CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `edi`.`ektRecent` AS SELECT `e`.`id` AS `id`, `e`.`barcode` AS `barcode`, `e`.`entryYear` AS `entryYear`, `e`.`batchNumber` AS `batchNumber`, `e`.`deliveryNumber` AS `deliveryNumber`, `e`.`vendorOrderNumber` AS `vendorOrderNumber`, `e`.`fec` AS `fec`, `e`.`hor` AS `hor`, `e`.`now` AS `now`, `e`.`ptj` AS `ptj`, `e`.`ref` AS `ref`, `e`.`item` AS `item`, `e`.`pac` AS `pac`, `e`.`qty` AS `qty`, `e`.`ori` AS `ori`, `e`.`cat` AS `cat`, `e`.`agj` AS `agj`, `e`.`kop` AS `kop`, `e`.`ptd` AS `ptd`, `e`.`sub` AS `sub`, `e`.`pro` AS `pro`, `e`.`pri` AS `pri`, `e`.`package` AS `package`, `e`.`auction` AS `auction`, `e`.`klo` AS `klo`, `e`.`k1` AS `k1`, `e`.`k2` AS `k2`, `e`.`k3` AS `k3`, `e`.`k4` AS `k4`, `e`.`s1` AS `s1`, `e`.`s2` AS `s2`, `e`.`s3` AS `s3`, `e`.`s4` AS `s4`, `e`.`s5` AS `s5`, `e`.`s6` AS `s6`, `e`.`ok` AS `ok`, `e`.`trolleyFk` AS `trolleyFk`, `e`.`putOrderFk` AS `putOrderFk`, `e`.`scanned` AS `scanned`, `e`.`cps` AS `cps`, `e`.`dp` AS `dp`, `e`.`sender` AS `sender`, `ec`.`usefulAuctionLeftSegmentLength` AS `usefulAuctionLeftSegmentLength`, `ec`.`standardBarcodeLength` AS `standardBarcodeLength`, `ec`.`floridayBarcodeLength` AS `floridayBarcodeLength`, `ec`.`floramondoBarcodeLength` AS `floramondoBarcodeLength`, `ec`.`defaultKlo` AS `defaultKlo`, `ec`.`ektRecentScopeDays` AS `ektRecentScopeDays` FROM ( `edi`.`ekt` `e` JOIN `edi`.`ektConfig` `ec` ) WHERE `e`.`entryYear` = year(`util`.`VN_CURDATE`()) AND `e`.`fec` >= `util`.`VN_CURDATE`() + INTERVAL - `ec`.`ektRecentScopeDays` DAY