diff --git a/cg/cg3700.cpp b/cg/cg3700.cpp index 3e42372e5..30a337c53 100755 --- a/cg/cg3700.cpp +++ b/cg/cg3700.cpp @@ -67,8 +67,8 @@ class TLista_fatture : public TPrintapp TString _ragsoc; TDate _date_from, _date_to; // Estremi data - real //_tot_doc, //Non ha senso tenere il totale documenti visto che la stampa rappresenta le righe: - //infatti uno stesso documento puo' comparire per piu' tipi indetraibilita' o tipi costo/ricavo diversi + real _tot_doc, //Non ha senso tenere il totale documenti visto che la stampa rappresenta le righe: + //infatti uno stesso documento puo' comparire per piu' tipi indetraibilita' o tipi costo/ricavo diversi _tot_imp, _tot_iva, // Totali complessivi della stampa _tp_doc, @@ -181,23 +181,34 @@ bool TLista_fatture::filter_func2(const TRelation *r) bool TLista_fatture::date_handler(TMask_field& f, KEY key) { - if (f.to_check(key) && key == K_ENTER) + if (key == K_TAB && f.mask().is_running()) + { + if (f.get().empty()) + if (f.dlg() == FLD_DATE_FROM) + return f.error_box("La data di inizio e' obbligatoria."); + else + return f.error_box("La data di fine e' obbligatoria."); + } + if (f.to_check(key)) { TMask& m = f.mask(); TDate da(m.get_date(FLD_DATE_FROM)); TDate a(m.get_date(FLD_DATE_TO)); - if (da > a) - return f.error_box("La data di fine deve essere minore della data di inizio."); - if (da.year() != a.year()) - return f.error_box("Le date debbono appartenere allo stesso anno."); + if (a.ok() && da.ok()) // Solo se sono entrambi compilati + { + if (da > a) + return f.error_box("La data di fine deve essere maggiore della data di inizio."); + if (da.year() != a.year()) + return f.error_box("Le date devono appartenere allo stesso anno."); + } } return TRUE; } bool TLista_fatture::mix_handler(TMask_field& f, KEY key) { - if (f.to_check(key) && key == K_ENTER) + if (f.to_check(key)) { TMask& m = f.mask(); short dlg1 = f.dlg(); @@ -460,7 +471,7 @@ bool TLista_fatture::preprocess_page(int file, int counter) { if (_tipo != intra) { - //_tot_doc += doc; + _tot_doc += doc; _tp_doc += doc; } _print_all = TRUE; @@ -499,8 +510,8 @@ print_action TLista_fatture::postprocess_print(int file, int counter) p.print(_pr); _pr.set_style(boldstyle); _pr.put("TOTALE GENERALE :",42); - //if (_tot_doc != 0.0) - // _pr.put(_tot_doc.string("###.###.###.###"),73); + if (_tot_doc != 0.0) + _pr.put(_tot_doc.string("###.###.###.###"),73); if (_tot_imp != 0.0) _pr.put(_tot_imp.string("###.###.###.###"),89); if (_tot_iva != 0.0) @@ -616,22 +627,22 @@ void TLista_fatture::set_the_header() s.format("Dalla data %s Alla data %s",(const char*)s1,(const char*)s2); if (_tipo == indetraibile || _tipo == costo_ricavo) { - s << "@45g Dal c. fornitore "; + s << "@45g Dal fornitore "; if (_from_cf == 0L && _to_cf == 999999L) - s << " Al c. fornitore"; + s << " Al fornitore"; else { s << _from_cf; - s << " Al c. fornitore "; + s << " Al fornitore "; s << _to_cf; } - s << "@94g Dal c. registro "; + s << "@94g Dal registro "; if (_from_reg.empty() && _to_reg == "~~~") - s << " Al c. registro"; + s << " Al registro"; else { s << _from_reg; - s << " Al codice registro "; + s << " Al registro "; s << _to_reg; } if (_tipo == costo_ricavo) @@ -771,6 +782,7 @@ bool TLista_fatture::set_print(int m) // Ciclo sulle ditte slezionate const long items = _ditte->items(); + printer().open(); for (int i = 0; i < items; i++) { if (_ditte->checked(i)) @@ -778,7 +790,7 @@ bool TLista_fatture::set_print(int m) _tipocrprec = -1; _tipodetprec = -1; _numregprec = -1L; - //_tot_doc = 0.0; + _tot_doc = 0.0; _tot_imp = 0.0; _tot_iva = 0.0; _tp_doc = 0.0; _tp_imp = 0.0; _tp_iva = 0.0; _one_printed = FALSE; _print_all = TRUE; diff --git a/cg/cg3700a.uml b/cg/cg3700a.uml index 4158421c2..cad532626 100755 --- a/cg/cg3700a.uml +++ b/cg/cg3700a.uml @@ -5,15 +5,11 @@ PAGE "Lista fatture per IVA indetraibile" -1 -1 68 10 DATE FLD_DATE_FROM BEGIN PROMPT 1 2 "Dalla data " - VALIDATE NOT_EMPTY_FUNC - WARNING "Le data di inizio e' obbligatoria" END DATE FLD_DATE_TO BEGIN PROMPT 1 3 "Alla data " - VALIDATE NOT_EMPTY_FUNC - WARNING "Le data di fine e' obbligatoria" END GROUPBOX DLG_NULL 40 5