1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-19 20:00:29 +01:00

Update 2_4_29.sql

This commit is contained in:
Luca 2022-01-24 17:39:15 +01:00
parent 6c883d65f4
commit 0cc8b6ba8f

View File

@ -45,9 +45,9 @@ UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM an_mansioni WHERE 1=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 `id` FROM `zz_modules` WHERE `name`='Ordini cliente'), '1', 'Ordine cliente (senza codici)', 'Ordine cliente (senza codici)', 'Ordine cliente num. {numero} del {data}', 'ordini', 'idordine', '{\"pricing\": true, \"last-page-footer\": true, \"hide_codice\": true}', 'fa fa-print', '', '', '0', '0', '1', '1');
-- Aggiunta vista Email inviata in moduli ordini
UPDATE `zz_modules` SET `options` = 'SELECT |select|\r\nFROM `or_ordini`\r\n LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`,\r\n SUM(`subtotale` - `sconto`) AS `totale_imponibile`,\r\n SUM(`subtotale` - `sconto` + `iva`) AS `totale`\r\n FROM `or_righe_ordini`\r\n GROUP BY `idordine`\r\n ) AS righe ON `or_ordini`.`id` = `righe`.`idordine`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n MIN(`data_evasione`) AS `data_evasione`\r\n FROM `or_righe_ordini`\r\n WHERE (`qta` - `qta_evasa`)>0\r\n GROUP BY `idordine`\r\n ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`\r\n LEFT JOIN (\r\n SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine\r\n) AS fattura ON fattura.idordine = or_ordini.id\r\nLEFT JOIN (\r\n SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record`\r\n FROM `zz_operations`\r\n INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id`\r\n INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id`\r\n INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id`\r\n WHERE `zz_modules`.`name` = \'Ordini fornitore\' AND `zz_operations`.`op` = \'send-email\'\r\n GROUP BY `zz_operations`.`id_record`\r\n ) AS `email` ON `email`.`id_record` = `or_ordini`.`id`\r\nWHERE 1=1 AND `dir` = \'uscita\' |date_period(`data`)|\r\nHAVING 2=2\r\nORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`id` = 25;
UPDATE `zz_modules` SET `options` = 'SELECT |select|\r\nFROM `or_ordini`\r\n LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`,\r\n SUM(`subtotale` - `sconto`) AS `totale_imponibile`,\r\n SUM(`subtotale` - `sconto` + `iva`) AS `totale`\r\n FROM `or_righe_ordini`\r\n GROUP BY `idordine`\r\n ) AS righe ON `or_ordini`.`id` = `righe`.`idordine`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n MIN(`data_evasione`) AS `data_evasione`\r\n FROM `or_righe_ordini`\r\n WHERE (`qta` - `qta_evasa`)>0\r\n GROUP BY `idordine`\r\n ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`\r\n LEFT JOIN (\r\n SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine\r\n) AS fattura ON fattura.idordine = or_ordini.id\r\nLEFT JOIN (\r\n SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record`\r\n FROM `zz_operations`\r\n INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id`\r\n INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id`\r\n INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id`\r\n WHERE `zz_modules`.`name` = \'Ordini fornitore\' AND `zz_operations`.`op` = \'send-email\'\r\n GROUP BY `zz_operations`.`id_record`\r\n ) AS `email` ON `email`.`id_record` = `or_ordini`.`id`\r\nWHERE 1=1 AND `dir` = \'uscita\' |date_period(`data`)|\r\nHAVING 2=2\r\nORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`name` = 'Ordini fornitore';
UPDATE `zz_modules` SET `options` = 'SELECT |select|\r\nFROM `or_ordini`\r\n LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`,\r\n SUM(`subtotale` - `sconto`) AS `totale_imponibile`,\r\n SUM(`subtotale` - `sconto` + `iva`) AS `totale`\r\n FROM `or_righe_ordini`\r\n GROUP BY `idordine`\r\n ) AS righe ON `or_ordini`.`id` = `righe`.`idordine`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n MIN(`data_evasione`) AS `data_evasione`\r\n FROM `or_righe_ordini`\r\n WHERE (`qta` - `qta_evasa`)>0\r\n GROUP BY `idordine`\r\n ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`\r\n LEFT JOIN (\r\n SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine\r\n) AS fattura ON fattura.idordine = or_ordini.id\r\nLEFT JOIN (\r\n SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record`\r\n FROM `zz_operations`\r\n INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id`\r\n INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id`\r\n INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id`\r\n WHERE `zz_modules`.`name` = \'Ordini cliente\' AND `zz_operations`.`op` = \'send-email\'\r\n GROUP BY `zz_operations`.`id_record`\r\n ) AS `email` ON `email`.`id_record` = `or_ordini`.`id`\r\nWHERE 1=1 AND `dir` = \'entrata\' |date_period(`data`)|\r\nHAVING 2=2\r\nORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`id` = 24;
UPDATE `zz_modules` SET `options` = 'SELECT |select|\r\nFROM `or_ordini`\r\n LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`,\r\n SUM(`subtotale` - `sconto`) AS `totale_imponibile`,\r\n SUM(`subtotale` - `sconto` + `iva`) AS `totale`\r\n FROM `or_righe_ordini`\r\n GROUP BY `idordine`\r\n ) AS righe ON `or_ordini`.`id` = `righe`.`idordine`\r\n LEFT JOIN (\r\n SELECT `idordine`,\r\n MIN(`data_evasione`) AS `data_evasione`\r\n FROM `or_righe_ordini`\r\n WHERE (`qta` - `qta_evasa`)>0\r\n GROUP BY `idordine`\r\n ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`\r\n LEFT JOIN (\r\n SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine\r\n) AS fattura ON fattura.idordine = or_ordini.id\r\nLEFT JOIN (\r\n SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record`\r\n FROM `zz_operations`\r\n INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id`\r\n INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id`\r\n INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id`\r\n WHERE `zz_modules`.`name` = \'Ordini cliente\' AND `zz_operations`.`op` = \'send-email\'\r\n GROUP BY `zz_operations`.`id_record`\r\n ) AS `email` ON `email`.`id_record` = `or_ordini`.`id`\r\nWHERE 1=1 AND `dir` = \'entrata\' |date_period(`data`)|\r\nHAVING 2=2\r\nORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`name` = 'Ordini cliente';
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Ordini cliente'), 'icon_Inviata', 'IF(`email`.`id_email` IS NOT NULL, \'fa fa-envelope text-success\', \'\')', 12, 1, 0, 0, '', '', 1, 0, 0),