Rinominata a database colonna idsede_azienda in idsede

This commit is contained in:
MatteoPistorello 2021-02-05 14:56:42 +01:00
parent fd49bbf101
commit b2a4a8f5c4
1 changed files with 4 additions and 1 deletions

View File

@ -99,3 +99,6 @@ UPDATE `zz_segments` SET `name` = 'Scadenzario completo per periodo' WHERE `zz_s
-- Eliminata colonna idsede_controparte e rinominata idsede_azienda in idsede
ALTER TABLE `mg_movimenti` CHANGE `idsede_azienda` `idsede` INT(11) NOT NULL;
ALTER TABLE `mg_movimenti` DROP `idsede_controparte`;
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_movimenti` JOIN `mg_articoli` ON `mg_articoli`.id = `mg_movimenti`.`idarticolo` LEFT JOIN `an_sedi` ON `mg_movimenti`.`idsede` = `an_sedi`.`id` WHERE 1=1 HAVING 2=2 ORDER BY mg_movimenti.data DESC, mg_movimenti.created_at DESC' WHERE `zz_modules`.`name` = 'Movimenti';
UPDATE `zz_views` SET `query` = 'IF( mg_movimenti.idsede=0, \'Sede legale\', an_sedi.nomesede )' WHERE `zz_views`.`name` = 'Sede' 'Movimenti' AND `zz_views`.`id_module`= (SELECT `id` FROM `zz_modules` WHERE `name`='Movimenti');
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_articoli`\r\n LEFT OUTER JOIN an_anagrafiche ON mg_articoli.id_fornitore = an_anagrafiche.idanagrafica\r\n LEFT OUTER JOIN co_iva ON mg_articoli.idiva_vendita = co_iva.id\r\n LEFT OUTER JOIN (\r\n SELECT SUM(qta - qta_evasa) AS qta_impegnata, idarticolo FROM or_righe_ordini\r\n INNER JOIN or_ordini ON or_righe_ordini.idordine = or_ordini.id\r\n WHERE idstatoordine IN (SELECT id FROM or_statiordine WHERE completato = 0)\r\n GROUP BY idarticolo\r\n ) ordini ON ordini.idarticolo = mg_articoli.id\r\n LEFT OUTER JOIN (SELECT `idarticolo`, `idsede`, SUM(`qta`) AS `qta` FROM `mg_movimenti` WHERE `idsede` = |giacenze_sedi_idsede| GROUP BY `idarticolo`, `idsede`) movimenti ON `mg_articoli`.`id` = `movimenti`.`idarticolo`\r\nWHERE 1=1 AND `mg_articoli`.`deleted_at` IS NULL HAVING 2=2 AND `Q.tà` > 0 ORDER BY `descrizione`' WHERE `zz_modules`.`name` = 'Giacenze sedi';