openstamanager/templates/interventi/body.php

660 lines
19 KiB
PHP
Raw Normal View History

<?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/>.
*/
2020-08-31 09:48:29 +02:00
use Carbon\Carbon;
2024-03-05 16:01:45 +01:00
use Models\Module;
use Modules\Checklists\Check;
2020-08-31 09:48:29 +02:00
include_once __DIR__.'/../../core.php';
2023-12-06 15:06:49 +01:00
$d_qta = (int) setting('Cifre decimali per quantità in stampa');
$d_importi = (int) setting('Cifre decimali per importi in stampa');
$d_totali = (int) setting('Cifre decimali per totali in stampa');
2024-07-31 10:57:13 +02:00
$sessioni = $documento->sessioni->sortBy('orario_inizio');
$firma = !empty($documento['firma_file']) ? '<img src="'.base_dir().'/files/interventi/'.$documento['firma_file'].'" style="width:70mm;">' : '';
echo '
2024-07-30 16:32:44 +02:00
<br>
2024-07-31 10:57:13 +02:00
2024-05-24 13:03:34 +02:00
<table class="table border-bottom">
2017-09-08 18:19:39 +02:00
<tr>
2024-07-31 10:57:13 +02:00
<th colspan="6" class="text-center bg-gray"><h4>'.tr('Cliente', [], ['upper' => true]).'</h4></th>
2017-09-08 18:19:39 +02:00
</tr>
<tr>
2024-07-31 10:57:13 +02:00
<td width="80">
<p class="text-muted">'.tr('Cliente', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td width="150">
'.$c_ragionesociale.'
2024-05-24 13:03:34 +02:00
</td>';
2024-05-29 09:25:33 +02:00
// Indirizzo
2024-05-24 13:03:34 +02:00
if (!empty($s_indirizzo) or !empty($s_cap) or !empty($s_citta) or !empty($s_provincia)) {
2020-11-12 17:11:09 +01:00
echo '
2017-09-08 18:19:39 +02:00
2024-07-31 10:57:13 +02:00
<td width="110">
<p class="text-muted">'.tr('Indirizzo', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.$s_indirizzo.' '.$s_cap.' - '.$s_citta.' ('.strtoupper((string) $s_provincia).')
2024-05-24 13:03:34 +02:00
</td>';
} elseif (!empty($c_indirizzo) or !empty($c_cap) or !empty($c_citta) or !empty($c_provincia)) {
2020-08-31 09:48:29 +02:00
echo '
2024-05-24 13:03:34 +02:00
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Indirizzo', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.$c_indirizzo.' '.$c_cap.' - '.$c_citta.' ('.strtoupper((string) $c_provincia).')
2024-05-24 13:03:34 +02:00
</td>';
2020-08-31 09:48:29 +02:00
}
2024-05-29 09:25:33 +02:00
echo '
2024-05-24 13:03:34 +02:00
</tr>
2024-07-31 10:57:13 +02:00
2024-05-24 13:03:34 +02:00
<tr>
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('P.Iva', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.strtoupper((string) $c_piva).'
2024-05-24 13:03:34 +02:00
</td>
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('C.F.', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td >
'.strtoupper((string) $c_codicefiscale).'
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
</tr>
2018-11-30 16:10:15 +01:00
2024-05-24 13:03:34 +02:00
<tr>
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Telefono', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.$c_telefono.'
2024-05-24 13:03:34 +02:00
</td>
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Cellulare', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.$c_cellulare.'
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
</tr>
</table>';
2024-05-29 09:25:33 +02:00
2024-07-31 10:57:13 +02:00
// Dati attività
2024-05-29 09:25:33 +02:00
echo '
2024-07-31 10:57:13 +02:00
<table class="table border-bottom">
2024-05-24 13:03:34 +02:00
<tr>
2024-07-31 10:57:13 +02:00
<th colspan="6" class="text-center bg-gray">
<h4>'.tr('Rapporto attività', [], ['upper' => true]).'</h4>
</th>
</tr>
<tr>
<td width="60">
<p class="text-muted">'.tr('Codice', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td width="170">
'.$documento['codice'].'
</td>
<td width="110">
<p class="text-muted">'.tr('Data richiesta', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
<td>
2024-07-31 10:57:13 +02:00
'.Translator::dateToLocale($documento['data_richiesta']).'
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td width="100">
<p class="text-muted">'.tr('Tipologia', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td>
'.$documento->tipo->getTranslation('title').'
</td>
</tr>';
2024-07-31 10:57:13 +02:00
// Dati preventivo o contratto
if (!empty($preventivo) or !empty($contratto)) {
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="2"></td>
2024-05-24 13:03:34 +02:00
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Preventivo n.', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.(!empty($preventivo) ? $preventivo['numero'].' del '.Translator::dateToLocale($preventivo['data_bozza']) : '-').'
2024-05-24 13:03:34 +02:00
</td>
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Contratto n.', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-30 16:32:44 +02:00
<td>
2024-07-31 10:57:13 +02:00
'.(!empty($contratto) ? $contratto['numero'].' del '.Translator::dateToLocale($contratto['data_bozza']) : '-').'
2017-09-08 18:19:39 +02:00
</td>
</tr>';
2024-07-31 10:57:13 +02:00
}
2017-09-08 18:19:39 +02:00
// riga 3
// Elenco impianti su cui è stato fatto l'intervento
2017-09-21 15:51:39 +02:00
$rs2 = $dbo->fetchArray('SELECT *, (SELECT nome FROM my_impianti WHERE id=my_impianti_interventi.idimpianto) AS nome, (SELECT matricola FROM my_impianti WHERE id=my_impianti_interventi.idimpianto) AS matricola FROM my_impianti_interventi WHERE idintervento='.prepare($id_record));
2017-09-08 18:19:39 +02:00
$impianti = [];
for ($j = 0; $j < count($rs2); ++$j) {
2024-07-31 10:57:13 +02:00
$impianti[] = ''.$rs2[$j]['nome']." <small style='color:#777;'>(".$rs2[$j]['matricola'].')</small>';
2017-09-08 18:19:39 +02:00
}
echo '
<tr>
2024-05-24 13:03:34 +02:00
<td>
2024-07-31 10:57:13 +02:00
<p class="text-muted">'.tr('Impianti', [], ['upper' => true]).':</p>
2024-05-24 13:03:34 +02:00
</td>
2024-07-31 10:57:13 +02:00
<td colspan="5">
'.implode(', ', $impianti).'
2018-01-19 22:10:37 +01:00
</td>
</tr>';
// Richiesta
echo '
2017-09-08 18:19:39 +02:00
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="6" style="line-height:1.5em">
<p class="text-muted">'.tr('Richiesta', [], ['upper' => true]).':</p>
2024-01-15 15:30:45 +01:00
<p>'.$documento['richiesta'].'</p>
2017-09-08 18:19:39 +02:00
</td>
</tr>';
// Descrizione
// Rimosso nl2br, non necessario con ckeditor
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="6" style="line-height:1.5em">
<p class="text-muted">'.tr('Descrizione', [], ['upper' => true]).':</p>
2024-01-15 15:30:45 +01:00
<p>'.$documento['descrizione'].'</p>
</td>
2024-05-24 13:03:34 +02:00
</tr>
</table>';
2019-07-12 17:35:14 +02:00
$righe = $documento->getRighe();
if (!setting('Visualizza riferimento su ogni riga in stampa')) {
$riferimenti = [];
$id_rif = [];
foreach ($righe as $riga) {
$riferimento = ($riga->getOriginalComponent() ? $riga->getOriginalComponent()->getDocument()->getReference() : null);
if (!empty($riferimento)) {
if (!array_key_exists($riferimento, $riferimenti)) {
$riferimenti[$riferimento] = [];
}
if (!in_array($riga->id, $riferimenti[$riferimento])) {
$id_rif[] = $riga->id;
$riferimenti[$riferimento][] = $riga->id;
}
}
}
}
2019-07-12 17:35:14 +02:00
if (!$righe->isEmpty()) {
echo '
2024-05-24 13:03:34 +02:00
<table class="table border-bottom">
<thead>
<tr>
2024-07-31 10:57:13 +02:00
<th colspan="4" class="text-center bg-gray">
<h4>'.tr('Materiale utilizzato e spese aggiuntive', [], ['upper' => true]).'</h4>
</th>
</tr>
<tr>
2024-07-31 10:57:13 +02:00
<td class="text-muted text-left">
'.tr('Descrizione', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td style="width:17%" class="text-muted text-right">
'.tr('Q.', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td style="width:20%" class="text-muted text-right">
'.tr('Prezzo unitario', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td style="width:20%" class="text-muted text-right">
'.tr('Importo', [], ['upper' => true]).'
</td>
</tr>
</thead>
<tbody>';
2019-07-12 17:35:14 +02:00
foreach ($righe as $riga) {
2021-07-07 07:57:10 +02:00
if (setting('Formato ore in stampa') == 'Sessantesimi') {
if ($riga->um == 'ore') {
$qta = Translator::numberToHours($riga->qta);
2021-07-07 07:57:10 +02:00
} else {
$qta = Translator::numberToLocale($riga->qta, $d_qta);
}
2021-07-07 07:57:10 +02:00
} else {
$qta = Translator::numberToLocale($riga->qta, $d_qta);
}
// Articolo
echo '
<tr>
<td>';
$text = '';
foreach ($riferimenti as $key => $riferimento) {
if (in_array($riga->id, $riferimento)) {
if ($riga->id === $riferimento[0]) {
$riga_ordine = $riga->getOriginalComponent()->getDocument();
2024-07-31 10:57:13 +02:00
$text = ''.$key.'<br>';
if ($options['pricing']) {
$text = $text.'</td><td></td><td>';
}
$text = $text.'</td><td></td></tr><tr><td>';
echo nl2br($text);
}
}
2024-05-23 11:36:25 +02:00
$riga['descrizione'] = str_replace('Rif. '.strtolower((string) $key), '', $riga['descrizione']);
}
2024-05-23 11:36:25 +02:00
$source_type = $riga::class;
if (!setting('Visualizza riferimento su ogni riga in stampa')) {
echo $riga['descrizione'];
} else {
2024-05-23 11:36:25 +02:00
echo nl2br((string) $riga['descrizione']);
}
2019-07-12 17:35:14 +02:00
if ($riga->isArticolo()) {
echo nl2br('<br><small>'.$riga->codice.'</small>');
}
2019-07-12 17:35:14 +02:00
if ($riga->isArticolo()) {
2019-07-12 17:35:14 +02:00
// Seriali
$seriali = $riga->serials;
if (!empty($seriali)) {
$text = tr('SN').': '.implode(', ', $seriali);
echo '
<small>'.$text.'</small>';
2019-07-12 17:35:14 +02:00
}
}
echo '
</td>';
// Quantità
echo '
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.$qta.' '.$riga->um.'
</td>';
// Prezzo unitario
echo '
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.($options['pricing'] ? moneyFormat($riga->prezzo_unitario_corrente, $d_importi) : '-');
2018-12-29 11:42:53 +01:00
2020-06-30 17:28:59 +02:00
if ($options['pricing'] && $riga->sconto > 0) {
$text = discountInfo($riga, false);
echo '
<br><small class="text-muted">'.$text.'</small>';
2018-12-29 11:42:53 +01:00
}
echo '
</td>';
// Prezzo totale
echo '
2024-07-31 10:57:13 +02:00
<td class="text-right">
2024-01-19 10:32:20 +01:00
'.($options['pricing'] ? moneyFormat($riga->importo, $d_importi) : '-').'
</td>
</tr>';
}
2019-07-12 17:35:14 +02:00
echo '
</tbody>';
2017-09-21 15:51:39 +02:00
if ($options['pricing']) {
// Totale spese aggiuntive
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="3" class="text-right bg-gray">
<b>'.tr('Totale', [], ['upper' => true]).'</b>
</td>
2024-07-31 10:57:13 +02:00
<th class="text-right">
'.moneyFormat($righe->sum('importo'), $d_totali).'
</th>
</tr>';
}
echo '
</table>';
}
// INTESTAZIONE ELENCO TECNICI
echo '
2024-07-31 10:57:13 +02:00
<table class="table border-bottom vertical-middle">
<thead>
<tr>
2024-07-31 10:57:13 +02:00
<th class="text-center bg-gray" colspan="5">
<h4>'.tr('Ore tecnici', [], ['upper' => true]).'</h4>
</th>
</tr>
<tr>
2024-07-31 10:57:13 +02:00
<td class="text-center text-muted" style="width:30%">
'.tr('Tecnico', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-center text-muted" colspan="3" style="width:35%">
'.tr('Orario', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-center" style="font-size:6pt;width:35%; border-left:1px solid #aaa;">
'.tr('I dati del ricevente verrano trattati in base alla normativa europea UE 2016/679 del 27 aprile 2016 (GDPR)').'
</td>
</tr>
</thead>
<tbody>';
// Sessioni di lavoro dei tecnici
2024-07-31 10:57:13 +02:00
$i = 0;
if (count($sessioni) > 0) {
foreach ($sessioni as $id => $sessione) {
echo '
<tr>';
2024-07-31 10:57:13 +02:00
// Nome tecnico
echo '
<td class="text-center">
'.$sessione->anagrafica->ragione_sociale.'
('.$sessione->tipo->getTranslation('title').')
</td>';
$inizio = new Carbon($sessione['orario_inizio']);
$fine = new Carbon($sessione['orario_fine']);
if ($inizio->isSameDay($fine)) {
$orario = timestampFormat($inizio).' - '.timeFormat($fine);
} else {
$orario = timestampFormat($inizio).' - '.timestampFormat($fine);
}
2024-07-31 10:57:13 +02:00
// Orario
echo '
2024-07-31 10:57:13 +02:00
<td class="text-center" colspan="3">
'.$orario.'
</td>';
// Testo lavori eseguiti 1/2
if ($i == 0) {
echo '
<td class="text-center" style="font-size:6pt; vertical-align:top; border-left:1px solid #aaa;">
'.tr('Si dichiara che i lavori sono stati eseguiti ed i materiali installati nel rispetto delle vigenti normative tecniche').'
</td>';
}
// Firma 1/3
if ($i == 1) {
echo '
<td rowspan="'.(count($sessioni)+1).'" class="text-center" style="font-size:6pt; vertical-align:bottom; border-left:1px solid #aaa;">
'.$firma.'<br>';
if (empty($documento['firma_file'])) {
echo ' <i>('.tr('Timbro e firma leggibile').')</i>';
} else {
echo ' <i>'.$documento['firma_nome'].'</i>';
}
echo '
</td>';
}
echo '
2024-07-31 10:57:13 +02:00
</tr>';
2024-07-31 10:57:13 +02:00
$i++;
}
}
// Ore lavorate
2021-07-07 07:57:10 +02:00
if (setting('Formato ore in stampa') == 'Sessantesimi') {
$ore_totali = Translator::numberToHours($documento->ore_totali);
2021-07-07 07:57:10 +02:00
} else {
$ore_totali = Translator::numberToLocale($documento->ore_totali, $d_totali);
}
2018-01-23 16:11:02 +01:00
echo '
<tr>
2017-09-12 16:45:18 +02:00
<td class="text-center">
2024-07-31 10:57:13 +02:00
<small class="text-muted">'.tr('Ore lavorate', [], ['upper' => true]).'</small><br/>'.$ore_totali.'
</td>';
2018-01-23 16:11:02 +01:00
// Costo totale manodopera
2018-02-03 13:55:09 +01:00
if ($options['pricing']) {
echo '
2018-01-23 16:11:02 +01:00
<td colspan="3" class="text-center">
2024-07-31 10:57:13 +02:00
<small class="text-muted">'.tr('Totale manodopera', [], ['upper' => true]).'</small><br/>'.moneyFormat($sessioni->sum('prezzo_manodopera'), $d_totali).'
</td>';
} else {
echo '
2018-01-23 16:11:02 +01:00
<td colspan="3" class="text-center">-</td>';
}
2024-07-31 10:57:13 +02:00
// Testo lavori eseguiti 2/2
if (count($sessioni) == 0) {
echo '
<td class="text-center" style="font-size:6pt; vertical-align:top; border-left:1px solid #aaa;">
'.tr('Si dichiara che i lavori sono stati eseguiti ed i materiali installati nel rispetto delle vigenti normative tecniche').'
</td>';
}
// Firma 2/3
if (count($sessioni) == 1) {
echo '<td rowspan="2" class="text-center" style="font-size:6pt; vertical-align:bottom; border-left:1px solid #aaa;">
'.$firma.'<br>';
2024-07-31 10:57:13 +02:00
if (empty($documento['firma_file'])) {
echo ' <br><br><br><i>('.tr('Timbro e firma leggibile').')</i>';
} else {
echo ' <i>'.$documento['firma_nome'].'</i>';
}
echo '
</td>';
}
2021-02-18 18:48:44 +01:00
echo '
</tr>';
2024-07-31 10:57:13 +02:00
2018-01-19 22:10:37 +01:00
// Totale km
echo '
2018-01-23 16:11:02 +01:00
<tr>
2018-01-19 22:10:37 +01:00
<td class="text-center">
2024-07-31 10:57:13 +02:00
<small class="text-muted">'.tr('Km percorsi', [], ['upper' => true]).'</small><br/>'.Translator::numberToLocale($documento->km_totali, $d_qta).'
2018-01-19 22:10:37 +01:00
</td>';
2018-01-23 16:11:02 +01:00
// Costo trasferta
2018-02-03 13:55:09 +01:00
if ($options['pricing']) {
2018-01-19 22:10:37 +01:00
echo '
<td class="text-center">
2024-07-31 10:57:13 +02:00
<small class="text-muted">'.tr('Costi di trasferta', [], ['upper' => true]).'</small><br/>'.moneyFormat($sessioni->sum('prezzo_viaggio'), $d_totali).'
2018-01-19 22:10:37 +01:00
</td>';
2018-01-23 16:11:02 +01:00
} else {
2018-01-19 22:10:37 +01:00
echo '
2018-01-23 16:11:02 +01:00
<td class="text-center">-</td>';
}
2018-01-19 22:10:37 +01:00
2018-01-23 16:11:02 +01:00
// Diritto di chiamata
2018-02-03 13:55:09 +01:00
if ($options['pricing']) {
2018-01-23 16:11:02 +01:00
echo '
2020-11-09 19:19:55 +01:00
<td class="text-center" colspan="2" width="120px" >
2024-07-31 10:57:13 +02:00
<small class="text-muted">'.tr('Diritto di chiamata', [], ['upper' => true]).'</small><br/>'.moneyFormat($sessioni->sum('prezzo_diritto_chiamata'), $d_totali).'
2018-01-23 16:11:02 +01:00
</td>';
2018-01-19 22:10:37 +01:00
} else {
echo '
2019-07-12 17:35:14 +02:00
<td class="text-center" colspan="2">-</td>';
2018-01-19 22:10:37 +01:00
}
2024-07-31 10:57:13 +02:00
// Firma 3/3
if (count($sessioni) == 0) {
echo '<td class="text-center" style="font-size:6pt; vertical-align:bottom; border-left:1px solid #aaa;">
'.$firma.'<br>';
if (empty($documento['firma_file'])) {
echo ' <br><br><br><i>('.tr('Timbro e firma leggibile').')</i>';
} else {
echo ' <i>'.$documento['firma_nome'].'</i>';
}
echo '
</td>';
}
2019-07-12 17:35:14 +02:00
// Calcoli
$imponibile = abs($documento->imponibile);
$sconto = $documento->sconto;
$totale_imponibile = abs($documento->totale_imponibile);
$totale_iva = abs($documento->iva);
$totale = abs($documento->totale);
$netto_a_pagare = abs($documento->netto);
$show_sconto = $sconto > 0;
// TOTALE COSTI FINALI
2017-09-21 15:51:39 +02:00
if ($options['pricing']) {
// Totale imponibile
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="4" class="text-right bg-gray">
'.tr('Imponibile', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, $d_totali).'
2024-07-31 10:57:13 +02:00
</td>
</tr>';
2018-06-29 13:35:39 +02:00
// Eventuale sconto totale
if ($show_sconto) {
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="4" class="text-right bg-gray">
'.tr('Sconto', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.moneyFormat($sconto, $d_totali).'
</td>
</tr>';
// Totale imponibile
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="4" class="text-right bg-gray">
'.tr('Totale imponibile', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.moneyFormat($totale_imponibile, $d_totali).'
</td>
</tr>';
}
// IVA
// Totale intervento
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="4" class="text-right bg-gray">
'.tr('Iva', [], ['upper' => true]).'
</td>
2024-07-31 10:57:13 +02:00
<td class="text-right">
'.moneyFormat($totale_iva, $d_totali).'
</td>
</tr>';
// TOTALE INTERVENTO
echo '
<tr>
2024-07-31 10:57:13 +02:00
<td colspan="4" class="text-right bg-gray">
<b>'.tr('Totale', [], ['upper' => true]).'</b>
</td>
2024-07-31 10:57:13 +02:00
<td class="text-right">
<b>'.moneyFormat($totale, $d_totali).'</b>
2024-07-31 10:57:13 +02:00
</td>
</tr>';
}
echo '
</table>';
2023-08-04 14:54:28 +02:00
if ($options['checklist']) {
2024-06-11 16:58:27 +02:00
$structure = Module::where('name', 'Interventi')->first();
$checks = $structure->mainChecks($id_record);
2023-08-04 14:54:28 +02:00
if (!empty($checks)) {
echo '
<pagebreak class="page-break-after" />
<table class="table table-bordered vertical-middle">
<tr>
<th class="text-center" colspan="2" style="font-size:11pt;">
2024-07-31 10:57:13 +02:00
CHECKLIST
</th>
</tr>';
2024-06-11 16:58:27 +02:00
$structure = Module::where('name', 'Interventi')->first();
$checks = $structure->mainChecks($id_record);
foreach ($checks as $check) {
echo renderChecklistHtml($check);
}
2024-04-09 12:18:08 +02:00
$impianti_collegati = $dbo->fetchArray('SELECT * FROM my_impianti_interventi INNER JOIN my_impianti ON my_impianti_interventi.idimpianto = my_impianti.id WHERE idintervento = '.prepare($id_record));
foreach ($impianti_collegati as $impianto) {
2024-06-11 16:58:27 +02:00
$checks = Check::where('id_module_from', Module::where('name', 'Impianti')->first()->id)->where('id_record_from', $impianto['id'])->where('id_module', Module::where('name', 'Interventi')->first()->id)->where('id_record', $id_record)->where('id_parent', null)->get();
2024-04-09 12:18:08 +02:00
if (sizeof($checks)) {
echo '
<tr>
<th class="text-center" colspan="2" style="font-size:11pt;">
2024-07-31 10:57:13 +02:00
'.tr('Impianto', [], ['upper' => true]).' '.$impianto['matricola'].' - '.$impianto['nome'].'
</th>
</tr>';
2024-04-09 12:18:08 +02:00
foreach ($checks as $check) {
echo renderChecklistHtml($check);
}
}
}
2024-04-09 12:18:08 +02:00
echo '
</table>';
}
}