From a4a750edf35af4d2121bdc1b77f6aeb8551bcf6a Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Fri, 5 Mar 2021 17:06:34 +0100 Subject: [PATCH] Patch level : 12.0 1038 Files correlati : ve0.ex ve0200f.msk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commento : Implementata la contabilizzazione delle note di credito split-payment Corretta dicitura pagherò nella configurazione della gestione spese bolli --- src/ve/ve0200f.uml | 2 +- src/ve/velib04b.cpp | 48 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/ve/ve0200f.uml b/src/ve/ve0200f.uml index c4fb88705..ca99cbde9 100755 --- a/src/ve/ve0200f.uml +++ b/src/ve/ve0200f.uml @@ -35,7 +35,7 @@ END CURRENCY F_IMPSPINC5 9 BEGIN -PROMPT 2 6 "Importo spese per paghero' " +PROMPT 2 6 "Importo spese per pagherò " FIELD IMPSPINC[5] PICTURE "." END diff --git a/src/ve/velib04b.cpp b/src/ve/velib04b.cpp index d7cef426a..aa69de368 100755 --- a/src/ve/velib04b.cpp +++ b/src/ve/velib04b.cpp @@ -717,8 +717,8 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i const bool revcharge = r.get_bool(RDOC_REVCHARGE); TString80 key; - key.format("%d|%-4s|%c|%3d|%3d|%6ld|%s|%s", - ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet, revcharge ? "X" : ""); + key.format("%d|%-4s|%c|%03d|%03d|%06ld|%s", + ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet); // Nel caso di documenti a zero tiene distinte IVA positiva e negativa if (r.doc().totale_doc().is_zero()) @@ -728,6 +728,9 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i else key << "|+"; } + if (_caus->reverse_charge_pubb()) + key << '|' << revcharge; + TRectype* iva = (TRectype*)objptr(key); @@ -741,12 +744,12 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i iva->put(RMI_GRUPPO, c.gruppo()); iva->put(RMI_CONTO, c.conto()); iva->put(RMI_SOTTOCONTO, c.sottoconto()); + iva->put(RMI_TIPODET, tipodet); + iva->put(RMI_REVCHARGE, revcharge); TAssoc_array::add(key, iva, true); } iva->add(RMI_IMPONIBILE, impon); - iva->put(RMI_TIPODET, tipodet); - iva->put(RMI_REVCHARGE, revcharge); iva->add(RMI_IMPOSTA, imposta); if (ord != 5) { @@ -1400,9 +1403,10 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) } else { - if (_caus->reverse_charge()) + if (_caus->reverse_charge_pubb()) { TCurrency_documento imposta(doc.imposta(), doc); + totdocval -= imposta; imposta.change_to_firm_val(); mov_rec.put(MOV_REVCHARGE, imposta.get_num()); // 15-12-2015 was MOV_RITFIS @@ -2200,13 +2204,15 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc) imponibile = cur.get_real(RMI_IMPONIBILE); imposta = cur.get_real(RMI_IMPOSTA); + + TCurrency_documento imponval(imponibile, doc); + TCurrency_documento impval(imposta, doc); if (in_valuta) // I documenti vanno sempre contabilizzati in Euro { - TCurrency_documento imponval(imponibile, doc); + imponval.change_to_firm_val(); imponibile = imponval.get_num(); // imponibile in lire - TCurrency_documento impval(imposta, doc); impval.change_to_firm_val(); imposta = impval.get_num(); // questa e' l'imposta ricalcolata } @@ -2226,6 +2232,17 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc) rec_iva.put(RMI_CONTO, conto); rec_iva.put(RMI_SOTTOCONTO, sottoconto); rec_iva.put(RMI_TIPODET, cur.get(RMI_TIPODET)); + + const bool revcharge = cur.get_bool(RMI_REVCHARGE); + + rec_iva.put(RMI_REVCHARGE, revcharge); + if (_caus->reverse_charge_pubb() && !revcharge) //risitema la testata per il reverse charge parziale + { + head.add(MOV_TOTDOC, imposta); + if (in_valuta) + head.add(MOV_TOTDOCVAL, impval.get_num()); + head.sub(MOV_REVCHARGE, imposta); + } nr++; } } @@ -2825,7 +2842,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz real imposte; for (int j = _movimento->iva_items()-1; j >= 0; j--) - if (!acquisto_revcharge || !_movimento->iva(j).get_bool(RDOC_REVCHARGE)) + if (!acquisto_revcharge || !_movimento->iva(j).get_bool(RMI_REVCHARGE)) imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -UNO : UNO); if (_caus->iva() == iva_acquisti) // Ricalcola precisamente il totale imposte { @@ -2961,10 +2978,23 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz } } // if fattura else if (is_nc) - { + { TImporto residuoval(sezione, abs(totdocval)); TImporto residuolit(sezione, abs(totdoc)); + if (is_split_payment(head)) + { + TCurrency_documento imposte(doc.imposta(), doc); + TImporto imposteval(sezione, imposte.get_num()); + + imposte.change_to_firm_val(); + + TImporto impostelit(sezione, imposte.get_num()); + + residuolit -= impostelit; + if (doc.in_valuta()) + residuoval -= imposteval; + } partita.put(PART_DATAPAG, doc.get(DOC_DATADOC)); partita.put(PART_TIPOPAG, doc.pagamento().tipo_rata(0));