salix/db/routines/vn/views/itemEntryOut.sql

20 lines
531 B
SQL

CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemEntryOut`
AS SELECT `t`.`warehouseOutFk` AS `warehouseOutFk`,
`t`.`shipped` AS `shipped`,
`b`.`itemFk` AS `itemFk`,
- `b`.`quantity` AS `quantity`,
`t`.`isDelivered` AS `isDelivered`,
`e`.`id` AS `entryFk`
FROM (
(
`vn`.`buy` `b`
JOIN `vn`.`entry` `e` ON(`b`.`entryFk` = `e`.`id`)
)
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
)
WHERE `e`.`isExcludedFromAvailable` = 0
AND NOT `t`.`daysInForward`
AND `b`.`quantity` <> 0