This commit is contained in:
FabioL 2024-05-14 17:16:32 +02:00
commit c2a740920c
12 changed files with 128 additions and 67 deletions

View File

@ -55,7 +55,7 @@ $id_files = $dbo->select('zz_files_print', 'id_file', [], ['id_print' => $id_rec
</div>
<div class="col-md-6">
{[ "type": "select", "multiple": "1", "label": "<?php echo tr('File da accodare'); ?>", "name": "id_files[]", "value": "<?php echo implode(',', array_column($id_files, 'id_file')); ?>", "ajax-source": "allegati", "select-options": <?php echo json_encode(['id_module' => $id_module, 'id_record' => $id_record]); ?>, "link": "allegato" ]}
{[ "type": "select", "multiple": "1", "label": "<?php echo tr('File da accodare'); ?>", "name": "id_files[]", "value": "<?php echo implode(',', array_column($id_files, 'id_file')); ?>", "help": "<?php echo tr('I file selezionati saranno accodati in fase di generazione della stampa'); ?>", "ajax-source": "allegati", "select-options": <?php echo json_encode(['id_module' => $id_module, 'id_record' => $id_record]); ?>, "link": "allegato" ]}
</div>
</div>

View File

@ -93,5 +93,5 @@ if (setting('Attiva notifica di presenza utenti sul record')) {
</tbody>
</table>';
} else {
echo '<span>Non è possibile monitorare la presenta degli utenti.</span>';
echo '<span>'.tr('Non è possibile monitorare la presenta degli utenti, attiva l\'impostazione di notifica di presenza utenti sul record').'.</span>';
}

View File

@ -90,17 +90,16 @@ function crea_grafico(values){
}
$labels.push(element.description + " (" + element.formattedSize + ")" + " [" + element.count + "]" )
});
options = {
responsive: true,
maintainAspectRatio: false,
legend: {
display: true,
position: "right"
position: "right",
},
animation:{
animateScale: true,
@ -164,6 +163,6 @@ function crea_grafico(values){
}
</script>
<div id="message" class="pull-right"></div>
<div class="chart-container" style="width:35em;">
<div class="chart-container">
<canvas id="chart"></canvas>
</div>';

View File

@ -653,8 +653,6 @@ class Prints
// Footer per l'ultima pagina
if (!empty($options['last-page-footer'])) {
$is_last_page = true;
// Generazione dei contenuti del footer
ob_start();
$print_footer = self::filepath($id_print, 'footer.php');

View File

@ -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 "
<table class='table table-striped table-bordered' id='contents'>
<thead>
<tr>
<th class='text-center' width='35' >#</th>";
if ($has_image) {
echo "
<th class='text-center' width='95' >Foto</th>";
}
echo "
<th class='text-center' style='width:50%'>".tr('Descrizione', [], ['upper' => true])."</th>
<th class='text-center' style='width:10%'>".tr('Q.tà', [], ['upper' => true]).'</th>';
if ($options['pricing']) {
echo "
<th class='text-center' style='width:20%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center' style='width:20%'>".tr('Imponibile', [], ['upper' => true]).'</th>';
<th class='text-center' style='width:15%'>" . tr('Prezzo unitario', [], ['upper' => true]) . '</th>';
if (!$options['no-iva']) {
echo "
<th class='text-center' style='width:10%'>" . tr('IVA', [], ['upper' => true]) . ' (%)</th>';
}
echo "
<th class='text-center' style='width:15%'>" . ($options['hide-total'] ? tr('Importo ivato', [], ['upper' => true]) : tr('Importo', [], ['upper' => true])) . '</th>';
}
echo '
@ -126,8 +151,8 @@ echo '
<tbody>';
// Righe documento
$righe = $documento->getRighe();
if (!setting('Visualizza riferimento su ogni riga in stampa')) {
$riferimenti = [];
@ -147,15 +172,37 @@ if (!setting('Visualizza riferimento su ogni riga in stampa')) {
}
}
}
$num = 0;
foreach ($righe as $riga) {
++$num;
$r = $riga->toArray();
$autofill->count($r['descrizione']);
echo '
echo
'
<tr>
<td class="text-center" nowrap="nowrap" style="vertical-align: middle" width="25">
' . $num . '
</td>';
if ($has_image) {
if ($riga->isArticolo() && !empty($riga->articolo->image)) {
echo '
<td align="center">
<img src="'.$riga->articolo->image.'" style="max-height: 60px; max-width:80px">
</td>';
$autofill->set(5);
} else {
echo '
<td></td>';
}
}
echo '
<td>';
$text = '';
foreach ($riferimenti as $key => $riferimento) {
@ -271,15 +318,15 @@ $netto_a_pagare = $documento->netto;
$show_sconto = $sconto > 0;
// TOTALE COSTI FINALI
if ($options['pricing']) {
if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-only-total']) {
// Totale imponibile
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? (($has_image) ? 3 : 2) : 4) . '" class="text-right border-top">
<b>'.tr('Imponibile', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? ($options['no-iva'] ? 1 : 2) : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, $d_totali).'</b>
</th>
</tr>';
@ -288,11 +335,11 @@ if ($options['pricing']) {
if ($show_sconto) {
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Sconto', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($sconto, $d_totali).'</b>
</th>
</tr>';
@ -300,24 +347,24 @@ if ($options['pricing']) {
// Totale imponibile
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Totale imponibile', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($totale_imponibile, $d_totali).'</b>
</th>
</tr>';
}
if (!$options['no-iva']) {
// IVA
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Totale IVA', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($totale_iva, $d_totali).'</b>
</th>
</tr>';
@ -325,9 +372,10 @@ if ($options['pricing']) {
// TOTALE
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td>
<th colspan="2" class="text-right">
<b>'.moneyFormat($totale, $d_totali).'</b>
</th>
@ -337,10 +385,10 @@ if ($options['pricing']) {
// SCONTO IN FATTURA
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Sconto in fattura', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($sconto_finale, $d_totali).'</b>
</th>
</tr>';
@ -348,18 +396,28 @@ if ($options['pricing']) {
// NETTO A PAGARE
echo '
<tr>
<td colspan="3" class="text-right border-top">
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Netto a pagare', [], ['upper' => true]). ':</b>
</td>
<th colspan="2" class="text-right">
<th colspan="' . ($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)) . '" class="text-right">
<b>'.moneyFormat($netto_a_pagare, $d_totali).'</b>
</th>
</tr>';
}
}
}
echo '
</table>';
if ($options['no-iva']) {
echo '
<p colspan="3" class="text-right text-muted">
<small>Importo IVA esclusa</small>
</p>
';
}
// CONDIZIONI GENERALI DI FORNITURA
$pagamento = Pagamento::find($documento['idpagamento']);

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!$is_last_page) {
if (!empty($options['last-page-footer'])) {
return;
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!empty($options['last-page-footer']) && !$is_last_page) {
if (!empty($options['last-page-footer'])) {
return;
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!empty($options['last-page-footer']) && !$is_last_page) {
if (!empty($options['last-page-footer'])) {
return;
}

View File

@ -419,6 +419,7 @@ if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-on
<td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td>
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($totale, $d_totali).'</b>
</th>

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!$is_last_page) {
if (!empty($options['last-page-footer'])) {
return;
}

View File

@ -10,6 +10,7 @@ UPDATE `zz_widgets` SET `class` = NULL;
-- Aggiunto available_options per zz_prints
ALTER TABLE `zz_prints` ADD `available_options` TEXT NULL AFTER `enabled`;
-- Opzioni possibili per stampa "Preventivo"
UPDATE `zz_prints` SET `available_options` = '{\"pricing\":\"Visualizzare i prezzi\", \"hide-total\": \"Nascondere i totali delle righe\", \"show-only-total\": \"Visualizzare solo i totali del documento\", \"hide-header\": \"Nascondere intestazione\", \"hide-footer\": \"Nascondere footer\", \"last-page-footer\": \"Visualizzare footer solo su ultima pagina\", \"hide-item-number\": \"Nascondere i codici degli articoli\"}' WHERE `zz_prints`.`name` = 'Preventivo';
UPDATE `zz_prints` SET `options` = '{\"pricing\": true, \"last-page-footer\": true, \"hide-item-number\": true}' WHERE `zz_prints`.`name` = 'Ordine cliente (senza codici)';

View File

@ -160,3 +160,7 @@ HAVING
2=2
ORDER BY
`matricola`" WHERE `name` = 'Impianti';
-- Opzioni possibili per stampa del Contratto
UPDATE `zz_prints` SET `available_options` = '{\"pricing\":\"Visualizzare i prezzi\", \"hide-total\": \"Nascondere i totali delle righe\", \"show-only-total\": \"Visualizzare solo i totali del documento\", \"hide-header\": \"Nascondere intestazione\", \"hide-footer\": \"Nascondere footer\", \"last-page-footer\": \"Visualizzare footer solo su ultima pagina\", \"hide-item-number\": \"Nascondere i codici degli articoli\"}' WHERE `zz_prints`.`name` = 'Contratto';