salix/db/routines/vn/views/invoiceCorrectionDataSource...

17 lines
480 B
MySQL
Raw Normal View History

2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`invoiceCorrectionDataSource`
AS SELECT `s`.`itemFk` AS `itemFk`,
`s`.`quantity` AS `quantity`,
`s`.`concept` AS `concept`,
`s`.`price` AS `price`,
`s`.`discount` AS `discount`,
`t`.`refFk` AS `refFk`,
`s`.`id` AS `saleFk`,
`t`.`shipped` AS `shipped`
FROM (
`vn`.`sale` `s`
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `s`.`ticketFk`)
)
WHERE `t`.`shipped` > `util`.`VN_CURDATE`() + INTERVAL -3 year