refs #6184 saveCmr #1788
|
@ -184,8 +184,8 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
|
||||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
||||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sectorType` (id,description)
|
INSERT INTO `vn`.`sectorType` (`id`, `code`)
|
||||||
VALUES (1,'First type');
|
VALUES (1,'normal');
|
||||||
|
|
||||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`)
|
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`accountNumberToIban`(
|
||||||
|
vAccount VARCHAR(20)
|
||||||
|
)
|
||||||
|
RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula y genera el código IBAN correspondiente
|
||||||
|
* a un número de cuenta bancaria español.
|
||||||
|
*
|
||||||
|
* @param vAccount Número de cuenta bancaria
|
||||||
|
* @return vIban Código IBAN de 4 caracteres.
|
||||||
|
*/
|
||||||
|
DECLARE vIban VARCHAR(4);
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
CONCAT('ES',
|
||||||
|
RIGHT(
|
||||||
|
CONCAT(0,
|
||||||
|
98-MOD(
|
||||||
|
CONCAT(
|
||||||
|
MOD(
|
||||||
|
CONCAT(
|
||||||
|
MOD(
|
||||||
|
CONCAT(
|
||||||
|
MOD(
|
||||||
|
SUBSTRING(vAccount, 1, 8),
|
||||||
|
97
|
||||||
|
),
|
||||||
|
SUBSTRING(vAccount,9,8)
|
||||||
|
),
|
||||||
|
97
|
||||||
|
),
|
||||||
|
SUBSTRING(
|
||||||
|
CONCAT(vAccount, 142800),
|
||||||
|
17,
|
||||||
|
8
|
||||||
|
)
|
||||||
|
),
|
||||||
|
97
|
||||||
|
),
|
||||||
|
SUBSTRING(
|
||||||
|
CONCAT(vAccount, 142800),
|
||||||
|
25,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
),
|
||||||
|
97
|
||||||
|
)
|
||||||
|
),
|
||||||
|
2
|
||||||
|
)
|
||||||
|
) INTO vIban;
|
||||||
|
|
||||||
|
RETURN vIban;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -70,9 +70,9 @@ BEGIN
|
||||||
ish.created,
|
ish.created,
|
||||||
ish.visible,
|
ish.visible,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
IF(st.description = 'previousByPacking', ish.packing, g.`grouping`),
|
IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
|
||||||
1) `grouping`,
|
1) `grouping`,
|
||||||
st.description = 'previousPrepared' isPreviousPrepared,
|
st.code = 'previousPrepared' isPreviousPrepared,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
ts.ticketFk,
|
ts.ticketFk,
|
||||||
iss.id,
|
iss.id,
|
||||||
|
|
|
@ -207,7 +207,7 @@ proc: BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ish.itemFk,
|
SELECT ish.itemFk,
|
||||||
p.sectorFk,
|
p.sectorFk,
|
||||||
st.description = 'previousPrepared' isPreviousPrepared,
|
st.code = 'previousPrepared' isPreviousPrepared,
|
||||||
sc.itemPackingTypeFk
|
sc.itemPackingTypeFk
|
||||||
FROM itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
|
|
|
@ -85,7 +85,7 @@ BEGIN
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id
|
JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id
|
||||||
JOIN packagingConfig pc
|
JOIN packagingConfig pc
|
||||||
WHERE IF(st.description = 'previousByPacking',
|
WHERE IF(st.code = 'previousByPacking',
|
||||||
i.`size` > pc.previousPreparationMinimumSize
|
i.`size` > pc.previousPreparationMinimumSize
|
||||||
AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ),
|
AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ),
|
||||||
TRUE)
|
TRUE)
|
||||||
|
|
|
@ -15,7 +15,7 @@ AS SELECT `ish`.`itemFk` AS `itemFk`,
|
||||||
`sh`.`parkingFk` AS `parkingFk`,
|
`sh`.`parkingFk` AS `parkingFk`,
|
||||||
`ish`.`id` AS `itemShelvingFk`,
|
`ish`.`id` AS `itemShelvingFk`,
|
||||||
`ish`.`created` AS `created`,
|
`ish`.`created` AS `created`,
|
||||||
`st`.`description` = 'previousPrepared' AS `isPreviousPrepared`
|
`st`.`code` = 'previousPrepared' AS `isPreviousPrepared`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`cc_to_iban`(cc VARCHAR(20))
|
|
||||||
RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
|
||||||
DETERMINISTIC
|
|
||||||
BEGIN
|
|
||||||
DECLARE iban VARCHAR(4);
|
|
||||||
select
|
|
||||||
CONCAT('ES',
|
|
||||||
RIGHT(
|
|
||||||
concat(0,
|
|
||||||
98-
|
|
||||||
mod(
|
|
||||||
concat(
|
|
||||||
mod(
|
|
||||||
concat(
|
|
||||||
mod(
|
|
||||||
concat(
|
|
||||||
mod(
|
|
||||||
substring(cc,1,8),
|
|
||||||
97),
|
|
||||||
substring(cc,9,8)
|
|
||||||
),
|
|
||||||
97),
|
|
||||||
substring(
|
|
||||||
concat(
|
|
||||||
cc,
|
|
||||||
142800
|
|
||||||
),
|
|
||||||
17,
|
|
||||||
8
|
|
||||||
)
|
|
||||||
),
|
|
||||||
97),
|
|
||||||
substring(
|
|
||||||
concat(
|
|
||||||
cc,
|
|
||||||
142800
|
|
||||||
),
|
|
||||||
25,
|
|
||||||
2
|
|
||||||
)
|
|
||||||
),
|
|
||||||
97)
|
|
||||||
)
|
|
||||||
,2)
|
|
||||||
)into iban;
|
|
||||||
RETURN iban;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1 @@
|
||||||
|
REVOKE EXECUTE ON FUNCTION vn2008.cc_to_iban FROM hr, financial;
|
|
@ -0,0 +1,38 @@
|
||||||
|
ALTER TABLE vn.sectorType CHANGE description code varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
|
||||||
|
|
||||||
|
-- Si no pongo lo de bajo da error en la view vn.itemShelvingAvailable
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`itemShelvingStock`
|
||||||
|
AS SELECT `ish`.`itemFk` AS `itemFk`,
|
||||||
|
sum(`ish`.`visible`) AS `visible`,
|
||||||
|
min(`ish`.`packing`) AS `packing`,
|
||||||
|
min(`ish`.`grouping`) AS `grouping`,
|
||||||
|
`s`.`description` AS `sector`,
|
||||||
|
sum(`ish`.`visible`) AS `visibleOriginal`,
|
||||||
|
0 AS `removed`,
|
||||||
|
`p`.`sectorFk` AS `sectorFk`,
|
||||||
|
`s`.`warehouseFk` AS `warehouseFk`,
|
||||||
|
`ish`.`shelvingFk` AS `shelvingFk`,
|
||||||
|
`p`.`code` AS `parkingCode`,
|
||||||
|
`sh`.`parkingFk` AS `parkingFk`,
|
||||||
|
`ish`.`id` AS `itemShelvingFk`,
|
||||||
|
`ish`.`created` AS `created`,
|
||||||
|
`st`.`code` = 'previousPrepared' AS `isPreviousPrepared`
|
||||||
|
FROM (
|
||||||
|
(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
`vn`.`itemShelving` `ish`
|
||||||
|
LEFT JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
|
||||||
|
)
|
||||||
|
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
|
||||||
|
)
|
||||||
|
LEFT JOIN `vn`.`sector` `s` ON(`s`.`id` = `p`.`sectorFk`)
|
||||||
|
)
|
||||||
|
LEFT JOIN `vn`.`sectorType` `st` ON(`st`.`id` = `s`.`typeFk`)
|
||||||
|
)
|
||||||
|
WHERE `ish`.`visible` <> 0
|
||||||
|
AND `p`.`sectorFk` <> 0
|
||||||
|
GROUP BY `ish`.`itemFk`,
|
||||||
|
`p`.`sectorFk`;
|
Loading…
Reference in New Issue