Merge remote-tracking branch 'origin/R_10_00' into R_10_00
This commit is contained in:
commit
496bf39046
@ -2808,8 +2808,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
||||
partita.put(PART_SEZ, sezione);
|
||||
|
||||
const real totdoc(head.get(MOV_TOTDOC));
|
||||
const real totdocval(head.get(MOV_TOTDOCVAL));
|
||||
const bool in_valuta = cambio.in_valuta();
|
||||
const real totdocval(head.get_real(MOV_TOTDOCVAL));
|
||||
const bool in_valuta = cambio.in_valuta();
|
||||
const bool swapped = !in_valuta && test_swap();
|
||||
const TCurrency_documento td((in_valuta ? totdocval : totdoc) * (swapped ? -UNO : UNO), doc);
|
||||
|
||||
@ -2961,7 +2961,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
||||
} // if fattura
|
||||
else if (is_nc)
|
||||
{
|
||||
TImporto residuoval(sezione, doc.totale_doc());
|
||||
TImporto residuoval(sezione, abs(totdocval));
|
||||
TImporto residuolit(sezione, abs(totdoc));
|
||||
|
||||
partita.put(PART_DATAPAG, doc.get(DOC_DATADOC));
|
||||
@ -2990,24 +2990,39 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
||||
if (p > 0 && p < nuova_riga)
|
||||
{
|
||||
TPagamento& pag = doc.pagamento();
|
||||
|
||||
TCurrency_documento totdoc(abs(doc.totale_doc()), doc);
|
||||
TCurrency_documento totspese(abs(doc.spese()), doc);
|
||||
TCurrency_documento totimposte(abs(doc.imposta(true)), doc);
|
||||
TCurrency_documento totimponibili = totdoc - totspese - totimposte;
|
||||
|
||||
if (in_valuta)
|
||||
{
|
||||
TCurrency_documento val2(totimposte); val2.change_to_firm_val();
|
||||
TCurrency_documento val3(totspese); val3.change_to_firm_val();
|
||||
TCurrency_documento val1(totdoc); val1.change_to_firm_val(); val1 -= val2+val3;
|
||||
// Cosi' corregge eventuali scompensi di poche lirette
|
||||
TCurrency_documento totdoc(abs(totdocval), doc);
|
||||
TCurrency_documento totspese(abs(doc.spese()), doc);
|
||||
TCurrency_documento totimposte(abs(doc.imposta(true)), doc);
|
||||
TCurrency_documento totimponibili = totdoc - totspese;
|
||||
|
||||
if (!cached_causale(head.get(MOV_CODCAUS), head.get_int(MOV_ANNOES)).reverse_charge_pubb())
|
||||
totimponibili -= totimposte;
|
||||
|
||||
TCurrency_documento val1(totimponibili); val1.change_to_firm_val();
|
||||
TCurrency_documento val2(totimposte); val2.change_to_firm_val();
|
||||
TCurrency_documento val3(totspese); val3.change_to_firm_val();
|
||||
|
||||
// Cosi' corregge eventuali scompensi di poche lirette
|
||||
pag.set_total_valuta(totimponibili, totimposte, totspese, val1, val2, val3);
|
||||
}
|
||||
else
|
||||
pag.set_total(totimponibili, totimposte, totspese);
|
||||
{
|
||||
TCurrency_documento totdoc(abs(totdoc), doc);
|
||||
TCurrency_documento totspese(abs(doc.spese()), doc);
|
||||
TCurrency_documento totimposte(abs(doc.imposta(true)), doc);
|
||||
TCurrency_documento totimponibili = totdoc - totspese - totimposte;
|
||||
|
||||
if (!cached_causale(head.get(MOV_CODCAUS), head.get_int(MOV_ANNOES)).reverse_charge_pubb())
|
||||
totimponibili -= totimposte;
|
||||
pag.set_total(totimponibili, totimposte, totspese);
|
||||
}
|
||||
pag.set_rate_auto();
|
||||
|
||||
const TRiga_partite& fatt = newgame->riga(p);
|
||||
|
||||
for (int r = 1; r <= fatt.rate() && r <= pag.n_rate(); r++)
|
||||
{
|
||||
const TRiga_scadenze& rata = fatt.rata(r);
|
||||
@ -3058,7 +3073,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
||||
}
|
||||
}
|
||||
|
||||
if (!residuoval.is_zero())
|
||||
if ((!residuoval.is_zero()) || (!residuolit.is_zero()))
|
||||
{
|
||||
// Pagamento non assegnato
|
||||
TRectype unpag = newgame->pagamento(TPartita::UNASSIGNED, 0, nuova_riga);
|
||||
@ -3068,7 +3083,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
||||
unpag.put(PAGSCA_IMPORTO, residuolit.valore());
|
||||
}
|
||||
else
|
||||
unpag.put(PAGSCA_IMPORTO, residuoval.valore());
|
||||
unpag.put(PAGSCA_IMPORTO, residuolit.valore());
|
||||
unpag.put(PAGSCA_ACCSAL, "A");
|
||||
newgame->modifica_pagamento(unpag, cambio, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user