diff --git a/cd/test/cg1170.txt b/cd/test/cg1170.txt new file mode 100644 index 000000000..7537a8462 --- /dev/null +++ b/cd/test/cg1170.txt @@ -0,0 +1,5 @@ +cg2100c.msk +cg2100t.msk +cg2.exe + +Recupero dati fattura collegata (id_documento_SDI e data_documento_SDI) da PFPRO per le integrazioni dei nuovi tipi documento e li riporto in prima nota. \ No newline at end of file diff --git a/cd/test/cg1170a.ini b/cd/test/cg1170a.ini new file mode 100644 index 000000000..29c0ba6e7 --- /dev/null +++ b/cd/test/cg1170a.ini @@ -0,0 +1,100 @@ +[Main] +Demo=0 + +[cg2] +File(51) = cg2.exe|X +File(54) = cg2100c.msk|X +File(62) = cg2100t.msk|X +Patch = 1170 +Versione = 21511200 + +[cg99] +Kill(0) = bastcfi.rep|x +Kill(1) = batbcve.msk|x +Kill(2) = bastcam.rep|x +Kill(3) = batbtra.msk|x +Kill(4) = batbndo.msk|x +Kill(5) = bastver.msk|x +Kill(6) = cg2fppro.msk|x +Kill(7) = batbpor.msk|x +Kill(8) = bastzon.rep|x +Kill(9) = bastleg.rep|x +Kill(10) = batbcam.msk|x +Kill(11) = bastpor.msk|x +Kill(12) = bastcco.rep|x +Kill(13) = batbind.msk|x +Kill(14) = bastnot.msk|x +Kill(15) = batbivd.msk|x +Kill(16) = batbleg.msk|x +Kill(17) = batbcco.msk|x +Kill(18) = bastmsp.msk|x +Kill(19) = bastntb.rep|x +Kill(20) = bastcco.msk|x +Kill(21) = batbtit.msk|x +Kill(22) = batblia.msk|x +Kill(23) = bastscc.msk|x +Kill(24) = batbarb.msk|x +Kill(25) = bastvet.msk|x +Kill(26) = bastzon.msk|x +Kill(27) = bastesc.msk|x +Kill(28) = batbreg.msk|x +Kill(29) = bastndo.msk|x +Kill(30) = bastndo.rep|x +Kill(31) = bastpdb.msk|x +Kill(32) = bastcve.rep|x +Kill(33) = batbvet.msk|x +Kill(34) = bastvet.rep|x +Kill(35) = batbdel.msk|x +Kill(36) = batbzon.msk|x +Kill(37) = bastcam.msk|x +Kill(38) = bastpdb.rep|x +Kill(39) = bastver.rep|x +Kill(40) = batblbu.msk|x +Kill(41) = batbmsp.msk|x +Kill(42) = bastscc.rep|x +Kill(43) = bastdpn.msk|x +Kill(44) = bastesc.rep|x +Kill(45) = bastcfi.msk|x +Kill(46) = batbinl.msk|x +Kill(47) = bastarb.msk|x +Kill(48) = batbscc.msk|x +Kill(49) = bastarb.rep|x +Kill(50) = bastdpn.rep|x +Kill(51) = bastntb.msk|x +Kill(52) = bastivd.rep|x +Kill(53) = bastreg.msk|x +Kill(54) = bastivd.msk|x +Kill(55) = batbins.msk|x +Kill(56) = batbpdb.msk|x +Kill(57) = bastreg.rep|x +Kill(58) = bastcve.msk|x +Kill(59) = batbntb.msk|x +Kill(60) = batbnot.msk|x +Kill(61) = batblia.msk|x +Kill(62) = cgtbcon.msk|x +Kill(63) = bastnot.rep|x +Kill(64) = batbesc.msk|x +Kill(65) = bastpor.rep|x +Kill(66) = batbcfi.msk|x +Kill(67) = bastmsp.rep|x +Kill(68) = batbver.msk|x +Kill(69) = batbdpn.msk|x +Kill(70) = bastleg.msk|x + +[cg] +Data = 13-06-2022 +Descrizione = Contabilita' Generale +Dischi = 1 +Edit_19 = cg0 -0 +Edit_20 = cg0 -1 +Edit_26 = cg0 -4 +Edit_5 = cg0 -5 +Moduli = ba +OEM = +Patch = 1170 +PostProcess = bainst -0 CG +PreProcess = +Prezzo(1) = +Prezzo(2) = +Versione = 21511200 + diff --git a/cd/test/cg1170a1.zip b/cd/test/cg1170a1.zip new file mode 100644 index 000000000..e6c453562 Binary files /dev/null and b/cd/test/cg1170a1.zip differ diff --git a/cd/test/fp1170.txt b/cd/test/fp1170.txt new file mode 100644 index 000000000..30cd4995e --- /dev/null +++ b/cd/test/fp1170.txt @@ -0,0 +1,4 @@ +fp0.exe +fp0400a.msk + +Recupero dati fattura collegata (id_documento_SDI e data_documento_SDI) da PFPRO per le integrazioni dei nuovi tipi documento. \ No newline at end of file diff --git a/cd/test/fp1170a.ini b/cd/test/fp1170a.ini new file mode 100644 index 000000000..7d97e9def --- /dev/null +++ b/cd/test/fp1170a.ini @@ -0,0 +1,20 @@ +[Main] +Demo=0 + +[fp0] +File(0) = fp0.exe|X +File(4) = fp0400a.msk|X +Patch = 1170 +Versione = 21511200 + +[fp] +Data = 13-06-2022 +Descrizione = Fattura Elettronica +Dischi = 1 +Moduli = cg,ve +OEM = +Patch = 1170 +PostProcess = +PreProcess = +Versione = 21511200 + diff --git a/cd/test/fp1170a1.zip b/cd/test/fp1170a1.zip new file mode 100644 index 000000000..4d256aac8 Binary files /dev/null and b/cd/test/fp1170a1.zip differ diff --git a/cd/test/fp1172.txt b/cd/test/fp1172.txt new file mode 100644 index 000000000..a37e10601 --- /dev/null +++ b/cd/test/fp1172.txt @@ -0,0 +1,12 @@ +fpmenu.men +fp0.exe + +Aggiunta: + -Aggiunte descrizione differenziata per TD17\TD19 Integrazioni e Autofattura. + Campo controlla il flag Stato EU nel code ISO e se il cliente è intacomunitario ci scrive + "Integrazione" altrimenti "Autofattura". + +Bug risolti: + -il paf0200 (e molti altri in realtà) non venivano resettati una volta inizializzati. + Se si elaboravano più integrazioni contemporaneamente i dati del cedente prestatore + della prima integrazione venivano riportati anche sulle altre diff --git a/cd/test/fp1172a.ini b/cd/test/fp1172a.ini new file mode 100644 index 000000000..3cd6a27aa --- /dev/null +++ b/cd/test/fp1172a.ini @@ -0,0 +1,20 @@ +[Main] +Demo=0 + +[fp0] +File(0) = fp0.exe|X +File(9) = fpmenu.men|X +Patch = 1172 +Versione = 21511200 + +[fp] +Data = 14-06-2022 +Descrizione = Fattura Elettronica +Dischi = 1 +Moduli = cg,ve +OEM = +Patch = 1172 +PostProcess = +PreProcess = +Versione = 21511200 + diff --git a/cd/test/fp1172a1.zip b/cd/test/fp1172a1.zip new file mode 100644 index 000000000..ff9925cfb Binary files /dev/null and b/cd/test/fp1172a1.zip differ diff --git a/src/cg/cglib07.cpp b/src/cg/cglib07.cpp index 2345d1b18..7bfcce13d 100644 --- a/src/cg/cglib07.cpp +++ b/src/cg/cglib07.cpp @@ -213,7 +213,7 @@ bool TAnagrafica::italiano() const bool TAnagrafica::estero_CEE() const { - return estero() && cache().get("%SCE", stato_residenza_ISO(), "B0"); + return estero() && cache().get_bool("%SCE", stato_residenza_ISO(), "B0") ; } const TString& TAnagrafica::stato_estero_UNICO() const diff --git a/src/fp/fplib.h b/src/fp/fplib.h index 13229dd36..8ad3afab8 100644 --- a/src/fp/fplib.h +++ b/src/fp/fplib.h @@ -678,7 +678,7 @@ protected: const TFirm& TReg_fp::get_firm(){return prefix().firm();} - TString TReg_fp::get_line_descr(); + TString TReg_fp::get_line_descr(TAnagrafica cliente); bool export_paf0100f(); bool export_paf3200f(); diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp index 9b50e24d1..dd10425b7 100644 --- a/src/fp/fplib01.cpp +++ b/src/fp/fplib01.cpp @@ -330,6 +330,7 @@ const TString& tipo_doc_sdi(const TDocumento& doc) { return tipo_doc_sdi; } + return doc.tipo().tipo_doc_sdi(); } @@ -3236,12 +3237,13 @@ bool TReg_fp::add_row_alleg(TFilename& file, long& nprogr, TPaf_record& paf) bool TReg_fp::add_riepilogo_iva(const TMovimento_contabile & mov, int n_riga) { TPaf_record& paf2200f = _paf_container.get_paf("PAF2200F"); + reset(paf2200f); + const TRectype& rec_iva = mov.iva()[n_riga]; const TString16 cod_aliquota = rec_iva.get(RMI_CODIVA); const TCodiceIVA& cod_iva= cached_codIVA(cod_aliquota); const real aliquota = cod_iva.percentuale(); - reset(paf2200f); // Aliquota paf2200f.set("PL_ALIQUOTAIVA", aliquota); // Natura @@ -3265,6 +3267,8 @@ bool TReg_fp::export_paf0100f() { // TPaf_record& paf0100f = _paf_container.get_paf("PAF0100F"); + reset(paf0100f); + paf0100f.set("P1_TRASMITTPAESE", _paese); paf0100f.set("P1_TRASMITTCOD", _cofi); paf0100f.set("P1_FMTTRASMISS", _privato ? "FPR12" : "FPA12"); @@ -3290,6 +3294,8 @@ bool TReg_fp::export_paf3200f() { // TPaf_record& paf3200f = _paf_container.get_paf("PAF3200F"); + reset(paf3200f); + paf3200f.set("PU_PEC", _pec); // return insert(paf3200f); @@ -3297,19 +3303,31 @@ bool TReg_fp::export_paf3200f() return true; } -TString TReg_fp::get_line_descr() +TString TReg_fp::get_line_descr(TAnagrafica cli) { TString descr; TString16 tdsdi = _tipo_doc_sdi; + bool estero_cee = cli.estero_CEE(); + bool ita = cli.italiano(); if (tdsdi == "TD16") descr = "Integrazione fattura reverse charge interno"; else if (tdsdi == "TD17") - descr = "Integrazione/autofattura per acquisto servizi da estero"; + { + if (ita || estero_cee) + descr = "Integrazione per acquisto servizi da estero"; + else + descr = "Autofattura per acquisto servizi da estero"; + } else if (tdsdi == "TD18") descr = "Integrazione per acquisto beni intracomunitari"; else if (tdsdi == "TD19") - descr = "Integrazione/autofattura per acquisto beni ex art.17 c.2 DPR 633/72"; + { + if (ita || estero_cee) + descr = "Integrazione per acquisto beni ex art.17 c.2 DPR 633/72"; + else + descr = "Autofattura per acquisto beni ex art.17 c.2 DPR 633/72"; + } else if (tdsdi == "TD20") descr = "Autofattura"; else @@ -3329,6 +3347,8 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) // TPaf_record& paf0200f = _paf_container.get_paf("PAF0200F"); + reset(paf0200f); + const TAnagrafica& fornitore = mov.clifo().anagrafica(); if (!paf0200f.is_full()) @@ -3378,10 +3398,9 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) ok &= insert(paf0200f); - // - // // TPaf_record& paf0400f = _paf_container.get_paf("PAF0400F"); + reset(paf0400f); TString stato = _ditta.stato_partita_IVA(); TTable tab_codiso("%SCE"); @@ -3446,8 +3465,11 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) paf0400f.set("P4_ANATITOLO", cache().get("TIT", titolo, "S0")); paf0400f.set("P4_GESTIONE", stato_paf()); ok &= insert(paf0400f); + // TPaf_record& paf0700f = _paf_container.get_paf("PAF0700F"); + reset(paf0700f); + paf0700f.set("P7_TIPODOC", _tipo_doc_sdi); paf0700f.set("P7_DIVISA", "EUR"); // Fisso su euro in quanto effettuiamo il cambio paf0700f.set("P7_DATA", mov.get_date(MOV_DATAREG)); // sembra sempre la data di registrazione visto che è na data di ricezione @@ -3475,6 +3497,8 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) paf0700f.set("P7_GESTIONE", stato_paf()); TPaf_record& paf2700f = _paf_container.get_paf("PAF2700F"); + reset(paf2700f); + // Disabilitata la scrittura del totale del documento, questo causa problemi se presente uno sconto in testata e l'addebito del bollo. // Campo calcola prima il totale, poi lo sconta e ci applica il bollo mentre lo SDI sconta a bollo gi applicato. @@ -3485,7 +3509,6 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) // paf1400 Dati fatture collegate TPaf_record& paf1400f = _paf_container.get_paf("PAF1400F"); - reset(paf1400f); TString idsdi = mov.get(MOV_IDDOCSDI); @@ -3512,17 +3535,26 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) paf1400f.set("PD_IDDOC", idsdi); paf1400f.set("PD_DATADOC", datasdi); ok &= insert(paf1400f); + // // Azzera DDT TPaf_record& paf1600f = _paf_container.get_paf("PAF1600F"); + reset(paf1600f); + // SEMPRE // TPaf_record& paf1800f = _paf_container.get_paf("PAF1800F"); TPaf_record& paf2000f = _paf_container.get_paf("PAF2000F"); TPaf_record& paf2100f = _paf_container.get_paf("PAF2100F"); TPaf_record& paf3000f = _paf_container.get_paf("PAF3000F"); + + reset(paf1800f); + reset(paf2000f); + reset(paf2100f); + reset(paf3000f); + int n_righe_iva = mov.iva().rows(); - TString descr = get_line_descr(); + TString descr = get_line_descr(fornitore); for (int i = 1; i <= n_righe_iva; i++) { @@ -3530,8 +3562,6 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) const TString16 cod_aliquota = rec_iva.get(RMI_CODIVA); const TCodiceIVA& cod_iva = cached_codIVA(cod_aliquota); const real aliquota = cod_iva.percentuale(); - - reset(paf1800f); paf1800f.set("PI_NUMEROLINEA", (long)i); //PI_TIPOCESSPREST CHAR(2) NOT NULL DEFAULT '', ci va? @@ -3551,7 +3581,7 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) ok &= insert(paf1800f); add_riepilogo_iva(mov, i); - reset(paf3000f); + paf3000f.set("PT_RIFNUMLINEA", (long)i); paf3000f.set("PT_COMMENTO", "");//TODO COSA DOBBIAMO METTERE NELLA DESCRIZIONE IVA CHE NON C'è // @@ -3562,6 +3592,8 @@ bool TReg_fp::reg_to_paf(const TMovimento_contabile& mov) } // Tabella di non invio XML TPaf_record& pafw300f = _paf_container.get_paf("PAFW300F"); + reset(pafw300f); + pafw300f.set("PW_TIPODOC", ""); //TODO PASSARE IL TIPO DOCUMENTO DELLA MASK NEL COSTRUTTORE pafw300f.set("PW_TIPONUM", ""); //TODO COSA CI METTIAMO NEL TIPO NUM pafw300f.set("PW_NUMERO", mov.get(MOV_NUMDOC)); diff --git a/src/include/recarray.h b/src/include/recarray.h index 0fd64c1b7..c790fdd4e 100755 --- a/src/include/recarray.h +++ b/src/include/recarray.h @@ -281,6 +281,26 @@ public: const TString& get(int file, long key, const char * campo); const TString& get(const char* table, const char* key_tok, const char* campo); + bool get_bool(int file, const char* key_tok, const char * campo) { return get(file, key_tok, campo) == "X"; } + bool get_bool(int file, long key, const char * campo) { return get(file, key, campo) == "X"; } + bool get_bool(const char* table, const char* key_tok, const char* campo) { return get(table, key_tok, campo) == "X"; } + + int get_int(int file, const char* key_tok, const char * campo) { return atoi(get(file, key_tok, campo)); } + int get_int(int file, long key, const char * campo) { return atoi(get(file, key, campo)); } + int get_int(const char* table, const char* key_tok, const char* campo) { return atoi(get(table, key_tok, campo)); } + + int get_long(int file, const char* key_tok, const char * campo) { return atol(get(file, key_tok, campo)); } + int get_long(int file, long key, const char * campo) { return atol(get(file, key, campo)); } + int get_long(const char* table, const char* key_tok, const char* campo) { return atol(get(table, key_tok, campo)); } + + real get_real(int file, const char* key_tok, const char * campo) { return real(get(file, key_tok, campo)); } + real get_real(int file, long key, const char * campo) { return real(get(file, key, campo)); } + real get_real(const char* table, const char* key_tok, const char* campo) { return real(get(table, key_tok, campo)); } + + TDate get_date(int file, const char* key_tok, const char * campo) { return TDate(get(file, key_tok, campo)); } + TDate get_date(int file, long key, const char * campo) { return TDate(get(file, key, campo)); } + TDate get_date(const char* table, const char* key_tok, const char* campo) { return TDate(get(table, key_tok, campo)); } + void test_file_changes(int file, bool t = TRUE) { rec_cache(file).test_file_changes(t); } };