1497
gitea/salix/test This commit looks good Details

This commit is contained in:
Bernat 2019-05-31 11:33:28 +02:00
parent d73c87c5f2
commit 97459bd7e6
3 changed files with 50 additions and 1 deletions

View File

@ -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`))));

View File

@ -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 ;

View File

@ -71,7 +71,7 @@ describe('Worker absences()', () => {
let calendar = result[0];
let absences = result[1];
expect(calendar.totalHolidays).toEqual(13.5);
expect(calendar.totalHolidays).toEqual(15.5);
expect(calendar.holidaysEnjoyed).toEqual(5);
let firstType = absences[0].absenceType().name;