1497
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
parent
d73c87c5f2
commit
97459bd7e6
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
CREATE
|
||||||
|
OR REPLACE ALGORITHM = UNDEFINED
|
||||||
|
DEFINER = `root`@`%`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`ticketGetVolume` AS
|
||||||
|
SELECT
|
||||||
|
`s`.`ticketFk` AS `ticketFk`,
|
||||||
|
`t`.`routeFk` AS `routeFk`,
|
||||||
|
`s`.`id` AS `saleFk`,
|
||||||
|
`t`.`shipped` AS `Fecha`,
|
||||||
|
(((`s`.`quantity` * `r`.`cm3`) * `i`.`compression`) / 1000000) AS `volume`
|
||||||
|
FROM
|
||||||
|
(((`vn`.`sale` `s`
|
||||||
|
JOIN `vn`.`item` `i` ON ((`i`.`id` = `s`.`itemFk`)))
|
||||||
|
JOIN `vn`.`ticket` `t` ON ((`t`.`id` = `s`.`ticketFk`)))
|
||||||
|
JOIN `bi`.`rotacion` `r` ON (((`r`.`Id_Article` = `s`.`itemFk`)
|
||||||
|
AND (`r`.`warehouse_id` = `t`.`warehouseFk`))));
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
DROP function IF EXISTS `vn`.`ticketTotalVolume`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
USE `vn`$$
|
||||||
|
CREATE DEFINER=`root`@`%` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3)
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
-- Devuelte el volumen total del ticket sumado
|
||||||
|
-- DECLARE vWarehouseId INTEGER;
|
||||||
|
-- DECLARE vShippedDate DATE;
|
||||||
|
DECLARE vVolume DECIMAL(10,3);
|
||||||
|
/*
|
||||||
|
SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId;
|
||||||
|
|
||||||
|
SELECT IFNULL(SUM(s.quantity * i.compression * r.cm3)/1000000,0) INTO vVolume
|
||||||
|
FROM sale s
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN bi.rotacion r on r.Id_Article = s.itemFk AND r.warehouse_id = vWarehouseId
|
||||||
|
WHERE s.ticketFk = vTicketId;
|
||||||
|
*/
|
||||||
|
SELECT sum(volume) INTO vVolume
|
||||||
|
FROM ticketGetVolume
|
||||||
|
WHERE ticketFk = vTicketId;
|
||||||
|
RETURN vVolume;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
|
@ -71,7 +71,7 @@ describe('Worker absences()', () => {
|
||||||
let calendar = result[0];
|
let calendar = result[0];
|
||||||
let absences = result[1];
|
let absences = result[1];
|
||||||
|
|
||||||
expect(calendar.totalHolidays).toEqual(13.5);
|
expect(calendar.totalHolidays).toEqual(15.5);
|
||||||
expect(calendar.holidaysEnjoyed).toEqual(5);
|
expect(calendar.holidaysEnjoyed).toEqual(5);
|
||||||
|
|
||||||
let firstType = absences[0].absenceType().name;
|
let firstType = absences[0].absenceType().name;
|
||||||
|
|
Loading…
Reference in New Issue