2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
$query = 'SELECT * FROM in_righe_interventi WHERE idintervento='.prepare($id_record).' '.Modules::getAdditionalsQuery('Magazzino').' ORDER BY id ASC';
|
|
|
|
$rs2 = $dbo->fetchArray($query);
|
|
|
|
|
|
|
|
if (count($rs2) > 0) {
|
|
|
|
echo '
|
|
|
|
<table class="table table-striped table-condensed table-hover table-bordered">
|
|
|
|
<tr>
|
|
|
|
<th>'._('Descrizione').'</th>
|
|
|
|
<th width="8%">'._('Q.tà').'</th>
|
|
|
|
<th width="15%">'._('Prezzo di acquisto').'</th>';
|
|
|
|
|
2017-08-07 13:07:18 +02:00
|
|
|
if (Auth::admin() || $_SESSION['gruppo'] != 'Tecnici') {
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
|
|
|
<th width="15%">'._('Prezzo di vendita').'</th>
|
|
|
|
<th width="15%">'._('Subtotale').'</th>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($records[0]['stato'] != 'Fatturato' && $records[0]['stato'] != 'Completato') {
|
|
|
|
echo '
|
|
|
|
<th width="80"></th>';
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
foreach ($rs2 as $r) {
|
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<input type="hidden" name="id" value="'.$r['id'].'">
|
|
|
|
'.nl2br($r['descrizione']).'
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
// Quantità
|
|
|
|
echo '
|
|
|
|
<td class="text-right">
|
|
|
|
'.Translator::numberToLocale($r['qta']).' '.$r['um'].'
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
//Costo unitario
|
|
|
|
echo '
|
|
|
|
<td class="text-right">
|
|
|
|
'.Translator::numberToLocale($r['prezzo_acquisto']).' €
|
|
|
|
</td>';
|
|
|
|
|
2017-08-07 13:07:18 +02:00
|
|
|
if (Auth::admin() || $_SESSION['gruppo'] != 'Tecnici') {
|
2017-08-04 16:28:16 +02:00
|
|
|
// Prezzo unitario
|
|
|
|
$netto = $r['prezzo_vendita'] - $r['sconto_unitario'];
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<td class="text-right">
|
|
|
|
'.Translator::numberToLocale($r['prezzo_vendita']).' €';
|
|
|
|
|
|
|
|
if ($r['sconto_unitario'] > 0) {
|
|
|
|
echo '
|
|
|
|
<br><span class="label label-danger">
|
|
|
|
- sconto '.Translator::numberToLocale($r['sconto_unitario']).($r['tipo_sconto'] == 'PRC' ? '%' : ' €').'
|
|
|
|
</span>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
// Prezzo di vendita
|
|
|
|
echo '
|
|
|
|
<td class="text-right">
|
|
|
|
<span class="prezzo_articolo">'.Translator::numberToLocale(sum($r['prezzo_vendita'] * $r['qta'], -$r['sconto'])).'</span> €
|
|
|
|
</td>';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pulsante per riportare nel magazzino centrale.
|
|
|
|
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
|
|
|
|
if ($records[0]['stato'] != 'Fatturato' && $records[0]['stato'] != 'Completato') {
|
|
|
|
echo '
|
|
|
|
<td>
|
|
|
|
<button type="button" class="btn btn-warning btn-xs" data-toggle="tooltip" onclick="launch_modal(\''._('Modifica spesa').'\', \''.$rootdir.'/modules/interventi/add_righe.php?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$r['id'].'\', 1);"><i class="fa fa-edit"></i></button>
|
2017-08-28 09:50:25 +02:00
|
|
|
<button type="button" class="btn btn-danger btn-xs" data-toggle="tooltip" onclick="if(confirm(\''._('Eliminare questa spesa?').'\')){ elimina_riga( \''.$r['id'].'\' ); }"><i class="fa fa-trash"></i></button>
|
2017-08-04 16:28:16 +02:00
|
|
|
</td>';
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</table>';
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function elimina_riga( id ){
|
|
|
|
$.post(globals.rootdir + '/modules/interventi/actions.php', { op: 'delriga', idriga: id }, function(data, result){
|
|
|
|
if( result=='success' ){
|
|
|
|
//ricarico l'elenco delle righe
|
|
|
|
$('#righe').load( globals.rootdir + '/modules/interventi/ajax_righe.php?id_module=<?php echo $id_module ?>&id_record=<?php echo $id_record ?>');
|
|
|
|
|
|
|
|
$('#costi').load(globals.rootdir + '/modules/interventi/ajax_costi.php?id_module=<?php echo $id_module ?>&id_record=<?php echo $id_record ?>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|