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

17 lines
486 B
MySQL
Raw Normal View History

CREATE OR REPLACE DEFINER=`vn-admin`@`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