diff --git a/src/ve/ve1100.cpp b/src/ve/ve1100.cpp index fa25c3436..4c17b3443 100755 --- a/src/ve/ve1100.cpp +++ b/src/ve/ve1100.cpp @@ -1601,7 +1601,7 @@ void TStampaDoc_application::set_filter(TDocumento_form& frm) if (_clifo_sheet->checked(i)) { key.format("%06ld", _clifo_sheet->row(i).get_long(1)); // Formatta il codice - _clifo_sel.add(key, NULL); + _clifo_sel.add(key, key); } // NB: se _clifo_sel non contiene nulla, non viene effettuato alcun filtro su CLI/FO (non setta la funzione!!) filtro.format("TIPOCF==\"%c\"", _selection_mask->get(F_TIPOCF)[0]); diff --git a/src/ve/ve1700.cpp b/src/ve/ve1700.cpp index 266ccdaac..6f17e07e2 100644 --- a/src/ve/ve1700.cpp +++ b/src/ve/ve1700.cpp @@ -297,7 +297,7 @@ TCursor* TLista_documenti_recordset::cursor() const if (clifo.checked(i)) { key.format("%06ld", clifo.row(i).get_long(1)); // Formatta il codice - _clifo_sel.add(key, NULL); + _clifo_sel.add(key, key); } cur->set_filterfunction(clifo.checked() > 0 ? filter_clifo : NULL); // NB: se _clifo_sel non contiene nulla, non viene effettuato alcun filter su CLI/FO (non setta la funzione!!) diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index 8a86fef8c..be6d5c005 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -474,6 +474,7 @@ real TDocumento::imponibile_bolli_esenti() const } return imponibile_esente; } + bool TDocumento::bolli_esenti_dovuti() const { const real impmin_bolli = ini_get_real(CONFIG_STUDIO, "ve", "IMPMINBOLLI"); @@ -1041,53 +1042,59 @@ void TDocumento::set_riga_esenzione() esente = check_iva_plafond(row(i).get(RDOC_CODIVA)); if (!esente) safe_delete(_esenzione); - else - { - static TString4 _tipo_riga_es; - static TString80 _des_esenz; - static real _bollo_es; + else + { + static TString4 _tipo_riga_es; + static TString80 _des_esenz; + static real _bollo_es; - if (_tipo_riga_es.empty()) - { - TConfig conf(CONFIG_STUDIO, "ve"); - _tipo_riga_es = conf.get("TRESENZ", "ve"); - _bollo_es = (real)conf.get("BOLLIES", "ve"); - if (_tipo_riga_es.empty()) - { - _tipo_riga_es = "05"; - conf.set("TRESENZ", _tipo_riga_es); - warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione userà automaticamente il tipo %s", (const char*)_tipo_riga_es); - } - _des_esenz = conf.get("DESESENZ", "ve"); - if (_des_esenz.not_empty()) - _des_esenz.insert(" "); - _des_esenz.insert("Fattura non imponibile"); - } - if (_esenzione == nullptr) - _esenzione = new TRiga_documento(this, _tipo_riga_es); + if (_tipo_riga_es.empty()) + { + TConfig conf(CONFIG_STUDIO, "ve"); + _tipo_riga_es = conf.get("TRESENZ", "ve"); + _bollo_es = (real)conf.get("BOLLIES", "ve"); + if (_tipo_riga_es.empty()) + { + _tipo_riga_es = "05"; + conf.set("TRESENZ", _tipo_riga_es); + warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione userà automaticamente il tipo %s", (const char*)_tipo_riga_es); + } + _des_esenz = conf.get("DESESENZ", "ve"); + if (_des_esenz.not_empty()) + _des_esenz.insert(" "); + _des_esenz.insert("Fattura non imponibile"); + } - TString d = _des_esenz; - TToken_string plafs(get(DOC_PLAFOND), ','); - const int items = plafs.items(); + TString d = _des_esenz; + const int pos = d.len(); + TLi_manager & plaf = plafond(); + TString protinf; + TString protins; + TDate dataprot; + TString rif; + TString descr; + bool to_print; + int printed = 0; + real utilizzo; - d << (items > 1 ? TR("come dalle vostre dichiarazioni:\n") : TR(" come da vostra dichiarazione:\n")); - for (int i = 0; i < items; i++) - { - TToken_string plaf(plafs.get(i)); - real utilizzo = plaf.get_real(_plimporto); - - if (utilizzo != ZERO) - { - TToken_string key(plaf.get(_planno)); key.add(plaf.get(_plnumprot)); - const TRectype & rec_plaf = cache().get(LF_LETINT, key); - - d << TR("N. di protocollo di invio: ") << rec_plaf.get(LETINT_PROTINTF) << TR("-") << rec_plaf.get(LETINT_PROTINTS) << " del " << rec_plaf.get(LETINT_VSDATA); - if (ini_get_bool(CONFIG_DITTA, "li", "ADDUTILIZZATO")) + for (int i = plaf.get_plafond_row(*this, protinf, protins, dataprot, utilizzo, rif, descr, to_print); i >= 0; i = plaf.get_plafond_row(*this, protinf, protins, dataprot, utilizzo, rif, descr, to_print, i)) + { + if (to_print) + { + printed++; + d << descr << " : " << protinf << " - " << protins << TR(" del ") << dataprot; + if (utilizzo != ZERO && ini_get_bool(CONFIG_DITTA, "li", "ADDUTILIZZATO")) d << TR(" per € ") << utilizzo.stringa(0, decimals()); d << "\n"; - } - } - _esenzione->set_descr(d); + } + } + if (printed > 0) + { + if (_esenzione == nullptr) + _esenzione = new TRiga_documento(this, _tipo_riga_es); + d.insert(printed > 1 ? TR(" come dalle vostre dichiarazioni:\n") : TR(" come da vostra dichiarazione:\n"), pos); + _esenzione->set_descr(d); + } } } }