diff --git a/templates/contratti/body.php b/templates/contratti/body.php index fb134a4b8..91fbc9cae 100755 --- a/templates/contratti/body.php +++ b/templates/contratti/body.php @@ -24,8 +24,20 @@ include_once __DIR__.'/../../core.php'; $prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA'); +// Righe documento +$righe = $documento->getRighe(); + +$has_image = $righe->search(fn ($item) => !empty($item->articolo->immagine)) !== false && $options['images'] == true; + +$columns = $options['no-iva'] ? 5 : 6; +$columns = $options['pricing'] ? $columns : 3; + +if ($has_image) { + ++$columns; +} + // Creazione righe fantasma -$autofill = new Util\Autofill($options['pricing'] ? 4 : 2); +$autofill = new Util\Autofill($columns); $autofill->setRows(20, 10); echo ' @@ -111,13 +123,26 @@ echo "
# | "; + +if ($has_image) { + echo " +Foto | "; +} + +echo "".tr('Descrizione', [], ['upper' => true])." | ".tr('Q.tà', [], ['upper' => true]).' | '; if ($options['pricing']) { echo " -".tr('Prezzo unitario', [], ['upper' => true])." | -".tr('Imponibile', [], ['upper' => true]).' | '; +" . tr('Prezzo unitario', [], ['upper' => true]) . ' | '; + if (!$options['no-iva']) { + echo " +" . tr('IVA', [], ['upper' => true]) . ' (%) | '; + } + echo " +" . ($options['hide-total'] ? tr('Importo ivato', [], ['upper' => true]) : tr('Importo', [], ['upper' => true])) . ' | '; } echo ' @@ -126,8 +151,8 @@ echo '
---|---|---|---|---|---|---|---|---|
+ ' . $num . ' + | '; + + if ($has_image) { + if ($riga->isArticolo() && !empty($riga->articolo->image)) { + echo ' ++ + | '; + + $autofill->set(5); + } else { + echo ' +'; + } + } + +echo ' | '; + $text = ''; foreach ($riferimenti as $key => $riferimento) { |