Patch level : 12.0

Files correlati     : fp, cg
Commento:
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:
-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
This commit is contained in:
smen 2022-06-14 10:50:07 +02:00
parent afa9e56967
commit d28b4d2567
4 changed files with 65 additions and 13 deletions

View File

@ -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

View File

@ -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();

View File

@ -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()
{
// <DatiTrassmissione>
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()
{
// <Datipec>
TPaf_record& paf3200f = _paf_container.get_paf("PAF3200F");
reset(paf3200f);
paf3200f.set("PU_PEC", _pec);
// </Datipec>
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)
// <CedentePrestatore>
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);
// </CedentePrestatore>
// </CedentePrestatore>
// <CessionarioCommittente>
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);
// </CessionarioCommittente>
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);
// </DatiGenerali>
// Azzera DDT
TPaf_record& paf1600f = _paf_container.get_paf("PAF1600F");
reset(paf1600f);
// SEMPRE
// <DatiBeniServizi>
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'è
// <CodiceArticolo>
@ -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));

View File

@ -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); }
};