diff --git a/lv/lv3200.cpp b/lv/lv3200.cpp index b7632d912..936c366ec 100755 --- a/lv/lv3200.cpp +++ b/lv/lv3200.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -69,6 +70,7 @@ protected: void spezza_riga(); void salva(); void annulla_operazioni(); + bool controlla(); void sistema_quantita(); void sistema_pacchi(); @@ -203,6 +205,21 @@ void TEvasione_msk::carica_righe() _buonori = doc; TSheet_field sheet = sfield(F_RIGHE); + sheet.row(-1); + //preparo l'array delle posizioni dei campi nello sheet + _posizioni.aggiungi("evaso", sheet.cid2index(S_EVASO)); + _posizioni.aggiungi("codart", sheet.cid2index(S_CODART)); + _posizioni.aggiungi("desrart", sheet.cid2index(S_ARTDESCR)); + _posizioni.aggiungi("causale", sheet.cid2index(S_CAUSALE)); + _posizioni.aggiungi("ritirato", sheet.cid2index(S_RITIRATO)); + _posizioni.aggiungi("dacons", sheet.cid2index(S_DACONS)); + _posizioni.aggiungi("consegnato", sheet.cid2index(S_CONSEGNATO)); + _posizioni.aggiungi("pacchi", sheet.cid2index(S_PACCHI)); + _posizioni.aggiungi("congpre", sheet.cid2index(S_CONGPRE)); + _posizioni.aggiungi("congatt", sheet.cid2index(S_CONGATT)); + _posizioni.aggiungi("rifbcon", sheet.cid2index(S_RIFBCON)); + _posizioni.aggiungi("rifbrit", sheet.cid2index(S_RIFBRIT)); + sheet.destroy(); for(int i = 1; i <= doc.rows(); i++) { @@ -510,6 +527,21 @@ void TEvasione_msk::annulla_operazioni() sheet.force_update(); } +//CONTROLLA: metodo che controlla se tutte le righe sono evase +bool TEvasione_msk::controlla() +{ + TSheet_field sheet = sfield(F_RIGHE); + + bool evaso = true; + + FOR_EACH_SHEET_ROW(sheet, r, row) + { + if (row->get(_posizioni.posizione("evaso")) != "X") + evaso = false; + } + return evaso; +} + //SISTEMA_QUANTITA: metodo che mantiene allineate le quantita consegnate e il numero //dei pacchi, moltiplicando il numero dei pacchi per i pezzi per pacco; se scrivo una quantità //a mano ed è prevista una evasione a pacchi, allora aggiorno il numero dei pacchi @@ -559,7 +591,6 @@ void TEvasione_msk::sistema_pacchi() //sottraendolo dal magazzino del pulito void TEvasione_msk::evadi_da_barcode() { - TRiga_pacco rp } //ON_FIELD_EVENT: metodo che gestisce gli eventi sui campi della maschera @@ -568,10 +599,60 @@ bool TEvasione_msk::on_field_event(TOperable_field& f, TField_event e, long joll //a seconda del bottone premuto esegui un metodo diverso switch (f.dlg()) { + case DLG_SELECT: + { + if (e == fe_button) + evadi_tutto(); + } + break; + case DLG_PREVIEW: + { + riordina_righe(); + } + break; + case DLG_ELABORA: + { + if (e == fe_button) + if (controlla()) + genera_documento(); + else + { + if(yesno_box(TR("ATTENZIONE: non tutte le righe sono evase. Si desidera continuare ugualmente?"))) + { + if(yesno_box(TR("Si desidera considerare evase tutte le righe?" + "(in caso contrario le righe evase parzialmente verranno spezzate su due righe)"))) + evadi_tutto(); + else + { + spezza_riga(); + genera_documento(); + } + } + else + riordina_righe(); + } + } + break; + case DLG_SAVEREC: + { + salva(); + } + break; + case DLG_CANCEL: + { + annulla_operazioni(); + } + break; case F_NDOC: { - if (e == fe_modify && f.get_long() > 0) - carica_righe(); + if (e == fe_modify) + if (f.get_long() > 0) + { + enable(F_RIGHE); + carica_righe(); + } + else + disable(F_RIGHE); } break; case F_DATADOC: @@ -586,6 +667,30 @@ bool TEvasione_msk::on_field_event(TOperable_field& f, TField_event e, long joll setta_campi_cliente(); } break; + case F_RIGHE: + { + if (e == fe_modify) + { + TSheet_field sheet = sfield(F_RIGHE); + if (sheet.items() > 0) + { + enable(DLG_SELECT); + enable(DLG_PREVIEW); + enable(DLG_ELABORA); + enable(DLG_SAVEREC); + enable(DLG_CANCEL); + } + else + { + disable(DLG_SELECT); + disable(DLG_PREVIEW); + disable(DLG_ELABORA); + disable(DLG_SAVEREC); + disable(DLG_CANCEL); + } + } + } + break; case S_CONSEGNATO: { if (e == fe_modify) @@ -631,20 +736,12 @@ TEvasione_msk::TEvasione_msk():TAutomask("lv3200a") int annoes = es.date2esc(data); set(F_ANNO, annoes); - //preparo l'array delle posizioni dei campi nello sheet - TSheet_field sheet = sfield(F_RIGHE); - _posizioni.aggiungi("evaso", sheet.cid2index(S_EVASO)); - _posizioni.aggiungi("codart", sheet.cid2index(S_CODART)); - _posizioni.aggiungi("desrart", sheet.cid2index(S_ARTDESCR)); - _posizioni.aggiungi("causale", sheet.cid2index(S_CAUSALE)); - _posizioni.aggiungi("ritirato", sheet.cid2index(S_RITIRATO)); - _posizioni.aggiungi("dacons", sheet.cid2index(S_DACONS)); - _posizioni.aggiungi("consegnato", sheet.cid2index(S_CONSEGNATO)); - _posizioni.aggiungi("pacchi", sheet.cid2index(S_PACCHI)); - _posizioni.aggiungi("congpre", sheet.cid2index(S_CONGPRE)); - _posizioni.aggiungi("congatt", sheet.cid2index(S_CONGATT)); - _posizioni.aggiungi("rifbcon", sheet.cid2index(S_RIFBCON)); - _posizioni.aggiungi("rifbrit", sheet.cid2index(S_RIFBRIT)); + disable(F_RIGHE); + disable(DLG_SELECT); + disable(DLG_PREVIEW); + disable(DLG_ELABORA); + disable(DLG_SAVEREC); + disable(DLG_CANCEL); _ndoc = 0; } diff --git a/lv/lv3200a.uml b/lv/lv3200a.uml index 3bde9a82c..86670ab1c 100755 --- a/lv/lv3200a.uml +++ b/lv/lv3200a.uml @@ -2,7 +2,37 @@ TOOLBAR "Topbar" 0 0 0 2 -#include +BUTTON DLG_SELECT 2 2 +BEGIN + PROMPT 1 1 "Tutti" + PICTURE TOOL_MULTISEL +END + +BUTTON DLG_PREVIEW 2 2 +BEGIN + PROMPT 1 1 "Controlla" + PICTURE TOOL_PREVIEW +END + +BUTTON DLG_ELABORA 2 2 +BEGIN + PROMPT 1 1 "Evadi" + PICTURE TOOL_ELABORA +END + +BUTTON DLG_SAVEREC 2 2 +BEGIN + PROMPT 1 1 "Salva" + PICTURE TOOL_SAVEREC +END + +BUTTON DLG_CANCEL 2 2 +BEGIN + PROMPT 1 1 "Annulla" + PICTURE TOOL_CANCEL +END + +#include ENDPAGE diff --git a/lv/lvmenu.men b/lv/lvmenu.men index b2263abe7..28a413570 100755 --- a/lv/lvmenu.men +++ b/lv/lvmenu.men @@ -109,7 +109,8 @@ Item_08 = "Fatture", "ve0 -1 -filtI1=2 -defNUM_FAT,TIPODOC_FAT,lv", "F" Item_09 = "Ordini Fornitori", "ve0 -1 -filtI1=3 -defNUM_ORF,TIPODOC_ORF,lv", "F" Item_10 = "Ordini Clienti", "ve0 -1 -filtI1=3 -defNUM_ORC,TIPODOC_ORC,lv", "F" Item_11 = "Fatturazione", "lv2 -4", "F" -Item_12 = "Stampe", [LVMENU_050] +Item_12 = "Evasione Buoni di Prelievo", "lv3 -1", "F" +Item_13 = "Stampe", [LVMENU_050] [LVMENU_050] Caption = "Stampe"