2017-08-04 16:28:16 +02:00
< ? php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager : il software gestionale open source per l ' assistenza tecnica e la fatturazione
* Copyright ( C ) DevCode s . n . c .
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < https :// www . gnu . org / licenses />.
*/
2017-08-04 16:28:16 +02:00
include_once __DIR__ . '/../../../core.php' ;
2018-06-26 09:41:43 +02:00
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 ) {
2019-07-12 17:35:14 +02:00
$intervento = \Modules\Interventi\Intervento :: find ( $result [ 'id' ]);
$totale_interventi += $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 >
2020-02-04 19:34:23 +01:00
< td class = " text-right " > '.moneyFormat($intervento->totale).' </ 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">' ;
2019-04-13 02:56:39 +02:00
echo '<b>' . moneyFormat ( $totale_interventi ) . '</b>' ;
2018-03-23 11:35:17 +01:00
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 > ' ;