2017-08-04 16:28:16 +02:00
< ? php
2018-06-26 14:30:26 +02:00
if ( file_exists ( __DIR__ . '/../../../core.php' )) {
include_once __DIR__ . '/../../../core.php' ;
} else {
include_once __DIR__ . '/../../core.php' ;
2018-06-18 15:56:00 +02:00
}
2018-09-28 16:43:40 +02:00
$show_prezzi = Auth :: user ()[ 'gruppo' ] != 'Tecnici' || ( Auth :: user ()[ 'gruppo' ] == 'Tecnici' && setting ( 'Mostra i prezzi al tecnico' ));
2018-07-08 18:11:17 +02:00
$idiva = setting ( 'Iva predefinita' );
2017-11-16 18:55:03 +01:00
$rs_iva = $dbo -> fetchArray ( 'SELECT descrizione, percentuale, indetraibile FROM co_iva WHERE id=' . prepare ( $idiva ));
2018-02-18 19:53:23 +01:00
( $rs_iva [ 0 ][ 'percentuale' ] > 0 ) ? $hide = '' : $hide = 'hide' ;
2017-11-16 18:55:03 +01:00
2018-09-28 16:43:40 +02:00
if ( $show_prezzi ) {
2017-09-06 15:29:51 +02:00
$costi = get_costi_intervento ( $id_record );
2018-02-18 19:53:23 +01:00
2018-05-05 09:29:09 +02:00
$rss = $dbo -> fetchArray ( 'SELECT in_statiintervento.completato AS flag_completato FROM in_statiintervento INNER JOIN in_interventi ON in_statiintervento.idstatointervento=in_interventi.idstatointervento WHERE in_interventi.id=' . prepare ( $id_record ));
2018-02-18 19:53:23 +01:00
2018-05-05 09:29:09 +02:00
if ( $rss [ 0 ][ 'flag_completato' ]) {
2018-02-16 15:45:15 +01:00
$readonly = 'readonly' ;
} else {
$readonly = '' ;
}
2017-08-04 16:28:16 +02:00
echo '
<!-- Riepilogo dei costi -->
< table class = " table table condensed table-striped table-hover table-bordered " >
< tr >
< th width = " 40% " ></ th >
2017-09-10 14:35:41 +02:00
< th width = " 20% " class = " text-center " > '.tr(' Costo ', [], [' upper ' => true]).' </ th >
< th width = " 20% " class = " text-center " > '.tr(' Addebito ', [], [' upper ' => true]).' </ th >
< th width = " 20% " class = " text-center " > '.tr(' Tot . Scontato ', [], [' upper ' => true]).' </ th >
2017-08-04 16:28:16 +02:00
</ tr >
< tr >
2017-09-10 14:35:41 +02:00
< th > '.tr(' Totale manodopera ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' manodopera_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' manodopera_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' manodopera_scontato ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr >
2018-01-04 11:03:23 +01:00
< tr >
< th > '.tr(' Totale diritto di chiamata ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' dirittochiamata_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' dirittochiamata_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' dirittochiamata_scontato ']).' </ td >
2018-01-04 11:03:23 +01:00
</ tr >
2017-08-04 16:28:16 +02:00
< tr >
2017-09-10 14:35:41 +02:00
< th > '.tr(' Totale viaggio ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' viaggio_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' viaggio_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' viaggio_scontato ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr >
< tr >
2017-09-10 14:35:41 +02:00
< th > '.tr(' Totale articoli ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' ricambi_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' ricambi_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' ricambi_scontato ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr >
< tr >
2017-09-10 14:35:41 +02:00
< th > '.tr(' Totale altre spese ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' altro_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' altro_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' altro_scontato ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr >
< tr >
2017-09-19 16:20:44 +02:00
< th > '.tr(' Sconto incondizionato ', [], [' upper ' => true]).' </ th >
2017-08-04 16:28:16 +02:00
< td class = " text-right " >-</ td >
< td class = " text-right " >-</ td >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat(-$costi[' sconto_globale ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr >
2018-01-04 11:03:23 +01:00
2017-11-16 18:55:03 +01:00
< tr class = '.$hide.' >
< th > '.tr(' Imponibile ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' totale_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' totale_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' totale_scontato ']).' </ td >
2017-11-16 18:55:03 +01:00
</ tr >
2018-01-04 11:03:23 +01:00
2017-11-16 18:55:03 +01:00
< tr class = '.$hide.' >
2018-03-19 18:11:51 +01:00
< th > '.tr(' IVA ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< td class = " text-right " > '.moneyFormat($costi[' iva_costo ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' iva_addebito ']).' </ td >
< td class = " text-right " > '.moneyFormat($costi[' iva_totale ']).' </ td >
2017-11-16 18:55:03 +01:00
</ tr >
2017-08-04 16:28:16 +02:00
< tr >
2017-09-10 14:35:41 +02:00
< th > '.tr(' Totale ', [], [' upper ' => true]).' </ th >
2019-04-13 02:56:39 +02:00
< th class = " text-right " > '.moneyFormat($costi[' totaleivato_costo ']).' </ th >
< th class = " text-right " > '.moneyFormat($costi[' totaleivato_addebito ']).' </ th >
< th class = " text-right " > '.moneyFormat($costi[' totale ']).' </ th >
2017-08-04 16:28:16 +02:00
</ tr >
</ table > ' ;
}
2017-09-11 11:28:39 +02:00
echo '
< script src = " '. $rootdir .'/lib/init.js " ></ script > ' ;