From cbae6c8fadc600f1fcd5b17b4ebe03696bfecb9c Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Thu, 12 Oct 2023 16:53:28 +0200 Subject: [PATCH] Patch level : 12.00 1286 Files correlati : cg3.exe Commento : La stampa movimenti con controllo allegato iva dave un errore sul codice causale --- src/cg/cg3100.cpp | 8 ++++++-- src/cg/cglib03.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cg/cg3100.cpp b/src/cg/cg3100.cpp index a464d73d0..d35a5fc35 100755 --- a/src/cg/cg3100.cpp +++ b/src/cg/cg3100.cpp @@ -1825,16 +1825,19 @@ bool TListaMov_application::segnala_errori_ogniriga() bool TListaMov_application::segnala_errori_iva() { TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA); - const TRectype& mv = current_cursor()->curr(LF_RMOV); + const TRectype& mov = current_cursor()->curr(LF_MOV); if (current_cursor()->is_first_match(LF_RMOVIVA)) { const TRecnotype nrec = rmoviva.recno(); + rmoviva.setkey(1); rmoviva.zero(); rmoviva.put(RMI_NUMREG, _numero); + const TRectype& rec = rmoviva.curr(); const TRectype recc (rec); + for (rmoviva.read(_isgteq); !rmoviva.eof() ;rmoviva.next()) { if (rec > recc) @@ -1847,9 +1850,10 @@ bool TListaMov_application::segnala_errori_iva() } const TString4 cod = rec.get(RMI_CODIVA); real percind; - const int tipodet = get_tipodet_from_rmi(rec, mv, percind); + const int tipodet = get_tipodet_from_rmi(rec, mov, percind); const int tipocr = rec.get_int(RMI_TIPOCR); const TRectype& tab_iva = cache().get("%IVA", cod); + if (!tab_iva.empty()) { int allc = tab_iva.get_int("S7"); diff --git a/src/cg/cglib03.cpp b/src/cg/cglib03.cpp index 2e882dd25..80b54e733 100755 --- a/src/cg/cglib03.cpp +++ b/src/cg/cglib03.cpp @@ -258,7 +258,7 @@ bool is_IVAxCassa(const TRectype& mov) int get_tipodet_from_rmi(const TRectype& rmi, const TRectype& mov, real& percind, const bool is_liq) { const int annodoc = mov.get_date(MOV_DATAREG).year(); - const TCausale caus(mov.get(MOV_CODCAUS), annodoc); + const TCausale & caus = cached_causale(mov.get(MOV_CODCAUS), annodoc); int tipodet = 0; percind = indetraibile_al(rmi.get(RMI_TIPODET), caus, annodoc, tipodet, is_liq);