salix/db/routines/hedera/views/myOrder.sql

25 lines
781 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `hedera`.`myOrder`
AS SELECT `o`.`id` AS `id`,
`o`.`date_send` AS `sent`,
`o`.`customer_id` AS `clientFk`,
`o`.`delivery_method_id` AS `deliveryMethodFk`,
`o`.`agency_id` AS `agencyModeFk`,
`o`.`address_id` AS `addressFk`,
`o`.`company_id` AS `companyFk`,
`o`.`note` AS `notes`,
`o`.`source_app` AS `sourceApp`,
`o`.`confirmed` AS `isConfirmed`,
`o`.`date_make` AS `created`,
`o`.`first_row_stamp` AS `firstRowStamp`,
`o`.`confirm_date` AS `confirmed`,
`o`.`taxableBase` AS `taxableBase`,
`o`.`tax` AS `tax`,
`o`.`total` AS `total`
FROM `hedera`.`order` `o`
WHERE `o`.`customer_id` = `account`.`myUser_getId`()
AND `o`.`source_app` = 'WEB'
AND `o`.`confirmed` = 0
WITH CASCADED CHECK OPTION