diff --git a/ps/pd0610100.cpp b/ps/pd0610100.cpp index 8a588762d..49afd3a6d 100755 --- a/ps/pd0610100.cpp +++ b/ps/pd0610100.cpp @@ -26,6 +26,7 @@ public: void TTabmod_caf_msk::riempi_sheet() { const long cliente = get_long(F_CLIENTE); + const int indsp = get_int(F_INDSPED); TSheet_field& sheet = sfield(F_SHEET); sheet.destroy(); if (cliente <= 0) @@ -33,28 +34,39 @@ void TTabmod_caf_msk::riempi_sheet() sheet.force_update(); return; } - TString8 codcli; - codcli.format("%06ld", cliente); + TString8 codcf; codcf.format("%06ld", cliente); + TString4 indsped; indsped.format("%03d", indsp); + TString16 key; key << codcf << indsped; TString query; query << "USE &CAF\n" - << "FROM CODTAB=\"" << codcli << "\"\n" - << "TO CODTAB=\"" << codcli << "\""; + << "FROM CODTAB=\"" << key << "\"\n" + << "TO CODTAB=\"" << key << "\""; TISAM_recordset caf_query(query); for (bool ok = caf_query.move_first(); ok; ok = caf_query.move_next()) { const TRectype& caf = caf_query.cursor()->curr(); const TString80 codtab = caf.get("CODTAB"); const TString8 forn1 = caf.get("I0"); - const TString8 forn2 = caf.get("I1"); + const TString4 lis1 = caf.get("S4"); + const TString4 con1 = caf.get("S5"); + const TString8 forn2 = caf.get("I1"); + const TString4 lis2 = caf.get("S6"); + const TString4 con2 = caf.get("S7"); + TToken_string& row = sheet.row(-1); - row.add(codtab.left(6), sheet.cid2index(S_CLIENTE)); - row.add(codtab.mid(6), sheet.cid2index(S_ARTICOLO)); - row.add(forn1, sheet.cid2index(S_FORN1)); - row.add(forn2, sheet.cid2index(S_FORN2)); + row.add(codtab.left(6), sheet.cid2index(S_CLIENTE)); + row.add(codtab.mid(6, 3), sheet.cid2index(S_INDSPED)); + row.add(codtab.mid(9), sheet.cid2index(S_ARTICOLO)); + row.add(forn1, sheet.cid2index(S_FORN1)); + row.add(lis1, sheet.cid2index(S_LIS1)); + row.add(con1, sheet.cid2index(S_CON1)); + row.add(forn2, sheet.cid2index(S_FORN2)); + row.add(lis2, sheet.cid2index(S_LIS2)); + row.add(con2, sheet.cid2index(S_CON2)); + sheet.disable_cell(sheet.items()-1 , sheet.cid2index(S_ARTICOLO)); sheet.disable_cell(sheet.items()-1 , sheet.cid2index(S_DESART)); sheet.check_row(sheet.items()-1); - } sheet.force_update(); } @@ -62,6 +74,7 @@ void TTabmod_caf_msk::riempi_sheet() void TTabmod_caf_msk::aggiungi_riga() { const TString8 cliente = get(F_CLIENTE); + const TString4 indsped = get(F_INDSPED); if (cliente.empty()) return; @@ -69,6 +82,8 @@ void TTabmod_caf_msk::aggiungi_riga() TToken_string& row = sheet.row(-1); row.add(cliente, sheet.cid2index(S_CLIENTE)); + row.add(indsped, sheet.cid2index(S_INDSPED)); + sheet.enable_cell(sheet.items() - 1, sheet.cid2index(S_ARTICOLO)); sheet.enable_cell(sheet.items() - 1, sheet.cid2index(S_DESART)); sheet.force_update(); @@ -83,17 +98,29 @@ void TTabmod_caf_msk::registra() { caf.zero(); TToken_string& row = *(TToken_string*)riga; + TString8 codcf; codcf.format("%06d", row.get_long(sheet.cid2index(S_CLIENTE))); + TString4 indsped; indsped.format("%03d", row.get_int(sheet.cid2index(S_INDSPED))); TString80 codtab; - codtab << row.get(sheet.cid2index(S_CLIENTE)); + codtab << codcf; + codtab << indsped; codtab << row.get(sheet.cid2index(S_ARTICOLO)); const long forn1 = row.get_long(sheet.cid2index(S_FORN1)); const long forn2 = row.get_long(sheet.cid2index(S_FORN2)); + const TString4 list1 = row.get(sheet.cid2index(S_LIS1)); + const TString4 list2 = row.get(sheet.cid2index(S_LIS2)); + const TString4 cont1 = row.get(sheet.cid2index(S_CON1)); + const TString4 cont2 = row.get(sheet.cid2index(S_CON2)); + caf.put("CODTAB", codtab); if (forn1 > 0 || forn2 > 0) { - caf.put("I0", forn1); - caf.put("I1", forn2); + caf.put("S4", list1); + caf.put("S5", cont1); + caf.put("S6", list2); + caf.put("S7", cont2); + caf.put("I0", forn1); + caf.put("I1", forn2); caf.rewrite_write(); } else @@ -111,6 +138,7 @@ bool TTabmod_caf_msk::on_field_event(TOperable_field& o, TField_event e, long jo { reset(F_CLIENTE); reset(F_RAGSOC); + reset(F_INDSPED); sfield(F_SHEET).destroy(); return false; } @@ -131,6 +159,7 @@ bool TTabmod_caf_msk::on_field_event(TOperable_field& o, TField_event e, long jo } break; case F_CLIENTE: + case F_INDSPED: if(e == fe_modify) riempi_sheet(); break; diff --git a/ps/pd0610100a.h b/ps/pd0610100a.h index cc38c1dc5..2d96b93e3 100755 --- a/ps/pd0610100a.h +++ b/ps/pd0610100a.h @@ -1,12 +1,22 @@ //Definizione campi per maschera pd0610100a #define F_CLIENTE 201 #define F_RAGSOC 202 -#define F_SHEET 203 +#define F_INDSPED 203 +#define F_SHEET 204 #define S_CLIENTE 101 -#define S_ARTICOLO 102 -#define S_DESART 103 -#define S_FORN1 104 -#define S_RAGSOC1 105 -#define S_FORN2 106 -#define S_RAGSOC2 107 \ No newline at end of file +#define S_INDSPED 102 +#define S_ARTICOLO 103 +#define S_DESART 104 +#define S_FORN1 105 +#define S_RAGSOC1 106 +#define S_LIS1 107 +#define S_DESLIS1 996 +#define S_CON1 108 +#define S_DESCON1 997 +#define S_FORN2 109 +#define S_RAGSOC2 110 +#define S_LIS2 111 +#define S_DESLIS2 998 +#define S_CON2 112 +#define S_DESCON2 999 \ No newline at end of file diff --git a/ps/pd0610100a.uml b/ps/pd0610100a.uml index 7eb78b0a9..0f4475c09 100755 --- a/ps/pd0610100a.uml +++ b/ps/pd0610100a.uml @@ -45,16 +45,34 @@ BEGIN CHECKTYPE REQUIRED END -SPREADSHEET F_SHEET 80 10 +NUMBER F_INDSPED 3 BEGIN - PROMPT 2 3 "Articoli/Fornitori" + PROMPT 2 2 "Indirizzo di spedizione" + USE LF_INDSP + INPUT TIPOCF "C" SELECT + INPUT CODCF F_CLIENTE SELECT + DISPLAY "Codice" CODIND + DISPLAY "Indirizzo" INDIR + DISPLAY "CAP" CAP + DISPLAY "Località" LOCALITA + OUTPUT F_INDSPED CODIND +END + +SPREADSHEET F_SHEET +BEGIN + PROMPT 2 4 "Articoli/Fornitori" ITEM "Cliente@6" + ITEM "Ind. Sped." ITEM "Cod.articolo@20" ITEM "Descrizione@45" ITEM "Fornitore 1" ITEM "Ragione sociale@45" + ITEM "Listino 1" + ITEM "Contratto 1" ITEM "Fornitore 2" ITEM "Ragione sociale@45" + ITEM "Listino 2" + ITEM "Contratto 2" END ENDPAGE @@ -65,13 +83,19 @@ PAGE "Articoli/Fornitori" -1 -1 80 18 NUMBER S_CLIENTE 6 BEGIN - PROMPT 2 2 "" + PROMPT 2 2 "Codice Cliente " FLAGS "ZD" -END +END + +NUMBER S_INDSPED 3 +BEGIN + PROMPT 25 2 "Indirizzo di spedizione " + FLAGS "ZD" +END STRING S_ARTICOLO 20 BEGIN - PROMPT 2 3 "Cod. art. " + PROMPT 2 4 "Cod. art. " FLAG "UG" USE LF_ANAMAG INPUT CODART S_ARTICOLO @@ -84,7 +108,7 @@ END STRING S_DESART 50 45 BEGIN - PROMPT 2 4 "Des. art. " + PROMPT 2 5 "Des. art. " USE LF_ANAMAG KEY 2 INPUT DESCR S_DESART DISPLAY "Descrizione@45" DESCR @@ -95,7 +119,7 @@ END NUMBER S_FORN1 6 BEGIN - PROMPT 2 5 "Fornit. 1 " + PROMPT 2 6 "Fornit. 1 " USE LF_CLIFO INPUT TIPOCF "F" SELECT INPUT CODCF S_FORN1 @@ -108,7 +132,7 @@ END STRING S_RAGSOC1 50 45 BEGIN - PROMPT 25 5 "" + PROMPT 25 6 "" USE LF_CLIFO KEY 2 INPUT TIPOCF "F" SELECT INPUT RAGSOC S_RAGSOC1 @@ -118,9 +142,52 @@ BEGIN CHECKTYPE NORMAL END +STRING S_LIS1 3 +BEGIN + PROMPT 2 7 "Listino 1 " + USE LF_CONDV + INPUT TIPO "L" + INPUT CATVEN "" + INPUT COD S_LIS1 + DISPLAY "Codice" COD + DISPLAY "Descrizione@50" DESCR + OUTPUT S_LIS1 COD + OUTPUT S_DESLIS1 DESCR + FLAGS "U" + CHECKTYPE NORMAL +END + +STRING S_DESLIS1 45 +BEGIN + PROMPT 25 7 "" + FLAGS "D" +END + +STRING S_CON1 3 +BEGIN + PROMPT 18 8 "Contratto 1 " + USE LF_CONDV + INPUT TIPO "C" + INPUT TIPOCF "F" + INPUT CODCF S_FORN1 SELECT + INPUT COD S_CON1 + DISPLAY "Tipo" TIPOCF + DISPLAY "Forn" CODCF + DISPLAY "Codice" COD + DISPLAY "Descrizione@35" DESCR + OUTPUT S_CON1 COD + OUTPUT S_DESCON1 DESCR +END + +STRING S_DESCON1 45 +BEGIN + PROMPT 25 8 "" + FLAGS "D" +END + NUMBER S_FORN2 6 BEGIN - PROMPT 2 6 "Fornit. 2 " + PROMPT 2 9 "Fornit. 2 " USE LF_CLIFO INPUT TIPOCF "F" SELECT INPUT CODCF S_FORN2 @@ -133,7 +200,7 @@ END STRING S_RAGSOC2 50 45 BEGIN - PROMPT 25 6 "" + PROMPT 25 9 "" USE LF_CLIFO KEY 2 INPUT TIPOCF "F" SELECT INPUT RAGSOC S_RAGSOC2 @@ -143,6 +210,49 @@ BEGIN CHECKTYPE NORMAL END +STRING S_LIS2 3 +BEGIN + PROMPT 2 10 "Listino 1 " + USE LF_CONDV + INPUT TIPO "L" + INPUT CATVEN "" + INPUT COD S_LIS2 + DISPLAY "Codice" COD + DISPLAY "Descrizione@50" DESCR + OUTPUT S_LIS2 COD + OUTPUT S_DESLIS2 DESCR + FLAGS "U" + CHECKTYPE NORMAL +END + +STRING S_DESLIS2 45 +BEGIN + PROMPT 25 10 "" + FLAGS "D" +END + +STRING S_CON2 3 +BEGIN + PROMPT 18 11 "Contratto 1 " + USE LF_CONDV + INPUT TIPO "C" + INPUT TIPOCF "F" + INPUT CODCF S_FORN1 SELECT + INPUT COD S_CON2 + DISPLAY "Tipo" TIPOCF + DISPLAY "Forn" CODCF + DISPLAY "Codice" COD + DISPLAY "Descrizione@35" DESCR + OUTPUT S_CON2 COD + OUTPUT S_DESCON2 DESCR +END + +STRING S_DESCON2 45 +BEGIN + PROMPT 25 11 "" + FLAGS "D" +END + ENDPAGE TOOLBAR "" 0 0 0 2