2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`productionVolume`
|
|
|
|
AS SELECT HOUR(`e`.`created`) AS `hora`,
|
|
|
|
MINUTE(`e`.`created`) AS `minuto`,
|
|
|
|
IFNULL(
|
|
|
|
`p`.`volume`,
|
|
|
|
IFNULL(`p`.`width` * `p`.`height` * `p`.`depth`, 94500)
|
|
|
|
) AS `cm3`,
|
|
|
|
`t`.`warehouseFk` AS `warehouseFk`,
|
|
|
|
`e`.`created` AS `created`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`vn`.`expedition` `e`
|
|
|
|
LEFT JOIN `vn`.`packaging` `p` ON(`p`.`id` = `e`.`packagingFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `e`.`ticketFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`client` `c` ON(`c`.`id` = `t`.`clientFk`)
|
|
|
|
)
|
|
|
|
WHERE `e`.`created` BETWEEN `util`.`VN_CURDATE`() AND `util`.`dayend`(`util`.`VN_CURDATE`())
|
|
|
|
AND `c`.`isRelevant` <> 0
|