2023-11-30 12:57:03 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
// Elenco articoli caricati sull'automezzo
|
2024-02-06 17:36:05 +01:00
|
|
|
$rs2 = $dbo->fetchArray('SELECT
|
2024-02-29 15:10:55 +01:00
|
|
|
`mg_movimenti`.`idsede` AS id,
|
|
|
|
`mg_articoli`.`codice` AS codice,
|
|
|
|
`idarticolo`,
|
|
|
|
SUM(`mg_movimenti`.`qta`) AS qta_automezzo,
|
|
|
|
`mg_articoli`.`qta` AS qta_magazzino,
|
2024-04-18 17:44:05 +02:00
|
|
|
`mg_articoli_lang`.`title`,
|
2024-02-29 15:10:55 +01:00
|
|
|
`mg_articoli`.`prezzo_vendita`,
|
2024-03-22 15:52:24 +01:00
|
|
|
(SELECT `percentuale` FROM `co_iva` LEFT JOIN `co_iva_lang` ON ( `co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `co_iva`.`id`=`mg_articoli`.`idiva_vendita`) AS prciva_vendita
|
2024-02-29 15:10:55 +01:00
|
|
|
FROM
|
|
|
|
`mg_movimenti`
|
|
|
|
INNER JOIN `mg_articoli` ON `mg_movimenti`.`idarticolo`=`mg_articoli`.`id`
|
2024-03-22 15:52:24 +01:00
|
|
|
LEFT JOIN `mg_articoli_lang` ON (`mg_articoli`.`id` = `mg_articoli_lang`.`id_record` AND `mg_articoli_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
|
2024-02-29 15:10:55 +01:00
|
|
|
WHERE
|
|
|
|
`mg_movimenti`.`idsede`='.prepare($id_record).'
|
|
|
|
GROUP BY
|
|
|
|
`idarticolo`
|
|
|
|
HAVING
|
|
|
|
`qta_automezzo`>0
|
|
|
|
ORDER BY
|
2024-04-18 17:44:05 +02:00
|
|
|
`mg_articoli_lang`.`title`');
|
2023-11-30 12:57:03 +01:00
|
|
|
|
|
|
|
if (!empty($rs2)) {
|
|
|
|
echo '
|
|
|
|
<div style="max-height: 300px; overflow: auto;">
|
2024-10-16 15:48:50 +02:00
|
|
|
<table class="table table-striped table-hover table-sm">
|
2023-11-30 12:57:03 +01:00
|
|
|
<tr>
|
|
|
|
<th>'.tr('Articolo').'</th>
|
|
|
|
<th width="25%">'.tr('Q.tà').'</th>
|
|
|
|
<th width="25%">'.tr('Prezzo di vendita').'</th>
|
|
|
|
<th width="10%"></th>
|
|
|
|
</tr>';
|
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
foreach ($rs2 as $r) {
|
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
<tr>';
|
2023-12-01 17:21:47 +01:00
|
|
|
// Articolo
|
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
<td class="text-left">
|
|
|
|
'.Modules::link('Articoli', $r['idarticolo'], $r['codice'].' - '.$r['descrizione']).'
|
|
|
|
</td>';
|
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
// Quantità
|
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
<td class="first_cell center">
|
|
|
|
<span><big>'.Translator::numberToLocale($r['qta_automezzo']).'</big></span><br/>
|
|
|
|
<small>'.tr('Q.tà magazzino').': '.Translator::numberToLocale($r['qta_magazzino']).'</small><br/>
|
|
|
|
</td>';
|
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
// Prezzo di vendita
|
|
|
|
$netto = $r['prezzo_vendita'];
|
|
|
|
$iva = $r['prezzo_vendita'] / 100 * $r['prciva_vendita'];
|
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
<td class="table_cell center">
|
|
|
|
<span>'.Translator::numberToLocale($netto + $iva).' €</span><br/>
|
|
|
|
<small>'.tr('Netto').': '.Translator::numberToLocale($netto).' €</small><br/>
|
|
|
|
<small>'.tr('Iva').': '.Translator::numberToLocale($iva).' €</small><br/>
|
|
|
|
</td>';
|
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
// Pulsanti
|
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
<td class="text-center">
|
2024-05-16 18:02:50 +02:00
|
|
|
<a class="btn btn-warning btn-xs" data-href="'.$structure->fileurl('add_articolo.php').'?idautomezzo='.$id_record.'&idarticolo='.$r['idarticolo'].'" data-widget="modal" data-title="'.tr('Aggiungi articoli').'">
|
2023-11-30 12:57:03 +01:00
|
|
|
<i class="fa fa-edit"></i>
|
|
|
|
</a>
|
|
|
|
<a class="btn btn-danger btn-xs ask" data-backto="record-edit" data-op="moverow" data-idautomezzotecnico="'.$r['id'].'", data-idarticolo="'.$r['idarticolo'].'" data-msg="'.tr("Rimuovere articolo dell'automezzo?").'">
|
|
|
|
<i class="fa fa-trash"></i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
$tot_articoli += $r['qta_automezzo'];
|
|
|
|
}
|
2023-11-30 12:57:03 +01:00
|
|
|
|
2023-12-01 17:21:47 +01:00
|
|
|
echo '
|
2023-11-30 12:57:03 +01:00
|
|
|
</table>
|
|
|
|
</div>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<p>'.tr('Nessun articolo presente').'...</p>';
|
|
|
|
}
|