salix/db/routines/vn2008/views/item_entry_in.sql

21 lines
604 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`item_entry_in`
AS SELECT `t`.`warehouse_id` AS `warehouse_id`,
`t`.`warehouse_id_out` AS `warehouse_id_out`,
`t`.`landing` AS `dat`,
`m`.`Id_Article` AS `item_id`,
`m`.`Cantidad` AS `amount`,
`t`.`received` AS `received`,
`e`.`Redada` AS `isVirtualStock`,
`e`.`Id_Entrada` AS `entryFk`
FROM (
(
`vn2008`.`Compres` `m`
JOIN `vn2008`.`Entradas` `e` ON(`m`.`Id_Entrada` = `e`.`Id_Entrada`)
)
JOIN `vn2008`.`travel` `t` ON(`e`.`travel_id` = `t`.`id`)
)
WHERE `e`.`Inventario` = 0
AND `m`.`Cantidad` <> 0