From 469dff4cd2cee88c78262ce6f27df467ab654904 Mon Sep 17 00:00:00 2001 From: Beppe Date: Mon, 7 Mar 2022 16:51:54 +0100 Subject: [PATCH] Azione di gruppo per esportazione PDF prima nota --- modules/primanota/bulk.php | 48 +++++++++++++++++++++++ templates/prima_nota/body.php | 64 +++++++++++++++++++++++++++++++ templates/prima_nota/header.php | 3 ++ templates/prima_nota/init.php | 48 +++++++++++++++++++++++ templates/prima_nota/settings.php | 23 +++++++++++ update/2_4_31.sql | 4 +- 6 files changed, 189 insertions(+), 1 deletion(-) create mode 100755 modules/primanota/bulk.php create mode 100755 templates/prima_nota/body.php create mode 100755 templates/prima_nota/header.php create mode 100755 templates/prima_nota/init.php create mode 100755 templates/prima_nota/settings.php diff --git a/modules/primanota/bulk.php b/modules/primanota/bulk.php new file mode 100755 index 000000000..0b1bf4989 --- /dev/null +++ b/modules/primanota/bulk.php @@ -0,0 +1,48 @@ +. + */ + +include_once __DIR__.'/../../core.php'; + +use Modules\PrimaNota\Mastrino; +use Util\Zip; + +switch (post('op')) { + case 'export-bulk': + + $_SESSION['superselect']['mastrini'] = $id_records; + + $print = Prints::getModulePredefinedPrint($id_module); + header("location: ".$rootdir."/pdfgen.php?id_print=".$print['id']."&id_record=".$id_records[0]); + exit; + + break; +} + +return [ + 'export-bulk' => [ + 'text' => ' '.tr('Esporta PDF'), + 'data' => [ + 'title' => tr('Vuoi davvero esportare il PDF?'), + 'msg' => '', + 'button' => tr('Procedi'), + 'class' => 'btn btn-lg btn-warning', + 'blank' => true, + ], + ], +]; diff --git a/templates/prima_nota/body.php b/templates/prima_nota/body.php new file mode 100755 index 000000000..0704d407b --- /dev/null +++ b/templates/prima_nota/body.php @@ -0,0 +1,64 @@ +. + */ + +include_once __DIR__.'/../../core.php'; + + +echo ' +
+
+

'.tr('Prima nota').'

+
+
'; + +echo ' + + + '; + + foreach($campi as $campo){ + echo ' + '; + } + +echo ' + '; + $index = 0; + + foreach($records['results'] as $record){ + $record['Data'] = Translator::dateToLocale($record['Data']); + $record['Dare'] = Translator::numberToLocale($record['Dare'],'qta'); + $record['Avere'] = Translator::numberToLocale($record['Avere'],'qta'); + ++$index; + + echo ' + + '; + + foreach($campi as $campo){ + echo ' + '; + } + + echo ' + '; + } + +echo ' +
#'.$campo.'
'.$index.''.$record[$campo].'
'; \ No newline at end of file diff --git a/templates/prima_nota/header.php b/templates/prima_nota/header.php new file mode 100755 index 000000000..581526fc5 --- /dev/null +++ b/templates/prima_nota/header.php @@ -0,0 +1,3 @@ +'; diff --git a/templates/prima_nota/init.php b/templates/prima_nota/init.php new file mode 100755 index 000000000..0b825706a --- /dev/null +++ b/templates/prima_nota/init.php @@ -0,0 +1,48 @@ +. + */ + +use Util\Query; + +include_once __DIR__.'/../../core.php'; + +$id_module = Modules::get('Prima nota')['id']; +$structure = Modules::get($id_module); + +if( !empty($_SESSION['superselect']['mastrini']) ){ + $id_record = $_SESSION['superselect']['mastrini']; + $where = "co_movimenti.idmastrino IN (".implode(",",$id_record).")"; + $id_record = json_decode($righe); + unset($_SESSION['superselect']['mastrini']); +}else{ + $where = "co_movimenti.idmastrino=".prepare($id_record); +} + +// RISULTATI VISIBILI +Util\Query::setSegments(false); +$query = Query::getQuery($structure, $where, 0, []); +$query = Modules::replaceAdditionals($id_module, $query); +$query = str_replace("1=1","1=1 AND ".$where,$query); + +$records = Query::executeAndCount($query); + +$campi = []; +foreach($records['results'][0] as $key=>$value){ + $campi[] = $key; +} +unset($campi[0]); \ No newline at end of file diff --git a/templates/prima_nota/settings.php b/templates/prima_nota/settings.php new file mode 100755 index 000000000..ee359be1f --- /dev/null +++ b/templates/prima_nota/settings.php @@ -0,0 +1,23 @@ +. + */ + +return [ + 'orientation' => 'L', + 'font-size' => '11pt', +]; diff --git a/update/2_4_31.sql b/update/2_4_31.sql index 8a93ee47a..b509a6e85 100644 --- a/update/2_4_31.sql +++ b/update/2_4_31.sql @@ -91,4 +91,6 @@ UPDATE `zz_settings` SET `tipo` = 'query=SELECT id, CONCAT(codice,\' - \',descri -- Aggiunte colonne codice e barcode fornitore in listini INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Codice', '(SELECT codice_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 8, 1, 0, 0, 1, '', '', 0, 0, 1), -((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Barcode', '(SELECT barcode_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 9, 1, 0, 0, 1, '', '', 0, 0, 1); \ No newline at end of file +((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Barcode', '(SELECT barcode_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 9, 1, 0, 0, 1, '', '', 0, 0, 1); + +INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name` = 'Prima nota'), (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name` = 'Prima nota'), 'Prima nota', 'Prima nota', 'Prima nota del {data}', 'prima_nota', 'idmastrino', '', 'fa fa-print', '', '', '0', '1', '1', '1'); \ No newline at end of file