Skip to content

Commit 32546ad

Browse files
Version 11.5.4
1 parent 08dbf46 commit 32546ad

29 files changed

+1548
-375
lines changed

ManWork/LaTex/ppmanual.pdf

-10 Bytes
Binary file not shown.

ManWork/LaTex/ppmanual.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
\renewcommand{\CoverPageFooterInfo}{
2727
\parbox[b]{.5\textwidth}{
2828
\tiny �������� ������: \today \\
29-
������ �������: 11.4.9
29+
������ �������: 11.5.3
3030
}
3131
}
3232

Src/Android/StyloQ/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ android {
2323
applicationId "ru.petroglif.styloq"
2424
minSdkVersion 28
2525
targetSdkVersion 30
26-
versionCode 41
27-
versionName '0.3.1'
26+
versionCode 43
27+
versionName '0.3.3'
2828
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2929
signingConfig signingConfigs.release
3030
}

Src/Android/StyloQ/app/src/main/java/ru/petroglif/styloq/BusinessEntity.java

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//
44
package ru.petroglif.styloq;
55
import org.json.JSONArray;
6+
import org.json.JSONException;
67
import org.json.JSONObject;
78

89
import java.util.ArrayList;
@@ -419,4 +420,246 @@ public boolean FromJson(JSONObject jsObj)
419420
int Flags;
420421
String Name;
421422
}
423+
//
424+
// Descr: Структура, представляющая элемент списка долговых документов.
425+
// Используется для предоставления справки о долгах контрагента, в частности, в агентских заказах.
426+
//
427+
public static class DebtEntry {
428+
DebtEntry()
429+
{
430+
BillID = 0;
431+
BillDate = null;
432+
BillCode = null;
433+
AgentID = 0;
434+
Amount = 0.0;
435+
Debt = 0.0;
436+
}
437+
public boolean FromJson(JSONObject jsObj)
438+
{
439+
boolean ok = false;
440+
if(jsObj != null) {
441+
BillID = jsObj.optInt("billid", 0);
442+
{
443+
String date_text = jsObj.optString("billdate", null);
444+
if(SLib.GetLen(date_text) > 0)
445+
BillDate = SLib.strtodate(date_text, SLib.DATF_ISO8601);
446+
else
447+
BillDate = null;
448+
}
449+
BillCode = jsObj.optString("billcode", null);
450+
AgentID = jsObj.optInt("agentid", 0);
451+
Amount = jsObj.optDouble("amt", 0.0);
452+
Debt = jsObj.optDouble("debt", 0.0);
453+
ok = true;
454+
}
455+
return ok;
456+
}
457+
public JSONObject ToJsonObj()
458+
{
459+
JSONObject result = null;
460+
try {
461+
if(BillID > 0) {
462+
result = new JSONObject();
463+
result.put("billid", BillID);
464+
if(BillDate != null) {
465+
String date_text = BillDate.Format(SLib.DATF_ISO8601|SLib.DATF_CENTURY);
466+
if(SLib.GetLen(date_text) > 0)
467+
result.put("billdate", date_text);
468+
}
469+
if(SLib.GetLen(BillCode) > 0) {
470+
result.put("billcode", BillCode);
471+
}
472+
if(AgentID > 0)
473+
result.put("agentid", AgentID);
474+
result.put("amt", Amount);
475+
result.put("debt", Debt);
476+
}
477+
} catch(JSONException exn) {
478+
result = null;
479+
}
480+
return result;
481+
}
482+
int BillID;
483+
SLib.LDATE BillDate;
484+
String BillCode;
485+
int AgentID;
486+
double Amount;
487+
double Debt;
488+
}
489+
//
490+
// Descr: Долговая выписка по одному контрагенту.
491+
//
492+
public static class ArDebtList {
493+
ArDebtList()
494+
{
495+
ArID = 0;
496+
ArName = null;
497+
SvcTime = null;
498+
CliTime = null;
499+
Debt = 0.0;
500+
List = null;
501+
}
502+
public boolean FromJson(JSONObject jsObj)
503+
{
504+
boolean ok = false;
505+
int items_count = 0;
506+
if(jsObj != null) {
507+
{
508+
String time_text = jsObj.optString("time", null);
509+
// SvcTime
510+
}
511+
ArID = jsObj.optInt("arid", 0);
512+
ArName = jsObj.optString("arname", null);
513+
items_count = jsObj.optInt("count", 0);
514+
Debt = jsObj.optDouble("debt", 0.0);
515+
JSONArray js_list = jsObj.optJSONArray("debt_list");
516+
if(js_list != null && js_list.length() > 0) {
517+
List = new ArrayList<DebtEntry>();
518+
for(int i = 0; i < js_list.length(); i++) {
519+
final JSONObject js_item = js_list.optJSONObject(i);
520+
if(js_item != null) {
521+
DebtEntry entry = new DebtEntry();
522+
if(entry.FromJson(js_item))
523+
List.add(entry);
524+
}
525+
}
526+
}
527+
else
528+
List = null;
529+
ok = true;
530+
}
531+
return ok;
532+
}
533+
public JSONObject ToJsonObj()
534+
{
535+
JSONObject result = null;
536+
final int items_count = SLib.GetCount(List);
537+
int real_items_count = 0;
538+
try {
539+
result = new JSONObject();
540+
result.put("arid", ArID);
541+
if(SLib.GetLen(ArName) > 0)
542+
result.put("arname", ArName);
543+
if(SvcTime != null) {
544+
String dtm_text = SLib.datetimefmt(SvcTime, SLib.DATF_ISO8601 | SLib.DATF_CENTURY, 0);
545+
if(SLib.GetLen(dtm_text) > 0)
546+
result.put("time", dtm_text);
547+
}
548+
if(CliTime != null) {
549+
String dtm_text = SLib.datetimefmt(CliTime, SLib.DATF_ISO8601 | SLib.DATF_CENTURY, 0);
550+
if(SLib.GetLen(dtm_text) > 0)
551+
result.put("clitime", dtm_text);
552+
}
553+
result.put("count", items_count);
554+
result.put("debt", Debt);
555+
JSONArray js_list = new JSONArray();
556+
for(int i = 0; i < items_count; i++) {
557+
final DebtEntry entry = List.get(i);
558+
if(entry != null) {
559+
JSONObject js_entry = entry.ToJsonObj();
560+
if(js_entry != null) {
561+
js_list.put(js_entry);
562+
real_items_count++;
563+
}
564+
}
565+
}
566+
result.put("debt_list", js_list);
567+
} catch(JSONException exn) {
568+
result = null;
569+
}
570+
return result;
571+
}
572+
int ArID;
573+
String ArName;
574+
// Предусматриваем время сервиса и время клиента из-за того, что часы на них могут быть
575+
// рассинхронизированы.
576+
SLib.LDATETIME SvcTime; // Время формирования выписки сервисом
577+
SLib.LDATETIME CliTime; // Время получения выписки клиентом
578+
double Debt; // Итоговых долг по контрагенту
579+
ArrayList <DebtEntry> List;
580+
}
581+
//
582+
// Descr: Общий список долговых выписок по контрагентам.
583+
// Сохраняется в реестре StyloQ с типом документа StyloQDatabase.doctypDebtList
584+
//
585+
public static class DebtList {
586+
public static class ShortReplyEntry {
587+
ShortReplyEntry()
588+
{
589+
ArID = 0;
590+
Debt = 0.0;
591+
IsExpired = false;
592+
}
593+
int ArID;
594+
double Debt;
595+
boolean IsExpired;
596+
}
597+
DebtList()
598+
{
599+
List = null;
600+
}
601+
ShortReplyEntry GetDebt(int arID)
602+
{
603+
ShortReplyEntry result = null;
604+
if(arID > 0) {
605+
final int _c = SLib.GetCount(List);
606+
for(int i = 0; result == null && i < _c; i++) {
607+
final ArDebtList entry = List.get(i);
608+
if(entry != null && entry.ArID == arID) {
609+
result = new ShortReplyEntry();
610+
result.ArID = entry.ArID;
611+
result.Debt = entry.Debt;
612+
result.IsExpired = false; // @todo
613+
}
614+
}
615+
}
616+
return result;
617+
}
618+
boolean FromJson(JSONObject jsObj)
619+
{
620+
boolean ok = false;
621+
List = null;
622+
if(jsObj != null) {
623+
try {
624+
JSONArray js_list = jsObj.optJSONArray("list");
625+
if(js_list != null) {
626+
for(int i = 0; i < js_list.length(); i++) {
627+
ArDebtList entry = new ArDebtList();
628+
if(entry.FromJson(js_list.getJSONObject(i))) {
629+
if(List == null)
630+
List = new ArrayList<ArDebtList>();
631+
List.add(entry);
632+
ok = true;
633+
}
634+
}
635+
}
636+
} catch(JSONException exn) {
637+
ok = false;
638+
}
639+
}
640+
return ok;
641+
}
642+
JSONObject ToJsonObj()
643+
{
644+
JSONObject result = null;
645+
try {
646+
result = new JSONObject();
647+
JSONArray js_list = new JSONArray();
648+
final int _c = SLib.GetCount(List);
649+
for(int i = 0; i < _c; i++) {
650+
final ArDebtList entry = List.get(i);
651+
if(entry != null) {
652+
JSONObject js_entry = entry.ToJsonObj();
653+
if(js_entry != null)
654+
js_list.put(js_entry);
655+
}
656+
}
657+
result.put("list", js_list);
658+
} catch(JSONException exn) {
659+
result = null;
660+
}
661+
return result;
662+
}
663+
ArrayList <ArDebtList> List;
664+
}
422665
}

Src/Android/StyloQ/app/src/main/java/ru/petroglif/styloq/CmdROrderPrereqActivity.java

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class CmdROrderPrereqActivity extends SLib.SlActivity {
4545
private JSONArray QuotKindListData;
4646
private ViewDescriptionList VdlDocs; // Описание таблицы просмотра существующих заказов
4747
private ArrayList <Document.EditAction> DocEditActionList;
48+
private BusinessEntity.DebtList DbtL; // @v11.5.4
49+
private StyloQCommand.Item CmdQueryDebt; // @v11.5.4 Команда сервиса, используемая для запроса долгового реестра
4850
private void RefreshCurrentDocStatus()
4951
{
5052
if(CPM.TabList != null) {
@@ -65,6 +67,8 @@ public CmdROrderPrereqActivity()
6567
{
6668
CPM = new CommonPrereqModule(this);
6769
DocEditActionList = null;
70+
DbtL = null;
71+
CmdQueryDebt = null;
6872
}
6973
private void MakeSimpleSearchIndex()
7074
{
@@ -625,6 +629,8 @@ public Object HandleEvent(int ev, Object srcObj, Object subj)
625629
{
626630
Intent intent = getIntent();
627631
try {
632+
CmdQueryDebt = null;
633+
DbtL = null;
628634
CPM.GetAttributesFromIntent(intent);
629635
long doc_id = intent.getLongExtra("SvcReplyDocID", 0);
630636
String svc_reply_doc_json = null;
@@ -651,6 +657,13 @@ public Object HandleEvent(int ev, Object srcObj, Object subj)
651657
WharehouseListData = js_head.optJSONArray("warehouse_list");
652658
QuotKindListData = js_head.optJSONArray("quotkind_list");
653659
CPM.MakeClientListFromCommonJson(js_head);
660+
if(CPM.GetOption_UseCliDebt()) {
661+
StyloQDatabase.SecStoragePacket cmdl_pack = db.GetForeignSvcCommandList(CPM.SvcIdent);
662+
StyloQCommand.List cmd_list = cmdl_pack.GetCommandList();
663+
CmdQueryDebt = cmd_list.GetItemWithParticularBaseId(StyloQCommand.sqbcDebtList);
664+
if(CmdQueryDebt != null)
665+
DbtL = app_ctx.LoadDebtList(CPM.SvcIdent);
666+
}
654667
CPM.RestoreRecentDraftDocumentAsCurrent(); // @v11.4.0
655668
CPM.MakeCurrentDocList();
656669
MakeSimpleSearchIndex();
@@ -891,10 +904,24 @@ else if(vg_id == R.id.LAYOUT_ORDERPREPREQ_ORDR) {
891904
case R.id.orderPrereqClientsListView:
892905
if(SLib.IsInRange(ev_subj.ItemIdx, CPM.CliListData)) {
893906
View iv = ev_subj.RvHolder.itemView;
894-
CommonPrereqModule.CliEntry cur_entry = null;
895-
cur_entry = (CommonPrereqModule.CliEntry)CPM.CliListData.get(ev_subj.ItemIdx);
907+
CommonPrereqModule.CliEntry cur_entry = (CommonPrereqModule.CliEntry)CPM.CliListData.get(ev_subj.ItemIdx);
896908
final int cur_cli_id = cur_entry.JsItem.optInt("id", 0);
897909
SLib.SetCtrlString(iv, R.id.LVITEM_GENERICNAME, cur_entry.JsItem.optString("nm", ""));
910+
if(DbtL != null) {
911+
SLib.SetCtrlVisibility(iv, R.id.LAYOUT_ORDERPREREQ_CLI_DEBT, View.VISIBLE);
912+
BusinessEntity.DebtList.ShortReplyEntry de = DbtL.GetDebt(cur_cli_id);
913+
String text;
914+
if(de != null) {
915+
text = "debt" + ": " + SLib.formatdouble(de.Debt, 2);
916+
}
917+
else {
918+
text = "???";
919+
}
920+
SLib.SetCtrlString(iv, R.id.CTL_ORDERPREREQ_CLI_DEBT, text);
921+
}
922+
else {
923+
SLib.SetCtrlVisibility(iv, R.id.LAYOUT_ORDERPREREQ_CLI_DEBT, View.GONE);
924+
}
898925
SetListBackground(iv, a, ev_subj.ItemIdx, SLib.PPOBJ_PERSON, cur_cli_id);
899926
{
900927
ImageView ctl = (ImageView)iv.findViewById(R.id.ORDERPREREQ_CLI_EXPANDSTATUS);
@@ -1263,6 +1290,7 @@ else if(selected_search_oid.Type == SLib.PPOBJ_LOCATION) {
12631290
else {
12641291
SLib.SetupRecyclerListViewHolderAsClickListener(ev_subj.RvHolder, ev_subj.ItemView, R.id.buttonOrder);
12651292
SLib.SetupRecyclerListViewHolderAsClickListener(ev_subj.RvHolder, ev_subj.ItemView, R.id.ORDERPREREQ_CLI_EXPANDSTATUS);
1293+
SLib.SetupRecyclerListViewHolderAsClickListener(ev_subj.RvHolder, ev_subj.ItemView, R.id.CTL_ORDERPREREQ_CLI_DEBT); // @v11.5.4
12661294
result = ev_subj.RvHolder;
12671295
}
12681296
}
@@ -1350,6 +1378,33 @@ else if(item.AddrExpandStatus == 2) {
13501378
a.notifyItemChanged(ev_subj.ItemIdx);
13511379
}
13521380
}
1381+
else if(ev_subj.ItemView.getId() == R.id.CTL_ORDERPREREQ_CLI_DEBT) {
1382+
if(DbtL != null) {
1383+
final int cur_cli_id = item.JsItem.optInt("id", 0);
1384+
if(cur_cli_id > 0) {
1385+
BusinessEntity.DebtList.ShortReplyEntry de = DbtL.GetDebt(cur_cli_id);
1386+
if(de == null) {
1387+
if(CmdQueryDebt != null) {
1388+
// query
1389+
boolean force_query = true;
1390+
try {
1391+
JSONObject js_query = new JSONObject();
1392+
String cmd_text = CmdQueryDebt.Uuid.toString();
1393+
js_query.put("cmd", cmd_text);
1394+
js_query.put("time", System.currentTimeMillis());
1395+
js_query.put("arid", cur_cli_id);
1396+
app_ctx.RunSvcCommand(CPM.SvcIdent, CmdQueryDebt, js_query, force_query, this);
1397+
} catch(StyloQException | JSONException exn) {
1398+
;
1399+
}
1400+
}
1401+
}
1402+
else {
1403+
// detail
1404+
}
1405+
}
1406+
}
1407+
}
13531408
else {
13541409
// @v11.4.8 {
13551410
ArrayList <JSONObject> dlvr_loc_list = item.GetDlvrLocListAsArray();

Src/Android/StyloQ/app/src/main/java/ru/petroglif/styloq/CommandListActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public Object HandleEvent(int ev, Object srcObj, Object subj)
342342
if(ev_subj != null) {
343343
StyloQApp app_ctx = GetAppCtx();
344344
if(app_ctx != null) {
345-
boolean force_query = (ev == SLib.EV_LISTVIEWITEMLONGCLK) ? true : false;
345+
final boolean force_query = (ev == SLib.EV_LISTVIEWITEMLONGCLK) ? true : false;
346346
StyloQCommand.Item cmd_item = ListData.GetViewItem(ev_subj.ItemIdx);
347347
if(cmd_item != null) {
348348
if(StyloQCommand.IsCommandPending(SvcIdent, cmd_item) == 0) { // @v11.4.8

0 commit comments

Comments
 (0)