From 84867671b278ce17d41fd225d08bddf42f3a7218 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Wed, 18 Jan 2023 13:20:42 +0100 Subject: [PATCH] Fix #1112 - Aggiunta colonna inviato in DDT uscita --- update/2_4_40.sql | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/update/2_4_40.sql b/update/2_4_40.sql index ecd7454bc..7226cca47 100644 --- a/update/2_4_40.sql +++ b/update/2_4_40.sql @@ -71,3 +71,30 @@ HAVING 2=2 ORDER BY `co_preventivi`.`id` DESC" WHERE `name` = 'Preventivi'; + +-- Aggiunta colonna Inviato in DDT in uscita +INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES +('26', 'icon_Inviato', "IF(`email`.`id_email` IS NOT NULL, 'fa fa-envelope text-success', '')", '13', '1', '0', '0', '0', NULL, NULL, '0', '0', '0'); + +UPDATE `zz_modules` SET `options` = "SELECT + |select| +FROM + `dt_ddt` + LEFT JOIN `an_anagrafiche` ON `dt_ddt`.`idanagrafica` = `an_anagrafiche`.`idanagrafica` + LEFT JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id` + LEFT JOIN `dt_causalet` ON `dt_ddt`.`idcausalet` = `dt_causalet`.`id` + LEFT JOIN `dt_spedizione` ON `dt_ddt`.`idspedizione` = `dt_spedizione`.`id` + LEFT JOIN `an_anagrafiche` `vettori` ON `dt_ddt`.`idvettore` = `vettori`.`idanagrafica` + LEFT JOIN `an_sedi` AS sedi ON `dt_ddt`.`idsede_partenza` = sedi.`id` + LEFT JOIN `an_sedi` AS `sedi_destinazione`ON `dt_ddt`.`idsede_destinazione` = `sedi_destinazione`.`id` + LEFT JOIN (SELECT `idddt`, SUM(`subtotale` - `sconto`) AS `totale_imponibile`, SUM(`subtotale` - `sconto` + `iva`) AS `totale` FROM `dt_righe_ddt` GROUP BY `idddt`) AS righe ON `dt_ddt`.`id` = `righe`.`idddt` + LEFT JOIN `dt_statiddt` ON `dt_statiddt`.`id` = `dt_ddt`.`idstatoddt` + LEFT JOIN (SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record` FROM `zz_operations` INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id` INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id` INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id` WHERE `zz_modules`.`name` = 'Ddt di vendita' AND `zz_operations`.`op` = 'send-email' GROUP BY `zz_operations`.`id_record`) AS `email` ON `email`.`id_record` = `dt_ddt`.`id` +WHERE + 1=1 AND `dir` = 'entrata' AND (`data` BETWEEN '2023-01-01' AND '2023-12-31 23:59:59') +HAVING + 2=2 +ORDER BY + `data` DESC, + CAST(`numero_esterno` AS UNSIGNED) DESC, + `dt_ddt`.created_at DESC" WHERE `name` = 'Ddt di vendita'; \ No newline at end of file