CREATE OR REPLACE DEFINER=`root`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`itemTicketOut`
AS SELECT `t`.`warehouseFk` AS `warehouseFk`,
	`t`.`shipped` AS `shipped`,
	`s`.`itemFk` AS `itemFk`,
	- `s`.`quantity` AS `quantity`,
	`s`.`isPicked` AS `isPicked`,
	`s`.`reserved` AS `reserved`,
	`t`.`refFk` AS `refFk`,
	`s`.`id` AS `saleFk`,
	`s`.`ticketFk` AS `ticketFk`
FROM (
		`vn`.`sale` `s`
		JOIN `vn`.`ticket` `t` ON(`s`.`ticketFk` = `t`.`id`)
	)
WHERE `s`.`quantity` <> 0
