Merge pull request #202 from devcode-it/2.4

Merge branch '2.4' to master
This commit is contained in:
Luca 2018-03-27 16:06:13 +02:00 committed by GitHub
commit 7a074a06a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -785,6 +785,10 @@ function aggiorna_sconto($tables, $fields, $id_record, $options = [])
$descrizione = $descrizione.' '.Translator::numberToLocale($sconto[0]['sconto_globale']).'%';
} else {
$rs = $dbo->fetchArray('SELECT SUM(subtotale - sconto) AS imponibile, SUM(iva) AS iva FROM (SELECT '.$tables['row'].'.subtotale, '.$tables['row'].'.sconto, '.$tables['row'].'.iva FROM '.$tables['row'].' WHERE '.$fields['row'].'='.prepare($id_record).') AS t');
$subtotale = $rs[0]['imponibile'];
$iva += $sconto[0]['sconto_globale'] * $rs[0]['iva'] / $subtotale;
$subtotale = -$sconto[0]['sconto_globale'];
}