Patch level : 12.0 296
Files correlati : Commento : Corretta gestione natura codice IVA e fatturazione PA git-svn-id: svn://10.65.10.50/branches/R_10_00@23358 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8780ad1298
commit
496f415aa5
@ -23,3 +23,4 @@
|
|||||||
#define CHK_SERVIZI 124
|
#define CHK_SERVIZI 124
|
||||||
#define FLD_DESCR_I1 125
|
#define FLD_DESCR_I1 125
|
||||||
#define FLD_INDET_S4 126
|
#define FLD_INDET_S4 126
|
||||||
|
#define FLD_NATURAPA 127
|
||||||
|
@ -298,6 +298,21 @@ BEGIN
|
|||||||
FIELD B3
|
FIELD B3
|
||||||
END
|
END
|
||||||
|
|
||||||
|
LIST FLD_NATURAPA 2 25
|
||||||
|
BEGIN
|
||||||
|
PROMPT 3 19 "Natura per fatture PA"
|
||||||
|
FIELD S12
|
||||||
|
HELP "Indicare la natura del codice IVA per le fatture PA"
|
||||||
|
ITEM "|IVA ordinaria"
|
||||||
|
ITEM "N1|IVA esclusa ex art 15"
|
||||||
|
ITEM "N2|IVA non soggetta"
|
||||||
|
ITEM "N3|IVA non imponibile"
|
||||||
|
ITEM "N4|IVA esente"
|
||||||
|
ITEM "N5|IVA in regime del margine"
|
||||||
|
ITEM "N6|IVA in reverse charge"
|
||||||
|
MODULE PA
|
||||||
|
END
|
||||||
|
|
||||||
BOOLEAN FLD_SOSPESO_B2
|
BOOLEAN FLD_SOSPESO_B2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 3 21 "Codice IVA sospeso"
|
PROMPT 3 21 "Codice IVA sospeso"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
3
|
3
|
||||||
1
|
1
|
||||||
%tabgen|0|0|1181|0|Tabelle di studio|50||
|
%tabgen|0|0|1186|0|Tabelle di studio|50||
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
3
|
3
|
||||||
86
|
87
|
||||||
COD|1|3|0|
|
COD|1|3|0|
|
||||||
CODTAB|1|25|0|
|
CODTAB|1|25|0|
|
||||||
S0|1|70|0|
|
S0|1|70|0|
|
||||||
@ -14,6 +14,7 @@ S8|1|5|0|
|
|||||||
S9|1|5|0|
|
S9|1|5|0|
|
||||||
S10|1|5|0|
|
S10|1|5|0|
|
||||||
S11|1|5|0|
|
S11|1|5|0|
|
||||||
|
S12|1|5|0|
|
||||||
I0|3|7|0|
|
I0|3|7|0|
|
||||||
I1|3|7|0|
|
I1|3|7|0|
|
||||||
I2|3|7|0|
|
I2|3|7|0|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
4
|
4
|
||||||
1
|
1
|
||||||
%tabcom|0|0|1197|0|Tabelle comuni|1500||
|
%tabcom|0|0|1210|0|Tabelle comuni|1500||
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
4
|
4
|
||||||
88
|
89
|
||||||
COD|1|3|0|
|
COD|1|3|0|
|
||||||
CODTAB|1|25|0|
|
CODTAB|1|25|0|
|
||||||
S0|1|70|0|
|
S0|1|70|0|
|
||||||
@ -14,6 +14,7 @@ S8|1|5|0|
|
|||||||
S9|1|5|0|
|
S9|1|5|0|
|
||||||
S10|1|5|0|
|
S10|1|5|0|
|
||||||
S11|1|5|0|
|
S11|1|5|0|
|
||||||
|
S12|1|5|0|
|
||||||
I0|3|7|0|
|
I0|3|7|0|
|
||||||
I1|3|7|0|
|
I1|3|7|0|
|
||||||
I2|3|7|0|
|
I2|3|7|0|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
5
|
5
|
||||||
0
|
0
|
||||||
$tab|0|0|1197|0|Tabelle ditta|400||
|
$tab|6734|6734|1210|0|Tabelle ditta|400||
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
5
|
5
|
||||||
88
|
89
|
||||||
COD|1|3|0|
|
COD|1|3|0|
|
||||||
CODTAB|1|25|0|
|
CODTAB|1|25|0|
|
||||||
S0|1|70|0|
|
S0|1|70|0|
|
||||||
@ -14,6 +14,7 @@ S8|1|5|0|
|
|||||||
S9|1|5|0|
|
S9|1|5|0|
|
||||||
S10|1|5|0|
|
S10|1|5|0|
|
||||||
S11|1|5|0|
|
S11|1|5|0|
|
||||||
|
S12|1|5|0|
|
||||||
I0|3|7|0|
|
I0|3|7|0|
|
||||||
I1|3|7|0|
|
I1|3|7|0|
|
||||||
I2|3|7|0|
|
I2|3|7|0|
|
||||||
|
@ -671,9 +671,9 @@ protected:
|
|||||||
|
|
||||||
void log(int severity, const char* msg);
|
void log(int severity, const char* msg);
|
||||||
bool show_log();
|
bool show_log();
|
||||||
const char * natura(const TString& tipo, const int tipo_acquisti, const int regspiva) const;
|
const char * natura(const TString& codiva) const;
|
||||||
void set_IVA(const TString& codiva, const int regspiva, TPaf_record& paf) const;
|
void set_IVA(const TString& codiva, TPaf_record& paf) const;
|
||||||
void set_IVA(const TRiga_documento& rdoc, const int regspiva, TPaf_record& paf) const;
|
void set_IVA(const TRiga_documento& rdoc, TPaf_record& paf) const;
|
||||||
|
|
||||||
bool elabora(TDocumentoEsteso& doc);
|
bool elabora(TDocumentoEsteso& doc);
|
||||||
bool elabora(const TRectype& rec);
|
bool elabora(const TRectype& rec);
|
||||||
@ -882,15 +882,24 @@ bool TDoc2Paf::show_log()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * TDoc2Paf::natura(const TString& tipo, const int tipo_acquisti, const int regspiva) const
|
const char * TDoc2Paf::natura(const TString& codiva) const
|
||||||
{
|
{
|
||||||
|
const TRectype& ai = cache().get("%IVA", codiva);
|
||||||
TString & natura = get_tmp_string(4);
|
TString & natura = get_tmp_string(4);
|
||||||
|
|
||||||
// N1 escluse ex art 15
|
natura = ai.get("S12");
|
||||||
if (tipo_acquisti == 5)
|
if(natura.blank())
|
||||||
|
{
|
||||||
|
const int tipo_iva11 = ai.get_int("S2");
|
||||||
|
const bool revcharge = tipo_iva11 >= 31 && tipo_iva11 <= 38;
|
||||||
|
const TString& tipo = ai.get("S1");
|
||||||
|
const int tipo_vendite = ai.get_int("S7");
|
||||||
|
|
||||||
|
// N1 escluse ex art 15
|
||||||
|
if (tipo_vendite == 5)
|
||||||
natura = "N5"; // regime del margine
|
natura = "N5"; // regime del margine
|
||||||
else
|
else
|
||||||
if (regspiva >12 && regspiva < 52)
|
if (revcharge)
|
||||||
natura = "N6"; // Inversione contabile (REVERSE CHARGE)
|
natura = "N6"; // Inversione contabile (REVERSE CHARGE)
|
||||||
else
|
else
|
||||||
if (tipo == "NS")
|
if (tipo == "NS")
|
||||||
@ -901,10 +910,11 @@ const char * TDoc2Paf::natura(const TString& tipo, const int tipo_acquisti, cons
|
|||||||
else
|
else
|
||||||
if (tipo == "ES")
|
if (tipo == "ES")
|
||||||
natura = "N4"; // Esente
|
natura = "N4"; // Esente
|
||||||
|
}
|
||||||
return natura;
|
return natura;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDoc2Paf::set_IVA(const TString& codiva, const int regspiva, TPaf_record& paf) const
|
void TDoc2Paf::set_IVA(const TString& codiva, TPaf_record& paf) const
|
||||||
{
|
{
|
||||||
const TRectype& ai = cache().get("%IVA", codiva);
|
const TRectype& ai = cache().get("%IVA", codiva);
|
||||||
const real aliquota = ai.get("R0");
|
const real aliquota = ai.get("R0");
|
||||||
@ -912,18 +922,13 @@ void TDoc2Paf::set_IVA(const TString& codiva, const int regspiva, TPaf_record& p
|
|||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
{
|
{
|
||||||
if (aliquota.is_zero())
|
if (aliquota.is_zero())
|
||||||
{
|
paf.set("PI_NATURA", natura(codiva));
|
||||||
const TString& tipo = ai.get("S1");
|
|
||||||
const int tipo_acquisti = ai.get_int("S8");
|
|
||||||
|
|
||||||
paf.set("PI_NATURA", natura(tipo, tipo_acquisti, regspiva));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
paf.set("PI_NATURA", "");
|
paf.set("PI_NATURA", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDoc2Paf::set_IVA(const TRiga_documento& rdoc, const int regspiva, TPaf_record& paf) const
|
void TDoc2Paf::set_IVA(const TRiga_documento& rdoc, TPaf_record& paf) const
|
||||||
{
|
{
|
||||||
const TString8 codiva(rdoc.get(RDOC_CODIVA));
|
const TString8 codiva(rdoc.get(RDOC_CODIVA));
|
||||||
const TRectype& ai = cache().get("%IVA", codiva);
|
const TRectype& ai = cache().get("%IVA", codiva);
|
||||||
@ -932,12 +937,7 @@ void TDoc2Paf::set_IVA(const TRiga_documento& rdoc, const int regspiva, TPaf_rec
|
|||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
{
|
{
|
||||||
if (aliquota.is_zero())
|
if (aliquota.is_zero())
|
||||||
{
|
paf.set("PI_NATURA", natura(codiva));
|
||||||
const TString& tipo = ai.get("S1");
|
|
||||||
const int tipo_acquisti = ai.get_int("S8");
|
|
||||||
|
|
||||||
paf.set("PI_NATURA", natura(tipo, tipo_acquisti, regspiva));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
paf.set("PI_NATURA", "");
|
paf.set("PI_NATURA", "");
|
||||||
}
|
}
|
||||||
@ -955,7 +955,6 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
const TFirm& firm = prefix().firm();
|
const TFirm& firm = prefix().firm();
|
||||||
const char* const paese = "IT";
|
const char* const paese = "IT";
|
||||||
TCausale caus = TCausale(doc.tipo().causale(), doc.anno());
|
TCausale caus = TCausale(doc.tipo().causale(), doc.anno());
|
||||||
const int regspiva = caus.regime_speciale();
|
|
||||||
|
|
||||||
// <DatiTrassmissione>
|
// <DatiTrassmissione>
|
||||||
TPaf_record paf0100f("PAF0100F");
|
TPaf_record paf0100f("PAF0100F");
|
||||||
@ -1277,7 +1276,7 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
// paf1800f.set("PI_ALIQUOTAIVA", "22.00"); // Altrimenti scarta le righe di descrizione
|
// paf1800f.set("PI_ALIQUOTAIVA", "22.00"); // Altrimenti scarta le righe di descrizione
|
||||||
|
|
||||||
|
|
||||||
set_IVA(codivadefault, regspiva, paf1800f);
|
set_IVA(codivadefault, paf1800f);
|
||||||
|
|
||||||
if (rdoc->is_merce())
|
if (rdoc->is_merce())
|
||||||
{
|
{
|
||||||
@ -1299,7 +1298,7 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
paf1800f.set("PI_PREZZOUNIT", -rdoc->prezzo(true, false));
|
paf1800f.set("PI_PREZZOUNIT", -rdoc->prezzo(true, false));
|
||||||
}
|
}
|
||||||
paf1800f.set("PI_PRZTOTALE", rdoc->importo(true, false));
|
paf1800f.set("PI_PRZTOTALE", rdoc->importo(true, false));
|
||||||
set_IVA(*rdoc, regspiva, paf1800f);
|
set_IVA(*rdoc, paf1800f);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const TDate data = doc.get(DOC_DATADOC);
|
const TDate data = doc.get(DOC_DATADOC);
|
||||||
@ -1398,7 +1397,7 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
paf1800f.set("PI_PREZZOUNIT", prz);
|
paf1800f.set("PI_PREZZOUNIT", prz);
|
||||||
paf1800f.set("PI_PRZTOTALE", imp);
|
paf1800f.set("PI_PRZTOTALE", imp);
|
||||||
set_IVA(*rdoc, regspiva, paf1800f);
|
set_IVA(*rdoc, paf1800f);
|
||||||
} else
|
} else
|
||||||
if (rdoc->is_prestazione())
|
if (rdoc->is_prestazione())
|
||||||
{
|
{
|
||||||
@ -1407,7 +1406,7 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
paf1800f.set("PI_QUANTITA", qta);
|
paf1800f.set("PI_QUANTITA", qta);
|
||||||
paf1800f.set("PI_PREZZOUNIT", rdoc->prezzo(false, false));
|
paf1800f.set("PI_PREZZOUNIT", rdoc->prezzo(false, false));
|
||||||
paf1800f.set("PI_PRZTOTALE", rdoc->importo(true, false));
|
paf1800f.set("PI_PRZTOTALE", rdoc->importo(true, false));
|
||||||
set_IVA(*rdoc, regspiva, paf1800f);
|
set_IVA(*rdoc, paf1800f);
|
||||||
}
|
}
|
||||||
|
|
||||||
paf1800f.set("PI_GESTIONE", "D");
|
paf1800f.set("PI_GESTIONE", "D");
|
||||||
@ -1436,13 +1435,8 @@ bool TDoc2Paf::elabora(TDocumentoEsteso& doc)
|
|||||||
paf2200f.set("PL_KEYNPROGR", ++num_riep);
|
paf2200f.set("PL_KEYNPROGR", ++num_riep);
|
||||||
paf2200f.set("PL_ALIQUOTAIVA", aliquota);
|
paf2200f.set("PL_ALIQUOTAIVA", aliquota);
|
||||||
if (aliquota.is_zero())
|
if (aliquota.is_zero())
|
||||||
{
|
paf2200f.set("PL_NATURA", natura(riva.cod_iva().codice()));
|
||||||
const TString& tipo = riva.cod_iva().tipo();
|
|
||||||
const int tipo_acquisti = riva.cod_iva().get_int("S8");
|
|
||||||
|
|
||||||
paf2200f.set("PL_NATURA", natura(tipo, tipo_acquisti, regspiva));
|
|
||||||
|
|
||||||
}
|
|
||||||
paf2200f.set("PL_IMPONIBILE", riva.imponibile());
|
paf2200f.set("PL_IMPONIBILE", riva.imponibile());
|
||||||
paf2200f.set("PL_IMPOSTA", riva.imposta());
|
paf2200f.set("PL_IMPOSTA", riva.imposta());
|
||||||
paf2200f.set("PL_ESIGIVA", eiva);
|
paf2200f.set("PL_ESIGIVA", eiva);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user