. */ use Carbon\CarbonInterval; include_once __DIR__.'/../../core.php'; // Creazione righe fantasma $autofill = new \Util\Autofill($options['pricing'] ? 4 : 2); $autofill->setRows(20, 10); echo '
'.tr('Contratto num. _NUM_ del _DATE_', [ '_NUM_' => $documento['numero'], '_DATE_' => Translator::dateToLocale($documento['data_bozza']), ], ['upper' => true]).'
'; // Elenco impianti $impianti = $dbo->fetchArray('SELECT nome, matricola FROM my_impianti WHERE id IN (SELECT my_impianti_contratti.idimpianto FROM my_impianti_contratti WHERE idcontratto = '.prepare($documento['id']).')'); if (!empty($impianti)) { $list = []; foreach ($impianti as $impianto) { $list[] = $impianto['nome']." (".$impianto['matricola'].')'; } echo '

'.tr('Impianti', [], ['upper' => true]).'

'.implode(', ', $list).'

'; } echo '

'.tr('Spett.le', [], ['upper' => true]).'

$c_ragionesociale$

$c_indirizzo$ $c_citta_full$

'.tr('Partita IVA', [], ['upper' => true]).'

$c_piva$

'.tr('Codice fiscale', [], ['upper' => true]).'

$c_codicefiscale$
'; // Descrizione if (!empty($documento['descrizione'])) { echo '

'.nl2br($documento['descrizione']).'


'; } // Intestazione tabella per righe echo " '; if ($options['pricing']) { echo " '; } echo ' '; // Righe documento $righe = $documento->getRighe(); foreach ($righe as $riga) { $r = $riga->toArray(); $autofill->count($r['descrizione']); echo ' '; if (!$riga->isDescrizione()) { echo ' '; if ($options['pricing']) { // Prezzo unitario echo ' '; // Imponibile echo ' '; } } else { echo ' '; if ($options['pricing']) { echo ' '; } } echo ' '; $autofill->next(); } echo ' |autofill| '; // Calcoli $imponibile = $documento->imponibile; $sconto = $documento->sconto; $totale_imponibile = $documento->totale_imponibile; $totale_iva = $documento->iva; $totale = $documento->totale; $sconto_finale = $documento->getScontoFinale(); $netto_a_pagare = $documento->netto; $show_sconto = $sconto > 0; // TOTALE COSTI FINALI if ($options['pricing']) { // Totale imponibile echo ' '; // Eventuale sconto incondizionato if ($show_sconto) { echo ' '; // Totale imponibile echo ' '; } // IVA echo ' '; // TOTALE echo ' '; if ($sconto_finale) { // SCONTO FINALE echo ' '; // NETTO A PAGARE echo ' '; } } echo '
".tr('Descrizione', [], ['upper' => true])." ".tr('Q.tà', [], ['upper' => true]).'".tr('Prezzo unitario', [], ['upper' => true])." ".tr('Imponibile', [], ['upper' => true]).'
'.nl2br($r['descrizione']); if ($riga->isArticolo()) { // Codice articolo $text = tr('COD. _COD_', [ '_COD_' => $riga->codice, ]); echo '
'.$text.''; $autofill->count($text, true); } echo '
'.Translator::numberToLocale(abs($riga->qta), 'qta').' '.$r['um'].' '.moneyFormat($riga->prezzo_unitario); if ($riga->sconto > 0) { $text = discountInfo($riga, false); echo '
'.$text.''; $autofill->count($text, true); } echo '
'.moneyFormat($riga->totale_imponibile).'
'.tr('Imponibile', [], ['upper' => true]).': '.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, 2).'
'.tr('Sconto', [], ['upper' => true]).': '.moneyFormat($sconto, 2).'
'.tr('Totale imponibile', [], ['upper' => true]).': '.moneyFormat($totale_imponibile, 2).'
'.tr('Totale IVA', [], ['upper' => true]).': '.moneyFormat($totale_iva, 2).'
'.tr('Totale documento', [], ['upper' => true]).': '.moneyFormat($totale, 2).'
'.tr('Sconto finale', [], ['upper' => true]).': '.moneyFormat($sconto_finale, 2).'
'.tr('Netto a pagare', [], ['upper' => true]).': '.moneyFormat($netto_a_pagare, 2).'
'; // CONDIZIONI GENERALI DI FORNITURA $pagamento = $dbo->fetchOne('SELECT * FROM co_pagamenti WHERE id = '.$documento['idpagamento']); echo '
'.tr('Condizioni generali di fornitura', [], ['upper' => true]).'
'.tr('Pagamento', [], ['upper' => true]).' '.$pagamento['descrizione'].'
'.tr('Validità offerta', [], ['upper' => true]).' '; if (!empty($documento->validita) && !empty($documento->tipo_validita)) { $intervallo = CarbonInterval::make($documento->validita.' '.$documento->tipo_validita); echo $intervallo->forHumans(); } elseif (!empty($documento->validita)) { echo tr('_TOT_ giorni', [ '_TOT_' => $documento->validita, ]); } else { echo '-'; } echo '
'.tr('Validità contratto', [], ['upper' => true]).' '; if (!empty($documento['data_accettazione']) && !empty($documento['data_conclusione'])) { echo ' '.tr('dal _START_ al _END_', [ '_START_' => Translator::dateToLocale($documento['data_accettazione']), '_END_' => Translator::dateToLocale($documento['data_conclusione']), ]); } else { echo '-'; } echo '
'.tr('Esclusioni', [], ['upper' => true]).' '.nl2br($documento['esclusioni']).'
'; // Conclusione if (empty($documento->stato->fatturabile)) { echo '

'.tr('Il tutto S.E. & O.').'

'.tr("In attesa di un Vostro Cortese riscontro, colgo l'occasione per porgere Cordiali Saluti").'

'; }