diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index ef590a5cd..668f8dd84 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -1532,18 +1532,28 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query) TClinton conto; ini2clinton(ini, conto); - int numrig = -1; // Normalmente aggiungi la riga in fondo - - // Cerca una riga che abbia gia' il tipo ed il conto richiesto - if (strchr(" DINT", tipo) != NULL) + int numrig = ini.get_int(RMV_NUMRIG)-1; + if (numrig != i) // Controllo se ho un numero riga valido { - if (tipo == 'I' || tipo == ' ') - numrig = clint2pos(conto, tipo); - else - numrig = type2pos(tipo); - if (numrig < 0) - tipo = ' '; - } + numrig = -1; // Normalmente aggiungi la riga in fondo + // Cerca una riga che abbia gia' il tipo ed il conto richiesto + if (strchr(" DINT", tipo) != NULL) + { + int nr = -1; + if (tipo == 'I' || tipo == ' ') + nr = clint2pos(conto, tipo); + else + nr = type2pos(tipo); + + if (nr < 0) + tipo = ' '; + else + { + if (get_cgs_imp(nr).is_zero()) + numrig = nr; + } + } + } TToken_string& riga = cg.row(numrig); diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 9760bba6e..8d96d09fe 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -713,7 +713,16 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) "Si desidera continuare ugualmente?"), i+1); if (!ok) return FALSE; } - + + if (app().is_transaction()) + { + // Controlla esistenza conti nelle transazioni + if (!c.find()) + return f.error_box("Il conto della riga %d non esiste", i+1); + if (!co.empty() && !co.find()) + return f.error_box("Il conto di contropartita della riga %d non esiste", i+1); + } + empty = FALSE; if (paga || nota) { diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index d98c29ffe..3d7296a2e 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -486,7 +486,7 @@ real TCodiceIVA::imposta(const real & imponibile, int ndec, const char * codval) real TCodiceIVA::scorpora(real& lordo, int ndec, const char* codval) const { const real percent = percentuale(); - real iva = (lordo * percent) / (percent + 100.0); + real iva = (lordo * percent) / (percent + CENTO); real imponibile = lordo - iva; switch (ndec)