diff --git a/src/tf/tf0200.cpp b/src/tf/tf0200.cpp index e96bfd85e..4fd26190f 100644 --- a/src/tf/tf0200.cpp +++ b/src/tf/tf0200.cpp @@ -168,7 +168,6 @@ void calcolaCreditoPrec(real& creprec, real& creaprec, bool mensile, int anno, i * Questi geni hanno messo la possibilità di mettere un valore <0 se voglio utilizzare del credito precedente */ TRectype rowLia = getLIA(anno); - if(mensile || (!mensile && ((mese - 1) % 3) == 0)) { TRelation ivaLiq(LF_IVALIQ); @@ -176,27 +175,31 @@ void calcolaCreditoPrec(real& creprec, real& creaprec, bool mensile, int anno, i // Fino al mese precedente TRectype to(ivaLiq.curr()); to.put("ANNO", anno); to.put("MESE", mese - 1); - TSorted_cursor curLiq(&ivaLiq, "MESE-", "GENERATA!=\"G\"", 1, &from, &to); + TCursor curLiq(&ivaLiq, "GENERATA!=\"G\"", 1, &from, &to); bool trovato = false; for(curLiq = 0; curLiq.pos() < curLiq.items(); ++curLiq) { TRectype rowLiq = curLiq.curr(); - if(rowLiq.get_int("MESE") >= mese) continue; // Perchè li prende lo stesso? - - if(rowLiq.get_real("IVADOVC") > ZERO) - creprec += rowLiq.get_real("IVADOVC"); - else - creprec -= rowLiq.get_real("IVADOV"); - - // Sommo finchè non trovo il primo valore positivo - if(!trovato) - creaprec = creaprec + rowLiq.get_real("CREAPREC"); - - // Se è > 0 Ho trovato il primo valore messo nella dichiarazione - if(rowLiq.get_real("CREAPREC") > ZERO) + if(rowLiq.get_int("MESE") >= mese) break; // Perchè li prende lo stesso? + + if(rowLiq.get_real("IVAVER") == ZERO) { - trovato = true; + creprec = rowLiq.get_real("CREPREC") + rowLiq.get_real("IVADOVC"); + // Possono esserci valori negativi, nel caso vanno sommati altrimenti sostituisco + if(rowLiq.get_real("CREAPREC") < ZERO) + creaprec += rowLiq.get_real("CREAPREC"); + else + creaprec = rowLiq.get_real("CREAPREC"); } + else + { + creprec = ZERO; + creaprec = ZERO; + } + + // Se il credito precedente è almeno una volta positivo flaggo trovato + if(rowLiq.get_real("CREAPREC") > ZERO) + trovato = true; } /* Se non ho trovato nessun valore positivo (i negativi senza nessun positivo prima non sono validi) * vado a leggere la liquidazione di quest'anno */ @@ -204,12 +207,6 @@ void calcolaCreditoPrec(real& creprec, real& creaprec, bool mensile, int anno, i { creaprec = rowLia.get_real("R0"); } - /* Se ho esaurito il credito del periodo precedente lo sottraggo a quello dell'anno precedente e lo azzero */ - if(creprec < ZERO) - { - creaprec += creprec; - creprec = ZERO; - } } } diff --git a/src/tf/tf0500.cpp b/src/tf/tf0500.cpp index 66788c9e4..95f92db12 100644 --- a/src/tf/tf0500.cpp +++ b/src/tf/tf0500.cpp @@ -85,6 +85,11 @@ bool TIvaSend_msk::on_field_event(TOperable_field& o, TField_event e, long jolly { switch(o.dlg()) { + case F_PATH: + if(e == fe_init) + { + set(F_PATH, ini_get_string(CONFIG_STUDIO, "tf", "path_invio")); + } case F_ANNO: if(e == fe_modify) { @@ -199,6 +204,8 @@ bool TIvaSend_app::generate(TIvaSend_msk& msk) if(!file.is_open()) error_box(TR("Impossibile aprire il file alla posizione %s", path)); + else + ini_set_string(CONFIG_STUDIO, "tf", "path_invio", msk.get(F_PATH)); TToken_string testata(getTestata(msk)); diff --git a/src/tf/tf0500a.uml b/src/tf/tf0500a.uml index 3af3dd493..0c630d09c 100644 --- a/src/tf/tf0500a.uml +++ b/src/tf/tf0500a.uml @@ -141,12 +141,5 @@ BEGIN FLAGS "D" END -STRING DLG_PROFILE 256 -BEGIN - PROMPT 1 -1 "Profilo " - PSELECT - FLAGS "H" -END - ENDPAGE ENDMASK \ No newline at end of file