2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../../core.php' ;
2018-06-26 09:41:43 +02:00
include_once Modules :: filepath ( 'Interventi' , 'modutil.php' );
2017-08-04 16:28:16 +02:00
// INTERVENTI ESEGUITI SU QUESTO IMPIANTO
echo '
< div class = " box " >
< div class = " box-header with-border " >
2017-09-04 12:02:29 +02:00
< h3 class = " box-title " > '.tr(' Interventi eseguiti su questo impianto ').' </ h3 >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " box-body " > ' ;
2017-12-20 14:05:14 +01:00
$results = $dbo -> fetchArray ( 'SELECT in_interventi.id, in_interventi.codice, descrizione, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=my_impianti_interventi.idintervento) AS data FROM my_impianti_interventi INNER JOIN in_interventi ON my_impianti_interventi.idintervento=in_interventi.id WHERE idimpianto=' . prepare ( $id_record ) . ' ORDER BY data DESC' );
2018-03-23 11:35:17 +01:00
$totale_interventi = 0 ;
2017-08-04 16:28:16 +02:00
if ( ! empty ( $results )) {
echo '
< table class = " table table-striped table-hover " >
< tr >
2018-03-23 11:35:17 +01:00
< th width = " 350 " > '.tr(' Intervento ').' </ th >
2017-09-04 12:02:29 +02:00
< th > '.tr(' Descrizione ').' </ th >
2018-03-23 11:35:17 +01:00
< th width = " 150 " class = " text-right " > '.tr(' Costo totale ').' </ th >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
foreach ( $results as $result ) {
2018-03-23 11:35:17 +01:00
$costi_intervento = get_costi_intervento ( $result [ 'id' ]);
$totale_interventi += $costi_intervento [ 'totale' ];
2017-08-04 16:28:16 +02:00
echo '
< tr >
< td >
2017-12-20 14:05:14 +01:00
'.Modules::link(' Interventi ', $result[' id '], tr(' Intervento num . _NUM_ del _DATE_ ' , [
2017-09-21 10:01:07 +02:00
'_NUM_' => $result [ 'codice' ],
2017-09-10 14:35:41 +02:00
'_DATE_' => Translator :: dateToLocale ( $result [ 'data' ]),
])) . '
2017-08-04 16:28:16 +02:00
</ td >
< td > '.nl2br($result[' descrizione ']).' </ td >
2018-03-23 11:35:17 +01:00
< td class = " text-right " > '.Translator::numberToLocale($costi_intervento[' totale ']).' & euro ; </ td >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
}
2018-06-26 09:41:43 +02:00
2018-03-23 11:35:17 +01:00
echo ' <tr>' ;
echo ' <td colspan="2" class="text-right">' ;
echo ' <b>Totale:</b>' ;
echo ' </td>' ;
echo ' <td class="text-right">' ;
echo '<b>' . Translator :: numberToLocale ( $totale_interventi ) . ' €</b>' ;
echo ' </td>' ;
echo ' </tr>' ;
2018-06-26 09:41:43 +02:00
2017-08-04 16:28:16 +02:00
echo '
</ table > ' ;
} else {
echo '
2018-08-28 17:10:23 +02:00
< div class = \ 'alert alert-info\' ><i class=\'fa fa-info-circle\'></i> ' . tr ( 'Nessun intervento su questo impianto' ) . '.</div>' ;
2017-08-04 16:28:16 +02:00
}
echo '
</ div >
</ div > ' ;