mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 23:37:51 +01:00
Fix row-list per calcolo iva anche su ddt e ordini
This commit is contained in:
parent
f852fe0262
commit
5f473b1d68
@ -60,10 +60,18 @@ if (!empty($rs)) {
|
||||
|
||||
// costo unitario
|
||||
echo '
|
||||
<td class="text-center">';
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
echo '
|
||||
'.Translator::numberToLocale($r['subtotale'] / $r['qta']).' €';
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">'.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
}
|
||||
}
|
||||
echo'
|
||||
</td>';
|
||||
@ -84,15 +92,7 @@ if (!empty($rs)) {
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
echo '
|
||||
'.Translator::numberToLocale($r['subtotale']).' €';
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">- '.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
}
|
||||
'.Translator::numberToLocale($r['subtotale'] - $r['sconto']).' €';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
@ -19,7 +19,7 @@ echo '
|
||||
/*
|
||||
Articoli e righe generiche
|
||||
*/
|
||||
$q_art = 'SELECT *, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice FROM `dt_righe_ddt` WHERE idddt='.prepare($id_record).' ORDER BY `order`';
|
||||
$q_art = 'SELECT *, round(iva,'.Settings::get('Cifre decimali per importi').') AS iva, round(sconto_unitario,'.Settings::get('Cifre decimali per importi').') AS sconto_unitario, round(sconto,'.Settings::get('Cifre decimali per importi').') AS sconto, round(subtotale,'.Settings::get('Cifre decimali per importi').') AS subtotale, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice FROM `dt_righe_ddt` WHERE idddt='.prepare($id_record).' ORDER BY `order`';
|
||||
$rs = $dbo->fetchArray($q_art);
|
||||
|
||||
if (!empty($rs)) {
|
||||
@ -119,7 +119,7 @@ if (!empty($rs)) {
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">- '.tr('sconto _TOT_ _TYPE_', [
|
||||
<br><small class="label label-danger">'.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
@ -210,7 +210,7 @@ echo '
|
||||
// Calcoli
|
||||
$imponibile = sum(array_column($rs, 'subtotale'));
|
||||
$sconto = sum(array_column($rs, 'sconto'));
|
||||
$iva = sum(array_column($rs, 'iva'), null, 2);
|
||||
$iva = sum(array_column($rs, 'iva'));
|
||||
|
||||
$imponibile_scontato = sum($imponibile, -$sconto);
|
||||
|
||||
|
@ -197,7 +197,7 @@ if (!empty($rs)) {
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">- '.tr('sconto _TOT_ _TYPE_', [
|
||||
<br><small class="label label-danger">'.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
|
@ -5,19 +5,21 @@ include_once __DIR__.'/../../core.php';
|
||||
// Mostro le righe dell'ordine
|
||||
echo '
|
||||
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||
<tr>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="120">'.tr('Q.tà').'</th>
|
||||
<th width="80">'.tr('U.m.').'</th>
|
||||
<th width="120">'.tr('Costo unitario').'</th>
|
||||
<th width="120">'.tr('Iva').'</th>
|
||||
<th width="120">'.tr('Imponibile').'</th>
|
||||
<th width="60"></th>
|
||||
</tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="120">'.tr('Q.tà').'</th>
|
||||
<th width="80">'.tr('U.m.').'</th>
|
||||
<th width="120">'.tr('Costo unitario').'</th>
|
||||
<th width="120">'.tr('Iva').'</th>
|
||||
<th width="120">'.tr('Imponibile').'</th>
|
||||
<th width="60"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="sortable">';
|
||||
|
||||
$q = 'SELECT *, (SELECT codice FROM mg_articoli WHERE mg_articoli.id=`or_righe_ordini`.`idarticolo`) AS codice FROM `or_righe_ordini` WHERE idordine='.prepare($id_record).' ORDER BY `order`';
|
||||
$q = 'SELECT *, round(iva,'.Settings::get('Cifre decimali per importi').') AS iva, round(sconto_unitario,'.Settings::get('Cifre decimali per importi').') AS sconto_unitario, round(sconto,'.Settings::get('Cifre decimali per importi').') AS sconto, round(subtotale,'.Settings::get('Cifre decimali per importi').') AS subtotale, (SELECT codice FROM mg_articoli WHERE mg_articoli.id=`or_righe_ordini`.`idarticolo`) AS codice FROM `or_righe_ordini` WHERE idordine='.prepare($id_record).' ORDER BY `order`';
|
||||
$rs = $dbo->fetchArray($q);
|
||||
|
||||
if (!empty($rs)) {
|
||||
@ -109,7 +111,7 @@ if (!empty($rs)) {
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">- '.tr('sconto _TOT_ _TYPE_', [
|
||||
<br><small class="label label-danger">'.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
@ -193,10 +195,12 @@ echo '
|
||||
// Calcoli
|
||||
$imponibile = sum(array_column($rs, 'subtotale'));
|
||||
$sconto = sum(array_column($rs, 'sconto'));
|
||||
$iva = sum(array_column($rs, 'iva'), null, 2);
|
||||
$iva = sum(array_column($rs, 'iva'));
|
||||
|
||||
$imponibile_scontato = sum($imponibile, -$sconto);
|
||||
|
||||
|
||||
|
||||
$totale_iva = sum($iva, $records[0]['iva_rivalsainps']);
|
||||
|
||||
$totale = sum([
|
||||
@ -248,7 +252,7 @@ if (abs($sconto) > 0) {
|
||||
<td></td>
|
||||
</tr>';
|
||||
|
||||
$totale -= $sconto;
|
||||
//$totale -= $sconto;
|
||||
}
|
||||
|
||||
// RIVALSA INPS
|
||||
|
@ -67,7 +67,7 @@ if (!empty($rs)) {
|
||||
|
||||
if ($r['sconto_unitario'] > 0) {
|
||||
echo '
|
||||
<br><small class="label label-danger">- '.tr('sconto _TOT_ _TYPE_', [
|
||||
<br><small class="label label-danger">'.tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user