diff --git a/back/helpers.spec.js b/back/helpers.spec.js new file mode 100644 index 000000000..ba8936d41 --- /dev/null +++ b/back/helpers.spec.js @@ -0,0 +1,5 @@ +const baseTime = null; // new Date(2022, 0, 19, 8, 0, 0, 0); +if (baseTime) { + jasmine.clock().install(); + jasmine.clock().mockDate(baseTime); +} diff --git a/db/Dockerfile b/db/Dockerfile index 8980c34f4..c7be72a23 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -31,11 +31,13 @@ COPY \ import-changes.sh \ config.ini \ dump/mysqlPlugins.sql \ + dump/mockDate.sql \ dump/structure.sql \ dump/dumpedFixtures.sql \ ./ RUN gosu mysql docker-init.sh \ && docker-dump.sh mysqlPlugins \ + && docker-dump.sh mockDate \ && docker-dump.sh structure \ && docker-dump.sh dumpedFixtures \ && gosu mysql docker-temp-stop.sh diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0a27b48b8..9f3a5e717 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1,6 +1,9 @@ CREATE SCHEMA IF NOT EXISTS `vn2008`; CREATE SCHEMA IF NOT EXISTS `tmp`; +UPDATE `util`.`config` + SET `environment`= 'test'; + ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1; @@ -8,8 +11,7 @@ ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1; INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) VALUES - ('DEFAULT_TOKEN', '1209600', CURDATE(), 66); - + ('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66); INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) VALUES @@ -295,30 +297,30 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), - (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), - (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), - (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL), - (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL); + (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), + (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), + (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), + (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), + (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL), + (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) - SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 + SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`) VALUES - (1101, 50, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (1102, 100, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (1103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (1104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)); + (1101, 50, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (1102, 100, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)); INSERT INTO `vn`.`clientConfig`(`riskTolerance`, `maxCreditRows`) VALUES @@ -354,7 +356,7 @@ INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `pr (114, 'Somewhere in France', 'address 14', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), (115, 'Somewhere in Birmingham', 'address 15', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), (116, 'Somewhere in Scotland', 'address 16', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (117, 'Somewhere in nowhere', 'address 17', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (117, 'Somewhere in util.VN_NOWhere', 'address 17', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), (118, 'Somewhere over the rainbow', 'address 18', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), (119, 'Somewhere in Alberic', 'address 19', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), (120, 'Somewhere in Montortal', 'address 20', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), @@ -400,20 +402,20 @@ DROP TEMPORARY TABLE tmp.address; INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`) VALUES - (1 , 1101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -11 MONTH)), - (2 , 1101, 5, 900, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)), - (3 , 1101, 5, 800, DATE_ADD(CURDATE(), INTERVAL -9 MONTH)), - (4 , 1101, 5, 700, DATE_ADD(CURDATE(), INTERVAL -8 MONTH)), - (5 , 1101, 5, 600, DATE_ADD(CURDATE(), INTERVAL -7 MONTH)), - (6 , 1101, 5, 500, DATE_ADD(CURDATE(), INTERVAL -6 MONTH)), - (7 , 1101, 5, 400, DATE_ADD(CURDATE(), INTERVAL -5 MONTH)), - (8 , 1101, 9, 300, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (9 , 1101, 9, 200, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (10, 1101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (11, 1101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (12, 1102, 9, 800, CURDATE()), - (14, 1104, 9, 90 , CURDATE()), - (15, 1105, 9, 90 , CURDATE()); + (1 , 1101, 5, 300, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 MONTH)), + (2 , 1101, 5, 900, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 MONTH)), + (3 , 1101, 5, 800, DATE_ADD(util.VN_CURDATE(), INTERVAL -9 MONTH)), + (4 , 1101, 5, 700, DATE_ADD(util.VN_CURDATE(), INTERVAL -8 MONTH)), + (5 , 1101, 5, 600, DATE_ADD(util.VN_CURDATE(), INTERVAL -7 MONTH)), + (6 , 1101, 5, 500, DATE_ADD(util.VN_CURDATE(), INTERVAL -6 MONTH)), + (7 , 1101, 5, 400, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 MONTH)), + (8 , 1101, 9, 300, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (9 , 1101, 9, 200, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (10, 1101, 9, 100, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (11, 1101, 9, 50 , DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (12, 1102, 9, 800, util.VN_CURDATE()), + (14, 1104, 9, 90 , util.VN_CURDATE()), + (15, 1105, 9, 90 , util.VN_CURDATE()); INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`) VALUES @@ -423,16 +425,16 @@ INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`) INSERT INTO `vn`.`clientObservation`(`id`, `clientFk`, `workerFk`, `text`, `created`) VALUES - (1, 1101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()), - (2, 1102, 1, 'With great power, comes great responsibility', CURDATE()), - (3, 1103, 3, 'this is a job for Super-Man!', CURDATE()), - (4, 1104, 3, 'yes... I am Iron-Man', CURDATE()), - (5, 1105, 5, 'They do understand. Our mutant powers make us superior', CURDATE()), - (6, 1106, 5, 'My name is Legion, for we are many!', CURDATE()), - (7, 1107, 9, 'I think our first move should be calling the Avengers..', CURDATE()), - (8, 1108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()), - (9, 1109, 18, 'HULK SMASH! ...', CURDATE()), - (10, 1110, 18, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', CURDATE()); + (1, 1101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', util.VN_CURDATE()), + (2, 1102, 1, 'With great power, comes great responsibility', util.VN_CURDATE()), + (3, 1103, 3, 'this is a job for Super-Man!', util.VN_CURDATE()), + (4, 1104, 3, 'yes... I am Iron-Man', util.VN_CURDATE()), + (5, 1105, 5, 'They do understand. Our mutant powers make us superior', util.VN_CURDATE()), + (6, 1106, 5, 'My name is Legion, for we are many!', util.VN_CURDATE()), + (7, 1107, 9, 'I think our first move should be calling the Avengers..', util.VN_CURDATE()), + (8, 1108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', util.VN_CURDATE()), + (9, 1109, 18, 'HULK SMASH! ...', util.VN_CURDATE()), + (10, 1110, 18, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', util.VN_CURDATE()); INSERT INTO `vn`.`observationType`(`id`,`description`, `code`) VALUES @@ -452,17 +454,17 @@ INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`desc INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`) VALUES - (1, 1101, CURDATE(), CURDATE()), - (2, 1102, CURDATE(), CURDATE()), - (3, 1103, CURDATE(), CURDATE()), - (4, 1104, CURDATE(), CURDATE()), - (5, 1105, CURDATE(), CURDATE()); + (1, 1101, util.VN_CURDATE(), util.VN_CURDATE()), + (2, 1102, util.VN_CURDATE(), util.VN_CURDATE()), + (3, 1103, util.VN_CURDATE(), util.VN_CURDATE()), + (4, 1104, util.VN_CURDATE(), util.VN_CURDATE()), + (5, 1105, util.VN_CURDATE(), util.VN_CURDATE()); INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassificationFk`, `credit`, `creationDate`, `grade`) VALUES - (1, 1, 3000, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL), - (2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL), - (3, 3, 10000, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL); + (1, 1, 3000, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL), + (2, 2, 6000, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL), + (3, 3, 10000, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL); INSERT INTO `vn`.`companyGroup`(`id`, `code`) VALUES @@ -504,11 +506,11 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) VALUES - (1, 'T', 1014.24, CURDATE(), 1101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 0), - (2, 'T', 121.36, CURDATE(), 1102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 0), - (3, 'T', 8.88, CURDATE(), 1103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 0), - (4, 'T', 8.88, CURDATE(), 1103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 0), - (5, 'A', 8.88, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 0); + (1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0); UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1; UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2; @@ -541,29 +543,29 @@ INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`) INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`) VALUES - (1, 1, 813.06, 2000000000, CURDATE()), - (2, 1, 33.80, 4751000000, CURDATE()), - (3, 1, 70.70, 6210000567, CURDATE()), - (4, 2, 110.33, 2000000000, CURDATE()), - (5, 3, 8.07, 2000000000, CURDATE()), - (6, 4, 8.07, 2000000000, CURDATE()), - (7, 5, 8.07, 2000000000, CURDATE()); + (1, 1, 813.06, 2000000000, util.VN_CURDATE()), + (2, 1, 33.80, 4751000000, util.VN_CURDATE()), + (3, 1, 70.70, 6210000567, util.VN_CURDATE()), + (4, 2, 110.33, 2000000000, util.VN_CURDATE()), + (5, 3, 8.07, 2000000000, util.VN_CURDATE()), + (6, 4, 8.07, 2000000000, util.VN_CURDATE()), + (7, 5, 8.07, 2000000000, util.VN_CURDATE()); INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`) VALUES - (1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), - (2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), - (3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), - (4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), - (5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), - (6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), - (7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 23, 0, 0, 0, 100), - (8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 10, 0, 0, 0, 100), - (9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 2, 0, 0, 0, 100), - (10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 3, 0, 0, 0, 100), - (11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), - (12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 4, 0, 0, 0, 100), - (13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100); + (1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), + (2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), + (3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), + (4, 'Zone 247 B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), + (5, 'Zone expensive A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), + (6, 'Zone expensive B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), + (7, 'Zone refund', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 23, 0, 0, 0, 100), + (8, 'Zone others', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 10, 0, 0, 0, 100), + (9, 'Zone superMan', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 2, 0, 0, 0, 100), + (10, 'Zone teleportation', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 3, 0, 0, 0, 100), + (11, 'Zone pickup C', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), + (12, 'Zone entanglement', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 4, 0, 0, 0, 100), + (13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100); INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) VALUES @@ -583,61 +585,61 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`) VALUES - (1, CURDATE(), '23:59'), - (2, CURDATE(), '23:59'), - (3, CURDATE(), '23:59'), - (4, CURDATE(), '23:59'), - (5, CURDATE(), '23:59'), - (6, CURDATE(), '23:59'), - (7, CURDATE(), '23:59'), - (8, CURDATE(), '23:59'), - (9, CURDATE(), '23:59'), - (10, CURDATE(), '23:59'), - (11, CURDATE(), '23:59'), - (12, CURDATE(), '23:59'), - (13, CURDATE(), '23:59'); + (1, util.VN_CURDATE(), '23:59'), + (2, util.VN_CURDATE(), '23:59'), + (3, util.VN_CURDATE(), '23:59'), + (4, util.VN_CURDATE(), '23:59'), + (5, util.VN_CURDATE(), '23:59'), + (6, util.VN_CURDATE(), '23:59'), + (7, util.VN_CURDATE(), '23:59'), + (8, util.VN_CURDATE(), '23:59'), + (9, util.VN_CURDATE(), '23:59'), + (10, util.VN_CURDATE(), '23:59'), + (11, util.VN_CURDATE(), '23:59'), + (12, util.VN_CURDATE(), '23:59'), + (13, util.VN_CURDATE(), '23:59'); INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1'); INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`) VALUES - (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 1.8, 10, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1), - (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 2, 'second route', 0.2, 20, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 9), - (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 3, 'third route', 0.5, 30, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 10), - (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 4, 'fourth route', 0, 40, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 12), - (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 5, 'fifth route', 0.1, 50, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 13), - (6, NULL, 57, CURDATE(), 5, 7, 'sixth route', 1.7, 60, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 3), - (7, NULL, 57, CURDATE(), 6, 8, 'seventh route', 0, 70, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 5); + (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1), + (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9), + (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10), + (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12), + (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13), + (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3), + (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5); INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`) VALUES - (1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, 'T1111111', 0, 1, 5, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T1111111', 0, 1, 5, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (3 , 1, 7, 1, 6, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T2222222', 0, 3, 5, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (4 , 3, 2, 1, 2, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T3333333', 0, 9, 5, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (5 , 3, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T4444444', 0, 10, 5, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (6 , 1, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, 5, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (7 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, CURDATE()), - (8 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, CURDATE()), - (9 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, CURDATE()), - (10, 1, 1, 5, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, CURDATE()), - (11, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, CURDATE()), - (12, 1, 8, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, CURDATE()), - (13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, CURDATE()), - (14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, CURDATE()), - (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, CURDATE()), - (16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, CURDATE()), - (17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, CURDATE()), - (18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, CURDATE()), - (19, 1, 5, 5, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, CURDATE()), - (20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (21, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (22, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (23, NULL, 8, 1, 7, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, CURDATE()), - (24 ,NULL, 8, 1, 7, CURDATE(), CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, CURDATE()), - (25 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, CURDATE()), - (26 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, CURDATE()), - (27 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, CURDATE()); + (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T2222222', 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T3333333', 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T4444444', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE()), + (15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), + (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, util.VN_CURDATE()), + (19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE()), + (20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE()), + (24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE()), + (25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -655,38 +657,38 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des (12, 11, 3, 'Delivery after 10am'); -- FIX for state hours on local, inter_afterInsert -UPDATE vncontrol.inter SET odbc_date = DATE_ADD(CURDATE(), INTERVAL -10 SECOND); +UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND); INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) VALUES - (1, 16, 5 , DATE_ADD(NOW(), INTERVAL -1 MONTH)), - (2, 16, 5 , DATE_ADD(NOW(), INTERVAL -1 MONTH)), - (3, 16, 5 , DATE_ADD(NOW(), INTERVAL -2 MONTH)), - (4, 16, 5 , DATE_ADD(NOW(), INTERVAL -3 MONTH)), - (5, 16, 18, DATE_ADD(NOW(), INTERVAL -4 MONTH)), - (6, 16, 18, DATE_ADD(NOW(), INTERVAL -1 MONTH)), - (7, 10, 18, NOW()), - (8, 5, 19, NOW()), - (9, 5, 19, NOW()), - (10, 5, 19, NOW()), - (11, 3, 19, NOW()), - (12, 3, 19, NOW()), - (13, 3, 19, NOW()), - (14, 3, 19, NOW()), - (15, 2, 19, NOW()), - (16, 3, 19, NOW()), - (17, 2, 19, NOW()), - (18, 2, 19, NOW()), - (19, 2, 19, NOW()), - (20, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), - (21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), - (22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)), - (23, 16, 21, NOW()), - (24, 16, 21, NOW()); + (1, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)), + (2, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)), + (3, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -2 MONTH)), + (4, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -3 MONTH)), + (5, 16, 18, DATE_ADD(util.VN_NOW(), INTERVAL -4 MONTH)), + (6, 16, 18, DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)), + (7, 10, 18, util.VN_NOW()), + (8, 5, 19, util.VN_NOW()), + (9, 5, 19, util.VN_NOW()), + (10, 5, 19, util.VN_NOW()), + (11, 3, 19, util.VN_NOW()), + (12, 3, 19, util.VN_NOW()), + (13, 3, 19, util.VN_NOW()), + (14, 3, 19, util.VN_NOW()), + (15, 2, 19, util.VN_NOW()), + (16, 3, 19, util.VN_NOW()), + (17, 2, 19, util.VN_NOW()), + (18, 2, 19, util.VN_NOW()), + (19, 2, 19, util.VN_NOW()), + (20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)), + (21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)), + (22, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)), + (23, 16, 21, util.VN_NOW()), + (24, 16, 21, util.VN_NOW()); INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`) VALUES - (12, 13, CURDATE()); + (12, 13, util.VN_CURDATE()); INSERT INTO `vn`.`deliveryPoint` (`id`, `name`, `ubication`) VALUES @@ -703,7 +705,7 @@ INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`, `inventoried`) VALUES - (1, 'beta-server', 'nightmare@mydomain.com', '200', DATE_ADD(CURDATE(),INTERVAL -1 MONTH)); + (1, 'beta-server', 'nightmare@mydomain.com', '200', DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH)); INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`) VALUES @@ -717,18 +719,18 @@ INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`) INSERT INTO `vn`.`greuge`(`id`, `clientFk`, `description`, `amount`, `shipped`, `created`, `greugeTypeFk`, `ticketFk`) VALUES - (1, 1101, 'some diff charges', -19.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), - (2, 1101, 'more diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), - (3, 1101, 'even more! diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), - (4, 1101, 'insane diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), - (5, 1101, 'gargantuous diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), - (6, 1101, 'diff charges', 88.30, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1), - (7, 1101, 'unaffordable diff charges', -39.12, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), - (8, 1101, 'some recovery charges', 29.35, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), - (9, 1101, 'some manna charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), - (10, 1101, 'some claim charges', 13.13, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), - (11, 1101, 'some heritage charges', -15.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), - (12, 1101, 'some miscellaneous charges', 58.00, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1); + (1, 1101, 'some diff charges', -19.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 1, 1), + (2, 1101, 'more diff charges', 60, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 2, 1), + (3, 1101, 'even more! diff charges', -9.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 3, 1), + (4, 1101, 'insane diff charges', 60, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 4, 1), + (5, 1101, 'gargantuous diff charges', -9.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 5, 1), + (6, 1101, 'diff charges', 88.30, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 6, 1), + (7, 1101, 'unaffordable diff charges', -39.12, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 1, 1), + (8, 1101, 'some recovery charges', 29.35, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 2, 1), + (9, 1101, 'some manna charges', -9.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 3, 1), + (10, 1101, 'some claim charges', 13.13, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 4, 1), + (11, 1101, 'some heritage charges', -15.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 5, 1), + (12, 1101, 'some miscellaneous charges', 58.00, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 6, 1); INSERT INTO `vn`.`mandateType`(`id`, `name`) VALUES @@ -738,7 +740,7 @@ INSERT INTO `vn`.`mandateType`(`id`, `name`) INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `mandateTypeFk`) VALUES - (1, 1102, 442, '1-1', CURDATE(), 2); + (1, 1102, 442, '1-1', util.VN_CURDATE(), 2); INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`) VALUES @@ -793,10 +795,10 @@ INSERT INTO `vn`.`taxType`(`id`, `nickname`, `isAccrued`, `serial`, `TIPOOPE`, ` INSERT INTO `vn`.`taxCode`(`id`, `dated`, `code`, `taxTypeFk`, `rate`, `equalizationTax`, `type`, `link`, `isActive`, `updated`, `transactionCode`) VALUES - (1 , CURDATE(), '1111111111', 1, 7.0 , 0.0, 'R', 1, 1, CURDATE(), 1), - (2 , CURDATE(), '2222222222', 2, 16.0, 0.0, 'G', 2, 1, CURDATE(), 1), - (21 , CURDATE(), '3333333333', 1, 7.0, 0.0, 'R', 3, 1, CURDATE(), 1), - (108, CURDATE(), '4444444444', 2, 8.0 , 0.0, 'R', 4, 1, CURDATE(), 1); + (1 , util.VN_CURDATE(), '1111111111', 1, 7.0 , 0.0, 'R', 1, 1, util.VN_CURDATE(), 1), + (2 , util.VN_CURDATE(), '2222222222', 2, 16.0, 0.0, 'G', 2, 1, util.VN_CURDATE(), 1), + (21 , util.VN_CURDATE(), '3333333333', 1, 7.0, 0.0, 'R', 3, 1, util.VN_CURDATE(), 1), + (108, util.VN_CURDATE(), '4444444444', 2, 8.0 , 0.0, 'R', 4, 1, util.VN_CURDATE(), 1); INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`) VALUES @@ -805,9 +807,9 @@ INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`) INSERT INTO `vn`.`taxClassCode`(`taxClassFk`, `effectived`, `taxCodeFk`) VALUES - (1, CURDATE(), 1), - (1, CURDATE(), 21), - (2, CURDATE(), 2); + (1, util.VN_CURDATE(), 1), + (1, util.VN_CURDATE(), 21), + (2, util.VN_CURDATE(), 2); INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) VALUES @@ -847,9 +849,9 @@ UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`) VALUES - (1, 1, 0, 0, 2.5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), - (2, 3, 10, 10, 10, 10, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), - (3, 13, 8.5, 10, 7.5, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 1, 2, CURDATE()); + (1, 1, 0, 0, 2.5, 2, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()), + (2, 3, 10, 10, 10, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()), + (3, 13, 8.5, 10, 7.5, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 1, 2, util.VN_CURDATE()); INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`) VALUES @@ -857,14 +859,14 @@ INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`) INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`) VALUES - (1, 0.00, 10, 10, 0, 1, CURDATE(), 6, 1.50), - (2, 100.00, 20, 20, 0, 1, CURDATE(), 7, 1.00), - (3, 14000.00, 0, 0, 0, 1, CURDATE(), NULL, 0), - (4, 218000.00, 0, 0, 0, 0, CURDATE(), NULL, 0), - (5, 292000.00, 0, 0, 0, 0, CURDATE(), NULL, 0), - (94, 140875.00, 49.00, 115.00, 25.00, 0, CURDATE(), 71, 0.00), - ('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00), - ('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00); + (1, 0.00, 10, 10, 0, 1, util.VN_CURDATE(), 6, 1.50), + (2, 100.00, 20, 20, 0, 1, util.VN_CURDATE(), 7, 1.00), + (3, 14000.00, 0, 0, 0, 1, util.VN_CURDATE(), NULL, 0), + (4, 218000.00, 0, 0, 0, 0, util.VN_CURDATE(), NULL, 0), + (5, 292000.00, 0, 0, 0, 0, util.VN_CURDATE(), NULL, 0), + (94, 140875.00, 49.00, 115.00, 25.00, 0, util.VN_CURDATE(), 71, 0.00), + ('cc', 1640038.00, 56.00, 220.00, 128.00, 1, util.VN_CURDATE(), 15, 90.00), + ('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, util.VN_CURDATE(), 16, 0.00); INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`) VALUES @@ -875,68 +877,68 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`) INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`) VALUES - (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1), - (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1), - (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2), - (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2), - (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3), - (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3), - (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL), - (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1), - (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2), + (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1), + (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1), + (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2), + (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2), + (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3), + (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3), + (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL), + (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1), + (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2), (10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94, 3); INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) VALUES - (1, CURDATE(), 1, 1, 1), - (2, CURDATE(), 2, 1, 1), - (3, CURDATE(), 3, 1, 1), - (4, CURDATE(), 3, 2, 1106), - (5, CURDATE(), 5, 1, 1106), - (6, CURDATE(), 5, 3, 1106); + (1, util.VN_CURDATE(), 1, 1, 1), + (2, util.VN_CURDATE(), 2, 1, 1), + (3, util.VN_CURDATE(), 3, 1, 1), + (4, util.VN_CURDATE(), 3, 2, 1106), + (5, util.VN_CURDATE(), 5, 1, 1106), + (6, util.VN_CURDATE(), 5, 3, 1106); INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`) VALUES - (1, 1, 2, 2, CURDATE(), NULL), - (2, 2, 2, 1, CURDATE(), NULL), - (3, 3, 2, 4, CURDATE(), NULL); + (1, 1, 2, 2, util.VN_CURDATE(), NULL), + (2, 2, 2, 1, util.VN_CURDATE(), NULL), + (3, 3, 2, 4, util.VN_CURDATE(), NULL); INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`) VALUES - (1, 1, 1, 'Ranged weapon longbow 2m', 5, 100.39, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (3, 1, 1, 'Ranged weapon longbow 2m', 2, 100.39, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, CURDATE()), - (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, CURDATE()), - (9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()), - (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, CURDATE()), - (11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()), - (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, CURDATE()), - (13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()), - (14, 1, 8, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, CURDATE()), - (15, 1, 19, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()), - (16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, CURDATE()), - (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (19, 1, 4, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (20, 1, 5, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (21, 1, 6, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (22, 1, 7, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()), - (23, 1, 9, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()), - (24, 1, 10, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()), - (25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()), - (31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, CURDATE()), - (32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, CURDATE()), - (33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, CURDATE()); + (1, 1, 1, 'Ranged weapon longbow 2m', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3, 1, 1, 'Ranged weapon longbow 2m', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, util.VN_CURDATE()), + (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, util.VN_CURDATE()), + (9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()), + (11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, util.VN_CURDATE()), + (13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE()), + (14, 1, 8, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()), + (15, 1, 19, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE()), + (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (19, 1, 4, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (20, 1, 5, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (21, 1, 6, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (22, 1, 7, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (23, 1, 9, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (24, 1, 10, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()), + (32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES @@ -1098,10 +1100,10 @@ INSERT INTO `vncontrol`.`accion`(`accion_id`, `accion`) INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) VALUES - (1, 0, CURDATE(), 5, 55, 3, 1, 14), - (1, 1, CURDATE(), 5, 54, 3, 2, 8), - (2, 1, CURDATE(), 10, 40, 4, 3, 8), - (3, 1, CURDATE(), 2, 40, 4, 4, 8); + (1, 0, util.VN_CURDATE(), 5, 55, 3, 1, 14), + (1, 1, util.VN_CURDATE(), 5, 54, 3, 2, 8), + (2, 1, util.VN_CURDATE(), 10, 40, 4, 3, 8), + (3, 1, util.VN_CURDATE(), 2, 40, 4, 4, 8); INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`) VALUES @@ -1124,8 +1126,8 @@ INSERT INTO `vn`.`train`(`id`, `name`) INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`, `created`, `trainFk`) VALUES - (1, 1106, 5, DATE_ADD(CURDATE(),INTERVAL +1 DAY), 1), - (2, 1106, 14, CURDATE(), 1); + (1, 1106, 5, DATE_ADD(util.VN_CURDATE(),INTERVAL +1 DAY), 1), + (2, 1106, 14, util.VN_CURDATE(), 1); INSERT INTO `vn`.`ticketCollection`(`id`, `ticketFk`, `collectionFk`) VALUES @@ -1296,10 +1298,10 @@ INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`) VALUES - (1, 1101, DATE_ADD(CURDATE(),INTERVAL -7 MONTH), DATE_ADD(CURDATE(),INTERVAL -3 MONTH), 50, 7), - (2, 1102, DATE_ADD(CURDATE(),INTERVAL -5 MONTH), CURDATE(), 100, 1), - (3, 1102, CURDATE(), DATE_ADD(CURDATE(),INTERVAL 1 MONTH), 50, 7), - (4, 1103, CURDATE(), NULL, 50, 7); + (1, 1101, DATE_ADD(util.VN_CURDATE(),INTERVAL -7 MONTH), DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), 50, 7), + (2, 1102, DATE_ADD(util.VN_CURDATE(),INTERVAL -5 MONTH), util.VN_CURDATE(), 100, 1), + (3, 1102, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(),INTERVAL 1 MONTH), 50, 7), + (4, 1103, util.VN_CURDATE(), NULL, 50, 7); INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`) VALUES @@ -1327,9 +1329,9 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) VALUES - (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), - (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); + (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), + (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), + (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) VALUES @@ -1340,9 +1342,9 @@ INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`) VALUES - (1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL), - (2, 4, 'last_buy', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL), - (3, 8, 'visible', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL); + (1, 2, 'available', CONCAT_WS('/',1,util.VN_CURDATE()), util.VN_NOW(), DATE_ADD(util.VN_NOW(),INTERVAL 15 MINUTE), util.VN_CURDATE(), NULL), + (2, 4, 'last_buy', CONCAT_WS('/',1,util.VN_CURDATE()), util.VN_NOW(), DATE_ADD(util.VN_NOW(),INTERVAL 15 MINUTE), util.VN_CURDATE(), NULL), + (3, 8, 'visible', CONCAT_WS('/',1,util.VN_CURDATE()), util.VN_NOW(), DATE_ADD(util.VN_NOW(),INTERVAL 15 MINUTE), util.VN_CURDATE(), NULL); INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`) VALUES @@ -1354,25 +1356,25 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`) INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`) VALUES - (1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1), - (2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2), - (3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1), - (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2), - (5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1), - (6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2), - (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), - (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); + (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1), + (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2), + (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1), + (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2), + (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1), + (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2), + (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), + (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`) VALUES - (1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'Movement 1', 0, 0, '', ''), - (2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'), - (3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'), - (4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'), - (5, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'), - (6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'), - (7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), - (8, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', ''); + (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'Movement 1', 0, 0, '', ''), + (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'), + (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'), + (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'), + (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'), + (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'), + (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), + (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', ''); INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) VALUES @@ -1383,97 +1385,97 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) VALUES - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', 2, 1, '35074', '687', '2.0'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', 3, 1, '1777', '13', '0.7'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', 4, 1, '3182', '59', '0.6'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Crisantemo', 5, 1, '1747', '13', '0.7'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Lilium Oriental', 6, 1, '7182', '59', '0.6'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Alstroemeria', 7, 1, '1777', '13', '0.7'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 1, 1, '4181', '59', '0.6'), - ('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 2, 1, '7268', '59', '0.6'), - ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', 2, 1, '-74', '0', '0.0'), - ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', 3, 1, '-7', '0', '0.0'), - ('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', 4, 1, '1100', '0', '0.0'), - ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', 5, 1, '848', '-187', '-22.1'), - ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'), - ('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0'); + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', 2, 1, '35074', '687', '2.0'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', 3, 1, '1777', '13', '0.7'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', 4, 1, '3182', '59', '0.6'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Crisantemo', 5, 1, '1747', '13', '0.7'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Lilium Oriental', 6, 1, '7182', '59', '0.6'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Alstroemeria', 7, 1, '1777', '13', '0.7'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 1, 1, '4181', '59', '0.6'), + ('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 2, 1, '7268', '59', '0.6'), + ('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', 2, 1, '-74', '0', '0.0'), + ('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', 3, 1, '-7', '0', '0.0'), + ('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', 4, 1, '1100', '0', '0.0'), + ('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', 5, 1, '848', '-187', '-22.1'), + ('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'), + ('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0'); INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`producer`,`printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`) VALUES - (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, CURDATE()), - (4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 2.5, CURDATE()), - (5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, NULL, 0, 1, 0, 2.5, CURDATE()), - (6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 2.5, CURDATE()), - (7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, NULL, 0, 1, 0, 2.5, CURDATE()), - (8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 2.5, CURDATE()), - (9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()), - (10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, CURDATE()), - (11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()), - (12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()), - (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, CURDATE()), - (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 4, CURDATE()), - (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()); + (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, util.VN_CURDATE()), + (4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), + (5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), + (6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), + (7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), + (8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), + (9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 4, util.VN_CURDATE()), + (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()); INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES - (1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 3, 1, 121, 442, NULL, 'TPV', 1,'155.89', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 3, 1, 124, 442, NULL, 'WEB', 1,'100.10', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 1, 2, 124, 442, NULL, 'ANDROID', 1,'107.25', DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 1, 2, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 1, 3, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 1, 3, 1, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1101, 2, 7, 1, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()), - (8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1101, 2, 7, 121, 442, NULL, 'SALIX', 0,'123.53', CURDATE(), CURDATE(), CURDATE()), - (9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1104, 2, 7, 124, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()), - (10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1102, 3, 1, 2, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()), - (11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1102, 2, 7, 122, 442, NULL, 'SALIX', 0,'60.90', CURDATE(), CURDATE(), CURDATE()), - (12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1103, 3, 1, 3, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1103, 1, 2, 123, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1104, 1, 2, 4, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1105, 1, 3, 125, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1106, 2, 7, 126, 442, NULL, 'SALIX', 0,'155.89', CURDATE(), CURDATE(), CURDATE()), - (17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1107, 1, 4, 127, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1108, 1, 4, 128, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()), - (19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1109, 1, 5, 129, 442, NULL, 'SALIX', 0,'16.50', CURDATE(), CURDATE(), CURDATE()), - (20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 101, 442, NULL, 'SALIX', 0,'21.45', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 102, 442, NULL, 'SALIX', 0,'0.00', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 103, 442, NULL, 'SALIX', 0,'148.50', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); + (1, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 3, 1, 121, 442, NULL, 'TPV', 1,'155.89', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (2, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 3, 1, 124, 442, NULL, 'WEB', 1,'100.10', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 1, 2, 124, 442, NULL, 'ANDROID', 1,'107.25', DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (4, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 1, 2, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (5, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 1, 3, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (6, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 1, 3, 1, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (7, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 2, 7, 1, 442, NULL, 'SALIX', 0,'10.01', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (8, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 2, 7, 121, 442, NULL, 'SALIX', 0,'123.53', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (9, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 2, 7, 124, 442, NULL, 'SALIX', 0,'10.01', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 3, 1, 2, 442, NULL, 'SALIX', 0,'10.01', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (11, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 2, 7, 122, 442, NULL, 'SALIX', 0,'60.90', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (12, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 3, 1, 3, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (13, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 1, 2, 123, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (14, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 1, 2, 4, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (15, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 1, 3, 125, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (16, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 2, 7, 126, 442, NULL, 'SALIX', 0,'155.89', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (17, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1107, 1, 4, 127, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (18, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 1, 4, 128, 442, NULL, 'SALIX', 0,'72.60', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (19, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 1, 5, 129, 442, NULL, 'SALIX', 0,'16.50', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE()), + (20, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 101, 442, NULL, 'SALIX', 0,'21.45', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (21, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 102, 442, NULL, 'SALIX', 0,'0.00', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (22, DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 1, 5, 103, 442, NULL, 'SALIX', 0,'148.50', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)); INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`) VALUES - (1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1), - (2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2), - (3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3), - (4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4), - (5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5), - (6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 6), - (7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7), - (8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8), - (9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9), - (10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10), - (11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11), - (12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12), - (13, 8, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 13), - (14, 8, 1, 1, CURDATE(), 10, 9.28, 0, CURDATE(), 14), - (15, 19, 1, 1, CURDATE(), 10, 1.50, 0, CURDATE(), 15), - (16, 20, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 16), - (17, 22, 2, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 30, 2.30, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 17), - (18, 22, 4, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 20, 3.00, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 18), - (19, 4, 1, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 19), - (20, 5, 1, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 20), - (21, 6, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 21), - (22, 7, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 22), - (23, 9, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 23), - (24, 10, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 24), - (25, 12, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 25), - (26, 13, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 26), - (27, 14, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 27), - (28, 15, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 28), - (29, 17, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 29), - (30, 18, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 30); + (1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1), + (2, 1, 2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 10, 1.07, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2), + (3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3), + (4, 1, 4, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 20, 3.06, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4), + (5, 2, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 10, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5), + (6, 3, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 15, 6.50, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 6), + (7, 11, 2, 1, util.VN_CURDATE(), 15, 1.30, 0, util.VN_CURDATE(), 7), + (8, 11, 4, 1, util.VN_CURDATE(), 10, 3.26, 0, util.VN_CURDATE(), 8), + (9, 16, 1, 1, util.VN_CURDATE(), 5, 9.10, 0, util.VN_CURDATE(), 9), + (10, 16, 2, 1, util.VN_CURDATE(), 10, 1.07, 0, util.VN_CURDATE(), 10), + (11, 16, 1, 1, util.VN_CURDATE(), 2, 9.10, 0, util.VN_CURDATE(), 11), + (12, 16, 4, 1, util.VN_CURDATE(), 20, 3.06, 0, util.VN_CURDATE(), 12), + (13, 8, 2, 1, util.VN_CURDATE(), 15, 1.30, 0, util.VN_CURDATE(), 13), + (14, 8, 1, 1, util.VN_CURDATE(), 10, 9.28, 0, util.VN_CURDATE(), 14), + (15, 19, 1, 1, util.VN_CURDATE(), 10, 1.50, 0, util.VN_CURDATE(), 15), + (16, 20, 2, 1, util.VN_CURDATE(), 15, 1.30, 0, util.VN_CURDATE(), 16), + (17, 22, 2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 30, 2.30, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 17), + (18, 22, 4, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 20, 3.00, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 18), + (19, 4, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 19), + (20, 5, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 20), + (21, 6, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 9.10, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 21), + (22, 7, 1, 1, util.VN_CURDATE(), 1, 9.10, 0, util.VN_CURDATE(), 22), + (23, 9, 1, 1, util.VN_CURDATE(), 1, 9.10, 0, util.VN_CURDATE(), 23), + (24, 10, 1, 1, util.VN_CURDATE(), 1, 9.10, 0, util.VN_CURDATE(), 24), + (25, 12, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 25), + (26, 13, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 26), + (27, 14, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 27), + (28, 15, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 28), + (29, 17, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 29), + (30, 18, 4, 1, util.VN_CURDATE(), 20, 3.00, 0, util.VN_CURDATE(), 30); INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) VALUES @@ -1661,43 +1663,43 @@ INSERT INTO `hedera`.`visitAgent`(`id`, `visitFk`) INSERT INTO `hedera`.`visitAccess`(`id`, `agentFk`, `stamp`) VALUES - (1, 1, CURDATE()), - (2, 2, CURDATE()), - (3, 3, CURDATE()), - (4, 4, CURDATE()), - (5, 5, CURDATE()), - (6, 6, CURDATE()), - (7, 7, CURDATE()), - (8, 8, CURDATE()), - (9, 9, CURDATE()), - (10, 10, CURDATE()), - (11, 11, CURDATE()); + (1, 1, util.VN_CURDATE()), + (2, 2, util.VN_CURDATE()), + (3, 3, util.VN_CURDATE()), + (4, 4, util.VN_CURDATE()), + (5, 5, util.VN_CURDATE()), + (6, 6, util.VN_CURDATE()), + (7, 7, util.VN_CURDATE()), + (8, 8, util.VN_CURDATE()), + (9, 9, util.VN_CURDATE()), + (10, 10, util.VN_CURDATE()), + (11, 11, util.VN_CURDATE()); INSERT INTO `hedera`.`visitUser`(`id`, `accessFk`, `userFk`, `stamp`) VALUES - (1, 1, 1101, CURDATE()), - (2, 2, 1101, CURDATE()), - (3, 3, 1101, CURDATE()), - (4, 4, 1102, CURDATE()), - (5, 5, 1102, CURDATE()), - (6, 6, 1102, CURDATE()), - (7, 7, 1103, CURDATE()), - (8, 8, 1103, CURDATE()), - (9, 9, 1103, CURDATE()), - (10, 10, 1102, DATE_SUB(CURDATE(), INTERVAL 1 DAY)), - (11, 11, 1103, DATE_SUB(CURDATE(), INTERVAL 1 DAY)); + (1, 1, 1101, util.VN_CURDATE()), + (2, 2, 1101, util.VN_CURDATE()), + (3, 3, 1101, util.VN_CURDATE()), + (4, 4, 1102, util.VN_CURDATE()), + (5, 5, 1102, util.VN_CURDATE()), + (6, 6, 1102, util.VN_CURDATE()), + (7, 7, 1103, util.VN_CURDATE()), + (8, 8, 1103, util.VN_CURDATE()), + (9, 9, 1103, util.VN_CURDATE()), + (10, 10, 1102, DATE_SUB(util.VN_CURDATE(), INTERVAL 1 DAY)), + (11, 11, 1103, DATE_SUB(util.VN_CURDATE(), INTERVAL 1 DAY)); INSERT INTO `hedera`.`userSession`(`created`, `lastUpdate`, `ssid`, `data`, `userVisitFk`) VALUES - (CURDATE(), CURDATE(), '121', 'data', 1), - (CURDATE(), CURDATE(), '122', 'data', 2), - (CURDATE(), CURDATE(), '123', 'data', 3), - (CURDATE(), CURDATE(), '124', 'data', 4), - (CURDATE(), CURDATE(), '125', 'data', 5), - (CURDATE(), CURDATE(), '126', 'data', 6), - (CURDATE(), CURDATE(), '127', 'data', 7), - (CURDATE(), CURDATE(), '128', 'data', 8), - (CURDATE(), CURDATE(), '129', 'data', 9); + (util.VN_CURDATE(), util.VN_CURDATE(), '121', 'data', 1), + (util.VN_CURDATE(), util.VN_CURDATE(), '122', 'data', 2), + (util.VN_CURDATE(), util.VN_CURDATE(), '123', 'data', 3), + (util.VN_CURDATE(), util.VN_CURDATE(), '124', 'data', 4), + (util.VN_CURDATE(), util.VN_CURDATE(), '125', 'data', 5), + (util.VN_CURDATE(), util.VN_CURDATE(), '126', 'data', 6), + (util.VN_CURDATE(), util.VN_CURDATE(), '127', 'data', 7), + (util.VN_CURDATE(), util.VN_CURDATE(), '128', 'data', 8), + (util.VN_CURDATE(), util.VN_CURDATE(), '129', 'data', 9); INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`) VALUES @@ -1721,11 +1723,11 @@ call vn.manaSpellersRequery(18); INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `userFk`, `companyFk`) VALUES - (1, 1101, 1, CURDATE(), 18, 18, 442), - (2, 1101, 1, CURDATE(), 18, 18, 442), - (3, 1101, 2, CURDATE(), 18, 18, 442), - (4, 1102, 2, CURDATE(), 18, 18, 567), - (5, 1102, 3, CURDATE(), 19, 19, 567); + (1, 1101, 1, util.VN_CURDATE(), 18, 18, 442), + (2, 1101, 1, util.VN_CURDATE(), 18, 18, 442), + (3, 1101, 2, util.VN_CURDATE(), 18, 18, 442), + (4, 1102, 2, util.VN_CURDATE(), 18, 18, 567), + (5, 1102, 3, util.VN_CURDATE(), 19, 19, 567); INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, `hasToNotify`) VALUES @@ -1739,10 +1741,10 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`) VALUES - (1, CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, CURDATE(), 0), - (2, CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, CURDATE(), 1), - (3, CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, CURDATE(), 5), - (4, CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, CURDATE(), 10); + (1, util.VN_CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, util.VN_CURDATE(), 0), + (2, util.VN_CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, util.VN_CURDATE(), 1), + (3, util.VN_CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, util.VN_CURDATE(), 5), + (4, util.VN_CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, util.VN_CURDATE(), 10); INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) VALUES @@ -1779,12 +1781,12 @@ INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, ` INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`) VALUES - (1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', CURDATE()), - (2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', CURDATE()), - (3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', CURDATE()), - (4, 2, 1101, NULL, 4698, NULL, NULL, 'started', CURDATE()), - (5, 1, 1104, NULL, 2000, NULL, 'SIS0043', 'ok', CURDATE()), - (6, 2, 1104, NULL, 4000, NULL, 'SIS0044', 'started', CURDATE()); + (1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', util.VN_CURDATE()), + (2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', util.VN_CURDATE()), + (3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', util.VN_CURDATE()), + (4, 2, 1101, NULL, 4698, NULL, NULL, 'started', util.VN_CURDATE()), + (5, 1, 1104, NULL, 2000, NULL, 'SIS0043', 'ok', util.VN_CURDATE()), + (6, 2, 1104, NULL, 4000, NULL, 'SIS0044', 'started', util.VN_CURDATE()); INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) VALUES @@ -1820,10 +1822,10 @@ INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`) VALUES - (1, 'Cobro web', 100.50, CURDATE(), 9, 1, 1101, CURDATE(), 442, 1), - (2, 'Cobro web', 200.50, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 1101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1), - (3, 'Cobro en efectivo', 300.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 1102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0), - (4, 'Cobro en efectivo', 400.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 1103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0); + (1, 'Cobro web', 100.50, util.VN_CURDATE(), 9, 1, 1101, util.VN_CURDATE(), 442, 1), + (2, 'Cobro web', 200.50, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), 9, 1, 1101, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), 442, 1), + (3, 'Cobro en efectivo', 300.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), 9, 1, 1102, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), 442, 0), + (4, 'Cobro en efectivo', 400.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 9, 1, 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 442, 0); INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`) VALUES @@ -1837,11 +1839,11 @@ INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`) INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `attenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`) VALUES - (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, CURDATE()), - (4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, CURDATE()), - (5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, CURDATE()); + (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)), + (2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)), + (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, util.VN_CURDATE()), + (4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, util.VN_CURDATE()), + (5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, util.VN_CURDATE()); INSERT INTO `vn`.`ticketServiceType`(`id`, `name`, `expenceFk`) VALUES @@ -1880,7 +1882,7 @@ INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`) FROM `postgresql`.`person` `p`; INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL + SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL FROM `postgresql`.`profile` `p`; INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) @@ -1888,7 +1890,7 @@ INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_i FROM `postgresql`.`business` `b`; INSERT INTO `postgresql`.`business` (`client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL + SELECT p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL FROM `postgresql`.`profile` `p` WHERE `p`.`profile_id` = 1109; @@ -1924,10 +1926,10 @@ INSERT INTO `vn`.`workCenter` (`id`, `name`, `warehouseFk`) INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`) VALUES - ('1', '27.5', YEAR(CURDATE())), - ('5', '22', YEAR(CURDATE())), - ('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))), - ('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))); + ('1', '27.5', YEAR(util.VN_CURDATE())), + ('5', '22', YEAR(util.VN_CURDATE())), + ('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))), + ('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))); INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`) VALUES @@ -1955,21 +1957,21 @@ INSERT INTO `postgresql`.`business_labour_payroll` (`business_id`, `cod_tarifa`, INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) VALUES - (1, 6, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), - (1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), - (1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), - (1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), - (1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), - (1106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 8 DAY))), - (1106, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 9 DAY))), - (1106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 7 DAY))), - (1107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), - (1107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), - (1107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), - (1107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), - (1107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 8 DAY))), - (1107, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 9 DAY))), - (1107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 7 DAY))); + (1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), + (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), + (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))), + (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -12 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 12 DAY))), + (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))), + (1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))), + (1106, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))), + (1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))), + (1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), + (1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))), + (1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -12 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 12 DAY))), + (1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))), + (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))), + (1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))), + (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))); INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) VALUES @@ -1977,12 +1979,12 @@ INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`) VALUES - (1, 19, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL +15 DAY), 1101), - (2, 18, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL +15 DAY), 1106); + (1, 19, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY), 1101), + (2, 18, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY), 1106); INSERT INTO `vn`.`sharingCart`(`id`, `workerFk`, `started`, `ended`, `workerSubstitute`, `created`) VALUES - (1, 18, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL +15 DAY), 19, DATE_ADD(CURDATE(), INTERVAL -5 DAY)); + (1, 18, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY), 19, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY)); CALL `vn`.zoneGeo_calcTree(); -- this is an auto calculate for table vn.zoneGeo, columns: path,lft,rgt,depth,sons @@ -2024,211 +2026,211 @@ INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`) INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) VALUES - (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9) - DAYOFWEEK(CURDATE())) DAY)), - (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)), - (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), - (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), - (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), - (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9) - DAYOFWEEK(CURDATE())) DAY)), - (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)), - (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), - (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), - (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), - (3, 'day', CURDATE()), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +2 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +3 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +4 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +7 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +8 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +9 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +10 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +11 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +12 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +13 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +14 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +15 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +16 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +17 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +18 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +19 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +20 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +21 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +22 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +23 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +24 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +25 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +26 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +27 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +28 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +29 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +30 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +31 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +32 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +33 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +34 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +35 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +36 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +37 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +38 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +39 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +40 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +41 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +42 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +43 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +44 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +45 DAY)), - (3, 'day', DATE_ADD(CURDATE(), INTERVAL +46 DAY)), - (4, 'day', CURDATE()), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +2 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +3 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +4 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +7 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +8 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +9 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +10 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +11 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +12 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +13 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +14 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +15 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +16 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +17 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +18 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +19 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +20 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +21 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +22 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +23 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +24 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +25 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +26 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +27 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +28 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +29 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +30 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +31 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +32 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +33 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +34 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +35 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +36 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +37 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +38 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +39 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +40 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +41 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +42 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +43 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +44 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +45 DAY)), - (4, 'day', DATE_ADD(CURDATE(), INTERVAL +46 DAY)), - (5, 'day', CURDATE()), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +2 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +3 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +4 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +7 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +8 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +9 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +10 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +11 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +12 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +13 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +14 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +15 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +16 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +17 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +18 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +19 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +20 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +21 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +22 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +23 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +24 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +25 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +26 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +27 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +28 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +29 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +30 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +31 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +32 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +33 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +34 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +35 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +36 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +37 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +38 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +39 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +40 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +41 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +42 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +43 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +44 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +45 DAY)), - (5, 'day', DATE_ADD(CURDATE(), INTERVAL +46 DAY)), - (6, 'day', CURDATE()), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +2 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +3 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +4 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +7 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +8 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +9 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +10 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +11 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +12 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +13 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +14 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +15 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +16 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +17 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +18 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +19 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +20 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +21 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +22 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +23 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +24 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +25 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +26 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +27 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +28 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +29 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +30 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +31 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +32 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +33 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +34 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +35 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +36 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +37 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +38 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +39 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +40 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +41 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +42 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +43 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +44 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +45 DAY)), - (6, 'day', DATE_ADD(CURDATE(), INTERVAL +46 DAY)), - (7, 'day', CURDATE()), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +2 DAY)), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +3 DAY)), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +4 DAY)), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)), - (7, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)); + (1, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=2, 2, 9) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (1, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=3, 3, 10) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (1, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=4, 4, 11) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (1, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=5, 5, 12) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (1, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=6, 6, 13) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (2, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=2, 2, 9) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (2, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=3, 3, 10) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (2, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=4, 4, 11) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (2, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=5, 5, 12) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (2, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=6, 6, 13) - DAYOFWEEK(util.VN_CURDATE())) DAY)), + (3, 'day', util.VN_CURDATE()), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +3 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +4 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +7 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +8 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +9 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +10 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +11 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +12 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +13 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +14 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +16 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +17 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +18 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +19 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +20 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +21 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +22 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +23 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +24 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +25 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +26 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +27 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +28 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +29 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +30 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +31 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +32 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +33 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +34 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +35 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +36 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +37 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +38 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +39 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +40 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +41 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +42 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +43 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +44 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +45 DAY)), + (3, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +46 DAY)), + (4, 'day', util.VN_CURDATE()), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +3 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +4 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +7 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +8 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +9 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +10 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +11 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +12 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +13 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +14 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +16 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +17 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +18 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +19 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +20 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +21 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +22 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +23 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +24 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +25 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +26 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +27 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +28 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +29 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +30 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +31 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +32 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +33 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +34 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +35 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +36 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +37 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +38 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +39 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +40 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +41 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +42 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +43 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +44 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +45 DAY)), + (4, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +46 DAY)), + (5, 'day', util.VN_CURDATE()), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +3 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +4 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +7 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +8 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +9 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +10 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +11 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +12 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +13 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +14 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +16 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +17 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +18 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +19 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +20 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +21 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +22 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +23 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +24 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +25 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +26 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +27 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +28 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +29 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +30 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +31 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +32 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +33 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +34 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +35 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +36 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +37 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +38 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +39 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +40 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +41 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +42 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +43 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +44 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +45 DAY)), + (5, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +46 DAY)), + (6, 'day', util.VN_CURDATE()), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +3 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +4 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +7 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +8 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +9 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +10 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +11 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +12 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +13 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +14 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +15 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +16 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +17 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +18 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +19 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +20 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +21 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +22 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +23 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +24 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +25 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +26 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +27 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +28 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +29 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +30 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +31 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +32 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +33 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +34 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +35 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +36 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +37 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +38 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +39 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +40 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +41 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +42 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +43 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +44 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +45 DAY)), + (6, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +46 DAY)), + (7, 'day', util.VN_CURDATE()), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY)), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +3 DAY)), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +4 DAY)), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY)), + (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`) VALUES @@ -2237,10 +2239,10 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`) INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`) VALUES - (1106, CONCAT(CURDATE(), ' 07:00'), TRUE, 'in'), - (1106, CONCAT(CURDATE(), ' 10:00'), TRUE, 'middle'), - (1106, CONCAT(CURDATE(), ' 10:10'), TRUE, 'middle'), - (1106, CONCAT(CURDATE(), ' 15:00'), TRUE, 'out'); + (1106, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in'), + (1106, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle'), + (1106, CONCAT(util.VN_CURDATE(), ' 10:10'), TRUE, 'middle'), + (1106, CONCAT(util.VN_CURDATE(), ' 15:00'), TRUE, 'out'); INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`) VALUES @@ -2267,14 +2269,14 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES - (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), - (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), - (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), - (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), - (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()), - (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', CURDATE()), - (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', CURDATE()), - (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', CURDATE()); + (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', util.VN_CURDATE()), + (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()), + (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()), + (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()), + (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()), + (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()), + (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), + (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()); INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`) VALUES @@ -2321,12 +2323,12 @@ INSERT INTO `vn`.`thermograph`(`id`, `model`) INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `result`, `dmsFk`) VALUES - ('TMM190901395', CURDATE(), 1, 1, 'WARM', 'Ok', NULL), - ('TL.BBA85422', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL), - ('TL.BBA85422', CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL), - ('TZ1905012010', CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5), - ('138350-0', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5), - ('138350-0', CURDATE(), 1, NULL, 'COOL', NULL, NULL); + ('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', 'Ok', NULL), + ('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL), + ('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL), + ('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5), + ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5), + ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL); REPLACE INTO `vn`.`incoterms`(`code`, `name`) VALUES @@ -2349,18 +2351,18 @@ INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`) INSERT INTO `vn`.`campaign`(`code`, `dated`) VALUES - ('valentinesDay', CONCAT(YEAR(CURDATE()), '-02-14')), - ('valentinesDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-02-14')), - ('valentinesDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-02-14')), - ('valentinesDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -3 YEAR)), '-02-14')), - ('mothersDay', CONCAT(YEAR(CURDATE()), '-05-05')), - ('mothersDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-05-05')), - ('mothersDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-05-05')), - ('mothersDay', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -3 YEAR)), '-05-05')), - ('allSaints', CONCAT(YEAR(CURDATE()), '-11-01')), - ('allSaints', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-11-01')), - ('allSaints', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-11-01')), - ('allSaints', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -3 YEAR)), '-11-01')); + ('valentinesDay', CONCAT(YEAR(util.VN_CURDATE()), '-02-14')), + ('valentinesDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-02-14')), + ('valentinesDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-02-14')), + ('valentinesDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -3 YEAR)), '-02-14')), + ('mothersDay', CONCAT(YEAR(util.VN_CURDATE()), '-05-05')), + ('mothersDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-05-05')), + ('mothersDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-05-05')), + ('mothersDay', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -3 YEAR)), '-05-05')), + ('allSaints', CONCAT(YEAR(util.VN_CURDATE()), '-11-01')), + ('allSaints', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-11-01')), + ('allSaints', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-11-01')), + ('allSaints', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -3 YEAR)), '-11-01')); INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height`) VALUES @@ -2372,61 +2374,61 @@ INSERT INTO `vn`.`rateConfig`(`rate0`, `rate1`, `rate2`, `rate3`) INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate3`) VALUES - (DATE_ADD(CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25), - (CURDATE(), 1, 12, 17, 22, 27); + (DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25), + (util.VN_CURDATE(), 1, 12, 17, 22, 27); INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) VALUES - (1, '07546501420', 67, 671, CURDATE(), 1761, 1, 1), - (2, '07546491421', 252, 2769, CURDATE(), 5231, 1, 1), - (3, '07546500823', 102, 1495, CURDATE(), 3221, 1, 1), - (4, '99610288821', 252, 2777, CURDATE(), 3641, 1, 1), - (5, '07546500834', 229, 3292, CURDATE(), 6601, 2, 1), - (6, '22101929561', 37, 458, CURDATE(), 441, 2, 1), - (7, '07546491432', 258, 3034, CURDATE(), 6441, 2, 1), - (8, '99610288644', 476, 4461, CURDATE(), 5751, 442, 1), - (9, '99610289193', 302, 2972, CURDATE(), 3871, 442, 1), - (10, '07546500856', 185, 2364, CURDATE(), 5321, 442, 1); + (1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1), + (2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1), + (3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1), + (4, '99610288821', 252, 2777, util.VN_CURDATE(), 3641, 1, 1), + (5, '07546500834', 229, 3292, util.VN_CURDATE(), 6601, 2, 1), + (6, '22101929561', 37, 458, util.VN_CURDATE(), 441, 2, 1), + (7, '07546491432', 258, 3034, util.VN_CURDATE(), 6441, 2, 1), + (8, '99610288644', 476, 4461, util.VN_CURDATE(), 5751, 442, 1), + (9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1), + (10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1); INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) VALUES - (1, '19ES0028013A481523', 1, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 11276.95, 442), - (2, '21ES00280136115760', 2, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 1376.20, 442), - (3, '19ES00280131956004', 3, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 3, 14268.50, 442), - (4, '19ES00280131955995', 4, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 8242.50, 442), - (5, '19ES00280132022070', 5, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 10012.49, 442), - (6, '19ES00280132032308', 6, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 19914.25, 442), - (7, '19ES00280132025489', 7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 1934.06, 442), - (8, '19ES00280132025490', 8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 3618.52, 442), - (9, '19ES00280132025491', 9, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 7126.23, 442), - (10, '19ES00280132025492', 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 4631.45, 442); + (1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442), + (2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442), + (3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442), + (4, '19ES00280131955995', 4, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442), + (5, '19ES00280132022070', 5, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442), + (6, '19ES00280132032308', 6, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442), + (7, '19ES00280132025489', 7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442), + (8, '19ES00280132025490', 8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442), + (9, '19ES00280132025491', 9, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442), + (10, '19ES00280132025492', 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442); REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issued`, `created`, `supplierRef`, `isBooked`, `companyFk`, `docFk`) VALUES - (1, 1001, 'R', 1, CURDATE(), CURDATE(), 1234, 0, 442, 1), - (2, 1002, 'R', 1, CURDATE(), CURDATE(), 1235, 1, 442, 1), - (3, 1003, 'R', 1, CURDATE(), CURDATE(), 1236, 0, 442, 1), - (4, 1004, 'R', 1, CURDATE(), CURDATE(), 1237, 0, 442, 1), - (5, 1005, 'R', 1, CURDATE(), CURDATE(), 1238, 1, 442, 1), - (6, 1006, 'R', 2, CURDATE(), CURDATE(), 1239, 0, 442, 1), - (7, 1007, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1240, 1, 442, 1), - (8, 1008, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1241, 1, 442, 1), - (9, 1009, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1), - (10, 1010, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1); + (1, 1001, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1234, 0, 442, 1), + (2, 1002, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1235, 1, 442, 1), + (3, 1003, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1236, 0, 442, 1), + (4, 1004, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1237, 0, 442, 1), + (5, 1005, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1238, 1, 442, 1), + (6, 1006, 'R', 2, util.VN_CURDATE(), util.VN_CURDATE(), 1239, 0, 442, 1), + (7, 1007, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1240, 1, 442, 1), + (8, 1008, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1241, 1, 442, 1), + (9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1), + (10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1); INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`) VALUES - (1, CURDATE(), 1, 336.99), - (1, CURDATE(), 1, 15.25), - (2, CURDATE(), 1, 168), - (2, CURDATE(), 1, 55.17), - (3, CURDATE(), 1, 87.95), - (3, CURDATE(), 1, 7.65), - (4, CURDATE(), 1, 373.27), - (4, CURDATE(), 1, 73.36), - (5, CURDATE(), 1, 64.23), - (6, CURDATE(), 1, 32.95), - (7, CURDATE(), 1, 58.64); + (1, util.VN_CURDATE(), 1, 336.99), + (1, util.VN_CURDATE(), 1, 15.25), + (2, util.VN_CURDATE(), 1, 168), + (2, util.VN_CURDATE(), 1, 55.17), + (3, util.VN_CURDATE(), 1, 87.95), + (3, util.VN_CURDATE(), 1, 7.65), + (4, util.VN_CURDATE(), 1, 373.27), + (4, util.VN_CURDATE(), 1, 73.36), + (5, util.VN_CURDATE(), 1, 64.23), + (6, util.VN_CURDATE(), 1, 32.95), + (7, util.VN_CURDATE(), 1, 58.64); INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`) VALUES @@ -2480,24 +2482,24 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`) VALUES - (1, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); + (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`) VALUES - (1, 1, CURDATE(), 1, 1); + (1, 1, util.VN_CURDATE(), 1, 1); INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`) VALUES - (1, 1, CURDATE(), 1), - (2, 2, CURDATE(), 1), - (3, 3, CURDATE(), 1), - (4, 4, CURDATE(), 1), - (5, 5, CURDATE(), 1), - (6, 6, CURDATE(), 1), - (7, 7, CURDATE(), 1), - (8, 8, CURDATE(), 1), - (9, 9, CURDATE(), 1), - (10, 10, CURDATE(), 1); + (1, 1, util.VN_CURDATE(), 1), + (2, 2, util.VN_CURDATE(), 1), + (3, 3, util.VN_CURDATE(), 1), + (4, 4, util.VN_CURDATE(), 1), + (5, 5, util.VN_CURDATE(), 1), + (6, 6, util.VN_CURDATE(), 1), + (7, 7, util.VN_CURDATE(), 1), + (8, 8, util.VN_CURDATE(), 1), + (9, 9, util.VN_CURDATE(), 1), + (10, 10, util.VN_CURDATE(), 1); CALL `cache`.`last_buy_refresh`(FALSE); @@ -2506,11 +2508,11 @@ UPDATE `vn`.`item` SET `genericFk` = 9 INSERT INTO `bs`.`defaulter` (`clientFk`, `amount`, `created`, `defaulterSinced`) VALUES - (1101, 500, CURDATE(), CURDATE()), - (1102, 500, CURDATE(), CURDATE()), - (1103, 500, CURDATE(), CURDATE()), - (1107, 500, CURDATE(), CURDATE()), - (1109, 500, CURDATE(), CURDATE()); + (1101, 500, util.VN_CURDATE(), util.VN_CURDATE()), + (1102, 500, util.VN_CURDATE(), util.VN_CURDATE()), + (1103, 500, util.VN_CURDATE(), util.VN_CURDATE()), + (1107, 500, util.VN_CURDATE(), util.VN_CURDATE()), + (1109, 500, util.VN_CURDATE(), util.VN_CURDATE()); UPDATE `vn`.`route` SET `invoiceInFk`=1 @@ -2521,16 +2523,16 @@ UPDATE `vn`.`route` WHERE `id`=2; INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`) VALUES - (18, YEAR(CURDATE()), MONTH(CURDATE()), 807.23), - (19, YEAR(CURDATE()), MONTH(CURDATE()), 34.40); + (18, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 807.23), + (19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40); INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`) VALUES - (1, 501.95, CURDATE(), 2, 1101), - (2, 70.7, CURDATE(), 2, 1101), - (3, 200.78, CURDATE(), 2, 1101), - (4, 33.8, CURDATE(), 1, 1101), - (30, 34.4, CURDATE(), 1, 1108); + (1, 501.95, util.VN_CURDATE(), 2, 1101), + (2, 70.7, util.VN_CURDATE(), 2, 1101), + (3, 200.78, util.VN_CURDATE(), 2, 1101), + (4, 33.8, util.VN_CURDATE(), 1, 1101), + (30, 34.4, util.VN_CURDATE(), 1, 1108); INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) VALUES @@ -2550,7 +2552,7 @@ INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`) INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`) VALUES - (1, 1, CONCAT(YEAR(CURDATE()), '-12-09'), 1, 1); + (1, 1, CONCAT(YEAR(util.VN_CURDATE()), '-12-09'), 1, 1); INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`) VALUES @@ -2578,10 +2580,10 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`) VALUES - (1106, 1, CURDATE(), CURDATE()), - (1106, 1, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (1106, 2, CURDATE(), NULL), - (1106, 2, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY)); + (1106, 1, util.VN_CURDATE(), util.VN_CURDATE()), + (1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)), + (1106, 2, util.VN_CURDATE(), NULL), + (1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)); INSERT INTO `vn`.`mdbBranch` (`name`) VALUES diff --git a/db/dump/mockDate.sql b/db/dump/mockDate.sql new file mode 100644 index 000000000..c63c2d76c --- /dev/null +++ b/db/dump/mockDate.sql @@ -0,0 +1,43 @@ +CREATE SCHEMA IF NOT EXISTS `util`; +USE `util`; + +DELIMITER ;; +DROP FUNCTION IF EXISTS `util`.`mockedDate`; +CREATE FUNCTION `util`.`mockedDate`() +RETURNS DATETIME +DETERMINISTIC +BEGIN + RETURN NOW(); + -- '2022-01-19 08:00:00' +END ;; +DELIMITER ; + +DELIMITER ;; +DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`; +CREATE FUNCTION `util`.`VN_CURDATE`() +RETURNS DATE +DETERMINISTIC +BEGIN + RETURN DATE(mockedDate()); +END ;; +DELIMITER ; + +DELIMITER ;; +DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`; +CREATE FUNCTION `util`.`VN_CURTIME`() +RETURNS TIME +DETERMINISTIC +BEGIN + RETURN TIME(mockedDate()); +END ;; +DELIMITER ; + +DELIMITER ;; +DROP FUNCTION IF EXISTS `util`.`VN_NOW`; +CREATE FUNCTION `util`.`VN_NOW`() +RETURNS DATETIME +DETERMINISTIC +BEGIN + RETURN mockedDate(); +END ;; +DELIMITER ; \ No newline at end of file diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 21ef7758c..cc0ee4785 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1,8 +1,8 @@ --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: account +-- Host: 127.0.0.1 Database: account -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.4.13-MariaDB-1:10.4.13+maria~focal /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -161,7 +161,7 @@ CREATE TABLE `ldapConfig` ( `userDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN for users', `groupDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN for groups', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -175,7 +175,7 @@ CREATE TABLE `mailAlias` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `alias` varchar(50) CHARACTER SET utf8 NOT NULL, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `isPublic` tinyint(4) NOT NULL DEFAULT '1', + `isPublic` tinyint(4) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `alias` (`alias`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; @@ -214,7 +214,7 @@ CREATE TABLE `mailClientAccess` ( `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mailFrom` (`client`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -260,7 +260,7 @@ CREATE TABLE `mailSenderAccess` ( `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mailFrom` (`sender`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -307,9 +307,9 @@ CREATE TABLE `role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(14) COLLATE utf8_unicode_ci NOT NULL COMMENT 'MySQL doesn''t support more than 14 chars for proxied user names', `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT '1', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT 1, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; @@ -423,9 +423,9 @@ CREATE TABLE `sambaConfig` ( `adController` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The hosname of domain controller', `adUser` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Active directory user', `adPassword` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Active directory password', - `verifyCert` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT 'Whether to verify server certificate', + `verifyCert` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Whether to verify server certificate', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -441,19 +441,19 @@ CREATE TABLE `user` ( `name` varchar(30) CHARACTER SET utf8 NOT NULL, `nickname` varchar(127) COLLATE utf8_unicode_ci NOT NULL, `bcryptPassword` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL, - `role` int(10) unsigned NOT NULL DEFAULT '2', - `active` tinyint(1) NOT NULL DEFAULT '1', + `role` int(10) unsigned NOT NULL DEFAULT 2, + `active` tinyint(1) NOT NULL DEFAULT 1, `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `emailVerified` tinyint(1) DEFAULT NULL, `verificationToken` varchar(512) CHARACTER SET utf8 DEFAULT NULL, `lang` char(2) CHARACTER SET utf8 DEFAULT NULL, `lastPassChange` datetime DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `password` char(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', - `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT 'Deprecated', - `sync` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Deprecated', + `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Deprecated', + `sync` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Deprecated', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `role` (`role`), @@ -528,7 +528,7 @@ BEGIN IF !(NEW.`password` <=> OLD.`password`) THEN SET NEW.bcryptPassword = NULL; - SET NEW.lastPassChange = NOW(); + SET NEW.lastPassChange = util.VN_NOW(); END IF; END */;; DELIMITER ; @@ -611,7 +611,7 @@ CREATE TABLE `userConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `loginKey` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2524,12 +2524,12 @@ DROP TABLE IF EXISTS `bancos_evolution`; CREATE TABLE `bancos_evolution` ( `Fecha` date NOT NULL, `Id_Banco` int(11) NOT NULL, - `saldo` decimal(10,2) NOT NULL DEFAULT '0.00', - `quilla` decimal(10,2) NOT NULL DEFAULT '0.00', - `deuda` decimal(10,2) NOT NULL DEFAULT '0.00', - `liquidez` decimal(10,2) NOT NULL DEFAULT '0.00', - `disponibilidad ajena` decimal(10,2) NOT NULL DEFAULT '0.00', - `saldo_aux` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'Saldo auxiliar para el calculo de lo dispuesto en las polizas', + `saldo` decimal(10,2) NOT NULL DEFAULT 0.00, + `quilla` decimal(10,2) NOT NULL DEFAULT 0.00, + `deuda` decimal(10,2) NOT NULL DEFAULT 0.00, + `liquidez` decimal(10,2) NOT NULL DEFAULT 0.00, + `disponibilidad ajena` decimal(10,2) NOT NULL DEFAULT 0.00, + `saldo_aux` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Saldo auxiliar para el calculo de lo dispuesto en las polizas', PRIMARY KEY (`Fecha`,`Id_Banco`), KEY `fk_banco_evolution_idx` (`Id_Banco`), CONSTRAINT `fk_banco_evolution` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -2575,7 +2575,7 @@ DROP TABLE IF EXISTS `clientDied`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientDied` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `clientName` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `lastInvoiced` date DEFAULT NULL, `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -2596,8 +2596,8 @@ CREATE TABLE `clientNewBorn` ( `clientFk` int(11) NOT NULL, `firstShipped` date NOT NULL COMMENT 'Primer pedido o de la relacion comercial, o después de un año de inactividad', `lastShipped` date NOT NULL COMMENT 'último pedido del cliente', - `isModified` tinyint(4) DEFAULT '0', - `isRookie` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'define un cliente que ha de ser cuidado por ser nuevo o recuperado', + `isModified` tinyint(4) DEFAULT 0, + `isRookie` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'define un cliente que ha de ser cuidado por ser nuevo o recuperado', PRIMARY KEY (`clientFk`), CONSTRAINT `clientNewBorn_fk1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; @@ -2698,7 +2698,7 @@ DROP TABLE IF EXISTS `defaulter`; CREATE TABLE `defaulter` ( `clientFk` int(11) NOT NULL, `created` date NOT NULL, - `amount` double NOT NULL DEFAULT '0', + `amount` double NOT NULL DEFAULT 0, `defaulterSinced` date DEFAULT NULL, `hasChanged` tinyint(1) DEFAULT NULL, `frozened` date DEFAULT NULL, @@ -2717,7 +2717,7 @@ DROP TABLE IF EXISTS `experienceIberflora2016`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `experienceIberflora2016` ( `Id_Cliente` int(11) NOT NULL, - `isVisitor` tinyint(4) NOT NULL DEFAULT '0', + `isVisitor` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`Id_Cliente`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes que participan en el estudio sobre la mejora del consumo tras la visita a las instalaciones de Silla'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -2783,7 +2783,7 @@ DROP TABLE IF EXISTS `inspeccionSS_2021`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `inspeccionSS_2021` ( `business_id` int(11) DEFAULT NULL, - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -2850,16 +2850,16 @@ CREATE TABLE `m3` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fecha` date NOT NULL, `provinceFk` smallint(5) unsigned DEFAULT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '0', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 0, `m3` decimal(10,2) DEFAULT NULL, `year` int(11) DEFAULT NULL, `month` int(11) DEFAULT NULL, `week` int(11) DEFAULT NULL, `day` int(11) DEFAULT NULL, `dayName` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - `euros` decimal(10,2) DEFAULT '0.00', + `euros` decimal(10,2) DEFAULT 0.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2977,7 +2977,7 @@ CREATE TABLE `nightTask` ( `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `errorCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3043,7 +3043,7 @@ CREATE TABLE `nightTaskConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `logMail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3073,15 +3073,15 @@ DROP TABLE IF EXISTS `payMethodClient`; CREATE TABLE `payMethodClient` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, - `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT '0', - `clientFk` int(11) NOT NULL DEFAULT '0', + `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT 0, + `clientFk` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `FkPayMethod_idx` (`payMethodFk`), KEY `FkClientPayMethod_idx` (`clientFk`), KEY `FkDateClientPayMethod` (`dated`,`clientFk`), CONSTRAINT `FkClientPayMethod` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FkPayMethodClient` FOREIGN KEY (`payMethodFk`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3099,7 +3099,7 @@ CREATE TABLE `payMethodClientEvolution` ( `amount` decimal(10,2) NOT NULL, `equalizationTax` decimal(10,2) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3111,9 +3111,9 @@ DROP TABLE IF EXISTS `produccion`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `produccion` ( `dated` date NOT NULL, - `m3` int(11) NOT NULL DEFAULT '0', - `cost` int(11) NOT NULL DEFAULT '0', - `eurosM3` decimal(10,2) NOT NULL DEFAULT '0.00', + `m3` int(11) NOT NULL DEFAULT 0, + `cost` int(11) NOT NULL DEFAULT 0, + `eurosM3` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`dated`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3168,13 +3168,13 @@ DROP TABLE IF EXISTS `sale`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sale` ( `saleFk` int(11) NOT NULL, - `amount` decimal(10,3) NOT NULL DEFAULT '0.000', - `surcharge` decimal(10,3) NOT NULL DEFAULT '0.000', + `amount` decimal(10,3) NOT NULL DEFAULT 0.000, + `surcharge` decimal(10,3) NOT NULL DEFAULT 0.000, `dated` date NOT NULL, `typeFk` smallint(5) unsigned NOT NULL, - `clientFk` int(11) NOT NULL DEFAULT '1', - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `margin` decimal(10,3) NOT NULL DEFAULT '0.000', + `clientFk` int(11) NOT NULL DEFAULT 1, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `margin` decimal(10,3) NOT NULL DEFAULT 0.000, PRIMARY KEY (`saleFk`), KEY `tip_to_tip_idx` (`typeFk`), KEY `clientes_bs_ventas_idx` (`clientFk`), @@ -3196,9 +3196,9 @@ DROP TABLE IF EXISTS `salePersonEvolution__`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `salePersonEvolution__` ( `dated` date NOT NULL DEFAULT '0000-00-00', - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - `equalizationTax` decimal(10,2) NOT NULL DEFAULT '0.00', - `salesPersonFk` int(11) NOT NULL DEFAULT '0', + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, + `equalizationTax` decimal(10,2) NOT NULL DEFAULT 0.00, + `salesPersonFk` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`dated`,`salesPersonFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3249,9 +3249,9 @@ CREATE TABLE `salesByclientSalesPerson` ( `dated` date NOT NULL DEFAULT '0000-00-00', `salesPersonFk` int(10) unsigned DEFAULT NULL, `clientFk` int(11) NOT NULL, - `amount` decimal(10,3) NOT NULL DEFAULT '0.000', - `equalizationTax` decimal(10,3) NOT NULL DEFAULT '0.000', - `amountNewBorn` decimal(10,3) NOT NULL DEFAULT '0.000', + `amount` decimal(10,3) NOT NULL DEFAULT 0.000, + `equalizationTax` decimal(10,3) NOT NULL DEFAULT 0.000, + `amountNewBorn` decimal(10,3) NOT NULL DEFAULT 0.000, PRIMARY KEY (`dated`,`clientFk`), KEY `clientSalePersonEvolution_clientFk` (`clientFk`), KEY `salesByclientSalesPerson_salesPerson` (`salesPersonFk`), @@ -3283,7 +3283,7 @@ CREATE TABLE `salesMonthlySnapshot` ( `newClientScore` decimal(10,3) DEFAULT NULL, `teamBossPlus` decimal(10,3) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3299,7 +3299,7 @@ CREATE TABLE `salesMonthlySnapshot__` ( `year` int(4) NOT NULL, `month` int(2) NOT NULL, `departmentFk` int(11) NOT NULL, - `ownSalesAmount` decimal(10,2) DEFAULT '0.00', + `ownSalesAmount` decimal(10,2) DEFAULT 0.00, `ownSalesPosition` int(11) DEFAULT NULL, `ownSalesBonus` int(11) DEFAULT NULL, `ownSalesScore` int(11) DEFAULT NULL, @@ -3313,7 +3313,7 @@ CREATE TABLE `salesMonthlySnapshot__` ( `teamSalesScore` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`year`,`month`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cada mes se guardan aqui los datos de forma estática, para consulta en grafana.'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cada mes se guardan aqui los datos de forma estática, para consulta en grafana.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3335,7 +3335,7 @@ CREATE TABLE `salesPerson` ( `leasedReplacement` decimal(10,2) DEFAULT NULL, `itemTypeBorrowed` decimal(10,2) DEFAULT NULL, `portfolioWeight` decimal(10,2) DEFAULT NULL COMMENT 'Pero de la cartera del comercial a fecha vendedores.updated', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`workerFk`,`year`,`month`), CONSTRAINT `salesPerson_FK` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -3375,13 +3375,13 @@ CREATE TABLE `salesPersonEvolution` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL DEFAULT '0000-00-00', `salesPersonFk` int(10) unsigned DEFAULT NULL, - `amount` decimal(10,3) NOT NULL DEFAULT '0.000', - `equalizationTax` decimal(10,3) NOT NULL DEFAULT '0.000', - `amountNewBorn` decimal(10,3) NOT NULL DEFAULT '0.000', + `amount` decimal(10,3) NOT NULL DEFAULT 0.000, + `equalizationTax` decimal(10,3) NOT NULL DEFAULT 0.000, + `amountNewBorn` decimal(10,3) NOT NULL DEFAULT 0.000, PRIMARY KEY (`id`), KEY `salesPersonEvolution_salesPerson` (`salesPersonFk`), CONSTRAINT `salesPersonEvolution_salesPerson` FOREIGN KEY (`salesPersonFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Evolución Comerciales'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Evolución Comerciales'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3408,24 +3408,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_ventas__` --- - -DROP TABLE IF EXISTS `v_ventas__`; -/*!50001 DROP VIEW IF EXISTS `v_ventas__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `v_ventas__` ( - `importe` tinyint NOT NULL, - `recargo` tinyint NOT NULL, - `year` tinyint NOT NULL, - `month` tinyint NOT NULL, - `week` tinyint NOT NULL, - `day` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `vendedores` -- @@ -3519,7 +3501,7 @@ CREATE TABLE `waste` ( `year` int(4) NOT NULL, `week` int(2) NOT NULL, `family` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `itemFk` int(11) NOT NULL DEFAULT '0', + `itemFk` int(11) NOT NULL DEFAULT 0, `itemTypeFk` smallint(5) unsigned DEFAULT NULL, `saleTotal` decimal(16,0) DEFAULT NULL, `saleWaste` decimal(16,0) DEFAULT NULL, @@ -3548,7 +3530,7 @@ CREATE TABLE `workerLabourDataByMonth` ( `permanent` int(5) NOT NULL COMMENT 'Número de empleados fijos', PRIMARY KEY (`id`), KEY `workerLabourDataByMonth_graph_idx` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3587,7 +3569,7 @@ CREATE TABLE `workerProductivity` ( CONSTRAINT `workerProductivity_FK` FOREIGN KEY (`actionFk`) REFERENCES `vncontrol`.`accion` (`accion_id`) ON UPDATE CASCADE, CONSTRAINT `workerProductivity_warehouseFk` FOREIGN KEY (`warehouseFk`) REFERENCES `vn`.`warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerProductivity_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3602,7 +3584,7 @@ CREATE TABLE `workerProductivityConfig` ( `minSeconsPackager` int(11) DEFAULT NULL, `minSeconsItemPicker` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3615,7 +3597,7 @@ DROP TABLE IF EXISTS `workerSpeed__`; CREATE TABLE `workerSpeed__` ( `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, `LitrosMinuto` decimal(10,1) DEFAULT NULL, `LitrosMinutoLastHour` decimal(10,1) DEFAULT NULL, `lastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -3634,7 +3616,7 @@ CREATE TABLE `zone_ETD__` ( `zoneFk` int(11) DEFAULT NULL, `totalVolume` decimal(5,1) DEFAULT NULL, `remainingVolume` decimal(5,1) DEFAULT NULL, - `speed` decimal(10,2) NOT NULL DEFAULT '0.00', + `speed` decimal(10,2) NOT NULL DEFAULT 0.00, `hourTheoretical` time DEFAULT NULL, `hourPractical` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -3650,7 +3632,7 @@ DROP TABLE IF EXISTS `zone_ETD_byTime`; CREATE TABLE `zone_ETD_byTime` ( `theorical` time NOT NULL, `practical` time NOT NULL DEFAULT '00:00:00', - `m3` decimal(10,1) NOT NULL DEFAULT '0.0', + `m3` decimal(10,1) NOT NULL DEFAULT 0.0, PRIMARY KEY (`theorical`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3802,8 +3784,8 @@ BEGIN * @param vStartingDate Fecha desde la cual se recalculan la tabla bs.bancos_evolution */ DECLARE vCurrentDate DATE; - DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, CURDATE()); - IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, CURDATE()) THEN + DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE()); + IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, util.VN_CURDATE()) THEN CALL util.throw('invalid date'); END IF; DELETE FROM bs.bancos_evolution WHERE Fecha >= vStartingDate; @@ -3858,8 +3840,8 @@ BEGIN SELECT t.dated, p.id_banco, - importe FROM vn.time t join vn2008.pago p ON p.fecha <= t.dated - WHERE t.dated BETWEEN CURDATE() AND vMaxDate - AND p.fecha BETWEEN CURDATE() AND vMaxDate + WHERE t.dated BETWEEN util.VN_CURDATE() AND vMaxDate + AND p.fecha BETWEEN util.VN_CURDATE() AND vMaxDate AND NOT conciliado ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); @@ -3868,8 +3850,8 @@ BEGIN SELECT t.dated, r.Id_Banco, SUM(Entregado) FROM vn.time t JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated - WHERE r.Fechacobro > CURDATE() AND r.Fechacobro <= vMaxDate - AND t.dated BETWEEN CURDATE() AND vMaxDate + WHERE r.Fechacobro > util.VN_CURDATE() AND r.Fechacobro <= vMaxDate + AND t.dated BETWEEN util.VN_CURDATE() AND vMaxDate GROUP BY t.dated, r.Id_Banco ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); @@ -3926,7 +3908,7 @@ BEGIN */ DECLARE vCurrentDate DATE; DECLARE vStartingDate DATE DEFAULT '2016-01-01'; - DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, CURDATE()); + DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE()); DELETE FROM bs.bancos_evolution WHERE Fecha > vStartingDate; @@ -3979,7 +3961,7 @@ BEGIN SELECT t.dated, p.id_banco, - importe FROM vn.time t join vn2008.pago p ON p.fecha <= t.dated - WHERE p.fecha >= CURDATE() + WHERE p.fecha >= util.VN_CURDATE() AND NOT conciliado ON DUPLICATE KEY UPDATE saldo = saldo - VALUES(saldo); @@ -3988,7 +3970,7 @@ BEGIN SELECT t.dated, r.Id_Banco, SUM(Entregado) FROM vn.time t JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated - WHERE r.Fechacobro > CURDATE() + WHERE r.Fechacobro > util.VN_CURDATE() GROUP BY t.dated, r.Id_Banco ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); @@ -4096,7 +4078,7 @@ BEGIN * Inserta en @bs.carteras. */ DELETE FROM bs.carteras - WHERE Año >= YEAR(CURDATE()) - 1; + WHERE Año >= YEAR(util.VN_CURDATE()) - 1; INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso @@ -4104,7 +4086,7 @@ BEGIN JOIN bs.ventas v on t.dated = v.fecha JOIN vn.client c on c.id = v.Id_Cliente JOIN vn.worker w ON w.id = c.salesPersonFk - WHERE t.year >= YEAR(CURDATE()) - 1 + WHERE t.year >= YEAR(util.VN_CURDATE()) - 1 GROUP BY w.code, t.year , t.month; END ;; DELIMITER ; @@ -4128,9 +4110,9 @@ BEGIN DECLARE vOneYearAgo DATETIME; DECLARE vTwoYearAgo DATETIME; - SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); - SET vTwoYearAgo = TIMESTAMPADD(YEAR, -2,CURDATE()); - SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,CURDATE()); + SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,util.VN_CURDATE()); + SET vTwoYearAgo = TIMESTAMPADD(YEAR, -2,util.VN_CURDATE()); + SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,util.VN_CURDATE()); DELETE FROM bs.clientNewBorn WHERE lastShipped < vOneYearAgo; @@ -4167,9 +4149,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDied_recalc`() BEGIN - SET @primerAviso := TIMESTAMPADD(MONTH,-1,CURDATE()); - SET @segundoAviso := TIMESTAMPADD(MONTH,-2,CURDATE()); - SET @tercerAviso := TIMESTAMPADD(MONTH,-3,CURDATE()); + SET @primerAviso := TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); + SET @segundoAviso := TIMESTAMPADD(MONTH,-2,util.VN_CURDATE()); + SET @tercerAviso := TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()); TRUNCATE TABLE bs.clientDied; @@ -4194,7 +4176,7 @@ BEGIN DELETE cd.* FROM bs.clientDied cd JOIN vn.ticket t ON t.clientFk = cd.id - WHERE t.refFk IS NULL AND t.shipped >=TIMESTAMPADD(MONTH,-1,CURDATE()); + WHERE t.refFk IS NULL AND t.shipped >=TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4233,7 +4215,7 @@ BLOCK1: BEGIN FROM vn.client c JOIN vn.ticket t on t.clientFk = c.id LEFT JOIN clientNewBorn cb on cb.clientFk = c.id - WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, CURDATE()) AND CURDATE() AND cb.isModified is null + WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null GROUP BY c.id; OPEN cur; @@ -4252,7 +4234,7 @@ BLOCK1: BEGIN DECLARE cur2 CURSOR FOR SELECT shipped FROM vn.ticket - WHERE clientFk = vClientFk AND shipped <= CURDATE() + WHERE clientFk = vClientFk AND shipped <= util.VN_CURDATE() ORDER BY shipped DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone2 = TRUE; @@ -4291,8 +4273,8 @@ BLOCK1: BEGIN LEFT JOIN (SELECT DISTINCT t.clientFk FROM vn.ticket t JOIN vn.productionConfig pc - WHERE t.shipped BETWEEN curdate() + INTERVAL -(`notBuyingMonths`) MONTH - AND curdate() + INTERVAL -(`pc`.`rookieDays`) DAY) notRookie ON notRookie.clientFk = cnb.clientFk + WHERE t.shipped BETWEEN util.VN_CURDATE() + INTERVAL -(`notBuyingMonths`) MONTH + AND util.VN_CURDATE() + INTERVAL -(`pc`.`rookieDays`) DAY) notRookie ON notRookie.clientFk = cnb.clientFk SET cnd.isRookie = ISNULL(notRookie.clientFk); END BLOCK1 ;; @@ -4681,7 +4663,7 @@ SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; END IF; - WHILE datFEC < CURDATE() DO + WHILE datFEC < util.VN_CURDATE() DO IF i mod 150 = 0 THEN SELECT datFEC; @@ -4749,7 +4731,7 @@ BEGIN INTO datFEC FROM bs.fondo_maniobra; - WHILE datFEC < CURDATE() DO + WHILE datFEC < util.VN_CURDATE() DO IF DAY(datFEC) MOD 28 = 0 THEN -- esto solo sirve para no aburrirse mientras esperamos... SELECT datFEC; @@ -5041,7 +5023,7 @@ BEGIN INTO vDated FROM bs.indicators; - WHILE vDated < CURDATE() DO + WHILE vDated < util.VN_CURDATE() DO CALL indicatorsUpdate(vDated); @@ -5130,7 +5112,7 @@ BEGIN SELECT TIMESTAMPADD(WEEK, -1,MAX(fecha)) INTO datSTART FROM bs.m3; - SET datEND = TIMESTAMPADD(DAY,-1,CURDATE()); + SET datEND = TIMESTAMPADD(DAY,-1,util.VN_CURDATE()); DELETE FROM bs.m3 WHERE fecha >= datSTART; @@ -5204,7 +5186,7 @@ BEGIN INTO vFromDated FROM vn.clientManaCache; - WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO + WHILE timestampadd(DAY,30,vFromDated) < util.VN_CURDATE() DO SELECT timestampadd(DAY,30,vFromDated), @@ -5286,7 +5268,7 @@ BEGIN JOIN (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual FROM bs.vendedores - WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE()) + WHERE año * 100 + mes >= (YEAR(util.VN_CURDATE()) -1) * 100 + MONTH(util.VN_CURDATE()) GROUP BY Id_Trabajador ) lastYearSales USING(Id_Trabajador) SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ; @@ -5311,14 +5293,14 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `mermasCacheUpdate__`() BEGIN DECLARE vTimeRange INT DEFAULT 30; - DECLARE vCurYearStarted DATE DEFAULT TIMESTAMPADD(DAY, - vTimeRange, CURDATE()); - DECLARE vCurYearFinished DATE DEFAULT CURDATE(); + DECLARE vCurYearStarted DATE DEFAULT TIMESTAMPADD(DAY, - vTimeRange, util.VN_CURDATE()); + DECLARE vCurYearFinished DATE DEFAULT util.VN_CURDATE(); DECLARE vLastYearStarted DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearStarted); DECLARE vLastYearFinished DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearFinished); REPLACE bs.mermasCache SELECT Comprador, - IF(Fecha < vCurYearStarted, year(CURDATE()) - 1,year(CURDATE())) año, + IF(Fecha < vCurYearStarted, year(util.VN_CURDATE()) - 1,year(util.VN_CURDATE())) año, CAST(sum(Importe) as DECIMAL(10,0)) as Valor_Compra, CAST(sum(IF(Cliente LIKE 'FALTAS',Importe,0)) as DECIMAL(10,0)) as Faltas, CAST(sum(IF(Cliente LIKE 'BASURA',Importe,0)) as DECIMAL(10,0)) as Basura @@ -5361,7 +5343,7 @@ BEGIN DECLARE rs CURSOR FOR SELECT id, `schema`, `procedure` FROM nightTask - WHERE finished <= CURDATE() + WHERE finished <= util.VN_CURDATE() OR finished IS NULL ORDER BY `order`; @@ -5380,7 +5362,7 @@ BEGIN END IF; UPDATE nightTask - SET `started` = NOW(), + SET `started` = util.VN_NOW(), `finished` = NULL, `error` = NULL, `errorCode` = NULL @@ -5403,8 +5385,8 @@ BEGIN WHERE id = vId; ELSE UPDATE nightTask - SET finished = NOW(), - lastFinished = NOW() + SET finished = util.VN_NOW(), + lastFinished = util.VN_NOW() WHERE id = vId; END IF; END LOOP; @@ -5483,7 +5465,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `payMethodClientAdd`() BEGIN INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) - SELECT CURDATE(), c.payMethodFk, c.id + SELECT util.VN_CURDATE(), c.payMethodFk, c.id FROM vn.client c JOIN vn.payMethod p ON c.payMethodFk = p.id; @@ -5630,9 +5612,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `produccion_launcher_auto`() BEGIN - DECLARE vDate DATE DEFAULT TIMESTAMPADD(WEEK, -1, CURDATE()); + DECLARE vDate DATE DEFAULT TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()); - WHILE vDate <= CURDATE() DO + WHILE vDate <= util.VN_CURDATE() DO CALL bs.produccionAdd(vDate); @@ -5640,9 +5622,9 @@ BEGIN END WHILE; - SET vDate = TIMESTAMPADD(DAY,-372, CURDATE()); + SET vDate = TIMESTAMPADD(DAY,-372, util.VN_CURDATE()); - WHILE vDate <= TIMESTAMPADD(YEAR,-1, CURDATE()) DO + WHILE vDate <= TIMESTAMPADD(YEAR,-1, util.VN_CURDATE()) DO CALL bs.produccionAdd(vDate); @@ -5718,8 +5700,8 @@ BEGIN SET vItemFk = IFNULL(vItemFk,0); SET vTypeFk = IFNULL(vTypeFk, 0); SET vCategoryFk = IFNULL(vCategoryFk,0); - SET vFromDate = IFNULL(vFromDate,CURDATE()); - SET vToDate = IFNULL(vToDate,CURDATE()); + SET vFromDate = IFNULL(vFromDate,util.VN_CURDATE()); + SET vToDate = IFNULL(vToDate,util.VN_CURDATE()); SET vProducerFk = IFNULL(vProducerFk,0); SET vFromDateLastYear = TIMESTAMPADD(YEAR,-1,vFromDate); @@ -5761,7 +5743,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salePersonEvolutionAdd`(IN vDateStart DATETIME) BEGIN DELETE FROM bs.salePersonEvolution - WHERE dated <= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); + WHERE dated <= DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR); INSERT INTO bs.salePersonEvolution (dated, amount, equalizationTax, salesPersonFk) @@ -5795,7 +5777,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByclientSalesPerson_add`(vDate BEGIN IF vDatedFrom IS NULL THEN - SELECT CURDATE() - INTERVAL DAY(CURDATE())-1 DAY - INTERVAL 1 MONTH INTO vDatedFrom; + SELECT util.VN_CURDATE() - INTERVAL DAY(util.VN_CURDATE())-1 DAY - INTERVAL 1 MONTH INTO vDatedFrom; END IF; INSERT INTO salesByclientSalesPerson( dated, salesPersonFk, clientFk, amount, equalizationTax) @@ -5839,7 +5821,7 @@ BEGIN DECLARE vRowCount INT DEFAULT 1; DECLARE vMaxRow INT; - IF(DAY(CURDATE()) = 5) THEN + IF(DAY(util.VN_CURDATE()) = 5) THEN -- COMERCIAL Y EQUIPO DROP TEMPORARY TABLE IF EXISTS tmp.salesPersons; CREATE TEMPORARY TABLE tmp.salesPersons @@ -5868,7 +5850,7 @@ BEGIN JOIN vn.client c ON c.id = s.salesPersonFk JOIN account.user u ON u.id = s.salesPersonFk JOIN vn.commissionConfig cc - WHERE dated BETWEEN util.firstDayOfMonth(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) + WHERE dated BETWEEN util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) GROUP BY year, month, workerFk; -- OBJETIVO EVALUABLE (GRUPO) Y OBJETIVO INCENTIVO (INDIVIDUAL) @@ -5901,16 +5883,16 @@ BEGIN IFNULL(v.portfolioWeight,0) AS walletWeigth FROM bs.vendedores v JOIN account.`user` u ON u.id = v.Id_Trabajador - JOIN vn.saleGoal sg1 ON sg1.`rank` = 1 AND sg1.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg1.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg2 ON sg2.`rank` = 2 AND sg2.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg3 ON sg3.`rank` = 3 AND sg3.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg3.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg4 ON sg4.`rank` = 4 AND sg4.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg4.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg5 ON sg5.`rank` = 5 AND sg5.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg5.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - WHERE v.año = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))-1 AND v.mes = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg1 ON sg1.`rank` = 1 AND sg1.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg1.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg2 ON sg2.`rank` = 2 AND sg2.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg3 ON sg3.`rank` = 3 AND sg3.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg3.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg4 ON sg4.`rank` = 4 AND sg4.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg4.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg5 ON sg5.`rank` = 5 AND sg5.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg5.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + WHERE v.año = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH))-1 AND v.mes = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) GROUP BY u.id ) sub - JOIN vn.saleGoal sg ON sg.`rank` = sub.rank AND sg.goalType = 'grupo' AND sg.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg2 ON sg2.`rank` = sub.rank AND sg2.goalType = 'individual' AND sg2.`year` = YEAR(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg ON sg.`rank` = sub.rank AND sg.goalType = 'grupo' AND sg.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + JOIN vn.saleGoal sg2 ON sg2.`rank` = sub.rank AND sg2.goalType = 'individual' AND sg2.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) JOIN vn.rankBonus rb ON rb.`rank` = sub.`rank`; -- PUNTUACIÓN EQUIPO, PLUS OBJETIVO EQUIPO Y PLUS VARIABLE JEFE DE EQUIPO @@ -5963,8 +5945,8 @@ BEGIN JOIN account.user u ON u.id = c.salesPersonFk JOIN vn.workerDepartment wd ON wd.workerFk = u.id JOIN vn.department d On d.id = wd.departmentFk - WHERE v.fecha >= util.firstDayOfMonth(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) - AND cn.firstShipped >= util.firstDayOfMonth(DATE_ADD(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), INTERVAL -1 year)) + WHERE v.fecha >= util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) + AND cn.firstShipped >= util.firstDayOfMonth(DATE_ADD(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH), INTERVAL -1 year)) AND d.name LIKE 'EQUIPO%' GROUP BY u.id ORDER BY total DESC; @@ -6058,7 +6040,7 @@ BEGIN SET vDated = TIMESTAMPADD(DAY, 1, vDated); END IF; - WHILE vDated < CURDATE() DO + WHILE vDated < util.VN_CURDATE() DO SET vCont = vCont + 1; @@ -6099,12 +6081,12 @@ BEGIN * Actualiza el campo portfolioWeight que indica el peso de la cartera del comercial * */ - DECLARE vStarted DATE DEFAULT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -17 MONTH), '%Y-%m-01'); + DECLARE vStarted DATE DEFAULT DATE_FORMAT(DATE_ADD(util.VN_CURDATE(), INTERVAL -17 MONTH), '%Y-%m-01'); UPDATE vendedores v JOIN vn.`time` t ON t.`year` = v.año AND t.`month` = v.mes SET v.portfolioWeight = NULL - WHERE t.dated BETWEEN vStarted AND CURDATE(); + WHERE t.dated BETWEEN vStarted AND util.VN_CURDATE(); UPDATE vendedores v JOIN ( @@ -6116,7 +6098,7 @@ BEGIN STRAIGHT_JOIN bs.ventas v ON t.dated = v.fecha JOIN vn.`client` c ON c.id = v.Id_Cliente WHERE c.lastSalesPersonFk IS NOT NULL - AND v.fecha BETWEEN vStarted AND CURDATE() + AND v.fecha BETWEEN vStarted AND util.VN_CURDATE() GROUP BY c.lastSalesPersonFk, t.`year`, t.`month` ) sub ON sub.lastSalesPersonFk = v.Id_Trabajador AND sub.`year` = v.año AND sub.`month`= v.mes SET v.portfolioWeight = sub.importe; @@ -6217,9 +6199,9 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_add_launcher`() BEGIN DECLARE vDatedFrom DATE; - CALL bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); + CALL bs.vendedores_add(YEAR(util.VN_CURDATE()),QUARTER(util.VN_CURDATE())); CALL bs.vendedores_evolution_add; - SELECT util.firstDayOfMonth(CURDATE())- INTERVAL 1 MONTH INTO vDatedFrom; + SELECT util.firstDayOfMonth(util.VN_CURDATE())- INTERVAL 1 MONTH INTO vDatedFrom; CALL bs.salesByclientSalesPerson_add(vDatedFrom); END ;; @@ -6241,9 +6223,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_add_launcher__`() BEGIN - CALL bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); + CALL bs.vendedores_add(YEAR(util.VN_CURDATE()),QUARTER(util.VN_CURDATE())); CALL bs.vendedores_evolution_add; - CALL bs.salesPersonClient_add(YEAR(CURDATE()), QUARTER(CURDATE())); + CALL bs.salesPersonClient_add(YEAR(util.VN_CURDATE()), QUARTER(util.VN_CURDATE())); END ;; DELIMITER ; @@ -6272,8 +6254,8 @@ Inserta en la tabla compradores_evolution las ventas acumuladas en el ultimo mes DECLARE vDateFrom DATE; DECLARE vDateTo DATE; - SET vCurYear = year(CURDATE()); - SET vCurMonth = month(CURDATE()); + SET vCurYear = year(util.VN_CURDATE()); + SET vCurMonth = month(util.VN_CURDATE()); SELECT IFNULL(max(year),vCurYear-1), IFNULL(max(month),1) INTO vYear, vMonth @@ -6340,8 +6322,8 @@ BEGIN DECLARE vEndingDate DATETIME; DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - IF datSTART < TIMESTAMPADD(YEAR,-5,CURDATE()) - OR datEND < TIMESTAMPADD(YEAR,-5,CURDATE()) THEN + IF datSTART < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) + OR datEND < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN CALL util.throw('fechaDemasiadoAntigua'); END IF; @@ -6425,7 +6407,7 @@ BEGIN * **/ - CALL bs.ventas_add(timestampadd(week,-1,curdate()),curdate()); + CALL bs.ventas_add(timestampadd(week,-1,util.VN_CURDATE()),util.VN_CURDATE()); END ;; DELIMITER ; @@ -6567,7 +6549,7 @@ BEGIN * **/ - CALL bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,CURDATE()))); + CALL bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()))); END ;; DELIMITER ; @@ -6742,8 +6724,8 @@ BEGIN * @param @datEND Fecha de finalización a buscar */ - SET @datSTART = TIMESTAMPADD(YEAR,-2,CURDATE()); - SET @datEND = TIMESTAMPADD(DAY,-DAY(CURDATE()),CURDATE()); + SET @datSTART = TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + SET @datEND = TIMESTAMPADD(DAY,-DAY(util.VN_CURDATE()),util.VN_CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; @@ -6815,7 +6797,7 @@ BEGIN SELECT week, year INTO vWeek, vYear FROM vn.time - WHERE dated = CURDATE(); + WHERE dated = util.VN_CURDATE(); REPLACE bs.waste SELECT *, 100 * mermas / total as porcentaje @@ -6859,7 +6841,7 @@ BEGIN SELECT week, year INTO vWeek, vYear FROM vn.time - WHERE dated = TIMESTAMPADD(WEEK, -1, CURDATE()); + WHERE dated = TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()); REPLACE bs.waste SELECT *, 100 * mermas / total as porcentaje @@ -6916,10 +6898,10 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - IF DAY(CURDATE()) = 21 THEN + IF DAY(util.VN_CURDATE()) = 21 THEN - SELECT util.firstDayOfMonth(DATE_SUB(CURDATE(), INTERVAL 12 MONTH)), - LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) + SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 12 MONTH)), + LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) INTO vDateStarted, vDateEnded; @@ -7039,10 +7021,10 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - IF DAY(CURDATE()) = 21 THEN + IF DAY(util.VN_CURDATE()) = 21 THEN - SELECT util.firstDayOfMonth(DATE_SUB(CURDATE(), INTERVAL 12 MONTH)), - LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) + SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 12 MONTH)), + LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) INTO vDateStarted, vDateEnded; @@ -7144,7 +7126,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerProductivity_add`() BEGIN DECLARE vDateFrom DATE; - SELECT DATE_SUB(CURDATE(),INTERVAL 30 DAY) INTO vDateFrom; + SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 30 DAY) INTO vDateFrom; DELETE FROM workerProductivity WHERE dated >= vDateFrom; @@ -7308,9 +7290,9 @@ DROP TABLE IF EXISTS `addressFriendship`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `addressFriendship` ( - `addressFk1` int(11) NOT NULL DEFAULT '0', - `addressFk2` int(11) NOT NULL DEFAULT '0', - `friendship` int(11) NOT NULL DEFAULT '0', + `addressFk1` int(11) NOT NULL DEFAULT 0, + `addressFk2` int(11) NOT NULL DEFAULT 0, + `friendship` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`addressFk1`,`addressFk2`), KEY `addressFriendship_fk2_idx` (`addressFk2`), CONSTRAINT `addressFriendship_fk1` FOREIGN KEY (`addressFk1`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -7380,7 +7362,7 @@ CREATE TABLE `cache_calc` ( `params` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '', `last_refresh` datetime DEFAULT NULL, `expires` datetime DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `connection_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `cache_name` (`cache_id`,`params`), @@ -7401,7 +7383,7 @@ CREATE TABLE `cache_valid` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `valid` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORYDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7414,8 +7396,8 @@ DROP TABLE IF EXISTS `departure_limit`; CREATE TABLE `departure_limit` ( `warehouse_id` smallint(6) unsigned NOT NULL, `fecha` date NOT NULL, - `hora` int(11) NOT NULL DEFAULT '0', - `minSpeed` decimal(10,2) NOT NULL DEFAULT '0.00', + `hora` int(11) NOT NULL DEFAULT 0, + `minSpeed` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`warehouse_id`,`fecha`), CONSTRAINT `warehouse_departure` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -7448,14 +7430,14 @@ DROP TABLE IF EXISTS `prod_graphic_source`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `prod_graphic_source` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `m3` double NOT NULL DEFAULT '0', + `m3` double NOT NULL DEFAULT 0, `warehouse_id` int(11) NOT NULL, `hora` int(11) NOT NULL, - `order` int(11) NOT NULL DEFAULT '0', - `graphCategory` int(11) NOT NULL DEFAULT '0', + `order` int(11) NOT NULL DEFAULT 0, + `graphCategory` int(11) NOT NULL DEFAULT 0, `Agencia` varchar(45) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7500,7 +7482,7 @@ DROP TABLE IF EXISTS `zoneAgencyFriendship`; CREATE TABLE `zoneAgencyFriendship` ( `agencyModeFk` int(11) NOT NULL, `zoneFk` int(11) NOT NULL, - `friendship` bigint(21) NOT NULL DEFAULT '0', + `friendship` bigint(21) NOT NULL DEFAULT 0, PRIMARY KEY (`agencyModeFk`,`zoneFk`), KEY `zoneAgencyFriendship_fk1_idx` (`zoneFk`), CONSTRAINT `zoneAgencyFriendship` FOREIGN KEY (`agencyModeFk`) REFERENCES `vn`.`agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -7574,8 +7556,8 @@ BEGIN SELECT t.routeFk, t.zoneFk, t.addressFk addressFk1, t2.addressFk addressFk2 FROM vn.ticket t JOIN vn.ticket t2 USING(routeFk, zoneFk) - WHERE t.shipped >= TIMESTAMPADD(MONTH,-3,CURDATE()) - AND t2.shipped >= TIMESTAMPADD(MONTH,-3,CURDATE()) + WHERE t.shipped >= TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()) + AND t2.shipped >= TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()) AND t.addressFk != t2.addressFk) sub GROUP BY addressFk1, addressFk2; @@ -7583,7 +7565,7 @@ BEGIN SELECT r.agencyModeFk, t.zoneFk, count(*) friendship FROM vn.route r JOIN vn.ticket t ON t.routeFk = r.id - WHERE t.shipped >= TIMESTAMPADD(MONTH,-3,CURDATE()) + WHERE t.shipped >= TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()) AND r.agencyModeFk AND t.routeFk AND t.zoneFk @@ -7618,7 +7600,7 @@ proc: BEGIN RESIGNAL; END; - IF vDate < CURDATE() THEN + IF vDate < util.VN_CURDATE() THEN LEAVE proc; END IF; @@ -7638,7 +7620,7 @@ proc: BEGIN SELECT inventoried INTO vInventoryDate FROM vn.config; - SELECT SUBTIME(NOW(), reserveTime) INTO vReserveDate + SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -7812,7 +7794,7 @@ proc: BEGIN RESIGNAL; END; - IF vDate < CURDATE() THEN + IF vDate < util.VN_CURDATE() THEN LEAVE proc; END IF; @@ -7844,7 +7826,7 @@ proc: BEGIN SELECT inventoried INTO vInventoryDate FROM vn.config; - SELECT SUBTIME(NOW(), reserveTime) INTO vReserveDate + SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -7970,7 +7952,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cacheCalc_clean`() BEGIN - DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW()); + DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, util.VN_NOW()); DELETE FROM cache_calc WHERE expires < vCleanTime; END ;; DELIMITER ; @@ -7997,8 +7979,8 @@ BEGIN UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id SET - cc.last_refresh = NOW(), - cc.expires = LEAST(ADDTIME(NOW(), c.lifetime), util.midNight()), + cc.last_refresh = util.VN_NOW(), + cc.expires = LEAST(ADDTIME(util.VN_NOW(), c.lifetime), util.midNight()), cc.connection_id = NULL WHERE cc.id = v_calc; @@ -8077,7 +8059,7 @@ proc: BEGIN -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. - IF !v_refresh AND NOW() < v_expires + IF !v_refresh AND util.VN_NOW() < v_expires THEN DO RELEASE_LOCK(v_lock_id); SET v_refresh = FALSE; @@ -8186,7 +8168,7 @@ BEGIN DECLARE vDateShort DATETIME; - SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); + SET vDateShort = TIMESTAMPADD(MONTH, -1, util.VN_CURDATE()); DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; END ;; @@ -8223,11 +8205,11 @@ DECLARE vLoadingDelay DECIMAL(5) DEFAULT 2; DECLARE rs CURSOR FOR SELECT Departure , Sum(pb.m3)/(GREATEST(IFNULL(lhp.m3,0),IFNULL(dp.minSpeed,0))) AS Horas - , curDate()+(Departure + vLoadingDelay -(Sum(pb.m3)/(GREATEST(IFNULL(lhp.m3,0),IFNULL(minSpeed,0))))/24) AS InicioPreparacion + , util.VN_CURDATE()+(Departure + vLoadingDelay -(Sum(pb.m3)/(GREATEST(IFNULL(lhp.m3,0),IFNULL(minSpeed,0))))/24) AS InicioPreparacion FROM tmp.production_buffer pb LEFT JOIN vn.lastHourProduction lhp ON lhp.warehouseFk = pb.warehouse_id - LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = CURDATE() - WHERE pb.Fecha = CURDATE() + LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = util.VN_CURDATE() + WHERE pb.Fecha = util.VN_CURDATE() AND pb.graphCategory > 1 AND IFNULL(Departure,0) > 0 GROUP BY Departure @@ -8235,7 +8217,7 @@ DECLARE rs CURSOR FOR DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SET myTime = HOUR(now()) + MINUTE(now()) / 60; + SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; OPEN rs; @@ -8269,10 +8251,10 @@ DECLARE rs CURSOR FOR SELECT minSpeed INTO myMinSpeed FROM cache.departure_limit WHERE warehouse_id = vWarehouseId - AND fecha = CURDATE(); + AND fecha = util.VN_CURDATE(); REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) - VALUES (vWarehouseId, CURDATE(), departureLimit, IFNULL(myMinSpeed,0)); + VALUES (vWarehouseId, util.VN_CURDATE(), departureLimit, IFNULL(myMinSpeed,0)); CLOSE rs; @@ -8308,11 +8290,11 @@ DECLARE departureLimit INT; DECLARE rs CURSOR FOR SELECT Departure , Sum(pb.m3)/GREATEST(v.m3,IFNULL(minSpeed,0)) AS Horas - , curDate()+(Departure-(Sum(pb.m3)/GREATEST(v.m3,IFNULL(minSpeed,0)))/24) AS InicioPreparacion + , util.VN_CURDATE()+(Departure-(Sum(pb.m3)/GREATEST(v.m3,IFNULL(minSpeed,0)))/24) AS InicioPreparacion FROM tmp.production_buffer pb JOIN vn2008.v_encajado_ultima_hora v ON v.warehouse_id = pb.warehouse_id - LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = CURDATE() - WHERE pb.Fecha = CURDATE() + LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = util.VN_CURDATE() + WHERE pb.Fecha = util.VN_CURDATE() AND alert_level < 2 AND IFNULL(Departure,0) > 0 GROUP BY Departure @@ -8320,7 +8302,7 @@ DECLARE rs CURSOR FOR DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -SET myTime = HOUR(now()) + MINUTE(now()) / 60; +SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; OPEN rs; @@ -8358,7 +8340,7 @@ SET departureLimit = IFNULL(departureLimit,24); IF departureLimit > 0 THEN REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) - VALUES (vWarehouseId, CURDATE(), departureLimit, myMinSpeed); + VALUES (vWarehouseId, util.VN_CURDATE(), departureLimit, myMinSpeed); END IF; @@ -8410,7 +8392,7 @@ proc: BEGIN -- TODO: ¿Se puede usar la fecha del ultimo inventario? SELECT inventoried INTO started FROM vn.config LIMIT 1; - SET ended = CURDATE(); -- TIMESTAMPADD(DAY, -1, CURDATE()); + SET ended = util.VN_CURDATE(); -- TIMESTAMPADD(DAY, -1, util.VN_CURDATE()); CALL vn.buyUltimateFromInterval(NULL, started, ended); @@ -8466,7 +8448,7 @@ proc: BEGIN pb.Agencia FROM tmp.production_buffer pb JOIN vn.state st ON st.id = pb.state - WHERE Fecha = CURDATE() + WHERE Fecha = util.VN_CURDATE() GROUP BY wh_id, graphCategory ; @@ -8516,7 +8498,7 @@ proc: BEGIN END IF; SET v_date_inv = (SELECT inventoried FROM vn.config LIMIT 1); - SET v_curdate = CURDATE(); + SET v_curdate = util.VN_CURDATE(); DELETE FROM stock; @@ -8583,7 +8565,7 @@ proc: BEGIN END IF; SET v_date_inv = (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1); - SET v_curdate = CURDATE(); + SET v_curdate = util.VN_CURDATE(); DELETE FROM stock; @@ -8791,7 +8773,7 @@ DROP TABLE IF EXISTS `VMPSettings`; CREATE TABLE `VMPSettings` ( `VMPID` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isEktSender` tinyint(4) NOT NULL DEFAULT '0', + `isEktSender` tinyint(4) NOT NULL DEFAULT 0, `MessageID` int(11) NOT NULL, `dateTimeTry` timestamp NULL DEFAULT NULL, `isVmpBA` tinyint(4) DEFAULT NULL COMMENT 'Basic authentication', @@ -8807,12 +8789,12 @@ CREATE TABLE `VMPSettings` ( `closedFrom` int(11) DEFAULT NULL, `closedTo` int(11) DEFAULT NULL, `totalRefreshHours` int(11) DEFAULT NULL COMMENT 'Numero > 4 para no saturar, no repetir para que no solapen las actualizaciones', - `UseSupplierEmbalageCode` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'vmp you want to see their embalage code', + `UseSupplierEmbalageCode` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'vmp you want to see their embalage code', `firstSupplyResponseId` int(11) DEFAULT NULL, `ApiId` int(11) DEFAULT NULL, `ApiKey` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `isBlocked` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'product source not allowed', - `isVNHSupplier` tinyint(1) DEFAULT '0' COMMENT 'The account belongs to VNH', + `isBlocked` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'product source not allowed', + `isVNHSupplier` tinyint(1) DEFAULT 0 COMMENT 'The account belongs to VNH', PRIMARY KEY (`VMPID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -8894,7 +8876,7 @@ CREATE TABLE `deliveryInformation` ( `FirstOrderDateTime` datetime DEFAULT NULL, `LatestOrderDateTime` datetime DEFAULT NULL, `supplyResponseID` int(11) DEFAULT NULL, - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`ID`), UNIQUE KEY `deliveryInformation_UN` (`Location`,`LatestDeliveryDateTime`,`FirstOrderDateTime`,`LatestOrderDateTime`,`supplyResponseID`), KEY `fgbSupplyResponse_idx` (`supplyResponseID`), @@ -8902,7 +8884,7 @@ CREATE TABLE `deliveryInformation` ( KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`) USING BTREE, KEY `deliveryInformation_updated_IDX` (`updated`) USING BTREE, CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8913,7 +8895,7 @@ DROP TABLE IF EXISTS `di`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `di` ( - `ID` int(11) NOT NULL DEFAULT '0', + `ID` int(11) NOT NULL DEFAULT 0, `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `LatestDeliveryDateTime` datetime DEFAULT NULL, `FirstOrderDateTime` datetime DEFAULT NULL, @@ -8938,11 +8920,11 @@ CREATE TABLE `ekt` ( `deliveryNumber` bigint(20) unsigned DEFAULT NULL, `fec` date DEFAULT NULL, `hor` time DEFAULT NULL, - `now` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `util.VN_NOW` timestamp NULL DEFAULT current_timestamp(), `ptj` mediumint(8) unsigned DEFAULT NULL, `ref` int(11) NOT NULL, `item` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `pac` int(11) DEFAULT '0', + `pac` int(11) DEFAULT 0, `qty` int(10) NOT NULL, `ori` varchar(3) COLLATE utf8_unicode_ci DEFAULT 'NL', `cat` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -8965,10 +8947,10 @@ CREATE TABLE `ekt` ( `s4` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, `s5` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `s6` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `ok` tinyint(4) NOT NULL DEFAULT '0', + `ok` tinyint(4) NOT NULL DEFAULT 0, `trolleyFk` int(11) DEFAULT NULL, `putOrderFk` bigint(20) unsigned DEFAULT NULL, - `scanned` tinyint(1) NOT NULL DEFAULT '0', + `scanned` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `barcode_year` (`barcode`,`entryYear`), UNIQUE KEY `entry_year` (`deliveryNumber`,`entryYear`) USING BTREE, @@ -8979,7 +8961,7 @@ CREATE TABLE `ekt` ( KEY `barcode` (`barcode`), KEY `fec` (`fec`), KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8999,7 +8981,7 @@ CREATE TABLE `ektEntryAssign__` ( `supplierFk` int(11) DEFAULT NULL, `entryFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9042,7 +9024,7 @@ CREATE TABLE `exchange` ( KEY `buy_edi_id` (`ektFk`), CONSTRAINT `exchange_ibfk_1` FOREIGN KEY (`mailFk`) REFERENCES `mail` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `exchange_ibfk_2` FOREIGN KEY (`ektFk`) REFERENCES `ekt` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9061,7 +9043,7 @@ CREATE TABLE `exchangeConfig` ( PRIMARY KEY (`id`), KEY `presale_id` (`presaleFk`), CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9122,8 +9104,8 @@ DROP TABLE IF EXISTS `floraHollandConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `floraHollandConfig` ( - `defaultAdminNumber` int(11) NOT NULL DEFAULT '66011', - `floramondoMargin` decimal(10,2) NOT NULL DEFAULT '0.17' + `defaultAdminNumber` int(11) NOT NULL DEFAULT 66011, + `floramondoMargin` decimal(10,2) NOT NULL DEFAULT 0.17 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9140,7 +9122,7 @@ CREATE TABLE `ftpConfig` ( `user` varchar(50) CHARACTER SET utf8 NOT NULL, `password` varchar(50) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9156,7 +9138,7 @@ CREATE TABLE `genus` ( `entry_date` date DEFAULT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, - `isHazard` tinyint(1) NOT NULL DEFAULT '0', + `isHazard` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`genus_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9315,7 +9297,7 @@ CREATE TABLE `item_groupToOffer` ( `group_code` int(11) unsigned NOT NULL, `itemTypeFk` smallint(5) unsigned NOT NULL, `intrastatFk` int(8) unsigned zerofill NOT NULL, - `originFk` tinyint(2) unsigned NOT NULL DEFAULT '17', + `originFk` tinyint(2) unsigned NOT NULL DEFAULT 17, `expenseFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '7001000000', PRIMARY KEY (`group_code`), KEY `item_groupToOffer_fk2_idx` (`itemTypeFk`), @@ -9336,20 +9318,20 @@ DROP TABLE IF EXISTS `item_track`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_track` ( `item_id` int(10) unsigned NOT NULL, - `s1` tinyint(3) NOT NULL DEFAULT '0', - `s2` tinyint(3) NOT NULL DEFAULT '0', - `s3` tinyint(3) NOT NULL DEFAULT '0', - `s4` tinyint(3) NOT NULL DEFAULT '0', - `pac` tinyint(3) NOT NULL DEFAULT '0', - `cat` tinyint(3) NOT NULL DEFAULT '0', - `ori` tinyint(3) NOT NULL DEFAULT '0', - `pro` tinyint(3) NOT NULL DEFAULT '0', - `package` tinyint(3) NOT NULL DEFAULT '0', - `s5` tinyint(3) NOT NULL DEFAULT '0', - `s6` tinyint(3) NOT NULL DEFAULT '0', - `kop` tinyint(3) NOT NULL DEFAULT '0', - `sub` tinyint(3) NOT NULL DEFAULT '0', - `item` tinyint(3) NOT NULL DEFAULT '0', + `s1` tinyint(3) NOT NULL DEFAULT 0, + `s2` tinyint(3) NOT NULL DEFAULT 0, + `s3` tinyint(3) NOT NULL DEFAULT 0, + `s4` tinyint(3) NOT NULL DEFAULT 0, + `pac` tinyint(3) NOT NULL DEFAULT 0, + `cat` tinyint(3) NOT NULL DEFAULT 0, + `ori` tinyint(3) NOT NULL DEFAULT 0, + `pro` tinyint(3) NOT NULL DEFAULT 0, + `package` tinyint(3) NOT NULL DEFAULT 0, + `s5` tinyint(3) NOT NULL DEFAULT 0, + `s6` tinyint(3) NOT NULL DEFAULT 0, + `kop` tinyint(3) NOT NULL DEFAULT 0, + `sub` tinyint(3) NOT NULL DEFAULT 0, + `item` tinyint(3) NOT NULL DEFAULT 0, PRIMARY KEY (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9366,9 +9348,9 @@ CREATE TABLE `log` ( `tableName` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `fieldName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `fieldValue` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9385,12 +9367,12 @@ CREATE TABLE `mail` ( `messageId` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `nExchanges` int(10) unsigned NOT NULL, `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `mail_id` (`messageId`), KEY `sender_id` (`senderFk`), CONSTRAINT `mail_ibfk_2` FOREIGN KEY (`senderFk`) REFERENCES `mailSender` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9406,7 +9388,7 @@ CREATE TABLE `mailSender` ( `kop` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mail` (`mail`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9419,11 +9401,11 @@ DROP TABLE IF EXISTS `marketPlace`; CREATE TABLE `marketPlace` ( `id` varchar(13) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `supplierFk` int(11) NOT NULL DEFAULT '1433', - `isOffered` tinyint(2) NOT NULL DEFAULT '0', + `supplierFk` int(11) NOT NULL DEFAULT 1433, + `isOffered` tinyint(2) NOT NULL DEFAULT 0, `MaxLatestDeliveryHour` int(11) DEFAULT NULL COMMENT 'Maxima hora para tener en cuenta la oferta', - `isLatestOrderDateTimeRelevant` tinyint(2) DEFAULT '0' COMMENT 'Se tiene en cuenta para calcular el próximo travel posible', - `isEarlyBird` tinyint(4) NOT NULL DEFAULT '0', + `isLatestOrderDateTimeRelevant` tinyint(2) DEFAULT 0 COMMENT 'Se tiene en cuenta para calcular el próximo travel posible', + `isEarlyBird` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `marketPlaceisOfferedIdx` (`isOffered`), KEY `marketPlaceMaxLatestIdx` (`MaxLatestDeliveryHour`), @@ -9460,12 +9442,12 @@ CREATE TABLE `param` ( `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(5) COLLATE utf8_unicode_ci NOT NULL, `subname` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `position` tinyint(3) unsigned NOT NULL DEFAULT '1', + `position` tinyint(3) unsigned NOT NULL DEFAULT 1, `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') COLLATE utf8_unicode_ci NOT NULL, - `required` tinyint(3) unsigned NOT NULL DEFAULT '1', + `required` tinyint(3) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`subname`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9498,16 +9480,16 @@ CREATE TABLE `putOrder` ( `deliveryInformationID` int(11) DEFAULT NULL, `supplyResponseID` int(11) DEFAULT NULL, `orderTradelineItemID` int(11) DEFAULT NULL COMMENT 'ticketFk or EntryFk?', - `OrderTradeLineDateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'fecha de creacion en la tabla', + `OrderTradeLineDateTime` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'fecha de creacion en la tabla', `quantity` int(11) DEFAULT NULL, `EndUserPartyID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `EndUserPartyGLN` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The grower can use this reference in his EKT in the NAD (MA) segment.', - `OrderStatus` int(11) DEFAULT '0' COMMENT '1 pending\n2 confirmed\n3 canceled', + `OrderStatus` int(11) DEFAULT 0 COMMENT '1 pending\n2 confirmed\n3 canceled', `isOrderProcessed` tinyint(4) DEFAULT NULL, `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `barcode` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `FHAdminNumber` int(11) DEFAULT '66011', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `FHAdminNumber` int(11) DEFAULT 66011, `saleFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `orderTradelineItemID_UNIQUE` (`orderTradelineItemID`), @@ -9515,7 +9497,7 @@ CREATE TABLE `putOrder` ( KEY `supplyResponseID_idx` (`supplyResponseID`), KEY `putOrder_FK` (`saleFk`), CONSTRAINT `putOrder_FK` FOREIGN KEY (`saleFk`) REFERENCES `vn`.`sale` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9618,7 +9600,7 @@ BEGIN JOIN vn.ticket t ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN deliveryInformation di ON di.ID = NEW.deliveryInformationID - WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= CURDATE() + WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID LIMIT 1; @@ -9627,7 +9609,7 @@ BEGIN JOIN vn.item i ON i.id = s.itemFk JOIN deliveryInformation di ON di.ID = NEW.deliveryInformationID SET s.quantity = 0 - WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= CURDATE() + WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID; INSERT INTO vn.mail (sender, `subject`, body) @@ -9713,8 +9695,8 @@ CREATE TABLE `supplier` ( `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, - `isAllowedDirectSales` tinyint(1) NOT NULL DEFAULT '0', - `isBanned` tinyint(1) NOT NULL DEFAULT '0', + `isAllowedDirectSales` tinyint(1) NOT NULL DEFAULT 0, + `isBanned` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`supplier_id`), UNIQUE KEY `supplier_UN` (`glnAddressCode`), KEY `glnaddressCodeidx` (`glnAddressCode`) @@ -9837,9 +9819,9 @@ CREATE TABLE `supplyResponse` ( `widthMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Width', `lengthMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Length', `heightMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Height', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp(), `EmbalageCodeSupplier` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`ID`), KEY `IX_TransNumber` (`TransactionNumber`) COMMENT 'Agregado por Ernesto 11.6.2019\nSe ejecutaba 1 consulta por segundo desde MAIL y consumia un 20% de CPU de todo el servidor !!!!!\nCPU usada es mas estable que Indice en SendererID, cpu vs espacio que ocupa?\n', KEY `supplyResponse_Ix1` (`Item_ArticleCode`), @@ -9850,7 +9832,7 @@ CREATE TABLE `supplyResponse` ( KEY `supplyResponse_updated_IDX` (`updated`) USING BTREE, CONSTRAINT `supplyResponse_fk2` FOREIGN KEY (`MarketPlaceID`) REFERENCES `marketPlace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `supplyResponseputOrder_FK` FOREIGN KEY (`vmpID`) REFERENCES `VMPSettings` (`VMPID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9877,7 +9859,7 @@ BEGIN WHERE i.supplyResponseFk = NEW.ID AND am.name = 'LOGIFLORA' AND e.isRaid - AND tr.landed >= CURDATE(); + AND tr.landed >= util.VN_CURDATE(); END */;; DELIMITER ; @@ -9896,14 +9878,14 @@ DROP TABLE IF EXISTS `supplyResponseLog`; CREATE TABLE `supplyResponseLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `supplyResponseFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `NumberOfUnitsOld` int(11) DEFAULT NULL, `NumberOfUnitsNew` int(11) DEFAULT NULL, `lastVMPUpdate` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `supplyResponseLog_FK` (`supplyResponseFk`), CONSTRAINT `supplyResponseLog_FK` FOREIGN KEY (`supplyResponseFk`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla la utiliza la empresa LOGIFLORA. No kkear.'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla la utiliza la empresa LOGIFLORA. No kkear.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9951,10 +9933,10 @@ DROP TABLE IF EXISTS `warehouseFloramondo`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `warehouseFloramondo` ( `warehouseFk` smallint(6) unsigned NOT NULL, - `travellingDays` int(11) NOT NULL DEFAULT '1', + `travellingDays` int(11) NOT NULL DEFAULT 1, `entryFk` int(11) DEFAULT NULL, `isFV` int(11) DEFAULT NULL COMMENT 'NULL indiferente\n0 no\n1 si\n', - `dayRange` int(11) NOT NULL DEFAULT '0' COMMENT 'dias de margen a futuro', + `dayRange` int(11) NOT NULL DEFAULT 0 COMMENT 'dias de margen a futuro', PRIMARY KEY (`warehouseFk`), KEY `warehouseFloramondo_FK2_idx` (`entryFk`), CONSTRAINT `warehouseFloramondo_FK2` FOREIGN KEY (`entryFk`) REFERENCES `vn`.`entry` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, @@ -10037,8 +10019,8 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN - DECLARE vFourYearsAgo DATE DEFAULT TIMESTAMPADD(YEAR,-4,CURDATE()); - DECLARE vOneWeekAgo DATE DEFAULT TIMESTAMPADD(WEEK,-1,CURDATE()); + DECLARE vFourYearsAgo DATE DEFAULT TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); + DECLARE vOneWeekAgo DATE DEFAULT TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); DELETE FROM ekt WHERE fec < vFourYearsAgo; @@ -10048,7 +10030,7 @@ BEGIN WHERE di.LatestOrderDateTime < vOneWeekAgo OR di.ID IS NULL; DELETE FROM putOrder - WHERE created < TIMESTAMPADD(MONTH,-1,CURDATE()); + WHERE created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); END ;; DELIMITER ; @@ -10135,7 +10117,7 @@ BEGIN putOrderFk, `ref`, kop) - SELECT year(curdate()) entryYear, + SELECT year(util.VN_CURDATE()) entryYear, p.id deliveryNumber , DATE(di.LatestDeliveryDateTime) fec, HOUR(di.LatestDeliveryDateTime) hor, @@ -10304,7 +10286,7 @@ proc:BEGIN AND IF(t.package, l.package = e.package, TRUE) AND IF(t.item, l.item = e.item, TRUE) AND i.isFloramondo = vIsFloramondoDirect - ORDER BY l.now DESC, b.id ASC + ORDER BY l.util.VN_NOW DESC, b.id ASC LIMIT 1; END IF; @@ -10486,7 +10468,7 @@ BEGIN DECLARE cursor1 CURSOR FOR SELECT e.id FROM edi.ekt e LEFT JOIN vn.buy b ON b.ektFk = e.id - WHERE e.fec >= CURDATE() + WHERE e.fec >= util.VN_CURDATE() AND ISNULL(b.ektFk); DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; @@ -10765,7 +10747,7 @@ proc: BEGIN RESIGNAL; END; - SET vStartingTime = NOW(); + SET vStartingTime = util.VN_NOW(); TRUNCATE edi.offerList ; @@ -10881,19 +10863,19 @@ proc: BEGIN AND i.quality <=> o.Quality JOIN vn.itemType it ON it.id = i.typeFk LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) SET i.supplyResponseFk = o.srID WHERE ( sr.ID IS NULL OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < NOW() + OR di.LatestOrderDateTime < util.VN_NOW() OR di.ID IS NULL) AND it.isInventory AND t.id IS NULL AND po.id IS NULL; - -- select now(),'Antes de crear ITO'; + -- select util.VN_NOW(),'Antes de crear ITO'; DROP TEMPORARY TABLE IF EXISTS itemToInsert; CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk @@ -11074,7 +11056,7 @@ proc: BEGIN JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID JOIN vn.floramondoConfig fc WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(NOW()), CURDATE(), TIMESTAMPADD(DAY,1,CURDATE())); + AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); UPDATE vn.floramondoConfig SET nextLanded = vLanded @@ -11089,7 +11071,7 @@ proc: BEGIN LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,NOW()) <= NOW() + WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() OR i.supplyResponseFk IS NULL OR sr.NumberOfUnits = 0) AND am.name = 'LOGIFLORA' @@ -11118,7 +11100,7 @@ proc: BEGIN JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; */ -- Se inserta el resto - SET vLastInserted := NOW(); + SET vLastInserted := util.VN_NOW(); -- Inserta la oferta INSERT INTO vn.buy( entryFk, @@ -11208,7 +11190,7 @@ proc: BEGIN AND typeFk = 17; INSERT INTO edi.log(tableName, fieldName,fieldValue) - VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(NOW(),vStartingTime)); + VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); @@ -11256,7 +11238,7 @@ proc: BEGIN RESIGNAL; END; - SET vStartingTime = NOW(); + SET vStartingTime = util.VN_NOW(); TRUNCATE edi.offerList ; @@ -11372,19 +11354,19 @@ proc: BEGIN AND i.quality <=> o.Quality JOIN vn.itemType it ON it.id = i.typeFk LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) SET i.supplyResponseFk = o.srID WHERE ( sr.ID IS NULL OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < NOW() + OR di.LatestOrderDateTime < util.VN_NOW() OR di.ID IS NULL) AND it.isInventory AND t.id IS NULL AND po.id IS NULL; - -- select now(),'Antes de crear ITO'; + -- select util.VN_NOW(),'Antes de crear ITO'; DROP TEMPORARY TABLE IF EXISTS itemToInsert; CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk @@ -11567,7 +11549,7 @@ proc: BEGIN JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID JOIN vn.floramondoConfig fc WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(NOW()), CURDATE(), TIMESTAMPADD(DAY,1,CURDATE())); + AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); UPDATE vn.floramondoConfig SET nextLanded = vLanded @@ -11582,7 +11564,7 @@ proc: BEGIN LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,NOW()) <= NOW() + WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() OR i.supplyResponseFk IS NULL OR sr.NumberOfUnits = 0) AND am.name = 'LOGIFLORA' @@ -11611,7 +11593,7 @@ proc: BEGIN JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; */ -- Se inserta el resto - SET vLastInserted := NOW(); + SET vLastInserted := util.VN_NOW(); -- Inserta la oferta INSERT INTO vn.buy( entryFk, @@ -11701,7 +11683,7 @@ proc: BEGIN AND typeFk = 17; INSERT INTO edi.log(tableName, fieldName,fieldValue) - VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(NOW(),vStartingTime)); + VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); @@ -11749,7 +11731,7 @@ proc: BEGIN RESIGNAL; END; - SET vStartingTime = NOW(); + SET vStartingTime = util.VN_NOW(); CALL util.debugAdd('edi.floramondo_offerRefresh',CONCAT('MaxItemId:' ,(SELECT MAX(id) FROM vn.item))); @@ -11785,7 +11767,7 @@ proc: BEGIN -- GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Quality, NumberOfItemsPerCask, EmbalageCode, Price, PictureReference ; - -- select now(),'Antes de crear edi.offer'; + -- select util.VN_NOW(),'Antes de crear edi.offer'; DROP TEMPORARY TABLE IF EXISTS edi.offer; CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`), @@ -11852,19 +11834,19 @@ proc: BEGIN AND i.quality <=> o.Quality JOIN vn.itemType it ON it.id = i.typeFk LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, CURDATE()) + LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) SET i.supplyResponseFk = o.srID WHERE ( sr.ID IS NULL OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < NOW() + OR di.LatestOrderDateTime < util.VN_NOW() OR di.ID IS NULL) AND it.isInventory AND t.id IS NULL AND po.id IS NULL; - -- select now(),'Antes de crear ITO'; + -- select util.VN_NOW(),'Antes de crear ITO'; DROP TEMPORARY TABLE IF EXISTS itemToInsert; CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk @@ -12044,7 +12026,7 @@ proc: BEGIN JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID JOIN vn.floramondoConfig fc WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(NOW()), CURDATE(), TIMESTAMPADD(DAY,1,CURDATE())); + AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); UPDATE vn.floramondoConfig SET nextLanded = vLanded @@ -12059,7 +12041,7 @@ proc: BEGIN LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,NOW()) <= NOW() + WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() OR i.supplyResponseFk IS NULL OR sr.NumberOfUnits = 0) AND am.name = 'LOGIFLORA' @@ -12087,7 +12069,7 @@ proc: BEGIN JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; -- Se inserta el resto - SET vLastInserted := NOW(); + SET vLastInserted := util.VN_NOW(); -- Inserta la oferta INSERT INTO vn.buy(entryFk, @@ -12149,7 +12131,7 @@ proc: BEGIN AND typeFk = 17; INSERT INTO edi.log(tableName, fieldName,fieldValue) - VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(NOW(),vStartingTime)); + VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); END ;; DELIMITER ; @@ -12674,7 +12656,7 @@ CREATE TABLE `config` ( `dmsDir` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Directory where documents are allocated', PRIMARY KEY (`id`), KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.' -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12688,7 +12670,7 @@ CREATE TABLE `contact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `recipient` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12703,7 +12685,7 @@ CREATE TABLE `image` ( `collectionFk` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `updated` int(11) DEFAULT NULL, - `nRefs` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Number of references, don''t modify this column manually', + `nRefs` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Number of references, don''t modify this column manually', PRIMARY KEY (`id`), UNIQUE KEY `collection` (`collectionFk`,`name`), CONSTRAINT `image_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`name`) ON UPDATE CASCADE @@ -12728,8 +12710,8 @@ CREATE TABLE `imageCollection` ( `schema` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', `table` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', `column` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', - `readRoleFk` int(10) unsigned DEFAULT '1', - `writeRoleFk` int(10) unsigned DEFAULT '1', + `readRoleFk` int(10) unsigned DEFAULT 1, + `writeRoleFk` int(10) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `role_id_writeRoleFk` (`writeRoleFk`), @@ -12751,7 +12733,7 @@ CREATE TABLE `imageCollectionSize` ( `collectionFk` int(10) unsigned NOT NULL, `width` int(10) unsigned NOT NULL, `height` int(10) unsigned NOT NULL, - `crop` tinyint(3) unsigned NOT NULL DEFAULT '0', + `crop` tinyint(3) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `image_schema_id` (`collectionFk`), CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE @@ -12771,7 +12753,7 @@ CREATE TABLE `imageConfig` ( `useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile', `url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Global image parameters'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Global image parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12785,7 +12767,7 @@ CREATE TABLE `language` ( `code` varchar(10) CHARACTER SET utf8 NOT NULL, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `orgName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `isActive` tinyint(1) NOT NULL DEFAULT '0', + `isActive` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -12804,7 +12786,7 @@ CREATE TABLE `link` ( `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12889,7 +12871,7 @@ CREATE TABLE `location` ( `phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `language` char(2) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12902,14 +12884,14 @@ DROP TABLE IF EXISTS `mailConfig`; CREATE TABLE `mailConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', - `port` smallint(6) NOT NULL DEFAULT '465' COMMENT 'SMTP port', - `secure` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Wether to use a secure connection', + `port` smallint(6) NOT NULL DEFAULT 465 COMMENT 'SMTP port', + `secure` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Wether to use a secure connection', `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The sender mail address', `senderName` varchar(75) CHARACTER SET utf8 NOT NULL COMMENT 'The sender name', `user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP user', `password` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP password, base64 encoded', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12952,12 +12934,12 @@ CREATE TABLE `menu` ( `path` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `roleFk` int(10) unsigned NOT NULL, `parentFk` int(10) unsigned DEFAULT NULL, - `displayOrder` tinyint(4) unsigned NOT NULL DEFAULT '1', + `displayOrder` tinyint(4) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `group_id` (`roleFk`), KEY `parent` (`parentFk`), CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12973,7 +12955,7 @@ CREATE TABLE `message` ( `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13302,15 +13284,15 @@ CREATE TABLE `news` ( `text` text COLLATE utf8_unicode_ci NOT NULL, `image` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `userFk` int(10) unsigned NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `priority` tinyint(3) unsigned NOT NULL DEFAULT '3', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `priority` tinyint(3) unsigned NOT NULL DEFAULT 3, `tag` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'new', PRIMARY KEY (`id`), KEY `user` (`userFk`), KEY `tag` (`tag`), CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13401,15 +13383,15 @@ CREATE TABLE `order` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date_send` date NOT NULL DEFAULT '0000-00-00', `customer_id` int(11) NOT NULL, - `delivery_method_id` int(11) DEFAULT '3', - `agency_id` int(11) DEFAULT '2', + `delivery_method_id` int(11) DEFAULT 3, + `agency_id` int(11) DEFAULT 2, `address_id` int(11) DEFAULT NULL, - `company_id` smallint(5) unsigned NOT NULL DEFAULT '442', + `company_id` smallint(5) unsigned NOT NULL DEFAULT 442, `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `source_app` set('WEB','ANDROID','IOS','SALIX','TPV','TABLET_VN','') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TPV', - `is_bionic` tinyint(1) NOT NULL DEFAULT '1', - `confirmed` tinyint(1) NOT NULL DEFAULT '0', - `date_make` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `is_bionic` tinyint(1) NOT NULL DEFAULT 1, + `confirmed` tinyint(1) NOT NULL DEFAULT 0, + `date_make` timestamp NOT NULL DEFAULT current_timestamp(), `first_row_stamp` datetime DEFAULT NULL, `confirm_date` datetime DEFAULT NULL, `taxableBase` decimal(10,2) NOT NULL, @@ -13543,7 +13525,7 @@ CREATE TABLE `orderConfig` ( CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`), CONSTRAINT `orderConfig_ibfk_5` FOREIGN KEY (`guestAddressFk`) REFERENCES `vn`.`address` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13569,14 +13551,14 @@ DROP TABLE IF EXISTS `orderRow`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderRow` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `orderFk` int(10) unsigned NOT NULL DEFAULT '0', - `itemFk` int(11) NOT NULL DEFAULT '0', + `orderFk` int(10) unsigned NOT NULL DEFAULT 0, + `itemFk` int(11) NOT NULL DEFAULT 0, `warehouseFk` int(11) DEFAULT NULL, `shipment` date DEFAULT NULL, - `amount` smallint(6) unsigned NOT NULL DEFAULT '0', + `amount` smallint(6) unsigned NOT NULL DEFAULT 0, `price` decimal(10,2) DEFAULT NULL, `rate` smallint(5) unsigned DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `saleFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `item` (`itemFk`), @@ -13607,7 +13589,7 @@ BEGIN WHERE id = NEW.orderFk; IF vIsFirst THEN - UPDATE `order` SET first_row_stamp = NOW() + UPDATE `order` SET first_row_stamp = util.VN_NOW() WHERE id = NEW.orderFk; END IF; END */;; @@ -13763,7 +13745,7 @@ CREATE TABLE `restPriv` ( PRIMARY KEY (`id`), KEY `role` (`role`), CONSTRAINT `restPriv_ibfk_1` FOREIGN KEY (`role`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13801,7 +13783,7 @@ CREATE TABLE `shelfConfig` ( `shelf` int(10) unsigned NOT NULL, `maxAmount` smallint(5) unsigned DEFAULT NULL, `showPacking` tinyint(4) NOT NULL, - `stack` tinyint(4) NOT NULL DEFAULT '0', + `stack` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `shelf_id` (`shelf`), KEY `family_id` (`family`), @@ -13809,7 +13791,7 @@ CREATE TABLE `shelfConfig` ( CONSTRAINT `shelfConfig_ibfk_1` FOREIGN KEY (`family`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_2` FOREIGN KEY (`shelf`) REFERENCES `shelf` (`id`) ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_3` FOREIGN KEY (`warehouse`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13827,7 +13809,7 @@ CREATE TABLE `social` ( `priority` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `priority` (`priority`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13841,7 +13823,7 @@ CREATE TABLE `survey` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `question` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13855,7 +13837,7 @@ CREATE TABLE `surveyAnswer` ( `id` int(10) unsigned NOT NULL, `surveyFk` int(10) unsigned NOT NULL, `answer` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `votes` int(10) unsigned NOT NULL DEFAULT '0', + `votes` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `survey` (`surveyFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -13893,7 +13875,7 @@ CREATE TABLE `tpvConfig` ( `maxAmount` int(10) unsigned DEFAULT NULL, `employeeFk` int(10) unsigned NOT NULL, `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The bank web service URL for production environment', - `testMode` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Whether test mode is enabled', + `testMode` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Whether test mode is enabled', `testUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank web service URL for test environment', `testKey` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank secret key for test environment', `merchantUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL, @@ -13933,7 +13915,7 @@ CREATE TABLE `tpvImapConfig` ( `successFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, `errorFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13964,7 +13946,7 @@ DROP TABLE IF EXISTS `tpvMerchantEnable`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvMerchantEnable` ( - `merchantFk` int(10) unsigned NOT NULL DEFAULT '0', + `merchantFk` int(10) unsigned NOT NULL DEFAULT 0, `companyFk` smallint(6) unsigned NOT NULL, PRIMARY KEY (`merchantFk`,`companyFk`), UNIQUE KEY `company_id` (`companyFk`), @@ -14002,7 +13984,7 @@ CREATE TABLE `tpvTransaction` ( `response` smallint(5) unsigned DEFAULT NULL COMMENT 'Status notified by bank: NULL if no notification, 0 if success, error otherwise', `errorCode` char(7) COLLATE utf8_unicode_ci DEFAULT NULL, `status` enum('started','ok','ko') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'started', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `merchant_id` (`merchantFk`), KEY `receipt_id` (`receiptFk`), @@ -14023,10 +14005,10 @@ DROP TABLE IF EXISTS `userSession`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `userSession` ( - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `lastUpdate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp(), + `lastUpdate` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `ssid` char(64) COLLATE utf8_unicode_ci NOT NULL, - `data` text COLLATE utf8_unicode_ci, + `data` text COLLATE utf8_unicode_ci DEFAULT NULL, `userVisitFk` int(10) unsigned DEFAULT NULL, UNIQUE KEY `ssid` (`ssid`), KEY `userVisit` (`userVisitFk`), @@ -14060,7 +14042,7 @@ DROP TABLE IF EXISTS `visitAccess`; CREATE TABLE `visitAccess` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `agentFk` int(10) unsigned NOT NULL, - `stamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `stamp` datetime NOT NULL DEFAULT current_timestamp(), `ip` int(10) unsigned DEFAULT NULL, `referer` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -14106,7 +14088,7 @@ CREATE TABLE `visitUser` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `accessFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `stamp` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `access_id` (`accessFk`), KEY `date_time` (`stamp`), @@ -14143,7 +14125,7 @@ DELIMITER ; -- -- Dumping routines for database 'hedera' -- -/*!50003 DROP FUNCTION IF EXISTS `myBasket_getId` */; +/*!50003 DROP FUNCTION IF EXISTS `MYBASKET_GETID` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -14689,7 +14671,7 @@ BEGIN FROM vn.buy b JOIN vn.entry e ON e.id = b.entryFk JOIN vn.travel t ON t.id = e.travelFk - WHERE t.shipped BETWEEN vDateInv AND CURDATE() + WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() AND t.warehouseOutFk = vWarehouse AND NOT e.isRaid AND t.isDelivered @@ -14698,7 +14680,7 @@ BEGIN FROM vn.sale m JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticket = t.id - WHERE t.shipped BETWEEN vDateInv AND CURDATE() + WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() AND t.warehouseFk = vWarehouse AND s.alertLevel = 3 ) t @@ -14737,7 +14719,7 @@ BEGIN LEFT JOIN vn.packaging p ON p.id = t.packageFk WHERE CEIL(s.quantity / t.packing) > 0 -- FIXME: Column Cubos.box not included in view vn.packaging - /* AND p.box */; + /* AND p.box */ ; DROP TEMPORARY TABLE `filter`, @@ -14810,7 +14792,7 @@ BEGIN FROM vn.buy b JOIN vn.entry e ON e.id = b.entryFk JOIN vn.travel t ON t.id = e.travelFk - WHERE t.shipped BETWEEN vDateInv AND CURDATE() + WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() AND t.warehouseOutFk = vWarehouse AND NOT e.isRaid AND t.isDelivered @@ -14819,7 +14801,7 @@ BEGIN FROM vn.sale m JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticket = t.id - WHERE t.shipped BETWEEN vDateInv AND CURDATE() + WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() AND t.warehouseFk = vWarehouse AND s.alertLevel = 3 ) t @@ -14858,7 +14840,7 @@ BEGIN LEFT JOIN vn.packaging p ON p.id = t.packageFk WHERE CEIL(s.quantity / t.packing) > 0 -- FIXME: Column Cubos.box not included in view vn.packaging - /* AND p.box */; + /* AND p.box */ ; DROP TEMPORARY TABLE filter, @@ -15027,7 +15009,7 @@ BEGIN THEN CALL order_checkConfig(vSelf); - IF vStatus = 'OK' AND vCreated < TIMESTAMPADD(DAY, -1, NOW()) + IF vStatus = 'OK' AND vCreated < TIMESTAMPADD(DAY, -1, util.VN_NOW()) THEN CALL order_update(vSelf); SET vStatus = 'UPDATED'; @@ -15155,7 +15137,7 @@ BEGIN FROM orderConfig LIMIT 1; - SET vDate = TIMESTAMPADD(DAY, 1, CURDATE()); + SET vDate = TIMESTAMPADD(DAY, 1, util.VN_CURDATE()); IF WEEKDAY(vDate) BETWEEN 5 AND 6 THEN SET vDate = TIMESTAMPADD(DAY, 7 - WEEKDAY(vDate), vDate); @@ -15648,8 +15630,8 @@ BEGIN * @param vTo To date, if %NULL current date * @select The tickets list */ - SET vFrom = IFNULL(vFrom, DATE_FORMAT(TIMESTAMPADD(MONTH, -3, CURDATE()), '%Y-%m-01')); - SET vTo = IFNULL(vTo, TIMESTAMPADD(YEAR, 1, CURDATE())); + SET vFrom = IFNULL(vFrom, DATE_FORMAT(TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()), '%Y-%m-01')); + SET vTo = IFNULL(vTo, TIMESTAMPADD(YEAR, 1, util.VN_CURDATE())); DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket @@ -16292,7 +16274,7 @@ BEGIN IF vTicket IS NULL THEN - SET vShipment = IFNULL(vShipment, CURDATE()); + SET vShipment = IFNULL(vShipment, util.VN_CURDATE()); CALL vn.ticket_add( vClientId, @@ -16324,7 +16306,7 @@ BEGIN THEN INSERT INTO vn.ticketObservation SET ticketFk = vTicket, - observationTypeFk = 4 /* salesperson */, + observationTypeFk = 4 /* salesperson */ , `description` = vNotes ON DUPLICATE KEY UPDATE `description` = CONCAT(VALUES(`description`),'. ', `description`); @@ -16416,7 +16398,7 @@ BEGIN JOIN edi.floraHollandConfig fhc JOIN hedera.`order` o ON o.id = vOrder WHERE i.id = vItem - AND di.LatestOrderDateTime > NOW() + AND di.LatestOrderDateTime > util.VN_NOW() AND vAmount > @available LIMIT 1; @@ -16461,7 +16443,7 @@ BEGIN CALL util.throw ('ORDER_ALREADY_CONFIRMED'); END IF; - UPDATE `order` SET confirmed = TRUE, confirm_date = NOW() + UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW() WHERE id = vOrder; COMMIT; @@ -16835,7 +16817,7 @@ proc: BEGIN CALL vn.ticketCalculatePurge; END IF; - UPDATE `order` SET date_make = NOW() + UPDATE `order` SET date_make = util.VN_NOW() WHERE id = vSelf; COMMIT; @@ -17216,7 +17198,7 @@ BEGIN WHERE ssid = vSsid; DELETE FROM userSession - WHERE lastUpdate < TIMESTAMPADD(HOUR, -1, NOW()); + WHERE lastUpdate < TIMESTAMPADD(HOUR, -1, util.VN_NOW()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -17407,11 +17389,11 @@ CREATE TABLE `labourTree` ( `id` int(11) NOT NULL AUTO_INCREMENT, `lft` int(11) NOT NULL, `rgt` int(11) NOT NULL, - `depth` int(11) NOT NULL DEFAULT '0', - `sons` int(11) NOT NULL DEFAULT '0', + `depth` int(11) NOT NULL DEFAULT 0, + `sons` int(11) NOT NULL DEFAULT 0, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17428,7 +17410,7 @@ CREATE TABLE `nst` ( PRIMARY KEY (`id`), UNIQUE KEY `lft_UNIQUE` (`lft`), UNIQUE KEY `rgt_UNIQUE` (`rgt`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17829,7 +17811,7 @@ DROP TABLE IF EXISTS `cdr`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cdr` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `call_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `call_date` datetime NOT NULL DEFAULT current_timestamp(), `clid` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `src` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `dst` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -17838,10 +17820,10 @@ CREATE TABLE `cdr` ( `dst_channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `last_app` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `last_data` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `duration` int(11) NOT NULL DEFAULT '0', - `billsec` int(11) NOT NULL DEFAULT '0', + `duration` int(11) NOT NULL DEFAULT 0, + `billsec` int(11) NOT NULL DEFAULT 0, `disposition` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ama_flags` int(11) NOT NULL DEFAULT '0', + `ama_flags` int(11) NOT NULL DEFAULT 0, `account_code` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `unique_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `user_field` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -17852,7 +17834,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17895,7 +17877,7 @@ CREATE TABLE `config` ( `sundayFestive` tinyint(4) NOT NULL, `countryPrefix` varchar(20) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17985,7 +17967,7 @@ CREATE TABLE `followmeConfig` ( `declineCall` char(1) CHARACTER SET utf8 NOT NULL, `timeout` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18021,7 +18003,7 @@ CREATE TABLE `queue` ( UNIQUE KEY `description` (`description`), KEY `config` (`config`), CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`config`) REFERENCES `queueConfig` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18099,7 +18081,7 @@ CREATE TABLE `queueConfig` ( `maxLen` int(10) unsigned NOT NULL, `ringInUse` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18118,7 +18100,7 @@ CREATE TABLE `queueMember` ( KEY `extension` (`extension`), CONSTRAINT `queueMember_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `queueMember_ibfk_2` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18151,7 +18133,7 @@ CREATE TABLE `queuePhone` ( PRIMARY KEY (`id`), UNIQUE KEY `queue` (`queue`,`phone`), CONSTRAINT `queuePhone_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18210,7 +18192,7 @@ CREATE TABLE `schedule` ( PRIMARY KEY (`id`), KEY `queue` (`queue`), CONSTRAINT `schedule_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18221,7 +18203,7 @@ DROP TABLE IF EXISTS `sip`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sip` ( - `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The user id', + `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'The user id', `extension` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT 'The softphone extension', `md5Secret` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'MD5 hash of extension and password', `secret` varchar(80) CHARACTER SET utf8 DEFAULT NULL COMMENT 'Deprecated', @@ -18387,7 +18369,7 @@ CREATE TABLE `sipConfig` ( `dtlssetup` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `nat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18675,7 +18657,7 @@ CREATE TABLE `address` ( KEY `address_town_id_idx` (`town_id`), CONSTRAINT `address_ibfk_1` FOREIGN KEY (`address_type_id`) REFERENCES `address_type` (`address_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `address_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `townKk` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18689,7 +18671,7 @@ CREATE TABLE `address_type` ( `address_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, PRIMARY KEY (`address_type_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18723,7 +18705,7 @@ CREATE TABLE `bank_account` ( CONSTRAINT `bank_account_client_id` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE, CONSTRAINT `bank_account_nation_id` FOREIGN KEY (`nation_id`) REFERENCES `vn`.`country` (`id`) ON UPDATE CASCADE, CONSTRAINT `bank_account_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18737,7 +18719,7 @@ CREATE TABLE `bank_account_type` ( `bank_account_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` char(15) DEFAULT NULL, PRIMARY KEY (`bank_account_type_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18771,7 +18753,7 @@ CREATE TABLE `business` ( `provider_id` int(11) DEFAULT NULL, `date_start` date DEFAULT NULL, `date_end` date DEFAULT NULL, - `workerBusiness` longtext, + `workerBusiness` longtext DEFAULT NULL, `reasonEndFk` int(11) DEFAULT NULL, `payedHolidays` int(11) DEFAULT NULL, `occupationCodeFk` varchar(1) DEFAULT NULL, @@ -18835,12 +18817,12 @@ DROP TABLE IF EXISTS `business_labour`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `business_labour` ( `business_id` int(11) NOT NULL, - `notes` longtext, + `notes` longtext DEFAULT NULL, `department_id` int(11) NOT NULL, - `professional_category_id` int(11) DEFAULT '0', - `incentivo` double DEFAULT '0', - `calendar_labour_type_id` int(11) DEFAULT '1', - `porhoras` smallint(6) NOT NULL DEFAULT '0', + `professional_category_id` int(11) DEFAULT 0, + `incentivo` double DEFAULT 0, + `calendar_labour_type_id` int(11) DEFAULT 1, + `porhoras` smallint(6) NOT NULL DEFAULT 0, `labour_agreement_id` int(11) DEFAULT NULL, `workcenter_id` int(11) NOT NULL, PRIMARY KEY (`business_id`), @@ -18868,7 +18850,7 @@ CREATE TABLE `business_labour_payroll` ( `cod_tarifa` int(11) DEFAULT NULL, `cod_categoria` int(11) DEFAULT NULL, `cod_contrato` int(11) DEFAULT NULL, - `importepactado` decimal(10,2) NOT NULL DEFAULT '0.00', + `importepactado` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`business_id`), KEY `business_labour_payroll_cod_categoria_idx` (`cod_categoria`), KEY `business_labour_payroll_FK` (`cod_contrato`), @@ -18906,7 +18888,7 @@ CREATE TABLE `calendar_free__` ( `type` varchar(20) NOT NULL, `rgb` varchar(7) DEFAULT NULL, PRIMARY KEY (`calendar_free_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18932,7 +18914,7 @@ CREATE TABLE `calendar_labour__` ( CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free__` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend__` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18944,10 +18926,10 @@ DROP TABLE IF EXISTS `calendar_labour_legend__`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_labour_legend__` ( `calendar_labour_legend_id` int(11) NOT NULL AUTO_INCREMENT, - `descripcion` longtext, + `descripcion` longtext DEFAULT NULL, PRIMARY KEY (`calendar_labour_legend_id`), UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18962,7 +18944,7 @@ CREATE TABLE `calendar_labour_type` ( `descripcion` varchar(50) DEFAULT NULL, `pausa_remunerada` time DEFAULT NULL, `hours_week` smallint(6) DEFAULT NULL, - `isPartial` tinyint(1) NOT NULL DEFAULT '0', + `isPartial` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`calendar_labour_type_id`), UNIQUE KEY `hours_labour_hours_labour_id_key` (`calendar_labour_type_id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8; @@ -18979,13 +18961,13 @@ CREATE TABLE `calendar_state` ( `calendar_state_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(30) NOT NULL, `rgb` varchar(7) NOT NULL, - `color` bigint(20) DEFAULT '0', + `color` bigint(20) DEFAULT 0, `permissionRate` decimal(3,2) DEFAULT NULL, `code` varchar(45) DEFAULT NULL, - `isAllowedToWork` tinyint(4) NOT NULL DEFAULT '0', - `isPrintable` tinyint(1) NOT NULL DEFAULT '0', + `isAllowedToWork` tinyint(4) NOT NULL DEFAULT 0, + `isPrintable` tinyint(1) NOT NULL DEFAULT 0, `discountRate` decimal(3,2) DEFAULT NULL, - `holidayEntitlementRate` decimal(3,2) DEFAULT '1.00', + `holidayEntitlementRate` decimal(3,2) DEFAULT 1.00, PRIMARY KEY (`calendar_state_id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19001,7 +18983,7 @@ CREATE TABLE `currency__` ( `currency_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`currency_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19028,18 +19010,18 @@ DROP TABLE IF EXISTS `income_employee`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `income_employee` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `debe` decimal(10,2) NOT NULL DEFAULT '0.00', - `haber` decimal(10,2) NOT NULL DEFAULT '0.00', + `debe` decimal(10,2) NOT NULL DEFAULT 0.00, + `haber` decimal(10,2) NOT NULL DEFAULT 0.00, `id_incomeType` int(11) DEFAULT NULL, `odbc_date` date DEFAULT NULL, `person_id` int(11) DEFAULT NULL, - `concepto` longtext, + `concepto` longtext DEFAULT NULL, PRIMARY KEY (`id`), KEY `fperson_id` (`person_id`), KEY `income_employeeId_incomeType_idx` (`id_incomeType`), CONSTRAINT `income_employeeId_incomeType` FOREIGN KEY (`id_incomeType`) REFERENCES `vn2008`.`payroll_conceptos` (`conceptoid`) ON UPDATE CASCADE, CONSTRAINT `income_employee_FK` FOREIGN KEY (`person_id`) REFERENCES `vn`.`person` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19052,8 +19034,8 @@ DROP TABLE IF EXISTS `incometype_employee`; CREATE TABLE `incometype_employee` ( `id_incometype` int(11) NOT NULL, `descripcion` varchar(255) DEFAULT NULL, - `nomina` smallint(6) DEFAULT '0', - `isExtraSalarial` tinyint(4) NOT NULL DEFAULT '0', + `nomina` smallint(6) DEFAULT 0, + `isExtraSalarial` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id_incometype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19067,7 +19049,7 @@ DROP TABLE IF EXISTS `journey`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `journey` ( `journey_id` int(11) NOT NULL AUTO_INCREMENT, - `day_id` smallint(6) NOT NULL DEFAULT '1' COMMENT 'Lunes = 1 \nDomingo = 7', + `day_id` smallint(6) NOT NULL DEFAULT 1 COMMENT 'Lunes = 1 \nDomingo = 7', `start` time DEFAULT NULL, `end` time DEFAULT NULL, `business_id` int(11) NOT NULL, @@ -19075,7 +19057,7 @@ CREATE TABLE `journey` ( UNIQUE KEY `day_id` (`day_id`,`start`,`end`,`business_id`), KEY `fki_business_journey` (`business_id`), CONSTRAINT `business_journey` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19138,15 +19120,15 @@ DROP TABLE IF EXISTS `nation__`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nation__` ( `nation_id` int(11) NOT NULL AUTO_INCREMENT, - `currency_id` int(11) NOT NULL DEFAULT '1', + `currency_id` int(11) NOT NULL DEFAULT 1, `name` varchar(20) NOT NULL, `brief` char(3) NOT NULL, - `flag` longblob, + `flag` longblob DEFAULT NULL, PRIMARY KEY (`nation_id`), UNIQUE KEY `nation_name_key` (`name`), KEY `nation_currency_id_idx` (`currency_id`), CONSTRAINT `nation___ibfk_1` FOREIGN KEY (`currency_id`) REFERENCES `currency__` (`currency_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19202,12 +19184,12 @@ CREATE TABLE `person__` ( `nif` varchar(15) DEFAULT NULL, `birth` date DEFAULT NULL, `firstname` varchar(20) DEFAULT NULL, - `p2` longtext, + `p2` longtext DEFAULT NULL, `nis` int(11) DEFAULT NULL, `id_trabajador` int(10) unsigned DEFAULT NULL, - `isDisable` smallint(6) NOT NULL DEFAULT '0', - `isFreelance` smallint(6) NOT NULL DEFAULT '0' COMMENT 'M Male\nF Female', - `isSsDiscounted` smallint(6) NOT NULL DEFAULT '0', + `isDisable` smallint(6) NOT NULL DEFAULT 0, + `isFreelance` smallint(6) NOT NULL DEFAULT 0 COMMENT 'M Male\nF Female', + `isSsDiscounted` smallint(6) NOT NULL DEFAULT 0, `sex` enum('M','F') NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', PRIMARY KEY (`person_id`), UNIQUE KEY `person_nis` (`person_id`), @@ -19217,7 +19199,7 @@ CREATE TABLE `person__` ( KEY `index1` (`person_id`,`name`,`nickname`,`firstname`), KEY `person_worker` (`id_trabajador`), CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`id_trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19231,7 +19213,7 @@ CREATE TABLE `professional_category` ( `professional_category_id` int(11) NOT NULL AUTO_INCREMENT, `category_name` varchar(50) NOT NULL, `professional_levels_id` int(11) DEFAULT NULL, - `fichajes` tinyint(4) NOT NULL DEFAULT '1', + `fichajes` tinyint(4) NOT NULL DEFAULT 1, `holiday_days` decimal(3,1) DEFAULT NULL, `dayBreak` int(11) DEFAULT NULL, PRIMARY KEY (`professional_category_id`), @@ -19251,7 +19233,7 @@ CREATE TABLE `professional_levels` ( `level_name` varchar(5) DEFAULT NULL, `price_overtime` double DEFAULT NULL, PRIMARY KEY (`professional_levels_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19264,7 +19246,7 @@ DROP TABLE IF EXISTS `profile`; CREATE TABLE `profile` ( `profile_id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL, - `profile_type_id` int(11) NOT NULL DEFAULT '1', + `profile_type_id` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`profile_id`), KEY `profile_person_id_idx` (`person_id`), KEY `profile_profile_type_id_idx` (`profile_type_id`), @@ -19286,7 +19268,7 @@ CREATE TABLE `profile_address` ( PRIMARY KEY (`profile_address_id`), KEY `profile_address_address_id_idx` (`address_id`), KEY `profile_address_profile_id_idx` (`profile_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19337,7 +19319,7 @@ CREATE TABLE `province` ( UNIQUE KEY `province_name_key` (`name`), KEY `province_nation_id_idx` (`nation_id`), CONSTRAINT `fk_province_nation1` FOREIGN KEY (`nation_id`) REFERENCES `nation__` (`nation_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19355,7 +19337,7 @@ CREATE TABLE `townKk` ( PRIMARY KEY (`town_id`), KEY `town_province_id_idx` (`province_id`), CONSTRAINT `townKk_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19367,7 +19349,7 @@ DROP TABLE IF EXISTS `workcenter`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workcenter` ( `workcenter_id` int(11) NOT NULL AUTO_INCREMENT, - `name` longtext, + `name` longtext DEFAULT NULL, `center_id` int(11) DEFAULT NULL, `counter` bigint(20) DEFAULT NULL, `warehouseFk` smallint(6) DEFAULT NULL, @@ -19404,7 +19386,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasAbril` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -19412,7 +19394,7 @@ CREATE TABLE `workers20190711_FichadasAbril` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19477,16 +19459,16 @@ DROP TABLE IF EXISTS `Naciones`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Naciones` ( `countryFk` mediumint(8) NOT NULL, - `CodigoNacion` smallint(6) NOT NULL DEFAULT '108', - `CodigoNacion347` smallint(6) NOT NULL DEFAULT '108', + `CodigoNacion` smallint(6) NOT NULL DEFAULT 108, + `CodigoNacion347` smallint(6) NOT NULL DEFAULT 108, `Nacion` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `SiglaNacion` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ES', `TipoCodigo` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT 'A', - `Longitud1` tinyint(4) NOT NULL DEFAULT '0', - `Longitud2` tinyint(4) NOT NULL DEFAULT '0', - `Longitud3` tinyint(4) NOT NULL DEFAULT '0', - `Longitud4` tinyint(4) NOT NULL DEFAULT '0', - `NacionCEE` smallint(6) NOT NULL DEFAULT '0', + `Longitud1` tinyint(4) NOT NULL DEFAULT 0, + `Longitud2` tinyint(4) NOT NULL DEFAULT 0, + `Longitud3` tinyint(4) NOT NULL DEFAULT 0, + `Longitud4` tinyint(4) NOT NULL DEFAULT 0, + `NacionCEE` smallint(6) NOT NULL DEFAULT 0, `FechaCEE` datetime DEFAULT NULL, `NacionISO` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`countryFk`,`CodigoNacion`) @@ -19505,7 +19487,7 @@ CREATE TABLE `Provincias` ( `CodigoProvincia` varchar(5) NOT NULL DEFAULT '', `CodigoMatricula` varchar(2) NOT NULL DEFAULT '', `Provincia` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `RecargoProvincial` decimal(28,10) NOT NULL DEFAULT '0.0000000000', + `RecargoProvincial` decimal(28,10) NOT NULL DEFAULT 0.0000000000, PRIMARY KEY (`CodigoProvincia`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19518,12 +19500,12 @@ DROP TABLE IF EXISTS `TiposIva`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `TiposIva` ( - `CodigoIva` smallint(6) NOT NULL DEFAULT '0', - `CodigoTerritorio` smallint(6) NOT NULL DEFAULT '0', + `CodigoIva` smallint(6) NOT NULL DEFAULT 0, + `CodigoTerritorio` smallint(6) NOT NULL DEFAULT 0, `Iva` varchar(30) NOT NULL DEFAULT '', - `BaseCorrectora` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `PorcentajeIva` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `RecargoEquivalencia` decimal(28,10) NOT NULL DEFAULT '0.0000000000', + `BaseCorrectora` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `PorcentajeIva` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `RecargoEquivalencia` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `CuentaIvaSoportado` varchar(15) NOT NULL DEFAULT '', `CuentaIvaRepercutido` varchar(15) NOT NULL DEFAULT '', `CuentaRecargo` varchar(15) NOT NULL DEFAULT '', @@ -19542,8 +19524,8 @@ CREATE TABLE `TiposIva` ( `CuentaIVARecCaja` varchar(15) NOT NULL DEFAULT '', `CuentaIVARecCajaPu` varchar(15) NOT NULL DEFAULT '', `CuentaIVARecCajaVen` varchar(15) NOT NULL DEFAULT '', - `IGICImplicito` smallint(6) NOT NULL DEFAULT '0', - `isIntracommunity` tinyint(2) NOT NULL DEFAULT '0', + `IGICImplicito` smallint(6) NOT NULL DEFAULT 0, + `isIntracommunity` tinyint(2) NOT NULL DEFAULT 0, PRIMARY KEY (`CodigoIva`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19556,9 +19538,9 @@ DROP TABLE IF EXISTS `TiposRetencion`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `TiposRetencion` ( - `CodigoRetencion` smallint(6) NOT NULL DEFAULT '0', + `CodigoRetencion` smallint(6) NOT NULL DEFAULT 0, `Retencion` varchar(50) NOT NULL DEFAULT '', - `PorcentajeRetencion` decimal(28,10) NOT NULL DEFAULT '0.0000000000', + `PorcentajeRetencion` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `CuentaCargo` varchar(15) DEFAULT NULL, `CuentaAbono` varchar(15) DEFAULT NULL, `ClaveIrpf` varchar(2) DEFAULT NULL, @@ -19577,10 +19559,10 @@ DROP TABLE IF EXISTS `TiposTransacciones`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `TiposTransacciones` ( - `CodigoTransaccion` tinyint(4) NOT NULL DEFAULT '0', + `CodigoTransaccion` tinyint(4) NOT NULL DEFAULT 0, `Transaccion` varchar(50) NOT NULL DEFAULT '', `TipoFactura` varchar(1) NOT NULL DEFAULT '', - `Autofactura` smallint(6) NOT NULL DEFAULT '0', + `Autofactura` smallint(6) NOT NULL DEFAULT 0, `ClaveOperacionDefecto` varchar(1) NOT NULL DEFAULT '', PRIMARY KEY (`CodigoTransaccion`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -19636,31 +19618,31 @@ CREATE TABLE `clientesProveedores` ( `ColaMunicipio` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoProvincia` varchar(5) COLLATE utf8_unicode_ci NOT NULL, `Provincia` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `CodigoNacion` smallint(6) NOT NULL DEFAULT '0', + `CodigoNacion` smallint(6) NOT NULL DEFAULT 0, `Nacion` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `Telefono` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `Telefono2` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `Telefono3` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `Fax` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoTransaccion` tinyint(4) NOT NULL DEFAULT '0', + `CodigoTransaccion` tinyint(4) NOT NULL DEFAULT 0, `CodigoRetencion` smallint(6) NOT NULL, - `Deducible` smallint(6) NOT NULL DEFAULT '0', - `CodigoIva` smallint(6) NOT NULL DEFAULT '0', - `Mediacion` smallint(6) NOT NULL DEFAULT '0', - `Exclusion347` smallint(6) NOT NULL DEFAULT '0', - `NumeroPlazos` tinyint(4) NOT NULL DEFAULT '1', - `DiasPrimerPlazo` smallint(6) NOT NULL DEFAULT '0', - `DiasEntrePlazos` smallint(6) NOT NULL DEFAULT '0', - `DiasFijos1` tinyint(4) NOT NULL DEFAULT '0', - `DiasFijos2` tinyint(4) NOT NULL DEFAULT '0', - `DiasFijos3` tinyint(4) NOT NULL DEFAULT '0', - `InicioNoPago` smallint(6) NOT NULL DEFAULT '0', - `FinNoPago` smallint(6) NOT NULL DEFAULT '0', - `ControlarFestivos` smallint(6) NOT NULL DEFAULT '0', - `DiasRetroceso` tinyint(4) NOT NULL DEFAULT '0', - `MesesComerciales` smallint(6) NOT NULL DEFAULT '0', + `Deducible` smallint(6) NOT NULL DEFAULT 0, + `CodigoIva` smallint(6) NOT NULL DEFAULT 0, + `Mediacion` smallint(6) NOT NULL DEFAULT 0, + `Exclusion347` smallint(6) NOT NULL DEFAULT 0, + `NumeroPlazos` tinyint(4) NOT NULL DEFAULT 1, + `DiasPrimerPlazo` smallint(6) NOT NULL DEFAULT 0, + `DiasEntrePlazos` smallint(6) NOT NULL DEFAULT 0, + `DiasFijos1` tinyint(4) NOT NULL DEFAULT 0, + `DiasFijos2` tinyint(4) NOT NULL DEFAULT 0, + `DiasFijos3` tinyint(4) NOT NULL DEFAULT 0, + `InicioNoPago` smallint(6) NOT NULL DEFAULT 0, + `FinNoPago` smallint(6) NOT NULL DEFAULT 0, + `ControlarFestivos` smallint(6) NOT NULL DEFAULT 0, + `DiasRetroceso` tinyint(4) NOT NULL DEFAULT 0, + `MesesComerciales` smallint(6) NOT NULL DEFAULT 0, `RemesaHabitual` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoTipoEfecto` smallint(6) NOT NULL DEFAULT '0', + `CodigoTipoEfecto` smallint(6) NOT NULL DEFAULT 0, `Email1` varchar(250) COLLATE utf8_unicode_ci NOT NULL, `Email2` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoCategoriaCliente_` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'CLI', @@ -19673,25 +19655,25 @@ CREATE TABLE `clientesProveedores` ( `DC` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CCC` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `IBAN` varchar(34) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCondiciones` smallint(6) NOT NULL DEFAULT '0', - `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT '0', - `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT '2', - `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT '2', + `CodigoCondiciones` smallint(6) NOT NULL DEFAULT 0, + `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT 0, + `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT 2, + `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT 2, `Contrapartida` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoCuentaImpagado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoCuentaEfecto` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `Comentarios` text COLLATE utf8_unicode_ci NOT NULL, - `CodigoTerritorio` smallint(6) NOT NULL DEFAULT '0', + `CodigoTerritorio` smallint(6) NOT NULL DEFAULT 0, `CodigoIdioma_` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `TarifaPrecio` smallint(6) NOT NULL DEFAULT '0', - `%Descuento` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `%Rappel` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `%ProntoPago` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `%Financiacion` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `CodigoComisionista` int(11) NOT NULL DEFAULT '0', - `TarifaDescuento` smallint(6) NOT NULL DEFAULT '0', + `TarifaPrecio` smallint(6) NOT NULL DEFAULT 0, + `%Descuento` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `%Rappel` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `%ProntoPago` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `%Financiacion` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `CodigoComisionista` int(11) NOT NULL DEFAULT 0, + `TarifaDescuento` smallint(6) NOT NULL DEFAULT 0, `SiglaNacion` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `MarcaMenorSinNif` smallint(6) NOT NULL DEFAULT '0', + `MarcaMenorSinNif` smallint(6) NOT NULL DEFAULT 0, `PersonaFisicaJuridica` varchar(1) COLLATE utf8_unicode_ci NOT NULL, `SiglaNacionRepresentante` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CifDniRepresentante` varchar(13) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -19699,12 +19681,12 @@ CREATE TABLE `clientesProveedores` ( `TipoDocumentoPersona` smallint(6) NOT NULL, `TipoCif` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `MotivoBajaClienteLc` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `PuntosSR` decimal(28,10) NOT NULL DEFAULT '0.0000000000', + `PuntosSR` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `TarjetaSR` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `FechaNacimiento` datetime DEFAULT NULL, `Domicilio2` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CuentaProvision` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoTransportista` int(11) NOT NULL DEFAULT '0', + `CodigoTransportista` int(11) NOT NULL DEFAULT 0, `FormadePago` varchar(35) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `ObservacionesCliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoTipoClienteLc` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -19716,14 +19698,14 @@ CREATE TABLE `clientesProveedores` ( `NombreEmpleado` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `PrimerApellidoEmpleado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `SegundoApellidoEmpleado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `sysTick` int(11) NOT NULL DEFAULT '0', - `RiesgoMaximo` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `PlazoMedioPCMA` smallint(6) NOT NULL DEFAULT '0', - `CriterioIvaIME` smallint(6) NOT NULL DEFAULT '0', + `sysTick` int(11) NOT NULL DEFAULT 0, + `RiesgoMaximo` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `PlazoMedioPCMA` smallint(6) NOT NULL DEFAULT 0, + `CriterioIvaIME` smallint(6) NOT NULL DEFAULT 0, `ReferenciaMandato` varchar(35) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `%Comision` decimal(28,10) NOT NULL DEFAULT '0.0000000000', - `CodigoZona` int(11) NOT NULL DEFAULT '0', - `BloqueoAlbaran` smallint(6) NOT NULL DEFAULT '0', + `%Comision` decimal(28,10) NOT NULL DEFAULT 0.0000000000, + `CodigoZona` int(11) NOT NULL DEFAULT 0, + `BloqueoAlbaran` smallint(6) NOT NULL DEFAULT 0, `CodigoSeccion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoSector_` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `CodigoProyecto` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -19783,7 +19765,7 @@ CREATE TABLE `movContaIVA` ( `CuotaIva1` double DEFAULT NULL, `PorRecargoEquivalencia1` double DEFAULT NULL, `RecargoEquivalencia1` double DEFAULT NULL, - `CodigoTransaccion1` double NOT NULL DEFAULT '0', + `CodigoTransaccion1` double NOT NULL DEFAULT 0, `CodigoIva1` smallint(6) NOT NULL, `BaseIva2` double DEFAULT NULL, `PorBaseCorrectora2` double DEFAULT NULL, @@ -19791,7 +19773,7 @@ CREATE TABLE `movContaIVA` ( `CuotaIva2` double DEFAULT NULL, `PorRecargoEquivalencia2` double DEFAULT NULL, `RecargoEquivalencia2` double DEFAULT NULL, - `CodigoTransaccion2` double NOT NULL DEFAULT '0', + `CodigoTransaccion2` double NOT NULL DEFAULT 0, `CodigoIva2` smallint(6) NOT NULL, `BaseIva3` double DEFAULT NULL, `PorBaseCorrectora3` double DEFAULT NULL, @@ -19799,7 +19781,7 @@ CREATE TABLE `movContaIVA` ( `CuotaIva3` double DEFAULT NULL, `PorRecargoEquivalencia3` double DEFAULT NULL, `RecargoEquivalencia3` double DEFAULT NULL, - `CodigoTransaccion3` double NOT NULL DEFAULT '0', + `CodigoTransaccion3` double NOT NULL DEFAULT 0, `CodigoIva3` smallint(6) NOT NULL, `BaseIva4` double DEFAULT NULL, `PorBaseCorrectora4` double DEFAULT NULL, @@ -19807,7 +19789,7 @@ CREATE TABLE `movContaIVA` ( `CuotaIva4` double DEFAULT NULL, `PorRecargoEquivalencia4` double DEFAULT NULL, `RecargoEquivalencia4` double DEFAULT NULL, - `CodigoTransaccion4` double NOT NULL DEFAULT '0', + `CodigoTransaccion4` double NOT NULL DEFAULT 0, `CodigoIva4` smallint(6) NOT NULL, `Año` int(11) DEFAULT NULL, `Serie` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -19827,7 +19809,7 @@ CREATE TABLE `movContaIVA` ( `EjercicioFactura` int(2) DEFAULT NULL, `FechaOperacion` date DEFAULT NULL, `Exclusion347` int(2) DEFAULT NULL, - `MantenerAsiento` int(2) DEFAULT '-1', + `MantenerAsiento` int(2) DEFAULT -1, `Metalico347` int(2) DEFAULT NULL, `ClaveOperacionFactura` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `TipoRectificativa` int(2) DEFAULT NULL, @@ -19837,13 +19819,13 @@ CREATE TABLE `movContaIVA` ( `ClaseAbonoRectificativas` int(2) DEFAULT NULL, `RecargoEquivalenciaOriginal` double DEFAULT NULL, `LibreA1` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `IvaDeducible1` int(2) NOT NULL DEFAULT '-1', - `IvaDeducible2` int(2) NOT NULL DEFAULT '-1', - `IvaDeducible3` int(2) NOT NULL DEFAULT '-1', - `IvaDeducible4` int(2) NOT NULL DEFAULT '-1', + `IvaDeducible1` int(2) NOT NULL DEFAULT -1, + `IvaDeducible2` int(2) NOT NULL DEFAULT -1, + `IvaDeducible3` int(2) NOT NULL DEFAULT -1, + `IvaDeducible4` int(2) NOT NULL DEFAULT -1, `FechaGrabacion` date DEFAULT NULL, - `Intracomunitaria` tinyint(1) DEFAULT '0', - `moveData` tinyint(1) DEFAULT '1', + `Intracomunitaria` tinyint(1) DEFAULT 0, + `moveData` tinyint(1) DEFAULT 1, PRIMARY KEY (`id`), CONSTRAINT `movContaIVA_fk1` FOREIGN KEY (`id`) REFERENCES `vn`.`XDiario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Informa del valor de los campos de IVA para enlazar en la tabla vn.movConta'; @@ -19863,7 +19845,7 @@ CREATE TABLE `pgcToSage` ( `accountTaxInput` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `accountTaxOutput` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Tabla relaciona cuentas pgc con Código de IVA y Código de Transacción en Sage'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tabla relaciona cuentas pgc con Código de IVA y Código de Transacción en Sage'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19879,16 +19861,16 @@ CREATE TABLE `planCuentasPGC` ( `Cuenta` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `ClienteOProveedor` varchar(1) COLLATE utf8_unicode_ci NOT NULL, `CodigoDivisa` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `IndicadorProrrata` smallint(6) NOT NULL DEFAULT '0', - `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT '2', - `StatusAnalitica` smallint(6) NOT NULL DEFAULT '0', + `IndicadorProrrata` smallint(6) NOT NULL DEFAULT 0, + `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT 2, + `StatusAnalitica` smallint(6) NOT NULL DEFAULT 0, `AnaCodigoCuenta` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT '0', - `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT '0', - `CierrePatrimonio_` smallint(6) NOT NULL DEFAULT '0', + `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT 0, + `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT 0, + `CierrePatrimonio_` smallint(6) NOT NULL DEFAULT 0, `CuentaPatrimonio_` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CuentaVarios` smallint(6) NOT NULL DEFAULT '0', - `TodasLasActividades` smallint(6) NOT NULL DEFAULT '0', + `CuentaVarios` smallint(6) NOT NULL DEFAULT 0, + `TodasLasActividades` smallint(6) NOT NULL DEFAULT 0, `ValorDelegacion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `ValorDepartamento` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `ValorProyecto` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', @@ -21971,7 +21953,7 @@ BEGIN /* Copia en movConta los asientos de XDiario para que luego los importe el proceso automático que hay en SQL Server */ DECLARE vDated DATE; - SELECT CONCAT(YEAR(CURDATE()), "-01-01") INTO vDated; + SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; SELECT "2021-01-01" INTO vDated; TRUNCATE XDiario_movConta_IVA; DELETE FROM movConta WHERE enlazadoSage = FALSE AND Asiento <> 1 ; @@ -22663,7 +22645,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SELECT CONCAT(YEAR(CURDATE()), "-01-01") INTO vDated; + SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; SELECT "2021-01-01" INTO vDated; DROP TEMPORARY TABLE IF EXISTS tmp.invoiceDua; CREATE TEMPORARY TABLE tmp.invoiceDua @@ -23113,7 +23095,7 @@ BEGIN ) x ON x.refFk = io.ref; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SELECT CONCAT(YEAR(CURDATE()), "-01-01") INTO vDated; + SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; SELECT "2021-01-01" INTO vDated; OPEN rs; FETCH rs INTO vInvoiceFk, vXDiarioFk; @@ -23526,10 +23508,10 @@ CREATE TABLE `userConfigView` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `tableCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `configuration` text COLLATE utf8_unicode_ci, + `configuration` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23560,7 +23542,7 @@ CREATE TABLE `inbound` ( `tableName` set('buy','sale') NOT NULL, `tableId` int(10) unsigned NOT NULL, `isSync` tinyint(4) NOT NULL, - `isPicked` tinyint(4) NOT NULL DEFAULT '0', + `isPicked` tinyint(4) NOT NULL DEFAULT 0, `warehouseFk` int(10) unsigned NOT NULL, `itemFk` int(10) unsigned NOT NULL, `dated` datetime NOT NULL, @@ -23586,7 +23568,7 @@ DELIMITER ;; BEFORE INSERT ON `inbound` FOR EACH ROW BEGIN - SET NEW.isPicked = NEW.isPicked OR NEW.dated < CURDATE(); + SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); CALL visible_log( NEW.isPicked, @@ -23681,7 +23663,7 @@ CREATE TABLE `outbound` ( `tableName` set('sale','buy','orderRow') NOT NULL, `tableId` int(10) unsigned NOT NULL, `isSync` tinyint(3) unsigned NOT NULL, - `isPicked` tinyint(4) NOT NULL DEFAULT '0', + `isPicked` tinyint(4) NOT NULL DEFAULT 0, `warehouseFk` int(10) unsigned NOT NULL, `itemFk` int(10) unsigned NOT NULL, `dated` datetime NOT NULL, @@ -23710,7 +23692,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.lack = NEW.quantity; - SET NEW.isPicked = NEW.isPicked OR NEW.dated < CURDATE(); + SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); CALL visible_log( NEW.isPicked, @@ -24134,7 +24116,7 @@ proc: BEGIN WHERE b.id = vNewId AND w.isBuyerToBeEmailed; - IF vLanded = CURDATE() THEN + IF vLanded = util.VN_CURDATE() THEN SELECT it.workerFk, b.entryFk, i.id, i.longName INTO vBuyerFk, vEntryFk, vItemFk, vItemName @@ -24357,7 +24339,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `log_refreshOrder`( `vTableId` INT) BEGIN DECLARE vExpireTime INT DEFAULT 20; - DECLARE vExpired DATETIME DEFAULT TIMESTAMPADD(MINUTE, -vExpireTime, NOW()); + DECLARE vExpired DATETIME DEFAULT TIMESTAMPADD(MINUTE, -vExpireTime, util.VN_NOW()); DROP TEMPORARY TABLE IF EXISTS tValues; CREATE TEMPORARY TABLE tValues @@ -24561,7 +24543,7 @@ proc: BEGIN -- Deletes expired outbounds - DELETE FROM outbound WHERE expired <= NOW(); + DELETE FROM outbound WHERE expired <= util.VN_NOW(); -- Attaches desync inbounds @@ -24848,7 +24830,8 @@ DELIMITER ; -- Current Database: `util` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `util` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +CREATE SCHEMA IF NOT EXISTS `util`; USE `util`; @@ -24862,7 +24845,7 @@ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `dbVersion` char(11) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current database version', - `hasTriggersDisabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Defines if triggers are disabled', + `hasTriggersDisabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Defines if triggers are disabled', `environment` varchar(45) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current Database environment', `lastDump` datetime DEFAULT NULL COMMENT 'Timestamp of the last data dump', PRIMARY KEY (`id`) @@ -24878,7 +24861,7 @@ DROP TABLE IF EXISTS `debug`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `debug` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `connectionId` int(10) unsigned DEFAULT NULL, `user` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `host` varchar(255) CHARACTER SET utf8 DEFAULT NULL, @@ -24886,7 +24869,7 @@ CREATE TABLE `debug` ( `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `created` (`created`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25079,7 +25062,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `dayEnd` */; +/*!50003 DROP FUNCTION IF EXISTS `dayend` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -25315,7 +25298,7 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `midnight`() RETURNS datetime READS SQL DATA BEGIN - RETURN TIMESTAMP(CURDATE(), '23:59:59'); + RETURN TIMESTAMP(util.VN_CURDATE(), '23:59:59'); END ;; DELIMITER ; @@ -25425,12 +25408,12 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `today`() RETURNS date BEGIN /** * Devuelve la fecha actual. Usar en lugar de la función nativa - * CURDATE() en aquellos que se necesite rendimiento ya que la + * util.VN_CURDATE() en aquellos que se necesite rendimiento ya que la * la última no es determinista. * * @return La fecha actual */ - RETURN CURDATE(); + RETURN util.VN_CURDATE(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25455,7 +25438,7 @@ BEGIN * * @return La fecha de mañana */ - RETURN TIMESTAMPADD(DAY, 1, CURDATE()); + RETURN TIMESTAMPADD(DAY, 1, util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25480,7 +25463,7 @@ BEGIN * * @return La fecha de antes de ayer */ - RETURN TIMESTAMPADD(DAY, -2, CURDATE()); + RETURN TIMESTAMPADD(DAY, -2, util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25507,7 +25490,7 @@ BEGIN * @param vYear Año a evaluar * @return La posicion relativa del año */ - DECLARE vCurYear INT DEFAULT YEAR(CURDATE()); + DECLARE vCurYear INT DEFAULT YEAR(util.VN_CURDATE()); IF vYear = vCurYear THEN RETURN 'curYear'; @@ -25546,7 +25529,7 @@ BEGIN * * @return La fecha de ayer */ - RETURN TIMESTAMPADD(DAY, -1, CURDATE()); + RETURN TIMESTAMPADD(DAY, -1, util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25945,7 +25928,7 @@ BEGIN RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; DELETE FROM `mysql`.`slow_log_temp` - WHERE start_time < TIMESTAMPADD(WEEK, -1, NOW()); + WHERE start_time < TIMESTAMPADD(WEEK, -1, util.VN_NOW()); RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; SET GLOBAL slow_query_log = vSlowQueryLog; @@ -26073,7 +26056,7 @@ CREATE TABLE `XDiario` ( `FACTURA` varchar(8) COLLATE utf8_unicode_ci DEFAULT '0', `BASEIMPO` decimal(10,2) DEFAULT NULL, `IVA` decimal(10,2) DEFAULT NULL, - `RECEQUIV` decimal(10,2) DEFAULT '0.00', + `RECEQUIV` decimal(10,2) DEFAULT 0.00, `DOCUMENTO` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `DEPARTA` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `CLAVE` int(11) DEFAULT NULL, @@ -26091,24 +26074,24 @@ CREATE TABLE `XDiario` ( `CODDIVISA` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, `IMPAUXME` decimal(10,2) DEFAULT NULL, `MONEDAUSO` varchar(1) COLLATE utf8_unicode_ci DEFAULT '2', - `NOCONV` tinyint(1) NOT NULL DEFAULT '0', + `NOCONV` tinyint(1) NOT NULL DEFAULT 0, `NUMEROINV` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `NFACTICK` tinyint(1) NOT NULL DEFAULT '1', - `TERIDNIF` tinyint(1) NOT NULL DEFAULT '2', + `NFACTICK` tinyint(1) NOT NULL DEFAULT 1, + `TERIDNIF` tinyint(1) NOT NULL DEFAULT 2, `TERNIF` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'I.F.', `TERNOM` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Nombre Importador', - `OPBIENES` tinyint(1) NOT NULL DEFAULT '1', + `OPBIENES` tinyint(1) NOT NULL DEFAULT 1, `TIPOFAC` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `TIPOIVA` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `L340` tinyint(2) NOT NULL DEFAULT '0', - `enlazado` tinyint(1) NOT NULL DEFAULT '0', + `L340` tinyint(2) NOT NULL DEFAULT 0, + `enlazado` tinyint(1) NOT NULL DEFAULT 0, `FECHA_EX` date DEFAULT NULL COMMENT 'FEcha de expedicion de la factura', - `LRECT349` tinyint(1) NOT NULL DEFAULT '0', - `empresa_id` smallint(5) unsigned NOT NULL DEFAULT '442', - `LDIFADUAN` tinyint(4) NOT NULL DEFAULT '0', - `METAL` tinyint(1) NOT NULL DEFAULT '0', - `METALIMP` decimal(10,2) NOT NULL DEFAULT '0.00', + `LRECT349` tinyint(1) NOT NULL DEFAULT 0, + `empresa_id` smallint(5) unsigned NOT NULL DEFAULT 442, + `LDIFADUAN` tinyint(4) NOT NULL DEFAULT 0, + `METAL` tinyint(1) NOT NULL DEFAULT 0, + `METALIMP` decimal(10,2) NOT NULL DEFAULT 0.00, `CLIENTE` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, `METALEJE` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, `FECHA_OP` date DEFAULT NULL COMMENT 'FEcha de operacion', @@ -26122,12 +26105,12 @@ CREATE TABLE `XDiario` ( `FACTU_RT` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `BASEIMP_RT` decimal(10,2) DEFAULT NULL, `BASEIMP_RF` decimal(10,2) DEFAULT NULL, - `RECTIFICA` int(1) NOT NULL DEFAULT '0', + `RECTIFICA` int(1) NOT NULL DEFAULT 0, `FECHA_RT` date DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `FECREGCON` date DEFAULT NULL, - `enlazadoSage` tinyint(1) NOT NULL DEFAULT '0', + `enlazadoSage` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), KEY `ASIENidx` (`id`,`ASIEN`), @@ -26135,7 +26118,7 @@ CREATE TABLE `XDiario` ( KEY `XDiario` (`enlazado`), KEY `enlazadoSage` (`enlazadoSage`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26185,21 +26168,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `__coolerPathDetail` --- - -DROP TABLE IF EXISTS `__coolerPathDetail`; -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `__coolerPathDetail` ( - `id` tinyint NOT NULL, - `coolerPathFk` tinyint NOT NULL, - `hallway` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `absenceType` -- @@ -26227,13 +26195,13 @@ DROP TABLE IF EXISTS `accounting`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accounting` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `bank` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `account` varchar(10) CHARACTER SET utf8 DEFAULT NULL, - `accountingTypeFk` smallint(6) NOT NULL DEFAULT '0', + `accountingTypeFk` smallint(6) NOT NULL DEFAULT 0, `entityFk` int(10) unsigned NOT NULL, - `isActive` tinyint(4) NOT NULL DEFAULT '1', - `currencyFk` tinyint(3) unsigned DEFAULT '1', + `isActive` tinyint(4) NOT NULL DEFAULT 1, + `currencyFk` tinyint(3) unsigned DEFAULT 1, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `BancosBanco` (`bank`), @@ -26253,11 +26221,11 @@ DROP TABLE IF EXISTS `accountingType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountingType` ( - `id` smallint(6) NOT NULL DEFAULT '0', + `id` smallint(6) NOT NULL DEFAULT 0, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `receiptDescription` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Descripción por defecto al crear nuevo recibo', `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `isAutoConciliated` tinyint(1) DEFAULT '1' COMMENT 'Si hay que marcar como conciliado el recibo al usar este tipo', + `isAutoConciliated` tinyint(1) DEFAULT 1 COMMENT 'Si hay que marcar como conciliado el recibo al usar este tipo', `maxAmount` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `accountingType_code_IDX` (`code`) USING BTREE @@ -26287,9 +26255,9 @@ DROP TABLE IF EXISTS `activityTaxDismissed`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `activityTaxDismissed` ( `clientFk` int(11) NOT NULL, - `isNotified` tinyint(1) DEFAULT '0', - `isDismissed` tinyint(1) DEFAULT '0', - `notified` int(11) DEFAULT '0', + `isNotified` tinyint(1) DEFAULT 0, + `isDismissed` tinyint(1) DEFAULT 0, + `notified` int(11) DEFAULT 0, PRIMARY KEY (`clientFk`), CONSTRAINT `clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -26304,8 +26272,8 @@ DROP TABLE IF EXISTS `address`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `address` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `warehouseFk__` smallint(6) unsigned DEFAULT '1', + `clientFk` int(11) NOT NULL DEFAULT 0, + `warehouseFk__` smallint(6) unsigned DEFAULT 1, `street` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `provinceFk` smallint(5) unsigned DEFAULT NULL, @@ -26313,12 +26281,12 @@ CREATE TABLE `address` ( `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `nickname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, - `isDefaultAddress` tinyint(1) NOT NULL DEFAULT '0', - `agencyModeFk` int(11) NOT NULL DEFAULT '2', + `isDefaultAddress` tinyint(1) NOT NULL DEFAULT 0, + `agencyModeFk` int(11) NOT NULL DEFAULT 2, `notes__` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasInsurance__` tinyint(1) NOT NULL DEFAULT '0', + `hasInsurance__` tinyint(1) NOT NULL DEFAULT 0, `porte__` double DEFAULT NULL, - `isActive` tinyint(4) NOT NULL DEFAULT '1', + `isActive` tinyint(4) NOT NULL DEFAULT 1, `postcodeOLD__` int(11) unsigned DEFAULT NULL, `longitude` decimal(11,7) DEFAULT NULL, `latitude` decimal(11,7) DEFAULT NULL, @@ -26326,8 +26294,8 @@ CREATE TABLE `address` ( `isEqualizated` tinyint(1) DEFAULT NULL, `customsAgentFk` int(11) DEFAULT NULL, `incotermsFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `isVilassarBuyer__` tinyint(4) NOT NULL DEFAULT '0', - `isLogifloraAllowed` tinyint(4) NOT NULL DEFAULT '0', + `isVilassarBuyer__` tinyint(4) NOT NULL DEFAULT 0, + `isLogifloraAllowed` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `Id_Agencia` (`agencyModeFk`), KEY `Id_cliente` (`clientFk`), @@ -26466,12 +26434,12 @@ DROP TABLE IF EXISTS `addressFilter`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `addressFilter` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `provinceFk` smallint(5) unsigned DEFAULT NULL, `countryFk` mediumint(8) unsigned DEFAULT NULL, - `isLogifloraAllowed` tinyint(1) DEFAULT '0', - `isVNHSupplier` tinyint(1) DEFAULT '0' COMMENT 'corresponde al campo edi.VMPSettings.isVNHSupplier', - `isEarlyBird` tinyint(1) DEFAULT '0' COMMENT 'corresponde al campo edi.marketPlace.isEarlybird', + `isLogifloraAllowed` tinyint(1) DEFAULT 0, + `isVNHSupplier` tinyint(1) DEFAULT 0 COMMENT 'corresponde al campo edi.VMPSettings.isVNHSupplier', + `isEarlyBird` tinyint(1) DEFAULT 0 COMMENT 'corresponde al campo edi.marketPlace.isEarlybird', `warehouseFk` smallint(5) unsigned DEFAULT NULL, `beforeDated` date DEFAULT NULL, `afterDated` date DEFAULT NULL, @@ -26482,7 +26450,7 @@ CREATE TABLE `addressFilter` ( CONSTRAINT `addressFilter_FK` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressFilter_FK_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressFilter_FK_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece los criterios para habilitar las compras directas a Logiflora'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece los criterios para habilitar las compras directas a Logiflora'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26494,7 +26462,7 @@ DROP TABLE IF EXISTS `addressForPackaging`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `addressForPackaging` ( `addressFk` int(11) NOT NULL, - `packagingValue` decimal(10,2) NOT NULL DEFAULT '0.04', + `packagingValue` decimal(10,2) NOT NULL DEFAULT 0.04, PRIMARY KEY (`addressFk`), CONSTRAINT `addresForPackaging_fk1` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -26531,11 +26499,11 @@ CREATE TABLE `agency` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', - `isVolumetric` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Si el calculo del porte se hacer por volumen', - `bankFk` int(11) NOT NULL DEFAULT '8' COMMENT 'para realizar los reembolsos', + `isVolumetric` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si el calculo del porte se hacer por volumen', + `bankFk` int(11) NOT NULL DEFAULT 8 COMMENT 'para realizar los reembolsos', `warehouseAliasFk` smallint(5) unsigned DEFAULT NULL, - `isOwn` tinyint(1) NOT NULL DEFAULT '0', - `labelZone` tinyint(4) NOT NULL DEFAULT '0', + `isOwn` tinyint(1) NOT NULL DEFAULT 0, + `labelZone` tinyint(4) NOT NULL DEFAULT 0, `workCenterFk` int(11) DEFAULT NULL, `supplierFk__` int(11) DEFAULT NULL, `isAnyVolumeAllowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Permite vender productos que tengan vn.itemType.IsUnconventionalSize = TRUE', @@ -26603,19 +26571,19 @@ CREATE TABLE `agencyMode` ( `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `deliveryMethodFk` int(11) DEFAULT NULL, - `m3` double DEFAULT '0', - `cod71__` tinyint(3) unsigned DEFAULT '0', - `web` smallint(1) unsigned zerofill NOT NULL DEFAULT '0', + `m3` double DEFAULT 0, + `cod71__` tinyint(3) unsigned DEFAULT 0, + `web` smallint(1) unsigned zerofill NOT NULL DEFAULT 0, `agencyFk` smallint(5) unsigned NOT NULL, - `inflation` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Este valor se utiliza para aumentar el valor del componente porte.', - `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', + `inflation` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Este valor se utiliza para aumentar el valor del componente porte.', + `isVolumetric` tinyint(1) NOT NULL DEFAULT 0, `reportMail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `showAgencyName` tinyint(1) DEFAULT '1' COMMENT 'obsoleta', - `isActive` tinyint(1) NOT NULL DEFAULT '1', - `isExternalAgency` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'obsoleta', - `flag` blob COMMENT 'obsoleta', + `showAgencyName` tinyint(1) DEFAULT 1 COMMENT 'obsoleta', + `isActive` tinyint(1) NOT NULL DEFAULT 1, + `isExternalAgency` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta', + `flag` blob DEFAULT NULL COMMENT 'obsoleta', `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isRiskFree` tinyint(1) NOT NULL DEFAULT '0', + `isRiskFree` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `Agencias` (`name`), KEY `Vista` (`deliveryMethodFk`), @@ -26627,19 +26595,22 @@ CREATE TABLE `agencyMode` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `agencyProvince__` +-- Temporary table structure for view `agencyTerm` -- -DROP TABLE IF EXISTS `agencyProvince__`; -/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; +DROP TABLE IF EXISTS `agencyTerm`; +/*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `agencyProvince__` ( - `provinceFk` tinyint NOT NULL, +/*!50001 CREATE TABLE `agencyTerm` ( `agencyFk` tinyint NOT NULL, - `zone` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `isVolumetric` tinyint NOT NULL + `minimumPackages` tinyint NOT NULL, + `kmPrice` tinyint NOT NULL, + `packagePrice` tinyint NOT NULL, + `routePrice` tinyint NOT NULL, + `minimumKm` tinyint NOT NULL, + `minimumM3` tinyint NOT NULL, + `m3Price` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; @@ -26734,7 +26705,7 @@ CREATE TABLE `assignedTicketToWorker` ( PRIMARY KEY (`id`), UNIQUE KEY `idWorker_UNIQUE` (`idWorker`), UNIQUE KEY `idTicket_UNIQUE` (`idTicket`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26765,12 +26736,12 @@ DROP TABLE IF EXISTS `autoRadioLogCall`; CREATE TABLE `autoRadioLogCall` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `response` longtext COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26788,7 +26759,7 @@ CREATE TABLE `autonomousRegion__` ( PRIMARY KEY (`id`), KEY `countryFk` (`countryFk`), CONSTRAINT `countryFk` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26893,12 +26864,12 @@ CREATE TABLE `awb` ( `code` varchar(18) COLLATE utf8_unicode_ci NOT NULL, `package` float unsigned NOT NULL, `weight` float unsigned DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `transitoryFk` int(11) DEFAULT NULL, - `taxFk` int(10) unsigned DEFAULT '62', + `taxFk` int(10) unsigned DEFAULT 62, `duakk` varchar(18) COLLATE utf8_unicode_ci DEFAULT NULL, `docFk` int(11) DEFAULT NULL, - `amount` double NOT NULL DEFAULT '0', + `amount` double NOT NULL DEFAULT 0, `freightFk` int(11) DEFAULT NULL, `m3` double unsigned DEFAULT NULL, `stems` int(10) unsigned DEFAULT NULL, @@ -26911,11 +26882,11 @@ CREATE TABLE `awb` ( `operated` datetime DEFAULT NULL, `bookEntried` date DEFAULT NULL, `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, - `isChecked` tinyint(3) DEFAULT '0', - `isTransitoryChecked` tinyint(3) DEFAULT '0', + `isChecked` tinyint(3) DEFAULT 0, + `isTransitoryChecked` tinyint(3) DEFAULT 0, `year` int(4) DEFAULT NULL, `observation` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasFreightPrepaid` tinyint(3) DEFAULT '0', + `hasFreightPrepaid` tinyint(3) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `codigo_UNIQUE` (`code`,`year`), KEY `proveedor_id` (`transitoryFk`), @@ -26942,7 +26913,7 @@ DELIMITER ;; FOR EACH ROW BEGIN - SET NEW.year= year(CURDATE()); + SET NEW.year= year(util.VN_CURDATE()); END */;; @@ -26976,40 +26947,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `awb__` --- - -DROP TABLE IF EXISTS `awb__`; -/*!50001 DROP VIEW IF EXISTS `awb__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `awb__` ( - `id` tinyint NOT NULL, - `code` tinyint NOT NULL, - `package` tinyint NOT NULL, - `weight` tinyint NOT NULL, - `created` tinyint NOT NULL, - `transitoryFk` tinyint NOT NULL, - `taxFk` tinyint NOT NULL, - `docFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `freightFk` tinyint NOT NULL, - `m3` tinyint NOT NULL, - `stems` tinyint NOT NULL, - `flightFk` tinyint NOT NULL, - `volumeWeight` tinyint NOT NULL, - `hb` tinyint NOT NULL, - `rate` tinyint NOT NULL, - `booked` tinyint NOT NULL, - `issued` tinyint NOT NULL, - `operated` tinyint NOT NULL, - `bookEntried` tinyint NOT NULL, - `invoiceInFk` tinyint NOT NULL, - `isChecked` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `bank` -- @@ -27038,7 +26975,7 @@ DROP TABLE IF EXISTS `bankEntity`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankEntity` ( - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `bic` varchar(11) CHARACTER SET utf8 DEFAULT NULL, @@ -27049,37 +26986,6 @@ CREATE TABLE `bankEntity` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `bankPolicy` --- - -DROP TABLE IF EXISTS `bankPolicy`; -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `bankPolicy` ( - `id` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `balanceInterestDrawn` tinyint NOT NULL, - `commissionAvailableBalances` tinyint NOT NULL, - `openingCommission` tinyint NOT NULL, - `started` tinyint NOT NULL, - `ended` tinyint NOT NULL, - `bankFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `description` tinyint NOT NULL, - `hasGuarantee` tinyint NOT NULL, - `dmsFk` tinyint NOT NULL, - `notaryFk` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `amortizationTypeFk` tinyint NOT NULL, - `periodicityTypeFk` tinyint NOT NULL, - `insuranceExpired` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `beach` -- @@ -27093,9 +26999,9 @@ CREATE TABLE `beach` ( `x` int(11) NOT NULL, `y` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isShowed` tinyint(1) DEFAULT '0', + `isShowed` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ubicaciones respecto a la playa del almacén'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ubicaciones respecto a la playa del almacén'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27124,12 +27030,12 @@ DROP TABLE IF EXISTS `bookingPlanner`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bookingPlanner` ( `id` int(10) NOT NULL AUTO_INCREMENT, - `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `effectived` timestamp NOT NULL DEFAULT current_timestamp(), `pgcFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'SPAIN', `priority` int(2) unsigned DEFAULT NULL, - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 1, + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `pgcFk_bookingPlanner_idx` (`pgcFk`), KEY `taxClassFk` (`taxClassFk`), @@ -27156,14 +27062,14 @@ CREATE TABLE `botanicExport` ( `countryFk` mediumint(8) unsigned DEFAULT NULL, `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8 NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isProtectedZone` tinyint(1) NOT NULL DEFAULT '0', + `isProtectedZone` tinyint(1) NOT NULL DEFAULT 0, `code` enum('importProhibited','phytosanitaryPassport','individualPassport') COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Paises` (`countryFk`), KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`), KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`), CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27197,14 +27103,14 @@ DROP TABLE IF EXISTS `budget`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `budget` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `started` date DEFAULT NULL, `finished` date DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `departmentFk` int(11) DEFAULT NULL, `supplierFk` int(11) DEFAULT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `amount` decimal(10,2) DEFAULT NULL, `projectFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -27216,7 +27122,7 @@ CREATE TABLE `budget` ( CONSTRAINT `budget_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_2` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Master de presupuestos de project'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Master de presupuestos de project'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27235,7 +27141,7 @@ CREATE TABLE `budgetDms` ( KEY `budgetDms_FK_1` (`dmsFk`), CONSTRAINT `budgetDms_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetDms_FK_1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de budget'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de budget'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27248,7 +27154,7 @@ DROP TABLE IF EXISTS `budgetInvoiceIn`; CREATE TABLE `budgetInvoiceIn` ( `id` int(11) NOT NULL AUTO_INCREMENT, `budgetFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `invoiceInFk` mediumint(8) unsigned NOT NULL, `amount` decimal(10,2) NOT NULL, PRIMARY KEY (`id`), @@ -27256,7 +27162,7 @@ CREATE TABLE `budgetInvoiceIn` ( KEY `budgetInvoiceIn_FK_1` (`invoiceInFk`), CONSTRAINT `budgetInvoiceIn_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetInvoiceIn_FK_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas relativas al presupuesto'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas relativas al presupuesto'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27269,7 +27175,7 @@ DROP TABLE IF EXISTS `budgetNotes`; CREATE TABLE `budgetNotes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `budgetFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `txt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -27277,7 +27183,7 @@ CREATE TABLE `budgetNotes` ( KEY `budgetNotes_FK_2` (`userFk`), CONSTRAINT `budgetNotes_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetNotes_FK_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de budget'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de budget'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27333,7 +27239,7 @@ CREATE TABLE `businessReasonEnd` ( `id` tinyint(3) NOT NULL AUTO_INCREMENT, `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27359,33 +27265,33 @@ DROP TABLE IF EXISTS `buy`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `buy` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `entryFk` int(11) NOT NULL DEFAULT '0', - `itemFk` int(11) NOT NULL DEFAULT '90', - `quantity` int(11) DEFAULT '0', - `dispatched` int(11) NOT NULL DEFAULT '0', - `buyingValue` decimal(10,3) DEFAULT '0.000', - `freightValue` decimal(10,3) DEFAULT '0.000', - `isIgnored` tinyint(1) NOT NULL DEFAULT '0', - `stickers` int(11) DEFAULT '0', - `packing` int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - `groupingMode` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=sin obligar 1=groping 2=packing', + `entryFk` int(11) NOT NULL DEFAULT 0, + `itemFk` int(11) NOT NULL DEFAULT 90, + `quantity` int(11) DEFAULT 0, + `dispatched` int(11) NOT NULL DEFAULT 0, + `buyingValue` decimal(10,3) DEFAULT 0.000, + `freightValue` decimal(10,3) DEFAULT 0.000, + `isIgnored` tinyint(1) NOT NULL DEFAULT 0, + `stickers` int(11) DEFAULT 0, + `packing` int(11) DEFAULT 0, + `grouping` smallint(5) unsigned NOT NULL DEFAULT 1, + `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=groping 2=packing', `containerFk` smallint(5) unsigned DEFAULT NULL, - `comissionValue` decimal(10,3) DEFAULT '0.000', - `packageValue` decimal(10,3) DEFAULT '0.000', + `comissionValue` decimal(10,3) DEFAULT 0.000, + `packageValue` decimal(10,3) DEFAULT 0.000, `location` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, `packageFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - `price1` decimal(10,2) DEFAULT '0.00', - `price2` decimal(10,2) DEFAULT '0.00', - `price3` decimal(10,2) DEFAULT '0.00', - `minPrice` decimal(10,2) DEFAULT '0.00', + `price1` decimal(10,2) DEFAULT 0.00, + `price2` decimal(10,2) DEFAULT 0.00, + `price3` decimal(10,2) DEFAULT 0.00, + `minPrice` decimal(10,2) DEFAULT 0.00, `producer` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `printedStickers` int(11) DEFAULT '0', - `workerFk` int(11) DEFAULT '0', - `isChecked` tinyint(1) NOT NULL DEFAULT '0', - `isPickedOff` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Esta mercancia no va a la zona de picking.', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `__cm2` int(10) unsigned NOT NULL DEFAULT '0', + `printedStickers` int(11) DEFAULT 0, + `workerFk` int(11) DEFAULT 0, + `isChecked` tinyint(1) NOT NULL DEFAULT 0, + `isPickedOff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Esta mercancia no va a la zona de picking.', + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `__cm2` int(10) unsigned NOT NULL DEFAULT 0, `ektFk` int(11) DEFAULT NULL, `weight` decimal(10,2) unsigned DEFAULT NULL, `deliveryFk` int(11) DEFAULT NULL, @@ -27626,7 +27532,7 @@ trig: BEGIN IF vIsBuyerToBeEmailed AND vBuyerFk != account.myUser_getId() AND - vLanded = CURDATE() THEN + vLanded = util.VN_CURDATE() THEN IF !(NEW.itemFk <=> OLD.itemFk) OR !(NEW.quantity <=> OLD.quantity) OR !(NEW.packing <=> OLD.packing) OR @@ -27706,7 +27612,7 @@ CREATE TABLE `buyMark` ( `id` int(11) NOT NULL, `comment` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `mark` tinyint(1) DEFAULT NULL, - `odbcDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `odbcDate` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), CONSTRAINT `Compres_mark_ibfk_1` FOREIGN KEY (`id`) REFERENCES `buy` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -27843,8 +27749,8 @@ DROP TABLE IF EXISTS `campaign`; CREATE TABLE `campaign` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` enum('mothersDay','allSaints','valentinesDay') COLLATE utf8_unicode_ci NOT NULL, - `dated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `scopeDays` int(11) NOT NULL DEFAULT '15', + `dated` datetime NOT NULL DEFAULT current_timestamp(), + `scopeDays` int(11) NOT NULL DEFAULT 15, PRIMARY KEY (`id`), UNIQUE KEY `campaign_dated_uindex` (`dated`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -27862,7 +27768,7 @@ CREATE TABLE `category` ( `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `nick` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27875,12 +27781,12 @@ DROP TABLE IF EXISTS `chain`; CREATE TABLE `chain` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `rappel` decimal(5,2) NOT NULL DEFAULT '0.00', + `rappel` decimal(5,2) NOT NULL DEFAULT 0.00, `componentFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `chain_FK` (`componentFk`), CONSTRAINT `chain_FK` FOREIGN KEY (`componentFk`) REFERENCES `component` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Grupos de clientes'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Grupos de clientes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27911,13 +27817,13 @@ CREATE TABLE `claim` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ticketCreated` date NOT NULL, `claimDepartmentFk__` tinyint(3) unsigned DEFAULT NULL, - `claimStateFk` int(10) unsigned NOT NULL DEFAULT '1', - `observation` text COLLATE utf8_unicode_ci, + `claimStateFk` int(10) unsigned NOT NULL DEFAULT 1, + `observation` text COLLATE utf8_unicode_ci DEFAULT NULL, `clientFk` int(11) NOT NULL, `workerFk` int(11) NOT NULL, - `responsibility` int(1) unsigned NOT NULL DEFAULT '3', - `isChargedToMana` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `responsibility` int(1) unsigned NOT NULL DEFAULT 3, + `isChargedToMana` tinyint(1) NOT NULL DEFAULT 0, + `created` timestamp NULL DEFAULT current_timestamp(), `ticketFk` int(11) DEFAULT NULL, `hasToPickUp` tinyint(1) NOT NULL, `packages` smallint(10) unsigned DEFAULT '0' COMMENT 'packages received by the client', @@ -27945,8 +27851,8 @@ CREATE TABLE `claimBeginning` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, `saleFk` int(11) DEFAULT NULL, - `claimComplaintFk__` int(10) unsigned NOT NULL DEFAULT '1', - `claimRequestFk__` int(1) unsigned NOT NULL DEFAULT '1', + `claimComplaintFk__` int(10) unsigned NOT NULL DEFAULT 1, + `claimRequestFk__` int(1) unsigned NOT NULL DEFAULT 1, `quantity` double DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Movimiento` (`saleFk`), @@ -28025,12 +27931,12 @@ DROP TABLE IF EXISTS `claimDevelopment`; CREATE TABLE `claimDevelopment` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, - `claimResponsibleFk` int(10) unsigned NOT NULL DEFAULT '1', + `claimResponsibleFk` int(10) unsigned NOT NULL DEFAULT 1, `workerFk` int(10) unsigned DEFAULT NULL, - `claimReasonFk` int(10) unsigned NOT NULL DEFAULT '1', - `claimResultFk` int(10) unsigned NOT NULL DEFAULT '1', - `claimRedeliveryFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `claimDestinationFk` tinyint(3) unsigned NOT NULL DEFAULT '2', + `claimReasonFk` int(10) unsigned NOT NULL DEFAULT 1, + `claimResultFk` int(10) unsigned NOT NULL DEFAULT 1, + `claimRedeliveryFk` tinyint(3) unsigned NOT NULL DEFAULT 1, + `claimDestinationFk` tinyint(3) unsigned NOT NULL DEFAULT 2, PRIMARY KEY (`id`), KEY `cl_main_id` (`claimFk`), KEY `cl_res_id` (`claimResponsibleFk`), @@ -28077,9 +27983,9 @@ CREATE TABLE `claimEnd` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `saleFk` int(11) DEFAULT NULL, `claimFk` int(10) unsigned NOT NULL, - `workerFk` int(10) unsigned NOT NULL DEFAULT '20', + `workerFk` int(10) unsigned NOT NULL DEFAULT 20, `claimDestinationFk` tinyint(4) DEFAULT NULL, - `isGreuge` tinyint(4) NOT NULL DEFAULT '0', + `isGreuge` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `cl_main_id` (`claimFk`), KEY `Id_Trabajador` (`workerFk`), @@ -28103,11 +28009,11 @@ CREATE TABLE `claimLog` ( `originFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -28115,7 +28021,7 @@ CREATE TABLE `claimLog` ( KEY `userFk` (`userFk`), CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28126,35 +28032,17 @@ DROP TABLE IF EXISTS `claimRatio`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimRatio` ( - `clientFk` int(11) NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT 0, `yearSale` decimal(10,2) DEFAULT NULL, `claimAmount` decimal(10,2) DEFAULT NULL, `claimingRate` decimal(5,2) DEFAULT NULL, `priceIncreasing` decimal(5,2) DEFAULT NULL, - `packingRate` decimal(5,2) NOT NULL DEFAULT '1.00', + `packingRate` decimal(5,2) NOT NULL DEFAULT 1.00, PRIMARY KEY (`clientFk`), CONSTRAINT `claimRatio_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `claimRatio__` --- - -DROP TABLE IF EXISTS `claimRatio__`; -/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `claimRatio__` ( - `clientFk` tinyint NOT NULL, - `yearSale` tinyint NOT NULL, - `claimAmount` tinyint NOT NULL, - `claimingRate` tinyint NOT NULL, - `priceIncreasing` tinyint NOT NULL, - `packingRate` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `claimReason` -- @@ -28165,7 +28053,7 @@ DROP TABLE IF EXISTS `claimReason`; CREATE TABLE `claimReason` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `isTired` tinyint(1) NOT NULL DEFAULT '0', + `isTired` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28194,7 +28082,7 @@ DROP TABLE IF EXISTS `claimResponsible`; CREATE TABLE `claimResponsible` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `responsability` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'if=1 >sensib >culpa', + `responsability` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'if=1 >sensib >culpa', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28243,66 +28131,66 @@ DROP TABLE IF EXISTS `client`; CREATE TABLE `client` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', + `discount` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', `defaultAddressFk` int(11) DEFAULT NULL, - `street` longtext COLLATE utf8_unicode_ci, + `street` longtext COLLATE utf8_unicode_ci DEFAULT NULL, `fi` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `fax__` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `cc` varchar(23) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', - `dueDay` smallint(6) NOT NULL DEFAULT '5', - `receipt__` int(11) DEFAULT '1' COMMENT 'obsoleta', - `isOfficial__` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'obsoleta (comprobar)', - `isTaxDataChecked` tinyint(1) NOT NULL DEFAULT '0', + `dueDay` smallint(6) NOT NULL DEFAULT 5, + `receipt__` int(11) DEFAULT 1 COMMENT 'obsoleta', + `isOfficial__` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'obsoleta (comprobar)', + `isTaxDataChecked` tinyint(1) NOT NULL DEFAULT 0, `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `accountingAccount` varchar(10) CHARACTER SET utf8 NOT NULL, - `isEqualizated` tinyint(1) NOT NULL DEFAULT '0', + `isEqualizated` tinyint(1) NOT NULL DEFAULT 0, `city` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, `provinceFk` smallint(5) unsigned DEFAULT NULL, `postcode` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL, `socialName` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL, `contact` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `wholesaler__` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `isReExpedition__` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `hasToInvoice` tinyint(1) NOT NULL DEFAULT '1', - `notes` text COLLATE utf8_unicode_ci COMMENT 'obsoleta (comprobar)', + `wholesaler__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `isReExpedition__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `hasToInvoice` tinyint(1) NOT NULL DEFAULT 1, + `notes` text COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', `administrativeNotes__` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'obsoleta (comprobar)', - `invoiceCopy__` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `hold__` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `isFreezed` tinyint(1) NOT NULL DEFAULT '0', + `invoiceCopy__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `hold__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `isFreezed` tinyint(1) NOT NULL DEFAULT 0, `salesPersonFk` int(10) unsigned DEFAULT NULL, - `credit` decimal(10,2) NOT NULL DEFAULT '0.00', + `credit` decimal(10,2) NOT NULL DEFAULT 0.00, `cyc` double DEFAULT NULL COMMENT 'obsoleta (comprobar)', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', - `isActive` tinyint(1) NOT NULL DEFAULT '1', + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, + `isActive` tinyint(1) NOT NULL DEFAULT 1, `gestdocFk` int(11) DEFAULT NULL, - `quality` int(2) DEFAULT '11', - `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT '5', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `isToBeMailed` tinyint(1) NOT NULL DEFAULT '1', + `quality` int(2) DEFAULT 11, + `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT 5, + `created` timestamp NULL DEFAULT current_timestamp(), + `isToBeMailed` tinyint(1) NOT NULL DEFAULT 1, `contactChannelFk` smallint(6) DEFAULT NULL, - `isVies` tinyint(4) NOT NULL DEFAULT '0', - `splitHolland__` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `sepaFth__` tinyint(1) DEFAULT '0' COMMENT 'campo para recibir los escritos de los clientes para el sepaobsoleta (comprobar)', - `hasSepaVnl` tinyint(1) DEFAULT '0', - `coreFth__` tinyint(1) DEFAULT '0' COMMENT 'obsoleta (comprobar)', - `hasCoreVnl` tinyint(1) DEFAULT '0', + `isVies` tinyint(4) NOT NULL DEFAULT 0, + `splitHolland__` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `sepaFth__` tinyint(1) DEFAULT 0 COMMENT 'campo para recibir los escritos de los clientes para el sepaobsoleta (comprobar)', + `hasSepaVnl` tinyint(1) DEFAULT 0, + `coreFth__` tinyint(1) DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `hasCoreVnl` tinyint(1) DEFAULT 0, `riskCalculated` date NOT NULL, - `hasCoreVnh` tinyint(1) DEFAULT '0', - `isRelevant` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Define los clientes cuyas ventas hay que tener en cuenta en los calculos estadisticos.', - `clientTypeFk` int(11) NOT NULL DEFAULT '1', + `hasCoreVnh` tinyint(1) DEFAULT 0, + `isRelevant` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Define los clientes cuyas ventas hay que tener en cuenta en los calculos estadisticos.', + `clientTypeFk` int(11) NOT NULL DEFAULT 1, `postcodeOld__` int(11) unsigned DEFAULT NULL COMMENT 'obsoleta (comprobar)', `mailAddress` int(11) DEFAULT NULL, `codposOLD__` char(5) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', `creditInsurance` int(11) DEFAULT NULL, - `eypbc` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Email\\nYesterday\\nPurchases\\nBy\\nConsigna', - `hasToInvoiceByAddress` tinyint(1) DEFAULT '0', - `cplusTerIdNifFk__` int(11) NOT NULL DEFAULT '1' COMMENT 'OBSOLETO', - `isCreatedAsServed` tinyint(1) DEFAULT '0', - `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT '0', + `eypbc` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Email\\nYesterday\\nPurchases\\nBy\\nConsigna', + `hasToInvoiceByAddress` tinyint(1) DEFAULT 0, + `cplusTerIdNifFk__` int(11) NOT NULL DEFAULT 1 COMMENT 'OBSOLETO', + `isCreatedAsServed` tinyint(1) DEFAULT 0, + `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT 0, `iban` varchar(45) CHARACTER SET utf8 DEFAULT NULL, - `hasLcr` tinyint(1) NOT NULL DEFAULT '0', + `hasLcr` tinyint(1) NOT NULL DEFAULT 0, `bankEntityFk` int(10) DEFAULT NULL, `typeFk` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT 'normal', `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de Iva por defecto asociado al cliente en SAGE', @@ -28498,7 +28386,7 @@ CREATE TABLE `clientChain` ( KEY `clientChain_fk2_idx` (`chainFk`), CONSTRAINT `clientChain_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientChain_fk2` FOREIGN KEY (`chainFk`) REFERENCES `chain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28542,7 +28430,7 @@ CREATE TABLE `clientCredit` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, `amount` double unsigned NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `workerFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `workers_fk_idx` (`workerFk`), @@ -28674,11 +28562,11 @@ CREATE TABLE `clientLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -28686,7 +28574,7 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28713,7 +28601,7 @@ DROP TABLE IF EXISTS `clientManaCache`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientManaCache` ( `clientFk` int(11) NOT NULL, - `mana` decimal(10,0) NOT NULL DEFAULT '0', + `mana` decimal(10,0) NOT NULL DEFAULT 0, `dated` date NOT NULL, PRIMARY KEY (`clientFk`,`dated`), KEY `manaCustomerIdx1` (`dated`), @@ -28748,7 +28636,7 @@ CREATE TABLE `clientObservation` ( `clientFk` int(11) NOT NULL, `workerFk` int(10) unsigned DEFAULT NULL, `text` text COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `Id_Trabajador` (`workerFk`), KEY `Id_Cliente` (`clientFk`), @@ -28811,7 +28699,7 @@ DROP TABLE IF EXISTS `clientPackagingGifts`; CREATE TABLE `clientPackagingGifts` ( `clientFk` int(11) NOT NULL, `giftFk` int(11) NOT NULL, - `added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `added` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`clientFk`,`giftFk`), KEY `clientPackagingGifts_FK_1` (`giftFk`), CONSTRAINT `clientPackagingGifts_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`), @@ -28843,7 +28731,7 @@ DROP TABLE IF EXISTS `clientProtected`; CREATE TABLE `clientProtected` ( `clientFk` int(11) NOT NULL, `workerFk` int(10) unsigned NOT NULL, - `isValidated__` tinyint(1) NOT NULL DEFAULT '0', + `isValidated__` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`clientFk`), KEY `clientProtected_fk2_idx` (`workerFk`), CONSTRAINT `clientProtected_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -28859,8 +28747,8 @@ DROP TABLE IF EXISTS `clientRisk`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientRisk` ( - `clientFk` int(11) NOT NULL DEFAULT '0', - `companyFk` smallint(6) unsigned NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT 0, + `companyFk` smallint(6) unsigned NOT NULL DEFAULT 0, `amount` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`clientFk`,`companyFk`), KEY `company_id` (`companyFk`), @@ -28869,21 +28757,6 @@ CREATE TABLE `clientRisk` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `clientRisk__` --- - -DROP TABLE IF EXISTS `clientRisk__`; -/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `clientRisk__` ( - `clientFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `amount` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `clientSample` -- @@ -28895,7 +28768,7 @@ CREATE TABLE `clientSample` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(10) unsigned NOT NULL, `typeFk` int(10) unsigned NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp(), `workerFk` int(10) unsigned NOT NULL, `balance` float NOT NULL, `companyFk` smallint(5) unsigned DEFAULT NULL, @@ -28917,7 +28790,7 @@ CREATE TABLE `clientType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) CHARACTER SET utf8 NOT NULL, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `isCreatedAsServed` tinyint(1) DEFAULT '0', + `isCreatedAsServed` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; @@ -28955,7 +28828,7 @@ CREATE TABLE `cmr` ( `senderInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Flowers 4º C. Plants 14º C', `paymentInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Carriage paid', `specialAgreements` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), `companyFk` smallint(5) unsigned DEFAULT NULL, `addressToFk` int(11) DEFAULT NULL, `addressFromFk` int(11) DEFAULT NULL, @@ -28974,7 +28847,7 @@ CREATE TABLE `cmr` ( CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cmr_fk2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29043,7 +28916,7 @@ CREATE TABLE `cmr_expeditionPallet` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cmrFk` int(11) NOT NULL, `expeditionPalletFk` int(11) NOT NULL, - `scanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `scanned` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `cmr_expeditionPallet_fk1_idx` (`cmrFk`), KEY `cmr_expeditionPallet_fk2_idx` (`expeditionPalletFk`), @@ -29107,13 +28980,13 @@ DROP TABLE IF EXISTS `collection`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `collection` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `workerFk` int(10) unsigned DEFAULT NULL, `stateFk` tinyint(3) unsigned DEFAULT NULL, `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `saleTotalCount` int(11) NOT NULL DEFAULT '0', - `salePickedCount` int(11) NOT NULL DEFAULT '0', - `trainFk` int(11) NOT NULL DEFAULT '1', + `saleTotalCount` int(11) NOT NULL DEFAULT 0, + `salePickedCount` int(11) NOT NULL DEFAULT 0, + `trainFk` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `ticketCollection_idx` (`workerFk`), KEY `collection_id2_idx` (`stateFk`), @@ -29183,13 +29056,13 @@ DROP TABLE IF EXISTS `collectionColors`; CREATE TABLE `collectionColors` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `shelve` int(11) NOT NULL DEFAULT '1', - `wagon` int(11) NOT NULL DEFAULT '1', - `trainFk` int(11) NOT NULL DEFAULT '1', + `shelve` int(11) NOT NULL DEFAULT 1, + `wagon` int(11) NOT NULL DEFAULT 1, + `trainFk` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `collectionColors_FK` (`trainFk`), CONSTRAINT `collectionColors_FK` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los colores para las baldas de las colecciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los colores para las baldas de las colecciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29264,18 +29137,18 @@ DROP TABLE IF EXISTS `collectionVolumetry`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `collectionVolumetry` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `level` int(10) unsigned NOT NULL DEFAULT '0', - `lines` int(10) unsigned NOT NULL DEFAULT '1', - `liters` int(10) unsigned NOT NULL DEFAULT '0', - `height` int(10) unsigned NOT NULL DEFAULT '20', + `level` int(10) unsigned NOT NULL DEFAULT 0, + `lines` int(10) unsigned NOT NULL DEFAULT 1, + `liters` int(10) unsigned NOT NULL DEFAULT 0, + `height` int(10) unsigned NOT NULL DEFAULT 20, `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'H', - `trainFk` int(11) NOT NULL DEFAULT '1', + `trainFk` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `collectionVolumetry_FK` (`itemPackingTypeFk`), KEY `collectionVolumetry_FK_1` (`trainFk`), CONSTRAINT `collectionVolumetry_FK` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, CONSTRAINT `collectionVolumetry_FK_1` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29286,7 +29159,7 @@ DROP TABLE IF EXISTS `commissionConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `commissionConfig` ( - `rate` decimal(5,4) NOT NULL DEFAULT '0.0000', + `rate` decimal(5,4) NOT NULL DEFAULT 0.0000, `plusTeamAmount` int(11) DEFAULT NULL, `plusNewBornAmount` int(11) DEFAULT NULL, `plusSalesAmount` int(11) DEFAULT NULL, @@ -29316,22 +29189,22 @@ CREATE TABLE `company` ( `workerManagerFk` int(10) unsigned NOT NULL, `registered` date NOT NULL, `expired` date DEFAULT NULL, - `logo` longblob, - `isOfficial` tinyint(1) unsigned NOT NULL DEFAULT '1', - `hasCyc` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `logo` longblob DEFAULT NULL, + `isOfficial` tinyint(1) unsigned NOT NULL DEFAULT 1, + `hasCyc` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `rgb` varchar(6) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `stamp` blob, - `created` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP, + `stamp` blob DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `clientFk` int(11) DEFAULT NULL, `sage200Company` int(2) DEFAULT NULL, `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL, - `isDefaulter` tinyint(4) NOT NULL DEFAULT '0', - `companyGroupFk` int(11) NOT NULL DEFAULT '1' COMMENT 'usado para calcular los greuges ', + `isDefaulter` tinyint(4) NOT NULL DEFAULT 0, + `companyGroupFk` int(11) NOT NULL DEFAULT 1 COMMENT 'usado para calcular los greuges ', `companyCode` int(2) DEFAULT NULL COMMENT 'Campo para movConta', `companyCodeTest` int(2) DEFAULT NULL, - `footnotes` longtext COLLATE utf8_unicode_ci COMMENT 'pie de paginas en las facturas', - `phytosanitary` longtext COLLATE utf8_unicode_ci, + `footnotes` longtext COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'pie de paginas en las facturas', + `phytosanitary` longtext COLLATE utf8_unicode_ci DEFAULT NULL, `fhAdminNumber` int(11) DEFAULT NULL COMMENT 'número de cliente en FloraHolland', PRIMARY KEY (`id`), KEY `gerente_id` (`workerManagerFk`), @@ -29373,9 +29246,9 @@ CREATE TABLE `component` ( `typeFk` int(11) NOT NULL, `classRate` smallint(6) DEFAULT NULL, `tax` double DEFAULT NULL, - `isRenewable` tinyint(2) NOT NULL DEFAULT '1', + `isRenewable` tinyint(2) NOT NULL DEFAULT 1, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isRequired` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Son componentes imprescindibles en toda venta', + `isRequired` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Son componentes imprescindibles en toda venta', PRIMARY KEY (`id`), KEY `series_componentes_idx` (`typeFk`), KEY `comp` (`classRate`), @@ -29383,25 +29256,6 @@ CREATE TABLE `component` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `componentRate__` --- - -DROP TABLE IF EXISTS `componentRate__`; -/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `componentRate__` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `componentTypeRate` tinyint NOT NULL, - `classRate` tinyint NOT NULL, - `tax` tinyint NOT NULL, - `isRenewable` tinyint NOT NULL, - `code` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `componentType` -- @@ -29412,64 +29266,14 @@ DROP TABLE IF EXISTS `componentType`; CREATE TABLE `componentType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `isBase` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', - `isMargin` tinyint(4) NOT NULL DEFAULT '0', + `isBase` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', + `isMargin` tinyint(4) NOT NULL DEFAULT 0, `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Serie_UNIQUE` (`type`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `componentTypeRate__` --- - -DROP TABLE IF EXISTS `componentTypeRate__`; -/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `componentTypeRate__` ( - `id` tinyint NOT NULL, - `type` tinyint NOT NULL, - `base` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `componentType__` --- - -DROP TABLE IF EXISTS `componentType__`; -/*!50001 DROP VIEW IF EXISTS `componentType__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `componentType__` ( - `id` tinyint NOT NULL, - `type` tinyint NOT NULL, - `isBase` tinyint NOT NULL, - `isMargin` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `component__` --- - -DROP TABLE IF EXISTS `component__`; -/*!50001 DROP VIEW IF EXISTS `component__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `component__` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `typeFk` tinyint NOT NULL, - `classRate` tinyint NOT NULL, - `tax` tinyint NOT NULL, - `isRenewable` tinyint NOT NULL, - `code` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `confectionType` -- @@ -29481,7 +29285,7 @@ CREATE TABLE `confectionType` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29494,49 +29298,49 @@ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ochoa` int(10) unsigned NOT NULL, - `invoiceOutFk` int(11) DEFAULT '0', - `bookFk` int(11) DEFAULT '0', - `serialAFk` int(11) DEFAULT '0', - `serialEFk` int(11) DEFAULT '0', - `serialRFk` int(11) DEFAULT '0', - `serialCFk` int(11) DEFAULT '0', + `invoiceOutFk` int(11) DEFAULT 0, + `bookFk` int(11) DEFAULT 0, + `serialAFk` int(11) DEFAULT 0, + `serialEFk` int(11) DEFAULT 0, + `serialRFk` int(11) DEFAULT 0, + `serialCFk` int(11) DEFAULT 0, `serialHFk` int(11) NOT NULL, - `serialPFk` int(11) DEFAULT '0', - `serialTFk` int(11) DEFAULT '0', + `serialPFk` int(11) DEFAULT 0, + `serialTFk` int(11) DEFAULT 0, `inventoried` datetime DEFAULT NULL, - `serialMFk` int(11) DEFAULT '0', - `itemLog` int(11) DEFAULT '0', + `serialMFk` int(11) DEFAULT 0, + `itemLog` int(11) DEFAULT 0, `weekGoal` int(11) DEFAULT NULL, `photosPath` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `cashBoxNumber` int(11) DEFAULT '0', + `cashBoxNumber` int(11) DEFAULT 0, `redCode` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `TabletTime` datetime DEFAULT NULL, - `t0` int(11) NOT NULL DEFAULT '0', - `t1` int(11) NOT NULL DEFAULT '0', - `t2` int(11) NOT NULL DEFAULT '0', - `t3` int(11) NOT NULL DEFAULT '0', - `cc` double NOT NULL DEFAULT '0', - `palet` double NOT NULL DEFAULT '0', + `t0` int(11) NOT NULL DEFAULT 0, + `t1` int(11) NOT NULL DEFAULT 0, + `t2` int(11) NOT NULL DEFAULT 0, + `t3` int(11) NOT NULL DEFAULT 0, + `cc` double NOT NULL DEFAULT 0, + `palet` double NOT NULL DEFAULT 0, `campaign` datetime NOT NULL, `campaignLife` tinyint(3) unsigned NOT NULL, `truckDays` tinyint(3) unsigned NOT NULL, `transportCharges` double NOT NULL, `escanerPath` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `printedTurn` int(4) DEFAULT NULL, - `truckLength` int(11) DEFAULT '24', + `truckLength` int(11) DEFAULT 24, `fuelConsumption` int(11) DEFAULT NULL, `petrol` decimal(10,1) DEFAULT NULL, `maintenance` decimal(10,1) DEFAULT NULL, `hourPrice` decimal(10,1) DEFAULT NULL, `meterPrice` decimal(10,1) DEFAULT NULL, `kmPrice` decimal(10,1) DEFAULT NULL, - `routeOption` int(11) DEFAULT '1', - `dbproduccion` tinyint(1) NOT NULL DEFAULT '1', + `routeOption` int(11) DEFAULT 1, + `dbproduccion` tinyint(1) NOT NULL DEFAULT 1, `mdbServer` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `fakeEmail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `defaultersMaxAmount` int(10) DEFAULT '200' COMMENT 'maxima deuda permitida a partir de la cual se bloquea a un usuario', + `defaultersMaxAmount` int(10) DEFAULT 200 COMMENT 'maxima deuda permitida a partir de la cual se bloquea a un usuario', `ASIEN` bigint(20) DEFAULT NULL, - `dayStartingHour` int(11) NOT NULL DEFAULT '3' COMMENT 'Hora a la que empieza una nueva jornada de producción', + `dayStartingHour` int(11) NOT NULL DEFAULT 3 COMMENT 'Hora a la que empieza una nueva jornada de producción', PRIMARY KEY (`id`), KEY `fechainv_idx` (`inventoried`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -29584,7 +29388,7 @@ CREATE TABLE `contratos_subvencion_270619` ( `workerFk` int(10) unsigned NOT NULL, `cod_centroFk` int(11) NOT NULL, `CodContratoFk` int(11) NOT NULL, - `journey` decimal(5,2) NOT NULL DEFAULT '8.00', + `journey` decimal(5,2) NOT NULL DEFAULT 8.00, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `nif` varchar(12) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), @@ -29594,7 +29398,7 @@ CREATE TABLE `contratos_subvencion_270619` ( CONSTRAINT `contratos_subvencion_270619_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `contratos_subvencion_270619_fk2` FOREIGN KEY (`cod_centroFk`) REFERENCES `vn2008`.`payroll_centros` (`cod_centro`) ON UPDATE CASCADE, CONSTRAINT `contratos_subvencion_270619_fk3` FOREIGN KEY (`CodContratoFk`) REFERENCES `vn2008`.`payroll_contratos__` (`CodContrato`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Segun los informes de vida laboral aportados por la SS'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Segun los informes de vida laboral aportados por la SS'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29607,20 +29411,20 @@ DROP TABLE IF EXISTS `conveyor`; CREATE TABLE `conveyor` ( `id` int(11) NOT NULL AUTO_INCREMENT, `typeFk` int(11) NOT NULL, - `stratum` int(11) NOT NULL DEFAULT '0', + `stratum` int(11) NOT NULL DEFAULT 0, `length` int(11) DEFAULT NULL, `width` int(11) DEFAULT NULL, `height` int(11) DEFAULT NULL, `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, - `freeSpace` int(11) NOT NULL DEFAULT '0', - `isBusy` tinyint(1) NOT NULL DEFAULT '0', + `freeSpace` int(11) NOT NULL DEFAULT 0, + `isBusy` tinyint(1) NOT NULL DEFAULT 0, `tandem` int(11) DEFAULT NULL COMMENT 'agrupa conveyors para dividir las cajas por tipo en una misma ruta', `conveyorBuildingClassFk` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `conveyor_fk1_idx` (`typeFk`), CONSTRAINT `conveyor_fk1` FOREIGN KEY (`typeFk`) REFERENCES `conveyorType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29633,10 +29437,10 @@ DROP TABLE IF EXISTS `conveyorBuildingClass`; CREATE TABLE `conveyorBuildingClass` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `priority` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT 0, `weightThreshold` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de caja para el montaje de pallets'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de caja para el montaje de pallets'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29654,7 +29458,7 @@ CREATE TABLE `conveyorConfig` ( `height` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `itemName_UNIQUE` (`itemName`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29667,20 +29471,20 @@ DROP TABLE IF EXISTS `conveyorExpedition`; CREATE TABLE `conveyorExpedition` ( `expeditionFk` int(11) NOT NULL, `conveyorFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `conveyorBuildingClassFk` int(11) NOT NULL DEFAULT '1', - `length` int(11) NOT NULL DEFAULT '1', - `width` int(11) NOT NULL DEFAULT '1', - `height` int(11) NOT NULL DEFAULT '1', - `x` int(11) NOT NULL DEFAULT '18100', - `y` int(11) NOT NULL DEFAULT '1', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `conveyorBuildingClassFk` int(11) NOT NULL DEFAULT 1, + `length` int(11) NOT NULL DEFAULT 1, + `width` int(11) NOT NULL DEFAULT 1, + `height` int(11) NOT NULL DEFAULT 1, + `x` int(11) NOT NULL DEFAULT 18100, + `y` int(11) NOT NULL DEFAULT 1, `routeFk` int(11) NOT NULL, - `isIn` tinyint(4) NOT NULL DEFAULT '0', + `isIn` tinyint(4) NOT NULL DEFAULT 0, `productionMinute` int(11) DEFAULT NULL, - `isOut` tinyint(4) NOT NULL DEFAULT '0', + `isOut` tinyint(4) NOT NULL DEFAULT 0, `truck` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `criterion` int(11) DEFAULT NULL, - `isHeavy` tinyint(1) NOT NULL DEFAULT '1', + `isHeavy` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`expeditionFk`), KEY `conveyorExpedition_fk1_idx` (`conveyorFk`), KEY `conveyorExpedition_fk2_idx` (`conveyorBuildingClassFk`), @@ -29700,7 +29504,7 @@ CREATE TABLE `conveyorMode` ( `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `saturacion` int(11) NOT NULL, `gap` int(11) NOT NULL, - `isActive` tinyint(4) NOT NULL DEFAULT '0', + `isActive` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29717,7 +29521,7 @@ CREATE TABLE `conveyorType` ( `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `color` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29729,7 +29533,7 @@ DROP TABLE IF EXISTS `corridor`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `corridor` ( `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL COMMENT 'letra que da nombre al pasillo', - `isAscendent` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'TRUE cuando se prepara de menor a mayor, FALSE cuando es a la inversa', + `isAscendent` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'TRUE cuando se prepara de menor a mayor, FALSE cuando es a la inversa', `prepOrder` int(10) unsigned NOT NULL COMMENT 'orden de preparacion de los pasillos', PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='establece el orden y sentido de preparacion de los pasillos del parking'; @@ -29745,13 +29549,13 @@ DROP TABLE IF EXISTS `country`; CREATE TABLE `country` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `country` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `CEE` tinyint(1) NOT NULL DEFAULT '1', + `CEE` tinyint(1) NOT NULL DEFAULT 1, `code` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1', + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `politicalCountryFk` mediumint(8) unsigned NOT NULL COMMENT 'Pais Real(apaño por culpa del España Exento)', `geoFk` int(11) DEFAULT NULL, - `hasDailyInvoice` tinyint(4) NOT NULL DEFAULT '0', - `isUeeMember` tinyint(4) NOT NULL DEFAULT '0', + `hasDailyInvoice` tinyint(4) NOT NULL DEFAULT 0, + `isUeeMember` tinyint(4) NOT NULL DEFAULT 0, `ibanLength` tinyint(4) DEFAULT NULL, `continentFk` tinyint(4) DEFAULT NULL, `a3Code` int(11) DEFAULT NULL COMMENT 'Código país para a3', @@ -29896,7 +29700,7 @@ CREATE TABLE `cplusCorrectingType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30067,7 +29871,7 @@ CREATE TABLE `creditInsurance` ( `id` int(11) NOT NULL AUTO_INCREMENT, `creditClassification` int(11) DEFAULT NULL, `credit` int(11) DEFAULT NULL, - `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `creationDate` timestamp NOT NULL DEFAULT current_timestamp(), `grade` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), @@ -30109,7 +29913,7 @@ CREATE TABLE `currency` ( `id` tinyint(3) unsigned NOT NULL, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `ratio` double NOT NULL DEFAULT '1', + `ratio` double NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `Moneda_UNIQUE` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -30177,7 +29981,7 @@ DROP TABLE IF EXISTS `delivery`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `delivery` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `longitude` decimal(11,7) DEFAULT NULL, `latitude` decimal(11,7) DEFAULT NULL, `dated` datetime DEFAULT NULL, @@ -30185,7 +29989,7 @@ CREATE TABLE `delivery` ( PRIMARY KEY (`id`), KEY `delivery_FK` (`addressFk`), CONSTRAINT `delivery_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Informa de los datos geográficos y temporales de las entregas de los repartidores'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Informa de los datos geográficos y temporales de las entregas de los repartidores'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30246,7 +30050,7 @@ CREATE TABLE `delivery_zip` ( KEY `postal_code_idx` (`postal_code`), KEY `admin_name3_idx` (`admin_name3`), KEY `admin_name2_idx` (`admin_name2`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30267,14 +30071,14 @@ CREATE TABLE `department` ( `bossFk__` int(11) DEFAULT NULL, `x__` int(11) DEFAULT NULL, `y__` int(11) DEFAULT NULL, - `isProduction` tinyint(4) NOT NULL DEFAULT '0', - `isSelected` tinyint(1) NOT NULL DEFAULT '0', - `depth` int(11) NOT NULL DEFAULT '0', - `sons` decimal(10,0) NOT NULL DEFAULT '0', - `parentFk` int(10) unsigned DEFAULT '1', + `isProduction` tinyint(4) NOT NULL DEFAULT 0, + `isSelected` tinyint(1) NOT NULL DEFAULT 0, + `depth` int(11) NOT NULL DEFAULT 0, + `sons` decimal(10,0) NOT NULL DEFAULT 0, + `parentFk` int(10) unsigned DEFAULT 1, `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `chatName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isTeleworking` tinyint(1) DEFAULT '0', + `isTeleworking` tinyint(1) DEFAULT 0, `notificationEmail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `hasToRefill` tinyint(1) DEFAULT '0' COMMENT 'Rellenar días sin fichadas presenciales', `hasToSendMail` tinyint(1) DEFAULT '0' COMMENT 'Para el envio de mail en el procedimiento workerTimeControl_sendMail()', @@ -30410,7 +30214,7 @@ CREATE TABLE `department_recalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30442,11 +30246,11 @@ CREATE TABLE `deviceLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `android_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `userFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `nameApp` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `versionApp` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30463,7 +30267,7 @@ CREATE TABLE `deviceProduction` ( `macWifi` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `serialNumber` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `departmentFk` int(11) DEFAULT NULL, - `isOutOfService` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0: Ok - 1: No disponible - 2: Sat', + `isOutOfService` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0: Ok - 1: No disponible - 2: Sat', `android_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `purchased` date NOT NULL DEFAULT '1900-01-01' COMMENT 'Fecha de compra', PRIMARY KEY (`id`), @@ -30474,7 +30278,7 @@ CREATE TABLE `deviceProduction` ( KEY `departmentFgn` (`departmentFk`), CONSTRAINT `departmentFgn` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30486,10 +30290,10 @@ DROP TABLE IF EXISTS `deviceProductionConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `isAllUsersallowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Permite que cualquier usuario pueda loguearse', - `isTractorHuntingMode` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Habilita el modo cazador para usuarios que no se han logeado un tractor para sacar', + `isAllUsersallowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite que cualquier usuario pueda loguearse', + `isTractorHuntingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Habilita el modo cazador para usuarios que no se han logeado un tractor para sacar', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -30558,7 +30362,7 @@ CREATE TABLE `disabilityGrade` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Grados de discapacidad Modelo 145 IRPF', `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30570,17 +30374,17 @@ DROP TABLE IF EXISTS `dms`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dms` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dmsTypeFk` int(11) NOT NULL DEFAULT '1', + `dmsTypeFk` int(11) NOT NULL DEFAULT 1, `reference` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `hardCopyNumber` mediumint(8) unsigned DEFAULT NULL, `contentType` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `file` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasFile` tinyint(4) NOT NULL DEFAULT '0', + `hasFile` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `warehouseFk` smallint(5) unsigned DEFAULT '60', + `created` timestamp NULL DEFAULT current_timestamp(), + `warehouseFk` smallint(5) unsigned DEFAULT 60, PRIMARY KEY (`id`), UNIQUE KEY `emp_id` (`companyFk`,`hardCopyNumber`,`warehouseFk`), UNIQUE KEY `dms_hardCopyNumber_IDX` (`hardCopyNumber`,`warehouseFk`) USING BTREE, @@ -30683,12 +30487,12 @@ DROP TABLE IF EXISTS `dmsRecover`; CREATE TABLE `dmsRecover` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) DEFAULT NULL, - `sign` text COLLATE utf8_unicode_ci, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `sign` text COLLATE utf8_unicode_ci DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `ticketFk_idx` (`ticketFk`), CONSTRAINT `ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30776,7 +30580,7 @@ CREATE TABLE `dua` ( `bookEntried` date DEFAULT NULL, `gestdocFk` int(11) DEFAULT NULL, `customsValue` decimal(10,2) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `ASIEN` double DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`), @@ -30821,13 +30625,13 @@ CREATE TABLE `duaIntrastat` ( `id` int(11) NOT NULL AUTO_INCREMENT, `duaFk` int(11) NOT NULL, `intrastatFk` int(8) unsigned NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`id`), KEY `duaIntrastat_fk1_idx` (`intrastatFk`), KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30872,7 +30676,7 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -30989,7 +30793,7 @@ CREATE TABLE `ektEntryAssign` ( UNIQUE KEY `ektEntryAssign_ix1` (`kop`,`sub`,`pro`), KEY `ektEntryAssign_FK` (`addressFk`), CONSTRAINT `ektEntryAssign_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31020,7 +30824,7 @@ CREATE TABLE `emergencyMedia` ( `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all emergency phones', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31063,24 +30867,24 @@ DROP TABLE IF EXISTS `entry`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `entry` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) NOT NULL DEFAULT '644', + `supplierFk` int(11) NOT NULL DEFAULT 644, `dated` datetime NOT NULL, `ref` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `isBooked` tinyint(1) NOT NULL DEFAULT '0', - `isInventory` tinyint(1) NOT NULL DEFAULT '0', - `notes` longtext COLLATE utf8_unicode_ci, - `isConfirmed` tinyint(1) NOT NULL DEFAULT '0', - `isOrdered` tinyint(1) NOT NULL DEFAULT '0', - `isRaid` tinyint(1) NOT NULL DEFAULT '0', - `commission` float DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `isBooked` tinyint(1) NOT NULL DEFAULT 0, + `isInventory` tinyint(1) NOT NULL DEFAULT 0, + `notes` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `isConfirmed` tinyint(1) NOT NULL DEFAULT 0, + `isOrdered` tinyint(1) NOT NULL DEFAULT 0, + `isRaid` tinyint(1) NOT NULL DEFAULT 0, + `commission` float DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `evaNotes` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `travelFk` int(11) unsigned DEFAULT NULL, - `currencyFk` tinyint(3) unsigned DEFAULT '1', - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `currencyFk` tinyint(3) unsigned DEFAULT 1, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `gestDocFk` int(11) DEFAULT NULL, `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, - `isBlocked` tinyint(4) NOT NULL DEFAULT '0', + `isBlocked` tinyint(4) NOT NULL DEFAULT 0, `loadPriority` int(11) DEFAULT NULL, `kop` int(11) DEFAULT NULL, `sub` mediumint(8) unsigned DEFAULT NULL, @@ -31325,11 +31129,11 @@ CREATE TABLE `entryLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -31337,7 +31141,7 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31351,13 +31155,13 @@ CREATE TABLE `entryObservation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `entryFk` int(11) NOT NULL, `observationTypeFk` tinyint(3) unsigned DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci, + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `entryFk_observationTypeFk_UNIQUE` (`entryFk`,`observationTypeFk`), KEY `observationType_id_observationTypeFk` (`observationTypeFk`), CONSTRAINT `entry_id_entryFk` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`), CONSTRAINT `observationType_id_observationTypeFk` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31442,7 +31246,7 @@ CREATE TABLE `envialiaCity` ( PRIMARY KEY (`id`), KEY `agencyFk` (`agencyFk`), KEY `postalCode` (`postalCode`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -31479,7 +31283,7 @@ CREATE TABLE `envialiaConfig` ( `endRange` bigint(25) DEFAULT NULL COMMENT 'limite del rango que nos proporciona enviaría', `cargoAgency` varchar(25) COLLATE utf8_unicode_ci DEFAULT '004666' COMMENT 'numero de verdnatura dado por enviaría', `actualNumber` bigint(25) DEFAULT NULL COMMENT 'Numero actual de etiquetas imprimidas , comprimido entre startRange y endRange, ', - `isAlreadyNotified` int(1) NOT NULL DEFAULT '0' COMMENT 'Booleano para que el evento vn.envialiaRangeChecker compruebe si se a enviado una notificación\n', + `isAlreadyNotified` int(1) NOT NULL DEFAULT 0 COMMENT 'Booleano para que el evento vn.envialiaRangeChecker compruebe si se a enviado una notificación\n', `notificationThrehold` int(11) DEFAULT NULL COMMENT 'Umbral para avisar a enviaría de reseetar el startRange y endRange\nSe avisara a enviaría si el umbral + el actualNumber es superior a endRange\n', PRIMARY KEY (`serviceType`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -31498,7 +31302,7 @@ CREATE TABLE `errorLogApp` ( `date` datetime DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31523,7 +31327,7 @@ CREATE TABLE `errorProduction` ( `hourWorked` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `dated` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31546,7 +31350,7 @@ CREATE TABLE `errorProduction__` ( `month` int(11) DEFAULT NULL, `year` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31561,7 +31365,7 @@ CREATE TABLE `erte` ( `workerFk` int(11) NOT NULL, `started` date DEFAULT NULL, `ended` date DEFAULT NULL, - `reduction` int(3) NOT NULL DEFAULT '1', + `reduction` int(3) NOT NULL DEFAULT 1, `monday` tinyint(1) DEFAULT NULL, `tuesday` tinyint(1) DEFAULT NULL, `wednesday` tinyint(1) DEFAULT NULL, @@ -31570,7 +31374,7 @@ CREATE TABLE `erte` ( `saturday` tinyint(1) DEFAULT NULL, `sunday` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31588,21 +31392,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `exchangeInsuranceIn` --- - -DROP TABLE IF EXISTS `exchangeInsuranceIn`; -/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeInsuranceIn` ( - `dated` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `rate` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `exchangeInsuranceOut` -- @@ -31618,25 +31407,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `exchangeReportSourcePrevious` --- - -DROP TABLE IF EXISTS `exchangeReportSourcePrevious`; -/*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeReportSourcePrevious` ( - `dated` tinyint NOT NULL, - `amountIn` tinyint NOT NULL, - `rateIn` tinyint NOT NULL, - `amountOut` tinyint NOT NULL, - `rateOut` tinyint NOT NULL, - `amountEntry` tinyint NOT NULL, - `rateEntry` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `excuse` -- @@ -31647,9 +31417,9 @@ DROP TABLE IF EXISTS `excuse`; CREATE TABLE `excuse` ( `id` int(11) NOT NULL AUTO_INCREMENT, `txt` varchar(255) CHARACTER SET latin1 NOT NULL, - `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `date` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31663,13 +31433,13 @@ CREATE TABLE `expedition` ( `id` int(11) NOT NULL AUTO_INCREMENT, `agencyModeFk` int(11) NOT NULL, `ticketFk` int(10) NOT NULL, - `isBox` int(11) DEFAULT '1' COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `isBox` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk', + `created` timestamp NULL DEFAULT current_timestamp(), `isRefund` bit(1) DEFAULT b'0', `isPickUp` bit(1) DEFAULT b'0', `itemFk` int(11) DEFAULT NULL COMMENT 'Este campo hace referencia al artículo que habria que facturar si las cajas no fueran incluidos.\\nSe debería llamar packageItemFk', `counter` smallint(5) unsigned NOT NULL, - `checked` tinyint(4) NOT NULL DEFAULT '0', + `checked` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, `externalId` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `packagingFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -31840,9 +31610,9 @@ DROP TABLE IF EXISTS `expeditionPallet`; CREATE TABLE `expeditionPallet` ( `id` int(11) NOT NULL AUTO_INCREMENT, `truckFk` int(11) NOT NULL, - `built` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `built` datetime NOT NULL DEFAULT current_timestamp(), `position` int(11) DEFAULT NULL, - `isPrint` tinyint(4) NOT NULL DEFAULT '2', + `isPrint` tinyint(4) NOT NULL DEFAULT 2, PRIMARY KEY (`id`), KEY `expeditionPallet_fk1_idx` (`truckFk`), CONSTRAINT `expeditionPallet_fk1` FOREIGN KEY (`truckFk`) REFERENCES `expeditionTruck` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -31877,26 +31647,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `expeditionPallet_Print` --- - -DROP TABLE IF EXISTS `expeditionPallet_Print`; -/*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionPallet_Print` ( - `truck` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `zone` tinyint NOT NULL, - `eti` tinyint NOT NULL, - `palletFk` tinyint NOT NULL, - `isMatch` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `nombreDia` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `expeditionRoute_Monitor` -- @@ -31943,7 +31693,7 @@ DROP TABLE IF EXISTS `expeditionScan`; CREATE TABLE `expeditionScan` ( `id` int(11) NOT NULL AUTO_INCREMENT, `expeditionFk` int(11) NOT NULL, - `scanned` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `scanned` datetime NOT NULL DEFAULT current_timestamp(), `palletFk` int(11) NOT NULL, `workerFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -32009,7 +31759,7 @@ DROP TABLE IF EXISTS `expeditionState`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `expeditionState` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `expeditionFk` int(11) NOT NULL, `typeFk` int(11) NOT NULL, `userFk` int(11) DEFAULT NULL, @@ -32018,7 +31768,7 @@ CREATE TABLE `expeditionState` ( KEY `expeditionState_FK_1` (`typeFk`), CONSTRAINT `expeditionState_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `expeditionState_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `expeditionStateType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de estados de las expediciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de estados de las expediciones'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -32079,7 +31829,7 @@ CREATE TABLE `expeditionStateType` ( `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Posibles estados de una expedición'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Posibles estados de una expedición'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32306,9 +32056,9 @@ CREATE TABLE `expence` ( `id` varchar(10) NOT NULL, `taxTypeFk` tinyint(4) NOT NULL, `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isConbase` tinyint(4) NOT NULL DEFAULT '1', - `isWithheld` tinyint(4) NOT NULL DEFAULT '0', - `isForSale` tinyint(4) NOT NULL DEFAULT '0', + `isConbase` tinyint(4) NOT NULL DEFAULT 1, + `isWithheld` tinyint(4) NOT NULL DEFAULT 0, + `isForSale` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`,`taxTypeFk`), KEY `iva_tipo_id` (`taxTypeFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -32360,7 +32110,7 @@ CREATE TABLE `floramondoConfig` ( `warehouseOutFk__` smallint(6) unsigned DEFAULT NULL, `agencyModeFk__` int(11) DEFAULT NULL, `MaxLatestDeliveryHour` int(11) DEFAULT NULL, - `MaxLatestOrderHour` int(11) DEFAULT '12' COMMENT 'Hora máxima para aceptar pedidos hoy', + `MaxLatestOrderHour` int(11) DEFAULT 12 COMMENT 'Hora máxima para aceptar pedidos hoy', `LastUpdated` datetime DEFAULT NULL, `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos a mostrar', PRIMARY KEY (`id`), @@ -32370,7 +32120,7 @@ CREATE TABLE `floramondoConfig` ( CONSTRAINT `floramondoConfigAgencyModeFk` FOREIGN KEY (`agencyModeFk__`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `floramondoConfigWarehouseOutFk` FOREIGN KEY (`warehouseOutFk__`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -32402,7 +32152,7 @@ DROP TABLE IF EXISTS `floramondoNotOfferDay__`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `floramondoNotOfferDay__` ( `dated` date NOT NULL, - `warehouseFk` int(11) NOT NULL DEFAULT '60', + `warehouseFk` int(11) NOT NULL DEFAULT 60, PRIMARY KEY (`dated`,`warehouseFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='no muestra oferta en floramondo para ese dia y almacen'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32420,7 +32170,7 @@ CREATE TABLE `fuelType` ( `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32435,7 +32185,7 @@ CREATE TABLE `gateArea` ( `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32471,7 +32221,7 @@ CREATE TABLE `genericAllocation` ( KEY `genericAllocation_longName_IDX` (`longName`) USING BTREE, KEY `genericAllocation_size_IDX` (`size`) USING BTREE, CONSTRAINT `genericAllocation_FK` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32507,7 +32257,7 @@ CREATE TABLE `glsConfig` ( `refund` int(1) DEFAULT NULL, `weight` int(1) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32522,7 +32272,7 @@ CREATE TABLE `glsExpedition__` ( `barcode` bigint(20) unsigned DEFAULT NULL, `uid` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `codexp` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`expeditionFk`), CONSTRAINT `glsInfo_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -32540,8 +32290,8 @@ CREATE TABLE `greuge` ( `clientFk` int(10) unsigned NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `amount` decimal(10,2) NOT NULL, - `shipped` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `shipped` datetime NOT NULL DEFAULT current_timestamp(), + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `greugeTypeFk` int(11) DEFAULT NULL, `ticketFk` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), @@ -32565,7 +32315,7 @@ DELIMITER ;; BEFORE UPDATE ON `greuge` FOR EACH ROW BEGIN - DECLARE vMaxDate DATETIME DEFAULT TIMESTAMPADD(YEAR,1,CURDATE()); + DECLARE vMaxDate DATETIME DEFAULT TIMESTAMPADD(YEAR,1,util.VN_CURDATE()); IF NEW.shipped > vMaxDate THEN SET NEW.shipped = vMaxDate; @@ -32716,7 +32466,7 @@ DELIMITER ;; BEFORE UPDATE ON `host` FOR EACH ROW BEGIN - SET new.updated = NOW(); + SET new.updated = util.VN_NOW(); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32750,11 +32500,11 @@ CREATE TABLE `ink` ( `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `picture` blob NOT NULL, `showOrder` int(11) NOT NULL, - `ball` blob, - `isCargex` tinyint(4) NOT NULL DEFAULT '0', + `ball` blob DEFAULT NULL, + `isCargex` tinyint(4) NOT NULL DEFAULT 0, `dutchCode` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `hex` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL, - `isRealColor` tinyint(1) NOT NULL DEFAULT '1', + `isRealColor` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `dutchCode_UNIQUE` (`dutchCode`), CONSTRAINT `ink_fk1` FOREIGN KEY (`dutchCode`) REFERENCES `edi`.`feature` (`feature_value`) ON DELETE SET NULL ON UPDATE CASCADE @@ -32800,9 +32550,9 @@ DROP TABLE IF EXISTS `intrastat`; CREATE TABLE `intrastat` ( `id` int(8) unsigned zerofill NOT NULL, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `import__` tinyint(4) NOT NULL DEFAULT '0', - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '2', - `taxCodeFk` tinyint(2) unsigned NOT NULL DEFAULT '64', + `import__` tinyint(4) NOT NULL DEFAULT 0, + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `taxCodeFk` tinyint(2) unsigned NOT NULL DEFAULT 64, PRIMARY KEY (`id`), KEY `iva_group_id` (`taxClassFk`), CONSTRAINT `intrastat_ibfk_1` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE @@ -32838,7 +32588,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32852,7 +32602,7 @@ CREATE TABLE `inventoryFailureCause` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32867,7 +32617,7 @@ CREATE TABLE `invoiceCorrection` ( `correctedFk` int(10) unsigned NOT NULL COMMENT 'Factura rectificada', `cplusRectificationTypeFk` int(10) unsigned NOT NULL, `cplusInvoiceType477Fk` int(10) unsigned NOT NULL, - `invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT '3', + `invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT 3, PRIMARY KEY (`correctingFk`), KEY `correctedFk_idx` (`correctedFk`), KEY `invoiceCorrection_ibfk_1_idx` (`cplusRectificationTypeFk`), @@ -32913,7 +32663,7 @@ CREATE TABLE `invoiceCorrectionType` ( `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32930,20 +32680,20 @@ CREATE TABLE `invoiceIn` ( `supplierFk` int(11) NOT NULL, `issued` date DEFAULT NULL COMMENT 'Fecha de emision de la factura', `supplierRef` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `isBooked` tinyint(1) NOT NULL DEFAULT '0', - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `isBooked` tinyint(1) NOT NULL DEFAULT 0, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `docFk` int(11) DEFAULT NULL, `booked` date DEFAULT NULL COMMENT 'Fecha de contabilizacion', `operated` date DEFAULT NULL COMMENT 'Fecha de entrega de la mercancia o el suministro', - `cplusInvoiceType472Fk` int(10) unsigned DEFAULT '1', - `cplusRectificationTypeFk` int(10) unsigned DEFAULT '1', - `cplusSubjectOpFk` int(10) unsigned DEFAULT '1', - `cplusTaxBreakFk` int(10) unsigned DEFAULT '1', - `cplusTrascendency472Fk` int(10) unsigned DEFAULT '1', + `cplusInvoiceType472Fk` int(10) unsigned DEFAULT 1, + `cplusRectificationTypeFk` int(10) unsigned DEFAULT 1, + `cplusSubjectOpFk` int(10) unsigned DEFAULT 1, + `cplusTaxBreakFk` int(10) unsigned DEFAULT 1, + `cplusTrascendency472Fk` int(10) unsigned DEFAULT 1, `bookEntried` date DEFAULT NULL COMMENT 'Fecha Asiento', - `isVatDeductible` tinyint(1) NOT NULL DEFAULT '1', + `isVatDeductible` tinyint(1) NOT NULL DEFAULT 1, `withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE', `expenceFkDeductible` varchar(10) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`), @@ -33119,21 +32869,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `invoiceInAwb__` --- - -DROP TABLE IF EXISTS `invoiceInAwb__`; -/*!50001 DROP VIEW IF EXISTS `invoiceInAwb__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceInAwb__` ( - `invoiceInFk` tinyint NOT NULL, - `awbFk` tinyint NOT NULL, - `dua` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoiceInDueDay` -- @@ -33145,10 +32880,10 @@ CREATE TABLE `invoiceInDueDay` ( `id` int(11) NOT NULL AUTO_INCREMENT, `invoiceInFk` mediumint(8) unsigned NOT NULL, `dueDated` date NOT NULL, - `bankFk` int(11) NOT NULL DEFAULT '3117', - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `bankFk` int(11) NOT NULL DEFAULT 3117, + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `foreignValue` decimal(10,2) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `recibida_id` (`invoiceInFk`), KEY `banco_id` (`bankFk`), @@ -33177,7 +32912,7 @@ BEGIN JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - IF (NEW.dueDated <= CURDATE() AND vIsNotified) + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( 'begonya@verdnatura.es', @@ -33217,7 +32952,7 @@ BEGIN JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - IF (NEW.dueDated <= CURDATE() AND vIsNotified) + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( 'begonya@verdnatura.es', @@ -33237,25 +32972,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `invoiceInDueDay__` --- - -DROP TABLE IF EXISTS `invoiceInDueDay__`; -/*!50001 DROP VIEW IF EXISTS `invoiceInDueDay__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceInDueDay__` ( - `id` tinyint NOT NULL, - `invoiceInFk` tinyint NOT NULL, - `dueDated` tinyint NOT NULL, - `bankFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `foreignValue` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoiceInIntrastat` -- @@ -33267,41 +32983,20 @@ CREATE TABLE `invoiceInIntrastat` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `invoiceInFk` mediumint(8) unsigned NOT NULL, `net` decimal(10,2) DEFAULT NULL, - `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT '06049190', + `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT 06049190, `amount` double NOT NULL, `stems` int(11) NOT NULL, `countryFk` mediumint(8) unsigned DEFAULT NULL, - `dated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `statisticalValue` double NOT NULL DEFAULT '0', + `dated` timestamp NOT NULL DEFAULT current_timestamp(), + `statisticalValue` double NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `intrastat_id` (`intrastatFk`), KEY `invoiceInIntrastat_FK` (`invoiceInFk`), CONSTRAINT `invoiceInIntrastat_FK` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE, CONSTRAINT `invoiceInIntrastat_ibfk_1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `invoiceInIntrastat2__` --- - -DROP TABLE IF EXISTS `invoiceInIntrastat2__`; -/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat2__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceInIntrastat2__` ( - `id` tinyint NOT NULL, - `invoiceInFk` tinyint NOT NULL, - `net` tinyint NOT NULL, - `intrastatFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `stems` tinyint NOT NULL, - `countryFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `statisticalValue` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoiceInIntrastat__` -- @@ -33333,11 +33028,11 @@ CREATE TABLE `invoiceInLog` ( `originFk` mediumint(8) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -33361,7 +33056,7 @@ CREATE TABLE `invoiceInSage` ( `invoiceInSerialFk` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `taxTypeSageFk` smallint(6) NOT NULL, `transactionTypeSageFk` tinyint(4) NOT NULL, - `isService` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para diferenciar producto de servicio', + `isService` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para diferenciar producto de servicio', `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL, `withholdingSageFk` smallint(6) DEFAULT NULL, PRIMARY KEY (`id`), @@ -33378,7 +33073,7 @@ CREATE TABLE `invoiceInSage` ( CONSTRAINT `invoiceInSage_taxTypeSageFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_withholdingSageFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciones de entrelas series de facturas recibidas y sus tipo de IVA con código Iva y codigo de Transación en Sage. Para precontabilizadar facturas recibidas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciones de entrelas series de facturas recibidas y sus tipo de IVA con código Iva y codigo de Transación en Sage. Para precontabilizadar facturas recibidas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33391,7 +33086,7 @@ DROP TABLE IF EXISTS `invoiceInSerial`; CREATE TABLE `invoiceInSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `cplusTerIdNifFk` int(11) NOT NULL DEFAULT '1', + `cplusTerIdNifFk` int(11) NOT NULL DEFAULT 1, `taxAreaFk` varchar(15) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`code`), KEY `InvoiceInSerial_Fk1_idx` (`cplusTerIdNifFk`), @@ -33417,7 +33112,7 @@ CREATE TABLE `invoiceInTax` ( `foreignValue` decimal(10,2) DEFAULT NULL, `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE', `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Tipo de transacción SAGE', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), KEY `recibida_id` (`invoiceInFk`), KEY `recibida_iva_ibfk_2` (`taxCodeFk`), @@ -33440,13 +33135,13 @@ DROP TABLE IF EXISTS `invoiceInTaxBookingAccount`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInTaxBookingAccount` ( `id` int(10) NOT NULL AUTO_INCREMENT, - `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `effectived` timestamp NOT NULL DEFAULT current_timestamp(), `account` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL, `priority` int(2) unsigned DEFAULT NULL, - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', - `rate` decimal(5,2) NOT NULL DEFAULT '0.00', + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 1, + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, + `rate` decimal(5,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`id`), KEY `invoiceInTaxBookingAccount_fk1_idx` (`taxAreaFk`), KEY `invoiceInTaxBookingAccount_fk2_idx` (`taxClassFk`), @@ -33454,42 +33149,9 @@ CREATE TABLE `invoiceInTaxBookingAccount` ( CONSTRAINT `invoiceInTaxBookingAccount_fk1` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk2` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk3` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `invoiceIn__` --- - -DROP TABLE IF EXISTS `invoiceIn__`; -/*!50001 DROP VIEW IF EXISTS `invoiceIn__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceIn__` ( - `id` tinyint NOT NULL, - `serialNumber` tinyint NOT NULL, - `serial` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `issued` tinyint NOT NULL, - `supplierRef` tinyint NOT NULL, - `isBooked` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `created` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `docFk` tinyint NOT NULL, - `booked` tinyint NOT NULL, - `operated` tinyint NOT NULL, - `cplusInvoiceType472Fk` tinyint NOT NULL, - `cplusRectificationTypeFk` tinyint NOT NULL, - `cplusSubjectOpFk` tinyint NOT NULL, - `cplusTaxBreakFk` tinyint NOT NULL, - `cplusTrascendency472Fk` tinyint NOT NULL, - `bookEntried` tinyint NOT NULL, - `isVatDeductible` tinyint NOT NULL, - `withholdingSageFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoiceOut` -- @@ -33502,25 +33164,25 @@ CREATE TABLE `invoiceOut` ( `ref` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `serial` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `issued` date DEFAULT NULL, - `amount` decimal(12,2) DEFAULT '0.00', + `amount` decimal(12,2) DEFAULT 0.00, `dued` datetime DEFAULT NULL, `bankFk` int(11) DEFAULT NULL, - `clientFk` int(11) DEFAULT '0', - `taxableBase7__` decimal(12,2) DEFAULT '0.00', - `taxableBase16__` decimal(12,2) DEFAULT '0.00', - `equ1__` decimal(12,2) DEFAULT '0.00', - `equ4__` decimal(12,2) DEFAULT '0.00', - `vat7__` decimal(12,2) DEFAULT '0.00', - `vat16__` decimal(12,2) DEFAULT '0.00', - `workerFk__` int(11) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `hasPdf` tinyint(3) unsigned NOT NULL DEFAULT '0', + `clientFk` int(11) DEFAULT 0, + `taxableBase7__` decimal(12,2) DEFAULT 0.00, + `taxableBase16__` decimal(12,2) DEFAULT 0.00, + `equ1__` decimal(12,2) DEFAULT 0.00, + `equ4__` decimal(12,2) DEFAULT 0.00, + `vat7__` decimal(12,2) DEFAULT 0.00, + `vat16__` decimal(12,2) DEFAULT 0.00, + `workerFk__` int(11) DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `hasPdf` tinyint(3) unsigned NOT NULL DEFAULT 0, `booked` date DEFAULT NULL, - `cplusInvoiceType477Fk` int(10) unsigned NOT NULL DEFAULT '1', - `cplusTaxBreakFk` int(10) unsigned NOT NULL DEFAULT '1', - `cplusSubjectOpFk` int(10) unsigned NOT NULL DEFAULT '1', - `cplusTrascendency477Fk` int(10) unsigned NOT NULL DEFAULT '1', + `cplusInvoiceType477Fk` int(10) unsigned NOT NULL DEFAULT 1, + `cplusTaxBreakFk` int(10) unsigned NOT NULL DEFAULT 1, + `cplusSubjectOpFk` int(10) unsigned NOT NULL DEFAULT 1, + `cplusTrascendency477Fk` int(10) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`,`ref`), UNIQUE KEY `Id_Factura` (`ref`), KEY `Id_Banco` (`bankFk`), @@ -33563,7 +33225,7 @@ BEGIN SELECT CONCAT(NEW.serial, IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , - RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(CURDATE()), 2)), 7,'0')) + 1) INTO vRef + RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(util.VN_CURDATE()), 2)), 7,'0')) + 1) INTO vRef FROM invoiceOut i LEFT JOIN company c ON c.id = i.companyFk WHERE i.serial = NEW.serial @@ -33573,7 +33235,7 @@ BEGIN SELECT CONCAT(NEW.serial, IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , - RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(CURDATE()), 2)), 8,'0')) + 1) INTO vRef + RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(util.VN_CURDATE()), 2)), 8,'0')) + 1) INTO vRef FROM invoiceOut i LEFT JOIN company c ON c.id = i.companyFk WHERE i.serial = NEW.serial @@ -33673,9 +33335,9 @@ DROP TABLE IF EXISTS `invoiceOutExpence`; CREATE TABLE `invoiceOutExpence` ( `id` int(11) NOT NULL AUTO_INCREMENT, `invoiceOutFk` int(10) unsigned NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `invoiceOutExpence_FK_1_idx` (`invoiceOutFk`), KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), @@ -33694,12 +33356,12 @@ DROP TABLE IF EXISTS `invoiceOutSerial`; CREATE TABLE `invoiceOutSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isTaxed` tinyint(1) NOT NULL DEFAULT '1', + `isTaxed` tinyint(1) NOT NULL DEFAULT 1, `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'NATIONAL', - `isCEE` tinyint(1) NOT NULL DEFAULT '0', - `cplusInvoiceType477Fk` int(10) unsigned DEFAULT '1', - `footNotes` longtext COLLATE utf8_unicode_ci, - `isRefEditable` tinyint(4) NOT NULL DEFAULT '0', + `isCEE` tinyint(1) NOT NULL DEFAULT 0, + `cplusInvoiceType477Fk` int(10) unsigned DEFAULT 1, + `footNotes` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `isRefEditable` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`code`), KEY `taxAreaFk_idx` (`taxAreaFk`), CONSTRAINT `invoiceOutSeriaTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE @@ -33717,8 +33379,8 @@ CREATE TABLE `invoiceOutTax` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `invoiceOutFk` int(10) unsigned NOT NULL, `taxableBase` decimal(10,2) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `vat` decimal(10,2) NOT NULL DEFAULT '0.00', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `vat` decimal(10,2) NOT NULL DEFAULT 0.00, `pgcFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0000000000', PRIMARY KEY (`id`), UNIQUE KEY `invoiceOutTax_Resctriccion` (`invoiceOutFk`,`pgcFk`), @@ -33741,7 +33403,7 @@ CREATE TABLE `invoiceOutTaxConfig` ( `taxClassCodeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `taxTypeSageFk` smallint(6) DEFAULT NULL, `transactionTypeSageFk` tinyint(4) DEFAULT NULL, - `isService` tinyint(1) DEFAULT '0', + `isService` tinyint(1) DEFAULT 0, `expenceFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `invoiceOutTaxConfig_FK` (`taxClassCodeFk`), @@ -33750,7 +33412,7 @@ CREATE TABLE `invoiceOutTaxConfig` ( CONSTRAINT `invoiceOutTaxConfig_FK` FOREIGN KEY (`taxClassCodeFk`) REFERENCES `taxClass` (`code`), CONSTRAINT `invoiceOutTaxConfig_FK_1` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`), CONSTRAINT `invoiceOutTaxConfig_FK_2` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33765,33 +33427,33 @@ CREATE TABLE `item` ( `equivalent` int(11) unsigned DEFAULT NULL, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `size` int(10) unsigned DEFAULT NULL, - `stems` int(11) DEFAULT '1', - `minPrice` double DEFAULT '0', - `isToPrint` tinyint(1) NOT NULL DEFAULT '0', - `isDeliveryNote__` tinyint(1) NOT NULL DEFAULT '0', - `taxClassFk__` tinyint(4) unsigned NOT NULL DEFAULT '1', + `stems` int(11) DEFAULT 1, + `minPrice` double DEFAULT 0, + `isToPrint` tinyint(1) NOT NULL DEFAULT 0, + `isDeliveryNote__` tinyint(1) NOT NULL DEFAULT 0, + `taxClassFk__` tinyint(4) unsigned NOT NULL DEFAULT 1, `family` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT 'VT', - `box` tinyint(1) NOT NULL DEFAULT '0', + `box` tinyint(1) NOT NULL DEFAULT 0, `category` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `originFk` tinyint(2) unsigned NOT NULL, - `doPhoto` tinyint(4) NOT NULL DEFAULT '0', + `doPhoto` tinyint(4) NOT NULL DEFAULT 0, `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `inkFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `niche__` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT '06039010', - `hasMinPrice` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isOnOffer__` tinyint(4) NOT NULL DEFAULT '0', - `isBargain__` tinyint(4) NOT NULL DEFAULT '0', + `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT 06039010, + `hasMinPrice` tinyint(1) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `isOnOffer__` tinyint(4) NOT NULL DEFAULT 0, + `isBargain__` tinyint(4) NOT NULL DEFAULT 0, `comment` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `typeFk` smallint(5) unsigned NOT NULL, - `generic` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `generic` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `producerFk` mediumint(3) unsigned DEFAULT NULL, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `density` int(11) NOT NULL DEFAULT '167' COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes, si no se especifica se pone por defecto la del tipo en un trigger', - `relevancy` tinyint(1) NOT NULL DEFAULT '0', + `density` int(11) NOT NULL DEFAULT 167 COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes, si no se especifica se pone por defecto la del tipo en un trigger', + `relevancy` tinyint(1) NOT NULL DEFAULT 0, `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '7001000000', - `isActive` tinyint(1) NOT NULL DEFAULT '1', + `isActive` tinyint(1) NOT NULL DEFAULT 1, `longName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `subName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `tag5` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -33806,9 +33468,9 @@ CREATE TABLE `item` ( `value9` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `tag10` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `value10` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `compression` decimal(5,2) NOT NULL DEFAULT '1.00' COMMENT 'Relacion de compresividad entre el volumen de las entradas en Silla y el empaquetado en los envios a clientes.\n\nMenor que 1 significa que se puede comprimir más que el volumen original.', - `minimum` decimal(10,0) unsigned NOT NULL DEFAULT '3' COMMENT 'Cantidad máxima de cajas / cubos que cabe en un nicho', - `upToDown` decimal(10,0) unsigned NOT NULL DEFAULT '0' COMMENT 'Se muestra el precio por kilo ', + `compression` decimal(5,2) NOT NULL DEFAULT 1.00 COMMENT 'Relacion de compresividad entre el volumen de las entradas en Silla y el empaquetado en los envios a clientes.\n\nMenor que 1 significa que se puede comprimir más que el volumen original.', + `minimum` decimal(10,0) unsigned NOT NULL DEFAULT 3 COMMENT 'Cantidad máxima de cajas / cubos que cabe en un nicho', + `upToDown` decimal(10,0) unsigned NOT NULL DEFAULT 0 COMMENT 'Se muestra el precio por kilo ', `supplyResponseFk` int(11) DEFAULT NULL, `hasKgPrice` tinyint(1) NOT NULL DEFAULT '0', `sectorFk` int(11) DEFAULT NULL, @@ -33818,7 +33480,7 @@ CREATE TABLE `item` ( `embalageCode` int(11) DEFAULT NULL COMMENT 'Campo para Floramondo', `quality` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Campo para Floramondo', `stars` int(11) DEFAULT NULL, - `stemMultiplier` double NOT NULL DEFAULT '1' COMMENT 'este valor multiplica las unidades y divide los precios en el procedimiento edi.ekt_load', + `stemMultiplier` double NOT NULL DEFAULT 1 COMMENT 'este valor multiplica las unidades y divide los precios en el procedimiento edi.ekt_load', `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `packingOut` decimal(10,2) DEFAULT NULL COMMENT 'cantidad que cabe en una caja de verdnatura', `genericFk` int(11) DEFAULT NULL COMMENT 'Item genérico', @@ -34086,10 +33748,10 @@ CREATE TABLE `itemCategory` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `order` int(10) unsigned DEFAULT NULL, - `display` tinyint(4) NOT NULL DEFAULT '1', + `display` tinyint(4) NOT NULL DEFAULT 1, `color` char(6) COLLATE utf8_unicode_ci DEFAULT NULL, - `shortLife` int(11) NOT NULL DEFAULT '0' COMMENT 'Sirve para filtrar aquellos reinos que tienen precios estables', - `merchandise` tinyint(1) NOT NULL DEFAULT '1', + `shortLife` int(11) NOT NULL DEFAULT 0 COMMENT 'Sirve para filtrar aquellos reinos que tienen precios estables', + `merchandise` tinyint(1) NOT NULL DEFAULT 1, `icon` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `isReclining` tinyint(4) NOT NULL DEFAULT '1', @@ -34208,15 +33870,15 @@ DROP TABLE IF EXISTS `itemCost`; CREATE TABLE `itemCost` ( `itemFk` int(11) NOT NULL, `warehouseFk` smallint(6) unsigned NOT NULL, - `quantity` int(10) NOT NULL DEFAULT '0', - `rotation` decimal(10,4) NOT NULL DEFAULT '0.0000', - `cm3` int(11) NOT NULL DEFAULT '0', - `storage` decimal(10,4) NOT NULL DEFAULT '0.0000', - `handling` decimal(10,4) NOT NULL DEFAULT '0.0000', - `extraCharge` decimal(10,4) NOT NULL DEFAULT '0.0000', - `wasted` decimal(10,4) NOT NULL DEFAULT '0.0000', - `cm3delivery` int(11) NOT NULL DEFAULT '0', - `grams` int(11) NOT NULL DEFAULT '0' COMMENT 'peso en gramos de una unidad de venta', + `quantity` int(10) NOT NULL DEFAULT 0, + `rotation` decimal(10,4) NOT NULL DEFAULT 0.0000, + `cm3` int(11) NOT NULL DEFAULT 0, + `storage` decimal(10,4) NOT NULL DEFAULT 0.0000, + `handling` decimal(10,4) NOT NULL DEFAULT 0.0000, + `extraCharge` decimal(10,4) NOT NULL DEFAULT 0.0000, + `wasted` decimal(10,4) NOT NULL DEFAULT 0.0000, + `cm3delivery` int(11) NOT NULL DEFAULT 0, + `grams` int(11) NOT NULL DEFAULT 0 COMMENT 'peso en gramos de una unidad de venta', PRIMARY KEY (`itemFk`,`warehouseFk`), KEY `warehouse_id_rotacion_idx` (`warehouseFk`), CONSTRAINT `id_article_rotaci` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -34272,7 +33934,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND ic.itemFk = NEW.itemFk - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN CALL mail_insert( @@ -34350,11 +34012,11 @@ DROP TABLE IF EXISTS `itemImageQueue`; CREATE TABLE `itemImageQueue` ( `itemFk` int(11) NOT NULL, `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `error` text COLLATE utf8_unicode_ci, - `attempts` int(11) DEFAULT '0', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `priority` int(11) DEFAULT '99', + `error` text COLLATE utf8_unicode_ci DEFAULT NULL, + `attempts` int(11) DEFAULT 0, + `created` timestamp NULL DEFAULT current_timestamp(), + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `priority` int(11) DEFAULT 99, PRIMARY KEY (`itemFk`), CONSTRAINT `itemImageQueueItemIdx` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola para añadir las imagenes al campo vn.item.image a partir de una url'; @@ -34389,7 +34051,7 @@ CREATE TABLE `itemLabel` ( `price` decimal(10,2) DEFAULT NULL, `labels` int(11) DEFAULT NULL COMMENT 'Tabla hecha para Ruben Espinosa, para sacar etiquetas en Holanda para un cliente.', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34404,11 +34066,11 @@ CREATE TABLE `itemLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -34460,11 +34122,11 @@ DROP TABLE IF EXISTS `itemPlacement`; CREATE TABLE `itemPlacement` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `modificationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `modificationDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `reserve` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `pickable` int(11) unsigned NOT NULL DEFAULT '0', + `pickable` int(11) unsigned NOT NULL DEFAULT 0, `sectorFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Id_Article_UNIQUE` (`itemFk`,`warehouseFk`), @@ -34531,9 +34193,9 @@ DROP TABLE IF EXISTS `itemPlacementSupply`; CREATE TABLE `itemPlacementSupply` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, - `quantity` decimal(10,0) NOT NULL DEFAULT '0', - `priority` int(10) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `quantity` decimal(10,0) NOT NULL DEFAULT 0, + `priority` int(10) unsigned NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned NOT NULL COMMENT 'Persona que crea la orden', `repoUserFk` int(10) unsigned DEFAULT NULL COMMENT 'Reponedor que la tiene asignada', `sectorFk` int(11) DEFAULT NULL, @@ -34546,7 +34208,7 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk4` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34599,7 +34261,7 @@ DROP TABLE IF EXISTS `itemProposal`; CREATE TABLE `itemProposal` ( `itemFk` int(11) NOT NULL, `mateFk` int(11) NOT NULL, - `counter` int(11) NOT NULL DEFAULT '0', + `counter` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`itemFk`,`mateFk`), KEY `itemProposal_fk2_idx` (`mateFk`), CONSTRAINT `itemProposal_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -34616,7 +34278,7 @@ DROP TABLE IF EXISTS `itemRepo__`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemRepo__` ( `itemFk` int(11) NOT NULL, - `quantity` int(10) unsigned NOT NULL DEFAULT '0', + `quantity` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`itemFk`), CONSTRAINT `itemRepo_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -34884,7 +34546,7 @@ CREATE TABLE `itemShelvingLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemShelvingFk` int(10) unsigned DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `accion` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `itemFk` int(11) DEFAULT NULL, `shelvingFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -34910,17 +34572,17 @@ CREATE TABLE `itemShelvingPlacementSupply` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemShelvingFk` int(10) unsigned NOT NULL, `itemPlacementSupplyFk` int(10) unsigned NOT NULL, - `quantity` decimal(10,0) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `quantity` decimal(10,0) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned NOT NULL, - `isPicked` tinyint(4) NOT NULL DEFAULT '0', + `isPicked` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `itemShelvingPlacementSupply_fk1_idx` (`itemShelvingFk`), KEY `itemShelvingPlacementSupply_fk2_idx` (`itemPlacementSupplyFk`), KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34959,8 +34621,8 @@ CREATE TABLE `itemShelvingSale` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemShelvingFk` int(10) unsigned NOT NULL, `saleFk` int(11) NOT NULL, - `quantity` decimal(10,0) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `quantity` decimal(10,0) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `itemShelvingSale_fk1_idx` (`itemShelvingFk`), @@ -35109,7 +34771,7 @@ CREATE TABLE `itemTag` ( `tagFk` int(11) NOT NULL, `value` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `intValue` int(11) DEFAULT NULL, - `priority` int(2) NOT NULL DEFAULT '0', + `priority` int(2) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `itemTagItemUq` (`itemFk`,`tagFk`), KEY `tagFk` (`tagFk`,`value`), @@ -35294,8 +34956,8 @@ CREATE TABLE `itemTaxCountry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) DEFAULT NULL, `countryFk` mediumint(8) unsigned DEFAULT NULL, - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 1, + `effectived` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `itemFk_UNIQUE` (`itemFk`,`countryFk`), KEY `taxClassFK_idx` (`taxClassFk`), @@ -35340,29 +35002,29 @@ CREATE TABLE `itemType` ( `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `gramsMin` int(11) DEFAULT NULL, `gramsMax` int(11) DEFAULT NULL, - `order` int(11) DEFAULT '0', + `order` int(11) DEFAULT 0, `categoryFk` int(10) unsigned NOT NULL, `workerFk` int(10) unsigned NOT NULL, - `isInventory` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Se utiliza tanto en el cálculo del inventario, como en el del informe del inventario valorado', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `f11` tinyint(4) NOT NULL DEFAULT '0', - `transaction` tinyint(4) NOT NULL DEFAULT '0', + `isInventory` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Se utiliza tanto en el cálculo del inventario, como en el del informe del inventario valorado', + `created` timestamp NULL DEFAULT current_timestamp(), + `f11` tinyint(4) NOT NULL DEFAULT 0, + `transaction` tinyint(4) NOT NULL DEFAULT 0, `making` int(10) unsigned DEFAULT NULL COMMENT 'Son productos de confección propia', `location` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `life` smallint(5) unsigned DEFAULT NULL, - `maneuver` double NOT NULL DEFAULT '0.21', - `target` double NOT NULL DEFAULT '0.15', - `topMargin` double NOT NULL DEFAULT '0.3', - `profit` double NOT NULL DEFAULT '0.02', - `density` double NOT NULL DEFAULT '167' COMMENT 'Almacena el valor por defecto de la densidad en kg/m3 para el calculo de los portes aereos, en articulos se guarda la correcta', - `promo` double NOT NULL DEFAULT '0', - `isPackaging` tinyint(1) NOT NULL DEFAULT '0', - `hasComponents` tinyint(1) NOT NULL DEFAULT '1', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '60', - `compression` decimal(5,2) DEFAULT '1.00', + `maneuver` double NOT NULL DEFAULT 0.21, + `target` double NOT NULL DEFAULT 0.15, + `topMargin` double NOT NULL DEFAULT 0.3, + `profit` double NOT NULL DEFAULT 0.02, + `density` double NOT NULL DEFAULT 167 COMMENT 'Almacena el valor por defecto de la densidad en kg/m3 para el calculo de los portes aereos, en articulos se guarda la correcta', + `promo` double NOT NULL DEFAULT 0, + `isPackaging` tinyint(1) NOT NULL DEFAULT 0, + `hasComponents` tinyint(1) NOT NULL DEFAULT 1, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, + `compression` decimal(5,2) DEFAULT 1.00, `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `temperatureFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL, - `isUnconventionalSize` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'familia con productos cuyas medidas no son aptas para la cinta transportadora o paletizar', + `isUnconventionalSize` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'familia con productos cuyas medidas no son aptas para la cinta transportadora o paletizar', PRIMARY KEY (`code`), UNIQUE KEY `tipo_id_UNIQUE` (`id`), UNIQUE KEY `Tipo_UNIQUE` (`name`,`categoryFk`), @@ -35458,7 +35120,7 @@ CREATE TABLE `itemTypeRestriction` ( UNIQUE KEY `itemTypeRestriction_UN` (`itemTypeFk`,`dated`), KEY `itemTypeRestriction_dated_IDX` (`dated`,`itemTypeFk`) USING BTREE, CONSTRAINT `itemTypeRestriction_itemType_id_fk` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35472,7 +35134,7 @@ CREATE TABLE `itemTypeTag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemTypeFk` smallint(5) unsigned NOT NULL, `tagFk` int(11) NOT NULL, - `priority` int(2) unsigned NOT NULL DEFAULT '0', + `priority` int(2) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `itemTypeFk_UNIQUE` (`itemTypeFk`,`tagFk`), KEY `itemTypeTagTipo_idx` (`itemTypeFk`), @@ -35560,11 +35222,11 @@ DROP TABLE IF EXISTS `labourTree`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `labourTree` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `lft` int(11) NOT NULL, `rgt` int(11) NOT NULL, - `depth` bigint(22) NOT NULL DEFAULT '0', + `depth` bigint(22) NOT NULL DEFAULT 0, `sons` decimal(10,0) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -35674,9 +35336,9 @@ CREATE TABLE `machine` ( `type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `use` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `productionYear` int(11) DEFAULT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `ppeFk` int(11) DEFAULT NULL, `supplierFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -35688,7 +35350,7 @@ CREATE TABLE `machine` ( CONSTRAINT `machine_FK` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `machine_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `machine_FK_2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -35735,7 +35397,7 @@ CREATE TABLE `machineDetail` ( CONSTRAINT `machineDetail_FK` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `machineDetail_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `machineDetail_FK_2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35754,7 +35416,7 @@ CREATE TABLE `machineDms` ( KEY `machineDms_FK` (`dmsFk`), CONSTRAINT `machineDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `machineDms_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35768,14 +35430,14 @@ CREATE TABLE `machineWorker` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `workerFk` int(10) unsigned NOT NULL, `machineFk` int(11) NOT NULL, - `inTimed` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `inTimed` datetime NOT NULL DEFAULT current_timestamp(), `outTimed` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `machineWorker_FK_1` (`machineFk`), KEY `machineWorker_FK` (`workerFk`), CONSTRAINT `machineWorker_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `machineWorker_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35789,7 +35451,7 @@ CREATE TABLE `machineWorkerConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `maxHours` smallint(5) unsigned NOT NULL COMMENT 'Indicates how many hours a user record is reviewed to update or insert', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35806,13 +35468,13 @@ CREATE TABLE `mail` ( `replyTo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `body` text COLLATE utf8_unicode_ci NOT NULL, - `sent` tinyint(2) NOT NULL DEFAULT '0', - `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `sent` tinyint(2) NOT NULL DEFAULT 0, + `creationDate` timestamp NOT NULL DEFAULT current_timestamp(), `attachment` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'OK', `senderFk` int(11) DEFAULT NULL, `recipientFk` int(11) DEFAULT NULL, - `plainTextBody` text COLLATE utf8_unicode_ci, + `plainTextBody` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `sent_idx` (`sent`), KEY `creation_idx` (`creationDate`) @@ -35857,7 +35519,7 @@ CREATE TABLE `mailTemplates` ( `name` varchar(50) CHARACTER SET utf8 NOT NULL, `attachmentPath` text CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35872,7 +35534,7 @@ CREATE TABLE `mandate` ( `clientFk` int(11) NOT NULL, `companyFk` smallint(5) unsigned NOT NULL, `code` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), `finished` timestamp NULL DEFAULT NULL, `mandateTypeFk` smallint(5) NOT NULL, PRIMARY KEY (`id`), @@ -35933,11 +35595,11 @@ DROP TABLE IF EXISTS `manuscript`; CREATE TABLE `manuscript` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) CHARACTER SET utf8 NOT NULL, - `description` text COLLATE utf8_unicode_ci, - `enabled` tinyint(1) NOT NULL DEFAULT '1', + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, + `enabled` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35951,7 +35613,7 @@ CREATE TABLE `medicalCenter` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35970,13 +35632,13 @@ CREATE TABLE `medicalReview` ( `isFit` tinyint(1) DEFAULT NULL, `amount` double DEFAULT NULL, `invoice` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `remark` longtext COLLATE utf8_unicode_ci, + `remark` longtext COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `frgcenter_idx` (`centerFk`), KEY `frgnkWorker_idx` (`workerFk`), CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35991,13 +35653,13 @@ CREATE TABLE `message` ( `uuid` varchar(50) CHARACTER SET utf8 NOT NULL, `sender` varchar(50) CHARACTER SET utf8 NOT NULL, `recipient` varchar(50) CHARACTER SET utf8 NOT NULL, - `message` longtext CHARACTER SET utf8, - `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `message` longtext CHARACTER SET utf8 DEFAULT NULL, + `sendDate` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36013,13 +35675,13 @@ CREATE TABLE `messageInbox` ( `sender` varchar(50) CHARACTER SET utf8 NOT NULL, `recipient` varchar(45) CHARACTER SET utf8 NOT NULL, `finalRecipient` varchar(50) CHARACTER SET utf8 NOT NULL, - `message` longtext CHARACTER SET utf8, - `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `message` longtext CHARACTER SET utf8 DEFAULT NULL, + `sendDate` timestamp NULL DEFAULT current_timestamp(), `read` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36073,7 +35735,7 @@ CREATE TABLE `mistakeType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36087,9 +35749,9 @@ CREATE TABLE `mobileAppVersionControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `appName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `version` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', - `IsVersionCritical` tinyint(1) DEFAULT '0', + `IsVersionCritical` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36155,12 +35817,12 @@ CREATE TABLE `noticeCategory` ( `keyName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `subject` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci, - `isEnabled` tinyint(1) NOT NULL DEFAULT '1', - `requiredRole` int(11) NOT NULL DEFAULT '1', + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, + `isEnabled` tinyint(1) NOT NULL DEFAULT 1, + `requiredRole` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `keyName_UNIQUE` (`keyName`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36171,8 +35833,8 @@ DROP TABLE IF EXISTS `noticeSubscription`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `noticeSubscription` ( - `noticeCategoryFk` int(11) NOT NULL DEFAULT '0', - `userFk` int(10) unsigned NOT NULL DEFAULT '0', + `noticeCategoryFk` int(11) NOT NULL DEFAULT 0, + `userFk` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`noticeCategoryFk`,`userFk`), KEY `noticeSubscription_ibfk_2` (`userFk`), CONSTRAINT `noticeSubscription_ibfk_1` FOREIGN KEY (`noticeCategoryFk`) REFERENCES `noticeCategory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -36191,7 +35853,7 @@ CREATE TABLE `observationType` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `hasNewBornMessage` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica aquellos que deben de recibir un mensaje advirtiendo de un cliente nuevo', + `hasNewBornMessage` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica aquellos que deben de recibir un mensaje advirtiendo de un cliente nuevo', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36219,7 +35881,7 @@ DROP TABLE IF EXISTS `orderTicket`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderTicket` ( `orderFk` int(10) unsigned NOT NULL, - `ticketFk` int(11) NOT NULL DEFAULT '0', + `ticketFk` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`ticketFk`,`orderFk`), KEY `order_id` (`orderFk`), CONSTRAINT `hedera_id` FOREIGN KEY (`orderFk`) REFERENCES `hedera`.`order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -36238,10 +35900,10 @@ CREATE TABLE `origin` ( `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(5) unsigned DEFAULT '4', - `flag` blob, - `nl` tinyint(4) NOT NULL DEFAULT '0', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', + `warehouseFk` smallint(5) unsigned DEFAULT 4, + `flag` blob DEFAULT NULL, + `nl` tinyint(4) NOT NULL DEFAULT 0, + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `Abreviatura` (`code`), KEY `warehouse_id` (`warehouseFk`), @@ -36308,7 +35970,7 @@ CREATE TABLE `packageChecked` ( PRIMARY KEY (`id`), UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), KEY `fkItem_idx` (`itemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36351,28 +36013,28 @@ DROP TABLE IF EXISTS `packaging`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `packaging` ( `id` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `volume` decimal(10,2) DEFAULT '0.00', - `width` decimal(10,2) DEFAULT '0.00', - `depth` decimal(10,2) DEFAULT '0.00', - `height` decimal(10,2) DEFAULT '0.00', - `value` decimal(10,2) DEFAULT '0.00', - `isPackageReturnable` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `volume` decimal(10,2) DEFAULT 0.00, + `width` decimal(10,2) DEFAULT 0.00, + `depth` decimal(10,2) DEFAULT 0.00, + `height` decimal(10,2) DEFAULT 0.00, + `value` decimal(10,2) DEFAULT 0.00, + `isPackageReturnable` tinyint(1) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `packagingReturnFk` int(11) DEFAULT NULL, `lower` int(11) DEFAULT NULL, `upload` int(11) DEFAULT NULL, `base` decimal(10,2) DEFAULT NULL, `itemFk` int(11) DEFAULT NULL, `price` decimal(10,2) NOT NULL, - `isBox` tinyint(1) NOT NULL DEFAULT '0', + `isBox` tinyint(1) NOT NULL DEFAULT 0, `cubicPackage` decimal(10,2) DEFAULT NULL, - `returnCost` decimal(10,2) NOT NULL DEFAULT '0.00', + `returnCost` decimal(10,2) NOT NULL DEFAULT 0.00, `cmrName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `freightItemFk` int(11) DEFAULT NULL, - `hasCompressionVariations` tinyint(1) DEFAULT '0' COMMENT 'Floramondo puede servirlos no llenos del todo', + `hasCompressionVariations` tinyint(1) DEFAULT 0 COMMENT 'Floramondo puede servirlos no llenos del todo', `conveyorBuildingClassFk` int(11) DEFAULT NULL, - `isTrolley` tinyint(1) NOT NULL DEFAULT '0', - `isPallet` tinyint(1) NOT NULL DEFAULT '0', + `isTrolley` tinyint(1) NOT NULL DEFAULT 0, + `isPallet` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `packaging_fk1` (`itemFk`), KEY `packaging_fk2_idx` (`freightItemFk`), @@ -36409,7 +36071,7 @@ DROP TABLE IF EXISTS `packagingGifts`; CREATE TABLE `packagingGifts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `started` date NOT NULL, `ended` date NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL, @@ -36422,7 +36084,7 @@ CREATE TABLE `packagingGifts` ( CONSTRAINT `PackagingGifts_FK` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`), CONSTRAINT `PackagingGifts_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`), CONSTRAINT `PackagingGifts_FK_2` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36460,8 +36122,8 @@ CREATE TABLE `packingSiteLog` ( `workerFk` int(10) unsigned NOT NULL, `printerModelFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `typeErrorFk` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `packingSiteLog_UN` (`id`), KEY `packingSiteLog_FK` (`workerFk`), @@ -36472,7 +36134,7 @@ CREATE TABLE `packingSiteLog` ( CONSTRAINT `packingSiteLog_FK_1` FOREIGN KEY (`printerModelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE, CONSTRAINT `packingSiteLog_FK_2` FOREIGN KEY (`packingSiteFk`) REFERENCES `packingSite` (`code`) ON UPDATE CASCADE, CONSTRAINT `packingSiteLog_FK_4` FOREIGN KEY (`typeErrorFk`) REFERENCES `packingSiteTypeError` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36500,7 +36162,7 @@ CREATE TABLE `parking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `column` varchar(5) CHARACTER SET utf8 DEFAULT '--', `row` varchar(5) CHARACTER SET utf8 DEFAULT '--', - `sectorFk` int(11) NOT NULL DEFAULT '2', + `sectorFk` int(11) NOT NULL DEFAULT 2, `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, `pickingOrder` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -36582,20 +36244,6 @@ CREATE TABLE `payDemDetail` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `payDemDetail__` --- - -DROP TABLE IF EXISTS `payDemDetail__`; -/*!50001 DROP VIEW IF EXISTS `payDemDetail__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `payDemDetail__` ( - `id` tinyint NOT NULL, - `detail` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `payMethod` -- @@ -36608,13 +36256,13 @@ CREATE TABLE `payMethod` ( `code` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `solution` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `outstandingDebt` tinyint(3) unsigned zerofill NOT NULL DEFAULT '000', - `graceDays` int(11) unsigned NOT NULL DEFAULT '0', - `isIbanRequiredForClients` tinyint(3) DEFAULT '0', - `isIbanRequiredForSuppliers` tinyint(3) DEFAULT '0', - `isNotified` tinyint(3) NOT NULL DEFAULT '1', - `hasVerified` tinyint(1) DEFAULT '0', - `graceMonthsDisableChecked` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que no hayan recibido un pago en los meses especificados', + `outstandingDebt` tinyint(3) unsigned zerofill NOT NULL DEFAULT 000, + `graceDays` int(11) unsigned NOT NULL DEFAULT 0, + `isIbanRequiredForClients` tinyint(3) DEFAULT 0, + `isIbanRequiredForSuppliers` tinyint(3) DEFAULT 0, + `isNotified` tinyint(3) NOT NULL DEFAULT 1, + `hasVerified` tinyint(1) DEFAULT 0, + `graceMonthsDisableChecked` int(11) unsigned NOT NULL DEFAULT 0 COMMENT 'Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que no hayan recibido un pago en los meses especificados', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36630,16 +36278,16 @@ CREATE TABLE `payment` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `received` date NOT NULL, `supplierFk` int(11) NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1', + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `divisa` decimal(10,2) DEFAULT NULL, - `bankFk` int(11) NOT NULL DEFAULT '0', + `bankFk` int(11) NOT NULL DEFAULT 0, `payMethodFk` tinyint(3) unsigned NOT NULL, - `bankingFees` double(6,2) unsigned NOT NULL DEFAULT '0.00', + `bankingFees` double(6,2) unsigned NOT NULL DEFAULT 0.00, `concept` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `exchangeInsuranceFk` int(11) DEFAULT NULL, `dueDated` date DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, @@ -36658,7 +36306,7 @@ CREATE TABLE `payment` ( CONSTRAINT `payment_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -36831,30 +36479,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `payment__` --- - -DROP TABLE IF EXISTS `payment__`; -/*!50001 DROP VIEW IF EXISTS `payment__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `payment__` ( - `id` tinyint NOT NULL, - `received` tinyint NOT NULL, - `dueDated` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `divisa` tinyint NOT NULL, - `bankFk` tinyint NOT NULL, - `payMethodFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `exchangeInsuranceFk` tinyint NOT NULL, - `isConciliated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `pcs` -- @@ -36863,13 +36487,13 @@ DROP TABLE IF EXISTS `pcs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pcs` ( - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), `routeFk` int(10) unsigned DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, `pallet` int(11) DEFAULT NULL, `box` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36880,7 +36504,7 @@ DROP TABLE IF EXISTS `pcs_graf`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pcs_graf` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `dia` date DEFAULT NULL, `created` datetime DEFAULT NULL, `box` decimal(4,0) DEFAULT NULL, @@ -36906,7 +36530,7 @@ CREATE TABLE `pedidosInternos` ( `idArticle` int(11) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36938,11 +36562,11 @@ CREATE TABLE `person` ( `birth` date DEFAULT NULL, `readerId` int(11) DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, - `isDisable` tinyint(1) NOT NULL DEFAULT '0', - `isFreelance` tinyint(1) NOT NULL DEFAULT '0', - `isSsDiscounted` tinyint(1) NOT NULL DEFAULT '0', + `isDisable` tinyint(1) NOT NULL DEFAULT 0, + `isFreelance` tinyint(1) NOT NULL DEFAULT 0, + `isSsDiscounted` tinyint(1) NOT NULL DEFAULT 0, `nickname` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `p2` longtext COLLATE utf8_unicode_ci, + `p2` longtext COLLATE utf8_unicode_ci DEFAULT NULL, `sex` enum('M','F') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', PRIMARY KEY (`id`), UNIQUE KEY `nif` (`fi`), @@ -36978,11 +36602,11 @@ CREATE TABLE `pgc` ( `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `rate` decimal(10,2) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `cplusTaxBreakFk` int(10) unsigned DEFAULT '1', - `mod340` tinyint(1) NOT NULL DEFAULT '0', - `mod347` tinyint(1) NOT NULL DEFAULT '0', - `cplusTrascendency477Fk` int(10) unsigned DEFAULT '1', - `isEqualizated` tinyint(1) DEFAULT '0', + `cplusTaxBreakFk` int(10) unsigned DEFAULT 1, + `mod340` tinyint(1) NOT NULL DEFAULT 0, + `mod347` tinyint(1) NOT NULL DEFAULT 0, + `cplusTrascendency477Fk` int(10) unsigned DEFAULT 1, + `isEqualizated` tinyint(1) DEFAULT 0, PRIMARY KEY (`code`), KEY `pgc_fk1_idx` (`cplusTaxBreakFk`), KEY `pgc_fk2_idx` (`cplusTrascendency477Fk`), @@ -37033,7 +36657,7 @@ CREATE TABLE `plantpassport` ( `producerFk` mediumint(3) unsigned NOT NULL, `plantpassportAuthorityFk` mediumint(3) unsigned NOT NULL, `number` varchar(25) CHARACTER SET utf8 DEFAULT NULL, - `isRequested` tinyint(2) NOT NULL DEFAULT '0', + `isRequested` tinyint(2) NOT NULL DEFAULT 0, PRIMARY KEY (`producerFk`,`plantpassportAuthorityFk`), KEY `plantpassport_authority_idx` (`plantpassportAuthorityFk`), KEY `producer_id_idx` (`producerFk`), @@ -37177,11 +36801,11 @@ DROP TABLE IF EXISTS `ppe`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ppe` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `amortization` decimal(10,2) NOT NULL DEFAULT '0.00', + `amortization` decimal(10,2) NOT NULL DEFAULT 0.00, `firstAmortizated` date DEFAULT NULL, `lastAmortizated` date DEFAULT NULL, `finished` date DEFAULT NULL, - `value` decimal(10,2) NOT NULL DEFAULT '0.00', + `value` decimal(10,2) NOT NULL DEFAULT 0.00, `planFk` int(11) NOT NULL, `groupFk` int(11) DEFAULT NULL, `account` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -37191,10 +36815,10 @@ CREATE TABLE `ppe` ( `location` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `discharged` date DEFAULT NULL, `cause` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `photo` blob, - `isInvestmentAsset` tinyint(4) NOT NULL DEFAULT '0', + `photo` blob DEFAULT NULL, + `isInvestmentAsset` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `ppe_fk1_idx` (`workerFk`), @@ -37211,7 +36835,7 @@ CREATE TABLE `ppe` ( CONSTRAINT `ppe_fk5` FOREIGN KEY (`account`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk6` FOREIGN KEY (`endowment`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk7` FOREIGN KEY (`elementAccount`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37225,13 +36849,13 @@ CREATE TABLE `ppeComponent` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ppeFk` int(11) NOT NULL, `invoiceInFk` mediumint(8) unsigned NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`id`), KEY `ppeComponent_fk1_idx` (`ppeFk`), KEY `ppeComponent_fk2_idx` (`invoiceInFk`), CONSTRAINT `ppeComponent_fk1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ppeComponent_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37250,7 +36874,7 @@ CREATE TABLE `ppeDMS` ( KEY `ppeDMS_fk2_idx` (`ppeFk`), CONSTRAINT `ppeDMS_fk1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ppeDMS_fk2` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37264,7 +36888,7 @@ CREATE TABLE `ppeGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de inmovilizado'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de inmovilizado'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37276,10 +36900,10 @@ DROP TABLE IF EXISTS `ppePlan`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ppePlan` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `rate` decimal(3,2) NOT NULL DEFAULT '1.00', - `days` int(11) NOT NULL DEFAULT '365', + `rate` decimal(3,2) NOT NULL DEFAULT 1.00, + `days` int(11) NOT NULL DEFAULT 365, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37297,9 +36921,9 @@ CREATE TABLE `priceFixed` ( `rate3` double NOT NULL, `started` date NOT NULL, `ended` date NOT NULL, - `bonus` double NOT NULL DEFAULT '0', - `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `bonus` double NOT NULL DEFAULT 0, + `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `id` int(11) NOT NULL AUTO_INCREMENT, `grouping` smallint(5) DEFAULT NULL, `packing` int(11) DEFAULT NULL, @@ -37377,15 +37001,15 @@ CREATE TABLE `printServerQueue` ( `printerFk` tinyint(3) unsigned DEFAULT NULL, `priorityFk` tinyint(3) unsigned DEFAULT NULL, `labelReportFk` tinyint(3) unsigned DEFAULT NULL, - `statusFk` tinyint(3) unsigned DEFAULT '1', + `statusFk` tinyint(3) unsigned DEFAULT 1, `started` datetime DEFAULT NULL, `finished` datetime DEFAULT NULL, `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `param3` text COLLATE utf8_unicode_ci, - `error` text COLLATE utf8_unicode_ci, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `param3` text COLLATE utf8_unicode_ci DEFAULT NULL, + `error` text COLLATE utf8_unicode_ci DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `reportFk__` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_estado` (`statusFk`), @@ -37410,15 +37034,15 @@ CREATE TABLE `printServerQueue2` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `printerFk` tinyint(3) unsigned DEFAULT NULL, `priorityFk` tinyint(3) unsigned DEFAULT NULL, - `reportFk` tinyint(3) unsigned DEFAULT '0', - `statusFk` tinyint(3) unsigned DEFAULT '1', + `reportFk` tinyint(3) unsigned DEFAULT 0, + `statusFk` tinyint(3) unsigned DEFAULT 1, `started` datetime DEFAULT NULL, `finished` datetime DEFAULT NULL, `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `param3` text COLLATE utf8_unicode_ci, - `error` text COLLATE utf8_unicode_ci, + `param3` text COLLATE utf8_unicode_ci DEFAULT NULL, + `error` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Id_Impresora_2` (`printerFk`,`priorityFk`,`reportFk`,`statusFk`,`param1`,`workerFk`,`param2`), KEY `Id_estado` (`statusFk`), @@ -37493,9 +37117,9 @@ DROP TABLE IF EXISTS `printingQueueCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `printingQueueCheck` ( - `lastCount` int(11) unsigned NOT NULL DEFAULT '0', - `lastCheckSum` int(11) unsigned NOT NULL DEFAULT '0', - `isAlreadyNotified` tinyint(2) NOT NULL DEFAULT '0', + `lastCount` int(11) unsigned NOT NULL DEFAULT 0, + `lastCheckSum` int(11) unsigned NOT NULL DEFAULT 0, + `isAlreadyNotified` tinyint(2) NOT NULL DEFAULT 0, PRIMARY KEY (`lastCount`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Comprueba que el servidor de impresion no esta parado'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37510,8 +37134,8 @@ DROP TABLE IF EXISTS `producer`; CREATE TABLE `producer` ( `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `isVisible` tinyint(1) NOT NULL DEFAULT '1', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `isVisible` tinyint(1) NOT NULL DEFAULT 1, + `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -37586,7 +37210,7 @@ CREATE TABLE `professionalCategory` ( `salaryorSeniority` decimal(10,2) DEFAULT NULL, `year` int(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37599,7 +37223,7 @@ DROP TABLE IF EXISTS `profile`; CREATE TABLE `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `personFk` int(11) DEFAULT NULL, - `profileTypeFk` int(11) NOT NULL DEFAULT '1', + `profileTypeFk` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `personFk` (`personFk`), KEY `profileTypeFk` (`profileTypeFk`), @@ -37619,7 +37243,7 @@ CREATE TABLE `profileType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37631,14 +37255,14 @@ DROP TABLE IF EXISTS `project`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `started` date DEFAULT NULL, `finished` date DEFAULT NULL, `userFk` int(11) unsigned NOT NULL, `departmentFk` int(11) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `location` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `amount` decimal(15,2) DEFAULT NULL, PRIMARY KEY (`id`), @@ -37648,7 +37272,7 @@ CREATE TABLE `project` ( CONSTRAINT `project_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `project_FK_1` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `project_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla master de proyectos'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla master de proyectos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37660,7 +37284,7 @@ DROP TABLE IF EXISTS `projectNotes`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `projectNotes` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `txt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `projectFk` int(11) NOT NULL, @@ -37669,7 +37293,7 @@ CREATE TABLE `projectNotes` ( KEY `projectNotes_FK_1` (`userFk`), CONSTRAINT `projectNotes_FK` FOREIGN KEY (`projectFk`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `projectNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de notas para project'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de notas para project'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -37721,7 +37345,7 @@ CREATE TABLE `property` ( `value` int(11) DEFAULT NULL, `propertyGroupFk` int(11) NOT NULL, `companyFk` smallint(5) unsigned NOT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `allocation` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, `m2` decimal(10,2) DEFAULT NULL, `tome` int(11) DEFAULT NULL, @@ -37734,7 +37358,7 @@ CREATE TABLE `property` ( CONSTRAINT `property_FK` FOREIGN KEY (`propertyGroupFk`) REFERENCES `propertyGroup` (`id`) ON UPDATE CASCADE, CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE, CONSTRAINT `property_company` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37753,7 +37377,7 @@ CREATE TABLE `propertyDms` ( KEY `propertyDms_FK_1` (`propertyFk`), CONSTRAINT `propertyDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, CONSTRAINT `propertyDms_FK_1` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37767,7 +37391,7 @@ CREATE TABLE `propertyGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37788,7 +37412,7 @@ CREATE TABLE `propertyNotes` ( KEY `propertyNotes_FK` (`propertyFk`), CONSTRAINT `propertyNotes_FK` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`), CONSTRAINT `propertyNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37926,7 +37550,7 @@ DROP TABLE IF EXISTS `punchState`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `punchState` ( `workerFk` int(11) NOT NULL, - `state` tinyint(4) DEFAULT '1', + `state` tinyint(4) DEFAULT 1, `created` datetime DEFAULT NULL, PRIMARY KEY (`workerFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table for storing punches that have cars with errors'; @@ -37940,7 +37564,7 @@ DROP TABLE IF EXISTS `queuePriority`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `queuePriority` ( - `id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `id` tinyint(3) unsigned NOT NULL DEFAULT 0, `priority` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -38029,25 +37653,6 @@ CREATE TABLE `rateConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `rate__` --- - -DROP TABLE IF EXISTS `rate__`; -/*!50001 DROP VIEW IF EXISTS `rate__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `rate__` ( - `id` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `rate0` tinyint NOT NULL, - `rate1` tinyint NOT NULL, - `rate2` tinyint NOT NULL, - `rate3` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `receipt` -- @@ -38058,15 +37663,15 @@ DROP TABLE IF EXISTS `receipt`; CREATE TABLE `receipt` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `invoiceFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre incorrecto, renombrar a description', - `amountPaid` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountUnpaid__` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountPaid` decimal(10,2) NOT NULL DEFAULT 0.00, + `amountUnpaid__` decimal(10,2) NOT NULL DEFAULT 0.00, `payed` datetime DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, - `bankFk` int(11) DEFAULT '0', - `clientFk` int(11) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `isConciliate` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `bankFk` int(11) DEFAULT 0, + `clientFk` int(11) DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `isConciliate` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, PRIMARY KEY (`Id`), KEY `Id_Banco` (`bankFk`), KEY `Id_Trabajador` (`workerFk`), @@ -38210,13 +37815,13 @@ CREATE TABLE `recipe` ( `originFk` tinyint(2) unsigned DEFAULT NULL, `typeFk` smallint(5) unsigned DEFAULT NULL, `longName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` int(11) NOT NULL DEFAULT '1', + `quantity` int(11) NOT NULL DEFAULT 1, `element` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `inkFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `recipe_ix_1` (`element`), KEY `recipe_ix_2` (`itemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38235,7 +37840,7 @@ CREATE TABLE `recipe_log` ( KEY `recipe_log_ix1` (`recipe_ItemFk`), KEY `recipe_log_ix2` (`element`), KEY `recipe_log_ix3` (`selected_ItemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38247,11 +37852,11 @@ DROP TABLE IF EXISTS `recovery`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `recovery` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT 0, `started` date NOT NULL COMMENT 'Fecha a partir de la que comienza el recobro', `finished` date DEFAULT NULL COMMENT 'Fecha en la que acaba', `amount` double NOT NULL, - `period` tinyint(3) unsigned NOT NULL DEFAULT '7' COMMENT 'numero de dias que indica cada cuanto hare el recobro', + `period` tinyint(3) unsigned NOT NULL DEFAULT 7 COMMENT 'numero de dias que indica cada cuanto hare el recobro', PRIMARY KEY (`id`), KEY `cliente_idx` (`clientFk`), CONSTRAINT `cliente333` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, @@ -38300,7 +37905,7 @@ DROP TABLE IF EXISTS `referenceRateConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `referenceRateConfig` ( - `simulatedValue` float unsigned NOT NULL DEFAULT '1.2309', + `simulatedValue` float unsigned NOT NULL DEFAULT 1.2309, PRIMARY KEY (`simulatedValue`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38335,7 +37940,7 @@ CREATE TABLE `route` ( `vehicleFk` int(10) unsigned DEFAULT NULL, `agencyModeFk` int(11) DEFAULT NULL, `time` datetime DEFAULT NULL, - `isOk` tinyint(1) unsigned NOT NULL DEFAULT '0', + `isOk` tinyint(1) unsigned NOT NULL DEFAULT 0, `kmStart` mediumint(9) NOT NULL, `kmEnd` mediumint(9) NOT NULL, `started` datetime NOT NULL, @@ -38343,9 +37948,9 @@ CREATE TABLE `route` ( `gestdocFk` int(11) DEFAULT NULL, `cost` double unsigned DEFAULT NULL, `m3` decimal(10,1) unsigned DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci, + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, `zoneFk` int(11) DEFAULT NULL, - `priority` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT 0, `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, `beachFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -38459,7 +38064,7 @@ CREATE TABLE `routeAction` ( `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `price` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38480,7 +38085,7 @@ CREATE TABLE `routeComplement` ( KEY `fgn_routeActionFk_idx` (`routeActionFk`), CONSTRAINT `fgn_routeActionFk` FOREIGN KEY (`routeActionFk`) REFERENCES `routeAction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgn_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38512,7 +38117,7 @@ CREATE TABLE `routeConfig` ( `distributionM3Category2` decimal(5,2) DEFAULT NULL, `plusCategory1Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `plusCategory2Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `defaultCompanyFk` smallint(5) unsigned DEFAULT '442', + `defaultCompanyFk` smallint(5) unsigned DEFAULT 442, PRIMARY KEY (`id`), KEY `routeConfig_FK` (`defaultCompanyFk`), CONSTRAINT `routeConfig_FK` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) @@ -38530,20 +38135,20 @@ CREATE TABLE `routeGate` ( `deviceId` varchar(30) CHARACTER SET utf8 NOT NULL, `displayText` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `status` set('idle','doing','done','') CHARACTER SET utf8 DEFAULT 'idle', - `gateAreaFk` int(11) NOT NULL DEFAULT '1', + `gateAreaFk` int(11) NOT NULL DEFAULT 1, `routeFk` int(11) NOT NULL, `freeTickets` int(11) DEFAULT NULL, `expeditions` int(11) DEFAULT NULL, `scanned` int(11) DEFAULT NULL, - `flag` blob, + `flag` blob DEFAULT NULL, `pallets` int(11) DEFAULT NULL, `lastScanned` datetime DEFAULT NULL, - `ready` tinyint(4) NOT NULL DEFAULT '0', + `ready` tinyint(4) NOT NULL DEFAULT 0, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), UNIQUE KEY `routeFk_UNIQUE` (`routeFk`), KEY `routeGate_fk1_idx` (`gateAreaFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -38608,11 +38213,11 @@ CREATE TABLE `routeLog` ( `originFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -38620,7 +38225,7 @@ CREATE TABLE `routeLog` ( KEY `userFk` (`userFk`), CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38651,7 +38256,7 @@ CREATE TABLE `routeUserPercentage` ( PRIMARY KEY (`id`), KEY `routeUserPercentageFk_idx` (`workerFk`), CONSTRAINT `routeUserPercentageFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38673,12 +38278,12 @@ CREATE TABLE `routesMonitor` ( `dated` date DEFAULT NULL, `dockFk` int(11) DEFAULT NULL, `m3` decimal(10,1) DEFAULT NULL, - `priority` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT 0, `etd` time DEFAULT NULL, `expeditionTruckFk` int(11) DEFAULT NULL, `m3boxes` decimal(10,1) DEFAULT NULL, `bufferFk` int(11) DEFAULT NULL COMMENT 'Buffer del sorter por el que se quiere sacar esa ruta', - `isPickingAllowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Los tickets de esta ruta se pueden preparar', + `isPickingAllowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Los tickets de esta ruta se pueden preparar', PRIMARY KEY (`routeFk`), KEY `routesMonitor_FK` (`bufferFk`), CONSTRAINT `routesMonitor_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`id`) ON DELETE SET NULL ON UPDATE CASCADE @@ -38697,16 +38302,16 @@ CREATE TABLE `sale` ( `itemFk` int(11) NOT NULL, `ticketFk` int(11) NOT NULL, `concept` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` decimal(10,2) NOT NULL DEFAULT '0.00', + `quantity` decimal(10,2) NOT NULL DEFAULT 0.00, `originalQuantity` double(9,1) DEFAULT NULL, - `price` decimal(10,2) DEFAULT '0.00', - `discount` tinyint(2) unsigned NOT NULL DEFAULT '0', - `priceFixed` decimal(10,2) NOT NULL DEFAULT '0.00', - `reserved` tinyint(1) NOT NULL DEFAULT '0', - `isPicked` tinyint(1) NOT NULL DEFAULT '0', - `isPriceFixed` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isAdded` tinyint(1) NOT NULL DEFAULT '0', + `price` decimal(10,2) DEFAULT 0.00, + `discount` tinyint(2) unsigned NOT NULL DEFAULT 0, + `priceFixed` decimal(10,2) NOT NULL DEFAULT 0.00, + `reserved` tinyint(1) NOT NULL DEFAULT 0, + `isPicked` tinyint(1) NOT NULL DEFAULT 0, + `isPriceFixed` tinyint(1) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `isAdded` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `Id_Ticket` (`ticketFk`), KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`), @@ -38751,7 +38356,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = NEW.id - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; END IF; @@ -38878,7 +38483,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = NEW.id - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; END IF; @@ -38924,7 +38529,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = OLD.id - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; END IF; END */;; @@ -39000,7 +38605,7 @@ DROP TABLE IF EXISTS `saleBuy`; CREATE TABLE `saleBuy` ( `saleFk` int(11) NOT NULL, `buyFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`saleFk`), KEY `saleBuy_FK` (`buyFk`), @@ -39065,7 +38670,7 @@ DROP TABLE IF EXISTS `saleChecked`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleChecked` ( `saleFk` int(11) NOT NULL, - `isChecked` int(11) NOT NULL DEFAULT '0', + `isChecked` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`saleFk`), CONSTRAINT `fk_Movimientos_checked_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -39099,8 +38704,8 @@ CREATE TABLE `saleComponent` ( `saleFk` int(11) NOT NULL, `componentFk` int(11) NOT NULL, `value` double NOT NULL, - `isGreuge` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Indica si ya se ha tenido en cuenta para calcular el greuge', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isGreuge` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Indica si ya se ha tenido en cuenta para calcular el greuge', + `created` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`saleFk`,`componentFk`), KEY `fk_mov_comp_idx` (`componentFk`), CONSTRAINT `mc_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -39145,7 +38750,7 @@ CREATE TABLE `saleGoal` ( `goal` decimal(10,2) DEFAULT NULL, `goalType` smallint(6) DEFAULT NULL COMMENT 'grado', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39157,12 +38762,12 @@ DROP TABLE IF EXISTS `saleGroup`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(11) DEFAULT NULL, `parkingFk` int(11) DEFAULT NULL, `sectorFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='agrupa lineas de venta'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='agrupa lineas de venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39174,7 +38779,7 @@ DROP TABLE IF EXISTS `saleGroupDetail`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleGroupDetail` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `saleFk` int(11) NOT NULL, `saleGroupFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -39182,7 +38787,7 @@ CREATE TABLE `saleGroupDetail` ( KEY `saleGroupDetail_FK_1` (`saleGroupFk`), CONSTRAINT `saleGroupDetail_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `saleGroupDetail_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona sale y saleGroup'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona sale y saleGroup'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39196,12 +38801,12 @@ CREATE TABLE `saleItemShelving__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `saleFk` int(11) NOT NULL, `itemShelvingFk` int(10) unsigned NOT NULL, - `quantity` int(11) NOT NULL DEFAULT '0', - `isPicked` tinyint(4) NOT NULL DEFAULT '0', + `quantity` int(11) NOT NULL DEFAULT 0, + `isPicked` tinyint(4) NOT NULL DEFAULT 0, `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39216,7 +38821,7 @@ CREATE TABLE `saleMistake` ( `saleFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL COMMENT 'Controlador', `typeFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `saleMistake_fk1_idx` (`saleFk`), KEY `saleMistake_fk2_idx` (`userFk`), @@ -39224,7 +38829,7 @@ CREATE TABLE `saleMistake` ( CONSTRAINT `saleMistake_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `saleMistake_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `saleMistake_fk3` FOREIGN KEY (`typeFk`) REFERENCES `mistakeType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39294,14 +38899,14 @@ CREATE TABLE `saleParking__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `saleFk` int(11) NOT NULL, `parkingFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleParking_FK` (`saleFk`), KEY `saleParking_FK_1` (`parkingFk`), CONSTRAINT `saleParking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `saleParking_FK_1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='ubica las lineas de venta preparadas previamente'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='ubica las lineas de venta preparadas previamente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39343,8 +38948,8 @@ DROP TABLE IF EXISTS `saleTracking`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleTracking` ( `saleFk` int(11) NOT NULL, - `isChecked` tinyint(3) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isChecked` tinyint(3) unsigned NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `originalQuantity` double DEFAULT NULL, `workerFk` int(11) NOT NULL, `actionFk` int(11) NOT NULL, @@ -39569,39 +39174,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `salesToPrePrepare__` --- - -DROP TABLE IF EXISTS `salesToPrePrepare__`; -/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesToPrePrepare__` ( - `Id_Ticket` tinyint NOT NULL, - `Id_Movimiento` tinyint NOT NULL, - `Id_Movimiento_mark` tinyint NOT NULL, - `Id_Trabjador` tinyint NOT NULL, - `isChecked` tinyint NOT NULL, - `created` tinyint NOT NULL, - `Id_Article` tinyint NOT NULL, - `Concepte` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `Cantidad` tinyint NOT NULL, - `original_quantity` tinyint NOT NULL, - `Hora` tinyint NOT NULL, - `Departure` tinyint NOT NULL, - `Minuto` tinyint NOT NULL, - `agency_id` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `province_id` tinyint NOT NULL, - `picked` tinyint NOT NULL, - `trabajador` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `stateFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `sample` -- @@ -39613,10 +39185,10 @@ CREATE TABLE `sample` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(25) CHARACTER SET utf8 NOT NULL, `description` varchar(105) COLLATE utf8_unicode_ci NOT NULL, - `isVisible` tinyint(1) unsigned NOT NULL DEFAULT '1', - `hasCompany` tinyint(1) unsigned NOT NULL DEFAULT '0', - `hasPreview` tinyint(1) unsigned NOT NULL DEFAULT '1', - `datepickerEnabled` tinyint(1) NOT NULL DEFAULT '0', + `isVisible` tinyint(1) unsigned NOT NULL DEFAULT 1, + `hasCompany` tinyint(1) unsigned NOT NULL DEFAULT 0, + `hasPreview` tinyint(1) unsigned NOT NULL DEFAULT 1, + `datepickerEnabled` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39631,22 +39203,22 @@ DROP TABLE IF EXISTS `sector`; CREATE TABLE `sector` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `isPreviousPreparedByPacking` tinyint(4) NOT NULL DEFAULT '1', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, + `isPreviousPreparedByPacking` tinyint(4) NOT NULL DEFAULT 1, `code` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `pickingPlacement` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `path` int(11) DEFAULT NULL, - `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT '0', - `isPackagingArea` tinyint(1) NOT NULL DEFAULT '0', + `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT 0, + `isPackagingArea` tinyint(1) NOT NULL DEFAULT 0, `labelReportFk` tinyint(3) unsigned DEFAULT NULL, `sonFk` int(11) DEFAULT NULL, - `isMain` tinyint(1) NOT NULL DEFAULT '0', + `isMain` tinyint(1) NOT NULL DEFAULT 0, `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, `labelReport__` tinyint(3) DEFAULT NULL, `printerFk` tinyint(3) unsigned DEFAULT NULL, - `isHideForPickers` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'sector a ocultar a los sacadores', - `isReserve` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Sectores de reserva, como Albenfruit o Fuentes', + `isHideForPickers` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'sector a ocultar a los sacadores', + `isReserve` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Sectores de reserva, como Albenfruit o Fuentes', PRIMARY KEY (`id`,`warehouseFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `sector_fk1_idx` (`warehouseFk`), @@ -39665,7 +39237,7 @@ DROP TABLE IF EXISTS `sectorCollection`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sectorCollection` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned NOT NULL, `sectorFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -39673,7 +39245,7 @@ CREATE TABLE `sectorCollection` ( KEY `sectorCollection_FK_2` (`sectorFk`), CONSTRAINT `sectorCollection_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sectorCollection_FK_1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Las lineas de preparacion de pedidos por sectores se agrupan bajo el identificador de esta tabla'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Las lineas de preparacion de pedidos por sectores se agrupan bajo el identificador de esta tabla'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39685,7 +39257,7 @@ DROP TABLE IF EXISTS `sectorCollectionSaleGroup`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sectorCollectionSaleGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `sectorCollectionFk` int(11) NOT NULL, `saleGroupFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -39693,7 +39265,7 @@ CREATE TABLE `sectorCollectionSaleGroup` ( KEY `sectorCollectionSaleGroup_FK_1` (`saleGroupFk`), CONSTRAINT `sectorCollectionSaleGroup_FK` FOREIGN KEY (`sectorCollectionFk`) REFERENCES `sectorCollection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sectorCollectionSaleGroup_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39716,7 +39288,7 @@ CREATE TABLE `sectorProductivity` ( `hourWorked` decimal(10,2) DEFAULT NULL, `dated` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39732,13 +39304,13 @@ CREATE TABLE `sharingCart` ( `started` date NOT NULL, `ended` date NOT NULL, `workerSubstitute` int(10) unsigned NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`started`,`ended`,`workerSubstitute`), KEY `Suplent` (`workerSubstitute`), CONSTRAINT `Suplent_key` FOREIGN KEY (`workerSubstitute`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -39836,7 +39408,7 @@ CREATE TABLE `sharingCartDaily` ( `ownerFk` int(10) unsigned NOT NULL, `substituteFk` int(10) unsigned NOT NULL, `dated` date NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `sharingCartDailyWorker_idx` (`ownerFk`,`dated`), KEY `sharingCartDailySubstitute_idx` (`substituteFk`), @@ -39863,7 +39435,7 @@ CREATE TABLE `sharingClient` ( KEY `Client` (`clientFk`), CONSTRAINT `Clients_key` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -39878,8 +39450,8 @@ DELIMITER ;; BEFORE INSERT ON `sharingClient` FOR EACH ROW BEGIN - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - SET NEW.started = GREATEST(CURDATE(),NEW.started); + SET NEW.ended = GREATEST(util.VN_CURDATE(),NEW.ended); + SET NEW.started = GREATEST(util.VN_CURDATE(),NEW.started); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39899,8 +39471,8 @@ DELIMITER ;; BEFORE UPDATE ON `sharingClient` FOR EACH ROW BEGIN - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - SET NEW.started = GREATEST(CURDATE(),NEW.started); + SET NEW.ended = GREATEST(util.VN_CURDATE(),NEW.ended); + SET NEW.started = GREATEST(util.VN_CURDATE(),NEW.started); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39918,12 +39490,12 @@ DROP TABLE IF EXISTS `shelving`; CREATE TABLE `shelving` ( `code` varchar(10) CHARACTER SET utf8 NOT NULL, `parkingFk` int(11) DEFAULT NULL, - `isPrinted` tinyint(4) NOT NULL DEFAULT '0', - `priority` int(11) NOT NULL DEFAULT '0', - `parked` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isPrinted` tinyint(4) NOT NULL DEFAULT 0, + `priority` int(11) NOT NULL DEFAULT 0, + `parked` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `userFk` int(10) unsigned DEFAULT NULL, - `isSpam` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'señala las matrículas con producto que se puede llevar a la reserva', - `isRecyclable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'las matrículas marcadas como reciclables se liberan cada noche desde vn.shelving_clean para poder volver a utilizarlas', + `isSpam` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'señala las matrículas con producto que se puede llevar a la reserva', + `isRecyclable` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'las matrículas marcadas como reciclables se liberan cada noche desde vn.shelving_clean para poder volver a utilizarlas', PRIMARY KEY (`code`), KEY `shelving_fk1_idx` (`parkingFk`), KEY `shelving_fk2_idx` (`userFk`), @@ -40007,11 +39579,11 @@ CREATE TABLE `shelvingLog` ( `originFk` varchar(10) CHARACTER SET utf8 NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -40019,7 +39591,7 @@ CREATE TABLE `shelvingLog` ( KEY `originFk` (`originFk`), CONSTRAINT `shelvingLog_FK_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40036,7 +39608,7 @@ CREATE TABLE `silexACL` ( `role` varchar(20) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `module_UNIQUE` (`module`,`method`,`role`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40051,9 +39623,9 @@ CREATE TABLE `sinister` ( `supplierFk` int(11) NOT NULL, `clientFk` int(11) NOT NULL, `amount` decimal(10,2) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `insureRate` decimal(3,2) NOT NULL DEFAULT '0.75', - `isBooked` tinyint(4) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `insureRate` decimal(3,2) NOT NULL DEFAULT 0.75, + `isBooked` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned NOT NULL, `companyFk` smallint(5) unsigned NOT NULL, PRIMARY KEY (`id`), @@ -40078,10 +39650,10 @@ DROP TABLE IF EXISTS `sinisterDetail`; CREATE TABLE `sinisterDetail` ( `id` int(11) NOT NULL, `sinisterFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `amountIn` decimal(10,2) DEFAULT NULL, `amountOut` decimal(10,2) DEFAULT NULL, - `isConciliated` tinyint(1) NOT NULL DEFAULT '0', + `isConciliated` tinyint(1) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned NOT NULL, `bankFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -40125,11 +39697,11 @@ CREATE TABLE `sms` ( `sender` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT '693474205', `destination` varchar(15) CHARACTER SET utf8 NOT NULL, `message` varchar(160) COLLATE utf8_unicode_ci NOT NULL, - `statusCode` smallint(9) DEFAULT '0', + `statusCode` smallint(9) DEFAULT 0, `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'OK', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40252,21 +39824,21 @@ DROP TABLE IF EXISTS `sorter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sorter` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `created` datetime NOT NULL, `routeFk` int(10) unsigned NOT NULL, `ticketFk` int(10) NOT NULL, - `isBox` int(11) DEFAULT '1', + `isBox` int(11) DEFAULT 1, `itemFk` int(11) DEFAULT NULL, - `width` decimal(10,2) DEFAULT '0.00', - `depth` decimal(10,2) DEFAULT '0.00', - `height` decimal(10,2) DEFAULT '0.00', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `weight` decimal(5,2) NOT NULL DEFAULT '0.00', - `buildingOrder` int(5) NOT NULL DEFAULT '0', + `width` decimal(10,2) DEFAULT 0.00, + `depth` decimal(10,2) DEFAULT 0.00, + `height` decimal(10,2) DEFAULT 0.00, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, + `weight` decimal(5,2) NOT NULL DEFAULT 0.00, + `buildingOrder` int(5) NOT NULL DEFAULT 0, `ETD` time NOT NULL DEFAULT '23:59:00', `palletOrder` int(5) DEFAULT NULL, - `lungGrow` int(11) DEFAULT '0', + `lungGrow` int(11) DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40280,9 +39852,9 @@ DROP TABLE IF EXISTS `specialPrice`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `specialPrice` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `itemFk` int(11) NOT NULL DEFAULT '0', - `value` double NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT 0, + `itemFk` int(11) NOT NULL DEFAULT 0, + `value` double NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `Id_Cliente_2` (`clientFk`,`itemFk`), KEY `Id_Article` (`itemFk`), @@ -40291,7 +39863,7 @@ CREATE TABLE `specialPrice` ( CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `{01A99AF1-3D3F-4B15-AC0C-C7A834F319A3}` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `{EE4ADEF6-0AC6-401F-B7C4-D797972FC065}` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40361,7 +39933,7 @@ CREATE TABLE `specieGeoInvasive` ( `genusFk` int(11) NOT NULL, `specieFk` int(11) NOT NULL, `zoneGeofk` int(11) NOT NULL, - `isForbidden` tinyint(1) NOT NULL DEFAULT '1', + `isForbidden` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `specieGeoInvasive_FK` (`genusFk`), KEY `specieGeoInvasive_FK_1` (`specieFk`), @@ -40369,7 +39941,7 @@ CREATE TABLE `specieGeoInvasive` ( CONSTRAINT `specieGeoInvasive_FK` FOREIGN KEY (`genusFk`) REFERENCES `genus` (`id`) ON UPDATE CASCADE, CONSTRAINT `specieGeoInvasive_FK_1` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON UPDATE CASCADE, CONSTRAINT `specieGeoInvasive_FK_2` FOREIGN KEY (`zoneGeofk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40389,7 +39961,7 @@ CREATE TABLE `starredModule` ( KEY `starred_moduleFk` (`moduleFk`), CONSTRAINT `starred_moduleFk` FOREIGN KEY (`moduleFk`) REFERENCES `salix`.`module` (`code`) ON UPDATE CASCADE, CONSTRAINT `starred_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40403,7 +39975,7 @@ CREATE TABLE `state` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `order` tinyint(3) unsigned DEFAULT NULL, - `alertLevel` int(11) NOT NULL DEFAULT '0', + `alertLevel` int(11) NOT NULL DEFAULT 0, `code` varchar(45) CHARACTER SET utf8 NOT NULL, `sectorProdPriority` tinyint(3) DEFAULT NULL, `nextStateFk` tinyint(4) NOT NULL COMMENT 'Estado al que tiene que cambiar el ticket despues de preparacion previa', @@ -40436,14 +40008,14 @@ CREATE TABLE `stockBuyed` ( `user` int(10) unsigned DEFAULT NULL, `buyed` decimal(10,2) DEFAULT NULL, `date` date DEFAULT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `creationDate` timestamp NULL DEFAULT current_timestamp(), `reserved` decimal(10,2) DEFAULT NULL, `requested` decimal(10,2) DEFAULT NULL, `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `stockBuyed_user_idx` (`user`), CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40456,7 +40028,7 @@ DROP TABLE IF EXISTS `stowaway`; CREATE TABLE `stowaway` ( `id` int(11) NOT NULL COMMENT 'ticket pequeño', `shipFk` int(11) NOT NULL COMMENT 'ticket grande', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tickets polizones y sus naves de embarque'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40477,30 +40049,30 @@ CREATE TABLE `supplier` ( `provinceFk` smallint(5) unsigned DEFAULT NULL, `countryFk` mediumint(8) unsigned DEFAULT NULL, `nif` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isOfficial` tinyint(1) NOT NULL DEFAULT '1', - `isFarmer` tinyint(1) NOT NULL DEFAULT '0', + `isOfficial` tinyint(1) NOT NULL DEFAULT 1, + `isFarmer` tinyint(1) NOT NULL DEFAULT 0, `retAccount` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `Fax__` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `commission` float NOT NULL DEFAULT '0', + `commission` float NOT NULL DEFAULT 0, `nickname` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `payMethodFk` tinyint(3) unsigned NOT NULL, `payDay` tinyint(4) unsigned DEFAULT NULL, - `payDemFk` tinyint(3) unsigned NOT NULL DEFAULT '7', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isSerious` tinyint(1) unsigned NOT NULL DEFAULT '1', - `note` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, + `payDemFk` tinyint(3) unsigned NOT NULL DEFAULT 7, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `isSerious` tinyint(1) unsigned NOT NULL DEFAULT 1, + `note` text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `postcodeFk` int(11) unsigned DEFAULT NULL, `postCode` char(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isActive` tinyint(4) DEFAULT '1', + `isActive` tinyint(4) DEFAULT 1, `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE', `withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE', `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Ti po de transacción SAGE', - `isTrucker` tinyint(1) NOT NULL DEFAULT '0', + `isTrucker` tinyint(1) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL COMMENT 'Responsible for approving invoices', `supplierActivityFk` varchar(45) NOT NULL DEFAULT 'flowersPlants', `healthRegister` varchar(45) DEFAULT NULL, - `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Se ha validado la forma de pago', + `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Se ha validado la forma de pago', PRIMARY KEY (`id`), UNIQUE KEY `cuenta` (`account`), UNIQUE KEY `NIF` (`nif`), @@ -40654,6 +40226,30 @@ CREATE TABLE `supplierAddress` ( PRIMARY KEY (`id`), KEY `supplierAddress_province_fk` (`provinceFk`), CONSTRAINT `supplierAddress_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierAgencyTerm` +-- + +DROP TABLE IF EXISTS `supplierAgencyTerm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierAgencyTerm` ( + `agencyFk` smallint(5) unsigned NOT NULL, + `supplierFk` int(11) DEFAULT NULL, + `minimumPackages` int(11) NOT NULL DEFAULT 0 COMMENT 'numero minimo de bultos', + `kmPrice` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'precio extra por km', + `packagePrice` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'precio extra por bulto', + `routePrice` decimal(10,2) DEFAULT NULL COMMENT 'precio fijo por ruta', + `minimumKm` int(11) NOT NULL DEFAULT 0, + `minimumM3` decimal(10,2) NOT NULL DEFAULT 0.00, + `m3Price` decimal(10,2) NOT NULL DEFAULT 0.00, + PRIMARY KEY (`agencyFk`), + KEY `agencyTerm_FK_1` (`supplierFk`), + CONSTRAINT `agencyTerm_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agencyTerm_FK_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40694,7 +40290,7 @@ CREATE TABLE `supplierContact` ( `phone` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, `mobile` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `observation` text COLLATE utf8_unicode_ci, + `observation` text COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `supplier_id` (`supplierFk`), @@ -40713,13 +40309,13 @@ CREATE TABLE `supplierExpense` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, `supplierFk` int(11) NOT NULL, - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '2', - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `dmsFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `dueDated` date NOT NULL, PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), @@ -40732,7 +40328,7 @@ CREATE TABLE `supplierExpense` ( CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40747,11 +40343,11 @@ CREATE TABLE `supplierLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -40759,7 +40355,7 @@ CREATE TABLE `supplierLog` ( KEY `supplierLog_ibfk_2` (`userFk`), CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40828,8 +40424,8 @@ CREATE TABLE `tag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `isFree` tinyint(1) NOT NULL DEFAULT '1', - `isQuantitatif` tinyint(4) NOT NULL DEFAULT '0', + `isFree` tinyint(1) NOT NULL DEFAULT 1, + `isQuantitatif` tinyint(4) NOT NULL DEFAULT 0, `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -40967,16 +40563,16 @@ CREATE TABLE `taxCode` ( `dated` date NOT NULL, `code` varchar(10) CHARACTER SET utf8 NOT NULL, `taxTypeFk` tinyint(2) NOT NULL, - `rate` decimal(4,1) NOT NULL DEFAULT '0.0', - `equalizationTax` decimal(4,1) NOT NULL DEFAULT '0.0', + `rate` decimal(4,1) NOT NULL DEFAULT 0.0, + `equalizationTax` decimal(4,1) NOT NULL DEFAULT 0.0, `type` char(1) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Solo rellenar si en el asiento ira en el DEBE', - `link` tinyint(4) unsigned DEFAULT '0' COMMENT 'las que tienen el mismo valor se contabilizan emparejadas', - `isActive` tinyint(2) NOT NULL DEFAULT '1', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `link` tinyint(4) unsigned DEFAULT 0 COMMENT 'las que tienen el mismo valor se contabilizan emparejadas', + `isActive` tinyint(2) NOT NULL DEFAULT 1, + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `transactionCode` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Código de Transacción de SAGE', `operationCode` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Código de operaciones de SAGE', `taxCode` int(4) DEFAULT NULL COMMENT 'Código de IVA SAGE', - `isIntracommunity` tinyint(2) DEFAULT '0', + `isIntracommunity` tinyint(2) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `taxCode_dated_IDX` (`dated`,`taxTypeFk`,`type`,`link`) USING BTREE, KEY `iva_tipo_id` (`taxTypeFk`), @@ -40996,7 +40592,7 @@ DROP TABLE IF EXISTS `taxType`; CREATE TABLE `taxType` ( `id` tinyint(2) NOT NULL AUTO_INCREMENT, `nickname` varchar(6) COLLATE utf8_unicode_ci NOT NULL, - `isAccrued` tinyint(4) NOT NULL DEFAULT '0', + `isAccrued` tinyint(4) NOT NULL DEFAULT 0, `serial` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' ' COMMENT 'respetar el nombre de la columna, se utiliza en contaplus', `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -41017,7 +40613,7 @@ DROP TABLE IF EXISTS `temperature`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `temperature` ( `code` varchar(10) CHARACTER SET utf8 NOT NULL, - `description` text COLLATE utf8_unicode_ci, + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, `name` varchar(10) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -41046,34 +40642,34 @@ DROP TABLE IF EXISTS `ticket`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticket` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `clientFk` int(11) NOT NULL DEFAULT 0, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, `shipped` datetime NOT NULL, `nickname` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `notes` longtext COLLATE utf8_unicode_ci, + `notes` longtext COLLATE utf8_unicode_ci DEFAULT NULL, `refFk` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `invoiceOutFk` int(10) unsigned DEFAULT NULL COMMENT 'eliminar', - `isBooked` tinyint(1) NOT NULL DEFAULT '0', - `addressFk` int(11) NOT NULL DEFAULT '0', + `isBooked` tinyint(1) NOT NULL DEFAULT 0, + `addressFk` int(11) NOT NULL DEFAULT 0, `workerFk` int(11) DEFAULT NULL, `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'eliminar', - `isSigned` tinyint(1) NOT NULL DEFAULT '0', - `isLabeled` tinyint(1) NOT NULL DEFAULT '0', - `isPrinted` tinyint(1) NOT NULL DEFAULT '0', - `packages` smallint(10) unsigned DEFAULT '0', + `isSigned` tinyint(1) NOT NULL DEFAULT 0, + `isLabeled` tinyint(1) NOT NULL DEFAULT 0, + `isPrinted` tinyint(1) NOT NULL DEFAULT 0, + `packages` smallint(10) unsigned DEFAULT 0, `location` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `hour` int(11) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isBlocked` tinyint(1) NOT NULL DEFAULT '1', + `hour` int(11) DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `isBlocked` tinyint(1) NOT NULL DEFAULT 1, `solution` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, `routeFk` int(10) unsigned DEFAULT NULL, `priority` tinyint(3) unsigned DEFAULT NULL, - `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT '1', - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT 1, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `agencyModeFk` int(11) DEFAULT NULL, `landed` date DEFAULT NULL, - `isBoxed` tinyint(2) NOT NULL DEFAULT '0', - `isDeleted` tinyint(2) NOT NULL DEFAULT '0', + `isBoxed` tinyint(2) NOT NULL DEFAULT 0, + `isDeleted` tinyint(2) NOT NULL DEFAULT 0, `zoneFk` int(11) DEFAULT NULL, `collectionFk__` int(11) DEFAULT NULL, `zonePrice` decimal(10,2) DEFAULT NULL, @@ -41146,8 +40742,8 @@ BEGIN WHERE c.id = NEW.clientFk; INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) - VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, CURDATE()), CURDATE()) - ON DUPLICATE KEY UPDATE lastShipped = CURDATE(); + VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, util.VN_CURDATE()), util.VN_CURDATE()) + ON DUPLICATE KEY UPDATE lastShipped = util.VN_CURDATE(); END IF; @@ -41178,7 +40774,7 @@ BEGIN FROM vn.route r WHERE r.isOk = FALSE AND r.id IN (OLD.routeFk,NEW.routeFk) - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; call util.debugAdd(NEW.id,CONCAT(OLD.routeFk,' ',NEW.routeFk)); END IF; @@ -41202,7 +40798,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND t.id = NEW.id - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); @@ -41303,7 +40899,7 @@ BEGIN FROM vn.route r WHERE r.isOk = FALSE AND r.id = OLD.routeFk - AND r.created >= CURDATE() + AND r.created >= util.VN_CURDATE() GROUP BY r.id; DELETE FROM sale WHERE ticketFk = OLD.id; @@ -41327,9 +40923,9 @@ CREATE TABLE `ticketCollection` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, `collectionFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `level` int(11) DEFAULT NULL, - `wagon` int(11) NOT NULL DEFAULT '0', + `wagon` int(11) NOT NULL DEFAULT 0, `smartTagFk` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, `usedShelves` int(11) DEFAULT NULL COMMENT 'número de bandejas que ocupa un ticket en el carro', `itemCount` int(11) DEFAULT NULL COMMENT 'número de productos distintos en el pedido', @@ -41395,7 +40991,7 @@ DROP TABLE IF EXISTS `ticketConfig`; CREATE TABLE `ticketConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `scopeDays` tinyint(3) DEFAULT NULL, - `pickingDelay` int(11) NOT NULL DEFAULT '10' COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar', + `pickingDelay` int(11) NOT NULL DEFAULT 10 COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41467,8 +41063,8 @@ DROP TABLE IF EXISTS `ticketDown`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketDown` ( `ticketFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `selected` int(11) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `selected` int(11) NOT NULL DEFAULT 0, `collectionFk` int(11) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), @@ -41477,7 +41073,7 @@ CREATE TABLE `ticketDown` ( KEY `ticketDown_FK` (`collectionFk`), CONSTRAINT `ticketDown_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketDown_fk1` FOREIGN KEY (`selected`) REFERENCES `ticketDown_SelectionType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41525,7 +41121,7 @@ DROP TABLE IF EXISTS `ticketLastState`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketLastState` ( - `ticketFk` int(11) NOT NULL DEFAULT '0', + `ticketFk` int(11) NOT NULL DEFAULT 0, `ticketTrackingFk` int(11) NOT NULL, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`ticketFk`), @@ -41563,21 +41159,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `ticketLocation` --- - -DROP TABLE IF EXISTS `ticketLocation`; -/*!50001 DROP VIEW IF EXISTS `ticketLocation`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLocation` ( - `ticketFk` tinyint NOT NULL, - `longitude` tinyint NOT NULL, - `latitude` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `ticketLog` -- @@ -41590,11 +41171,11 @@ CREATE TABLE `ticketLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -41602,37 +41183,9 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `ticketMRW` --- - -DROP TABLE IF EXISTS `ticketMRW`; -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketMRW` ( - `id_Agencia` tinyint NOT NULL, - `empresa_id` tinyint NOT NULL, - `Consignatario` tinyint NOT NULL, - `DOMICILIO` tinyint NOT NULL, - `POBLACION` tinyint NOT NULL, - `CODPOSTAL` tinyint NOT NULL, - `telefono` tinyint NOT NULL, - `movil` tinyint NOT NULL, - `IF` tinyint NOT NULL, - `Id_Ticket` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `Id_Consigna` tinyint NOT NULL, - `CodigoPais` tinyint NOT NULL, - `Fecha` tinyint NOT NULL, - `province_id` tinyint NOT NULL, - `landing` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `ticketNotInvoiced` -- @@ -41680,7 +41233,7 @@ DROP TABLE IF EXISTS `ticketPackage`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackage` ( `ticket` int(11) NOT NULL, - `counter` int(10) unsigned NOT NULL DEFAULT '0', + `counter` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`ticket`), CONSTRAINT `ticketPackage_ticketFk` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -41697,8 +41250,8 @@ CREATE TABLE `ticketPackaging` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `quantity` int(10) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `quantity` int(10) DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `pvp` double DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -41746,7 +41299,7 @@ CREATE TABLE `ticketPackagingStartingStock` ( `itemFk` int(11) NOT NULL, `sent` int(11) DEFAULT NULL, `returned` int(11) DEFAULT NULL, - `isForgetable` tinyint(1) NOT NULL DEFAULT '0', + `isForgetable` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`clientFk`,`packagingFk`), KEY `ticketPackagingStartingStock_fk2_idx` (`packagingFk`), KEY `ticketPackagingStartingStock_fk3_idx` (`itemFk`), @@ -41789,7 +41342,7 @@ CREATE TABLE `ticketParking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, `parkingFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), @@ -41797,7 +41350,7 @@ CREATE TABLE `ticketParking` ( KEY `ticketParking_fk1_idx` (`parkingFk`), CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -41959,13 +41512,13 @@ CREATE TABLE `ticketRequest` ( `price__` double DEFAULT NULL, `itemFk` double DEFAULT NULL, `clientFk` int(11) DEFAULT NULL, - `response` longtext COLLATE utf8_unicode_ci, - `ok__` tinyint(1) NOT NULL DEFAULT '0', + `response` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `ok__` tinyint(1) NOT NULL DEFAULT 0, `total` int(11) DEFAULT NULL, `buyed` datetime DEFAULT NULL, - `ko__` tinyint(1) NOT NULL DEFAULT '0', + `ko__` tinyint(1) NOT NULL DEFAULT 0, `saleFk` int(11) DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), `isOk` tinyint(1) DEFAULT NULL, `requesterFk` int(10) unsigned DEFAULT NULL, `attenderFk` int(10) unsigned DEFAULT NULL, @@ -42057,9 +41610,9 @@ DROP TABLE IF EXISTS `ticketService`; CREATE TABLE `ticketService` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` int(11) NOT NULL DEFAULT '0', - `price` decimal(10,2) NOT NULL DEFAULT '0.00', - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '2', + `quantity` int(11) NOT NULL DEFAULT 0, + `price` decimal(10,2) NOT NULL DEFAULT 0.00, + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 2, `ticketFk` int(11) NOT NULL, `ticketServiceTypeFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -42228,7 +41781,7 @@ DROP TABLE IF EXISTS `ticketTrolley`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketTrolley` ( `ticket` int(11) NOT NULL, - `labelCount` int(11) NOT NULL DEFAULT '0', + `labelCount` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`ticket`), CONSTRAINT `fk_ticketTrolley_vs_ticket` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -42277,20 +41830,20 @@ DROP TABLE IF EXISTS `till`; CREATE TABLE `till` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, - `isAccountable` tinyint(1) NOT NULL DEFAULT '0', + `isAccountable` tinyint(1) NOT NULL DEFAULT 0, `serie` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `number` int(11) DEFAULT NULL, `concept` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `in` decimal(10,2) DEFAULT NULL, `out` decimal(10,2) DEFAULT NULL, - `bankFk` int(11) DEFAULT '1', + `bankFk` int(11) DEFAULT 1, `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned DEFAULT '442' COMMENT 'kakear', - `isLinked` tinyint(4) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isOk` tinyint(4) NOT NULL DEFAULT '0', - `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'to kak\\n', - `isConciliate` tinyint(4) NOT NULL DEFAULT '0', + `companyFk` smallint(5) unsigned DEFAULT 442 COMMENT 'kakear', + `isLinked` tinyint(4) DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `isOk` tinyint(4) NOT NULL DEFAULT 0, + `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT 1 COMMENT 'to kak\\n', + `isConciliate` tinyint(4) NOT NULL DEFAULT 0, `supplierAccountFk` mediumint(8) unsigned NOT NULL, `calculatedCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `InForeignValue` decimal(10,2) DEFAULT NULL, @@ -42305,7 +41858,7 @@ CREATE TABLE `till` ( KEY `fk_Cajas_Proveedores_account1_idx` (`supplierAccountFk`), CONSTRAINT `till_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `till_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -42340,7 +41893,7 @@ DROP TABLE IF EXISTS `tillConfig`; CREATE TABLE `tillConfig` ( `id` int(11) NOT NULL, `openingBalance` decimal(10,2) NOT NULL, - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42396,25 +41949,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Temporary table structure for view `time__` --- - -DROP TABLE IF EXISTS `time__`; -/*!50001 DROP VIEW IF EXISTS `time__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `time__` ( - `dated` tinyint NOT NULL, - `period` tinyint NOT NULL, - `month` tinyint NOT NULL, - `year` tinyint NOT NULL, - `day` tinyint NOT NULL, - `week` tinyint NOT NULL, - `yearMonth` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `town` -- @@ -42614,7 +42148,7 @@ CREATE TABLE `trainingCenter` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42633,9 +42167,9 @@ CREATE TABLE `trainingCourse` ( `ended` datetime NOT NULL, `invoice` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `amount` double DEFAULT NULL, - `remark` longtext COLLATE utf8_unicode_ci, - `hasDiscount` tinyint(1) NOT NULL DEFAULT '0', - `hasDiploma` tinyint(1) NOT NULL DEFAULT '0', + `remark` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `hasDiscount` tinyint(1) NOT NULL DEFAULT 0, + `hasDiploma` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `frgnWorker_idx` (`workerFk`), KEY `frgnCenter_idx` (`centerFk`), @@ -42643,7 +42177,7 @@ CREATE TABLE `trainingCourse` ( CONSTRAINT `frgnCenter` FOREIGN KEY (`centerFk`) REFERENCES `trainingCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnTrainingCourseType` FOREIGN KEY (`trainingCourseTypeFk`) REFERENCES `trainingCourseType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42657,7 +42191,7 @@ CREATE TABLE `trainingCourseType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42677,12 +42211,12 @@ CREATE TABLE `travel` ( `warehouseOutFk` smallint(6) unsigned DEFAULT NULL, `agencyFk` int(11) DEFAULT NULL, `ref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `isDelivered` tinyint(1) NOT NULL DEFAULT '0', - `isReceived` tinyint(1) NOT NULL DEFAULT '0', + `isDelivered` tinyint(1) NOT NULL DEFAULT 0, + `isReceived` tinyint(1) NOT NULL DEFAULT 0, `m3` decimal(10,2) unsigned DEFAULT NULL, `kg` decimal(10,0) unsigned DEFAULT NULL, `cargoSupplierFk` int(11) DEFAULT NULL, - `totalEntries` tinyint(4) unsigned DEFAULT '0', + `totalEntries` tinyint(4) unsigned DEFAULT 0, `appointment` datetime DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `shipment_2` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`ref`), @@ -42808,7 +42342,7 @@ CREATE TABLE `travelClonedWeekly` ( CONSTRAINT `travelClonedWeekly_FK_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelClonedWeekly_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `travelClonedWeekly_FK_4` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42823,11 +42357,11 @@ CREATE TABLE `travelLog` ( `originFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -42835,7 +42369,7 @@ CREATE TABLE `travelLog` ( KEY `userFk` (`userFk`), CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42850,9 +42384,9 @@ CREATE TABLE `travelObservation` ( `originFk` int(11) NOT NULL, `userFk` int(11) NOT NULL, `description` text COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42909,11 +42443,11 @@ DROP TABLE IF EXISTS `trolley`; CREATE TABLE `trolley` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(10) unsigned DEFAULT NULL, - `coupled` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `coupled` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `trolley_FK` (`workerFk`), CONSTRAINT `trolley_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42946,8 +42480,8 @@ CREATE TABLE `userConfig` ( `userFk` int(10) unsigned NOT NULL, `warehouseFk` smallint(6) DEFAULT NULL, `companyFk` smallint(5) unsigned DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NULL DEFAULT current_timestamp(), + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`userFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42964,11 +42498,11 @@ CREATE TABLE `userLog` ( `originFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -43025,9 +42559,9 @@ CREATE TABLE `vehicle` ( `numberPlate` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `model` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `tradeMark` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `m3` double DEFAULT NULL, - `isActive` tinyint(4) NOT NULL DEFAULT '1', + `isActive` tinyint(4) NOT NULL DEFAULT 1, `warehouseFk` smallint(6) unsigned DEFAULT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `deliveryPointFk` int(11) DEFAULT '6' COMMENT 'Direccion para Buscaman', @@ -43066,7 +42600,7 @@ CREATE TABLE `vehicleDms` ( KEY `vehicleDms_FK_1` (`dmsFk`), CONSTRAINT `vehicleDms_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `vehicleDms_FK_1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de vehicle'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de vehicle'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43089,7 +42623,7 @@ CREATE TABLE `vehicleEvent` ( KEY `vehicleEvent_FK_1` (`userFk`), CONSTRAINT `vehicleEvent_FK` FOREIGN KEY (`vehicleStateFk`) REFERENCES `vehicleState` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `vehicleEvent_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43109,7 +42643,7 @@ CREATE TABLE `vehicleInvoiceIn` ( KEY `vehicleInvoiceIn_FK_1` (`invoiceInFk`), CONSTRAINT `vehicleInvoiceIn_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), CONSTRAINT `vehicleInvoiceIn_FK_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43122,7 +42656,7 @@ DROP TABLE IF EXISTS `vehicleNotes`; CREATE TABLE `vehicleNotes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `vehicleFk` int(10) unsigned NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `note` text COLLATE utf8_unicode_ci NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -43157,15 +42691,15 @@ DROP TABLE IF EXISTS `volumeConfig`; CREATE TABLE `volumeConfig` ( `palletM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', `trolleyM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', - `dutchCompressionRate` double NOT NULL DEFAULT '1', + `dutchCompressionRate` double NOT NULL DEFAULT 1, `standardFlowerBox` int(11) NOT NULL COMMENT 'en litros', - `minCompressionRate` decimal(10,2) DEFAULT '0.30' COMMENT 'minimo permitido por la empresa', - `ccLength` int(11) NOT NULL DEFAULT '130' COMMENT 'longitud útil para la carga de un CC, en cm', - `ccWidth` int(11) NOT NULL DEFAULT '60' COMMENT 'ancho útil para la carga en un CC, en cm', - `sorterPallet_m3` decimal(5,1) NOT NULL DEFAULT '2.0' COMMENT 'volumen minimo para extraer pallet del sorter', - `minTicketVolume` int(11) NOT NULL DEFAULT '75' COMMENT 'volumen mínimo, en litros, para que un pedido sea preparable', - `shelveVolume` int(11) DEFAULT '200' COMMENT 'volumen en litros de una bandeja standard, a efectos de los sacadores', - `minTicketValue` int(11) NOT NULL DEFAULT '50' + `minCompressionRate` decimal(10,2) DEFAULT 0.30 COMMENT 'minimo permitido por la empresa', + `ccLength` int(11) NOT NULL DEFAULT 130 COMMENT 'longitud útil para la carga de un CC, en cm', + `ccWidth` int(11) NOT NULL DEFAULT 60 COMMENT 'ancho útil para la carga en un CC, en cm', + `sorterPallet_m3` decimal(5,1) NOT NULL DEFAULT 2.0 COMMENT 'volumen minimo para extraer pallet del sorter', + `minTicketVolume` int(11) NOT NULL DEFAULT 75 COMMENT 'volumen mínimo, en litros, para que un pedido sea preparable', + `shelveVolume` int(11) DEFAULT 200 COMMENT 'volumen en litros de una bandeja standard, a efectos de los sacadores', + `minTicketValue` int(11) NOT NULL DEFAULT 50 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='almacena el valor standard para volumenes convencionales de Verdnatura, en metros cúbicos'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -43178,10 +42712,10 @@ DROP TABLE IF EXISTS `wagon`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `wagon` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `volume` int(11) NOT NULL DEFAULT '150' COMMENT 'Volumen en litros', + `volume` int(11) NOT NULL DEFAULT 150 COMMENT 'Volumen en litros', `plate` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Matrícula', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43193,15 +42727,15 @@ DROP TABLE IF EXISTS `wagonVolumetry`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `wagonVolumetry` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `level` int(10) unsigned NOT NULL DEFAULT '0', - `lines` int(10) unsigned NOT NULL DEFAULT '1', - `liters` int(10) unsigned NOT NULL DEFAULT '0', - `height` int(10) unsigned NOT NULL DEFAULT '20', + `level` int(10) unsigned NOT NULL DEFAULT 0, + `lines` int(10) unsigned NOT NULL DEFAULT 1, + `liters` int(10) unsigned NOT NULL DEFAULT 0, + `height` int(10) unsigned NOT NULL DEFAULT 20, `wagonFk` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `wagonVolumetry_FK` (`wagonFk`), CONSTRAINT `wagonVolumetry_FK` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43215,31 +42749,31 @@ CREATE TABLE `warehouse` ( `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `isFeedStock` tinyint(1) unsigned NOT NULL DEFAULT '0', + `isFeedStock` tinyint(1) unsigned NOT NULL DEFAULT 0, `addressName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `delay` double NOT NULL DEFAULT '0.004', - `hasAvailable` tinyint(4) NOT NULL DEFAULT '0', - `isForTicket` tinyint(2) unsigned zerofill NOT NULL DEFAULT '00', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', - `labelZone` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'almacenes donde hay produccion', - `hasComission` tinyint(4) NOT NULL DEFAULT '0', - `isInventory` tinyint(2) NOT NULL DEFAULT '0', - `isComparative` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Si esta a true,en la comparativa muestra el stock de este almacen, cuando no se especifica almacen.', - `valuatedInventory` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Determina si se incluye en el informe de inventario valorado', - `isManaged` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Se añaden los cubos de expedition a la tabla ticketPackaging', - `hasConfectionTeam` tinyint(1) unsigned NOT NULL DEFAULT '0', - `hasStowaway` tinyint(1) NOT NULL DEFAULT '0', - `hasDms` tinyint(1) NOT NULL DEFAULT '0', + `delay` double NOT NULL DEFAULT 0.004, + `hasAvailable` tinyint(4) NOT NULL DEFAULT 0, + `isForTicket` tinyint(2) unsigned zerofill NOT NULL DEFAULT 00, + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, + `labelZone` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'almacenes donde hay produccion', + `hasComission` tinyint(4) NOT NULL DEFAULT 0, + `isInventory` tinyint(2) NOT NULL DEFAULT 0, + `isComparative` tinyint(2) NOT NULL DEFAULT 0 COMMENT 'Si esta a true,en la comparativa muestra el stock de este almacen, cuando no se especifica almacen.', + `valuatedInventory` tinyint(2) NOT NULL DEFAULT 0 COMMENT 'Determina si se incluye en el informe de inventario valorado', + `isManaged` tinyint(2) NOT NULL DEFAULT 0 COMMENT 'Se añaden los cubos de expedition a la tabla ticketPackaging', + `hasConfectionTeam` tinyint(1) unsigned NOT NULL DEFAULT 0, + `hasStowaway` tinyint(1) NOT NULL DEFAULT 0, + `hasDms` tinyint(1) NOT NULL DEFAULT 0, `pickUpAgencyModeFk` int(11) DEFAULT NULL, - `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT '0', + `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT 0, `aliasFk` smallint(5) unsigned DEFAULT NULL, `labelReport` int(11) DEFAULT NULL, - `hasUbications` tinyint(1) NOT NULL DEFAULT '1', - `hasProduction` tinyint(1) NOT NULL DEFAULT '0', + `hasUbications` tinyint(1) NOT NULL DEFAULT 1, + `hasProduction` tinyint(1) NOT NULL DEFAULT 0, `addressFk` int(11) DEFAULT NULL, - `hasMachine` tinyint(1) NOT NULL DEFAULT '0', - `isLogiflora` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Este almacén acepta productos de Logiflora', - `isBionic` tinyint(1) NOT NULL DEFAULT '1', + `hasMachine` tinyint(1) NOT NULL DEFAULT 0, + `isLogiflora` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Este almacén acepta productos de Logiflora', + `isBionic` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`countryFk`), @@ -43323,7 +42857,7 @@ DROP TABLE IF EXISTS `workCenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workCenter` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL DEFAULT 0, `name` varchar(255) DEFAULT NULL, `payrollCenterFk` int(11) DEFAULT NULL, `counter` bigint(20) DEFAULT NULL, @@ -43373,19 +42907,19 @@ CREATE TABLE `worker` ( `started__` datetime DEFAULT NULL, `ended__` datetime DEFAULT NULL, `notes__` varchar(254) COLLATE utf8_unicode_ci DEFAULT NULL, - `photo` blob, + `photo` blob DEFAULT NULL, `fi__` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL, `address__` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `birthed__` date NOT NULL, `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, `clientFk__` int(11) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `bossFk` int(11) NOT NULL DEFAULT '103', + `bossFk` int(11) NOT NULL DEFAULT 103, `fiDueDate` datetime DEFAULT NULL, - `hasMachineryAuthorized` tinyint(2) DEFAULT '0', + `hasMachineryAuthorized` tinyint(2) DEFAULT 0, `seniority` date DEFAULT NULL, - `isTodayRelative` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', - `isF11Allowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Usuario autorizado para abrir el F11', + `isTodayRelative` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', + `isF11Allowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Usuario autorizado para abrir el F11', `sectorFk` int(11) DEFAULT NULL COMMENT 'Sector que tiene asociado el trabajador.', `maritalStatus` enum('S','M') COLLATE utf8_unicode_ci NOT NULL, `labelerFk` tinyint(3) unsigned DEFAULT NULL, @@ -43427,7 +42961,7 @@ CREATE TABLE `workerBosses` ( KEY `fg_bossFk_worker_idx` (`bossFk`), CONSTRAINT `fg_bossFk_worker` FOREIGN KEY (`bossFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fg_workerFk_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43455,9 +42989,9 @@ DROP TABLE IF EXISTS `workerBusinessType`; CREATE TABLE `workerBusinessType` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `isFullTime` tinyint(1) NOT NULL DEFAULT '1', - `isPermanent` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Contrato fijo', - `hasHolidayEntitlement` tinyint(1) DEFAULT '1' COMMENT 'Tiene derecho a vacaciones', + `isFullTime` tinyint(1) NOT NULL DEFAULT 1, + `isPermanent` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Contrato fijo', + `hasHolidayEntitlement` tinyint(1) DEFAULT 1 COMMENT 'Tiene derecho a vacaciones', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -43490,7 +43024,7 @@ CREATE TABLE `workerClockLog` ( `originFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `logWorkerClockoriginFk` (`originFk`), @@ -43571,7 +43105,7 @@ CREATE TABLE `workerDistributionCategory` ( PRIMARY KEY (`id`), KEY `workerDistributionCategory_workerFk_idx` (`workerFk`), CONSTRAINT `workerDistributionCategory_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43585,7 +43119,7 @@ CREATE TABLE `workerDocument` ( `id` int(11) NOT NULL AUTO_INCREMENT, `worker` int(10) unsigned DEFAULT NULL, `document` int(11) DEFAULT NULL, - `isReadableByWorker` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica si el empleado tiene permiso para acceder al documento', + `isReadableByWorker` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el empleado tiene permiso para acceder al documento', PRIMARY KEY (`id`), KEY `workerDocument_ibfk_1` (`worker`), KEY `workerDocument_ibfk_2` (`document`), @@ -43606,7 +43140,7 @@ CREATE TABLE `workerEmergencyBoss` ( `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all responsible people phones', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43623,7 +43157,7 @@ CREATE TABLE `workerHourPrice` ( `nightInc` decimal(4,2) DEFAULT NULL, `extraInc` decimal(4,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43638,14 +43172,14 @@ CREATE TABLE `workerIrpf` ( `spouseNif` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `geographicMobilityDate` date DEFAULT NULL, `disabilityGradeFk` int(11) DEFAULT NULL, - `isDependend` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Acredita la necesidad de ayuda de terceras personas o movilidad reducida', + `isDependend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Acredita la necesidad de ayuda de terceras personas o movilidad reducida', `familySituation` enum('1','2','3') COLLATE utf8_unicode_ci DEFAULT '1', `spousePension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Pensión compensatoria en favor del conyuge ', `childPension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Anualidades por alimentos en favor de los hijos', - `hasHousingPaymentBefore` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Apartado 5 - Pagos por adquisición o rehabilitación de la vivienda habitual utilizando financiación ajena, con derecho a deducción del IRPF', - `hasHousingPaymentAfter` tinyint(1) NOT NULL DEFAULT '0', - `hasExtendedWorking` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Aprtado 1 - prolongar la actividad laboral', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `hasHousingPaymentBefore` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Apartado 5 - Pagos por adquisición o rehabilitación de la vivienda habitual utilizando financiación ajena, con derecho a deducción del IRPF', + `hasHousingPaymentAfter` tinyint(1) NOT NULL DEFAULT 0, + `hasExtendedWorking` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Aprtado 1 - prolongar la actividad laboral', + `updated` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`workerFk`), KEY `workerIrpf_disabilityGradeFk` (`disabilityGradeFk`), CONSTRAINT `workerIrpf_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, @@ -43664,21 +43198,21 @@ CREATE TABLE `workerJourney` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `dated` date NOT NULL, - `total` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceOrdinaryHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `nocturn` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceNocturnHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `holiday` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceHolidayHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `lunch` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceExtraHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `extra` decimal(5,2) NOT NULL DEFAULT '0.00', - `contractJourney` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceExtraHoliday` decimal(5,2) NOT NULL DEFAULT '0.00', + `total` decimal(5,2) NOT NULL DEFAULT 0.00, + `priceOrdinaryHour` decimal(5,2) NOT NULL DEFAULT 0.00, + `nocturn` decimal(5,2) NOT NULL DEFAULT 0.00, + `priceNocturnHour` decimal(5,2) NOT NULL DEFAULT 0.00, + `holiday` decimal(5,2) NOT NULL DEFAULT 0.00, + `priceHolidayHour` decimal(5,2) NOT NULL DEFAULT 0.00, + `lunch` decimal(5,2) NOT NULL DEFAULT 0.00, + `priceExtraHour` decimal(5,2) NOT NULL DEFAULT 0.00, + `extra` decimal(5,2) NOT NULL DEFAULT 0.00, + `contractJourney` decimal(5,2) NOT NULL DEFAULT 0.00, + `priceExtraHoliday` decimal(5,2) NOT NULL DEFAULT 0.00, `businessFk` int(11) DEFAULT NULL, - `isPaid` tinyint(1) NOT NULL DEFAULT '0', - `isUpdated` tinyint(1) NOT NULL DEFAULT '0', - `permission` decimal(5,2) NOT NULL DEFAULT '0.00', + `isPaid` tinyint(1) NOT NULL DEFAULT 0, + `isUpdated` tinyint(1) NOT NULL DEFAULT 0, + `permission` decimal(5,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`id`), UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), KEY `fk_workerJourney_user_idx` (`userFk`), @@ -43686,7 +43220,7 @@ CREATE TABLE `workerJourney` ( KEY `workerJourney_dated_idx` (`dated`), CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerJourney_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `postgresql`.`business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43720,11 +43254,11 @@ CREATE TABLE `workerLog` ( `originFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned NOT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text COLLATE utf8_unicode_ci NOT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -43732,7 +43266,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43744,12 +43278,12 @@ DROP TABLE IF EXISTS `workerMana`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerMana` ( `workerFk` int(10) unsigned NOT NULL, - `size` int(11) NOT NULL DEFAULT '300', - `amount` int(11) NOT NULL DEFAULT '0', - `pricesModifierRate` double NOT NULL DEFAULT '0', - `isPricesModifierActivated` tinyint(1) NOT NULL DEFAULT '1', - `minRate` decimal(3,2) NOT NULL DEFAULT '-0.05', - `maxRate` decimal(3,2) NOT NULL DEFAULT '0.05', + `size` int(11) NOT NULL DEFAULT 300, + `amount` int(11) NOT NULL DEFAULT 0, + `pricesModifierRate` double NOT NULL DEFAULT 0, + `isPricesModifierActivated` tinyint(1) NOT NULL DEFAULT 1, + `minRate` decimal(3,2) NOT NULL DEFAULT -0.05, + `maxRate` decimal(3,2) NOT NULL DEFAULT 0.05, PRIMARY KEY (`workerFk`), KEY `fk_mana_spellers_Trabajadores_idx` (`workerFk`), CONSTRAINT `fk_mana_spellers_Trabajadores` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -43814,13 +43348,13 @@ CREATE TABLE `workerMistake` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `workerMistakeTypeFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `workerMistake_fk1_idx` (`userFk`), KEY `workerMistake_fk2_idx` (`workerMistakeTypeFk`), CONSTRAINT `workerMistake_fk1` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workerMistake_fk2` FOREIGN KEY (`workerMistakeTypeFk`) REFERENCES `workerMistakeType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43847,19 +43381,19 @@ DROP TABLE IF EXISTS `workerRelatives`; CREATE TABLE `workerRelatives` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(10) unsigned NOT NULL, - `isDescendant` tinyint(1) DEFAULT '1' COMMENT 'Descendientes - Ascendientes', + `isDescendant` tinyint(1) DEFAULT 1 COMMENT 'Descendientes - Ascendientes', `disabilityGradeFk` int(11) DEFAULT NULL, `birthed` int(4) NOT NULL, `adoptionYear` int(4) DEFAULT NULL COMMENT 'Solo en el caso de descendientes', - `isDependend` tinyint(1) DEFAULT '0', - `isJointCustody` tinyint(1) DEFAULT '0' COMMENT 'Solo en el caso de descendientes', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `isDependend` tinyint(1) DEFAULT 0, + `isJointCustody` tinyint(1) DEFAULT 0 COMMENT 'Solo en el caso de descendientes', + `updated` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `workerRelatives_disabilityGradeFk` (`disabilityGradeFk`), KEY `workerRelatives_workerFk` (`workerFk`), CONSTRAINT `workerRelatives_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerRelatives_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `workerIrpf` (`workerFk`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43874,7 +43408,7 @@ CREATE TABLE `workerShelving` ( `workerFk` int(10) unsigned NOT NULL, `shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL, `collectionFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `workerShelving_shelving_fk` (`shelvingFk`), KEY `workerShelving_FK` (`workerFk`), @@ -43882,7 +43416,7 @@ CREATE TABLE `workerShelving` ( CONSTRAINT `workerShelving_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `workerShelving_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE, CONSTRAINT `workerShelving_worker_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43968,11 +43502,11 @@ CREATE TABLE `workerTimeControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `timed` datetime NOT NULL, - `manual` tinyint(4) NOT NULL DEFAULT '0', + `manual` tinyint(4) NOT NULL DEFAULT 0, `order` int(11) DEFAULT NULL, `warehouseFk` smallint(6) unsigned DEFAULT NULL, `direction` enum('in','out','middle') COLLATE utf8_unicode_ci DEFAULT 'middle', - `isSendMail` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', + `isSendMail` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', PRIMARY KEY (`id`), UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`), KEY `warehouseFkfk1_idx` (`warehouseFk`), @@ -43993,7 +43527,7 @@ DELIMITER ;; AFTER INSERT ON `workerTimeControl` FOR EACH ROW BEGIN - IF NEW.timed > DATE_ADD(NOW(), INTERVAL 1 DAY) THEN + IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN CALL util.throw('date in the future'); END IF; END */;; @@ -44032,7 +43566,7 @@ CREATE TABLE `workerTimeControlConfig` ( `timeToBreakTime` int(11) DEFAULT NULL COMMENT 'Tiempo mínimo que se debe trabajar para añadir descanso, expresado en segundos', `dayMaxTime` int(11) DEFAULT NULL COMMENT 'Tiempo máximo desde la entrada hasta la salida, expresado en segundos', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44049,7 +43583,7 @@ CREATE TABLE `workerTimeControlConfig_` ( PRIMARY KEY (`id`), KEY `warehouseFk_1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44062,7 +43596,7 @@ DROP TABLE IF EXISTS `workerTimeControlLog`; CREATE TABLE `workerTimeControlLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` datetime NOT NULL DEFAULT current_timestamp(), `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de fichadas, se rellena cuando el fichador(tablet) no autoriza el fichaje (PROC:vn.workerTimeControl_check)'; @@ -44081,14 +43615,14 @@ CREATE TABLE `workerTimeControlMail` ( `year` int(4) NOT NULL, `week` int(2) NOT NULL, `state` enum('SENDED','CONFIRMED','REVISE') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'SENDED', - `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha/hora último cambio de estado', - `sendedCounter` int(3) NOT NULL DEFAULT '1' COMMENT 'Número de veces que se ha enviado el correo', - `emailResponse` text COLLATE utf8_unicode_ci, + `updated` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'Fecha/hora último cambio de estado', + `sendedCounter` int(3) NOT NULL DEFAULT 1 COMMENT 'Número de veces que se ha enviado el correo', + `emailResponse` text COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`year`,`week`), KEY `workerFk_idx` (`workerFk`), CONSTRAINT `workerTimeControlMail_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda las respuestas de mail de los correos generados automáticamente por la procedimiento workerTimeControl_sendMail'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda las respuestas de mail de los correos generados automáticamente por la procedimiento workerTimeControl_sendMail'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44144,7 +43678,7 @@ CREATE TABLE `workerTimeControlSchedule` ( `time` time DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `punique_trhf` (`time`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44263,8 +43797,8 @@ DROP TABLE IF EXISTS `workers20190711`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711` ( - `person_id` int(11) NOT NULL DEFAULT '0', - `business_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, + `business_id` int(11) NOT NULL DEFAULT 0, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, @@ -44289,7 +43823,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasAbril` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44297,9 +43831,9 @@ CREATE TABLE `workers20190711_FichadasAbril` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44311,7 +43845,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasJulio11`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasJulio11` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44319,9 +43853,9 @@ CREATE TABLE `workers20190711_FichadasJulio11` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44333,7 +43867,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasJunio`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasJunio` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44341,9 +43875,9 @@ CREATE TABLE `workers20190711_FichadasJunio` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44355,7 +43889,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasMayo`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasMayo` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44363,9 +43897,9 @@ CREATE TABLE `workers20190711_FichadasMayo` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44377,7 +43911,7 @@ DROP TABLE IF EXISTS `workers20190711_FichadasOctubre`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasOctubre` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44385,9 +43919,9 @@ CREATE TABLE `workers20190711_FichadasOctubre` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44399,7 +43933,7 @@ DROP TABLE IF EXISTS `workers20190711_Garrote`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_Garrote` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', + `person_id` int(11) NOT NULL DEFAULT 0, `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -44407,9 +43941,9 @@ CREATE TABLE `workers20190711_Garrote` ( `Hora` int(2) DEFAULT NULL, `Minuto` int(2) DEFAULT NULL, `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + `jornada` decimal(5,2) NOT NULL DEFAULT 8.00, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44427,7 +43961,7 @@ CREATE TABLE `workingHours` ( PRIMARY KEY (`id`), KEY `user_working_hour_idx` (`userId`), CONSTRAINT `user_working_hour` FOREIGN KEY (`userId`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44442,7 +43976,7 @@ DELIMITER ;; BEFORE INSERT ON `workingHours` FOR EACH ROW BEGIN - IF (SELECT COUNT(*) FROM workingHours WHERE userId = NEW.userId AND DATE(timeIn) = CURDATE()) > 0 THEN + IF (SELECT COUNT(*) FROM workingHours WHERE userId = NEW.userId AND DATE(timeIn) = util.VN_CURDATE()) > 0 THEN CALL util.throw ('ALREADY_LOGGED'); END IF; END */;; @@ -44465,11 +43999,11 @@ CREATE TABLE `zone` ( `hour` datetime NOT NULL, `warehouseFk__` smallint(6) unsigned DEFAULT NULL, `agencyModeFk` int(11) NOT NULL, - `travelingDays` int(11) NOT NULL DEFAULT '1', - `price` double NOT NULL DEFAULT '0', - `bonus` double NOT NULL DEFAULT '0', - `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', - `inflation` decimal(5,2) NOT NULL DEFAULT '1.00', + `travelingDays` int(11) NOT NULL DEFAULT 1, + `price` double NOT NULL DEFAULT 0, + `bonus` double NOT NULL DEFAULT 0, + `isVolumetric` tinyint(1) NOT NULL DEFAULT 0, + `inflation` decimal(5,2) NOT NULL DEFAULT 1.00, `m3Max` decimal(10,2) unsigned DEFAULT NULL, `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos que esa ruta puede transportar', `code` varchar(45) DEFAULT NULL, @@ -44526,7 +44060,7 @@ DROP TABLE IF EXISTS `zoneConfig`; CREATE TABLE `zoneConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `scope` int(10) unsigned NOT NULL, - `forwardDays` int(10) NOT NULL DEFAULT '7' COMMENT 'days forward to show zone_upcomingDeliveries', + `forwardDays` int(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -44588,13 +44122,13 @@ CREATE TABLE `zoneExclusion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zoneFk` int(11) NOT NULL, `dated` date NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `userFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `zoneFk_2` (`zoneFk`,`dated`), KEY `zoneFk` (`zoneFk`), CONSTRAINT `zoneExclusion_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44658,7 +44192,7 @@ CREATE TABLE `zoneFilter` ( KEY `zoneFilter_FK_1` (`itemTypeFk`), CONSTRAINT `zoneFilter_FK` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneFilter_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44676,7 +44210,7 @@ CREATE TABLE `zoneGeo` ( `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `lft` int(11) DEFAULT NULL, `rgt` int(11) DEFAULT NULL, - `depth` bigint(22) NOT NULL DEFAULT '0', + `depth` bigint(22) NOT NULL DEFAULT 0, `sons` decimal(10,0) DEFAULT NULL, PRIMARY KEY (`id`), KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), @@ -44739,7 +44273,7 @@ CREATE TABLE `zoneGeoRecalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44772,11 +44306,11 @@ CREATE TABLE `zoneLog` ( `originFk` int(10) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8 DEFAULT NULL, `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, + `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -44784,7 +44318,7 @@ CREATE TABLE `zoneLog` ( KEY `userFk` (`userFk`), CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44799,11 +44333,11 @@ CREATE TABLE `zonePromo__` ( `zoneFk` int(11) NOT NULL, `dated` date NOT NULL, `amount` decimal(10,2) NOT NULL, - `isDone` tinyint(4) NOT NULL DEFAULT '0', + `isDone` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `zonePromo_fk1_idx` (`zoneFk`), CONSTRAINT `zonePromo_fk1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45065,7 +44599,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(NOW(), INTERVAL -10 MINUTE),DATE_ADD(NOW(), INTERVAL -1 MINUTE)) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -45083,7 +44617,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(CURDATE(), INTERVAL -1 DAY)) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 DAY)) */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -45142,7 +44676,7 @@ DELIMITER ;; SELECT week,year INTO vWeek,vYear FROM vn.time - WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) + WHERE dated IN (DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL -4 DAY)) GROUP BY year,week LIMIT 1; @@ -45635,7 +45169,7 @@ BEGIN INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) SELECT vWarehouse, vItem, vComponentCost, vCost FROM vn.rate - WHERE dated <= CURDATE() + WHERE dated <= util.VN_CURDATE() AND warehouseFk = vWarehouse ORDER BY dated DESC LIMIT 1; @@ -45645,7 +45179,7 @@ BEGIN /* INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost FROM vn.rate - WHERE dated <= CURDATE() + WHERE dated <= util.VN_CURDATE() AND warehouseFk = vWarehouse ORDER BY dated DESC LIMIT 1; @@ -45720,9 +45254,9 @@ BEGIN RETURN 0; END IF; - SET vDate = IFNULL(vDate, CURDATE()); + SET vDate = IFNULL(vDate, util.VN_CURDATE()); - SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vDateIni = TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); SELECT IFNULL(SUM(t.amount), 0) INTO vDebt @@ -45814,7 +45348,7 @@ BEGIN JOIN saleComponent sc on sc.saleFk = s.id WHERE sc.componentFk IN (vManaComponent, vAutoManaComponent) AND t.shipped > vFromDated - AND t.shipped < TIMESTAMPADD(DAY,1,CURDATE()) + AND t.shipped < TIMESTAMPADD(DAY,1,util.VN_CURDATE()) AND a.clientFk = vClient UNION ALL SELECT - amountPaid @@ -45822,7 +45356,7 @@ BEGIN JOIN `client` c ON c.id = r.clientFk WHERE r.bankFk = vManaBank AND r.payed > vFromDated - AND r.payed <= CURDATE() + AND r.payed <= util.VN_CURDATE() AND c.id = vClient UNION ALL SELECT g.amount @@ -45830,7 +45364,7 @@ BEGIN JOIN `client` c ON c.id = g.clientFk WHERE g.greugeTypeFk = vManaGreugeType AND g.shipped > vFromDated - AND g.shipped <= CURDATE() + AND g.shipped <= util.VN_CURDATE() AND c.id = vClient ) sub; RETURN IFNULL(vMana,0); @@ -46022,7 +45556,7 @@ BEGIN l: LOOP SELECT workerSubstitute INTO vWorkerSubstituteFk FROM sharingCart - WHERE curdate() BETWEEN started AND ended + WHERE util.VN_CURDATE() BETWEEN started AND ended AND workerFk = vSalesPersonFk ORDER BY id LIMIT 1; @@ -46299,7 +45833,7 @@ BEGIN FROM (SELECT taxClassFk, rate FROM invoiceInTaxBookingAccount - WHERE effectived <= CURDATE() + WHERE effectived <= util.VN_CURDATE() AND countryFk = vCountryFk AND taxClassFk = vTaxClass ORDER BY effectived DESC @@ -46511,8 +46045,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_calcCommission__`( - vCurrentCommission INT, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_calcCommission__`(vCurrentCommission INT, vTravelFk INT, vCurrencyFk INT ) RETURNS int(11) @@ -46552,8 +46085,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`( - vTravelFk INT, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`(vTravelFk INT, vCurrencyFk INT, vSupplierFk INT ) RETURNS int(11) @@ -46622,8 +46154,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission__`( - vTravelFk INT, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission__`(vTravelFk INT, vCurrencyFk INT, vSupplierFk INT ) RETURNS int(11) @@ -46669,8 +46200,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`( - vCurrency INT, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`(vCurrency INT, vSupplierFk INT ) RETURNS int(11) READS SQL DATA @@ -47021,6 +46551,19 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `getEnvironment` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `getInventoryDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47202,7 +46745,7 @@ BEGIN SELECT rate3 INTO price FROM vn.priceFixed WHERE itemFk = vItemFk - AND CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; + AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; SELECT `value` INTO price FROM vn.specialPrice @@ -47239,7 +46782,7 @@ BEGIN * #PENDING REVIEW **/ - DECLARE vToday DATETIME DEFAULT CURDATE(); + DECLARE vToday DATETIME DEFAULT util.VN_CURDATE(); DECLARE vYesterday DATETIME; DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); DECLARE vTicket INT DEFAULT NULL; @@ -47256,10 +46799,10 @@ BEGIN FROM vn.sale s JOIN vn.saleTracking st ON st.saleFk = s.id JOIN vn.ticketStateToday tst ON tst.ticket = s.ticketFk - WHERE st.created > CURDATE() + WHERE st.created > util.VN_CURDATE() -- AND tst.`code` = 'ON_PREPARATION' ) sub ON sub.ticketFk = i.Id_Ticket - WHERE odbc_date > CURDATE() + WHERE odbc_date > util.VN_CURDATE() AND s.`code` = 'ON_PREPARATION' AND i.Id_Trabajador = vWorker AND sub.ticketFk IS NULL @@ -48280,7 +47823,7 @@ BEGIN IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) AND ISNULL(m.outTimed)) + AND m.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW()) AND ISNULL(m.outTimed)) THEN RETURN "REGISTERED"; ELSE @@ -48369,7 +47912,7 @@ BEGIN DECLARE vCount INT; DECLARE vUuid VARCHAR(255); - DECLARE vSendDate DATETIME DEFAULT NOW(); + DECLARE vSendDate DATETIME DEFAULT util.VN_NOW(); DECLARE vSender VARCHAR(255) CHARSET utf8; SELECT `name` INTO vSender @@ -49341,7 +48884,7 @@ proc:BEGIN JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk WHERE sg.id = vParamFk - AND sg.created > TIMESTAMPADD(WEEK,-1, CURDATE()) + AND sg.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()) LIMIT 1; IF vValidFk THEN @@ -49356,7 +48899,7 @@ proc:BEGIN SELECT c.id INTO vValidFk FROM vn.collection c WHERE c.id = vParamFk - AND c.created > TIMESTAMPADD(WEEK,-1, CURDATE()); + AND c.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); IF vValidFk THEN @@ -49370,7 +48913,7 @@ proc:BEGIN SELECT t.id INTO vValidFk FROM vn.ticket t WHERE t.id = vParamFk - AND t.shipped > TIMESTAMPADD(WEEK,-1, CURDATE()); + AND t.shipped > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); IF vValidFk THEN @@ -49500,7 +49043,7 @@ BEGIN IF vTicket IS NULL THEN CALL vn.ticket_add( vClientFk, - IFNULL(vShipped, CURDATE()), + IFNULL(vShipped, util.VN_CURDATE()), vWarehouseFk, vCompanyFk, vAddressFk, @@ -49560,8 +49103,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`( - vClient INT +CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`(vClient INT ,vBank INT ,vAmount DOUBLE ,vConcept VARCHAR(25) @@ -49782,7 +49324,7 @@ BEGIN IF NOT vTravelFk THEN INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) - SELECT vLanded, curdate(), vWarehouseFk, wOut.id, am.id + SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id FROM vn.warehouse wOut JOIN vn.agencyMode am ON am.name = 'LOGIFLORA' WHERE wOut.name = 'Holanda'; @@ -49888,6 +49430,45 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `VN_CURDATE` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `VN_CURTIME` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `VN_NOW` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `workerIsBoss` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49970,7 +49551,7 @@ BEGIN IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), NOW()) AND ISNULL(m.outTimed)) + AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed)) THEN RETURN TRUE; ELSE @@ -50032,7 +49613,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC BEGIN DECLARE vDirection VARCHAR(6); @@ -50101,7 +49682,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC BEGIN DECLARE vDirection VARCHAR(6); @@ -50209,8 +49790,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`( - vAsiento INT, +CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`(vAsiento INT, vDated DATE, vSubaccount VARCHAR(12), vAccount VARCHAR(12), @@ -50392,7 +49972,7 @@ BEGIN */ DECLARE vAgency INT; DECLARE vShipped DATE; -DECLARE vLanded DATE DEFAULT CURDATE(); +DECLARE vLanded DATE DEFAULT util.VN_CURDATE(); SELECT agencyFk INTO vAgency FROM agencyMode WHERE id= vAgencyMode; l: LOOP @@ -50459,7 +50039,7 @@ BEGIN ) t LIMIT 1 ) t - WHERE IF(vDated = CURDATE(), t.maxHour > HOUR(NOW()), TRUE) AND t.substractDay < 225; + WHERE IF(vDated = util.VN_CURDATE(), t.maxHour > HOUR(util.VN_NOW()), TRUE) AND t.substractDay < 225; END ;; DELIMITER ; @@ -50535,8 +50115,8 @@ BEGIN AND (ah.provinceFk = a.provinceFk OR ah.provinceFk IS NULL OR vAddress IS NULL) - AND TIMESTAMPADD(DAY, -ah.substractDay, vDate) >= CURDATE() - AND IF(TIMESTAMPADD(DAY, -ah.substractDay, vDate) = CURDATE(), ah.maxHour > HOUR(NOW()), TRUE) + AND TIMESTAMPADD(DAY, -ah.substractDay, vDate) >= util.VN_CURDATE() + AND IF(TIMESTAMPADD(DAY, -ah.substractDay, vDate) = util.VN_CURDATE(), ah.maxHour > HOUR(util.VN_NOW()), TRUE) ORDER BY ( (ah.weekDay IS NOT NULL) + (ah.agencyFk IS NOT NULL) + @@ -50786,7 +50366,7 @@ BEGIN ON s.id = bp.supplierFk LEFT JOIN vn.bank b ON b.id = bp.bankFk - WHERE bp.insuranceExpired = CURDATE(); + WHERE bp.insuranceExpired = util.VN_CURDATE(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50823,7 +50403,7 @@ BEGIN FROM cache.last_buy WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; - CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); + CALL buyUltimateFromInterval(vWarehouseFk, util.VN_CURDATE(), vDated); REPLACE INTO tmp.buyUltimate SELECT itemFk, buyFk, warehouseFk, landed landing @@ -51010,7 +50590,7 @@ BEGIN FROM cache.last_buy WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; - CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); + CALL buyUltimateFromInterval(vWarehouseFk, util.VN_CURDATE(), vDated); REPLACE INTO tmp.buyUltimate SELECT itemFk, buyFk, warehouseFk @@ -51377,7 +50957,7 @@ BEGIN * @param vGrouping Cantidad de grouping */ - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE()); UPDATE vn.buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk @@ -51411,7 +50991,7 @@ BEGIN * @param vItemFk id del item * @param vPacking packing a actualizar */ - CALL buyUltimate(vWarehouseFk, CURDATE()); + CALL buyUltimate(vWarehouseFk, util.VN_CURDATE()); UPDATE buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk @@ -51449,7 +51029,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.camara; - IF vDateStart = CURDATE() THEN + IF vDateStart = util.VN_CURDATE() THEN CREATE TEMPORARY TABLE tmp.camara SELECT vDated as dated, @@ -52380,7 +51960,7 @@ proc: BEGIN * @return tmp.ticketComponentPrice * @return tmp.zoneGetShipped */ - DECLARE vLanded DATE DEFAULT DATE_ADD(CURDATE(),INTERVAL 2 DAY); + DECLARE vLanded DATE DEFAULT DATE_ADD(util.VN_CURDATE(),INTERVAL 2 DAY); DECLARE vAddressFk INT DEFAULT 24526; DECLARE vAgencyModeFk INT DEFAULT 639; DECLARE vAvailableCalc INT; @@ -52537,12 +52117,12 @@ BEGIN DECLARE v3Month DATE; DECLARE vTrashId varchar(15); - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); - SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); - SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE()); - SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE()); - SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); + SET vDateShort = TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); + SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()); + SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); + SET v18Month = TIMESTAMPADD(MONTH, -18,util.VN_CURDATE()); + SET v26Month = TIMESTAMPADD(MONTH, -26,util.VN_CURDATE()); + SET v3Month = TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()); DELETE FROM ticketParking WHERE created < vDateShort; DELETE FROM routesMonitor WHERE dated < vDateShort; @@ -52551,14 +52131,14 @@ BEGIN DELETE FROM messageInbox WHERE sendDate < vDateShort; DELETE FROM messageInbox WHERE sendDate < vDateShort; DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo; - DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0; - DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); + DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0; + DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_CURDATE()); DELETE FROM entryLog WHERE creationDate < vDateShort; DELETE IGNORE FROM expedition WHERE created < v26Month; DELETE FROM sms WHERE created < v18Month; DELETE FROM saleTracking WHERE created < vOneYearAgo; DELETE tobs FROM ticketObservation tobs - JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,CURDATE()); + JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; DELETE FROM sharingCart where ended < vDateShort; DELETE FROM sharingClient where ended < vDateShort; @@ -52612,7 +52192,7 @@ BEGIN FROM vn.travel t LEFT JOIN vn.entry e ON e.travelFk = t.id JOIN vn.travelThermograph th ON th.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; SELECT dt.id into vTrashId FROM vn.dmsType dt @@ -52629,7 +52209,7 @@ BEGIN DELETE t FROM vn.travel t LEFT JOIN vn.entry e ON e.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; -- borrar entradas sin compras DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; @@ -52638,7 +52218,7 @@ BEGIN FROM vn.entry e LEFT JOIN vn.buy b ON b.entryFk = e.id JOIN vn.entryConfig ec ON e.id != ec.defaultEntry - WHERE e.dated < TIMESTAMPADD(MONTH, -3, CURDATE()) AND b.entryFK IS NULL; + WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL; DELETE e FROM vn.entry e @@ -52649,7 +52229,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.routeToDelete SELECT * FROM vn.route r - WHERE created < TIMESTAMPADD(YEAR,-4,CURDATE()); + WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); UPDATE tmp.routeToDelete tmp JOIN vn.dms d ON d.id = tmp.gestdocFk @@ -52664,7 +52244,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.duaToDelete SELECT * FROM vn.dua - WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); + WHERE operated < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); UPDATE tmp.duaToDelete tm JOIN vn.dms d ON d.id = tm.gestdocFk @@ -52674,7 +52254,7 @@ BEGIN FROM tmp.duaToDelete tmp JOIN vn.dua d ON d.id = tmp.id; - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,CURDATE()); + DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); -- Borra los ficheros gestDoc INSERT INTO vn.printServerQueue(priorityFk, labelReportFk)VALUES(1,11); @@ -52712,7 +52292,7 @@ BEGIN * item_clean, buy_clean * */ - DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, CURDATE()); + DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, util.VN_CURDATE()); DECLARE vDone INT DEFAULT FALSE; DECLARE vBuyFk INT; DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; @@ -52923,15 +52503,15 @@ BEGIN DECLARE vClientDebt DOUBLE; - SELECT vn.clientGetDebt(vClientFk, CURDATE()) INTO vClientDebt; + SELECT vn.clientGetDebt(vClientFk, util.VN_CURDATE()) INTO vClientDebt; INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - VALUES (vClientFk, 'Saldo pendiente', vClientDebt, CURDATE(), 5); + VALUES (vClientFk, 'Saldo pendiente', vClientDebt, util.VN_CURDATE(), 5); CALL vn.clientGreugeSpray(vClientFk, TRUE, '', TRUE); INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - SELECT vClientFk, 'Liquidación cliente', sum(amount), CURDATE(), 5 + SELECT vClientFk, 'Liquidación cliente', sum(amount), util.VN_CURDATE(), 5 FROM vn.greuge WHERE clientFk = vClientFk; @@ -52969,20 +52549,20 @@ BEGIN SELECT id into vIsRemittanced FROM receipt WHERE invoiceFk LIKE 'REMESA%' - AND payed > util.firstDayOfMonth(CURDATE()) + AND payed > util.firstDayOfMonth(util.VN_CURDATE()) limit 1; DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; CREATE TEMPORARY TABLE tmp.clientGetDebt SELECT clientFk FROM bs.defaulter - WHERE created = CURDATE() + WHERE created = util.VN_CURDATE() AND amount; - CALL clientGetDebt(CURDATE()); + CALL clientGetDebt(util.VN_CURDATE()); UPDATE client c - JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() + JOIN bi.defaulters d ON d.client = c.id AND d.date = util.VN_CURDATE() JOIN config ON TRUE LEFT JOIN account.`user` u ON u.id = c.id AND u.active LEFT JOIN worker w ON w.id = u.id @@ -52990,7 +52570,7 @@ BEGIN LEFT JOIN payMethod pm ON pm.id = c.payMethodFk LEFT JOIN tmp.risk rk ON rk.clientFk = c.id SET c.isFreezed = TRUE, - d.frozened = CURDATE(), + d.frozened = util.VN_CURDATE(), u.active = FALSE WHERE (d.amount > config.defaultersMaxAmount AND rk.risk > 0) @@ -53025,10 +52605,10 @@ BEGIN * @param vDate Fecha maxima de los registros * @return tmp.risk */ - DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, CURDATE()); + DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, util.VN_CURDATE()); DECLARE vEnded DATETIME; - SET vEnded = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); + SET vEnded = TIMESTAMP(IFNULL(vDate, util.VN_CURDATE()), '23:59:59'); DROP TEMPORARY TABLE IF EXISTS tClientRisk; CREATE TEMPORARY TABLE tClientRisk @@ -53238,7 +52818,7 @@ BEGIN VALUES( vClientFk, 'Desasignación', -1 * vMana, - CURDATE(), + util.VN_CURDATE(), vGreugeTypeMana); END IF; @@ -53271,7 +52851,7 @@ BEGIN JOIN vn.manaSpellers ms ON ms.worker = c.salesPersonFk JOIN vn.claimRatio cr ON cr.clientFk = c.id WHERE ms.worker = IF(onlyForHisOwner, vOwner, ms.worker) - AND t.shipped >= TIMESTAMPADD(MONTH,-1,CURDATE()) + AND t.shipped >= TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) AND c.id != vClientFk HAVING monthSale > 100; @@ -53279,10 +52859,10 @@ BEGIN FROM tmp.clientList; INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - SELECT clientFk, CONCAT('Cliente: ',vClientFk), vGreuge * monthSale / vTotalSale, CURDATE(), vGreugeTypeFk + SELECT clientFk, CONCAT('Cliente: ',vClientFk), vGreuge * monthSale / vTotalSale, util.VN_CURDATE(), vGreugeTypeFk FROM tmp.clientList UNION ALL - SELECT vClientFk, 'Reparto greuge', -vGreuge, CURDATE(), vGreugeTypeFk; + SELECT vClientFk, 'Reparto greuge', -vGreuge, util.VN_CURDATE(), vGreugeTypeFk; END IF; @@ -53373,7 +52953,7 @@ BEGIN IFNULL(pe.equivalentFk, p.itemFk) itemFk, NULL, NULL, - IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, CURDATE()), tp.quantity, NULL) SenttoClient, + IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, util.VN_CURDATE()), tp.quantity, NULL) SenttoClient, IF(tp.quantity < 0, -tp.quantity, NULL) GotfromClient, NULL AS refFk, NULL, @@ -53422,13 +53002,13 @@ BEGIN CALL vn.ticket_add( vClientFk - ,CURDATE() + ,util.VN_CURDATE() ,vWarehouseFk -- Algemesi ,442 -- Verdnatura ,NULL -- address ,NULL -- agencia ,NULL -- route - ,CURDATE() + ,util.VN_CURDATE() ,account.myUser_getId() ,TRUE ,vNewTicket); @@ -53671,7 +53251,7 @@ BEGIN INSERT INTO tmp.client(clientFk) SELECT DISTINCT clientFk FROM vn.invoiceOut - WHERE issued > TIMESTAMPADD(MONTH, -2, CURDATE()); + WHERE issued > TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); SELECT max(id) INTO maxClientFk FROM tmp.client; @@ -53900,7 +53480,7 @@ BEGIN ELSE - INSERT INTO vn.cmr(created, ead) VALUES(NOW(), NOW() + INTERVAL vLandingDays DAY); + INSERT INTO vn.cmr(created, ead) VALUES(util.VN_NOW(), util.VN_NOW() + INTERVAL vLandingDays DAY); SELECT LAST_INSERT_ID(); @@ -53948,7 +53528,7 @@ BEGIN ELSE - INSERT INTO vn.cmr(created) VALUES(NOW()); + INSERT INTO vn.cmr(created) VALUES(util.VN_NOW()); SELECT LAST_INSERT_ID(); @@ -53977,7 +53557,7 @@ BEGIN */ SET SESSION group_concat_max_len = 1000000; --- IF (DAY(CURDATE()) = 5) THEN +-- IF (DAY(util.VN_CURDATE()) = 5) THEN INSERT INTO vn.mail (receiver, replyTo, @@ -53994,7 +53574,7 @@ BEGIN Estimado cliente,
- A continuación le enviamos el resumen menual de CMR ',UPPER(MONTHNAME(CURDATE() - INTERVAL 1 MONTH)),' ', YEAR(CURDATE() - INTERVAL 1 MONTH), '.

+ A continuación le enviamos el resumen menual de CMR ',UPPER(MONTHNAME(util.VN_CURDATE() - INTERVAL 1 MONTH)),' ', YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH), '.

Le rogamos que nos devuelva el resumen firmado a cmr@verdnatura.es


@@ -54013,8 +53593,8 @@ BEGIN JOIN vn.address a ON c.addressToFk = a.id JOIN vn.client c2 ON a.clientFk = c2.id WHERE c.state = 'Pending' - AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) - AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH) + AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH) + AND YEAR(c.created) = YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH) AND c2.email IS NOT NULL -- No cogemos los CMRs dirigidos a 'Verdnatura' GROUP BY c2.id; @@ -54022,8 +53602,8 @@ BEGIN UPDATE vn.cmr c SET c.state = 'Sent' WHERE c.state = 'Pending' - AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) - AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH); + AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH) + AND YEAR(c.created) = YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH); -- END IF; END ;; DELIMITER ; @@ -54097,7 +53677,7 @@ BEGIN DECLARE vCalcFk INT; DECLARE vWarehouseFk INT; DECLARE vWarehouseAliasFk INT; - DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + DECLARE vCurrentYear INT DEFAULT YEAR(util.VN_NOW()); DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE TEMPORARY TABLE tmp.sale @@ -54171,7 +53751,7 @@ BEGIN ts.itemFk, CAST(0 AS DECIMAL(10,0)) as saleOrder, IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, - IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) /* + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW())) */) as priority, + IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) /* + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,util.VN_NOW())) */ ) as priority, CONCAT( IF( iss.id, CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), @@ -54320,7 +53900,7 @@ BEGIN SELECT barcodeToItem(vItemFk) INTO itemFk; - SELECT CONCAT(vn.getUser()," ",DATE_FORMAT(NOW( ), "%H:%i" )," ",i.name) INTO vConcept FROM vn.item i WHERE i.id = itemFk; + SELECT CONCAT(vn.getUser()," ",DATE_FORMAT(util.VN_NOW( ), "%H:%i" )," ",i.name) INTO vConcept FROM vn.item i WHERE i.id = itemFk; SELECT name INTO vItemName FROM vn.item WHERE id = vItemFk; SELECT CONCAT("Añadido articulo ", vItemName, " cantidad:", vQuantity) INTO vDescription; @@ -54366,7 +53946,7 @@ BEGIN JOIN vn.state ss on ss.code = 'PREPARED' LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id WHERE c.workerFk = vWorkerFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND c.created >= TIMESTAMPADD(HOUR , -6,util.VN_NOW()) AND s.quantity != 0 GROUP BY c.id HAVING totalRow > pickedRow; @@ -54472,7 +54052,7 @@ BEGIN FROM vn.collection c LEFT JOIN vn.state s ON c.stateFk = s.id WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION' - AND created >= TIMESTAMPADD(HOUR , -6,NOW()); + AND created >= TIMESTAMPADD(HOUR , -6,util.VN_NOW()); END ;; @@ -54545,7 +54125,7 @@ BEGIN INSERT INTO vn.ticketLog (originFk, userFk, action , description) VALUES(vOrigin, vn.getUser(), 'update', vDescription); - SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; + SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(util.VN_NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; IF vTicketFk IS NULL THEN SELECT c.name , co.id INTO vClientName,vConsignatario @@ -54555,7 +54135,7 @@ BEGIN LIMIT 1; CALL ticket_add(vClientFk, - NOW(), vWarehouseFk, + util.VN_NOW(), vWarehouseFk, 442, vConsignatario, NULL, @@ -54565,12 +54145,12 @@ BEGIN TRUE, vTicketFk); - SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; + SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(util.VN_NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; END IF; INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded) - SELECT itemFk, vTicketFk, CONCAT(concept," ",vn.getWorkerCode(), " ",LEFT(CAST(NOW() AS TIME),5)), vQuantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded + SELECT itemFk, vTicketFk, CONCAT(concept," ",vn.getWorkerCode(), " ",LEFT(CAST(util.VN_NOW() AS TIME),5)), vQuantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded FROM vn.sale s WHERE s.id = vSaleFk; SELECT quantity INTO vOriginalQuantity FROM vn.sale WHERE id = vSaleFk; @@ -54629,7 +54209,7 @@ proc:BEGIN FROM vn.collection c WHERE c.workerFk = vn.getUser() AND c.saleTotalCount > c.salePickedCount + 1 - AND c.created > TIMESTAMPADD(HOUR , -5,NOW()); + AND c.created > TIMESTAMPADD(HOUR , -5,util.VN_NOW()); IF vMaxNotReadyCollections < vNotReadyCollections THEN @@ -54745,7 +54325,7 @@ proc:BEGIN JOIN vn.state s ON s.id = pb.state JOIN vn.agencyMode am ON am.id = pb.agencyModeFk JOIN vn.agency a ON a.id = am.agencyFk - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPreparable AND (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) @@ -54766,7 +54346,7 @@ proc:BEGIN JOIN vn.state s ON s.id = pb.state JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' JOIN vn.ticket t ON t.id = pb.ticketFk - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND LENGTH(pb.problem) = 0 AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPrintable @@ -54775,7 +54355,7 @@ proc:BEGIN OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)) - AND t.created < TIMESTAMPADD(MINUTE, -10, NOW()) + AND t.created < TIMESTAMPADD(MINUTE, -10, util.VN_NOW()) ORDER BY HH, mm, s.`order` DESC, @@ -55182,7 +54762,7 @@ proc:BEGIN JOIN vn.state ss ON ss.code = 'PREPARED' LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id WHERE c.workerFk = vUserFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND c.created >= TIMESTAMPADD(HOUR , -6,util.VN_NOW()) AND s.quantity != 0 GROUP BY c.id HAVING totalRow > pickedRow) sub; @@ -55301,7 +54881,7 @@ proc:BEGIN JOIN vn.agencyMode am ON am.id = pb.agencyModeFk JOIN vn.agency a ON a.id = am.agencyFk JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPreparable @@ -55327,7 +54907,7 @@ proc:BEGIN JOIN vn.ticket t ON t.id = pb.ticketFk JOIN vn.ticketConfig tc JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND (LENGTH(pb.problem) = 0 OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) AND (pb.ubicacion IS NOT NULL @@ -55339,7 +54919,7 @@ proc:BEGIN OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) ) - AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) + AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , util.VN_NOW()) AND (pc.isPreviousPreparationRequired = FALSE OR pb.previousWithoutParking = FALSE) ORDER BY HH, @@ -55746,7 +55326,7 @@ proc:BEGIN DECLARE vTrainFk INT DEFAULT 1; DECLARE vNow DATETIME; - SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons, pc.maxNotReadyCollections , NOW() + SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons, pc.maxNotReadyCollections , util.VN_NOW() INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections, vNow FROM vn.productionConfig pc; @@ -55779,7 +55359,7 @@ proc:BEGIN JOIN vn.state ss ON ss.code = 'PREPARED' LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id WHERE c.workerFk = vUserFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND c.created >= TIMESTAMPADD(HOUR , -6,util.VN_NOW()) AND s.quantity != 0 GROUP BY c.id HAVING totalRow > pickedRow) sub; @@ -55900,7 +55480,7 @@ call util.debugAdd('wargo',CONCAT('vNotReadyCollections ',vNotReadyCollections)) JOIN vn.agencyMode am ON am.id = pb.agencyModeFk JOIN vn.agency a ON a.id = am.agencyFk JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPreparable @@ -55929,7 +55509,7 @@ call util.debugAdd('wargo',CONCAT('vPrintedTickets ',vPrintedTickets)); JOIN vn.ticket t ON t.id = pb.ticketFk JOIN vn.ticketConfig tc JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() + WHERE pb.shipped = util.VN_CURDATE() AND (LENGTH(pb.problem) = 0 OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) AND (pb.ubicacion IS NOT NULL @@ -55941,7 +55521,7 @@ call util.debugAdd('wargo',CONCAT('vPrintedTickets ',vPrintedTickets)); OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) ) - AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) + AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , util.VN_NOW()) AND (pc.isPreviousPreparationRequired = FALSE OR pb.previousWithoutParking = FALSE) ORDER BY HH, @@ -56662,7 +56242,7 @@ FROM JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN bi.rotacion r ON r.Id_Article = e.item_id AND r.warehouse_id = e.warehouse_id - WHERE e.dat BETWEEN CURDATE() AND vLastDate + WHERE e.dat BETWEEN util.VN_CURDATE() AND vLastDate AND e.warehouse_id = vWarehouse AND ic.display AND e.isVirtualStock is FALSE @@ -56682,7 +56262,7 @@ FROM JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN bi.rotacion r ON r.Id_Article = s.item_id AND r.warehouse_id = s.warehouse_id - WHERE s.dat BETWEEN CURDATE() AND vLastDate + WHERE s.dat BETWEEN util.VN_CURDATE() AND vLastDate AND s.warehouse_id = vWarehouse AND ic.display GROUP BY date(s.dat), s.item_id @@ -56923,7 +56503,7 @@ BEGIN FROM vn.workerTimeControl wtc JOIN vn.worker w ON w.userFk = wtc.userFk JOIN vn.workerLabour wl ON wl.workerFK = w.id - AND wtc.timed BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) + AND wtc.timed BETWEEN wl.started AND IFNULL(wl.ended, util.VN_CURDATE()) WHERE wtc.timed BETWEEN vDateStart AND vDateEnd ) users LEFT JOIN(SELECT `order`, @@ -57715,7 +57295,7 @@ BEGIN DECLARE vDiff DECIMAL(10,2); DECLARE vApunte BIGINT; - SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated + SELECT ASIEN, IFNULL(bookEntried, util.VN_CURDATE()) INTO vBookNumber, vBookDated FROM dua WHERE id = vDuaFk; @@ -57862,7 +57442,7 @@ BEGIN DECLARE vDiff DECIMAL(10,2); DECLARE vApunte BIGINT; - SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated + SELECT ASIEN, IFNULL(bookEntried, util.VN_CURDATE()) INTO vBookNumber, vBookDated FROM dua WHERE id = vDuaFk; @@ -58019,7 +57599,7 @@ BEGIN DECLARE vDated DATE; DECLARE vTotalDUABase DECIMAL(10,2); - SELECT IFNULL(operated, CURDATE()) INTO vDated + SELECT IFNULL(operated, util.VN_CURDATE()) INTO vDated FROM dua WHERE id = vDuaFk; @@ -58194,13 +57774,13 @@ DECLARE done INT DEFAULT FALSE; DECLARE vEntryFk INT; DECLARE vTravelFk INT; DECLARE vId INT; -DECLARE vLanded DATE DEFAULT CURDATE(); +DECLARE vLanded DATE DEFAULT util.VN_CURDATE(); DECLARE cur1 CURSOR FOR SELECT id FROM vn.ektEntryAssign; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - IF HOUR(NOW()) > 12 THEN + IF HOUR(util.VN_NOW()) > 12 THEN SET vLanded = TIMESTAMPADD(DAY,1,vLanded); @@ -58344,7 +57924,7 @@ BEGIN kop) SELECT year(curdate()) entryYear, p.id deliveryNumber , - CURDATE() fec, + util.VN_CURDATE() fec, CURTIME() hor, i.longName item, sr.NumberOfItemsPerCask pac, @@ -58399,7 +57979,7 @@ BEGIN INSERT INTO vn.energyMeter SET `input` = vInput, - `period` = DATE_FORMAT(NOW(), '%Y-%m-%d %H:00:00'), + `period` = DATE_FORMAT(util.VN_NOW(), '%Y-%m-%d %H:00:00'), `activeTime` = vActiveTime, `consumption` = CAST(IFNULL((vConsumption / 3600) * vActiveTime, 0) AS DECIMAL(10,2)) ON DUPLICATE KEY UPDATE @@ -58781,14 +58361,14 @@ BEGIN FROM vn.buy b JOIN vn.entrySplit es ON es.delayedFk = b.entryFk JOIN vn.itemPlacement ip ON ip.itemFk = b.itemFk - WHERE ip.modificationDate > CURDATE(); + WHERE ip.modificationDate > util.VN_CURDATE(); INSERT INTO itemList SELECT DISTINCT ish.itemFk, es.delayedFk, es.receivedFk FROM vn.buy b JOIN vn.entrySplit es ON es.delayedFk = b.entryFk JOIN vn.itemShelving ish ON ish.itemFk = b.itemFk - WHERE ish.created > CURDATE(); + WHERE ish.created > util.VN_CURDATE(); UPDATE vn.buy b @@ -59818,7 +59398,7 @@ BEGIN DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; - SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; + SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo); CALL vn.errorProduction_add('ENCAJAR', vDatedFrom, vDatedTo); @@ -59844,8 +59424,8 @@ BEGIN DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; - IF (DAY(CURDATE()) = 5) THEN - SELECT util.firstDayOfMonth(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)), CONCAT(LAST_DAY(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)),' 23:59:59') INTO vDatedFrom, vDatedTo; + IF (DAY(util.VN_CURDATE()) = 5) THEN + SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 MONTH)), CONCAT(LAST_DAY(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 MONTH)),' 23:59:59') INTO vDatedFrom, vDatedTo; CALL vn.errorProduction_add('SACAR' ,'Sacadores','PREPARED', vDatedFrom, vDatedTo); CALL vn.errorProduction_add('ENCAJAR' ,'Encajadores','PACKED', vDatedFrom, vDatedTo); @@ -60451,7 +60031,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_Add`(vHour VARCHAR( BEGIN INSERT INTO vn.expeditionTruck(ETD,description) - VALUES(CONCAT(CURDATE(), ' ', vHour), vDescription); + VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription); END ;; DELIMITER ; @@ -60476,7 +60056,7 @@ BEGIN ETD, description Destino FROM vn.expeditionTruck - WHERE ETD BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE ETD BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) ORDER BY ETD; END ;; DELIMITER ; @@ -60766,7 +60346,7 @@ BEGIN JOIN vn.client c ON c.id = t.clientFk WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci AND s.isPicked = FALSE - AND date(t.shipped) = CURDATE() + AND date(t.shipped) = util.VN_CURDATE() AND t.warehouseFk = vWarehouseFk ) sub ON sub.itemFk = ishr.itemFk ; @@ -60796,7 +60376,7 @@ BEGIN JOIN vn.client c ON c.id = t.clientFk SET s.isPicked = TRUE WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci - AND date(t.shipped) = CURDATE() + AND date(t.shipped) = util.VN_CURDATE() AND t.warehouseFk = vWarehouseFk AND s.itemFk = vItemFk; @@ -61107,7 +60687,7 @@ BEGIN t.routeFk as routeFk FROM vn2008.expeditions e INNER JOIN vn.ticket t ON t.id = e.ticket_id - WHERE DATE(odbc_date) = CURDATE(); + WHERE DATE(odbc_date) = util.VN_CURDATE(); END ;; DELIMITER ; @@ -61574,7 +61154,7 @@ proc: BEGIN vEntryFk FROM tmp.inventory; - SELECT vWh, count(*), NOW() FROM tmp.inventory; + SELECT vWh, count(*), util.VN_NOW() FROM tmp.inventory; -- DROP TEMPORARY TABLE tmp.inventory; @@ -61593,8 +61173,8 @@ proc: BEGIN FROM vn.travel t JOIN vn.entry e ON e.travelFk = t.id WHERE e.supplierFk = 4 - AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, CURDATE())) - AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); + AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, util.VN_CURDATE())) + AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, util.VN_CURDATE())); DELETE e FROM vn.entry e @@ -61625,7 +61205,7 @@ BEGIN * Recalcula los inventarios de todos los almacenes. */ - call vn.inventoryMake(TIMESTAMPADD(DAY, -10, CURDATE()), 0); + call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0); END ;; DELIMITER ; @@ -61860,7 +61440,7 @@ proc: BEGIN vEntryFk FROM tmp.inventory; - SELECT vWh, count(*), NOW() FROM tmp.inventory; + SELECT vWh, count(*), util.VN_NOW() FROM tmp.inventory; -- DROP TEMPORARY TABLE tmp.inventory; @@ -61876,7 +61456,7 @@ proc: BEGIN JOIN vn.entry e ON e.travelFk = t.id WHERE e.supplierFk = 4 AND t.shipped <= vDeleteDate - AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); + AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, util.VN_CURDATE())); END ;; DELIMITER ; @@ -61932,7 +61512,7 @@ BEGIN LEFT JOIN origin o ON o.id = i.originFk ) ON it.id = i.typeFk LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,CURDATE())) AND s.name = 'INVENTARIO'; + WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO'; DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; CREATE TEMPORARY TABLE tmp.lastEntryOk @@ -61969,7 +61549,7 @@ BEGIN LEFT JOIN origin o ON o.id = i.originFk ) ON it.id = i.typeFk LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,CURDATE())) + WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,util.VN_CURDATE())) ORDER BY tr.landed DESC; DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup; @@ -62105,7 +61685,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT) BEGIN - DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); + DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()); SET vMaxTicketDate = vn2008.DAYEND(vMaxTicketDate); @@ -62136,7 +61716,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`(IN vMaxTicketDate datetime, IN vClientFk INT, IN vCompanyFk INT) BEGIN - DECLARE vMinTicketDate DATE DEFAULT TIMESTAMPADD(YEAR, -3, CURDATE()); + DECLARE vMinTicketDate DATE DEFAULT TIMESTAMPADD(YEAR, -3, util.VN_CURDATE()); SET vMaxTicketDate = util.dayend(vMaxTicketDate); DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; @@ -62630,7 +62210,7 @@ BEGIN n.bookEntried FECHA, tc.code SUBCTA, s.supplierAccount CONTRA, - SUM(ROUND(tc.rate * it.taxableBase / 100 /* + 0.0001*/, 2)) EURODEBE, + SUM(ROUND(tc.rate * it.taxableBase / 100 /* + 0.0001*/ , 2)) EURODEBE, SUM(it.taxableBase) BASEEURO, GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, vSerialNumber FACTURA, @@ -62912,7 +62492,7 @@ BEGIN n.bookEntried FECHA, tc.code SUBCTA, s.supplierAccount CONTRA, - SUM(ROUND(tc.rate * it.taxableBase / 100 /* + 0.0001*/, 2)) EURODEBE, + SUM(ROUND(tc.rate * it.taxableBase / 100 /* + 0.0001*/ , 2)) EURODEBE, SUM(it.taxableBase) BASEEURO, GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, vSerialNumber FACTURA, @@ -63589,7 +63169,7 @@ BEGIN WHERE iot.invoiceOutFk = vInvoice; UPDATE invoiceOut - SET booked = CURDATE() + SET booked = util.VN_CURDATE() WHERE id = vInvoice; END ;; DELIMITER ; @@ -64029,7 +63609,7 @@ BEGIN DECLARE vNewInvoiceInId INT; DECLARE vIsInterCompany BOOL; - SET vInvoiceDate = IFNULL(vInvoiceDate,CURDATE()); + SET vInvoiceDate = IFNULL(vInvoiceDate,util.VN_CURDATE()); SELECT t.clientFk, t.companyFk INTO vClient, vCompany @@ -64258,7 +63838,7 @@ BEGIN END IF; CALL invoiceFromClient(vMaxShipped, vClientFk, vCompanyFk); - CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); + CALL invoiceOut_new(vSerial, util.VN_CURDATE(), vTaxArea, vInvoiceId); UPDATE invoiceOut SET `ref` = vRef @@ -64297,7 +63877,7 @@ BEGIN */ DECLARE vIsRefEditable BOOLEAN; CALL invoiceFromTicket(vTicketFk); - CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); + CALL invoiceOut_new(vSerial, util.VN_CURDATE(), vTaxArea, vInvoiceId); IF vRef IS NOT NULL THEN SELECT isRefEditable INTO vIsRefEditable @@ -64358,7 +63938,7 @@ BEGIN DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S'; - SET vInvoiceDate = IFNULL(vInvoiceDate,CURDATE()); + SET vInvoiceDate = IFNULL(vInvoiceDate,util.VN_CURDATE()); SELECT t.clientFk, t.companyFk INTO vClient, vCompany @@ -64647,13 +64227,13 @@ BEGIN END IF; CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, util.VN_CURDATE()); SELECT SUM(visible) INTO vVisibleAltillo FROM vn.itemShelvingStock WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE()); SELECT i.id, i.longName, @@ -64738,7 +64318,7 @@ BEGIN END IF; CALL cache.visible_refresh(vCacheVisibleFk, TRUE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, TRUE,vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCacheAvailableFk, TRUE,vWarehouseFk, util.VN_CURDATE()); SELECT SUM(visible) INTO vVisibleAltillo FROM vn.itemShelvingStock @@ -64808,7 +64388,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemDiary__`(IN vItemId INT, IN vWarehouse INT) BEGIN DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vCurdate DATE DEFAULT util.VN_CURDATE(); DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); SELECT vn.barcodeToItem(vItemId) INTO vItemId; @@ -65028,14 +64608,14 @@ BEGIN LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta FROM vn2008.item_out - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) AND warehouse_id = vWarehouseFk GROUP BY item_id ) sale ON sale.item_id = i.id LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra FROM vn2008.item_entry_in - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) AND warehouse_id = vWarehouseFk AND isVirtualStock = FALSE GROUP BY item_id @@ -65043,7 +64623,7 @@ BEGIN LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado FROM vn2008.item_entry_out - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) AND warehouse_id = vWarehouseFk GROUP BY item_id ) mov ON mov.item_id = i.id @@ -65124,7 +64704,7 @@ BEGIN LEFT JOIN origin o ON o.id = i.originFk ) ON it.id = i.typeFk LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY) + WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(util.VN_CURDATE(), INTERVAl + 10 DAY) ORDER BY tr.landed DESC , b.id DESC; END ;; DELIMITER ; @@ -65189,7 +64769,7 @@ BEGIN */ DECLARE vCalc INT; - DECLARE vTodayIni DATE DEFAULT CURDATE(); + DECLARE vTodayIni DATE DEFAULT util.VN_CURDATE(); DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); DECLARE vproductionOrderPrinted INT DEFAULT 4; DECLARE vWarehouseSillaFv INT DEFAULT 1; @@ -65257,11 +64837,11 @@ BEGIN IF ASCII(vPlacement) > 57 THEN INSERT INTO itemPlacement(itemFk, warehouseFk, reserve, pickable) VALUES(vItemFk, vWarehouseFk, vPlacement, 0) - ON DUPLICATE KEY UPDATE reserve = vPlacement, modificationDate = NOW(); + ON DUPLICATE KEY UPDATE reserve = vPlacement, modificationDate = util.VN_NOW(); ELSE INSERT INTO itemPlacement(itemFk, warehouseFk, code) VALUES(vItemFk, vWarehouseFk, vPlacement) - ON DUPLICATE KEY UPDATE code = vPlacement, modificationDate = NOW(); + ON DUPLICATE KEY UPDATE code = vPlacement, modificationDate = util.VN_NOW(); END IF; END ;; DELIMITER ; @@ -65455,7 +65035,7 @@ BEGIN * que aun no han sido preparados. */ DECLARE vCalc INT; - DECLARE vTodayIni DATE DEFAULT CURDATE(); + DECLARE vTodayIni DATE DEFAULT util.VN_CURDATE(); DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); DECLARE vproductionOrderPrinted INT DEFAULT 4; DECLARE vWarehouseSillaFv INT DEFAULT 1; @@ -66416,7 +65996,7 @@ BEGIN AND IFNULL(sub3.transit,0) < s.quantity AND s.isPicked = FALSE AND s.reserved = FALSE - AND t.shipped BETWEEN CURDATE() AND MIDNIGHT(CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE()) AND tst.isPreviousPreparable = TRUE AND t.warehouseFk = vWarehouseFk AND iss.sectorFk = vSectorFk @@ -66483,7 +66063,7 @@ proc:BEGIN WHERE id = vSectorFk; CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; @@ -66613,15 +66193,15 @@ proc:BEGIN LEFT JOIN vn.zone z ON z.id = t.zoneFk LEFT JOIN (SELECT DISTINCT saleFk FROM vn.saleTracking st - WHERE st.created > CURDATE() + WHERE st.created > util.VN_CURDATE() AND st.isChecked ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk AND s.isPicked = 0 AND NOT io.Reservado AND stPrevious.saleFk IS NULL - AND io.dat >= CURDATE() - AND io.dat < CURDATE()+1 + AND io.dat >= util.VN_CURDATE() + AND io.dat < util.VN_CURDATE()+1 ) sub GROUP BY itemFk, hours, minutes; @@ -66666,10 +66246,10 @@ BEGIN DECLARE vWarehouseFk INT DEFAULT 1; DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; - DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); + DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item @@ -66699,7 +66279,7 @@ BEGIN JOIN tmp.item2 ti ON ti.itemFk = s.itemFk JOIN vn.ticket t ON t.id = s.ticketFk LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id - WHERE t.shipped BETWEEN CURDATE() AND vTodayDayEnd + WHERE t.shipped BETWEEN util.VN_CURDATE() AND vTodayDayEnd AND t.warehouseFk = vWarehouseFk AND IFNULL(tst.productionOrder,0) < 5 GROUP BY s.itemFK @@ -66731,10 +66311,10 @@ BEGIN DECLARE vWarehouseFk INT DEFAULT 1; DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; - DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); + DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item @@ -66819,7 +66399,7 @@ BEGIN LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk @@ -66846,7 +66426,7 @@ BEGIN LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk @@ -67068,7 +66648,7 @@ BEGIN JOIN ticket t ON t.id = c.ticketFk WHERE c.id = vClaimFk; - CALL buyUltimate (vWarehouseFk, CURDATE()); + CALL buyUltimate (vWarehouseFk, util.VN_CURDATE()); INSERT INTO itemShelving (itemFk, shelvingFk, packing, `grouping`, visible) SELECT s.itemFk, vShelvingFk, b.packing, b.`grouping`, cb.quantity AS visible @@ -67205,7 +66785,7 @@ proc:BEGIN JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk @@ -67230,7 +66810,7 @@ proc:BEGIN JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk @@ -67377,11 +66957,11 @@ BEGIN FROM ( SELECT * FROM ( SELECT t2.* FROM ( - SELECT item_id itemFk, amount, CURDATE() dated + SELECT item_id itemFk, amount, util.VN_CURDATE() dated FROM cache.stock WHERE warehouse_id = vWarehouseFk UNION ALL - SELECT ish.itemFk, - sum(visible), CURDATE() + SELECT ish.itemFk, - sum(visible), util.VN_CURDATE() FROM vn.itemShelving ish JOIN shelving sh ON sh.code = ish.shelvingFk JOIN parking p ON sh.parkingFk = p.id @@ -67391,21 +66971,21 @@ BEGIN UNION ALL SELECT item_id, sum(iei.amount), dat FROM vn2008.item_entry_in iei - WHERE dat >= CURDATE() + WHERE dat >= util.VN_CURDATE() AND warehouse_id = vWarehouseFk AND isVirtualStock = FALSE GROUP BY item_id, dat UNION ALL SELECT item_id, sum(ieo.amount), dat FROM vn2008.item_entry_out ieo - WHERE dat >= CURDATE() + WHERE dat >= util.VN_CURDATE() AND warehouse_id = vWarehouseFk GROUP BY item_id, dat UNION ALL SELECT i.itemFk, sum(io.amount), dat FROM vn2008.item_out io JOIN tmp.item i ON i.itemFk = io.item_id - WHERE io.dat >= CURDATE() + WHERE io.dat >= util.VN_CURDATE() AND io.warehouse_id = vWarehouseFk GROUP BY io.item_id, io.dat ) t2 @@ -67574,21 +67154,21 @@ BEGIN SELECT itemFk, SUM(quantity) stock, SUM(quantity) visible, SUM(quantity) available FROM ( SELECT itemFk, quantity FROM itemTicketOut - WHERE shipped >= CURDATE() AND shipped < vDated + WHERE shipped >= util.VN_CURDATE() AND shipped < vDated AND warehouseFk = vWarehouseFk AND (vItemFk IS NULL OR itemFk = vItemFk) UNION ALL SELECT itemFk, quantity FROM itemEntryIn i LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk - WHERE i.landed >= CURDATE() AND i.landed < vDated + WHERE i.landed >= util.VN_CURDATE() AND i.landed < vDated AND i.warehouseInFk = vWarehouseFk AND (vItemFk IS NULL OR i.itemFk = vItemFk) AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) UNION ALL SELECT itemFk, quantity FROM itemEntryOut - WHERE shipped >= CURDATE() AND shipped < vDated + WHERE shipped >= util.VN_CURDATE() AND shipped < vDated AND warehouseOutFk = vWarehouseFk AND (vItemFk IS NULL OR itemFk = vItemFk) ) t @@ -67657,7 +67237,7 @@ BEGIN JOIN address a ON a.id=t.addressFk WHERE t.warehouseFk = vWarehouseFk AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() + AND DATE(t.shipped) = util.VN_CURDATE() AND a.isDefaultAddress LIMIT 1; @@ -67665,13 +67245,13 @@ BEGIN CALL ticket_add( vClientFk, - CURDATE(), + util.VN_CURDATE(), vWarehouseFk, vCompanyVnlFk, NULL, NULL, NULL, - CURDATE(), + util.VN_CURDATE(), account.userGetId(), FALSE, vTicketFk); @@ -67679,7 +67259,7 @@ BEGIN END IF; INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 + SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(util.VN_NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 FROM item WHERE id = vItemFk; @@ -68056,7 +67636,7 @@ BEGIN SELECT s.itemFk, SUM(s.quantity) AS total, v.tipo_id typeFk FROM vn.sale s INNER JOIN bs.ventas v ON v.Id_Movimiento = s.id - WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, CURDATE()) AND CURDATE() + WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, util.VN_CURDATE()) AND util.VN_CURDATE() GROUP BY s.itemFk; DROP TABLE IF EXISTS tmp.topSeller; @@ -68134,7 +67714,7 @@ BEGIN JOIN address a ON a.id=t.addressFk WHERE t.warehouseFk = vWarehouseFk AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() + AND DATE(t.shipped) = util.VN_CURDATE() AND a.isDefaultAddress LIMIT 1; @@ -68144,13 +67724,13 @@ BEGIN CALL ticket_add( vClientFk, - CURDATE(), + util.VN_CURDATE(), vWarehouseFk, vCompanyVnlFk, NULL, NULL, NULL, - CURDATE(), + util.VN_CURDATE(), account.userGetId(), FALSE, vTicketFk); @@ -68159,7 +67739,7 @@ BEGIN INSERT INTO sale(ticketFk, itemFk, concept, quantity) SELECT vTicketFk, vItemFk, - CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(NOW() AS TIME),5)), + CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), vQuantity FROM item WHERE id = vItemFk; @@ -68420,7 +68000,7 @@ BEGIN WHERE i.id > 170000 AND (ISNULL(i.supplyResponseFk) OR sub.NumberOfUnits=0 - OR sub.lodt < NOW()) + OR sub.lodt < util.VN_NOW()) GROUP BY i.name, subname, value5, @@ -68494,7 +68074,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`(IN vItemId int, IN vWarehouse int) BEGIN DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vCurdate DATE DEFAULT util.VN_CURDATE(); DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); SELECT inventoried INTO vDateInventory FROM config; @@ -68512,8 +68092,8 @@ BEGIN `in` AS invalue, `out`, @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - @currentLineFk := IF (@shipped < CURDATE() - OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)), + @currentLineFk := IF (@shipped < util.VN_CURDATE() + OR (@shipped = util.VN_CURDATE() AND (isPicked OR alertLevel >= 2)), lineFk,@currentLineFk) lastPreparedLineFk, isTicket, lineFk, @@ -68542,8 +68122,8 @@ BEGIN JOIN supplier s ON s.id = e.supplierFk JOIN alertLevel al ON al.id = CASE - WHEN tr.landed < CURDATE() THEN 3 - WHEN tr.landed = CURDATE() AND tr.isReceived = TRUE THEN 3 + WHEN tr.landed < util.VN_CURDATE() THEN 3 + WHEN tr.landed = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 ELSE 0 END JOIN state st ON st.code = al.code @@ -68576,8 +68156,8 @@ BEGIN JOIN supplier s ON s.id = e.supplierFk JOIN alertLevel al ON al.id = CASE - WHEN tr.shipped < CURDATE() THEN 3 - WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + WHEN tr.shipped < util.VN_CURDATE() THEN 3 + WHEN tr.shipped = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 ELSE 0 END JOIN state st ON st.code = al.code @@ -68613,8 +68193,8 @@ BEGIN JOIN clientType ct ON ct.id = c.clientTypeFk JOIN alertLevel al ON al.id = CASE - WHEN t.shipped < curdate() THEN 3 - WHEN t.shipped > util.dayEnd(curdate()) THEN 0 + WHEN t.shipped < util.VN_CURDATE() THEN 3 + WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 0 ELSE IFNULL(ts.alertLevel, 0) END LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' @@ -68660,13 +68240,13 @@ BEGIN SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, util.VN_CURDATE()); SELECT SUM(visible) INTO vVisibleItemShelving FROM vn.itemShelvingStock WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE()); SELECT i.id, i.longName, @@ -68734,7 +68314,7 @@ BEGIN **/ CALL `cache`.stock_refresh(vForce); - CALL item_getMinacum(NULL, CURDATE(), vDays, NULL); + CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL); CALL item_getMinETD(); SELECT i.id itemFk, @@ -68896,7 +68476,7 @@ BEGIN FROM ticket t JOIN sale s ON s.ticketFk = t.id LEFT JOIN `zone` z ON z.id = t.zoneFk - WHERE t.shipped BETWEEN CURDATE() AND vMidnight + WHERE t.shipped BETWEEN util.VN_CURDATE() AND vMidnight GROUP BY s.itemFk; END ;; DELIMITER ; @@ -69013,7 +68593,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLINT, vItem INT) BEGIN - DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, CURDATE()); + DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, util.VN_CURDATE()); INSERT INTO vn2008.tmp_item (item_id, visible) SELECT item_id, SUM(amount) amount @@ -69025,19 +68605,19 @@ BEGIN LEFT JOIN (SELECT DISTINCT saleFk FROM saleTracking st JOIN state s ON s.id = st.stateFk - WHERE st.created > CURDATE() + WHERE st.created > util.VN_CURDATE() AND (s.isPicked OR st.isChecked) ) stPrevious ON `stPrevious`.`saleFk` = i.saleFk WHERE i.warehouseFk = vWarehouse AND (vItem IS NULL OR i.itemFk = vItem) AND (s.isPicked OR i.reserved OR stPrevious.saleFk ) - AND i.shipped >= CURDATE() AND i.shipped < vTomorrow + AND i.shipped >= util.VN_CURDATE() AND i.shipped < vTomorrow UNION ALL SELECT iei.itemFk, quantity FROM itemEntryIn iei LEFT JOIN itemPlacement ip ON ip.itemFk = iei.itemFk AND ip.warehouseFk = vWarehouse - WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > CURDATE()*/) - AND iei.landed >= CURDATE() AND iei.landed < vTomorrow + WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > util.VN_CURDATE()*/ ) + AND iei.landed >= util.VN_CURDATE() AND iei.landed < vTomorrow AND iei.warehouseInFk = vWarehouse AND (vItem IS NULL OR iei.itemFk = vItem) AND iei.isVirtualStock is FALSE @@ -69045,7 +68625,7 @@ BEGIN SELECT itemFk, quantity FROM itemEntryOut WHERE isDelivered != FALSE - AND shipped >= CURDATE() AND shipped < vTomorrow + AND shipped >= util.VN_CURDATE() AND shipped < vTomorrow AND warehouseOutFk = vWarehouse AND (vItem IS NULL OR itemFk = vItem) ) t @@ -69855,7 +69435,7 @@ BEGIN JOIN itemType t ON t.id = i.typeFk JOIN warehouse w ON w.id = tr.warehouseInFk WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd - AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, trUE) AND NOT e.isRaid AND w.valuatedInventory AND t.isInventory @@ -69888,7 +69468,7 @@ BEGIN AND it.isInventory ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); - IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + IF vDated = util.VN_CURDATE() THEN -- volver a poner lo que esta aun en las estanterias INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` @@ -70059,7 +69639,7 @@ BEGIN JOIN itemType t ON t.id = i.typeFk JOIN warehouse w ON w.id = tr.warehouseInFk WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd - AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, trUE) AND NOT e.isRaid AND w.valuatedInventory AND t.isInventory @@ -70092,7 +69672,7 @@ BEGIN AND it.isInventory ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); - IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + IF vDated = util.VN_CURDATE() THEN -- volver a poner lo que esta aun en las estanterias INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` @@ -70471,7 +70051,7 @@ BEGIN */ UPDATE vn.machineWorker mw JOIN vn.machine m ON m.id = mw.machineFk - SET mw.outTimed = NOW() + SET mw.outTimed = util.VN_NOW() WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate) AND ISNULL(mw.outTimed); @@ -70553,12 +70133,12 @@ BEGIN IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) AND ISNULL(m.outTimed)) THEN + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN UPDATE machineWorker m SET m.outTimed = CURRENT_TIMESTAMP() WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed) AND m.machineFk = vMachineFk; @@ -70593,7 +70173,7 @@ BEGIN SELECT m.plate FROM machine m JOIN machineWorker mw ON mw.machineFk = m.id - WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) + WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW()) AND ISNULL(mw.outTimed) AND mw.workerFk = vWorkerFk; @@ -70632,7 +70212,7 @@ BEGIN SELECT COUNT(*) INTO vIsRepeated FROM vn.mail - WHERE creationDate >= CURDATE() + WHERE creationDate >= util.VN_CURDATE() AND `receiver` = vReceiver AND `replyTo` = vReplyTo AND `subject` = vSubject @@ -70754,7 +70334,7 @@ BEGIN */ DECLARE vWorkerIsExcluded BOOLEAN; DECLARE vFromDated DATE; - DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE()); + DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,util.VN_CURDATE()); DECLARE vMana INT; DECLARE vAutoMana INT; DECLARE vClaimMana INT; @@ -70806,7 +70386,7 @@ BEGIN FROM greuge g JOIN client c ON c.id = g.clientFk WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType - AND g.shipped > vFromDated and g.shipped < CURDATE() + AND g.shipped > vFromDated and g.shipped < util.VN_CURDATE() UNION ALL SELECT cc.mana FROM clientManaCache cc @@ -72042,7 +71622,7 @@ BEGIN DECLARE vCalcFk INT; DECLARE vWarehouseFk INT; DECLARE vWarehouseAliasFk INT; - DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + DECLARE vCurrentYear INT DEFAULT YEAR(util.VN_NOW()); DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE TEMPORARY TABLE tmp.sale @@ -72148,7 +71728,7 @@ BEGIN ish.visible, IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, - IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, + IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,util.VN_NOW()))) as priority, 0 as saleOrder, sc.isPreviousPrepared, iss.id as itemShelvingSaleFk, @@ -72269,11 +71849,11 @@ BEGIN JOIN vn.client c ON c.id = t.clientFk WHERE c.typeFk IN ('normal','handMaking','internalUse') AND ( - t.shipped BETWEEN CURDATE() AND vEndingDate + t.shipped BETWEEN util.VN_CURDATE() AND vEndingDate OR ( ts.alertLevel < 3 AND t.shipped >= vStartingDate - AND t.shipped < CURDATE() + AND t.shipped < util.VN_CURDATE() ) ); END ;; @@ -72451,7 +72031,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prod`(vWarehouseFk INT, vScopeDays INT) proc: BEGIN - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(util.VN_CURDATE())); DECLARE vIsTodayRelative BOOLEAN; @@ -72459,7 +72039,7 @@ proc: BEGIN FROM vn.worker WHERE userFk = vn.getUser(); - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_CURDATE()), vEndingDate); DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket @@ -72661,7 +72241,7 @@ proc: BEGIN LEFT JOIN vn.ticketState tls on tls.ticket = t.id LEFT JOIN vn.state s ON s.id = tls.state LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_CURDATE())) AND wp.warehouse_id = vWarehouseFk; */ DROP TEMPORARY TABLE tmp.productionTicket; @@ -72696,7 +72276,7 @@ proc: BEGIN * @return Table tmp.productionBuffer */ - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(util.VN_CURDATE())); DECLARE vIsTodayRelative BOOLEAN; @@ -72704,7 +72284,7 @@ proc: BEGIN FROM vn.worker WHERE userFk = vn.getUser(); - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_CURDATE()), vEndingDate); DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket @@ -72801,7 +72381,7 @@ proc: BEGIN IF(tp.hasTicketRequest, ' COD 100',''), IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), IF(tp.hasComponentLack,' COMPONENTES', ''), - IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') + IF(HOUR(util.VN_NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') ) as char(255))); -- Clientes Nuevos o Recuperados @@ -72933,7 +72513,7 @@ proc: BEGIN LEFT JOIN vn.ticketState tls on tls.ticket = t.id LEFT JOIN vn.state s ON s.id = tls.state LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_CURDATE())) AND wp.warehouse_id = vWarehouseFk; */ @@ -72971,7 +72551,7 @@ proc: BEGIN * @return Table tmp.productionBuffer */ - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(util.VN_CURDATE())); DECLARE vIsTodayRelative BOOLEAN; @@ -72979,7 +72559,7 @@ proc: BEGIN FROM vn.worker WHERE userFk = vn.getUser(); - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_CURDATE()), vEndingDate); DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket @@ -73073,7 +72653,7 @@ proc: BEGIN IF(tp.hasTicketRequest, ' COD 100',''), IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), IF(tp.hasComponentLack,' COMPONENTES', ''), - IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') + IF(HOUR(util.VN_NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') ) as char(255))); -- Clientes Nuevos o Recuperados @@ -73210,7 +72790,7 @@ proc: BEGIN LEFT JOIN vn.ticketState tls on tls.ticket = t.id LEFT JOIN vn.state s ON s.id = tls.state LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_CURDATE())) AND wp.warehouse_id = vWarehouseFk; */ DROP TEMPORARY TABLE tmp.productionTicket; @@ -73257,7 +72837,7 @@ BEGIN FROM vn.sale s JOIN vn.item i ON i.id = s.itemFk JOIN vn.ticket t ON t.id = s.ticketFk - WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(HOUR, 23, util.VN_CURDATE()) GROUP BY s.ticketFk HAVING saleNum = iptNull; @@ -73269,7 +72849,7 @@ BEGIN JOIN vn.item i ON i.id = s.itemFk JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.sector sc ON sc.id = vSectorFk - WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(HOUR, 23, util.VN_CURDATE()) GROUP BY s.ticketFk HAVING iptSector; @@ -73850,13 +73430,13 @@ BEGIN ) SELECT vCustomer, - CURDATE(), + util.VN_CURDATE(), vAddress, vRefundAgencyMode, a.nickname, vWarehouse, vCompany, - CURDATE(), + util.VN_CURDATE(), vZoneFk FROM address a WHERE a.id = vAddress; @@ -74105,7 +73685,7 @@ BEGIN JOIN vn2008.Tickets_state ts ON t.Id_Ticket = ts.Id_Ticket JOIN vncontrol.inter i ON i.inter_id = ts.inter_id JOIN vn2008.state s ON i.state_id = s.id AND s.alert_level < 2 - WHERE t.Fecha BETWEEN CURDATE() AND util.dayend(CURDATE()) + WHERE t.Fecha BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND t.warehouse_id IN (1,44) AND Id_Ruta GROUP BY Id_Ruta @@ -74183,7 +73763,7 @@ UPDATE ticket mt SELECT tt.addressFk, ROUND(IFNULL(AVG(t.priority),0),0) AS priority FROM ticket t JOIN ticket tt ON tt.addressFk = t.addressFk - WHERE t.shipped > TIMESTAMPADD(YEAR,-1,CURDATE()) + WHERE t.shipped > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) AND tt.routeFk = vRuta GROUP BY addressFk ) sub ON sub.addressFk = mt.addressFk @@ -75908,7 +75488,7 @@ BEGIN CONCAT( 'El ', CONCAT (CAST((SUM(sub.fail)/COUNT(*))*100 AS DECIMAL(10,2)), ' %'), - CONCAT(' de los artículos han sido vendidos sin lote con fecha: ', DATE_SUB(CURDATE(), INTERVAL 3 DAY )) + CONCAT(' de los artículos han sido vendidos sin lote con fecha: ', DATE_SUB(util.VN_CURDATE(), INTERVAL 3 DAY )) ) subject, GROUP_CONCAT(sub.ticket SEPARATOR '

') body FROM (SELECT IF (sb.saleFk IS NULL,1, 0) fail, @@ -75922,7 +75502,7 @@ BEGIN JOIN itemType it ON it.id = i.typeFk JOIN account.user u ON u.id = it.workerFk JOIN itemCategory ic ON ic.id = it.categoryFk - WHERE t.shipped = DATE_SUB(CURDATE(), INTERVAL 1 DAY) + WHERE t.shipped = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 DAY) AND ic.code='fruit')sub; END ;; DELIMITER ; @@ -76136,10 +75716,10 @@ BEGIN DECLARE vComponentCount INT; DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), date(tt.shipped)) FROM tmp.sale_getProblems tt - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_CURDATE()); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; @@ -76188,12 +75768,12 @@ BEGIN FROM tmp.ticket_list tl JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = util.VN_CURDATE() JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) + WHERE util.VN_NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),util.VN_CURDATE())) AND dm.code IN('AGENCY','DELIVERY','PICKUP') - AND t.shipped BETWEEN CURDATE() AND util.midnight() + AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight() GROUP BY t.addressFk) sub ON sub.addressFk = t.addressFk JOIN vn.volumeConfig vc WHERE sub.litros < vc.minTicketVolume @@ -76228,7 +75808,7 @@ BEGIN SELECT DISTINCT clientFk FROM tmp.ticket_list; - CALL clientGetDebt(CURDATE()); + CALL clientGetDebt(util.VN_CURDATE()); INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) @@ -76305,7 +75885,7 @@ BEGIN AND ic.merchandise = TRUE AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk; @@ -76331,7 +75911,7 @@ BEGIN AND ic.merchandise = TRUE AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; @@ -76359,7 +75939,7 @@ BEGIN AND ic.merchandise = TRUE AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; @@ -76448,10 +76028,10 @@ BEGIN DECLARE vComponentCount INT; DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), date(tt.shipped)) FROM tmp.sale_getProblems tt - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_CURDATE()); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; @@ -76490,8 +76070,8 @@ BEGIN FROM tmp.ticket_list tl JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() - WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = util.VN_CURDATE() + WHERE util.VN_NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),util.VN_CURDATE())) GROUP BY tl.ticketFk) sub JOIN vn.volumeConfig vc WHERE sub.litros < vc.minTicketVolume; @@ -76523,7 +76103,7 @@ BEGIN SELECT DISTINCT clientFk FROM tmp.ticket_list; - CALL clientGetDebt(CURDATE()); + CALL clientGetDebt(util.VN_CURDATE()); INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) @@ -76592,7 +76172,7 @@ BEGIN AND it.categoryFk != 6 AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouse GROUP BY tl.ticketFk LIMIT 1) sub ON DUPLICATE KEY UPDATE @@ -76615,7 +76195,7 @@ BEGIN AND it.categoryFk != 6 AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouse GROUP BY tl.ticketFk LIMIT 1) sub ON DUPLICATE KEY UPDATE @@ -77027,7 +76607,7 @@ BEGIN AND (ISNULL(scsg.sectorCollectionFk) OR (NOT st.isChecked AND sl.quantity > 0)) - AND sc.created > CURDATE(); + AND sc.created > util.VN_CURDATE(); END ;; DELIMITER ; @@ -77112,7 +76692,7 @@ BEGIN WHERE ISNULL(scsg.id) AND sc.userFk = vUserFk AND sc.sectorFk = vSectorFk - AND sc.created >= CURDATE(); + AND sc.created >= util.VN_CURDATE(); IF NOT hasEmptyCollections THEN INSERT INTO vn.sectorCollection(userFk, sectorFk) @@ -77140,7 +76720,7 @@ BEGIN DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; - SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; + SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker; @@ -77377,7 +76957,7 @@ BEGIN LEFT JOIN tmp.ticketFree tf ON tf.ticketFk = io.ticketFk WHERE (dat BETWEEN util.tomorrow() AND '2019-10-31' OR - (dat BETWEEN CURDATE() AND util.dayEnd(CURDATE()) AND tf.ticketFk IS NOT NULL)) + (dat BETWEEN util.VN_CURDATE() AND util.dayEnd(util.VN_CURDATE()) AND tf.ticketFk IS NOT NULL)) AND item_id = vItemFk AND io.warehouse_id = vWarehouseFk GROUP BY dated; @@ -77603,7 +77183,7 @@ proc: BEGIN UPDATE vn.saleGroup sg SET sg.parkingFk = vParkingFk WHERE sg.id = vParam - AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND sg.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); CALL vn.ticket_setNextState(vn.ticket_get(vParam)); @@ -77615,7 +77195,7 @@ proc: BEGIN SELECT COUNT(*) INTO vIsTicket FROM vn.ticket t WHERE t.id = vParam - AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); IF vIsTicket THEN @@ -77650,7 +77230,7 @@ proc: BEGIN SELECT COUNT(*) INTO vIsCollection FROM vn.collection c WHERE c.id = vParam - AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); IF vIsCollection THEN @@ -77671,7 +77251,7 @@ proc: BEGIN WHERE s.code = vParam COLLATE utf8_unicode_ci; UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = NOW(), isPrinted = TRUE + SET parkingFk = vParkingFk, parked = util.VN_NOW(), isPrinted = TRUE WHERE `code` = vParam COLLATE utf8_unicode_ci; END ;; @@ -77703,7 +77283,7 @@ SELECT s.itemFk, JOIN vn.ticket t ON t.id = s.ticketFk LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk AND ist.warehouseFk = vWarehouseFk JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk AND ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), CURDATE())) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE())) AND iss.saleFk IS NULL AND t.warehouseFk = vWarehouseFk GROUP BY s.itemFk @@ -77764,7 +77344,7 @@ proc: BEGIN UPDATE vn.saleGroup sg SET sg.parkingFk = vParkingFk WHERE sg.id = vParam - AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND sg.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); CALL vn.ticket_setPreviousState(vn.ticket_get(vParam)); @@ -77776,7 +77356,7 @@ proc: BEGIN SELECT COUNT(*) INTO vIsTicket FROM vn.ticket t WHERE t.id = vParam - AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); IF vIsTicket THEN @@ -77793,7 +77373,7 @@ proc: BEGIN SELECT COUNT(*) INTO vIsCollection FROM vn.collection c WHERE c.id = vParam - AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); IF vIsCollection THEN @@ -77814,7 +77394,7 @@ proc: BEGIN WHERE s.code = vParam COLLATE utf8_unicode_ci; UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1 + SET parkingFk = vParkingFk, parked = util.VN_NOW(), isPrinted = 1 WHERE `code` = vParam COLLATE utf8_unicode_ci; SELECT (COUNT(*) > 0) AS IsUpdated @@ -77864,17 +77444,17 @@ BEGIN DELETE FROM vn.shelving WHERE length(code) > 3 - AND parked < TIMESTAMPADD(WEEK,-1,CURDATE()); + AND parked < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); DELETE FROM vn.itemShelving WHERE visible <= 0 - AND created < TIMESTAMPADD(MONTH,-1,CURDATE()); + AND created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); DELETE ish.* FROM vn.itemShelving ish JOIN vn.shelving sh ON sh.code = ish.shelvingFk WHERE sh.parkingFk IS NULL - AND ish.created < TIMESTAMPADD(WEEK,-1,CURDATE()); + AND ish.created < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); UPDATE vn.shelving sh LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code` @@ -77884,7 +77464,7 @@ BEGIN AND sh.isRecyclable AND ( sh.parked IS NULL OR - sh.parked < TIMESTAMPADD(MONTH,-1,CURDATE()) + sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) ); END ;; @@ -77941,14 +77521,14 @@ BEGIN LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta FROM vn2008.item_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) AND warehouse_id = vWarehouseFk GROUP BY item_id ) sale ON sale.item_id = i.id LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra FROM vn2008.item_entry_in - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) AND warehouse_id = vWarehouseFk AND isVirtualStock = FALSE GROUP BY item_id @@ -77956,7 +77536,7 @@ BEGIN LEFT JOIN ( SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado FROM vn2008.item_entry_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) AND warehouse_id = vWarehouseFk GROUP BY item_id ) mov ON mov.item_id = i.id @@ -78169,7 +77749,7 @@ BEGIN WHERE dateEnd IS NULL ORDER BY ci.creationDate DESC) t1 GROUP BY Id_Cliente; - CALL vn2008.risk_vs_client_list(CURDATE()); + CALL vn2008.risk_vs_client_list(util.VN_CURDATE()); SELECT c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo, @@ -78355,7 +77935,7 @@ BEGIN SELECT item_id, SUM(amount) amount FROM vn2008.item_entry_in WHERE dat = vDate - AND vDate >= CURDATE() + AND vDate >= util.VN_CURDATE() AND warehouse_id = vWarehouse AND isVirtualStock is FALSE GROUP BY item_id @@ -78407,7 +77987,7 @@ BEGIN ) ENGINE = MEMORY; - IF vDate >= CURDATE() THEN + IF vDate >= util.VN_CURDATE() THEN INSERT INTO tmp.item SELECT item_id, SUM(amount) amount FROM vn2008.item_entry_in @@ -78969,7 +78549,7 @@ BEGIN FROM vn.payment p LEFT JOIN vn.supplier s ON s.id = p.supplierFk LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk - WHERE p.created < (CURDATE() - INTERVAL pm.graceMonthsDisableChecked MONTH) + WHERE p.created < (util.VN_CURDATE() - INTERVAL pm.graceMonthsDisableChecked MONTH) AND pm.graceMonthsDisableChecked AND s.isPayMethodChecked GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id @@ -79589,7 +79169,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SET vNewShipped = IFNULL(vNewShipped, CURDATE()); + SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE()); CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); @@ -80328,11 +79908,11 @@ BEGIN DECLARE vHasUbications BOOL; DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)), w.hasUbications + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), date(tt.shipped)), w.hasUbications FROM tmp.ticketGetProblems tt JOIN vn.warehouse w ON w.id = tt.warehouseFk - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_CURDATE()); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; @@ -80388,7 +79968,7 @@ BEGIN SELECT DISTINCT clientFk FROM tmp.ticketList; - CALL clientGetDebt(CURDATE()); + CALL clientGetDebt(util.VN_CURDATE()); INSERT INTO tmp.ticketProblems(ticketFk, risk) SELECT DISTINCT tl.ticketFk, r.risk @@ -80459,7 +80039,7 @@ BEGIN AND it.categoryFk != 6 AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouse GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE @@ -80482,7 +80062,7 @@ BEGIN AND it.categoryFk != 6 AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) AND NOT i.generic - AND CURDATE() = vDate + AND util.VN_CURDATE() = vDate AND t.warehouseFk = vWarehouse GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE @@ -80825,10 +80405,10 @@ BEGIN WHERE t.id = vTicket; IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN - IF vShipped >= CURDATE() THEN + IF vShipped >= util.VN_CURDATE() THEN CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); END IF; - IF vShipped = CURDATE() THEN + IF vShipped = util.VN_CURDATE() THEN CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); END IF; END IF; @@ -81692,7 +81272,7 @@ IF viewAll IS true THEN SET st.stateFk = s.id WHERE workerFk = vn.getUser() AND (a.accion = 'PRESACAR') - AND st.created > TIMESTAMPADD(HOUR, -10, NOW()); + AND st.created > TIMESTAMPADD(HOUR, -10, util.VN_NOW()); ELSE @@ -81735,7 +81315,7 @@ IF viewAll IS true THEN LEFT JOIN vn.item i ON i.id = stpp.Id_Article JOIN vn.state s ON s.id = stpp.stateFk WHERE w.id = vn.getUser() - AND stpp.created > CURDATE() + AND stpp.created > util.VN_CURDATE() AND s.code = 'PREVIOUS_PREPARATION' ORDER BY p.pickingOrder, p.column ASC; @@ -82334,16 +81914,16 @@ BEGIN LEFT JOIN (SELECT tc.collectionFk FROM ticketCollection tc WHERE ticketFk = vTicketFk - AND tc.created >= CURDATE() + AND tc.created >= util.VN_CURDATE() )sub ON sub.collectionFk = tc.collectionFk WHERE ts.workerFk = vWorkerFk AND sub.collectionFk IS NULL - AND tc.created >= CURDATE() + AND tc.created >= util.VN_CURDATE() GROUP BY tc.collectionFk )sub ON sub.collectionFk = tc.collectionFk JOIN ticketState ts ON ts.ticketFk = t.id WHERE ts.code IN ('ON_PREPARATION', 'PREPARED', 'PREVIOUS_PREPARATION', 'OK PREVIOUS') - AND t.shipped >= CURDATE() + AND t.shipped >= util.VN_CURDATE() AND s.quantity <>0 LIMIT 1; @@ -82544,7 +82124,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; - SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0); + SET vYear = YEAR(util.VN_CURDATE()) + IF(vWeek < WEEK(util.VN_CURDATE()),1, 0); OPEN rsTicket; myLoop: LOOP @@ -83275,7 +82855,7 @@ BEGIN CALL util.throw('NO_ZONE_AVAILABLE'); END IF; - IF vShipped < CURDATE() THEN + IF vShipped < util.VN_CURDATE() THEN CALL util.throw('ERROR_PAST_SHIPMENT'); END IF; END ;; @@ -83636,13 +83216,13 @@ BEGIN ) SELECT vCustomer, - CURDATE(), + util.VN_CURDATE(), vAddress, vRefundAgencyMode, a.nickname, vWarehouse, vCompany, - CURDATE(), + util.VN_CURDATE(), vZoneFk FROM address a WHERE a.id = vAddress; @@ -83806,7 +83386,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) BEGIN /** * Cálcula el stock movible para los artículos de un ticket @@ -84019,7 +83599,7 @@ BEGIN DECLARE vAvailableCache INT; DECLARE vVisibleCache INT; - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, CURDATE()); + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, util.VN_CURDATE()); CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); CALL `vn`.`zoneClosure_recalc`(); @@ -84046,7 +83626,7 @@ BEGIN AND s.isPicked = FALSE AND s.reserved = FALSE AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; @@ -84065,7 +83645,7 @@ BEGIN AND s.isPicked = FALSE AND s.reserved = FALSE AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; @@ -84086,7 +83666,7 @@ BEGIN AND s.isPicked = FALSE AND s.reserved = FALSE AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; @@ -84133,8 +83713,8 @@ BEGIN LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id LEFT JOIN vn.state st2 ON st2.id = tst.stateFk WHERE (t.id IS NULL - OR (vDated > CURDATE()) - OR (vDated = CURDATE() AND vHour >= zc.`hour`)) + OR (vDated > util.VN_CURDATE()) + OR (vDated = util.VN_CURDATE() AND vHour >= zc.`hour`)) AND ts.etd <= vHour GROUP BY ts.ticketFk, t.id ORDER BY ts.etd, ts.ticketFk; @@ -84444,7 +84024,7 @@ BEGIN WHERE s.ticketFk = vSelf; UPDATE vn.ticket t - SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(NOW()) MOD 2000, t.shipped ) + SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(util.VN_NOW()) MOD 2000, t.shipped ) WHERE t.id = vSelf; END ;; @@ -86235,7 +85815,7 @@ BEGIN FROM hedera.tpvTransaction t WHERE t.receiptFk IS NULL AND t.status = 'ok' - AND t.created < DATE_ADD(NOW(),INTERVAL - 2 DAY) + AND t.created < DATE_ADD(util.VN_NOW(),INTERVAL - 2 DAY) GROUP BY t.clientFk; END ;; @@ -86912,7 +86492,7 @@ BEGIN DECLARE vDone BOOLEAN DEFAULT FALSE; DECLARE vRsTravel CURSOR FOR SELECT travelFk, - @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), + @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(util.VN_CURDATE()) - 1 + weekDay,util.VN_CURDATE()), @a := TIMESTAMPADD(DAY,duration,@a), warehouseOutFk, warehouseInFk, @@ -86926,7 +86506,7 @@ BEGIN SET vCounter = vSinceWeek; vWeekLoop :LOOP INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyFk, ref, cargoSupplierFk, kg) - SELECT @a := TIMESTAMPADD(DAY, vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), + SELECT @a := TIMESTAMPADD(DAY, vCounter * 7 - WEEKDAY(util.VN_CURDATE()) - 1 + weekDay,util.VN_CURDATE()), @a := TIMESTAMPADD(DAY, duration, @a), warehouseOutFk, warehouseInFk, @@ -87606,7 +87186,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisable`(vUserId int) mainLabel:BEGIN - IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > CURDATE() OR dated IS NULL)) > 0 THEN + IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > util.VN_CURDATE() OR dated IS NULL)) > 0 THEN LEAVE mainLabel; END IF; DELETE FROM account.account @@ -87661,8 +87241,8 @@ BEGIN INNER JOIN vn.worker w ON p.id_trabajador = w.id) INNER JOIN account.account a ON w.userFk = a.id WHERE ((b.date_end) IS NOT NULL - AND (b.date_end) < CURDATE() - AND (b.date_end) > TIMESTAMPADD(DAY, -70,CURDATE()) ); + AND (b.date_end) < util.VN_CURDATE() + AND (b.date_end) > TIMESTAMPADD(DAY, -70,util.VN_CURDATE()) ); DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; @@ -87782,7 +87362,7 @@ BEGIN DECLARE vDateStart DATE; DECLARE vDateEnd DATE; - SET vDateStart = TIMESTAMPADD(MONTH,-1,CURDATE()); + SET vDateStart = TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); SET vDateEnd = util.yesterday(); CALL vn.workerJourneyReplace(vDateStart,vDateEnd,0); @@ -87828,9 +87408,9 @@ BEGIN JOIN postgresql.profile p ON p.person_id = pe.person_id JOIN postgresql.business b ON b.client_id = p.profile_id JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) + JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,util.VN_CURDATE()) WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, CURDATE()) >= vFromDate + AND IFNULL(b.date_end, util.VN_CURDATE()) >= vFromDate -- AND bl.porhoras AND vUserFk IN (0,w.userFk); @@ -88060,9 +87640,9 @@ UPDATE vn.workerJourney wj JOIN postgresql.business_labour bl ON bl.business_id = b.business_id JOIN postgresql.calendar_labour_type pclt ON pclt.calendar_labour_type_id = bl.calendar_labour_type_id JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) + JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,util.VN_CURDATE()) WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, CURDATE()) >= vFromDate + AND IFNULL(b.date_end, util.VN_CURDATE()) >= vFromDate AND bl.porhoras = FALSE AND vUserFk IN (0,w.userFk); @@ -88131,7 +87711,7 @@ BEGIN INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) SELECT w.workerFk, t.dated, w.businessFk FROM workerLabour w - JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) + JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,util.VN_CURDATE()) WHERE t.dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) ORDER BY w.workerFk, t.dated, w.businessFk; @@ -88417,7 +87997,7 @@ BEGIN INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) SELECT w.workerFk, t.dated, w.businessFk FROM workerLabour w - JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) + JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,util.VN_CURDATE()) WHERE t.dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) ORDER BY w.workerFk, t.dated, w.businessFk; @@ -88726,7 +88306,7 @@ BEGIN CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,NOW(),FALSE); + CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE); END ;; @@ -88758,7 +88338,7 @@ BEGIN IF(direction = 'in', @cont:=@cont+1, TRUE), @cont cont FROM vn.workerTimeControl wtc - WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE() + WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) AND util.VN_CURDATE() ORDER BY userFk, timed)sub GROUP BY cont HAVING cont2 MOD 2 = 1)sub2 @@ -88999,7 +88579,7 @@ BEGIN @cont cont, @lastUserFk := userFk FROM workerTimeControl wtc - WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND util.dayEnd(CURDATE()) + WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) AND util.dayEnd(util.VN_CURDATE()) ORDER BY userFk, timed)sub GROUP BY cont HAVING cont2 MOD 2 = 1)sub2 @@ -89068,10 +88648,10 @@ proc: BEGIN WHERE w.id = vUserFk; - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN SELECT "Descansos 12 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; @@ -89100,7 +88680,7 @@ proc: BEGIN JOIN postgresql.person p ON p.person_id = pr.person_id JOIN postgresql.calendar_state cs USING(calendar_state_id) JOIN worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() + WHERE ce.date = util.VN_CURDATE() AND cs.isAllowedToWork = FALSE AND w.userFk = vUserFk LIMIT 1; @@ -89135,19 +88715,19 @@ proc: BEGIN -- VERIFICAR DESCANSO SEMANAL SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); + SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND)); DROP TEMPORARY TABLE IF EXISTS tmp.trash; CREATE TEMPORARY TABLE tmp.trash SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, @vLastTimed:= UNIX_TIMESTAMP(timed) FROM workerTimeControl - WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) + WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND) AND userFk= vUserFk AND direction IN ('in','out') ORDER BY timed ASC; - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA SELECT "Descansos 36 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; @@ -89160,7 +88740,7 @@ proc: BEGIN ELSE -- DIA ACTUAL -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO - SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked FROM workerTimeControl wtc WHERE userFk = vUserFk AND timed >= vLastIn @@ -89236,7 +88816,7 @@ BEGIN DECLARE vBody VARCHAR(255) DEFAULT NULL; IF (vTimed IS NULL) THEN - SET vTimed = NOW(); + SET vTimed = util.VN_NOW(); END IF; SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax, weekMaxBreak, weekMaxScope, askInOut @@ -89269,8 +88849,8 @@ BEGIN JOIN postgresql.person p ON p.person_id = pr.person_id JOIN vn.worker w ON w.id = p.id_trabajador WHERE w.userFk = vUserFk AND - b.date_start <= CURDATE() AND - IFNULL(b.date_end,CURDATE()) >= CURDATE() + b.date_start <= util.VN_CURDATE() AND + IFNULL(b.date_end,util.VN_CURDATE()) >= util.VN_CURDATE() ) = 0 THEN -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; @@ -89329,7 +88909,7 @@ BEGIN JOIN postgresql.person p ON p.person_id = pr.person_id JOIN postgresql.calendar_state cs USING(calendar_state_id) JOIN vn.worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() AND + WHERE ce.date = util.VN_CURDATE() AND cs.isAllowedToWork = FALSE AND w.userFk = vUserFk LIMIT 1; @@ -89448,10 +89028,10 @@ proc: BEGIN WHERE w.id = vUserFk; - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN SELECT "Descansos 12 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; @@ -89480,7 +89060,7 @@ proc: BEGIN JOIN postgresql.person p ON p.person_id = pr.person_id JOIN postgresql.calendar_state cs USING(calendar_state_id) JOIN worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() + WHERE ce.date = util.VN_CURDATE() AND cs.isAllowedToWork = FALSE AND w.userFk = vUserFk LIMIT 1; @@ -89515,19 +89095,19 @@ proc: BEGIN -- VERIFICAR DESCANSO SEMANAL SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); + SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND)); DROP TEMPORARY TABLE IF EXISTS tmp.trash; CREATE TEMPORARY TABLE tmp.trash SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, @vLastTimed:= UNIX_TIMESTAMP(timed) FROM workerTimeControl - WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) + WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND) AND userFk= vUserFk AND direction IN ('in','out') ORDER BY timed ASC; - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA SELECT "Descansos 36 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; @@ -89540,7 +89120,7 @@ proc: BEGIN ELSE -- DIA ACTUAL -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO - SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked FROM workerTimeControl wtc WHERE userFk = vUserFk AND timed >= vLastIn @@ -89594,7 +89174,7 @@ BEGIN /** * Verifica si el empleado puede fichar * @param vWorker Identificador del trabajador - * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW() + * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = util.VN_NOW() * @param vDirection solo se pueden pasa los valores del campo workerTimeControl.direction ENUM('in', 'out', 'middle') * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. Si hay algún problema, devuelve el mesaje a que se debe mostrar al usuario * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá fichada a la tabla vn.workerTimeControl @@ -89624,9 +89204,9 @@ BEGIN DECLARE vDone INT DEFAULT FALSE; DECLARE vCursor CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + SELECT UNIX_TIMESTAMP(util.VN_NOW() - INTERVAL vGap SECOND) UNION - SELECT UNIX_TIMESTAMP(NOW()) + SELECT UNIX_TIMESTAMP(util.VN_NOW()) UNION (SELECT UNIX_TIMESTAMP(timed) FROM workerTimeControl @@ -89636,9 +89216,9 @@ BEGIN ORDER BY timed ASC); DECLARE vCursor2 CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + SELECT UNIX_TIMESTAMP(util.VN_NOW() - INTERVAL vGap SECOND) UNION - SELECT UNIX_TIMESTAMP(NOW()) + SELECT UNIX_TIMESTAMP(util.VN_NOW()) UNION SELECT UNIX_TIMESTAMP(timed) FROM workerTimeControl @@ -89686,7 +89266,7 @@ BEGIN END; IF (vTimed IS NULL) THEN - SET vTimed = NOW(); + SET vTimed = util.VN_NOW(); SET vManual = FALSE; END IF; @@ -89746,7 +89326,7 @@ BEGIN LIMIT 1; -- FICHADAS A FUTURO - IF vTimed > DATE_ADD(NOW(), INTERVAL 60 SECOND) THEN + IF vTimed > DATE_ADD(util.VN_NOW(), INTERVAL 60 SECOND) THEN SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; CALL util.throw(vErrorCode); END IF; @@ -89926,7 +89506,7 @@ BEGIN DECLARE vIsMiddleOdd BOOLEAN ; IF (vTimed IS NULL) THEN - SET vTimed = NOW(); + SET vTimed = util.VN_NOW(); END IF; SELECT timed INTO vLastIn @@ -89941,7 +89521,7 @@ BEGIN FROM workerTimeControl WHERE userFk = vWorkerFk AND direction = 'middle' - AND timed BETWEEN vLastIn AND NOW(); + AND timed BETWEEN vLastIn AND util.VN_NOW(); DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; CREATE TEMPORARY TABLE tmp.workerTimeControlDirection @@ -90000,7 +89580,7 @@ BEGIN DECLARE vIsMiddleOdd BOOLEAN ; IF (vTimed IS NULL) THEN - SET vTimed = NOW(); + SET vTimed = util.VN_NOW(); END IF; SELECT timed INTO vLastIn @@ -90015,7 +89595,7 @@ BEGIN FROM workerTimeControl WHERE userFk = vWorkerFk AND direction = 'middle' - AND timed BETWEEN vLastIn AND NOW(); + AND timed BETWEEN vLastIn AND util.VN_NOW(); DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; @@ -90171,7 +89751,7 @@ BEGIN * @return (name, surname, userFk, departmentFk, button1, button2) * Los valores posibles para button son ('in', 'inMiddle', 'outMiddle', 'out') */ - CALL vn.workerTimeControl_direction(vWorkerFk, NOW()); + CALL vn.workerTimeControl_direction(vWorkerFk, util.VN_NOW()); SELECT wi.name, wi.surname, @@ -90393,7 +89973,7 @@ BEGIN isSendMail; UPDATE workerTimeControlMail - SET updated = NOW(), state = 'SENDED' + SET updated = util.VN_NOW(), state = 'SENDED' WHERE year = vYear AND week = vWeek AND IFNULL(vWorkerFk, workerFk) = workerFk ; @@ -90738,8 +90318,8 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartm BEGIN DECLARE vDatedFrom, vDatedTo DATETIME; - IF (DAYNAME(CURDATE()) = 'miércoles') THEN - SELECT DATE_SUB(CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; + IF (DAYNAME(util.VN_CURDATE()) = 'miércoles') THEN + SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, NULL); END IF; @@ -90813,7 +90393,7 @@ SELECT COUNT(*) INTO vHasSignedToday FROM vn.workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; SET @day := 0; -SET @lastTimed := NOW(); +SET @lastTimed := util.VN_NOW(); SELECT SUM(IF(interval_in_minutes >= v12hoursInMinutes,1,0)), SUM(FLOOR(interval_in_minutes/ v36hoursInMinutes)) , SUM(jornadas) INTO vDescansos12h, vDescansos36h, vJornadas @@ -90832,14 +90412,14 @@ SELECT SUM(IF(interval_in_minutes >= v12hoursInMinutes,1,0)), SUM(FLOOR(interva ( SELECT day(timed) as dayNumber, dayname(timed) as dayName, timed FROM - (SELECT TIMESTAMPADD(DAY, -11, NOW()) as timed, vUserFk as userFk -- Fichada virtual para los en los que no se ha trabajado la semana anterior + (SELECT TIMESTAMPADD(DAY, -11, util.VN_NOW()) as timed, vUserFk as userFk -- Fichada virtual para los en los que no se ha trabajado la semana anterior UNION ALL SELECT timed, userFk FROM vn.workerTimeControl wtc WHERE userFk = vUserFk AND timed >= TIMESTAMPADD(DAY, -10,vDated) UNION ALL - SELECT IF(vHasSignedToday, '2000-01-01 00:00', NOW()) as timed, vUserFk + SELECT IF(vHasSignedToday, '2000-01-01 00:00', util.VN_NOW()) as timed, vUserFk ) sub4 ORDER BY timed ) sub @@ -90866,7 +90446,7 @@ SELECT cs.type INTO vCantWork JOIN postgresql.person p ON p.person_id = pr.person_id JOIN postgresql.calendar_state cs USING(calendar_state_id) JOIN vn.worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() + WHERE ce.date = util.VN_CURDATE() AND cs.isAllowedToWork = FALSE AND w.userFk = vUserFk LIMIT 1; @@ -91486,7 +91066,7 @@ BEGIN JOIN agencyMode am ON am.id= r.agencyModeFk JOIN agency a ON a.id = am.agencyFk JOIN workerDistributionCategory wdc ON wdc.workerFk = vWorkerFk - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = wdc.workerFk AND a.workCenterFk = wl.workCenterFk + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, util.VN_CURDATE()) AND wl.workerFk = wdc.workerFk AND a.workCenterFk = wl.workCenterFk JOIN department v ON v.id = departmentFk JOIN routeConfig rc WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND @@ -91513,7 +91093,7 @@ BEGIN ORDER BY dated DESC LIMIT 1 ) sub JOIN routeConfig rc - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, util.VN_CURDATE()) AND wl.workerFk = sub.workerFk JOIN department v ON v.id = departmentFk WHERE r.m3>0 AND @@ -91760,7 +91340,7 @@ BEGIN WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo ORDER BY dated DESC LIMIT 1 ) sub - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = sub.workerFk AND a.workCenterFk = wl.workCenterFk + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, util.VN_CURDATE()) AND wl.workerFk = sub.workerFk AND a.workCenterFk = wl.workCenterFk JOIN department v ON v.id = departmentFk JOIN routeConfig rc WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND @@ -91792,7 +91372,7 @@ BEGIN ORDER BY dated DESC LIMIT 1 ) sub JOIN routeConfig rc - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, util.VN_CURDATE()) AND wl.workerFk = sub.workerFk JOIN department v ON v.id = departmentFk WHERE r.m3>0 AND @@ -92170,7 +91750,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11)) BEGIN INSERT INTO vn.workingHours (timeIn, userId) - VALUES (NOW(),vUserId); + VALUES (util.VN_NOW(),vUserId); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92190,9 +91770,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11)) BEGIN UPDATE vn.workingHours - SET timeOut = NOW() + SET timeOut = util.VN_NOW() WHERE userId = vUserId - AND DATE(timeIn) = CURDATE(); + AND DATE(timeIn) = util.VN_CURDATE(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92296,7 +91876,7 @@ proc: BEGIN */ DECLARE vScope INT; DECLARE vCounter INT DEFAULT 0; - DECLARE vShipped DATE DEFAULT CURDATE(); + DECLARE vShipped DATE DEFAULT util.VN_CURDATE(); DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN @@ -92356,7 +91936,7 @@ proc: BEGIN */ DECLARE vScope INT; DECLARE vCounter INT DEFAULT 0; - DECLARE vShipped DATE DEFAULT CURDATE(); + DECLARE vShipped DATE DEFAULT util.VN_CURDATE(); DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN @@ -92879,7 +92459,7 @@ proc:BEGIN JOIN vn.productionConfig pc WHERE a.isOwn AND pc.isZoneClosedByExpeditionActivated - AND e.created >= CURDATE() + AND e.created >= util.VN_CURDATE() GROUP BY t.zoneFk, t.warehouseFk HAVING numTickets >= minTicketsToCloseZone) sub; END ;; @@ -92921,7 +92501,7 @@ BEGIN JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk WHERE dm.code IN ('AGENCY','DELIVERY'); - CALL zone_getOptionsForShipment(CURDATE(),FALSE); + CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE); DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes; CREATE TEMPORARY TABLE tmp.zoneNodes ( @@ -92989,7 +92569,7 @@ BEGIN INSERT INTO mail (receiver,replyTo,subject,body) SELECT 'pepe@verdnatura.es' receiver, 'noreply@verdnatura.es' replyTo, - CONCAT('Colisiones en zonas ', CURDATE()) subject, + CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject, CONCAT(vTableCollisions, GROUP_CONCAT(sub.td SEPARATOR ''), '') body @@ -93207,7 +92787,7 @@ BEGIN LEFT JOIN tmp.closedZones cz ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zw.zoneFk - AND zo.shipped = CURDATE() + AND zo.shipped = util.VN_CURDATE() WHERE z.agencyModeFk = vAgencyModeFk AND zw.warehouseFk = vWarehouseFk AND (ISNULL(cz.zoneFk) OR vShowExpiredZones); @@ -93617,8 +93197,8 @@ BEGIN IF NOT vShowExpiredZones THEN DELETE FROM tmp.zoneOption - WHERE shipped < CURDATE() - OR (shipped = CURDATE() AND CURTIME() > `hour`); + WHERE shipped < util.VN_CURDATE() + OR (shipped = util.VN_CURDATE() AND util.VN_CURTIME() > `hour`); END IF; END ;; DELIMITER ; @@ -93645,7 +93225,7 @@ BEGIN * @param vShipped The shipping date * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options */ - DECLARE vHour TIME DEFAULT TIME(NOW()); + DECLARE vHour TIME DEFAULT TIME(util.VN_NOW()); DROP TEMPORARY TABLE IF EXISTS tLandings; CREATE TEMPORARY TABLE tLandings @@ -93703,8 +93283,8 @@ BEGIN IF NOT vShowExpiredZones THEN DELETE FROM tmp.zoneOption - WHERE vShipped < CURDATE() - OR (vShipped = CURDATE() AND CURTIME() > `hour`); + WHERE vShipped < util.VN_CURDATE() + OR (vShipped = util.VN_CURDATE() AND util.VN_CURTIME() > `hour`); END IF; END ;; DELIMITER ; @@ -93754,7 +93334,7 @@ BEGIN LEFT JOIN tmp.closedZones cz ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zw.zoneFk - AND zo.shipped = CURDATE() + AND zo.shipped = util.VN_CURDATE() WHERE z.agencyModeFk = vAgencyModeFk AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) ORDER BY shipped) t @@ -93891,7 +93471,7 @@ BEGIN DECLARE vForwardDays INT; SELECT forwardDays INTO vForwardDays FROM zoneConfig; - CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY)); + CALL util.time_createTable(util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL vForwardDays DAY)); DROP TEMPORARY TABLE IF EXISTS tLandings; CREATE TEMPORARY TABLE tLandings @@ -93903,7 +93483,7 @@ BEGIN ti.dated shipped FROM zone z JOIN zoneEvent e ON e.zoneFk = z.id - JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate()); + JOIN tmp.time ti ON ti.dated BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY, vForwardDays, util.VN_CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption @@ -94013,9 +93593,9 @@ DROP TABLE IF EXISTS `inter`; CREATE TABLE `inter` ( `inter_id` int(11) NOT NULL AUTO_INCREMENT, `state_id` tinyint(3) unsigned NOT NULL, - `fallo_id` int(10) unsigned NOT NULL DEFAULT '21', + `fallo_id` int(10) unsigned NOT NULL DEFAULT 21, `nota` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `odbc_date` timestamp NULL DEFAULT current_timestamp(), `Id_Ticket` int(11) DEFAULT NULL, `Id_Trabajador` int(11) DEFAULT NULL, `Id_Supervisor` int(10) unsigned DEFAULT NULL, @@ -94199,7 +93779,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN - DECLARE vDate DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); + DECLARE vDate DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); DELETE i FROM inter i JOIN vn.ticket t ON i.Id_Ticket = t.id WHERE t.shipped <= vDate; END ;; @@ -94229,7 +93809,7 @@ USE `account`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`password` AS `password` from (`user` `u` join `account` `a` on((`a`.`id` = `u`.`id`))) where `u`.`active` */; +/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`password` AS `password` from (`user` `u` join `account` `a` on(`a`.`id` = `u`.`id`)) where `u`.`active` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94267,7 +93847,7 @@ USE `account`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myRole` AS select `r`.`inheritsFrom` AS `id` from (`roleRole` `r` join `user` `u` on((`u`.`role` = `r`.`role`))) where (`u`.`id` = `myUser_getId`()) */; +/*!50001 VIEW `myRole` AS select `r`.`inheritsFrom` AS `id` from (`roleRole` `r` join `user` `u` on(`u`.`role` = `r`.`role`)) where `u`.`id` = `myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94286,7 +93866,7 @@ USE `account`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myUser` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`nickname` AS `nickname`,`u`.`lang` AS `lang`,`u`.`role` AS `role`,`u`.`recoverPass` AS `recoverPass` from `user` `u` where (`u`.`name` = `myUserGetName`()) */ +/*!50001 VIEW `myUser` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`nickname` AS `nickname`,`u`.`lang` AS `lang`,`u`.`role` AS `role`,`u`.`recoverPass` AS `recoverPass` from `user` `u` where `u`.`name` = `myUserGetName`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94312,7 +93892,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,curdate())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on((`b`.`business_id` = `ce`.`business_id`))) join `postgresql`.`profile` `pr` on((`pr`.`profile_id` = `b`.`client_id`))) join `postgresql`.`person` `p` on((`p`.`person_id` = `pr`.`person_id`))) join `postgresql`.`calendar_state` `cs` on((`cs`.`calendar_state_id` = `ce`.`calendar_state_id`))) join `vn`.`worker` `w` on((`w`.`id` = `p`.`id_trabajador`))) where ((`ce`.`date` >= (curdate() + interval -(1) year)) and (`cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo'))) group by `p`.`firstname`,`p`.`name`,`cs`.`type` having (`endContract` >= curdate()) */; +/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,util.VN_CURDATE())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on(`b`.`business_id` = `ce`.`business_id`)) join `postgresql`.`profile` `pr` on(`pr`.`profile_id` = `b`.`client_id`)) join `postgresql`.`person` `p` on(`p`.`person_id` = `pr`.`person_id`)) join `postgresql`.`calendar_state` `cs` on(`cs`.`calendar_state_id` = `ce`.`calendar_state_id`)) join `vn`.`worker` `w` on(`w`.`id` = `p`.`id_trabajador`)) where `ce`.`date` >= util.VN_CURDATE() + interval -1 year and `cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo') group by `p`.`firstname`,`p`.`name`,`cs`.`type` having `endContract` >= util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94331,7 +93911,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,(`i`.`lastYearSales` - `yi`.`lastYearSales`) AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,(`i`.`totalGreuge` - `yi`.`totalGreuge`) AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,(`i`.`latePaymentRate` - `yi`.`latePaymentRate`) AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,(`i`.`countEmployee` - `yi`.`countEmployee`) AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,(`i`.`averageMana` - `yi`.`averageMana`) AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,(`i`.`bankingPool` - `yi`.`bankingPool`) AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,(`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients`) AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,(`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients`) AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,(`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients`) AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,(`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate`) AS `incLastMonthWebBuyingRate`,`i`.`productionHours__` AS `productionHours__`,`i`.`dailyWorkersCost__` AS `dailyWorkersCost__`,`i`.`volumeM3__` AS `volumeM3__`,`i`.`salesValue__` AS `salesValue__`,`i`.`valueM3__` AS `valueM3__`,`i`.`hoursM3__` AS `hoursM3__`,`i`.`workerCostM3__` AS `workerCostM3__`,`i`.`salesWorkersCostRate__` AS `salesWorkersCostRate__`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on((`yi`.`updated` = (select (max(`indicators`.`updated`) + interval -(1) day) from `indicators`)))) where (`i`.`updated` = (select max(`indicators`.`updated`) from `indicators`)) */; +/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,`i`.`lastYearSales` - `yi`.`lastYearSales` AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,`i`.`totalGreuge` - `yi`.`totalGreuge` AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,`i`.`latePaymentRate` - `yi`.`latePaymentRate` AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,`i`.`countEmployee` - `yi`.`countEmployee` AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,`i`.`averageMana` - `yi`.`averageMana` AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,`i`.`bankingPool` - `yi`.`bankingPool` AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients` AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients` AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients` AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate` AS `incLastMonthWebBuyingRate`,`i`.`productionHours__` AS `productionHours__`,`i`.`dailyWorkersCost__` AS `dailyWorkersCost__`,`i`.`volumeM3__` AS `volumeM3__`,`i`.`salesValue__` AS `salesValue__`,`i`.`valueM3__` AS `valueM3__`,`i`.`hoursM3__` AS `hoursM3__`,`i`.`workerCostM3__` AS `workerCostM3__`,`i`.`salesWorkersCostRate__` AS `salesWorkersCostRate__`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on(`yi`.`updated` = (select max(`indicators`.`updated`) + interval -1 day from `indicators`))) where `i`.`updated` = (select max(`indicators`.`updated`) from `indicators`) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94350,7 +93930,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `m3Silla__` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where (`m3`.`warehouseFk` in (1,44)) group by `m3`.`fecha` */; +/*!50001 VIEW `m3Silla__` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where `m3`.`warehouseFk` in (1,44) group by `m3`.`fecha` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94445,7 +94025,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `packingSpeed` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) AS `cm3`,`t`.`warehouseFk` AS `warehouse_id`,`e`.`created` AS `odbc_date` from ((`vn`.`expedition` `e` join `vn`.`packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` between curdate() and `util`.`dayend`(curdate())) */; +/*!50001 VIEW `packingSpeed` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,`p`.`width` * `p`.`height` * `p`.`depth`) AS `cm3`,`t`.`warehouseFk` AS `warehouse_id`,`e`.`created` AS `odbc_date` from ((`vn`.`expedition` `e` join `vn`.`packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) where `e`.`created` between util.VN_CURDATE() and `util`.`dayend`(util.VN_CURDATE()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94464,7 +94044,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `s1_ticketDetail` AS select `s`.`ticketFk` AS `ticketFk`,cast(sum((`s`.`price` * `s`.`quantity`)) as decimal(10,2)) AS `ticketAmount`,count(`s`.`id`) AS `ticketLines`,cast(sum(`sv`.`volume`) as decimal(10,2)) AS `ticketM3`,cast(`t`.`shipped` as date) AS `shipped` from ((`vn`.`ticket` `t` join `vn`.`sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (`t`.`shipped` between '2021-09-01' and '2021-10-31 23:59') group by `s`.`ticketFk` */; +/*!50001 VIEW `s1_ticketDetail` AS select `s`.`ticketFk` AS `ticketFk`,cast(sum(`s`.`price` * `s`.`quantity`) as decimal(10,2)) AS `ticketAmount`,count(`s`.`id`) AS `ticketLines`,cast(sum(`sv`.`volume`) as decimal(10,2)) AS `ticketM3`,cast(`t`.`shipped` as date) AS `shipped` from ((`vn`.`ticket` `t` join `vn`.`sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `vn`.`saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between '2021-09-01' and '2021-10-31 23:59' group by `s`.`ticketFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94483,7 +94063,7 @@ USE `bs`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `s21_saleDetail` AS select dayofmonth(`t`.`shipped`) AS `dia`,year(`t`.`shipped`) AS `año`,month(`t`.`shipped`) AS `mes`,`s`.`concept` AS `concepto`,`s`.`quantity` AS `unidades`,`s`.`price` AS `precio`,(`s`.`quantity` * `s`.`price`) AS `venta`,`it`.`name` AS `familia`,`w`.`code` AS `comprador`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`sv`.`volume` AS `volume` from ((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (((`t`.`shipped` between '2020-10-21' and '2020-10-28') or (`t`.`shipped` between '2019-10-21' and '2019-10-28') or (`t`.`shipped` between '2021-09-1' and '2021-10-28')) and (`t`.`warehouseFk` in (1,60)) and `c`.`isRelevant` and (`s`.`quantity` > 0)) */; +/*!50001 VIEW `s21_saleDetail` AS select dayofmonth(`t`.`shipped`) AS `dia`,year(`t`.`shipped`) AS `año`,month(`t`.`shipped`) AS `mes`,`s`.`concept` AS `concepto`,`s`.`quantity` AS `unidades`,`s`.`price` AS `precio`,`s`.`quantity` * `s`.`price` AS `venta`,`it`.`name` AS `familia`,`w`.`code` AS `comprador`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`sv`.`volume` AS `volume` from ((((((`vn`.`sale` `s` join `vn`.`item` `i` on(`i`.`id` = `s`.`itemFk`)) join `vn`.`itemType` `it` on(`it`.`id` = `i`.`typeFk`)) join `vn`.`worker` `w` on(`w`.`id` = `it`.`workerFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `vn`.`client` `c` on(`c`.`id` = `t`.`clientFk`)) join `vn`.`saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where (`t`.`shipped` between '2020-10-21' and '2020-10-28' or `t`.`shipped` between '2019-10-21' and '2019-10-28' or `t`.`shipped` between '2021-09-1' and '2021-10-28') and `t`.`warehouseFk` in (1,60) and `c`.`isRelevant` <> 0 and `s`.`quantity` > 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94526,25 +94106,6 @@ USE `bs`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_ventas__` --- - -/*!50001 DROP TABLE IF EXISTS `v_ventas__`*/; -/*!50001 DROP VIEW IF EXISTS `v_ventas__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventas__` AS select (`ventas`.`importe` * `Movimientos`.`Cantidad`) AS `importe`,`ventas`.`recargo` AS `recargo`,`time`.`year` AS `year`,`time`.`month` AS `month`,`time`.`week` AS `week`,`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`time`.`date` = `ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`ventas`.`Id_Movimiento` = `Movimientos`.`Id_Movimiento`))) group by `time`.`date` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `vendedores` -- @@ -94628,7 +94189,7 @@ USE `edi`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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` > (curdate() + interval -(12) hour)) and (`po`.`OrderStatus` = 3) and (left(`po`.`error`,4) <> '(0) ')) */; +/*!50001 VIEW `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) ' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94647,7 +94208,7 @@ USE `edi`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `supplyOffer` AS select `sr`.`vmpID` AS `vmpID`,`di`.`ID` AS `diId`,`sr`.`ID` AS `srId`,`sr`.`Item_ArticleCode` AS `Item_ArticleCode`,`sr`.`VBNOmschrijving` AS `product_name`,`s`.`company_name` AS `company_name`,cast(`sr`.`Price` as decimal(10,3)) AS `Price`,`sr`.`Quality` AS `Quality`,`sr`.`s1` AS `s1`,`sr`.`s2` AS `s2`,`sr`.`s3` AS `s3`,`sr`.`s4` AS `s4`,`sr`.`s5` AS `s5`,`sr`.`s6` AS `s6`,`sr`.`NumberOfUnits` AS `NumberOfUnits`,least(if((`sr`.`EmbalageCode` = 800),((`sr`.`EmbalageCode` * 10) + `sr`.`NumberOfItemsPerCask`),`sr`.`EmbalageCode`),ifnull(`idt`.`bucket_id`,'999')) AS `EmbalageCode`,`di`.`LatestDeliveryDateTime` AS `LatestDeliveryDateTime`,`di`.`EarliestDespatchDateTime` AS `EarliestDespatchDateTime`,`di`.`FirstOrderDateTime` AS `FirstOrderDateTime`,`di`.`LatestOrderDateTime` AS `LatestOrderDateTime`,`sr`.`NumberOfItemsPerCask` AS `NumberOfItemsPerCask`,`sr`.`NumberOfLayersPerTrolley` AS `NumberOfLayersPerTrolley`,`sr`.`MinimumNumberToOrder` AS `MinimumNumberToOrder`,`sr`.`MaximumNumberToOrder` AS `MaximumNumberToOrder`,`sr`.`IncrementalOrderableQuantity` AS `IncrementalOrderableQuantity`,`sr`.`PackingPrice` AS `PackingPrice`,`sr`.`MarketPlaceID` AS `MarketPlaceID`,`sr`.`PictureReference` AS `PictureReference`,`sr`.`updated` AS `supplyResponseUpdated`,`i`.`group_id` AS `group_id`,`mp`.`name` AS `marketPlace`,`di`.`DeliveryPrice` AS `DeliveryPrice`,`di`.`ChargeAmount` AS `ChargeAmount`,`di`.`MinimumQuantity` AS `MinimumQuantity`,`di`.`MaximumQuantity Integer` AS `MaximumQuantity`,cast((`sr`.`MinimumNumberToOrder` * (case `sr`.`MinimumOrderUnitType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `OrderUnit`,cast((`sr`.`IncrementalOrderableQuantity` * (case `sr`.`IncrementalOrderableQuantityType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `IncrementalOrderUnit`,`mp`.`isEarlyBird` AS `isEarlyBird`,`v`.`isVNHSupplier` AS `isVNHSupplier`,`igo`.`expenseFk` AS `expenseFk`,`igo`.`intrastatFk` AS `intrastatFk`,`igo`.`originFk` AS `originFk`,ifnull(`idt`.`itemTypeFk`,`igo`.`itemTypeFk`) AS `itemTypeFk` from (((((((((`edi`.`deliveryInformation` `di` join `edi`.`supplyResponse` `sr` on((`sr`.`ID` = `di`.`supplyResponseID`))) left join `edi`.`supplier` `s` on((`s`.`glnAddressCode` = `sr`.`SupplierGLN`))) join `edi`.`bucket` `b` on((`b`.`bucket_id` = `sr`.`EmbalageCode`))) join `edi`.`item` `i` on((`i`.`id` = `sr`.`Item_ArticleCode`))) join `edi`.`marketPlace` `mp` on((`mp`.`id` = `sr`.`MarketPlaceID`))) join `vn`.`floramondoConfig` `fm`) left join `edi`.`item_defaultType` `idt` on((`idt`.`item_id` = `i`.`id`))) join `edi`.`VMPSettings` `v` on((`v`.`VMPID` = `sr`.`vmpID`))) join `edi`.`item_groupToOffer` `igo` on((`igo`.`group_code` = `i`.`group_id`))) where ((`v`.`isBlocked` = 0) and (`s`.`isBanned` = 0) and (`sr`.`NumberOfUnits` > 0) and (now() between `di`.`FirstOrderDateTime` and `di`.`LatestOrderDateTime`) and (`mp`.`isOffered` = 1) and (`di`.`LatestDeliveryDateTime` between cast(`fm`.`nextLanded` as date) and concat(cast(`fm`.`nextLanded` as date),' ',`fm`.`MaxLatestDeliveryHour`))) group by `sr`.`ID` having (`EmbalageCode` <> 999) */; +/*!50001 VIEW `supplyOffer` AS select `sr`.`vmpID` AS `vmpID`,`di`.`ID` AS `diId`,`sr`.`ID` AS `srId`,`sr`.`Item_ArticleCode` AS `Item_ArticleCode`,`sr`.`VBNOmschrijving` AS `product_name`,`s`.`company_name` AS `company_name`,cast(`sr`.`Price` as decimal(10,3)) AS `Price`,`sr`.`Quality` AS `Quality`,`sr`.`s1` AS `s1`,`sr`.`s2` AS `s2`,`sr`.`s3` AS `s3`,`sr`.`s4` AS `s4`,`sr`.`s5` AS `s5`,`sr`.`s6` AS `s6`,`sr`.`NumberOfUnits` AS `NumberOfUnits`,least(if(`sr`.`EmbalageCode` = 800,`sr`.`EmbalageCode` * 10 + `sr`.`NumberOfItemsPerCask`,`sr`.`EmbalageCode`),ifnull(`idt`.`bucket_id`,'999')) AS `EmbalageCode`,`di`.`LatestDeliveryDateTime` AS `LatestDeliveryDateTime`,`di`.`EarliestDespatchDateTime` AS `EarliestDespatchDateTime`,`di`.`FirstOrderDateTime` AS `FirstOrderDateTime`,`di`.`LatestOrderDateTime` AS `LatestOrderDateTime`,`sr`.`NumberOfItemsPerCask` AS `NumberOfItemsPerCask`,`sr`.`NumberOfLayersPerTrolley` AS `NumberOfLayersPerTrolley`,`sr`.`MinimumNumberToOrder` AS `MinimumNumberToOrder`,`sr`.`MaximumNumberToOrder` AS `MaximumNumberToOrder`,`sr`.`IncrementalOrderableQuantity` AS `IncrementalOrderableQuantity`,`sr`.`PackingPrice` AS `PackingPrice`,`sr`.`MarketPlaceID` AS `MarketPlaceID`,`sr`.`PictureReference` AS `PictureReference`,`sr`.`updated` AS `supplyResponseUpdated`,`i`.`group_id` AS `group_id`,`mp`.`name` AS `marketPlace`,`di`.`DeliveryPrice` AS `DeliveryPrice`,`di`.`ChargeAmount` AS `ChargeAmount`,`di`.`MinimumQuantity` AS `MinimumQuantity`,`di`.`MaximumQuantity Integer` AS `MaximumQuantity`,cast(`sr`.`MinimumNumberToOrder` * (case `sr`.`MinimumOrderUnitType` when 1 then 1 when 2 then `sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask` when 3 then `sr`.`NumberOfItemsPerCask` when 4 then floor(128 * 56 / (`b`.`x_size` * `b`.`y_size`)) * `sr`.`NumberOfItemsPerCask` when 5 then floor(128 * 56 / (`b`.`x_size` * `b`.`y_size`)) * `sr`.`NumberOfItemsPerCask` * `sr`.`NumberOfLayersPerTrolley` end) as decimal(10,0)) AS `OrderUnit`,cast(`sr`.`IncrementalOrderableQuantity` * (case `sr`.`IncrementalOrderableQuantityType` when 1 then 1 when 2 then `sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask` when 3 then `sr`.`NumberOfItemsPerCask` when 4 then floor(128 * 56 / (`b`.`x_size` * `b`.`y_size`)) * `sr`.`NumberOfItemsPerCask` when 5 then floor(128 * 56 / (`b`.`x_size` * `b`.`y_size`)) * `sr`.`NumberOfItemsPerCask` * `sr`.`NumberOfLayersPerTrolley` end) as decimal(10,0)) AS `IncrementalOrderUnit`,`mp`.`isEarlyBird` AS `isEarlyBird`,`v`.`isVNHSupplier` AS `isVNHSupplier`,`igo`.`expenseFk` AS `expenseFk`,`igo`.`intrastatFk` AS `intrastatFk`,`igo`.`originFk` AS `originFk`,ifnull(`idt`.`itemTypeFk`,`igo`.`itemTypeFk`) AS `itemTypeFk` from (((((((((`edi`.`deliveryInformation` `di` join `edi`.`supplyResponse` `sr` on(`sr`.`ID` = `di`.`supplyResponseID`)) left join `edi`.`supplier` `s` on(`s`.`glnAddressCode` = `sr`.`SupplierGLN`)) join `edi`.`bucket` `b` on(`b`.`bucket_id` = `sr`.`EmbalageCode`)) join `edi`.`item` `i` on(`i`.`id` = `sr`.`Item_ArticleCode`)) join `edi`.`marketPlace` `mp` on(`mp`.`id` = `sr`.`MarketPlaceID`)) join `vn`.`floramondoConfig` `fm`) left join `edi`.`item_defaultType` `idt` on(`idt`.`item_id` = `i`.`id`)) join `edi`.`VMPSettings` `v` on(`v`.`VMPID` = `sr`.`vmpID`)) join `edi`.`item_groupToOffer` `igo` on(`igo`.`group_code` = `i`.`group_id`)) where `v`.`isBlocked` = 0 and `s`.`isBanned` = 0 and `sr`.`NumberOfUnits` > 0 and current_timestamp() between `di`.`FirstOrderDateTime` and `di`.`LatestOrderDateTime` and `mp`.`isOffered` = 1 and `di`.`LatestDeliveryDateTime` between cast(`fm`.`nextLanded` as date) and concat(cast(`fm`.`nextLanded` as date),' ',`fm`.`MaxLatestDeliveryHour`) group by `sr`.`ID` having `EmbalageCode` <> 999 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94672,7 +94233,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mainAccountBank` AS select `e`.`name` AS `name`,`a`.`iban` AS `iban` from ((`hedera`.`mainAccount` `c` join `vn`.`supplierAccount` `a` on((`a`.`id` = `c`.`accountFk`))) join `vn`.`bankEntity` `e` on((`e`.`id` = `a`.`bankEntityFk`))) */; +/*!50001 VIEW `mainAccountBank` AS select `e`.`name` AS `name`,`a`.`iban` AS `iban` from ((`hedera`.`mainAccount` `c` join `vn`.`supplierAccount` `a` on(`a`.`id` = `c`.`accountFk`)) join `vn`.`bankEntity` `e` on(`e`.`id` = `a`.`bankEntityFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94691,7 +94252,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myAddress` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`street` AS `street`,`t`.`city` AS `city`,`t`.`postalCode` AS `postalCode`,`t`.`provinceFk` AS `provinceFk`,`t`.`nickname` AS `nickname`,`t`.`isDefaultAddress` AS `isDefaultAddress`,`t`.`isActive` AS `isActive`,`t`.`longitude` AS `longitude`,`t`.`latitude` AS `latitude`,`t`.`agencyModeFk` AS `agencyModeFk` from `vn`.`address` `t` where (`t`.`clientFk` = `account`.`myUser_getId`()) */ +/*!50001 VIEW `myAddress` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`street` AS `street`,`t`.`city` AS `city`,`t`.`postalCode` AS `postalCode`,`t`.`provinceFk` AS `provinceFk`,`t`.`nickname` AS `nickname`,`t`.`isDefaultAddress` AS `isDefaultAddress`,`t`.`isActive` AS `isActive`,`t`.`longitude` AS `longitude`,`t`.`latitude` AS `latitude`,`t`.`agencyModeFk` AS `agencyModeFk` from `vn`.`address` `t` where `t`.`clientFk` = `account`.`myUser_getId`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94711,7 +94272,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasket` AS select `o`.`id` AS `id`,`o`.`date_make` AS `made`,`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` from `hedera`.`order` `o` where (`o`.`id` = `MYBASKET_GETID`()) */ +/*!50001 VIEW `myBasket` AS select `o`.`id` AS `id`,`o`.`date_make` AS `made`,`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` from `hedera`.`order` `o` where `o`.`id` = `MYBASKET_GETID`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94731,7 +94292,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasketDefaults` AS select coalesce(`dm`.`code`,`cm`.`code`) AS `deliveryMethod`,coalesce(`ad`.`agencyModeFk`,`oc`.`defaultAgencyFk`) AS `agencyModeFk`,`c`.`defaultAddressFk` AS `addressFk`,`oc`.`defaultAgencyFk` AS `defaultAgencyFk` from ((((((`hedera`.`orderConfig` `oc` join `vn`.`agencyMode` `ca` on((`ca`.`id` = `oc`.`defaultAgencyFk`))) join `vn`.`deliveryMethod` `cm` on((`cm`.`id` = `ca`.`deliveryMethodFk`))) left join `vn`.`client` `c` on((`c`.`id` = `account`.`myUser_getId`()))) left join `vn`.`address` `ad` on((`ad`.`id` = `c`.`defaultAddressFk`))) left join `vn`.`agencyMode` `a` on((`a`.`id` = `ad`.`agencyModeFk`))) left join `vn`.`deliveryMethod` `dm` on((`dm`.`id` = `a`.`deliveryMethodFk`))) */; +/*!50001 VIEW `myBasketDefaults` AS select coalesce(`dm`.`code`,`cm`.`code`) AS `deliveryMethod`,coalesce(`ad`.`agencyModeFk`,`oc`.`defaultAgencyFk`) AS `agencyModeFk`,`c`.`defaultAddressFk` AS `addressFk`,`oc`.`defaultAgencyFk` AS `defaultAgencyFk` from ((((((`hedera`.`orderConfig` `oc` join `vn`.`agencyMode` `ca` on(`ca`.`id` = `oc`.`defaultAgencyFk`)) join `vn`.`deliveryMethod` `cm` on(`cm`.`id` = `ca`.`deliveryMethodFk`)) left join `vn`.`client` `c` on(`c`.`id` = `account`.`myUser_getId`())) left join `vn`.`address` `ad` on(`ad`.`id` = `c`.`defaultAddressFk`)) left join `vn`.`agencyMode` `a` on(`a`.`id` = `ad`.`agencyModeFk`)) left join `vn`.`deliveryMethod` `dm` on(`dm`.`id` = `a`.`deliveryMethodFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94750,7 +94311,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasketItem` AS select `r`.`id` AS `id`,`r`.`orderFk` AS `orderFk`,`r`.`warehouseFk` AS `warehouseFk`,`r`.`itemFk` AS `itemFk`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`orderRow` `r` where (`r`.`orderFk` = `MYBASKET_GETID`()) */ +/*!50001 VIEW `myBasketItem` AS select `r`.`id` AS `id`,`r`.`orderFk` AS `orderFk`,`r`.`warehouseFk` AS `warehouseFk`,`r`.`itemFk` AS `itemFk`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`orderRow` `r` where `r`.`orderFk` = `MYBASKET_GETID`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94770,7 +94331,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myClient` AS select `c`.`id` AS `id`,`c`.`isToBeMailed` AS `isToBeMailed`,`c`.`defaultAddressFk` AS `defaultAddressFk`,`c`.`credit` AS `credit` from `vn`.`client` `c` where (`c`.`id` = `account`.`myUser_getId`()) */ +/*!50001 VIEW `myClient` AS select `c`.`id` AS `id`,`c`.`isToBeMailed` AS `isToBeMailed`,`c`.`defaultAddressFk` AS `defaultAddressFk`,`c`.`credit` AS `credit` from `vn`.`client` `c` where `c`.`id` = `account`.`myUser_getId`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94790,7 +94351,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount`,`i`.`hasPdf` AS `hasPdf` from `vn`.`invoiceOut` `i` where (`i`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount`,`i`.`hasPdf` AS `hasPdf` from `vn`.`invoiceOut` `i` where `i`.`clientFk` = `account`.`myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94809,7 +94370,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myMenu` AS select `t`.`id` AS `id`,`t`.`path` AS `path`,`t`.`description` AS `description`,`t`.`parentFk` AS `parentFk` from (`hedera`.`menu` `t` join `account`.`myRole` `r` on((`r`.`id` = `t`.`roleFk`))) order by `t`.`parentFk`,`t`.`displayOrder`,`t`.`id` */; +/*!50001 VIEW `myMenu` AS select `t`.`id` AS `id`,`t`.`path` AS `path`,`t`.`description` AS `description`,`t`.`parentFk` AS `parentFk` from (`hedera`.`menu` `t` join `account`.`myRole` `r` on(`r`.`id` = `t`.`roleFk`)) order by `t`.`parentFk`,`t`.`displayOrder`,`t`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94828,7 +94389,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrder` AS select `o`.`id` AS `id`,`o`.`date_send` AS `landed`,`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 `note`,`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` from `hedera`.`order` `o` where (`o`.`customer_id` = `account`.`myUser_getId`()) */; +/*!50001 VIEW `myOrder` AS select `o`.`id` AS `id`,`o`.`date_send` AS `landed`,`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 `note`,`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` from `hedera`.`order` `o` where `o`.`customer_id` = `account`.`myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94847,7 +94408,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrderRow` AS select `orw`.`id` AS `id`,`orw`.`order_id` AS `Fk`,`orw`.`item_id` AS `itemFk`,`orw`.`warehouse_id` AS `warehouseFk`,`orw`.`shipment` AS `shipped`,`orw`.`amount` AS `amount`,`orw`.`price` AS `price`,`orw`.`rate` AS `rate`,`orw`.`created` AS `created`,`orw`.`Id_Movimiento` AS `saleFk` from (`hedera`.`order_row` `orw` join `hedera`.`myOrder` `o` on((`o`.`id` = `orw`.`order_id`))) */ +/*!50001 VIEW `myOrderRow` AS select `orw`.`id` AS `id`,`orw`.`order_id` AS `Fk`,`orw`.`item_id` AS `itemFk`,`orw`.`warehouse_id` AS `warehouseFk`,`orw`.`shipment` AS `shipped`,`orw`.`amount` AS `amount`,`orw`.`price` AS `price`,`orw`.`rate` AS `rate`,`orw`.`created` AS `created`,`orw`.`Id_Movimiento` AS `saleFk` from (`hedera`.`order_row` `orw` join `hedera`.`myOrder` `o` on(`o`.`id` = `orw`.`order_id`)) */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94867,7 +94428,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrderTicket` AS select `o`.`id` AS `orderFk`,`ot`.`ticketFk` AS `ticketFk` from (`hedera`.`myOrder` `o` join `hedera`.`orderTicket` `ot` on((`ot`.`orderFk` = `o`.`id`))) */; +/*!50001 VIEW `myOrderTicket` AS select `o`.`id` AS `orderFk`,`ot`.`ticketFk` AS `ticketFk` from (`hedera`.`myOrder` `o` join `hedera`.`orderTicket` `ot` on(`ot`.`orderFk` = `o`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94886,7 +94447,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicket` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`t`.`nickname` AS `nickname`,`t`.`agencyModeFk` AS `agencyModeFk`,`t`.`refFk` AS `refFk`,`t`.`addressFk` AS `addressFk`,`t`.`location` AS `location`,`t`.`companyFk` AS `companyFk` from `vn`.`ticket` `t` where (`t`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 VIEW `myTicket` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`t`.`nickname` AS `nickname`,`t`.`agencyModeFk` AS `agencyModeFk`,`t`.`refFk` AS `refFk`,`t`.`addressFk` AS `addressFk`,`t`.`location` AS `location`,`t`.`companyFk` AS `companyFk` from `vn`.`ticket` `t` where `t`.`clientFk` = `account`.`myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94905,7 +94466,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicketRow` AS select `s`.`id` AS `id`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`s`.`reserved` AS `reserved`,`s`.`isPicked` AS `isPicked` from (`vn`.`sale` `s` join `hedera`.`myTicket` `t` on((`s`.`ticketFk` = `t`.`id`))) */ +/*!50001 VIEW `myTicketRow` AS select `s`.`id` AS `id`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`s`.`reserved` AS `reserved`,`s`.`isPicked` AS `isPicked` from (`vn`.`sale` `s` join `hedera`.`myTicket` `t` on(`s`.`ticketFk` = `t`.`id`)) */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94925,7 +94486,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicketService` AS select `s`.`id` AS `id`,`s`.`description` AS `description`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`taxClassFk` AS `taxClassFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`ticketServiceTypeFk` AS `ticketServiceTypeFk` from (`vn`.`ticketService` `s` join `hedera`.`myTicket` `t` on((`s`.`ticketFk` = `t`.`id`))) */ +/*!50001 VIEW `myTicketService` AS select `s`.`id` AS `id`,`s`.`description` AS `description`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`taxClassFk` AS `taxClassFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`ticketServiceTypeFk` AS `ticketServiceTypeFk` from (`vn`.`ticketService` `s` join `hedera`.`myTicket` `t` on(`s`.`ticketFk` = `t`.`id`)) */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -94945,7 +94506,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicketState` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`t`.`nickname` AS `nickname`,`t`.`agencyModeFk` AS `agencyModeFk`,`t`.`refFk` AS `refFk`,`t`.`addressFk` AS `addressFk`,`t`.`location` AS `location`,`t`.`companyFk` AS `companyFk`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`code` AS `code` from (`vn`.`ticket` `t` left join `vn`.`ticketState` `ts` on((`ts`.`ticketFk` = `t`.`id`))) where (`t`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 VIEW `myTicketState` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`t`.`nickname` AS `nickname`,`t`.`agencyModeFk` AS `agencyModeFk`,`t`.`refFk` AS `refFk`,`t`.`addressFk` AS `addressFk`,`t`.`location` AS `location`,`t`.`companyFk` AS `companyFk`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`code` AS `code` from (`vn`.`ticket` `t` left join `vn`.`ticketState` `ts` on(`ts`.`ticketFk` = `t`.`id`)) where `t`.`clientFk` = `account`.`myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -94964,7 +94525,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTpvTransaction` AS select `t`.`id` AS `id`,`t`.`merchantFk` AS `merchantFk`,`t`.`clientFk` AS `clientFk`,`t`.`receiptFk` AS `receiptFk`,`t`.`amount` AS `amount`,`t`.`response` AS `response`,`t`.`status` AS `status`,`t`.`created` AS `created` from `hedera`.`tpvTransaction` `t` where (`t`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 VIEW `myTpvTransaction` AS select `t`.`id` AS `id`,`t`.`merchantFk` AS `merchantFk`,`t`.`clientFk` AS `clientFk`,`t`.`receiptFk` AS `receiptFk`,`t`.`amount` AS `amount`,`t`.`response` AS `response`,`t`.`status` AS `status`,`t`.`created` AS `created` from `hedera`.`tpvTransaction` `t` where `t`.`clientFk` = `account`.`myUser_getId`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95109,7 +94670,7 @@ USE `pbx`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `queueConf` AS select `q`.`name` AS `name`,`c`.`strategy` AS `strategy`,`c`.`timeout` AS `timeout`,`c`.`retry` AS `retry`,`c`.`weight` AS `weight`,`c`.`maxLen` AS `maxlen`,`c`.`ringInUse` AS `ringinuse` from (`queue` `q` join `queueConfig` `c` on((`q`.`config` = `c`.`id`))) */; +/*!50001 VIEW `queueConf` AS select `q`.`name` AS `name`,`c`.`strategy` AS `strategy`,`c`.`timeout` AS `timeout`,`c`.`retry` AS `retry`,`c`.`weight` AS `weight`,`c`.`maxLen` AS `maxlen`,`c`.`ringInUse` AS `ringinuse` from (`queue` `q` join `queueConfig` `c` on(`q`.`config` = `c`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95147,7 +94708,7 @@ USE `pbx`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on((`u`.`id` = `s`.`user_id`))) left join `pbx`.`sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `pbx`.`sipConfig` `c`) */; +/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on(`u`.`id` = `s`.`user_id`)) left join `pbx`.`sipReg` `r` on(`s`.`user_id` = `r`.`userId`)) join `pbx`.`sipConfig` `c`) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95216,7 +94777,7 @@ USE `sage`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientLastTwoMonths` AS select `vn`.`invoiceOut`.`clientFk` AS `clientFk`,`vn`.`invoiceOut`.`companyFk` AS `companyFk` from `vn`.`invoiceOut` where (`vn`.`invoiceOut`.`issued` > (curdate() - interval 2 month)) union select `vn`.`receipt`.`clientFk` AS `clientFk`,`vn`.`receipt`.`companyFk` AS `companyFk` from `vn`.`receipt` where (`vn`.`receipt`.`payed` > (curdate() - interval 2 month)) */; +/*!50001 VIEW `clientLastTwoMonths` AS select `vn`.`invoiceOut`.`clientFk` AS `clientFk`,`vn`.`invoiceOut`.`companyFk` AS `companyFk` from `vn`.`invoiceOut` where `vn`.`invoiceOut`.`issued` > util.VN_CURDATE() - interval 2 month union select `vn`.`receipt`.`clientFk` AS `clientFk`,`vn`.`receipt`.`companyFk` AS `companyFk` from `vn`.`receipt` where `vn`.`receipt`.`payed` > util.VN_CURDATE() - interval 2 month */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95235,7 +94796,7 @@ USE `sage`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInList` AS select `vn`.`invoiceIn`.`id` AS `id`,`vn`.`invoiceIn`.`supplierRef` AS `supplierRef`,`vn`.`invoiceIn`.`serial` AS `serial`,`vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`issued` AS `issued`,if((`vn`.`invoiceIn`.`expenceFkDeductible` > 0),1,0) AS `isVatDeductible`,`vn`.`invoiceIn`.`serialNumber` AS `serialNumber` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` >= (date_format(curdate(),'%Y-01-01') + interval -(1) year)) union all select `vn`.`dua`.`id` AS `id`,`vn`.`dua`.`code` AS `code`,'D' AS `D`,`c`.`id` AS `supplierFk`,`vn`.`dua`.`issued` AS `issued`,0 AS `FALSE`,`vn`.`dua`.`id` AS `serialNumber` from (`vn`.`dua` join `vn`.`company` `c` on((`c`.`code` = 'VNL'))) */; +/*!50001 VIEW `invoiceInList` AS select `vn`.`invoiceIn`.`id` AS `id`,`vn`.`invoiceIn`.`supplierRef` AS `supplierRef`,`vn`.`invoiceIn`.`serial` AS `serial`,`vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`issued` AS `issued`,if(`vn`.`invoiceIn`.`expenceFkDeductible` > 0,1,0) AS `isVatDeductible`,`vn`.`invoiceIn`.`serialNumber` AS `serialNumber` from `vn`.`invoiceIn` where `vn`.`invoiceIn`.`issued` >= date_format(util.VN_CURDATE(),'%Y-01-01') + interval -1 year union all select `vn`.`dua`.`id` AS `id`,`vn`.`dua`.`code` AS `code`,'D' AS `D`,`c`.`id` AS `supplierFk`,`vn`.`dua`.`issued` AS `issued`,0 AS `FALSE`,`vn`.`dua`.`id` AS `serialNumber` from (`vn`.`dua` join `vn`.`company` `c` on(`c`.`code` = 'VNL')) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95254,7 +94815,7 @@ USE `sage`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `providerLastThreeMonths` AS select `vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`companyFk` AS `companyFk` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` > (curdate() - interval 3 month)) union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where (`vn`.`payment`.`received` > (curdate() + interval -(3) month)) */; +/*!50001 VIEW `providerLastThreeMonths` AS select `vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`companyFk` AS `companyFk` from `vn`.`invoiceIn` where `vn`.`invoiceIn`.`issued` > util.VN_CURDATE() - interval 3 month union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where `vn`.`payment`.`received` > util.VN_CURDATE() + interval -3 month */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95317,7 +94878,7 @@ USE `salix`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `RoleMapping` AS select ((`u`.`id` * 1000) + `r`.`inheritsFrom`) AS `id`,'USER' AS `principalType`,`u`.`id` AS `principalId`,`r`.`inheritsFrom` AS `roleId` from (`account`.`user` `u` join `account`.`roleRole` `r` on((`r`.`role` = `u`.`role`))) */; +/*!50001 VIEW `RoleMapping` AS select `u`.`id` * 1000 + `r`.`inheritsFrom` AS `id`,'USER' AS `principalType`,`u`.`id` AS `principalId`,`r`.`inheritsFrom` AS `roleId` from (`account`.`user` `u` join `account`.`roleRole` `r` on(`r`.`role` = `u`.`role`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95373,26 +94934,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `NewView` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) month))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `__coolerPathDetail` --- - -/*!50001 DROP TABLE IF EXISTS `__coolerPathDetail`*/; -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */; +/*!50001 VIEW `NewView` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(`c`.`id` = `t`.`clientFk` and `t`.`shipped` < util.VN_CURDATE() + interval (-`pc`.`rookieDays`) day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_CURDATE() + interval (-`notBuyingMonths`) month */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95417,20 +94959,20 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `agencyProvince__` +-- Final view structure for view `agencyTerm` -- -/*!50001 DROP TABLE IF EXISTS `agencyProvince__`*/; -/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; +/*!50001 DROP TABLE IF EXISTS `agencyTerm`*/; +/*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyProvince__` AS select `a`.`province_id` AS `provinceFk`,`a`.`agency_id` AS `agencyFk`,`a`.`zona` AS `zone`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`isVolumetric` AS `isVolumetric` from `vn2008`.`Agencias_province` `a` */; +/*!50001 VIEW `agencyTerm` AS select `sat`.`agencyFk` AS `agencyFk`,`sat`.`minimumPackages` AS `minimumPackages`,`sat`.`kmPrice` AS `kmPrice`,`sat`.`packagePrice` AS `packagePrice`,`sat`.`routePrice` AS `routePrice`,`sat`.`minimumKm` AS `minimumKm`,`sat`.`minimumM3` AS `minimumM3`,`sat`.`m3Price` AS `m3Price` from `supplierAgencyTerm` `sat` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95473,25 +95015,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `awb__` --- - -/*!50001 DROP TABLE IF EXISTS `awb__`*/; -/*!50001 DROP VIEW IF EXISTS `awb__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `awb__` AS select `a`.`id` AS `id`,`a`.`codigo` AS `code`,`a`.`bultos` AS `package`,`a`.`peso` AS `weight`,`a`.`MYSQL_TIME` AS `created`,`a`.`transitario_id` AS `transitoryFk`,`a`.`iva_id` AS `taxFk`,`a`.`gestdoc_id` AS `docFk`,`a`.`importe` AS `amount`,`a`.`carguera_id` AS `freightFk`,`a`.`m3` AS `m3`,`a`.`stems` AS `stems`,`a`.`flight_id` AS `flightFk`,`a`.`volume_weight` AS `volumeWeight`,`a`.`hb` AS `hb`,`a`.`rate` AS `rate`,`a`.`booked` AS `booked`,`a`.`issued` AS `issued`,`a`.`operated` AS `operated`,`a`.`bookEntried` AS `bookEntried`,`a`.`invoiceInFk` AS `invoiceInFk`,`a`.`isChecked` AS `isChecked` from `vn2008`.`awb` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `bank` -- @@ -95511,25 +95034,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `bankPolicy` --- - -/*!50001 DROP TABLE IF EXISTS `bankPolicy`*/; -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bankPolicy` AS select `bp`.`poliza_id` AS `id`,`bp`.`referencia` AS `ref`,`bp`.`importe` AS `amount`,`bp`.`com_dispuesto` AS `balanceInterestDrawn`,`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,`bp`.`com_anual` AS `openingCommission`,`bp`.`apertura` AS `started`,`bp`.`cierre` AS `ended`,`bp`.`Id_Banco` AS `bankFk`,`bp`.`empresa_id` AS `companyFk`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn2008`.`Bancos_poliza` `bp` order by `bp`.`poliza_id` desc */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `businessCalendar` -- @@ -95563,7 +95067,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `buyer` AS select distinct `u`.`id` AS `userFk`,`u`.`nickname` AS `nickname` from (`account`.`user` `u` join `vn`.`itemType` `it` on((`it`.`workerFk` = `u`.`id`))) where `u`.`active` order by `u`.`nickname` */; +/*!50001 VIEW `buyer` AS select distinct `u`.`id` AS `userFk`,`u`.`nickname` AS `nickname` from (`account`.`user` `u` join `vn`.`itemType` `it` on(`it`.`workerFk` = `u`.`id`)) where `u`.`active` <> 0 order by `u`.`nickname` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95582,7 +95086,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `buyerSales` AS select `v`.`importe` AS `importe`,`w`.`code` AS `comprador`,`t`.`year` AS `año`,`t`.`week` AS `semana` from (((`bs`.`ventas` `v` join `vn`.`time` `t` on((`t`.`dated` = `v`.`fecha`))) join `vn`.`itemType` `it` on((`it`.`id` = `v`.`tipo_id`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) */; +/*!50001 VIEW `buyerSales` AS select `v`.`importe` AS `importe`,`w`.`code` AS `comprador`,`t`.`year` AS `año`,`t`.`week` AS `semana` from (((`bs`.`ventas` `v` join `vn`.`time` `t` on(`t`.`dated` = `v`.`fecha`)) join `vn`.`itemType` `it` on(`it`.`id` = `v`.`tipo_id`)) join `vn`.`worker` `w` on(`w`.`id` = `it`.`workerFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95606,25 +95110,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `claimRatio__` --- - -/*!50001 DROP TABLE IF EXISTS `claimRatio__`*/; -/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `claimRatio__` AS select `claims_ratio`.`Id_Cliente` AS `clientFk`,`claims_ratio`.`Consumo` AS `yearSale`,`claims_ratio`.`Reclamaciones` AS `claimAmount`,`claims_ratio`.`Ratio` AS `claimingRate`,`claims_ratio`.`recobro` AS `priceIncreasing`,`claims_ratio`.`inflacion` AS `packingRate` from `bi`.`claims_ratio` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `clientLost` -- @@ -95639,7 +95124,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientLost` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) month))) */; +/*!50001 VIEW `clientLost` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(`c`.`id` = `t`.`clientFk` and `t`.`shipped` < util.VN_CURDATE() + interval (-`pc`.`rookieDays`) day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_CURDATE() + interval (-`notBuyingMonths`) month */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95677,26 +95162,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientPhoneBook` AS select `c`.`id` AS `clientFk`,trim(`c`.`phone`) AS `phone` from `client` `c` where (`c`.`phone` and `c`.`isActive`) union select `c`.`id` AS `clientFk`,trim(`c`.`mobile`) AS `phone` from `client` `c` where (`c`.`mobile` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`phone`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`phone` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`mobile`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`mobile` and `c`.`isActive`) union select `cc`.`clientFk` AS `clientFk`,trim(`cc`.`phone`) AS `phone` from (`clientContact` `cc` left join `client` `c` on((`c`.`id` = `cc`.`clientFk`))) where (`c`.`phone` and `c`.`isActive`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientRisk__` --- - -/*!50001 DROP TABLE IF EXISTS `clientRisk__`*/; -/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientRisk__` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk__` `c` */; +/*!50001 VIEW `clientPhoneBook` AS select `c`.`id` AS `clientFk`,trim(`c`.`phone`) AS `phone` from `client` `c` where `c`.`phone` <> 0 and `c`.`isActive` <> 0 union select `c`.`id` AS `clientFk`,trim(`c`.`mobile`) AS `phone` from `client` `c` where `c`.`mobile` <> 0 and `c`.`isActive` <> 0 union select `a`.`clientFk` AS `clientFk`,trim(`a`.`phone`) AS `phone` from (`address` `a` join `client` `c` on(`c`.`id` = `a`.`clientFk`)) where `a`.`phone` <> 0 and `c`.`isActive` <> 0 union select `a`.`clientFk` AS `clientFk`,trim(`a`.`mobile`) AS `phone` from (`address` `a` join `client` `c` on(`c`.`id` = `a`.`clientFk`)) where `a`.`mobile` <> 0 and `c`.`isActive` <> 0 union select `cc`.`clientFk` AS `clientFk`,trim(`cc`.`phone`) AS `phone` from (`clientContact` `cc` left join `client` `c` on(`c`.`id` = `cc`.`clientFk`)) where `c`.`phone` <> 0 and `c`.`isActive` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95715,7 +95181,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`cmr`.`packagesList` AS `packagesList`,`aTo`.`nickname` AS `clientName`,`aTo`.`postalCode` AS `clientPostalCode`,`aTo`.`street` AS `clientStreet`,`aTo`.`city` AS `clientCity`,`pTo`.`name` AS `clientProvince`,`cTo`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`cSu`.`country` AS `companyCountry`,concat(`aFrom`.`street`,' ',`aFrom`.`postalCode`,' ',`aFrom`.`city`,' (',`cFrom`.`country`,')') AS `warehouseAddress`,`cmr`.`created` AS `shipped`,`aTo`.`nickname` AS `clientOficialName`,`cmr`.`supplierFk` AS `supplierFk`,`aSu`.`name` AS `carrierName`,`aSu`.`street` AS `carrierStreet`,`aSu`.`postCode` AS `carrierPostCode`,`aSu`.`city` AS `carrierCity`,`cAs`.`country` AS `carrierCountry`,ifnull(`aTo`.`phone`,`client`.`phone`) AS `phone`,ifnull(`aTo`.`mobile`,`client`.`mobile`) AS `mobile`,`aTo`.`id` AS `addressFk`,`c`.`stamp` AS `stamp`,`cmr`.`merchandiseDetail` AS `merchandiseDetail` from ((((((((((((`cmr` left join `address` `aTo` on((`aTo`.`id` = `cmr`.`addressToFk`))) left join `province` `pTo` on((`pTo`.`id` = `aTo`.`provinceFk`))) left join `country` `cTo` on((`cTo`.`id` = `pTo`.`countryFk`))) left join `client` on((`client`.`id` = `aTo`.`clientFk`))) left join `supplier` `su` on((`su`.`id` = `cmr`.`companyFk`))) left join `country` `cSu` on((`cSu`.`id` = `su`.`countryFk`))) left join `address` `aFrom` on((`aFrom`.`id` = `cmr`.`addressFromFk`))) left join `province` `pFrom` on((`pFrom`.`id` = `aFrom`.`provinceFk`))) left join `country` `cFrom` on((`cFrom`.`id` = `pFrom`.`countryFk`))) left join `supplier` `aSu` on((`aSu`.`id` = `cmr`.`supplierFk`))) left join `country` `cAs` on((`cAs`.`id` = `aSu`.`countryFk`))) join `company` `c` on((`c`.`id` = `cmr`.`companyFk`))) */; +/*!50001 VIEW `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`cmr`.`packagesList` AS `packagesList`,`aTo`.`nickname` AS `clientName`,`aTo`.`postalCode` AS `clientPostalCode`,`aTo`.`street` AS `clientStreet`,`aTo`.`city` AS `clientCity`,`pTo`.`name` AS `clientProvince`,`cTo`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`cSu`.`country` AS `companyCountry`,concat(`aFrom`.`street`,' ',`aFrom`.`postalCode`,' ',`aFrom`.`city`,' (',`cFrom`.`country`,')') AS `warehouseAddress`,`cmr`.`created` AS `shipped`,`aTo`.`nickname` AS `clientOficialName`,`cmr`.`supplierFk` AS `supplierFk`,`aSu`.`name` AS `carrierName`,`aSu`.`street` AS `carrierStreet`,`aSu`.`postCode` AS `carrierPostCode`,`aSu`.`city` AS `carrierCity`,`cAs`.`country` AS `carrierCountry`,ifnull(`aTo`.`phone`,`client`.`phone`) AS `phone`,ifnull(`aTo`.`mobile`,`client`.`mobile`) AS `mobile`,`aTo`.`id` AS `addressFk`,`c`.`stamp` AS `stamp`,`cmr`.`merchandiseDetail` AS `merchandiseDetail` from ((((((((((((`cmr` left join `address` `aTo` on(`aTo`.`id` = `cmr`.`addressToFk`)) left join `province` `pTo` on(`pTo`.`id` = `aTo`.`provinceFk`)) left join `country` `cTo` on(`cTo`.`id` = `pTo`.`countryFk`)) left join `client` on(`client`.`id` = `aTo`.`clientFk`)) left join `supplier` `su` on(`su`.`id` = `cmr`.`companyFk`)) left join `country` `cSu` on(`cSu`.`id` = `su`.`countryFk`)) left join `address` `aFrom` on(`aFrom`.`id` = `cmr`.`addressFromFk`)) left join `province` `pFrom` on(`pFrom`.`id` = `aFrom`.`provinceFk`)) left join `country` `cFrom` on(`cFrom`.`id` = `pFrom`.`countryFk`)) left join `supplier` `aSu` on(`aSu`.`id` = `cmr`.`supplierFk`)) left join `country` `cAs` on(`cAs`.`id` = `aSu`.`countryFk`)) join `company` `c` on(`c`.`id` = `cmr`.`companyFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95734,7 +95200,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionReportSource` AS select `tc`.`collectionFk` AS `collectionFk`,`tc`.`ticketFk` AS `ticketFk`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`s`.`quantity` AS `quantity`,`ip`.`code` AS `nicho`,`tc`.`level` AS `level` from (((((`collection` `c` join `ticketCollection` `tc` on((`tc`.`collectionFk` = `c`.`id`))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) left join `itemPlacement` `ip` on(((`ip`.`itemFk` = `s`.`itemFk`) and (`ip`.`warehouseFk` = `t`.`warehouseFk`)))) */; +/*!50001 VIEW `collectionReportSource` AS select `tc`.`collectionFk` AS `collectionFk`,`tc`.`ticketFk` AS `ticketFk`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`s`.`quantity` AS `quantity`,`ip`.`code` AS `nicho`,`tc`.`level` AS `level` from (((((`collection` `c` join `ticketCollection` `tc` on(`tc`.`collectionFk` = `c`.`id`)) join `ticket` `t` on(`t`.`id` = `tc`.`ticketFk`)) join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) left join `itemPlacement` `ip` on(`ip`.`itemFk` = `s`.`itemFk` and `ip`.`warehouseFk` = `t`.`warehouseFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95753,7 +95219,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionSmartTag` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk` from (((((`ticketCollection` `tc` join `smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) */; +/*!50001 VIEW `collectionSmartTag` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk` from (((((`ticketCollection` `tc` join `smartTag` `st` on(`st`.`code` = `tc`.`smartTagFk` collate utf8_general_ci)) join `ticket` `t` on(`t`.`id` = `tc`.`ticketFk`)) join `collection` `c` on(`c`.`id` = `tc`.`collectionFk`)) join `worker` `w` on(`w`.`id` = `c`.`workerFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95772,83 +95238,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionSmartTag2` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk`,`u`.`name` AS `worker`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed` from ((((((`vn`.`ticketCollection` `tc` join `vn`.`smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `vn`.`ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `vn`.`collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `vn`.`worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `account`.`user` `u` on((`u`.`id` = `w`.`id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `componentRate__` --- - -/*!50001 DROP TABLE IF EXISTS `componentRate__`*/; -/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentRate__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `componentTypeRate__` --- - -/*!50001 DROP TABLE IF EXISTS `componentTypeRate__`*/; -/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentTypeRate__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `componentType__` --- - -/*!50001 DROP TABLE IF EXISTS `componentType__`*/; -/*!50001 DROP VIEW IF EXISTS `componentType__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentType__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `isBase`,`t`.`margen` AS `isMargin` from `bi`.`tarifa_componentes_series` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `component__` --- - -/*!50001 DROP TABLE IF EXISTS `component__`*/; -/*!50001 DROP VIEW IF EXISTS `component__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `component__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `typeFk`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; +/*!50001 VIEW `collectionSmartTag2` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk`,`u`.`name` AS `worker`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed` from ((((((`vn`.`ticketCollection` `tc` join `vn`.`smartTag` `st` on(`st`.`code` = `tc`.`smartTagFk` collate utf8_general_ci)) join `vn`.`ticket` `t` on(`t`.`id` = `tc`.`ticketFk`)) join `vn`.`collection` `c` on(`c`.`id` = `tc`.`collectionFk`)) join `vn`.`worker` `w` on(`w`.`id` = `c`.`workerFk`)) join `vn`.`agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `account`.`user` `u` on(`u`.`id` = `w`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95886,7 +95276,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),(count(`parent`.`id`) - 1)) using utf8),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where (`node`.`lft` between `parent`.`lft` and `parent`.`rgt`) group by `node`.`id` order by `node`.`lft` */; +/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),count(`parent`.`id`) - 1) using utf8),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where `node`.`lft` between `parent`.`lft` and `parent`.`rgt` group by `node`.`id` order by `node`.`lft` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95943,7 +95333,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ektSubAddress` AS select `eea`.`sub` AS `sub`,`a`.`clientFk` AS `clientFk`,`a`.`nickname` AS `nickname`,`eea`.`addressFk` AS `addressFk` from (`ektEntryAssign` `eea` join `address` `a` on((`a`.`id` = `eea`.`addressFk`))) group by `eea`.`sub` */; +/*!50001 VIEW `ektSubAddress` AS select `eea`.`sub` AS `sub`,`a`.`clientFk` AS `clientFk`,`a`.`nickname` AS `nickname`,`eea`.`addressFk` AS `addressFk` from (`ektEntryAssign` `eea` join `address` `a` on(`a`.`id` = `eea`.`addressFk`)) group by `eea`.`sub` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95962,7 +95352,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `entryList` AS select `e`.`id` AS `entryFk`,if(`tr`.`isReceived`,' x','') AS `isHere`,`tr`.`landed` AS `landed`,ifnull(`s`.`nickname`,`s`.`name`) AS `supplier`,`e`.`ref` AS `entryRef`,`a`.`name` AS `agency`,`tr`.`ref` AS `travelRef`,`tr`.`appointment` AS `appointment`,`e`.`supplierFk` AS `supplierFk`,`tr`.`warehouseInFk` AS `warehouseInFk` from (((`entry` `e` join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) left join `agency` `a` on((`tr`.`agencyFk` = `a`.`id`))) where (`tr`.`landed` between (curdate() + interval -(1) week) and (curdate() + interval 3 month)) order by (`tr`.`landed` < (curdate() + interval 2 day)) desc,`tr`.`landed` desc,ifnull(`s`.`nickname`,`s`.`name`),`e`.`id` desc */; +/*!50001 VIEW `entryList` AS select `e`.`id` AS `entryFk`,if(`tr`.`isReceived`,' x','') AS `isHere`,`tr`.`landed` AS `landed`,ifnull(`s`.`nickname`,`s`.`name`) AS `supplier`,`e`.`ref` AS `entryRef`,`a`.`name` AS `agency`,`tr`.`ref` AS `travelRef`,`tr`.`appointment` AS `appointment`,`e`.`supplierFk` AS `supplierFk`,`tr`.`warehouseInFk` AS `warehouseInFk` from (((`entry` `e` join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `supplier` `s` on(`s`.`id` = `e`.`supplierFk`)) left join `agency` `a` on(`tr`.`agencyFk` = `a`.`id`)) where `tr`.`landed` between util.VN_CURDATE() + interval -1 week and util.VN_CURDATE() + interval 3 month order by `tr`.`landed` < util.VN_CURDATE() + interval 2 day desc,`tr`.`landed` desc,ifnull(`s`.`nickname`,`s`.`name`),`e`.`id` desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95981,26 +95371,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceEntry` AS select max(`tr`.`landed`) AS `dated`,cast(sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) as decimal(10,2)) AS `Dolares`,cast((sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) / sum(((((100 + `e`.`commission`) / 100) * (`b`.`buyingValue` + `b`.`freightValue`)) * `b`.`quantity`))) as decimal(10,4)) AS `rate` from ((`entry` `e` join `buy` `b` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) where ((`tr`.`landed` between '2016-01-31' and curdate()) and (`e`.`commission` < 0) and (`e`.`currencyFk` = 2)) group by month(`tr`.`landed`),year(`tr`.`landed`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeInsuranceIn` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceIn`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceIn` AS select `exchangeInsuranceInPrevious`.`dated` AS `dated`,sum(`exchangeInsuranceInPrevious`.`amount`) AS `amount`,cast((sum((`exchangeInsuranceInPrevious`.`amount` * `exchangeInsuranceInPrevious`.`rate`)) / sum(`exchangeInsuranceInPrevious`.`amount`)) as decimal(10,4)) AS `rate` from `vn`.`exchangeInsuranceInPrevious` group by `exchangeInsuranceInPrevious`.`dated` */; +/*!50001 VIEW `exchangeInsuranceEntry` AS select max(`tr`.`landed`) AS `dated`,cast(sum((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) as decimal(10,2)) AS `Dolares`,cast(sum((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) / sum((100 + `e`.`commission`) / 100 * (`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`) as decimal(10,4)) AS `rate` from ((`entry` `e` join `buy` `b` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) where `tr`.`landed` between '2016-01-31' and util.VN_CURDATE() and `e`.`commission` < 0 and `e`.`currencyFk` = 2 group by month(`tr`.`landed`),year(`tr`.`landed`) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96019,26 +95390,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceOut` AS select `p`.`received` AS `received`,sum(`p`.`divisa`) AS `divisa`,(sum(`p`.`divisa`) / sum(`p`.`amount`)) AS `rate` from ((`payment` `p` join `bank` `b` on((`b`.`id` = `p`.`bankFk`))) join `accountingType` `at2` on((`at2`.`id` = `b`.`cash`))) where ((`p`.`currencyFk` = 2) and (`at2`.`code` = 'wireTransfer') and (`p`.`supplierFk` <> 2213)) group by `p`.`received` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeReportSourcePrevious` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeReportSourcePrevious`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeReportSourcePrevious` AS select `exchangeInsuranceIn`.`dated` AS `dated`,`exchangeInsuranceIn`.`amount` AS `amountIn`,`exchangeInsuranceIn`.`rate` AS `rateIn`,0.00 AS `amountOut`,0.00 AS `rateOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceIn` union all select `exchangeInsuranceOut`.`received` AS `received`,0.00 AS `amountIn`,0.00 AS `ratedIn`,`exchangeInsuranceOut`.`divisa` AS `amountOut`,`exchangeInsuranceOut`.`rate` AS `ratedOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceOut` union all select `exchangeInsuranceEntry`.`dated` AS `dated`,0.00 AS `amountIn`,0.00 AS `ratedIn`,0.00 AS `amountOut`,0.00 AS `ratedOut`,`exchangeInsuranceEntry`.`Dolares` AS `amountEntry`,`exchangeInsuranceEntry`.`rate` AS `rateEntry` from `vn`.`exchangeInsuranceEntry` */; +/*!50001 VIEW `exchangeInsuranceOut` AS select `p`.`received` AS `received`,sum(`p`.`divisa`) AS `divisa`,sum(`p`.`divisa`) / sum(`p`.`amount`) AS `rate` from ((`payment` `p` join `bank` `b` on(`b`.`id` = `p`.`bankFk`)) join `accountingType` `at2` on(`at2`.`id` = `b`.`cash`)) where `p`.`currencyFk` = 2 and `at2`.`code` = 'wireTransfer' and `p`.`supplierFk` <> 2213 group by `p`.`received` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96057,26 +95409,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `etd`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on((`et`.`id` = `r`.`expeditionTruckFk`))) left join `ticket` `t` on((`r`.`routeFk` = `t`.`routeFk`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `expeditionScan` `es` on((`e`.`id` = `es`.`expeditionFk`))) left join `expeditionPallet` `ep` on((`es`.`palletFk` = `ep`.`id`))) where (`et`.`ETD` >= curdate()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionPallet_Print` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionPallet_Print`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,(`et`.`id` <=> `rm`.`expeditionTruckFk`) AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if((`r`.`created` > (curdate() + interval 1 day)),ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) join `vn`.`expeditionScan` `es` on((`es`.`palletFk` = `ep`.`id`))) join `vn`.`expedition` `e` on((`e`.`id` = `es`.`expeditionFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `vn`.`route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `vn2008`.`Rutas_monitor` `rm` on((`rm`.`Id_Ruta` = `r`.`id`))) left join `vn`.`expeditionTruck` `et2` on((`et2`.`id` = `rm`.`expeditionTruckFk`))) where (`ep`.`isPrint` = 0) group by `ep`.`id`,`t`.`routeFk` */; +/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `etd`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on(`et`.`id` = `r`.`expeditionTruckFk`)) left join `ticket` `t` on(`r`.`routeFk` = `t`.`routeFk`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `expeditionScan` `es` on(`e`.`id` = `es`.`expeditionFk`)) left join `expeditionPallet` `ep` on(`es`.`palletFk` = `ep`.`id`)) where `et`.`ETD` >= util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96095,7 +95428,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(isnull(`e`.`id`),`t`.`id`,NULL)) AS `tickets`,count(distinct `e`.`id`) AS `expeditions`,count(distinct `es`.`id`) AS `scanned`,max(`e`.`created`) AS `lastPacked`,`r`.`created` AS `created` from ((((((`route` `r` left join `routesMonitor` `rm` on((`r`.`id` = `rm`.`routeFk`))) left join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) join `ticket` `t` on((`t`.`routeFk` = `r`.`id`))) left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) left join `expeditionScan` `es` on((`es`.`expeditionFk` = `e`.`id`))) left join `stowaway` `st` on((`st`.`id` = `t`.`id`))) where ((`r`.`created` >= `util`.`yesterday`()) and isnull(`st`.`id`)) group by `r`.`id` */; +/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(`e`.`id` is null,`t`.`id`,NULL)) AS `tickets`,count(distinct `e`.`id`) AS `expeditions`,count(distinct `es`.`id`) AS `scanned`,max(`e`.`created`) AS `lastPacked`,`r`.`created` AS `created` from ((((((`route` `r` left join `routesMonitor` `rm` on(`r`.`id` = `rm`.`routeFk`)) left join `expeditionTruck` `et` on(`et`.`id` = `rm`.`expeditionTruckFk`)) join `ticket` `t` on(`t`.`routeFk` = `r`.`id`)) left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) left join `expeditionScan` `es` on(`es`.`expeditionFk` = `e`.`id`)) left join `stowaway` `st` on(`st`.`id` = `t`.`id`)) where `r`.`created` >= `util`.`yesterday`() and `st`.`id` is null group by `r`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96114,7 +95447,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionRoute_freeTickets` AS select `t`.`routeFk` AS `routeFk`,`tss`.`ticket` AS `ticket`,`s`.`name` AS `code`,`w`.`name` AS `almacen`,`tss`.`updated` AS `updated`,`p`.`code` AS `parkingCode` from ((((((`vn`.`ticketState` `tss` join `vn`.`ticket` `t` on((`t`.`id` = `tss`.`ticket`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`state` `s` on((`s`.`id` = `tss`.`state`))) left join `vn`.`stowaway` `st` on((`st`.`id` = `t`.`id`))) left join `vn`.`ticketParking` `tp` on((`tp`.`ticketFk` = `t`.`id`))) left join `vn`.`parking` `p` on((`p`.`id` = `tp`.`parkingFk`))) where ((ifnull(`t`.`packages`,0) = 0) and isnull(`st`.`id`)) */; +/*!50001 VIEW `expeditionRoute_freeTickets` AS select `t`.`routeFk` AS `routeFk`,`tss`.`ticket` AS `ticket`,`s`.`name` AS `code`,`w`.`name` AS `almacen`,`tss`.`updated` AS `updated`,`p`.`code` AS `parkingCode` from ((((((`vn`.`ticketState` `tss` join `vn`.`ticket` `t` on(`t`.`id` = `tss`.`ticket`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`state` `s` on(`s`.`id` = `tss`.`state`)) left join `vn`.`stowaway` `st` on(`st`.`id` = `t`.`id`)) left join `vn`.`ticketParking` `tp` on(`tp`.`ticketFk` = `t`.`id`)) left join `vn`.`parking` `p` on(`p`.`id` = `tp`.`parkingFk`)) where ifnull(`t`.`packages`,0) = 0 and `st`.`id` is null */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96133,7 +95466,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) left join `expeditionScan` `es` on((`es`.`palletFk` = `ep`.`id`))) */; +/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) left join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96152,7 +95485,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionSticker` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,3) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`am`.`name`,'ZONA ','Z'),`z`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`c`.`mobile`,ifnull(`a`.`mobile`,ifnull(`c`.`phone`,`a`.`phone`))) AS `phone`,`w`.`code` AS `workerCode` from ((((((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `agencyMode` `am` on((`am`.`id` = `r`.`agencyModeFk`))) join `client` `c` on((`c`.`id` = `a`.`clientFk`))) join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) */; +/*!50001 VIEW `expeditionSticker` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,3) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`am`.`name`,'ZONA ','Z'),`z`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`c`.`mobile`,ifnull(`a`.`mobile`,ifnull(`c`.`phone`,`a`.`phone`))) AS `phone`,`w`.`code` AS `workerCode` from ((((((((((`expedition` `e` join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) left join `beach` `b` on(`b`.`id` = `rm`.`beachFk`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `agencyMode` `am` on(`am`.`id` = `r`.`agencyModeFk`)) join `client` `c` on(`c`.`id` = `a`.`clientFk`)) join `worker` `w` on(`w`.`id` = `e`.`workerFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96171,7 +95504,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionSticker__` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,4) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`z`.`name`,'ZONA ','Z'),`am`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`a`.`mobile`,`a`.`phone`) AS `phone` from (((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`id`))) */; +/*!50001 VIEW `expeditionSticker__` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,4) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`z`.`name`,'ZONA ','Z'),`am`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`a`.`mobile`,`a`.`phone`) AS `phone` from (((((((`expedition` `e` join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) left join `beach` `b` on(`b`.`id` = `rm`.`beachFk`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) join `agencyMode` `am` on(`t`.`agencyModeFk` = `am`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96190,7 +95523,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) where (isnull(`e`.`id`) and (`et`.`ETD` > curdate())) */; +/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) join `expeditionTruck` `et` on(`et`.`id` = `rm`.`expeditionTruckFk`)) where `e`.`id` is null and `et`.`ETD` > util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96209,7 +95542,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTimeExpended` AS select `e`.`ticketFk` AS `ticketFk`,min(`e`.`created`) AS `started`,max(`e`.`created`) AS `finished`,max(`e`.`counter`) AS `cajas`,`w`.`code` AS `code`,`t`.`warehouseFk` AS `warehouseFk` from ((`expedition` `e` join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` > curdate()) group by `e`.`ticketFk` */; +/*!50001 VIEW `expeditionTimeExpended` AS select `e`.`ticketFk` AS `ticketFk`,min(`e`.`created`) AS `started`,max(`e`.`created`) AS `finished`,max(`e`.`counter`) AS `cajas`,`w`.`code` AS `code`,`t`.`warehouseFk` AS `warehouseFk` from ((`expedition` `e` join `worker` `w` on(`w`.`id` = `e`.`workerFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) where `e`.`created` > util.VN_CURDATE() group by `e`.`ticketFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96228,7 +95561,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `description`,count(distinct if(isnull(`e`.`expeditionFk`),`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by `fallos` desc,`e`.`etd` */; +/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `description`,count(distinct if(`e`.`expeditionFk` is null,`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`etd` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96247,7 +95580,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by `fallos` desc,`e`.`etd`,`e`.`truckFk` */; +/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`etd`,`e`.`truckFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96266,7 +95599,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on((`et`.`id` = `e`.`expeditionTruckFk`))) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by `fallos` desc,`e`.`palletFk` */; +/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on(`et`.`id` = `e`.`expeditionTruckFk`)) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`palletFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96285,7 +95618,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `ticket` where (`ticket`.`shipped` > '2001-01-01') group by `ticket`.`clientFk` */; +/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `ticket` where `ticket`.`shipped` > '2001-01-01' group by `ticket`.`clientFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96304,7 +95637,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `floraHollandBuyedItems` AS select `b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`b`.`quantity` AS `quantity`,`b`.`buyingValue` AS `buyingValue`,`tr`.`landed` AS `landed`,`e`.`companyFk` AS `companyFk` from (((((`buy` `b` join `item` `i` on((`b`.`itemFk` = `i`.`id`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `itemCategory` `ic` on((`ic`.`id` = `it`.`categoryFk`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on(((`tr`.`id` = `e`.`travelFk`) and (`ic`.`id` not in (8,6)) and (`b`.`buyingValue` <> 0) and (`b`.`quantity` <> 0) and (`e`.`supplierFk` in (1664,1665,1666,1465,1433))))) */; +/*!50001 VIEW `floraHollandBuyedItems` AS select `b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`b`.`quantity` AS `quantity`,`b`.`buyingValue` AS `buyingValue`,`tr`.`landed` AS `landed`,`e`.`companyFk` AS `companyFk` from (((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`it`.`id` = `i`.`typeFk`)) join `itemCategory` `ic` on(`ic`.`id` = `it`.`categoryFk`)) join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk` and `ic`.`id` not in (8,6) and `b`.`buyingValue` <> 0 and `b`.`quantity` <> 0 and `e`.`supplierFk` in (1664,1665,1666,1465,1433))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96399,7 +95732,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`ink` `k` left join `inkI18n` `i` on(((`i`.`inkFk` = `k`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`ink` `k` left join `inkI18n` `i` on(`i`.`inkFk` = `k`.`id` and `i`.`lang` = `util`.`lang`())) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96418,83 +95751,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 (`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) where (`t`.`shipped` > (curdate() + interval -(3) year)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceInAwb__` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInAwb__`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInAwb__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInAwb__` AS select `a`.`recibida_id` AS `invoiceInFk`,`a`.`awb_id` AS `awbFk`,`a`.`dua` AS `dua` from `vn2008`.`awb_recibida` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceInDueDay__` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInDueDay__`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInDueDay__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInDueDay__` AS select `r`.`id` AS `id`,`r`.`recibida_id` AS `invoiceInFk`,`r`.`fecha` AS `dueDated`,`r`.`banco_id` AS `bankFk`,`r`.`cantidad` AS `amount`,`r`.`divisa` AS `foreignValue`,`r`.`stamp` AS `created` from `vn2008`.`recibida_vencimiento` `r` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceInIntrastat2__` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInIntrastat2__`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat2__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInIntrastat2__` AS select `id`.`id` AS `id`,`id`.`recibida_id` AS `invoiceInFk`,`id`.`neto` AS `net`,`id`.`intrastat_id` AS `intrastatFk`,`id`.`importe` AS `amount`,`id`.`unidades` AS `stems`,`id`.`Paises_Id` AS `countryFk`,`id`.`odbc_date` AS `dated`,`id`.`valorestadistico` AS `statisticalValue` from `vn2008`.`intrastat_data` `id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceIn__` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceIn__`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceIn__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceIn__` AS select `r`.`id` AS `id`,`r`.`num_recibida` AS `serialNumber`,`r`.`serie` AS `serial`,`r`.`proveedor_id` AS `supplierFk`,`r`.`fecha` AS `issued`,`r`.`sref` AS `supplierRef`,`r`.`contabilizada` AS `isBooked`,`r`.`moneda_id` AS `currencyFk`,`r`.`MYSQL_TIME` AS `created`,`r`.`empresa_id` AS `companyFk`,`r`.`gestdoc_id` AS `docFk`,`r`.`dateBooking` AS `booked`,`r`.`dateOperation` AS `operated`,`r`.`cplusInvoiceType472Fk` AS `cplusInvoiceType472Fk`,`r`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`r`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`r`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`r`.`cplusTrascendency472Fk` AS `cplusTrascendency472Fk`,`r`.`bookEntried` AS `bookEntried`,`r`.`isVatDeductible` AS `isVatDeductible`,`r`.`withholdingSageFk` AS `withholdingSageFk` from `vn2008`.`recibida` `r` */; +/*!50001 VIEW `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 (`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) where `t`.`shipped` > util.VN_CURDATE() + interval -3 year */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96513,7 +95770,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,concat(`g`.`name`,' ',ifnull(`s`.`name`,'')) AS `ediBotanic` from ((`itemBotanical` `ib` left join `specie` `s` on((`s`.`id` = `ib`.`specieFk`))) left join `genus` `g` on((`g`.`id` = `ib`.`genusFk`))) */; +/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,concat(`g`.`name`,' ',ifnull(`s`.`name`,'')) AS `ediBotanic` from ((`itemBotanical` `ib` left join `specie` `s` on(`s`.`id` = `ib`.`specieFk`)) left join `genus` `g` on(`g`.`id` = `ib`.`genusFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96532,7 +95789,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`itemCategory` `c` left join `itemCategoryI18n` `i` on(((`i`.`categoryFk` = `c`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`itemCategory` `c` left join `itemCategoryI18n` `i` on(`i`.`categoryFk` = `c`.`id` and `i`.`lang` = `util`.`lang`())) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96551,7 +95808,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'COLOR') */; +/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on(`t`.`id` = `it`.`tagFk`)) where `t`.`code` = 'COLOR' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96570,7 +95827,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemEntryIn` AS select `t`.`warehouseInFk` AS `warehouseInFk`,`t`.`landed` AS `landed`,`b`.`itemFk` AS `itemFk`,`b`.`quantity` AS `quantity`,`t`.`isReceived` AS `isReceived`,`e`.`isRaid` AS `isVirtualStock`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`b`.`quantity` <> 0)) */; +/*!50001 VIEW `itemEntryIn` AS select `t`.`warehouseInFk` AS `warehouseInFk`,`t`.`landed` AS `landed`,`b`.`itemFk` AS `itemFk`,`b`.`quantity` AS `quantity`,`t`.`isReceived` AS `isReceived`,`e`.`isRaid` AS `isVirtualStock`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`e`.`travelFk` = `t`.`id`)) where `e`.`isInventory` = 0 and `b`.`quantity` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96589,7 +95846,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemEntryOut` AS select `t`.`warehouseOutFk` AS `warehouseOutFk`,`t`.`shipped` AS `shipped`,`b`.`itemFk` AS `itemFk`,-(`b`.`quantity`) AS `quantity`,`t`.`isDelivered` AS `isDelivered`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`e`.`isRaid` = 0) and (`b`.`quantity` <> 0)) */; +/*!50001 VIEW `itemEntryOut` AS select `t`.`warehouseOutFk` AS `warehouseOutFk`,`t`.`shipped` AS `shipped`,`b`.`itemFk` AS `itemFk`,-`b`.`quantity` AS `quantity`,`t`.`isDelivered` AS `isDelivered`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`e`.`travelFk` = `t`.`id`)) where `e`.`isInventory` = 0 and `e`.`isRaid` = 0 and `b`.`quantity` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96608,7 +95865,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemInk` AS select `i`.`longName` AS `longName`,`i`.`inkFk` AS `inkFk`,`ink`.`name` AS `color` from (`item` `i` join `ink` on((`ink`.`id` = `i`.`inkFk`))) where `ink`.`isRealColor` group by `i`.`longName` */; +/*!50001 VIEW `itemInk` AS select `i`.`longName` AS `longName`,`i`.`inkFk` AS `inkFk`,`ink`.`name` AS `color` from (`item` `i` join `ink` on(`ink`.`id` = `i`.`inkFk`)) where `ink`.`isRealColor` <> 0 group by `i`.`longName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96627,7 +95884,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on((`i`.`id` = `ips`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; +/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0)) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on(`i`.`id` = `ips`.`itemFk`)) left join `worker` `w` on(`w`.`userFk` = `ips`.`userFk`)) left join `worker` `rw` on(`rw`.`userFk` = `ips`.`repoUserFk`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemPlacementSupplyFk` = `ips`.`id`)) where `ips`.`created` >= util.VN_CURDATE() group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96646,7 +95903,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'PRODUCER') */; +/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on(`t`.`id` = `it`.`tagFk`)) where `t`.`code` = 'PRODUCER' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96665,7 +95922,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemSearch` AS select `s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`t`.`nickname` AS `nickname`,`t`.`shipped` AS `shipped` from ((`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`w`.`name` in ('VNH','Floramondo'))) */; +/*!50001 VIEW `itemSearch` AS select `s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`t`.`nickname` AS `nickname`,`t`.`shipped` AS `shipped` from ((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`tomorrow`() and `w`.`name` in ('VNH','Floramondo') */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96684,7 +95941,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelvingStock` `stock` on((`stock`.`itemFk` = `i`.`id`))) left join `vn`.`saleTracking` `stk` on((`stk`.`saleFk` = `s`.`id`))) left join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and isnull(`stk`.`id`) and (`stock`.`visible` > 0) and isnull(`stk`.`saleFk`) and `st`.`isPreviousPreparable`) */; +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `vn`.`agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `st` on(`st`.`id` = `tst`.`state`)) join `vn`.`item` `i` on(`i`.`id` = `s`.`itemFk`)) join `vn`.`itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `vn`.`saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(util.VN_CURDATE()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96703,7 +95960,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingList` AS select `ish`.`shelvingFk` AS `shelvingFk`,`ish`.`visible` AS `visible`,`ish`.`created` AS `created`,`pk`.`code` AS `parking`,`ish`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`parked` AS `parked`,`pk`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `parking` `pk` on((`pk`.`id` = `sh`.`parkingFk`))) order by `ish`.`created` */; +/*!50001 VIEW `itemShelvingList` AS select `ish`.`shelvingFk` AS `shelvingFk`,`ish`.`visible` AS `visible`,`ish`.`created` AS `created`,`pk`.`code` AS `parking`,`ish`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`parked` AS `parked`,`pk`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `item` `i` on(`i`.`id` = `ish`.`itemFk`)) left join `parking` `pk` on(`pk`.`id` = `sh`.`parkingFk`)) order by `ish`.`created` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96741,7 +95998,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingSaleSum` AS select `iss`.`id` AS `id`,`iss`.`itemShelvingFk` AS `itemShelvingFk`,`iss`.`saleFk` AS `saleFk`,sum(`iss`.`quantity`) AS `quantity`,`iss`.`created` AS `created`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelvingSale` `iss` join `itemShelving` `ish` on((`ish`.`id` = `iss`.`itemShelvingFk`))) join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) group by `iss`.`saleFk` */; +/*!50001 VIEW `itemShelvingSaleSum` AS select `iss`.`id` AS `id`,`iss`.`itemShelvingFk` AS `itemShelvingFk`,`iss`.`saleFk` AS `saleFk`,sum(`iss`.`quantity`) AS `quantity`,`iss`.`created` AS `created`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelvingSale` `iss` join `itemShelving` `ish` on(`ish`.`id` = `iss`.`itemShelvingFk`)) join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) group by `iss`.`saleFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96760,7 +96017,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`s`.`isPreviousPrepared` AS `isPreviousPrepared` from (((`itemShelving` `ish` left join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) left join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) where ((`ish`.`visible` <> 0) and `p`.`sectorFk`) group by `ish`.`itemFk`,`p`.`sectorFk` */; +/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`s`.`isPreviousPrepared` AS `isPreviousPrepared` from (((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96779,7 +96036,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStockFull` AS select `ish`.`itemFk` AS `itemFk`,`ish`.`visible` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`grouping` AS `grouping`,`s`.`description` AS `sector`,`issr`.`removed` AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created` from ((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) left join `itemShelvingStockRemoved` `issr` on((`issr`.`itemShelvingFk` = `ish`.`id`))) */; +/*!50001 VIEW `itemShelvingStockFull` AS select `ish`.`itemFk` AS `itemFk`,`ish`.`visible` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`grouping` AS `grouping`,`s`.`description` AS `sector`,`issr`.`removed` AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created` from ((((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `itemShelvingStockRemoved` `issr` on(`issr`.`itemShelvingFk` = `ish`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96798,7 +96055,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStockRemoved` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,0 AS `removed` from ((`itemShelving` `ish` left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`id` */; +/*!50001 VIEW `itemShelvingStockRemoved` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,0 AS `removed` from ((`itemShelving` `ish` left join `itemShelvingSale` `iss` on(`iss`.`itemShelvingFk` = `ish`.`id`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemShelvingFk` = `ish`.`id`)) group by `ish`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96817,7 +96074,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock_byWarehouse` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,`s`.`warehouseFk` AS `warehouseFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) group by `ish`.`itemFk`,`s`.`warehouseFk` */; +/*!50001 VIEW `itemShelvingStock_byWarehouse` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,`s`.`warehouseFk` AS `warehouseFk` from (((`itemShelving` `ish` join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) group by `ish`.`itemFk`,`s`.`warehouseFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96855,7 +96112,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTicketOut` AS select `t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`s`.`itemFk` AS `itemFk`,-(`s`.`quantity`) AS `quantity`,`s`.`isPicked` AS `isPicked`,`s`.`reserved` AS `reserved`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`s`.`ticketFk` AS `ticketFk` from (`sale` `s` join `ticket` `t` on((`s`.`ticketFk` = `t`.`id`))) where (`s`.`quantity` <> 0) */; +/*!50001 VIEW `itemTicketOut` AS select `t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`s`.`itemFk` AS `itemFk`,-`s`.`quantity` AS `quantity`,`s`.`isPicked` AS `isPicked`,`s`.`reserved` AS `reserved`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`s`.`ticketFk` AS `ticketFk` from (`sale` `s` join `ticket` `t` on(`s`.`ticketFk` = `t`.`id`)) where `s`.`quantity` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96874,7 +96131,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`itemType` `t` left join `itemTypeI18n` `i` on(((`i`.`typeFk` = `t`.`id`) and (`i`.`lang` = `util`.`LANG`())))) */; +/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`itemType` `t` left join `itemTypeI18n` `i` on(`i`.`typeFk` = `t`.`id` and `i`.`lang` = `util`.`LANG`())) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96893,7 +96150,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_Free_Id` AS select (`i1`.`id` + 1) AS `newId` from (`item` `i1` left join `item` `i2` on(((`i1`.`id` + 1) = `i2`.`id`))) where (isnull(`i2`.`id`) and (`i1`.`id` > 400000)) */; +/*!50001 VIEW `item_Free_Id` AS select `i1`.`id` + 1 AS `newId` from (`item` `i1` left join `item` `i2` on(`i1`.`id` + 1 = `i2`.`id`)) where `i2`.`id` is null and `i1`.`id` > 400000 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96912,7 +96169,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`b`.`stickers` AS `stickers`,`b`.`printedStickers` AS `life`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `cache`.`last_buy` `clb` on((`clb`.`item_id` = `i`.`id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) left join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; +/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`b`.`stickers` AS `stickers`,`b`.`printedStickers` AS `life`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on(`i`.`id` = `b`.`itemFk`)) join `cache`.`last_buy` `clb` on(`clb`.`item_id` = `i`.`id`)) join `vn`.`entry` `e` on(`e`.`id` = `b`.`entryFk`)) left join `vn`.`travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96931,7 +96188,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastHourProduction` AS select `t`.`warehouseFk` AS `warehouseFk`,cast(sum((ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) / 1000000)) as decimal(5,1)) AS `m3` from (((`warehouse` `w` join `ticket` `t` on((`t`.`warehouseFk` = `w`.`id`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) where (`e`.`created` between (now() - interval 1 hour) and now()) group by `t`.`warehouseFk` */; +/*!50001 VIEW `lastHourProduction` AS select `t`.`warehouseFk` AS `warehouseFk`,cast(sum(ifnull(`p`.`volume`,`p`.`width` * `p`.`height` * `p`.`depth`) / 1000000) as decimal(5,1)) AS `m3` from (((`warehouse` `w` join `ticket` `t` on(`t`.`warehouseFk` = `w`.`id`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) where `e`.`created` between current_timestamp() - interval 1 hour and current_timestamp() group by `t`.`warehouseFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96950,7 +96207,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastPurchases` AS select `tr`.`landed` AS `landed`,`w`.`id` AS `warehouseFk`,`w`.`name` AS `warehouse`,`i`.`longName` AS `longName`,`i`.`subName` AS `subName`,`e`.`id` AS `entryFk`,`b`.`stickers` AS `stickers`,`b`.`packing` AS `packing`,`e`.`ref` AS `ref`,`b`.`itemFk` AS `itemFk`,`ek`.`pro` AS `pro`,`ek`.`ref` AS `ektRef`,`ek`.`agj` AS `agj` from (((((`vn`.`buy` `b` join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) left join `edi`.`ekt` `ek` on((`ek`.`id` = `b`.`ektFk`))) where ((`tr`.`landed` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`e`.`isRaid` = 0) and (`b`.`stickers` > 0)) */; +/*!50001 VIEW `lastPurchases` AS select `tr`.`landed` AS `landed`,`w`.`id` AS `warehouseFk`,`w`.`name` AS `warehouse`,`i`.`longName` AS `longName`,`i`.`subName` AS `subName`,`e`.`id` AS `entryFk`,`b`.`stickers` AS `stickers`,`b`.`packing` AS `packing`,`e`.`ref` AS `ref`,`b`.`itemFk` AS `itemFk`,`ek`.`pro` AS `pro`,`ek`.`ref` AS `ektRef`,`ek`.`agj` AS `agj` from (((((`vn`.`buy` `b` join `vn`.`entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `vn`.`item` `i` on(`i`.`id` = `b`.`itemFk`)) join `vn`.`travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) left join `edi`.`ekt` `ek` on(`ek`.`id` = `b`.`ektFk`)) where `tr`.`landed` between `util`.`yesterday`() and `util`.`tomorrow`() and `e`.`isRaid` = 0 and `b`.`stickers` > 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96969,7 +96226,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimsNumber` desc */; +/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(`cb`.`quantity` * `s`.`price` * (1 - (`c`.`responsibility` - 1) / 4) * (100 - `s`.`discount`) / 100),2) AS `claimedAmount`,round(sum(`cb`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on(`cb`.`claimFk` = `c`.`id`)) join `sale` `s` on(`s`.`id` = `cb`.`saleFk`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemType` `it` on(`it`.`id` = `i`.`typeFk`)) where `c`.`created` >= util.VN_CURDATE() + interval -1 week group by `s`.`itemFk` having `claimedAmount` > 100 and `claimsNumber` > 2 or `claimsNumber` > 4 order by count(0) desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96988,7 +96245,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mistake` AS select `wr`.`code` AS `revisador`,`s`.`concept` AS `concept`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk` from (((((`saleMistake` `sm` join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) join `sale` `s` on((`s`.`id` = `sm`.`saleFk`))) join `itemShelvingSale` `iss` on((`iss`.`saleFk` = `sm`.`saleFk`))) join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) */; +/*!50001 VIEW `mistake` AS select `wr`.`code` AS `revisador`,`s`.`concept` AS `concept`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk` from (((((`saleMistake` `sm` join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) join `worker` `wr` on(`wr`.`id` = `sm`.`userFk`)) join `sale` `s` on(`s`.`id` = `sm`.`saleFk`)) join `itemShelvingSale` `iss` on(`iss`.`saleFk` = `sm`.`saleFk`)) join `worker` `w` on(`w`.`id` = `iss`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97007,7 +96264,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mistakeRatio` AS select `wr`.`code` AS `revisador`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk`,`sm`.`saleFk` AS `saleFk` from ((((`itemShelvingSale` `iss` join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) left join `saleMistake` `sm` on((`iss`.`saleFk` = `sm`.`saleFk`))) left join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) */; +/*!50001 VIEW `mistakeRatio` AS select `wr`.`code` AS `revisador`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk`,`sm`.`saleFk` AS `saleFk` from ((((`itemShelvingSale` `iss` join `worker` `w` on(`w`.`id` = `iss`.`userFk`)) left join `saleMistake` `sm` on(`iss`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `worker` `wr` on(`wr`.`id` = `sm`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97026,7 +96283,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `newBornSales` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from ((((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) join `account`.`role` `r` on((`r`.`id` = `u`.`role`))) where ((`r`.`name` = 'salesPerson') and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; +/*!50001 VIEW `newBornSales` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from ((((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on(`cn`.`firstShipped` + interval 1 year > `v`.`fecha` and `v`.`Id_Cliente` = `cn`.`clientFk`)) join `vn`.`client` `c` on(`c`.`id` = `v`.`Id_Cliente`)) join `account`.`user` `u` on(`u`.`id` = `c`.`salesPersonFk`)) join `account`.`role` `r` on(`r`.`id` = `u`.`role`)) where `r`.`name` = 'salesPerson' and `u`.`name` not in ('ismaelalcolea','ruben') */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97045,7 +96302,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `newBornSales__` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; +/*!50001 VIEW `newBornSales__` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on(`cn`.`firstShipped` + interval 1 year > `v`.`fecha` and `v`.`Id_Cliente` = `cn`.`clientFk`)) join `vn`.`client` `c` on(`c`.`id` = `v`.`Id_Cliente`)) join `account`.`user` `u` on(`u`.`id` = `c`.`salesPersonFk`)) where `u`.`role` = 18 and `u`.`name` not in ('ismaelalcolea','ruben') */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97064,7 +96321,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`origin` `o` left join `originI18n` `i` on(((`i`.`originFk` = `o`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`origin` `o` left join `originI18n` `i` on(`i`.`originFk` = `o`.`id` and `i`.`lang` = `util`.`lang`())) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97083,7 +96340,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `packageEquivalentItem` AS select `p`.`itemFk` AS `itemFk`,`p2`.`itemFk` AS `equivalentFk` from ((`packageEquivalent` `pe` join `packaging` `p` on((`p`.`id` = `pe`.`packagingFk`))) join `packaging` `p2` on((`p2`.`id` = `pe`.`equivalentFk`))) */; +/*!50001 VIEW `packageEquivalentItem` AS select `p`.`itemFk` AS `itemFk`,`p2`.`itemFk` AS `equivalentFk` from ((`packageEquivalent` `pe` join `packaging` `p` on(`p`.`id` = `pe`.`packagingFk`)) join `packaging` `p2` on(`p2`.`id` = `pe`.`equivalentFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97140,26 +96397,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `personMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil personal') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `printer__` --- - -/*!50001 DROP TABLE IF EXISTS `printer__`*/; -/*!50001 DROP VIEW IF EXISTS `printer__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `printer__` AS select `i`.`Id_Impresora` AS `id`,`i`.`Ruta` AS `path`,`i`.`Impresora` AS `name`,`i`.`referencia` AS `reference`,`i`.`isLabeler` AS `isLabeler`,`i`.`description` AS `description` from `vn2008`.`Impresoras__` `i` */; +/*!50001 VIEW `personMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on(`po`.`person_id` = `p`.`person_id`)) join `postgresql`.`profile_media` `pom` on(`pom`.`profile_id` = `po`.`profile_id`)) join `postgresql`.`media` `m` on(`m`.`media_id` = `pom`.`media_id`)) join `postgresql`.`media_type` `mt` on(`mt`.`media_type_id` = `m`.`media_type_id`)) where `mt`.`name` = 'movil personal' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97178,7 +96416,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `productionVolume` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,ifnull(((`p`.`width` * `p`.`height`) * `p`.`depth`),94500)) AS `cm3`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `created` from (((`expedition` `e` left join `packaging` `p` on((`p`.`itemFk` = `e`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) where ((`e`.`created` between curdate() and `util`.`dayend`(curdate())) and `c`.`isRelevant`) */; +/*!50001 VIEW `productionVolume` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,ifnull(`p`.`width` * `p`.`height` * `p`.`depth`,94500)) AS `cm3`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `created` from (((`expedition` `e` left join `packaging` `p` on(`p`.`itemFk` = `e`.`itemFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `client` `c` on(`c`.`id` = `t`.`clientFk`)) where `e`.`created` between util.VN_CURDATE() and `util`.`dayend`(util.VN_CURDATE()) and `c`.`isRelevant` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97197,7 +96435,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `productionVolume_LastHour` AS select cast(sum((`productionVolume`.`cm3` / 1000000)) as decimal(10,0)) AS `m3`,`productionVolume`.`warehouseFk` AS `warehouseFk` from `productionVolume` where ((`productionVolume`.`created` > (now() + interval -(1) hour)) and (`productionVolume`.`warehouseFk` in (1,44,60))) group by `productionVolume`.`warehouseFk` */; +/*!50001 VIEW `productionVolume_LastHour` AS select cast(sum(`productionVolume`.`cm3` / 1000000) as decimal(10,0)) AS `m3`,`productionVolume`.`warehouseFk` AS `warehouseFk` from `productionVolume` where `productionVolume`.`created` > current_timestamp() + interval -1 hour and `productionVolume`.`warehouseFk` in (1,44,60) group by `productionVolume`.`warehouseFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97216,7 +96454,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rankingNewBornByQuarter__` AS select sum(`v`.`importe`) AS `total`,`u`.`name` AS `name`,now() AS `time_sec`,`u`.`id` AS `userFk` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`v`.`fecha` >= '2020-07-01') and (`cn`.`firstShipped` >= '2019-07-01') and (`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `u`.`id` order by sum(`v`.`importe`) desc limit 20 */; +/*!50001 VIEW `rankingNewBornByQuarter__` AS select sum(`v`.`importe`) AS `total`,`u`.`name` AS `name`,current_timestamp() AS `time_sec`,`u`.`id` AS `userFk` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on(`cn`.`firstShipped` + interval 1 year > `v`.`fecha` and `v`.`Id_Cliente` = `cn`.`clientFk`)) join `vn`.`client` `c` on(`c`.`id` = `v`.`Id_Cliente`)) join `account`.`user` `u` on(`u`.`id` = `c`.`salesPersonFk`)) where `v`.`fecha` >= '2020-07-01' and `cn`.`firstShipped` >= '2019-07-01' and `u`.`role` = 18 and `u`.`name` not in ('ismaelalcolea','ruben') group by `u`.`id` order by sum(`v`.`importe`) desc limit 20 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97235,26 +96473,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rankingSellingByQuarter__` AS select sum(`v`.`importe`) AS `importe`,`u`.`name` AS `name`,`u`.`id` AS `userFk`,now() AS `time_sec` from (`bs`.`vendedores` `v` join `account`.`user` `u` on((`u`.`id` = `v`.`Id_Trabajador`))) where ((`v`.`año` = year(curdate())) and (quarter(concat(year(curdate()),'-',`v`.`mes`,'-01')) = quarter(curdate())) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `v`.`Id_Trabajador` order by sum(`v`.`importe`) desc limit 15 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `rate__` --- - -/*!50001 DROP TABLE IF EXISTS `rate__`*/; -/*!50001 DROP VIEW IF EXISTS `rate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rate__` AS select `r`.`tarifa_id` AS `id`,`r`.`fecha` AS `dated`,`r`.`warehouse_id` AS `warehouseFk`,`r`.`t0` AS `rate0`,`r`.`t1` AS `rate1`,`r`.`t2` AS `rate2`,`r`.`t3` AS `rate3` from `vn2008`.`tarifas` `r` */; +/*!50001 VIEW `rankingSellingByQuarter__` AS select sum(`v`.`importe`) AS `importe`,`u`.`name` AS `name`,`u`.`id` AS `userFk`,current_timestamp() AS `time_sec` from (`bs`.`vendedores` `v` join `account`.`user` `u` on(`u`.`id` = `v`.`Id_Trabajador`)) where `v`.`año` = year(util.VN_CURDATE()) and quarter(concat(year(util.VN_CURDATE()),'-',`v`.`mes`,'-01')) = quarter(util.VN_CURDATE()) and `u`.`name` not in ('ismaelalcolea','ruben') group by `v`.`Id_Trabajador` order by sum(`v`.`importe`) desc limit 15 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97292,7 +96511,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 (((`sale` `s` join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on((`ct`.`id` = `c`.`typeFk`))) where (`ct`.`type` = 'coste') */; +/*!50001 VIEW `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 (((`sale` `s` join `saleComponent` `sc` on(`sc`.`saleFk` = `s`.`id`)) join `component` `c` on(`c`.`id` = `sc`.`componentFk`)) join `componentType` `ct` on(`ct`.`id` = `c`.`typeFk`)) where `ct`.`type` = 'coste' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97311,7 +96530,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistakeList` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; +/*!50001 VIEW `saleMistakeList` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `vncontrol`.`accion` `a` on(`a`.`accion_id` = `st`.`actionFk` and `a`.`accion` = 'SACAR')) left join `vn`.`saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `vn`.`mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `vn`.`worker` `w` on(`w`.`id` = `sm`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97330,7 +96549,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistake_list__` AS select `st`.`saleFk` AS `saleFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) where (`st`.`created` > '2020-10-01') */; +/*!50001 VIEW `saleMistake_list__` AS select `st`.`saleFk` AS `saleFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `vncontrol`.`accion` `a` on(`a`.`accion_id` = `st`.`actionFk` and `a`.`accion` = 'SACAR')) left join `vn`.`saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `vn`.`mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `vn`.`worker` `w` on(`w`.`id` = `sm`.`userFk`)) where `st`.`created` > '2020-10-01' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97349,7 +96568,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistake_list__2` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; +/*!50001 VIEW `saleMistake_list__2` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `vncontrol`.`accion` `a` on(`a`.`accion_id` = `st`.`actionFk` and `a`.`accion` = 'SACAR')) left join `vn`.`saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `vn`.`mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `vn`.`worker` `w` on(`w`.`id` = `sm`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97368,7 +96587,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleSaleTracking` AS select distinct `st`.`saleFk` AS `saleFk` from `saleTracking` `st` where (`st`.`created` >= (curdate() + interval -(1) day)) */; +/*!50001 VIEW `saleSaleTracking` AS select distinct `st`.`saleFk` AS `saleFk` from `saleTracking` `st` where `st`.`created` >= util.VN_CURDATE() + interval -1 day */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97387,7 +96606,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`id` AS `itemTypeFk`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `cost`,((((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) * `s`.`quantity`) AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `account`.`user` `u` on((`u`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`warehouse` `wh` on((`wh`.`id` = `t`.`warehouseFk`))) join `vn`.`time` `tm` on((`tm`.`dated` = cast(`t`.`shipped` as date)))) join `cache`.`last_buy` `lb` on(((`lb`.`item_id` = `i`.`id`) and (`lb`.`warehouse_id` = `wh`.`id`)))) join `vn`.`buy` `b` on((`b`.`id` = `lb`.`buy_id`))) where (`wh`.`isManaged` <> 0) */; +/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`id` AS `itemTypeFk`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`b`.`buyingValue` + `b`.`freightValue` + `b`.`comissionValue` + `b`.`packageValue` AS `cost`,(`b`.`buyingValue` + `b`.`freightValue` + `b`.`comissionValue` + `b`.`packageValue`) * `s`.`quantity` AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on(`i`.`id` = `s`.`itemFk`)) join `vn`.`itemType` `it` on(`it`.`id` = `i`.`typeFk`)) join `account`.`user` `u` on(`u`.`id` = `it`.`workerFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `vn`.`client` `c` on(`c`.`id` = `t`.`clientFk`)) join `vn`.`warehouse` `wh` on(`wh`.`id` = `t`.`warehouseFk`)) join `vn`.`time` `tm` on(`tm`.`dated` = cast(`t`.`shipped` as date))) join `cache`.`last_buy` `lb` on(`lb`.`item_id` = `i`.`id` and `lb`.`warehouse_id` = `wh`.`id`)) join `vn`.`buy` `b` on(`b`.`id` = `lb`.`buy_id`)) where `wh`.`isManaged` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97406,7 +96625,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(((`ic`.`cm3delivery` * `s`.`quantity`) / 1000),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `volume`,((`s`.`quantity` * `ic`.`grams`) / 1000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3delivery`) * greatest(`i`.`density`,167)) / 1000000) AS `weight`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `physicalVolume`,(((`s`.`quantity` * `ic`.`cm3delivery`) * ifnull(`t`.`zonePrice`,`z`.`price`)) / (`vc`.`standardFlowerBox` * 1000)) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,(((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100) AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `volumeConfig` `vc`) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) where (`s`.`quantity` > 0) */; +/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(`ic`.`cm3delivery` * `s`.`quantity` / 1000,0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `volume`,`s`.`quantity` * `ic`.`grams` / 1000 AS `physicalWeight`,`s`.`quantity` * `ic`.`cm3delivery` * greatest(`i`.`density`,167) / 1000000 AS `weight`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `physicalVolume`,`s`.`quantity` * `ic`.`cm3delivery` * ifnull(`t`.`zonePrice`,`z`.`price`) / (`vc`.`standardFlowerBox` * 1000) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100 AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) join `volumeConfig` `vc`) join `itemCost` `ic` on(`ic`.`itemFk` = `s`.`itemFk` and `ic`.`warehouseFk` = `t`.`warehouseFk`)) where `s`.`quantity` > 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97425,7 +96644,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume_Today_VNH` AS select `t`.`nickname` AS `Cliente`,`p`.`name` AS `Provincia`,`c`.`country` AS `Pais`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volume` from (((((`saleVolume` `sv` join `ticket` `t` on((`t`.`id` = `sv`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `country` `c` on((`c`.`id` = `p`.`countryFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`w`.`name` = 'VNH') and (`t`.`shipped` between curdate() and `util`.`dayend`(curdate()))) group by `t`.`nickname`,`p`.`name` */; +/*!50001 VIEW `saleVolume_Today_VNH` AS select `t`.`nickname` AS `Cliente`,`p`.`name` AS `Provincia`,`c`.`country` AS `Pais`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volume` from (((((`saleVolume` `sv` join `ticket` `t` on(`t`.`id` = `sv`.`ticketFk`)) join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) join `country` `c` on(`c`.`id` = `p`.`countryFk`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) where `w`.`name` = 'VNH' and `t`.`shipped` between util.VN_CURDATE() and `util`.`dayend`(util.VN_CURDATE()) group by `t`.`nickname`,`p`.`name` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97444,7 +96663,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sale_freightComponent` AS select `t`.`id` AS `ticketFk`,(`sc`.`value` * `s`.`quantity`) AS `amount`,`t`.`shipped` AS `shipped` from ((((`ticket` `t` straight_join `sale` `s` on((`t`.`id` = `s`.`ticketFk`))) join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on(((`ct`.`id` = `c`.`typeFk`) and (`ct`.`type` = 'agencia')))) */; +/*!50001 VIEW `sale_freightComponent` AS select `t`.`id` AS `ticketFk`,`sc`.`value` * `s`.`quantity` AS `amount`,`t`.`shipped` AS `shipped` from ((((`ticket` `t` straight_join `sale` `s` on(`t`.`id` = `s`.`ticketFk`)) join `saleComponent` `sc` on(`sc`.`saleFk` = `s`.`id`)) join `component` `c` on(`c`.`id` = `sc`.`componentFk`)) join `componentType` `ct` on(`ct`.`id` = `c`.`typeFk` and `ct`.`type` = 'agencia')) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97463,7 +96682,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPersonSince` AS select `p`.`id_trabajador` AS `workerFk`,min(`b`.`date_start`) AS `started` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join `postgresql`.`business` `b` on((`pr`.`profile_id` = `b`.`client_id`))) left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `postgresql`.`professional_category` `pc` on((`pc`.`professional_category_id` = `bl`.`professional_category_id`))) where (`pc`.`category_name` = 'Aux ventas') group by `p`.`id_trabajador` */; +/*!50001 VIEW `salesPersonSince` AS select `p`.`id_trabajador` AS `workerFk`,min(`b`.`date_start`) AS `started` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on(`pr`.`person_id` = `p`.`person_id`)) left join `postgresql`.`business` `b` on(`pr`.`profile_id` = `b`.`client_id`)) left join `postgresql`.`business_labour` `bl` on(`b`.`business_id` = `bl`.`business_id`)) join `postgresql`.`professional_category` `pc` on(`pc`.`professional_category_id` = `bl`.`professional_category_id`)) where `pc`.`category_name` = 'Aux ventas' group by `p`.`id_trabajador` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97482,7 +96701,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`a`.`accion` AS `accion`,`st`.`created` AS `created`,`e`.`code` AS `code`,`w`.`firstName` AS `firstname`,`w`.`lastName` AS `lastName`,`w`.`code` AS `workerCode`,((`ic`.`cm3delivery` * `s`.`quantity`) / 1000) AS `litros`,`s`.`concept` AS `concept`,`d`.`name` AS `departmentName` from (((((((((`vn`.`saleTracking` `st` left join `vn`.`salesPreviousPreparated` `prevPrepSales` on((`prevPrepSales`.`saleFk` = `st`.`saleFk`))) join `vn`.`sale` `s` on((`s`.`id` = `st`.`saleFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`itemCost` `ic` on(((`ic`.`warehouseFk` = `t`.`warehouseFk`) and (`ic`.`itemFk` = `s`.`itemFk`)))) join `vn`.`worker` `w` on((`w`.`id` = `st`.`workerFk`))) join `vn`.`state` `e` on((`e`.`id` = `st`.`stateFk`))) join `vncontrol`.`accion` `a` on((`a`.`accion_id` = `st`.`actionFk`))) join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `st`.`workerFk`))) join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) where ((`st`.`created` > (now() + interval -(1) hour)) and isnull(`prevPrepSales`.`saleFk`) and (not((`d`.`name` like 'EQUIPO%')))) */; +/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`a`.`accion` AS `accion`,`st`.`created` AS `created`,`e`.`code` AS `code`,`w`.`firstName` AS `firstname`,`w`.`lastName` AS `lastName`,`w`.`code` AS `workerCode`,`ic`.`cm3delivery` * `s`.`quantity` / 1000 AS `litros`,`s`.`concept` AS `concept`,`d`.`name` AS `departmentName` from (((((((((`vn`.`saleTracking` `st` left join `vn`.`salesPreviousPreparated` `prevPrepSales` on(`prevPrepSales`.`saleFk` = `st`.`saleFk`)) join `vn`.`sale` `s` on(`s`.`id` = `st`.`saleFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `vn`.`itemCost` `ic` on(`ic`.`warehouseFk` = `t`.`warehouseFk` and `ic`.`itemFk` = `s`.`itemFk`)) join `vn`.`worker` `w` on(`w`.`id` = `st`.`workerFk`)) join `vn`.`state` `e` on(`e`.`id` = `st`.`stateFk`)) join `vncontrol`.`accion` `a` on(`a`.`accion_id` = `st`.`actionFk`)) join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `st`.`workerFk`)) join `vn`.`department` `d` on(`d`.`id` = `wd`.`departmentFk`)) where `st`.`created` > current_timestamp() + interval -1 hour and `prevPrepSales`.`saleFk` is null and `d`.`name` not like 'EQUIPO%' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97501,26 +96720,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPreviousPreparated` AS select `st`.`saleFk` AS `saleFk` from (`saleTracking` `st` join `state` `e` on((`e`.`id` = `st`.`stateFk`))) where ((`st`.`created` > curdate()) and (`e`.`code` like 'PREVIOUS_PREPARATION')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `salesToPrePrepare__` --- - -/*!50001 DROP TABLE IF EXISTS `salesToPrePrepare__`*/; -/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesToPrePrepare__` AS select `m`.`ticketFk` AS `Id_Ticket`,`mk`.`Id_Movimiento` AS `Id_Movimiento`,`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,`mk`.`Id_Trabajador` AS `Id_Trabjador`,`mk`.`valor` AS `isChecked`,`mk`.`odbc_date` AS `created`,`m`.`itemFk` AS `Id_Article`,`m`.`concept` AS `Concepte`,`art`.`subName` AS `subName`,ifnull(`m`.`quantity`,0) AS `Cantidad`,ifnull(`m`.`originalQuantity`,`m`.`quantity`) AS `original_quantity`,hour(`t`.`shipped`) AS `Hora`,hour(`t`.`shipped`) AS `Departure`,minute(`t`.`shipped`) AS `Minuto`,`am`.`agencyFk` AS `agency_id`,`t`.`warehouseFk` AS `warehouse_id`,`a`.`provinceFk` AS `province_id`,`is`.`quantity` AS `picked`,`t`.`CodigoTrabajador` AS `trabajador`,`is`.`sectorFk` AS `sectorFk`,`mk`.`stateFk` AS `stateFk` from ((((((((`vn2008`.`Movimientos_mark` `mk` join `vn`.`state` `st` on((`st`.`id` = `mk`.`stateFk`))) join `vn`.`sale` `m` on((`m`.`id` = `mk`.`Id_Movimiento`))) join `vn`.`ticket` `t` on((`m`.`ticketFk` = `t`.`id`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`itemShelvingSaleSum` `is` on((`is`.`saleFk` = `mk`.`Id_Movimiento`))) join `vn2008`.`Articles` `art` on((`art`.`Id_Article` = `m`.`itemFk`))) left join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `mk`.`Id_Trabajador`))) where (`st`.`code` like 'PREVIOUS_PREPARATION') */; +/*!50001 VIEW `salesPreviousPreparated` AS select `st`.`saleFk` AS `saleFk` from (`saleTracking` `st` join `state` `e` on(`e`.`id` = `st`.`stateFk`)) where `st`.`created` > util.VN_CURDATE() and `e`.`code` like 'PREVIOUS_PREPARATION' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97539,7 +96739,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-(least(`b`.`quantity`,0)) AS `out`,greatest(`b`.`quantity`,0) AS `in`,`w`.`name` AS `warehouse`,`b`.`buyingValue` AS `buyingValue` from ((((((`buy` `b` join `item` `i` on((`i`.`id` = `b`.`itemFk`))) join `packaging` `p` on((`p`.`itemFk` = `i`.`id`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) where `p`.`isPackageReturnable` */; +/*!50001 VIEW `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-least(`b`.`quantity`,0) AS `out`,greatest(`b`.`quantity`,0) AS `in`,`w`.`name` AS `warehouse`,`b`.`buyingValue` AS `buyingValue` from ((((((`buy` `b` join `item` `i` on(`i`.`id` = `b`.`itemFk`)) join `packaging` `p` on(`p`.`itemFk` = `i`.`id`)) join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `supplier` `s` on(`s`.`id` = `e`.`supplierFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) where `p`.`isPackageReturnable` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97558,7 +96758,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tagL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`tag` `t` left join `tagI18n` `i` on(((`i`.`tagFk` = `t`.`id`) and (`i`.`lang` = `util`.`LANG`())))) */; +/*!50001 VIEW `tagL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`tag` `t` left join `tagI18n` `i` on(`i`.`tagFk` = `t`.`id` and `i`.`lang` = `util`.`LANG`())) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97577,7 +96777,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketLabel_Source` AS select concat(`tc`.`collectionFk`,' ',`tc`.`wagon`,'-',`tc`.`level`) AS `level`,`t`.`id` AS `Id_Ticket`,(case when (`t`.`routeFk` is not null) then if(`agr`.`showAgencyName`,concat(right(left(`agr`.`name`,(locate(' ',`agr`.`name`) - 1)),2),'- R',convert(right(`t`.`routeFk`,3) using utf8)),`agr`.`name`) else if((`am`.`deliveryMethodFk` = 2),`zo`.`name`,`am`.`name`) end) AS `Agencia`,`t`.`clientFk` AS `Id_Cliente`,`t`.`notes` AS `Notas`,'CDT' AS `Sacador`,1 AS `ncarro`,if(hour(`t`.`shipped`),date_format(`t`.`shipped`,'%H:%i'),date_format(`zo`.`hour`,'%H:%i')) AS `horaagencia`,`t`.`shipped` AS `fecha`,if(((now() + interval 1 hour) > `ze`.`etc`),'!!!','') AS `urgente` from (((((((`vn`.`ticket` `t` join `vn`.`agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`id`))) left join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`route` `r` on((`t`.`routeFk` = `r`.`id`))) left join `vn`.`zoneEstimatedDelivery` `ze` on((`ze`.`zoneFk` = `t`.`zoneFk`))) left join `vn`.`ticketCollection` `tc` on((`tc`.`ticketFk` = `t`.`id`))) left join `vn`.`agencyMode` `agr` on((`r`.`agencyModeFk` = `agr`.`id`))) left join `vn`.`zone` `zo` on((`t`.`zoneFk` = `zo`.`id`))) where (`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) */; +/*!50001 VIEW `ticketLabel_Source` AS select concat(`tc`.`collectionFk`,' ',`tc`.`wagon`,'-',`tc`.`level`) AS `level`,`t`.`id` AS `Id_Ticket`,case when `t`.`routeFk` is not null then if(`agr`.`showAgencyName`,concat(right(left(`agr`.`name`,locate(' ',`agr`.`name`) - 1),2),'- R',convert(right(`t`.`routeFk`,3) using utf8)),`agr`.`name`) else if(`am`.`deliveryMethodFk` = 2,`zo`.`name`,`am`.`name`) end AS `Agencia`,`t`.`clientFk` AS `Id_Cliente`,`t`.`notes` AS `Notas`,'CDT' AS `Sacador`,1 AS `ncarro`,if(hour(`t`.`shipped`),date_format(`t`.`shipped`,'%H:%i'),date_format(`zo`.`hour`,'%H:%i')) AS `horaagencia`,`t`.`shipped` AS `fecha`,if(current_timestamp() + interval 1 hour > `ze`.`etc`,'!!!','') AS `urgente` from (((((((`vn`.`ticket` `t` join `vn`.`agencyMode` `am` on(`t`.`agencyModeFk` = `am`.`id`)) left join `vn`.`address` `a` on(`a`.`id` = `t`.`addressFk`)) left join `vn`.`route` `r` on(`t`.`routeFk` = `r`.`id`)) left join `vn`.`zoneEstimatedDelivery` `ze` on(`ze`.`zoneFk` = `t`.`zoneFk`)) left join `vn`.`ticketCollection` `tc` on(`tc`.`ticketFk` = `t`.`id`)) left join `vn`.`agencyMode` `agr` on(`r`.`agencyModeFk` = `agr`.`id`)) left join `vn`.`zone` `zo` on(`t`.`zoneFk` = `zo`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(util.VN_CURDATE()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97672,7 +96872,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketNotInvoiced` AS select `t`.`companyFk` AS `companyFk`,`cm`.`code` AS `companyCode`,`t`.`clientFk` AS `clientFk`,`c`.`name` AS `clientName`,`t`.`shipped` AS `shipped`,cast(sum((((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)) as decimal(10,2)) AS `value` from (((`ticket` `t` join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) join `company` `cm` on((`cm`.`id` = `t`.`companyFk`))) where (isnull(`t`.`refFk`) and (`t`.`shipped` > '2017-01-01')) group by `t`.`id` */; +/*!50001 VIEW `ticketNotInvoiced` AS select `t`.`companyFk` AS `companyFk`,`cm`.`code` AS `companyCode`,`t`.`clientFk` AS `clientFk`,`c`.`name` AS `clientName`,`t`.`shipped` AS `shipped`,cast(sum(`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100) as decimal(10,2)) AS `value` from (((`ticket` `t` join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `client` `c` on(`c`.`id` = `t`.`clientFk`)) join `company` `cm` on(`cm`.`id` = `t`.`companyFk`)) where `t`.`refFk` is null and `t`.`shipped` > '2017-01-01' group by `t`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97691,7 +96891,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketPackingList` AS select `t`.`nickname` AS `nickname`,`t`.`id` AS `ticketFk`,`am`.`name` AS `agencyMode`,`am`.`flag` AS `flag`,`p`.`name` AS `province`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`sv`.`litros` AS `litros`,`to`.`description` AS `observaciones` from (((((((`ticket` `t` join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) left join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) left join `saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) join `observationType` `ot` on((`ot`.`code` = 'packager'))) left join `ticketObservation` `to` on(((`to`.`ticketFk` = `t`.`id`) and (`ot`.`id` = `to`.`observationTypeFk`)))) */; +/*!50001 VIEW `ticketPackingList` AS select `t`.`nickname` AS `nickname`,`t`.`id` AS `ticketFk`,`am`.`name` AS `agencyMode`,`am`.`flag` AS `flag`,`p`.`name` AS `province`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`sv`.`litros` AS `litros`,`to`.`description` AS `observaciones` from (((((((`ticket` `t` join `address` `a` on(`a`.`id` = `t`.`addressFk`)) join `province` `p` on(`p`.`id` = `a`.`provinceFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) left join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) join `observationType` `ot` on(`ot`.`code` = 'packager')) left join `ticketObservation` `to` on(`to`.`ticketFk` = `t`.`id` and `ot`.`id` = `to`.`observationTypeFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97710,7 +96910,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum((`s`.`isPicked` <> 0)) AS `alreadyMadeSaleLines`,(sum((`s`.`isPicked` <> 0)) / count(`s`.`id`)) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`vn`.`saleGroup` `sg` join `vn`.`saleGroupDetail` `sgd` on((`sgd`.`saleGroupFk` = `sg`.`id`))) join `vn`.`sale` `s` on((`s`.`id` = `sgd`.`saleFk`))) join `vn`.`ticketState` `tls` on((`tls`.`ticketFk` = `s`.`ticketFk`))) join `vn`.`alertLevel` `al` on((`al`.`id` = `tls`.`alertLevel`))) join `vn`.`worker` `w` on((`w`.`id` = `sg`.`userFk`))) left join `vn`.`parking` `p` on((`p`.`id` = `sg`.`parkingFk`))) join `vn`.`itemShelvingStock` `iss` on((`iss`.`itemFk` = `s`.`itemFk`))) where (`sg`.`created` >= (curdate() + interval 0.1 day)) group by `sg`.`id` */; +/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum(`s`.`isPicked` <> 0) AS `alreadyMadeSaleLines`,sum(`s`.`isPicked` <> 0) / count(`s`.`id`) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`vn`.`saleGroup` `sg` join `vn`.`saleGroupDetail` `sgd` on(`sgd`.`saleGroupFk` = `sg`.`id`)) join `vn`.`sale` `s` on(`s`.`id` = `sgd`.`saleFk`)) join `vn`.`ticketState` `tls` on(`tls`.`ticketFk` = `s`.`ticketFk`)) join `vn`.`alertLevel` `al` on(`al`.`id` = `tls`.`alertLevel`)) join `vn`.`worker` `w` on(`w`.`id` = `sg`.`userFk`)) left join `vn`.`parking` `p` on(`p`.`id` = `sg`.`parkingFk`)) join `vn`.`itemShelvingStock` `iss` on(`iss`.`itemFk` = `s`.`itemFk`)) where `sg`.`created` >= util.VN_CURDATE() + interval 0.1 day group by `sg`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97729,7 +96929,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`tls`.`ticketFk` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn`.`ticketLastState` `tls` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `tls`.`ticketTrackingFk`))) join `vn`.`state` `s` on((`s`.`id` = `i`.`state_id`))) */; +/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`tls`.`ticketFk` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn`.`ticketLastState` `tls` join `vncontrol`.`inter` `i` on(`i`.`inter_id` = `tls`.`ticketTrackingFk`)) join `vn`.`state` `s` on(`s`.`id` = `i`.`state_id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97748,7 +96948,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticket` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`worker` AS `worker`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`vn`.`ticketState` `ts` join `vn`.`ticket` `t` on((`t`.`id` = `ts`.`ticket`))) where (`t`.`shipped` between curdate() and `MIDNIGHT`(curdate())) */; +/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticket` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`worker` AS `worker`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`vn`.`ticketState` `ts` join `vn`.`ticket` `t` on(`t`.`id` = `ts`.`ticket`)) where `t`.`shipped` between util.VN_CURDATE() and `MIDNIGHT`(util.VN_CURDATE()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97772,25 +96972,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `time__` --- - -/*!50001 DROP TABLE IF EXISTS `time__`*/; -/*!50001 DROP VIEW IF EXISTS `time__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `time__` AS select `t`.`date` AS `dated`,`t`.`period` AS `period`,`t`.`month` AS `month`,`t`.`year` AS `year`,`t`.`day` AS `day`,`t`.`week` AS `week`,`t`.`yearMonth` AS `yearMonth` from `vn2008`.`time` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `tr2` -- @@ -97824,7 +97005,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` from ((((`buy` `b` join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; +/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` from ((((`buy` `b` join `entry` `e` on(`e`.`id` = `b`.`entryFk`)) join `travel` `tr` on(`tr`.`id` = `e`.`travelFk`)) join `supplier` `s` on(`s`.`id` = `e`.`supplierFk`)) join `warehouse` `w` on(`w`.`id` = `tr`.`warehouseInFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97843,7 +97024,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `traceabilitySale` AS select `s`.`ticketFk` AS `ticketFk`,`sb`.`buyFk` AS `buyFk`,`t`.`shipped` AS `shipped`,`t`.`nickname` AS `nickname`,`s`.`quantity` AS `quantity`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `worker` from (((`saleBuy` `sb` join `sale` `s` on((`s`.`id` = `sb`.`saleFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `worker` `w` on((`w`.`id` = `sb`.`workerFk`))) */; +/*!50001 VIEW `traceabilitySale` AS select `s`.`ticketFk` AS `ticketFk`,`sb`.`buyFk` AS `buyFk`,`t`.`shipped` AS `shipped`,`t`.`nickname` AS `nickname`,`s`.`quantity` AS `quantity`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `worker` from (((`saleBuy` `sb` join `sale` `s` on(`s`.`id` = `sb`.`saleFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `sb`.`workerFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97881,7 +97062,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`business_id` AS `business_id`,`w`.`id` AS `workerFk` from ((((`vn`.`time` `t` left join `postgresql`.`business` `b` on((`t`.`dated` between `b`.`date_start` and ifnull(`b`.`date_end`,curdate())))) left join `postgresql`.`profile` `pr` on((`b`.`client_id` = `pr`.`profile_id`))) left join `postgresql`.`person` `p` on((`pr`.`person_id` = `p`.`person_id`))) left join `vn`.`worker` `w` on((`p`.`id_trabajador` = `w`.`id`))) where (`t`.`dated` > (curdate() + interval -(2) year)) */; +/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`business_id` AS `business_id`,`w`.`id` AS `workerFk` from ((((`vn`.`time` `t` left join `postgresql`.`business` `b` on(`t`.`dated` between `b`.`date_start` and ifnull(`b`.`date_end`,util.VN_CURDATE()))) left join `postgresql`.`profile` `pr` on(`b`.`client_id` = `pr`.`profile_id`)) left join `postgresql`.`person` `p` on(`pr`.`person_id` = `p`.`person_id`)) left join `vn`.`worker` `w` on(`p`.`id_trabajador` = `w`.`id`)) where `t`.`dated` > util.VN_CURDATE() + interval -2 year */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97900,7 +97081,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerCalendar` AS select `ce`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`calendar_employee` `ce` on((`ce`.`business_id` = `b`.`business_id`))) */; +/*!50001 VIEW `workerCalendar` AS select `ce`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on(`pr`.`person_id` = `p`.`person_id`)) join `postgresql`.`business` `b` on(`b`.`client_id` = `pr`.`profile_id`)) join `postgresql`.`calendar_employee` `ce` on(`ce`.`business_id` = `b`.`business_id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97919,7 +97100,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` >= curdate()) and (`b`.`date_start` <= curdate()))) */; +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on(`pr`.`person_id` = `p`.`person_id`)) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on(`b`.`business_id` = `bl`.`business_id`)) on(`pr`.`profile_id` = `b`.`client_id`)) join `vn`.`department` `d` on(`d`.`id` = `bl`.`department_id`)) where `b`.`date_end` is null and `b`.`date_start` <= util.VN_CURDATE() or `b`.`date_end` >= util.VN_CURDATE() and `b`.`date_start` <= util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97938,7 +97119,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartmentTest` AS select `p`.`workerFk` AS `workerFk`,`d`.`id` AS `departmentFk` from ((((`vn`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where (curdate() between `b`.`date_start` and ifnull(`b`.`date_end`,curdate())) */; +/*!50001 VIEW `workerDepartmentTest` AS select `p`.`workerFk` AS `workerFk`,`d`.`id` AS `departmentFk` from ((((`vn`.`person` `p` join `postgresql`.`profile` `pr` on(`pr`.`person_id` = `p`.`id`)) join `postgresql`.`business` `b` on(`b`.`client_id` = `pr`.`profile_id`)) join `postgresql`.`business_labour` `bl` on(`b`.`business_id` = `bl`.`business_id`)) join `vn`.`department` `d` on(`d`.`id` = `bl`.`department_id`)) where util.VN_CURDATE() between `b`.`date_start` and ifnull(`b`.`date_end`,util.VN_CURDATE()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97957,7 +97138,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerLabour` AS select `b`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`bl`.`workcenter_id` AS `workCenterFk`,`b`.`date_start` AS `started`,`b`.`date_end` AS `ended`,`d`.`id` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) order by `b`.`date_start` desc */; +/*!50001 VIEW `workerLabour` AS select `b`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`bl`.`workcenter_id` AS `workCenterFk`,`b`.`date_start` AS `started`,`b`.`date_end` AS `ended`,`d`.`id` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on(`pr`.`person_id` = `p`.`person_id`)) join `postgresql`.`business` `b` on(`b`.`client_id` = `pr`.`profile_id`)) join `postgresql`.`business_labour` `bl` on(`b`.`business_id` = `bl`.`business_id`)) join `vn`.`department` `d` on(`d`.`id` = `bl`.`department_id`)) order by `b`.`date_start` desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97995,7 +97176,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil empresa') */; +/*!50001 VIEW `workerMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on(`po`.`person_id` = `p`.`person_id`)) join `postgresql`.`profile_media` `pom` on(`pom`.`profile_id` = `po`.`profile_id`)) join `postgresql`.`media` `m` on(`m`.`media_id` = `pom`.`media_id`)) join `postgresql`.`media_type` `mt` on(`mt`.`media_type_id` = `m`.`media_type_id`)) where `mt`.`name` = 'movil empresa' */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98014,7 +97195,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerSpeedExpedition` AS select `sv`.`ticketFk` AS `ticketFk`,sum(`sv`.`litros`) AS `litros`,sum(if((`sub`.`started` > (now() + interval -(1) hour)),`sv`.`litros`,0)) AS `literLastHour`,cast(((60 * sum(`sv`.`litros`)) / time_to_sec(timediff(max(`sub`.`finished`),min(`sub`.`started`)))) as decimal(10,1)) AS `litersByMinute`,`sub`.`code` AS `workerCode`,`sub`.`cajas` AS `cajas`,`sub`.`warehouseFk` AS `warehouseFk` from (`saleVolume` `sv` join `expeditionTimeExpended` `sub` on((`sub`.`ticketFk` = `sv`.`ticketFk`))) group by `workerCode` */; +/*!50001 VIEW `workerSpeedExpedition` AS select `sv`.`ticketFk` AS `ticketFk`,sum(`sv`.`litros`) AS `litros`,sum(if(`sub`.`started` > current_timestamp() + interval -1 hour,`sv`.`litros`,0)) AS `literLastHour`,cast(60 * sum(`sv`.`litros`) / time_to_sec(timediff(max(`sub`.`finished`),min(`sub`.`started`))) as decimal(10,1)) AS `litersByMinute`,`sub`.`code` AS `workerCode`,`sub`.`cajas` AS `cajas`,`sub`.`warehouseFk` AS `warehouseFk` from (`saleVolume` `sv` join `expeditionTimeExpended` `sub` on(`sub`.`ticketFk` = `sv`.`ticketFk`)) group by `sub`.`code` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98033,7 +97214,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`accion` AS `accion`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if((`salesPreparedLastHour`.`created` >= (now() + interval -(1) hour)),`salesPreparedLastHour`.`litros`,0)) AS `sumaLitrosLastHour`,cast(((60 * sum(`salesPreparedLastHour`.`litros`)) / time_to_sec(timediff(max(`salesPreparedLastHour`.`created`),min(`salesPreparedLastHour`.`created`)))) as decimal(10,1)) AS `litersByMinute`,`salesPreparedLastHour`.`departmentName` AS `departmentName` from `vn`.`salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`accion`,`salesPreparedLastHour`.`workerCode` */; +/*!50001 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`accion` AS `accion`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if(`salesPreparedLastHour`.`created` >= current_timestamp() + interval -1 hour,`salesPreparedLastHour`.`litros`,0)) AS `sumaLitrosLastHour`,cast(60 * sum(`salesPreparedLastHour`.`litros`) / time_to_sec(timediff(max(`salesPreparedLastHour`.`created`),min(`salesPreparedLastHour`.`created`))) as decimal(10,1)) AS `litersByMinute`,`salesPreparedLastHour`.`departmentName` AS `departmentName` from `vn`.`salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`accion`,`salesPreparedLastHour`.`workerCode` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98052,7 +97233,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `workerTeam` `t` on((`w`.`team` = `t`.`team`))) */; +/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `workerTeam` `t` on(`w`.`team` = `t`.`team`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98071,7 +97252,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`u`.`bcryptPassword` AS `bcryptPassword`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on((`w`.`userFk` = `u`.`id`))) join `vn`.`client` `c` on((`c`.`id` = `u`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`id`))) */; +/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`u`.`bcryptPassword` AS `bcryptPassword`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`userFk` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98090,7 +97271,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlWorking` AS select `wtc`.`userFk` AS `userFk`,`wtc`.`timed` AS `timed`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`pm`.`mediaValue` AS `phone`,`wm`.`mediaValue` AS `workerPhone`,`d`.`name` AS `department`,`wc`.`name` AS `workerCenter`,count(`wtc`.`order`) AS `maxOrder` from (((((((`vn`.`workerTimeControl` `wtc` join `vn`.`worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) left join `vn`.`personMedia` `pm` on((`pm`.`workerFk` = `w`.`id`))) left join `vn`.`workerMedia` `wm` on((`wm`.`workerFk` = `w`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`id`))) left join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) left join `vn`.`workerLabour` `wl` on((`wl`.`businessFk` = (select `wl2`.`businessFk` from `vn`.`workerLabour` `wl2` where (`wl2`.`workerFk` = `w`.`id`) order by `wl2`.`started` desc limit 1)))) left join `vn`.`workCenter` `wc` on((`wc`.`id` = `wl`.`workCenterFk`))) where (cast(`wtc`.`timed` as date) = curdate()) group by `wtc`.`userFk` having ((`maxOrder` % 2) = 1) order by `wtc`.`timed` desc */; +/*!50001 VIEW `workerTimeControlWorking` AS select `wtc`.`userFk` AS `userFk`,`wtc`.`timed` AS `timed`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`pm`.`mediaValue` AS `phone`,`wm`.`mediaValue` AS `workerPhone`,`d`.`name` AS `department`,`wc`.`name` AS `workerCenter`,count(`wtc`.`order`) AS `maxOrder` from (((((((`vn`.`workerTimeControl` `wtc` join `vn`.`worker` `w` on(`w`.`userFk` = `wtc`.`userFk`)) left join `vn`.`personMedia` `pm` on(`pm`.`workerFk` = `w`.`id`)) left join `vn`.`workerMedia` `wm` on(`wm`.`workerFk` = `w`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) left join `vn`.`department` `d` on(`d`.`id` = `wd`.`departmentFk`)) left join `vn`.`workerLabour` `wl` on(`wl`.`businessFk` = (select `wl2`.`businessFk` from `vn`.`workerLabour` `wl2` where `wl2`.`workerFk` = `w`.`id` order by `wl2`.`started` desc limit 1))) left join `vn`.`workCenter` `wc` on(`wc`.`id` = `wl`.`workCenterFk`)) where cast(`wtc`.`timed` as date) = util.VN_CURDATE() group by `wtc`.`userFk` having `maxOrder` MOD 2 = 1 order by `wtc`.`timed` desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98109,7 +97290,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControl_Journey__` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum((if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60)))) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; +/*!50001 VIEW `workerTimeControl_Journey__` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum(if(`wtc`.`order` MOD 2,-1,1) * (hour(`wtc`.`timed`) + minute(`wtc`.`timed`) / 60)) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on(`w`.`userFk` = `wtc`.`userFk`)) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98128,7 +97309,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,(if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60))) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) */; +/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,if(`wtc`.`order` MOD 2,-1,1) * (hour(`wtc`.`timed`) + minute(`wtc`.`timed`) / 60) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on(`w`.`userFk` = `wtc`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98147,7 +97328,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerWithoutDevice__` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `deviceProductionUser` `dpu` on((`dpu`.`userFk` = `c`.`workerFk`))) where ((`c`.`created` > curdate()) and isnull(`dpu`.`userFk`)) group by `c`.`workerFk` */; +/*!50001 VIEW `workerWithoutDevice__` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones` from ((`collection` `c` join `client` `cl` on(`cl`.`id` = `c`.`workerFk`)) left join `deviceProductionUser` `dpu` on(`dpu`.`userFk` = `c`.`workerFk`)) where `c`.`created` > util.VN_CURDATE() and `dpu`.`userFk` is null group by `c`.`workerFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98166,7 +97347,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerWithoutTractor` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones`,max(`c`.`created`) AS `created` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `machineWorker` `mw` on(((`mw`.`workerFk` = `c`.`workerFk`) and (`mw`.`inTimed` > curdate())))) where ((`c`.`created` > curdate()) and isnull(`mw`.`workerFk`)) group by `c`.`workerFk` */; +/*!50001 VIEW `workerWithoutTractor` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones`,max(`c`.`created`) AS `created` from ((`collection` `c` join `client` `cl` on(`cl`.`id` = `c`.`workerFk`)) left join `machineWorker` `mw` on(`mw`.`workerFk` = `c`.`workerFk` and `mw`.`inTimed` > util.VN_CURDATE())) where `c`.`created` > util.VN_CURDATE() and `mw`.`workerFk` is null group by `c`.`workerFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -98185,7 +97366,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast((curdate() + interval ((hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60) + minute(ifnull(`zc`.`hour`,`z`.`hour`))) minute) as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `hourEffective`,floor(((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)))) AS `minutesLess`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `etc` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `s` on((`s`.`id` = `tst`.`state`))) join `vn`.`saleVolume` `sv` on((`sv`.`ticketFk` = `t`.`id`))) left join `vn`.`lastHourProduction` `lhp` on((`lhp`.`warehouseFk` = `t`.`warehouseFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`warehouseAlias` `wa` on((`wa`.`id` = `w`.`aliasFk`))) join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`zoneClosure` `zc` on(((`zc`.`zoneFk` = `t`.`zoneFk`) and (`zc`.`dated` = curdate())))) left join `cache`.`departure_limit` `dl` on(((`dl`.`warehouse_id` = `t`.`warehouseFk`) and (`dl`.`fecha` = curdate())))) where (`w`.`hasProduction` and (cast(`t`.`shipped` as date) = curdate())) group by `t`.`zoneFk` */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast(util.VN_CURDATE() + interval (hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`,`z`.`hour`))) minute as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast(`zc`.`hour` + interval (-sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute as time) AS `hourEffective`,floor(-sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) AS `minutesLess`,cast(`zc`.`hour` + interval (-sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute as time) AS `etc` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = util.VN_CURDATE())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = util.VN_CURDATE())) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = util.VN_CURDATE() group by `t`.`zoneFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/db/export-structure.sh b/db/export-structure.sh index 9b23f43ac..1ecbcb3f0 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -96,5 +96,12 @@ mysqldump \ --databases \ ${SCHEMAS[@]} \ ${IGNORETABLES[@]} \ + | sed 's/\bCURDATE\b/vn.VN_CURDATE/ig'\ + | sed 's/\bCURTIME\b/vn.VN_CURTIME/ig' \ + | sed 's/\bNOW\b/vn.VN_NOW/ig' \ + | sed 's/\bCURRENT_DATE\b/vn.VN_CURDATE/ig' \ + | sed 's/\bCURRENT_TIME\b/vn.VN_CURTIME/ig' \ + | sed 's/\bLOCALTIME\b/vn.VN_NOW/ig' \ + | sed 's/\bLOCALTIMESTAMP\b/vn.VN_NOW/ig' \ | sed 's/ AUTO_INCREMENT=[0-9]* //g' \ - > dump/structure.sql + > dump/structure.sql \ No newline at end of file diff --git a/db/tests/vn/zone_getLanded.spec.js b/db/tests/vn/zone_getLanded.spec.js index 6673879e4..5f82156d3 100644 --- a/db/tests/vn/zone_getLanded.spec.js +++ b/db/tests/vn/zone_getLanded.spec.js @@ -5,8 +5,9 @@ describe('zone zone_getLanded()', () => { it(`should return data for a shipped in the past`, async() => { let stmts = []; let stmt; - stmts.push('START TRANSACTION'); + const date = new Date(); + date.setHours(0, 0, 0, 0); let params = { addressFk: 121, @@ -14,7 +15,8 @@ describe('zone zone_getLanded()', () => { warehouseFk: 1, showExpiredZones: true}; - stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(CURDATE(), INTERVAL -1 DAY), ?, ?, ?, ?)', [ + stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(?, INTERVAL -1 DAY), ?, ?, ?, ?)', [ + date, params.addressFk, params.agencyModeFk, params.warehouseFk, @@ -38,6 +40,8 @@ describe('zone zone_getLanded()', () => { it(`should return data for a shipped tomorrow`, async() => { let stmts = []; let stmt; + const date = new Date(); + date.setHours(0, 0, 0, 0); stmts.push('START TRANSACTION'); @@ -47,7 +51,8 @@ describe('zone zone_getLanded()', () => { warehouseFk: 1, showExpiredZones: false}; - stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(CURDATE(), INTERVAL +2 DAY), ?, ?, ?, ?)', [ + stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(?, INTERVAL +2 DAY), ?, ?, ?, ?)', [ + date, params.addressFk, params.agencyModeFk, params.warehouseFk, diff --git a/modules/client/back/methods/client/createReceipt.js b/modules/client/back/methods/client/createReceipt.js index 131a1d61f..a75ee8844 100644 --- a/modules/client/back/methods/client/createReceipt.js +++ b/modules/client/back/methods/client/createReceipt.js @@ -51,6 +51,9 @@ module.exports = function(Self) { Self.createReceipt = async(ctx, options) => { const models = Self.app.models; const args = ctx.args; + const date = new Date(); + date.setHours(0, 0, 0, 0); + let tx; const myOptions = {}; @@ -92,8 +95,9 @@ module.exports = function(Self) { throw new UserError('Invalid account'); await Self.rawSql( - `CALL vn.ledger_doCompensation(CURDATE(), ?, ?, ?, ?, ?, ?)`, + `CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`, [ + date, args.compensationAccount, args.bankFk, accountingType.receiptDescription + originalClient.accountingAccount, @@ -106,9 +110,10 @@ module.exports = function(Self) { } else if (accountingType.isAutoConciliated == true) { const description = `${originalClient.id} : ${originalClient.socialName} - ${accountingType.receiptDescription}`; const [xdiarioNew] = await Self.rawSql( - `SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`, + `SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`, [ null, + date, bank.account, originalClient.accountingAccount, description, @@ -126,9 +131,10 @@ module.exports = function(Self) { ); await Self.rawSql( - `SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`, + `SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`, [ xdiarioNew.ledger, + date, originalClient.accountingAccount, bank.account, description, diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index 34fba0984..f7f8c505b 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -74,8 +74,10 @@ module.exports = function(Self) { ] }, myOptions); - const query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`; - const data = await Self.rawSql(query, [id], myOptions); + const date = new Date(); + date.setHours(0, 0, 0, 0); + const query = `SELECT vn.clientGetDebt(?, ?) AS debt`; + const data = await Self.rawSql(query, [id, date], myOptions); client.debt = data[0].debt; diff --git a/modules/client/back/methods/client/getDebt.js b/modules/client/back/methods/client/getDebt.js index 8eb0f2480..aafdbfa48 100644 --- a/modules/client/back/methods/client/getDebt.js +++ b/modules/client/back/methods/client/getDebt.js @@ -25,8 +25,10 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`; - const [debt] = await Self.rawSql(query, [clientFk], myOptions); + const date = new Date(); + date.setHours(0, 0, 0, 0); + const query = `SELECT vn.clientGetDebt(?, ?) AS debt`; + const [debt] = await Self.rawSql(query, [clientFk, date], myOptions); return debt; }; diff --git a/modules/client/back/methods/client/lastActiveTickets.js b/modules/client/back/methods/client/lastActiveTickets.js index da38dbee8..03616a0e3 100644 --- a/modules/client/back/methods/client/lastActiveTickets.js +++ b/modules/client/back/methods/client/lastActiveTickets.js @@ -32,6 +32,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const ticket = await Self.app.models.Ticket.findById(ticketId, null, myOptions); const query = ` SELECT @@ -50,12 +52,12 @@ module.exports = Self => { JOIN vn.warehouse w ON t.warehouseFk = w.id JOIN vn.address ad ON t.addressFk = ad.id JOIN vn.province pr ON ad.provinceFk = pr.id - WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 + WHERE t.shipped >= ? AND t.clientFk = ? AND ts.alertLevel = 0 AND t.id <> ? AND t.warehouseFk = ? ORDER BY t.shipped LIMIT 10`; - return Self.rawSql(query, [id, ticketId, ticket.warehouseFk], myOptions); + return Self.rawSql(query, [date, id, ticketId, ticket.warehouseFk], myOptions); }; }; diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 1eef35024..f2d576e39 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -120,7 +120,6 @@ describe('client summary()', () => { const result = await models.Client.summary(clientId, options); expect(result.recovery.id).toEqual(3); - await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index dccf7f39c..48cb75f31 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -122,7 +122,6 @@ module.exports = Self => { return clientModel.findOne(filter, options); } - async function getRecoveries(recoveryModel, clientId, options) { const filter = { where: { diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 81c8e1d2d..ce1d89818 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -51,6 +51,8 @@ module.exports = Self => { const stmts = []; + const date = new Date(); + date.setHours(0, 0, 0, 0); const stmt = new ParameterizedSQL( `SELECT * FROM ( @@ -72,10 +74,10 @@ module.exports = Self => { LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user uw ON uw.id = co.workerFk WHERE - d.created = CURDATE() + d.created = ? AND d.amount > 0 ORDER BY co.created DESC) d` - ); + , [date]); stmt.merge(conn.makeWhere(filter.where)); stmt.merge(`GROUP BY d.clientFk`); diff --git a/modules/client/back/methods/recovery/hasActiveRecovery.js b/modules/client/back/methods/recovery/hasActiveRecovery.js index a0d0064eb..6b69d99d7 100644 --- a/modules/client/back/methods/recovery/hasActiveRecovery.js +++ b/modules/client/back/methods/recovery/hasActiveRecovery.js @@ -27,13 +27,15 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const query = ` SELECT count(*) AS hasActiveRecovery FROM vn.recovery WHERE clientFk = ? - AND IFNULL(finished,CURDATE()) >= CURDATE(); + AND IFNULL(finished, ?) >= ?; `; - const [result] = await Self.rawSql(query, [id], myOptions); + const [result] = await Self.rawSql(query, [id, date, date], myOptions); return result.hasActiveRecovery != 0; }; diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 6399faa52..35252e107 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -145,6 +145,8 @@ module.exports = Self => { stmts.push('CALL cache.visible_refresh(@calc_id, FALSE, 1)'); + const date = new Date(); + date.setHours(0, 0, 0, 0); stmt = new ParameterizedSQL(` SELECT i.image, @@ -202,9 +204,9 @@ module.exports = Self => { LEFT JOIN itemType t ON t.id = i.typeFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) + LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR) LEFT JOIN supplier s ON s.id = e.supplierFk` - ); + , [date]); if (ctx.args.tags) { let i = 1; diff --git a/modules/item/back/methods/item/getWasteByItem.js b/modules/item/back/methods/item/getWasteByItem.js index a797667f5..b93d534da 100644 --- a/modules/item/back/methods/item/getWasteByItem.js +++ b/modules/item/back/methods/item/getWasteByItem.js @@ -32,6 +32,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const wastes = await Self.rawSql(` SELECT *, 100 * dwindle / total AS percentage FROM ( @@ -42,11 +44,11 @@ module.exports = Self => { sum(ws.saleWaste) AS dwindle FROM bs.waste ws WHERE buyer = ? AND family = ? - AND year = YEAR(TIMESTAMPADD(WEEK,-1,CURDATE())) - AND week = WEEK(TIMESTAMPADD(WEEK,-1,CURDATE()), 1) + AND year = YEAR(TIMESTAMPADD(WEEK,-1, ?)) + AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) GROUP BY buyer, itemFk ) sub - ORDER BY family, percentage DESC`, [buyer, family], myOptions); + ORDER BY family, percentage DESC`, [buyer, family, date, date], myOptions); const details = []; diff --git a/modules/item/back/methods/item/getWasteByWorker.js b/modules/item/back/methods/item/getWasteByWorker.js index 5e40831b9..2b0b78974 100644 --- a/modules/item/back/methods/item/getWasteByWorker.js +++ b/modules/item/back/methods/item/getWasteByWorker.js @@ -19,6 +19,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const wastes = await Self.rawSql(` SELECT *, 100 * dwindle / total AS percentage FROM ( @@ -27,11 +29,11 @@ module.exports = Self => { sum(ws.saleTotal) AS total, sum(ws.saleWaste) AS dwindle FROM bs.waste ws - WHERE year = YEAR(TIMESTAMPADD(WEEK,-1,CURDATE())) - AND week = WEEK(TIMESTAMPADD(WEEK,-1,CURDATE()), 1) + WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?)) + AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) GROUP BY buyer, family ) sub - ORDER BY percentage DESC`, null, myOptions); + ORDER BY percentage DESC`, [date, date], myOptions); const details = []; diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js index a08125551..3756a706b 100644 --- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js +++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js @@ -34,6 +34,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const stmt = new ParameterizedSQL(` SELECT u.name AS salesPerson, @@ -47,9 +49,10 @@ module.exports = Self => { JOIN client c ON c.id = v.userFk JOIN account.user u ON c.salesPersonFk = u.id LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk - AND CURDATE() BETWEEN sc.started AND sc.ended + AND ? BETWEEN sc.started AND sc.ended LEFT JOIN workerTeamCollegues wtc - ON wtc.collegueFk = IFNULL(sc.workerSubstitute, c.salesPersonFk)`); + ON wtc.collegueFk = IFNULL(sc.workerSubstitute, c.salesPersonFk)`, + [date]); if (!filter.where) filter.where = {}; diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 9b6030e9f..9a7415055 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -104,6 +104,8 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const conn = Self.dataSource.connector; const models = Self.app.models; + const date = new Date(); + date.setHours(0, 0, 0, 0); const args = ctx.args; const myOptions = {}; @@ -264,15 +266,18 @@ module.exports = Self => { `); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems'); - stmts.push(` + + stmt = new ParameterizedSQL(` CREATE TEMPORARY TABLE tmp.sale_getProblems - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped - FROM tmp.filter f - LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) - AND f.shipped >= CURDATE()`); + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped + FROM tmp.filter f + LEFT JOIN alertLevel al ON al.id = f.alertLevel + WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) + AND f.shipped >= ?`, [date]); + stmts.push(stmt); + stmts.push('CALL ticket_getProblems(FALSE)'); stmts.push(` diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js index 5a9cbb564..0ecec7e88 100644 --- a/modules/route/back/methods/agency-term/filter.js +++ b/modules/route/back/methods/agency-term/filter.js @@ -74,6 +74,8 @@ module.exports = Self => { filter = mergeFilters(filter, {where}); + const date = new Date(); + date.setHours(0, 0, 0, 0); const stmts = []; const stmt = new ParameterizedSQL( `SELECT * @@ -101,10 +103,10 @@ module.exports = Self => { LEFT JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id LEFT JOIN vn.supplier s ON s.id = sat.supplierFk - WHERE r.created > DATE_ADD(CURDATE(), INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL + WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL GROUP BY r.id ) a` - ); + , [date]); stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makePagination(filter)); diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js index 9b3c6edf4..9d481f21e 100644 --- a/modules/route/back/methods/route/specs/filter.spec.js +++ b/modules/route/back/methods/route/specs/filter.spec.js @@ -2,17 +2,17 @@ const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models; describe('Route filter()', () => { - let today = new Date(); + const today = new Date(); today.setHours(2, 0, 0, 0); it('should return the routes matching "search"', async() => { - let ctx = { + const ctx = { args: { search: 1, } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(1); expect(result[0].id).toEqual(1); @@ -28,7 +28,6 @@ describe('Route filter()', () => { const to = new Date(); to.setHours(23, 59, 59, 999); - const ctx = { args: { from: from, @@ -48,43 +47,43 @@ describe('Route filter()', () => { }); it('should return the routes matching "m3"', async() => { - let ctx = { + const ctx = { args: { m3: 0.1, } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(1); }); it('should return the routes matching "description"', async() => { - let ctx = { + const ctx = { args: { description: 'third route', } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(1); }); it('should return the routes matching "workerFk"', async() => { - let ctx = { + const ctx = { args: { workerFk: 56, } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(5); }); it('should return the routes matching "warehouseFk"', async() => { - let ctx = { + const ctx = { args: { warehouseFk: 1, } @@ -102,25 +101,25 @@ describe('Route filter()', () => { }); it('should return the routes matching "vehicleFk"', async() => { - let ctx = { + const ctx = { args: { vehicleFk: 2, } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(1); }); it('should return the routes matching "agencyModeFk"', async() => { - let ctx = { + const ctx = { args: { agencyModeFk: 7, } }; - let result = await app.models.Route.filter(ctx); + const result = await app.models.Route.filter(ctx); expect(result.length).toEqual(1); }); diff --git a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js index beb494d43..bb38cb50e 100644 --- a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js +++ b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js @@ -1,30 +1,32 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('route getSuggestedTickets()', () => { const routeID = 1; const ticketId = 12; + it('should return an array of suggested tickets', async() => { const activeCtx = { accessToken: {userId: 19}, headers: {origin: 'http://localhost'} }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - const tx = await app.models.Ticket.beginTransaction({}); + const tx = await models.Ticket.beginTransaction({}); try { const options = {transaction: tx}; - const ticketInRoute = await app.models.Ticket.findById(ticketId, null, options); + const ticketInRoute = await models.Ticket.findById(ticketId, null, options); await ticketInRoute.updateAttributes({ routeFk: null, landed: new Date() }, options); - const result = await app.models.Route.getSuggestedTickets(routeID, options); + const result = await models.Route.getSuggestedTickets(routeID, options); const length = result.length; const anyResult = result[Math.floor(Math.random() * Math.floor(length))]; diff --git a/modules/ticket/back/methods/sale/getClaimableFromTicket.js b/modules/ticket/back/methods/sale/getClaimableFromTicket.js index 4e0549a4d..ecbc52b94 100644 --- a/modules/ticket/back/methods/sale/getClaimableFromTicket.js +++ b/modules/ticket/back/methods/sale/getClaimableFromTicket.js @@ -24,6 +24,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const date = new Date(); + date.setHours(0, 0, 0, 0); const query = ` SELECT s.id AS saleFk, @@ -39,11 +41,11 @@ module.exports = Self => { INNER JOIN vn.sale s ON s.ticketFk = t.id LEFT JOIN vn.claimBeginning cb ON cb.saleFk = s.id - WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, CURDATE()) + WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, ?) AND t.id = ? AND cb.id IS NULL ORDER BY t.landed DESC, t.id DESC`; - const claimableSales = await Self.rawSql(query, [ticketFk], myOptions); + const claimableSales = await Self.rawSql(query, [date, ticketFk], myOptions); return claimableSales; }; diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 902831d99..467c88246 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -132,6 +132,8 @@ module.exports = Self => { Self.filter = async(ctx, filter, options) => { const userId = ctx.req.accessToken.userId; const conn = Self.dataSource.connector; + const date = new Date(); + date.setHours(0, 0, 0, 0); const models = Self.app.models; const args = ctx.args; @@ -297,7 +299,8 @@ module.exports = Self => { stmts.push(stmt); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems'); - stmts.push(` + + stmt = new ParameterizedSQL(` CREATE TEMPORARY TABLE tmp.sale_getProblems (INDEX (ticketFk)) ENGINE = MEMORY @@ -305,7 +308,9 @@ module.exports = Self => { FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) - AND f.shipped >= CURDATE()`); + AND f.shipped >= ?`, [date]); + stmts.push(stmt); + stmts.push('CALL ticket_getProblems(FALSE)'); stmt = new ParameterizedSQL(` diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index befc75ffc..4e9c22a24 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -26,6 +26,8 @@ module.exports = function(Self) { Self.makeInvoice = async(ctx, ticketsIds, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; + const date = new Date(); + date.setHours(0, 0, 0, 0); const myOptions = {}; let tx; @@ -81,7 +83,7 @@ module.exports = function(Self) { WHERE id IN(?) AND refFk IS NULL `, [ticketsIds], myOptions); - await Self.rawSql('CALL invoiceOut_new(?, CURDATE(), null, @invoiceId)', [serial], myOptions); + await Self.rawSql('CALL invoiceOut_new(?, ?, null, @invoiceId)', [serial, date], myOptions); const [resultInvoice] = await Self.rawSql('SELECT @invoiceId id', [], myOptions); diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js index 43f5b93df..8b7e1685d 100644 --- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js +++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js @@ -56,7 +56,6 @@ describe('ticket canBeInvoiced()', () => { it('should return falsy for a ticket shipping in future', async() => { const tx = await models.Ticket.beginTransaction({}); - try { const options = {transaction: tx}; diff --git a/modules/travel/back/methods/thermograph/createThermograph.js b/modules/travel/back/methods/thermograph/createThermograph.js index 137f32ac4..23d9d6037 100644 --- a/modules/travel/back/methods/thermograph/createThermograph.js +++ b/modules/travel/back/methods/thermograph/createThermograph.js @@ -40,6 +40,7 @@ module.exports = Self => { const models = Self.app.models; let tx; const myOptions = {}; + const date = new Date(); if (typeof options == 'object') Object.assign(myOptions, options); @@ -57,8 +58,8 @@ module.exports = Self => { await Self.rawSql(` INSERT INTO travelThermograph(thermographFk, warehouseFk, temperatureFk, created) - VALUES (?, ?, ?, NOW()) - `, [thermograph.id, warehouseId, temperatureFk], myOptions); + VALUES (?, ?, ?, ?) + `, [thermograph.id, warehouseId, temperatureFk, date], myOptions); if (tx) await tx.commit(); diff --git a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js index 7fe681ec1..927d83df3 100644 --- a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js @@ -1,8 +1,8 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; describe('workerTimeControl filter()', () => { it('should return 1 result filtering by id', async() => { - let ctx = {req: {accessToken: {userId: 1106}}, args: {workerFk: 1106}}; + const ctx = {req: {accessToken: {userId: 1106}}, args: {workerFk: 1106}}; const firstHour = new Date(); firstHour.setHours(7, 0, 0, 0); const lastHour = new Date(); @@ -14,13 +14,13 @@ describe('workerTimeControl filter()', () => { timed: {between: [firstHour, lastHour]} } }; - let result = await app.models.WorkerTimeControl.filter(ctx, filter); + const result = await models.WorkerTimeControl.filter(ctx, filter); expect(result.length).toEqual(4); }); it('should return a privilege error for a non subordinate worker', async() => { - let ctx = {req: {accessToken: {userId: 1107}}, args: {workerFk: 1106}}; + const ctx = {req: {accessToken: {userId: 1107}}, args: {workerFk: 1106}}; const firstHour = new Date(); firstHour.setHours(7, 0, 0, 0); const lastHour = new Date(); @@ -34,7 +34,7 @@ describe('workerTimeControl filter()', () => { }; let error; - await app.models.WorkerTimeControl.filter(ctx, filter).catch(e => { + await models.WorkerTimeControl.filter(ctx, filter).catch(e => { error = e; }).finally(() => { expect(error.message).toEqual(`You don't have enough privileges`); diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index 0c2914934..69fcbe90c 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -8,10 +8,10 @@ describe('workerTimeControl add/delete timeEntry()', () => { const employeeId = 1; const salesPersonId = 1106; const salesBossId = 19; - let activeCtx = { + const activeCtx = { accessToken: {userId: 50}, }; - let ctx = {req: activeCtx}; + const ctx = {req: activeCtx}; beforeAll(() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ @@ -82,7 +82,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { const workerId = salesPersonId; let error; - let calendar = await app.models.Calendar.findById(3); + const calendar = await app.models.Calendar.findById(3); try { ctx.args = {timed: new Date(calendar.dated), direction: 'in'}; diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index 82cb5038e..b3a3fce16 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -80,6 +80,9 @@ module.exports = Self => { if (hasHoursRecorded && isNotHalfAbsence) throw new UserError(`The worker has hours recorded that day`); + const date = new Date(); + const now = new Date(); + date.setHours(0, 0, 0, 0); const [result] = await Self.rawSql( `SELECT COUNT(*) halfHolidayCounter FROM vn.calendar c @@ -88,8 +91,8 @@ module.exports = Self => { JOIN vn.person pe ON pe.id = p.person_id WHERE c.dayOffTypeFk = 6 AND pe.workerFk = ? - AND c.dated BETWEEN util.firstDayOfYear(CURDATE()) - AND LAST_DAY(DATE_ADD(NOW(), INTERVAL 12-MONTH(NOW()) MONTH))`, [id]); + AND c.dated BETWEEN util.firstDayOfYear(?) + AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]); const hasHalfHoliday = result.halfHolidayCounter > 0; const isHalfHoliday = absenceType.code === 'halfHoliday'; diff --git a/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js b/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js index 0c479dda0..4fb4b4e5c 100644 --- a/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js +++ b/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js @@ -8,7 +8,6 @@ describe('zone getZoneClosing()', () => { const options = {transaction: tx}; const date = new Date(); const today = date.toISOString().split('T')[0]; - const result = await models.Zone.getZoneClosing([1, 2, 3], today, options); expect(result.length).toEqual(3); diff --git a/print/methods/schedule/invoice.js b/print/methods/schedule/invoice.js index c76ca85b5..7128cebbd 100644 --- a/print/methods/schedule/invoice.js +++ b/print/methods/schedule/invoice.js @@ -93,11 +93,12 @@ module.exports = async function(request, response, next) { await email.send(mailOptions); } // Update queue status + const date = new Date(); sql = `UPDATE invoiceOut_queue SET status = "printed", - printed = NOW() + printed = ? WHERE invoiceFk = ?`; - connection.query(sql, [invoiceOut.id]); + connection.query(sql, [date, invoiceOut.id]); connection.query('COMMIT'); } catch (error) { connection.query('ROLLBACK');