From 087a1d46fc2843dd9b87b8959df4241bf3b3db19 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Tue, 9 Aug 2022 09:03:21 +0200 Subject: [PATCH] Patch level : 12.0 1186 Files correlati : ve0.exe ve6.exe Commento: le fatture di acquisto con reverse charge parziale non venivano contabilizzate bene --- src/ve/velib04b.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ve/velib04b.cpp b/src/ve/velib04b.cpp index b921b1bf7..31de3a4c7 100755 --- a/src/ve/velib04b.cpp +++ b/src/ve/velib04b.cpp @@ -749,7 +749,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i key << "|+"; } if (_caus->reg().tipo_registro() == acquisto && _caus->reverse_charge_pubb()) - key << '|' << revcharge; + key << '|' << (revcharge ? "X" : ""); TRectype* iva = (TRectype*)objptr(key); @@ -4529,8 +4529,11 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo head.put(MOV_CODCAUS, caus.codice()); head.put(MOV_TIPODOC, caus.tipo_doc()); head.put(MOV_PROTIVA, protiva); + mov.destroy_cg_row(-1); + mov.destroy_iva_row(-1); TString descr; + descr << TR("Regolarizzazione ") << doc.get(DOC_CODNUM) << '/' << doc.numero() << TR(" del ") << doc.get(DOC_DATADOC); head.put(MOV_DESCR,descr); @@ -4557,20 +4560,21 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo head.put(MOV_CONTSEP, doc.get(DOC_CONTSEP)); real totdoc; - for (int ri = 0; ri < _movimento->iva_items(); ri++) + int ri = 0; + for (int i = 0; i < _movimento->iva_items(); i++) { - const TRectype& rmoviva = _movimento->iva(ri); - const bool revcharge = rmoviva.get(RMI_REVCHARGE); + const TRectype& rmoviva = _movimento->iva(i); + const bool revcharge = rmoviva.get_bool(RMI_REVCHARGE); if (revcharge) { const real imponibile = rmoviva.get(RMI_IMPONIBILE); const real imposta = rmoviva.get(RMI_IMPOSTA); - TRectype& rmi = mov.iva(ri); + TRectype& rmi = mov.iva(ri++); rmi.put(RMI_IMPONIBILE, imponibile); rmi.put(RMI_IMPOSTA, imposta); - rmi.put(RMI_CODIVA, rmoviva.get(RMI_CODIVA)); + rmi.put(RMI_CODIVA, rmoviva.get(RMI_CODIVA)); TBill zio; caus.bill(2, zio); zio.put(rmi); totdoc += imponibile + imposta; // Incrementa totdoc @@ -5087,5 +5091,4 @@ bool TContabilizzazione::call_exe(const TDocumento& doc, const TMovimentoPN& mov ininame.fremove(); return ok; -} - +} \ No newline at end of file