From 4988d9d489ae8fdbaa8d585d4bd31e37e16c4544 Mon Sep 17 00:00:00 2001 From: mtollari Date: Thu, 18 May 2017 13:23:01 +0000 Subject: [PATCH] Patch level : 12.0 400 Files correlati : tf Commento : Sistemato il calcolo del totale dei movimenti passivi con l'aggiunta dell'esclusione dei movimenti in rev charge e liquidazione differita git-svn-id: svn://10.65.10.50/branches/R_10_00@23824 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/tf/tf0200.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/tf/tf0200.cpp b/src/tf/tf0200.cpp index b5f8c83f7..606101dc0 100644 --- a/src/tf/tf0200.cpp +++ b/src/tf/tf0200.cpp @@ -510,6 +510,35 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO } + /* Il reverse charge va sottratto dal totale delle operazioni attive! + * Creo un cursore su MOV e RMOVIVA e sottraggo + */ + TString queryMov = "USE RMOVIVA\n"; + queryMov << "SELECT BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)\n"; + queryMov << "JOIN MOV INTO NUMREG==NUMREG\n"; + + TISAM_recordset cmov(queryMov); + + cmov.set_var("#DADATAREG", TDate(01,start, anno)); + cmov.set_var("#ADATAREG", TDate(31, start, anno)); + + for (bool ok = cmov.move_first(); ok; ok = cmov.move_next()) + { + // Vado a prendere la prima riga in RMOV + TString key = cmov.get("23.NUMREG").as_string(); + key << "|1"; + TRectype rmov = cache().get(LF_RMOV, key); + + // Controllo di essere sul registro vendite + bool regVen = TRegistro(cmov.get("23.REG").as_string()).tipo() == reg_att; + + // Salto se il registro non è di tipo vendite o ci sono delle righe in RMOV + if(!regVen || !rmov.empty()) continue; + + totopatt -= cmov.get("25.IMPONIBILE").as_real(); + } + + // Aggiungo gli indeducibili per articolo 19, e indeducibili su ricavi esenti static TRelation rpom(LF_TAB); TRectype pomFrom(rpom.curr()); pomFrom.put("COD", "POM");pomFrom.put("CODTAB", anno);