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

20 lines
528 B
SQL

CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemEntryIn`
AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
`t`.`landed` AS `landed`,
`b`.`itemFk` AS `itemFk`,
`b`.`quantity` AS `quantity`,
`t`.`isReceived` AS `isReceived`,
`t`.`isRaid` AS `isVirtualStock`,
`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 `b`.`quantity` <> 0