diff --git a/lv/lv0400.cpp b/lv/lv0400.cpp index c964b56cd..bbc61c031 100755 --- a/lv/lv0400.cpp +++ b/lv/lv0400.cpp @@ -191,7 +191,7 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly { TSheet_field& ss=(TSheet_field&)o; TToken_string& row=ss.row(ss.selected()); - for (short id=F_IMPFISART; id<=F_IMPFISART+30; id++) + for (short id=F_CODART; id<=F_CODART+35; id++) { const int pos=id2pos(id); if (pos>0) @@ -230,15 +230,18 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly } break; default: - if (e==fe_modify && o.dlg()>500 && o.dlg() != F_CAUSLAVDESCRIG) + if (e==fe_modify && is_running() && o.dlg()>500 && o.dlg() != F_CAUSLAVDESCRIG) { TSheet_field& ss = sfield(F_RIGHE); - const short rowid = o.dlg()-400; - const int index= ss.cid2index(rowid); const int sel=ss.selected(); - ss.row(sel).add(o.get(),index); - ss.force_update(sel); - + if (sel >= 0) + { + const short rowid = o.dlg()-400; + const int index= ss.cid2index(rowid); + ss.sheet_mask().set(rowid,o.get()); + ss.row(sel).add(o.get(),index); + ss.force_update(sel); + } } break; } @@ -347,8 +350,20 @@ int TContratti_app:: read(TMask& m) TISAM_recordset righeset(query); const TRectype& rec=righeset.cursor()->curr(); + TLocalisamfile magcli(LF_CLIFOGIAC); + + const TDate oggi(TODAY); + const int year=oggi.year(); + const long clifo=m.get_long(F_CODCF); + const int indsp=m.get_int(F_INDSPED); + TSheet_field& righe=m.sfield(F_RIGHE); TMask& msk=righe.sheet_mask(); + + const int coldotin=righe.cid2index(S_DOTIN); + const int coldotod=righe.cid2index(S_DOTOD); + const int coldottmp=righe.cid2index(S_DOTTMP); + righe.destroy(); for (bool ok=righeset.move_first(); ok; ok=righeset.move_next()) @@ -360,8 +375,44 @@ int TContratti_app:: read(TMask& m) if (fr!= NULL) row.add(fr->read(rec),righe.cid2index(f->dlg())); } + + bool found = false; + magcli.zero(); + + const TString codart=row.get(0); + + if (oggi.month() == 12) + { + magcli.put(CLIFOGIAC_ANNOES, year+1); + magcli.put(CLIFOGIAC_TIPOCF, 'C'); + magcli.put(CLIFOGIAC_CODCF, clifo); + magcli.put(CLIFOGIAC_INDSPED, indsp); + magcli.put(CLIFOGIAC_CODART, codart); + found = magcli.read()==NOERR; + } + if (!found) + { + magcli.zero(); + magcli.put(CLIFOGIAC_ANNOES, year); + magcli.put(CLIFOGIAC_TIPOCF, 'C'); + magcli.put(CLIFOGIAC_CODCF, clifo); + magcli.put(CLIFOGIAC_INDSPED, indsp); + magcli.put(CLIFOGIAC_CODART, codart); + found = magcli.read()==NOERR; + } + if (found) + { + const int dotin=magcli.get_int("DOTIN"); + const int dotod=magcli.get_int("DOTOD"); + const int dottmp=magcli.get_int("DOTTM"); + + row.add(dotin,coldotin); + row.add(dotod,coldotod); + row.add(dottmp,coldottmp); + } righe.check_row(righe.items()-1,3); } + righe.force_update(); } return err; @@ -386,6 +437,7 @@ void TContratti_app::save_rows(const TMask& m) build_query(m,query); TISAM_recordset righeset(query); TLocalisamfile& file=righeset.cursor()->file(); + for (bool ok=righeset.move_first(); ok; ok=righeset.move_next()) { const TString& art=righeset.get("CODART").as_string(); @@ -421,7 +473,7 @@ void TContratti_app::save_rows(const TMask& m) fr->write(row->get(pos),file.curr()); } } - const TString80 codart=file.get("CODART"); + const TString80 codart=row->get(0); if (codart.full()) { file.rewrite_write(); @@ -445,14 +497,23 @@ void TContratti_app::save_rows(const TMask& m) magcli.put(CLIFOGIAC_CODCF, clifo); magcli.put(CLIFOGIAC_INDSPED, indsp); magcli.put(CLIFOGIAC_CODART, codart); + found = magcli.read()==NOERR; + if (!found) + { + magcli.zero(); + magcli.put(CLIFOGIAC_ANNOES, year); + magcli.put(CLIFOGIAC_TIPOCF, 'C'); + magcli.put(CLIFOGIAC_CODCF, clifo); + magcli.put(CLIFOGIAC_INDSPED, indsp); + magcli.put(CLIFOGIAC_CODART, codart); + } } magcli.put(CLIFOGIAC_DOTIN,row->get(coldotin)); magcli.put(CLIFOGIAC_DOTOD,row->get(coldotod)); magcli.put(CLIFOGIAC_DOTTM,row->get(coldottmp)); magcli.rewrite_write(); - break; } - } + } //FOR_EACH_... } diff --git a/lv/lv0400.h b/lv/lv0400.h index f2403d139..885a73479 100755 --- a/lv/lv0400.h +++ b/lv/lv0400.h @@ -48,7 +48,9 @@ #define F_CODART 501 #define F_DESART 502 -#define F_CAUSLAVDESCRIG 512 +#define F_TIPOFORF 509 +#define F_CAUSLAVDESCRIG 511 +#define F_DOTTMP 512 #define F_PRZDTTMP 513 #define F_INDTTEMP 514 #define F_FIDTTEMP 515 @@ -57,29 +59,28 @@ #define F_VALCONV 518 #define F_ARTBLOC 519 #define F_CALCCONS 520 -#define F_TIPOFORF 521 -#define F_NOLCIC 522 -#define F_VCARTCLI 523 -#define F_MINCIC 524 -#define F_FORFPERCL 525 -#define F_CAUSLAVRIG 526 -#define F_RITAUDTTMPRIG 527 -#define F_FATTKG 528 -#define F_ARROT 529 +#define F_NOLCIC 521 +#define F_VCARTCLI 522 +#define F_MINCIC 523 +#define F_FORFPERCL 524 +#define F_CAUSLAVRIG 525 +#define F_RITAUDTTMPRIG 526 +#define F_FATTKG 527 +#define F_ARROT 528 #define F_PPCONF 530 #define S_CODART 101 #define S_DESCR 102 -#define S_UM 103 -#define S_CONG 104 -#define S_PREZZOST 105 -#define S_PREZZORN 106 -#define S_SCONTO 107 -#define S_DOTIN 108 -#define S_DOTOD 109 -#define S_DOTTMP 110 -#define S_CONSMESE 111 -#define S_CONSANNO 112 +#define S_CONG 103 +#define S_PREZZOST 104 +#define S_DOTIN 105 +#define S_DOTOD 106 +#define S_CONSMESE 107 +#define S_CONSANNO 108 +#define S_TIPOFORF 109 +#define S_PREZZORN 110 +#define S_SCONTO 111 +#define S_DOTTMP 112 #define S_PRZDTTMP 113 #define S_INDTTEMP 114 #define S_FIDTTEMP 115 @@ -88,15 +89,15 @@ #define S_VALCONV 118 #define S_ARTBLOC 119 #define S_CALCCONS 120 -#define S_TIPOFORF 121 -#define S_NOLCIC 122 -#define S_VCARTCLI 123 -#define S_MINCIC 124 -#define S_FORFPERCL 125 -#define S_CAUSLAV 126 -#define S_RITAUDTTMP 127 -#define S_FATTKG 128 -#define S_ARROT 129 +#define S_NOLCIC 121 +#define S_VCARTCLI 122 +#define S_MINCIC 123 +#define S_FORFPERCL 124 +#define S_CAUSLAV 125 +#define S_RITAUDTTMP 126 +#define S_FATTKG 127 +#define S_ARROT 128 +#define S_UM 129 #define S_PPCONF 130 #define S_CODCF 301 diff --git a/lv/lv0400a.uml b/lv/lv0400a.uml index 71e5623a2..a559d8525 100755 --- a/lv/lv0400a.uml +++ b/lv/lv0400a.uml @@ -111,18 +111,18 @@ END SPREADSHEET F_RIGHE -1 8 BEGIN PROMPT 0 3 "Righe contratto" - ITEM "Articolo@10F" - ITEM "Descrizione@30" - ITEM "UM@3" + ITEM "Articolo@8F" + ITEM "Descrizione@28" ITEM "Cong.@4" ITEM "Prezzo@8" - ITEM "Prezzo\nRinnovo@8" - ITEM "Sconto %@5" ITEM "Dot.\nIniz.@5" ITEM "Dot.\nOd.@5" - ITEM "Dot.\nTemp.@5" ITEM "Cons.\nmese@6" ITEM "Cons.\nanno@6" + ITEM "Tipo\nForfait@7" + ITEM "Prezzo\nRinnovo@8" + ITEM "Sconto %@5" + ITEM "Dot.\nTemp.@5" ITEM "Prezzo\nDot.Temp." ITEM "Inizio\nDot.Temp." ITEM "Fine\nDot.Temp." @@ -131,7 +131,6 @@ BEGIN ITEM "Val.\nconvenzionale@13" ITEM "Articolo\nbloccato@9" ITEM "Calcolo\nconsegnato@9" - ITEM "Tipo\nForfait@7" ITEM "Tipo\nnolo/ciclaggio@9" ITEM "Tipo\n% val.conv.@9" ITEM "Minimo\nciclaggio@9" @@ -140,6 +139,7 @@ BEGIN ITEM "Ritiro\naut.Dot.Temp.@12" ITEM "Fatturazione\na kg" ITEM "Arrotond." + ITEM "UM@3" END STRING F_CODART 20 @@ -189,7 +189,7 @@ END LISTBOX F_NOLCIC 1 20 BEGIN - PROMPT 40 14 "In base a " + PROMPT 39 14 "In base a " ITEM "I|Dot. iniziale" ITEM "O|Dot. odierna" GROUP 1 @@ -197,7 +197,7 @@ END LISTBOX F_VCARTCLI 1 20 BEGIN - PROMPT 40 14 "Per " + PROMPT 39 14 "Per " ITEM "N|Nessuno" ITEM "C|Cliente" ITEM "A|Articolo" @@ -244,20 +244,25 @@ BEGIN GROUP 3 END +NUMBER F_DOTTMP 9 +BEGIN + PROMPT 1 17 "Dot.temp." +END + CURRENCY F_PRZDTTMP 15 BEGIN - PROMPT 1 17 "Prezzo dot.tmp." + PROMPT 21 17 "Prezzo " FLAGS "U" END DATE F_INDTTEMP BEGIN - PROMPT 35 17 "Inizio " + PROMPT 45 17 "Inizio " END DATE F_FIDTTEMP BEGIN - PROMPT 60 17 "Fine " + PROMPT 64 17 "Fine " END NUMBER F_PPCONF 15 5