From 476f1a9b269887cfe4dcf289a138ea25cb6489e0 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 1 Aug 2003 07:55:21 +0000 Subject: [PATCH] Patch level : 2.0 546 Files correlati : cg2.exe Ricompilazione Demo : [ ] Commento : Corretta importazione da file .ini righe di prima nota: ignorava le righe con lo stesso conto delle precedenti git-svn-id: svn://10.65.10.50/trunk@11362 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg2100.cpp | 32 +++++++++++++++++++++----------- cg/cg2102.cpp | 11 ++++++++++- cg/cglib01.cpp | 2 +- 3 files changed, 32 insertions(+), 13 deletions(-) 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)