2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`saleCost`
|
|
|
|
AS SELECT `s`.`itemFk` AS `itemFk`,
|
|
|
|
`s`.`ticketFk` AS `ticketFk`,
|
|
|
|
`s`.`concept` AS `concept`,
|
|
|
|
`s`.`quantity` AS `quantity`,
|
|
|
|
`s`.`discount` AS `discount`,
|
|
|
|
`s`.`price` AS `price`,
|
|
|
|
`c`.`name` AS `component`,
|
|
|
|
`sc`.`value` AS `coste`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`vn`.`sale` `s`
|
|
|
|
JOIN `vn`.`saleComponent` `sc` ON(`sc`.`saleFk` = `s`.`id`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`component` `c` ON(`c`.`id` = `sc`.`componentFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
|
|
|
|
)
|
2024-07-01 09:11:16 +00:00
|
|
|
WHERE `ct`.`code` = 'cost'
|