diff --git a/cg/cg4400.h b/cg/cg4400.h index 6ee87c826..68b947e5f 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -67,6 +67,8 @@ class CG4400_application : public TPrintapp TString _tipodoc, _descr_doc, _codlib, _codice_vidi; TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis; TFilename _t; + + TParagraph_string* _desc27; messaggio _scelta; protected: diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index e973d9050..5aedf174c 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -149,6 +149,20 @@ void Visliq_app::reset_fields() _mask->field(F_RAGSOC).set(""); } +bool Visliq_app::select_butt(TMask& m) +{ + if (_ditte->run() == K_ENTER) + { + TToken_string& row = _ditte->row(_ditte->selected()); + m.field(F_CODDITTA).set(row.get(0)); + m.field(F_RAGSOC).set(row.get(1)); + set_freqviva(row.get(2)); + set_mask_freq(m); + return TRUE; + } + return FALSE; +} + void Visliq_app::build_nomiditte() { _nomiditte.destroy(); @@ -251,6 +265,10 @@ bool Visliq_app::menu(MENU_TAG m) bool Visliq_app::set_ditta(TMask_field& f, KEY k) { bool found = TRUE; + + if (k == K_F9) + return app().select_butt(f.mask()); + if (k == K_TAB && f.focusdirty()) { found = FALSE; @@ -286,6 +304,10 @@ bool Visliq_app::set_ditta(TMask_field& f, KEY k) bool Visliq_app::set_ragsoc(TMask_field& f, KEY k) { bool found = TRUE; + + if (k == K_F9) + return app().select_butt(f.mask()); + if (k == K_TAB && f.focusdirty()) { found = FALSE; @@ -400,16 +422,7 @@ bool Visliq_app::vis_liq() while ((k = m.run()) != K_ESC) { if (k == DLG_SELECT) - { - if (_ditte->run() == K_ENTER) - { - TToken_string& row = _ditte->row(_ditte->selected()); - m.field(F_CODDITTA).set(row.get(0)); - m.field(F_RAGSOC).set(row.get(1)); - set_freqviva(row.get(2)); - set_mask_freq(m); - } - } + select_butt(m); else if (k == K_ENTER) { long dtt = m.get_long(F_CODDITTA); @@ -809,6 +822,8 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver long lrettd = vsw->search("Rettifiche IVA a debito", x,line,TRUE); long lacct = vsw->search("Versamento acconto dicembre",x,line,TRUE); long lrimb = vsw->search("Iva chiesta a rimborso",x,line,TRUE); + long lintr = vsw->search("Interesse",x,line,TRUE); + long livdv = vsw->search("IVA DOVUTA",x,line,TRUE); if (wasdebt != 0) lvers = vsw->search(wasdebt < 0 ? "CREDITO ATTUALE" : "IVA DA VERSARE", @@ -847,12 +862,23 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver ln.overwrite(abs(risul).string("###.###.###.###"), 58); } else if (risul.sign() > 0) - { + { + // aggiorna l'interesse solo se c'era dall'inizio, non + // se si e' passati da credito a debito (this is a limit + // and not a feature) + if (lintr > 0) + vsw->replace(lintr, intr.string("###.###.###.###"), 75); + if (livdv > 0) + { + vsw->replace(livdv, risul.string("###.###.###.###"), 75); + risul += intr; + } ln.overwrite("IVA DA VERSARE", 23); ln.overwrite(risul.string("###.###.###.###"), 75); - } - vsw->replace(lvers, ln, 0); + } + vsw->replace(lvers, ln, 0); + vsw->refresh(); } void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field* sv) @@ -977,8 +1003,7 @@ void Visliq_app::write_del() int ctri = _freqviva == "M" ? 6000 + month : 6030 + (month/3); _del->put("S6", format("%d",ctri)); - if (wasdel) _del->rewrite(); - else _del->write(); + _del->rewrite(); } @@ -1199,15 +1224,14 @@ void Visliq_app::write_general(TMask& m) // write delega acconto if (ac_mod) { - bool was = look_del(12,7,TRUE); + look_del(12,7,TRUE); _del->put("R0",nacct); _del->put("R1",""); _del->put("S7",anabi); _del->put("S8",ancab); _del->put("S9",ancon); _del->put("S6","6013"); - if (was) _del->rewrite(); - else _del->write(); + _del->rewrite(); } } diff --git a/cg/cg5500.h b/cg/cg5500.h index c57e29d05..a3866a2f8 100755 --- a/cg/cg5500.h +++ b/cg/cg5500.h @@ -89,7 +89,8 @@ public: // 2 palle TMask* get_main_mask() { return _mask; } - + bool select_butt(TMask& m); + // riaggiusta la liquidazione del mese dato void recalc_liq_data(TViswin* v, real& rimb, real& rett, real& vers, real& acc, TString& d1, TString& d2, TDate& date, TString&