salix/db/routines/edi/views/errorList.sql

24 lines
816 B
MySQL
Raw Permalink Normal View History

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `edi`.`errorList`
AS SELECT `po`.`id` AS `id`,
`c`.`name` AS `name`,
`i`.`longName` AS `longName`,
`po`.`quantity` AS `quantity`,
left(`po`.`error`, 4) AS `stock`,
`po`.`error` AS `error`,
`po`.`deliveryInformationID` AS `deliveryInformationID`,
`po`.`supplyResponseID` AS `supplyResponseID`,
`po`.`OrderTradeLineDateTime` AS `OrderTradeLineDateTime`,
`po`.`EndUserPartyGLN` AS `EndUserPartyGLN`
FROM (
(
`edi`.`putOrder` `po`
LEFT JOIN `vn`.`client` `c` ON(`c`.`id` = `po`.`EndUserPartyGLN`)
)
LEFT JOIN `vn`.`item` `i` ON(`i`.`supplyResponseFk` = `po`.`supplyResponseID`)
)
WHERE `po`.`OrderTradeLineDateTime` > `util`.`VN_CURDATE`() + INTERVAL -12 HOUR
AND `po`.`OrderStatus` = 3
AND left(`po`.`error`, 4) <> '(0) '