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
2021-01-20 15:08:51 +01:00
* Copyright ( C ) DevCode s . r . l .
2020-09-07 15:04:06 +02:00
*
* 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
2020-09-09 15:12:02 +02:00
use Modules\Interventi\Intervento ;
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 ) {
2020-09-09 15:12:02 +02:00
$intervento = Intervento :: find ( $result [ 'id' ]);
2019-07-12 17:35:14 +02:00
$totale_interventi += $intervento -> totale ;
2017-08-04 16:28:16 +02:00
echo '
< tr >
< td >
2020-09-09 15:12:02 +02:00
'.Modules::link(' Interventi ', $result[' id '], $intervento->getReference()).'
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
2020-09-09 15:12:02 +02:00
echo ' < tr >
< td colspan = " 2 " class = " text-right " >
< b > '.tr(' Totale ').' :</ b >
</ td >
< td class = " text-right " >
< b > '.moneyFormat($totale_interventi).' </ b >
</ td >
</ tr > ' ;
2018-06-26 09:41:43 +02:00
2017-08-04 16:28:16 +02:00
echo '
</ table > ' ;
} else {
echo '
2021-08-05 18:17:26 +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 > ' ;