From f450a8b6681b66a9b930232cb32d9c497ba869c5 Mon Sep 17 00:00:00 2001 From: Matteo Baccarin Date: Tue, 4 Feb 2020 16:30:11 +0100 Subject: [PATCH] Aggiunti filtri su stampa inventario --- templates/magazzino_inventario/body.php | 10 ++++++++++ update/2_4_13.sql | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/templates/magazzino_inventario/body.php b/templates/magazzino_inventario/body.php index 59e91005a..13cff3136 100644 --- a/templates/magazzino_inventario/body.php +++ b/templates/magazzino_inventario/body.php @@ -9,6 +9,8 @@ $search = [ 'categoria' => $_GET['search_categoria'], 'subcategoria' => $_GET['search_subcategoria'], 'tipo' => $_GET['search_tipo'], + 'fornitore' => $_GET['search_fornitore'], + 'barcode' => $_GET['search_barcode'], ]; foreach ($search as $name => $value) { @@ -46,6 +48,14 @@ if (!empty($search['subcategoria'])) { $where[] = 'id_sottocategoria IN (SELECT id FROM mg_categorie WHERE nome LIKE '.prepare('%'.$search['subcategoria'].'%').' AND parent NOT NULL)'; } +if (!empty($search['fornitore'])) { + $where[] = 'id_fornitore IN (SELECT idanagrafica FROM an_anagrafiche WHERE ragione_sociale LIKE '.prepare('%'.$search['fornitore'].'%').')'; +} + +if (!empty($search['barcode'])) { + $where[] = "(REPLACE(barcode, '.', '') LIKE ".prepare('%'.$search['barcode'].'%').' OR barcode LIKE '.prepare('%'.$search['barcode'].'%').')'; +} + $period_end = $_SESSION['period_end']; $query = 'SELECT *, diff --git a/update/2_4_13.sql b/update/2_4_13.sql index be0adb778..c4859b5a7 100755 --- a/update/2_4_13.sql +++ b/update/2_4_13.sql @@ -181,4 +181,10 @@ INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, ` (NULL, (SELECT id FROM zz_modules WHERE `name`='Articoli'), 'Q.tà impegnata', 'IFNULL(a.qta_impegnata, 0)', 10, 1, 0, 1, '', '', 0, 0, 1), (NULL, (SELECT id FROM zz_modules WHERE `name`='Articoli'), 'Q.tà disponibile', 'qta-IFNULL(a.qta_impegnata, 0)', 11, 1, 0, 1, '', '', 0, 0, 1); -UPDATE `zz_views` SET `order` = '9' WHERE `zz_views`.`name` = 'Q.tà' AND `zz_views`.`id_module` = (SELECT id FROM zz_modules WHERE `name`='Articoli'); \ No newline at end of file +UPDATE `zz_views` SET `order` = '9' WHERE `zz_views`.`name` = 'Q.tà' AND `zz_views`.`id_module` = (SELECT id FROM zz_modules WHERE `name`='Articoli'); + +UPDATE `zz_views` SET `visible` = '1' WHERE `zz_views`.`name` = 'Fornitore' AND `zz_views`.`id_module` = (SELECT id FROM zz_modules WHERE `name`='Articoli'); +UPDATE `zz_views` SET `visible` = '1' WHERE `zz_views`.`name` = 'Prezzo di acquisto' AND `zz_views`.`id_module` = (SELECT id FROM zz_modules WHERE `name`='Articoli'); +UPDATE `zz_views` SET `visible` = '1' WHERE `zz_views`.`name` = 'Prezzo di vendita' AND `zz_views`.`id_module` = (SELECT id FROM zz_modules WHERE `name`='Articoli'); + +INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT id FROM zz_modules WHERE `name`='Articoli'), 'Barcode', 'mg_articoli.barcode', '2', '1', '0', '0', '', '', '1', '0', '1'); \ No newline at end of file