2017-09-08 17:03:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
// Creazione righe fantasma
|
2020-05-29 16:32:00 +02:00
|
|
|
$autofill = new \Util\Autofill($options['pricing'] ? 6 : 3);
|
2019-07-29 16:54:20 +02:00
|
|
|
$rows_per_page = 16;
|
|
|
|
if (!empty($options['last-page-footer'])) {
|
|
|
|
$rows_per_page += 10;
|
|
|
|
}
|
|
|
|
$autofill->setRows($rows_per_page);
|
2017-09-08 17:03:47 +02:00
|
|
|
|
|
|
|
// Intestazione tabella per righe
|
|
|
|
echo "
|
2017-09-12 16:45:18 +02:00
|
|
|
<table class='table table-striped table-bordered' id='contents'>
|
2017-09-08 17:03:47 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2020-05-29 16:32:00 +02:00
|
|
|
<th class='text-center' style='width:5%'>".tr('#', [], ['upper' => true])."</th>
|
2017-09-10 14:35:41 +02:00
|
|
|
<th class='text-center'>".tr('Descrizione', [], ['upper' => true])."</th>
|
2017-09-13 11:15:31 +02:00
|
|
|
<th class='text-center' style='width:10%'>".tr('Q.tà', [], ['upper' => true]).'</th>';
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2017-09-21 15:51:39 +02:00
|
|
|
if ($options['pricing']) {
|
2017-09-08 17:03:47 +02:00
|
|
|
echo "
|
2017-09-12 16:45:18 +02:00
|
|
|
<th class='text-center' style='width:15%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
|
2017-09-10 14:35:41 +02:00
|
|
|
<th class='text-center' style='width:15%'>".tr('Importo', [], ['upper' => true])."</th>
|
2017-09-13 11:15:31 +02:00
|
|
|
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true]).' (%)</th>';
|
2017-09-08 17:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
// Righe documento
|
|
|
|
$righe = $documento->getRighe();
|
|
|
|
foreach ($righe as $riga) {
|
|
|
|
$r = $riga->toArray();
|
|
|
|
|
|
|
|
$autofill->count($r['descrizione']);
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2017-09-13 11:15:31 +02:00
|
|
|
echo '
|
2020-05-29 16:32:00 +02:00
|
|
|
<tr>';
|
|
|
|
|
|
|
|
echo'
|
|
|
|
<td class=\'text-center\' >
|
2020-06-09 16:59:26 +02:00
|
|
|
'.($r['order'] + 1).'</td>';
|
2020-05-29 16:32:00 +02:00
|
|
|
|
|
|
|
echo'
|
2017-09-13 11:15:31 +02:00
|
|
|
<td>
|
|
|
|
'.nl2br($r['descrizione']);
|
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
if ($riga->isArticolo()) {
|
|
|
|
// Codice articolo
|
|
|
|
$text = tr('COD. _COD_', [
|
2020-07-06 13:32:43 +02:00
|
|
|
'_COD_' => $riga->codice,
|
2019-07-12 12:40:13 +02:00
|
|
|
]);
|
2018-02-15 14:25:27 +01:00
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<br><small>'.$text.'</small>';
|
2018-02-15 14:25:27 +01:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
$autofill->count($text, true);
|
2018-02-15 14:25:27 +01:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
// Seriali
|
|
|
|
$seriali = $riga->serials;
|
|
|
|
if (!empty($seriali)) {
|
2019-07-12 13:04:28 +02:00
|
|
|
$text = tr('SN').': '.implode(', ', $seriali);
|
2019-07-12 12:40:13 +02:00
|
|
|
echo '
|
|
|
|
<br><small>'.$text.'</small>';
|
2018-02-15 14:25:27 +01:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
$autofill->count($text, true);
|
2018-02-15 14:25:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-22 17:52:51 +02:00
|
|
|
// Aggiunta dei riferimenti ai documenti
|
2020-03-03 10:33:32 +01:00
|
|
|
if (setting('Riferimento dei documenti nelle stampe') && $riga->hasOriginal()) {
|
|
|
|
$ref = $riga->getOriginal()->parent->getReference();
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2019-04-19 01:39:58 +02:00
|
|
|
if (!empty($ref)) {
|
|
|
|
echo '
|
2020-03-03 10:33:32 +01:00
|
|
|
<br><small>'.$ref.'</small>';
|
2019-07-12 12:40:13 +02:00
|
|
|
|
2020-03-03 10:33:32 +01:00
|
|
|
$autofill->count($ref, true);
|
2017-09-13 11:15:31 +02:00
|
|
|
}
|
|
|
|
}
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2017-09-13 11:15:31 +02:00
|
|
|
echo '
|
|
|
|
</td>';
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
if (!$riga->isDescrizione()) {
|
2018-02-15 17:41:09 +01:00
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<td class="text-center">
|
|
|
|
'.Translator::numberToLocale(abs($riga->qta), 'qta').' '.$r['um'].'
|
|
|
|
</td>';
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
if ($options['pricing']) {
|
|
|
|
// Prezzo unitario
|
2018-02-03 13:55:09 +01:00
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<td class="text-right">
|
2020-02-14 17:43:39 +01:00
|
|
|
'.moneyFormat($riga->prezzo_unitario);
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
if ($riga->sconto > 0) {
|
2020-02-15 14:11:44 +01:00
|
|
|
$text = discountInfo($riga, false);
|
2018-01-18 19:03:06 +01:00
|
|
|
|
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<br><small class="text-muted">'.$text.'</small>';
|
|
|
|
|
|
|
|
$autofill->count($text, true);
|
2017-09-13 11:15:31 +02:00
|
|
|
}
|
2019-07-12 12:40:13 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
// Imponibile
|
|
|
|
echo '
|
|
|
|
<td class="text-right">
|
|
|
|
'.moneyFormat($riga->totale_imponibile).'
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
// Iva
|
|
|
|
echo '
|
|
|
|
<td class="text-center">
|
|
|
|
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
|
|
|
|
</td>';
|
2017-09-08 17:03:47 +02:00
|
|
|
}
|
2019-07-12 12:40:13 +02:00
|
|
|
} else {
|
2017-09-08 17:03:47 +02:00
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<td></td>';
|
2017-09-08 17:03:47 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
if ($options['pricing']) {
|
2018-02-15 17:41:09 +01:00
|
|
|
echo '
|
2019-07-12 12:40:13 +02:00
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>';
|
2018-01-18 19:03:06 +01:00
|
|
|
}
|
2017-09-08 17:03:47 +02:00
|
|
|
}
|
2017-09-13 11:15:31 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
echo '
|
|
|
|
</tr>';
|
2017-09-13 11:15:31 +02:00
|
|
|
|
2019-07-12 12:40:13 +02:00
|
|
|
$autofill->next();
|
2017-09-08 17:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
|autofill|
|
|
|
|
</tbody>
|
|
|
|
</table>';
|