diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 4c069366e..5eb493f63 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -464,16 +464,13 @@ void TPrimanota_application::cgs_pack() bool TPrimanota_application::ci_sono_importi(const TSheet_field& s) const { - if (s.items() > 0) + TImporto imp; + FOR_EACH_SHEET_ROW(s, r, riga) if (riga && !riga->empty_items()) { - TImporto imp; - FOR_EACH_SHEET_ROW(s, r, riga); - { - imp = *riga; - if (!imp.is_zero()) - return true; - } - } + imp = *riga; + if (!imp.is_zero()) + return true; + } return false; } @@ -3230,16 +3227,19 @@ bool TPrimanota_application::quadratura_handler(TMask_field& f, KEY key) TSheet_field& shiva = m.sfield(F_SHEETIVA); const real totdoc = app().totale_documento(); - real totdist; TGeneric_distrib distrib(totdoc, TCurrency::get_firm_dec()); - FOR_EACH_SHEET_ROW(shiva, o, orow) + real totdist; + if (!shiva.empty()) { - const real o_imponibile = orow->get(0); - const real o_imposta = orow->get(3); + FOR_EACH_SHEET_ROW(shiva, o, orow) + { + const real o_imponibile = orow->get(0); + const real o_imposta = orow->get(3); - if (!o_imponibile.is_zero() || !o_imposta.is_zero()) - distrib.add(o_imponibile + o_imposta); - totdist += o_imponibile + o_imposta; + if (!o_imponibile.is_zero() || !o_imposta.is_zero()) + distrib.add(o_imponibile + o_imposta); + totdist += o_imponibile + o_imposta; + } } if (app()._perc_attesa_fld.full()) {