Patch level : 12.0 752

Files correlati     : ve
Commento            : Aggiunto calcolo della ritenuta passato da Alessandro
This commit is contained in:
Mattia Tollari 2019-04-02 14:55:59 +02:00
parent de9db58ec7
commit 7fa5b469bf

View File

@ -746,15 +746,44 @@ real TRiga_documento::ritenuta(const char tipor, bool lordo, int ndec) const
real val;
if (tipo().tipo() == RIGA_SPESEDOC)
{
const char tipo_rit = spesa().tipo_ritenuta();
{
const char tipo_rit = spesa().tipo_ritenuta();
if ((tipor != '\0' && tipo_rit == tipor) || (tipor == '\0' && tipo_rit != '\0'))
{
if ((tipor != '\0' && tipo_rit == tipor) || (tipor == '\0' && tipo_rit != '\0'))
{
_rit_calc = true;
val = importo(true, lordo, ndec);
if (spesa().is_percentuale() && spesa().field_perc().blank())
{
real imponibile;
FOR_EACH_PHYSICAL_RDOC(doc(), r, rdoc1)
{
if (rdoc1->is_prestazione())
{
imponibile += rdoc1->imponibile();
}
}
// Riciclo per sommare la % delle spese da sommare
FOR_EACH_PHYSICAL_RDOC(doc(), r, rdoc2)
{
if (rdoc2->is_spese() && rdoc2->spesa().spe_cal_rit())
{
if (rdoc2->spesa().is_percentuale())
val += imponibile * rdoc2->spesa().perc() / CENTO;
else
val = rdoc2->importo(true, lordo, ndec);
}
}
val += imponibile;
val *= spesa().perc() / CENTO;
val.round(2);
}
else
val = importo(true, lordo, ndec);
_rit_calc = false;
}
}
}
return val;
}