From b8a7ec9d2167b8c2d0cdc308b4352644977749e5 Mon Sep 17 00:00:00 2001 From: MatteoPistorello Date: Wed, 2 Mar 2022 17:18:05 +0100 Subject: [PATCH] Migliorie creazione documento con serial --- include/common/importa.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/include/common/importa.php b/include/common/importa.php index b4780ec88..8af3f8982 100755 --- a/include/common/importa.php +++ b/include/common/importa.php @@ -258,6 +258,19 @@ if (in_array($final_module['name'], ['Fatture di vendita', 'Fatture di acquisto' '; } +$has_serial = 0; +if (!empty($options['serials'])) { + foreach ($righe as $riga) { + if (!empty($riga['abilita_serial'])) { + $serials = $riga->serials ?: 0; + + if (!empty($serials)) { + $has_serial = 1; + } + } + } +} + // Righe del documento echo '
@@ -279,7 +292,7 @@ echo ' '.tr('Q.tà da evadere').' '.tr('Subtot.').''; -if (!empty($options['serials'])) { +if (!empty($has_serial)) { echo ' '.tr('Seriali').''; } @@ -322,6 +335,19 @@ foreach ($righe as $i => $riga) { echo ' '.nl2br($descrizione); + if ($riga->isArticolo() && !empty($riga->abilita_serial)) { + $serials = $riga->serials; + $mancanti = abs($riga->qta) - count($serials); + + if (!empty($mancanti)) { + echo ' +
'.tr('_NUM_ serial mancanti', [ + '_NUM_' => $mancanti, + ]).''; + } + } + + echo ' '; @@ -343,7 +369,7 @@ foreach ($righe as $i => $riga) { '; // Seriali - if (!empty($options['serials'])) { + if (!empty($has_serial)) { echo ' ';