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>
<div class="col-md-6"> <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>
</div> </div>

View File

@ -93,5 +93,5 @@ if (setting('Attiva notifica di presenza utenti sul record')) {
</tbody> </tbody>
</table>'; </table>';
} else { } 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

@ -36,7 +36,7 @@ $(document).ready(function() {
url: globals.rootdir + "/actions.php", url: globals.rootdir + "/actions.php",
type: "get", type: "get",
data: { data: {
id_module: '.$id_module.', id_module: '.$id_module. ',
op: "sizes", op: "sizes",
}, },
success: function(data) { success: function(data) {
@ -90,17 +90,16 @@ function crea_grafico(values){
} }
$labels.push(element.description + " (" + element.formattedSize + ")" + " [" + element.count + "]" ) $labels.push(element.description + " (" + element.formattedSize + ")" + " [" + element.count + "]" )
}); });
options = { options = {
responsive: true,
maintainAspectRatio: false,
legend: { legend: {
display: true, display: true,
position: "right" position: "right",
}, },
animation:{ animation:{
animateScale: true, animateScale: true,
@ -164,6 +163,6 @@ function crea_grafico(values){
} }
</script> </script>
<div id="message" class="pull-right"></div> <div id="message" class="pull-right"></div>
<div class="chart-container" style="width:35em;"> <div class="chart-container">
<canvas id="chart"></canvas> <canvas id="chart"></canvas>
</div>'; </div>';

View File

@ -653,8 +653,6 @@ class Prints
// Footer per l'ultima pagina // Footer per l'ultima pagina
if (!empty($options['last-page-footer'])) { if (!empty($options['last-page-footer'])) {
$is_last_page = true;
// Generazione dei contenuti del footer // Generazione dei contenuti del footer
ob_start(); ob_start();
$print_footer = self::filepath($id_print, 'footer.php'); $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'); $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 // Creazione righe fantasma
$autofill = new Util\Autofill($options['pricing'] ? 4 : 2); $autofill = new Util\Autofill($columns);
$autofill->setRows(20, 10); $autofill->setRows(20, 10);
echo ' echo '
@ -111,13 +123,26 @@ echo "
<table class='table table-striped table-bordered' id='contents'> <table class='table table-striped table-bordered' id='contents'>
<thead> <thead>
<tr> <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:50%'>".tr('Descrizione', [], ['upper' => true])."</th>
<th class='text-center' style='width:10%'>".tr('Q.tà', [], ['upper' => true]).'</th>'; <th class='text-center' style='width:10%'>".tr('Q.tà', [], ['upper' => true]).'</th>';
if ($options['pricing']) { if ($options['pricing']) {
echo " echo "
<th class='text-center' style='width:20%'>".tr('Prezzo unitario', [], ['upper' => true])."</th> <th class='text-center' style='width:15%'>" . tr('Prezzo unitario', [], ['upper' => true]) . '</th>';
<th class='text-center' style='width:20%'>".tr('Imponibile', [], ['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 ' echo '
@ -126,8 +151,8 @@ echo '
<tbody>'; <tbody>';
// Righe documento
$righe = $documento->getRighe();
if (!setting('Visualizza riferimento su ogni riga in stampa')) { if (!setting('Visualizza riferimento su ogni riga in stampa')) {
$riferimenti = []; $riferimenti = [];
@ -147,15 +172,37 @@ if (!setting('Visualizza riferimento su ogni riga in stampa')) {
} }
} }
} }
$num = 0;
foreach ($righe as $riga) { foreach ($righe as $riga) {
++$num;
$r = $riga->toArray(); $r = $riga->toArray();
$autofill->count($r['descrizione']); $autofill->count($r['descrizione']);
echo ' echo
'
<tr> <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>'; <td>';
$text = ''; $text = '';
foreach ($riferimenti as $key => $riferimento) { foreach ($riferimenti as $key => $riferimento) {
@ -271,15 +318,15 @@ $netto_a_pagare = $documento->netto;
$show_sconto = $sconto > 0; $show_sconto = $sconto > 0;
// TOTALE COSTI FINALI // TOTALE COSTI FINALI
if ($options['pricing']) { if (($options['pricing'] && !isset($options['hide-total'])) || $options['show-only-total']) {
// Totale imponibile // Totale imponibile
echo ' echo '
<tr> <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> <b>'.tr('Imponibile', [], ['upper' => true]). ':</b>
</td> </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> <b>'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, $d_totali).'</b>
</th> </th>
</tr>'; </tr>';
@ -288,11 +335,11 @@ if ($options['pricing']) {
if ($show_sconto) { if ($show_sconto) {
echo ' echo '
<tr> <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> <b>'.tr('Sconto', [], ['upper' => true]). ':</b>
</td> </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> <b>'.moneyFormat($sconto, $d_totali).'</b>
</th> </th>
</tr>'; </tr>';
@ -300,66 +347,77 @@ if ($options['pricing']) {
// Totale imponibile // Totale imponibile
echo ' echo '
<tr> <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> <b>'.tr('Totale imponibile', [], ['upper' => true]). ':</b>
</td> </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> <b>'.moneyFormat($totale_imponibile, $d_totali).'</b>
</th> </th>
</tr>'; </tr>';
} }
if (!$options['no-iva']) {
// IVA // IVA
echo '
<tr>
<td colspan="3" class="text-right border-top">
<b>'.tr('Totale IVA', [], ['upper' => true]).':</b>
</td>
<th colspan="2" class="text-right">
<b>'.moneyFormat($totale_iva, $d_totali).'</b>
</th>
</tr>';
// TOTALE
echo '
<tr>
<td colspan="3" 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>
</tr>';
if ($sconto_finale) {
// SCONTO IN FATTURA
echo ' echo '
<tr> <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> <b>'.tr('Totale IVA', [], ['upper' => true]). ':</b>
</td> </td>
<th colspan="2" class="text-right">
<b>'.moneyFormat($sconto_finale, $d_totali).'</b> <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> </th>
</tr>'; </tr>';
// NETTO A PAGARE // TOTALE
echo ' echo '
<tr> <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> <b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td> </td>
<th colspan="2" class="text-right"> <th colspan="2" class="text-right">
<b>'.moneyFormat($netto_a_pagare, $d_totali).'</b> <b>'.moneyFormat($totale, $d_totali).'</b>
</th> </th>
</tr>'; </tr>';
if ($sconto_finale) {
// SCONTO IN FATTURA
echo '
<tr>
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Sconto in fattura', [], ['upper' => true]). ':</b>
</td>
<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>';
// NETTO A PAGARE
echo '
<tr>
<td colspan="' . ($options['show-only-total'] ? 2 : 4) . '" class="text-right border-top">
<b>'.tr('Netto a pagare', [], ['upper' => true]). ':</b>
</td>
<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 ' echo '
</table>'; </table>';
if ($options['no-iva']) {
echo '
<p colspan="3" class="text-right text-muted">
<small>Importo IVA esclusa</small>
</p>
';
}
// CONDIZIONI GENERALI DI FORNITURA // CONDIZIONI GENERALI DI FORNITURA
$pagamento = Pagamento::find($documento['idpagamento']); $pagamento = Pagamento::find($documento['idpagamento']);

View File

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

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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; return;
} }

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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; 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"> <td colspan="'.($options['show-only-total'] ? 2 : 4).'" class="text-right border-top">
<b>'.tr('Totale documento', [], ['upper' => true]).':</b> <b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td> </td>
<th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right"> <th colspan="'.($options['show-only-total'] ? (($has_image) ? 2 : 1) : (($has_image) ? 3 : 2)).'" class="text-right">
<b>'.moneyFormat($totale, $d_totali).'</b> <b>'.moneyFormat($totale, $d_totali).'</b>
</th> </th>

View File

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

View File

@ -10,6 +10,7 @@ UPDATE `zz_widgets` SET `class` = NULL;
-- Aggiunto available_options per zz_prints -- Aggiunto available_options per zz_prints
ALTER TABLE `zz_prints` ADD `available_options` TEXT NULL AFTER `enabled`; 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 `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)'; 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

@ -159,4 +159,8 @@ WHERE
HAVING HAVING
2=2 2=2
ORDER BY ORDER BY
`matricola`" WHERE `name` = 'Impianti'; `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';