Patch level : 12.0 nopatch

Files correlati     :
Commento:
sconto in fattura nell'invio
This commit is contained in:
smen 2022-04-04 17:10:43 +02:00
parent db67361893
commit ee6464deec
2 changed files with 36 additions and 3 deletions

View File

@ -790,6 +790,8 @@ const char* TPaf_container::paf_to_prefix(const char * paf)
return "P7";
if (paf_name == "PAF0800F")
return "P8";
if (paf_name == "PAF0900F")
return "P9";
if (paf_name == "PAF1000F")
return "P0";
if (paf_name == "PAF1100F")
@ -1779,6 +1781,8 @@ void TDoc_fp::fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TStr
bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
{
int linea_sconto = 0;
if (!initialize(doc))
return false;
bool ok = true;
@ -1869,11 +1873,11 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
tab_codiso.put("CODTAB", stato); tab_codiso.read();
TString piva = cliente.partita_IVA(),
fisc = cliente.codice_fiscale();
fisc = cliente.codice_fiscale();
if (!stato.full())
stato = "IT";
if (tab_codiso.get_bool("B0") || stato == "IT") // Cliente EU
if (tab_codiso.get_bool("B0") || stato == "IT") // Cliente EU
{
if (stato == "IT")
{
@ -2018,6 +2022,23 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
com.add_front_and_back("#");
}
//SCONTO IN FATTURA
const real sconto_in_fat = doc.get_real(DOC_SCONTOFATT);
if (sconto_in_fat > ZERO)
{
TPaf_record& paf0900f = _paf_container.get_paf("PAF0900F");
reset(paf0900f);
paf0900f.set("P9_RIFNUMLINEA", (real)linea_sconto++);
paf0900f.set("P9_TIPOSCONTO", "SC");
paf0900f.set("P9_IMPSCONTO", sconto_in_fat);
paf0900f.set("P9_GESTIONE", stato_paf());
ok &= insert(paf0900f);
}
// SEMPRE
// Azzera contratti
TPaf_record& paf1000f = _paf_container.get_paf("PAF1000F");
@ -2481,6 +2502,15 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
riga++;
}
}
if (sconto_in_fat > ZERO)
{
reset(paf2100f);
paf2100f.set("PK_KEYNLINAR", _idx_adg_doc_row++);
//paf2100f.set("PK_TIPODATO", "Sconto"); DA CAPIRE COSA METTERCI
paf2100f.set("PK_RIFDATO", "Sconto praticato in base all articolo 121 del decreto - legge n. 34 del 2020");
ok &= insert(paf2100f);
}
// Se il bollo va fatto pagare bisogna aggiungere una riga!
const real importo_bolli = doc.get_real(DOC_BOLLI);
if (doc.get_bool(DOC_ADDBOLLI) && importo_bolli > ZERO)
@ -2696,6 +2726,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
paf2500f.set("PO_MODALITAPAGAM", cache().get("%CLR", key_class, "S12")); // Si assicura che il numero riga sia accettabile
TToken_string& riga_scadenze = scad.row(nr); // Data|Importo
paf2500f.set("PO_DATASCADENZA", TDate(riga_scadenze.get(0))); // Data scadenza
paf2500f.set("PO_IMPORTO", converti_prezzo(real(riga_scadenze.get()))); // Importo rata
paf2500f.set("PO_GESTIONE", stato_paf());
ok &= insert(paf2500f);

View File

@ -174,6 +174,8 @@ void TDocumentoEsteso::scadenze_recalc()
const bool saldo = hh.get_bool(DOC_ACCSALDO);
real totimponibili = totale_doc() - ritenute() - totimposte - totspese;
const bool is_in_valuta = in_valuta();
pagato += get_real(DOC_SCONTOFATT);
if (is_split_payment())
totimposte = ZERO;