CREATE OR REPLACE DEFINER=`vn`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`ticketStateToday`
AS SELECT `ts`.`ticketFk` AS `ticketFk`,
	`ts`.`state` AS `state`,
	`ts`.`productionOrder` AS `productionOrder`,
	`ts`.`alertLevel` AS `alertLevel`,
	`ts`.`userFk` AS `userFk`,
	`ts`.`code` AS `code`,
	`ts`.`updated` AS `updated`,
	`ts`.`isPicked` AS `isPicked`
FROM (
		`vn`.`ticketState` `ts`
		JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`)
	)
WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`midnight`()
