2021-12-16 12:25:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (file_exists(__DIR__.'/../../../core.php')) {
|
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
} else {
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
}
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
$righe = $dbo->fetchArray('SELECT * FROM in_righe_tipiinterventi WHERE id_tipointervento='.prepare($id_record));
|
2021-12-16 12:25:25 +01:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2024-10-16 15:48:50 +02:00
|
|
|
<table class="table table-striped table-sm table-hover table-bordered">
|
2021-12-16 12:25:25 +01:00
|
|
|
<tr>
|
|
|
|
<th>'.tr('Descrizione').'</th>
|
|
|
|
<th width="8%">'.tr('Q.tà').'</th>
|
|
|
|
<th width="15%">'.tr('Prezzo di acquisto').'</th>
|
|
|
|
<th width="15%">'.tr('Prezzo di vendita').'</th>
|
|
|
|
<th width="8%">'.tr('Iva').'</th>
|
|
|
|
<th width="8%">'.tr('Subtotale').'</th>
|
|
|
|
<th class="text-center" width="8%">'.tr('#').'</th>
|
|
|
|
</tr>';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
foreach ($righe as $riga) {
|
2024-02-06 17:36:05 +01:00
|
|
|
$rs = $dbo->fetchArray('SELECT `percentuale` FROM `co_iva` WHERE `id`='.$riga['idiva']);
|
2024-01-15 15:30:45 +01:00
|
|
|
$iva = ($riga['subtotale'] * $rs[0]['percentuale']) / 100;
|
2021-12-16 12:25:25 +01:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2021-12-16 12:25:25 +01:00
|
|
|
<tr>
|
|
|
|
<td class="text-left">'.$riga['descrizione'].'</td>
|
|
|
|
<td class="text-right">'.number_format($riga['qta'], 2, ',', '.').' '.$riga['um'].'</td>
|
|
|
|
<td class="text-right">'.number_format($riga['prezzo_acquisto'], 2, ',', '.').' €</td>
|
|
|
|
<td class="text-right">'.number_format($riga['prezzo_vendita'], 2, ',', '.').' €</td>
|
|
|
|
<td class="text-right">'.number_format($iva, 2, ',', '.').' €</td>
|
|
|
|
<td class="text-right">'.number_format($riga['subtotale'], 2, ',', '.').' €</td>
|
2024-05-16 18:02:50 +02:00
|
|
|
<td class="text-center"><button type="button" class="btn btn-xs btn-warning" onclick="launch_modal(\''.tr('Aggiungi riga').'\', \''.$module->fileurl('add_righe.php').'?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$riga['id'].'\', 1);"><i class="fa fa-edit"></i></button> <button type="button" class="btn btn-xs btn-danger" data-widget="tooltip" onclick="if(confirm(\''.tr('Eliminare questa riga?').'\')){ elimina_riga( \''.$riga['id'].'\' ); }"><i class="fa fa-trash"></i></button></td>
|
2021-12-16 12:25:25 +01:00
|
|
|
</tr>';
|
2024-01-15 15:30:45 +01:00
|
|
|
}
|
2021-12-16 12:25:25 +01:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2021-12-16 12:25:25 +01:00
|
|
|
</table>';
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function elimina_riga( id ){
|
2023-08-04 14:54:28 +02:00
|
|
|
$.post('<?php echo $module->fileurl('actions.php'); ?>', { op: 'delriga', idriga: id }, function(data, result){
|
2021-12-16 12:25:25 +01:00
|
|
|
if( result=='success' ){
|
|
|
|
//ricarico l'elenco delle righe
|
2023-08-04 14:54:28 +02:00
|
|
|
$('#righe').load( '<?php echo $module->fileurl('ajax_righe.php'); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');
|
2021-12-16 12:25:25 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|