From 9ff7232b50a6d4caf5f17b0fb86d7e806347479f Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 9 Sep 2020 12:54:10 +0200 Subject: [PATCH 1/6] export production and fix test --- db/changes/10200-normality/00-ACL.sql | 2 - .../10200-normality/00-itemLastEntries.sql | 44 - .../00-zoneEstimatedDelivery.sql | 47 - db/changes/10200-normality/01-zoneETD.sql | 16 - db/dump/dumpedFixtures.sql | 22 +- db/dump/structure.sql | 3221 +++++++++++++---- .../back/methods/client/specs/getCard.spec.js | 2 +- .../back/methods/client/specs/getDebt.spec.js | 2 +- .../back/methods/client/specs/summary.spec.js | 2 +- .../back/methods/ticket/specs/filter.spec.js | 2 +- 10 files changed, 2627 insertions(+), 733 deletions(-) delete mode 100644 db/changes/10200-normality/00-ACL.sql delete mode 100644 db/changes/10200-normality/00-itemLastEntries.sql delete mode 100644 db/changes/10200-normality/00-zoneEstimatedDelivery.sql delete mode 100644 db/changes/10200-normality/01-zoneETD.sql diff --git a/db/changes/10200-normality/00-ACL.sql b/db/changes/10200-normality/00-ACL.sql deleted file mode 100644 index ad9bc79d6..000000000 --- a/db/changes/10200-normality/00-ACL.sql +++ /dev/null @@ -1,2 +0,0 @@ -UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '155'); -UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '157'); diff --git a/db/changes/10200-normality/00-itemLastEntries.sql b/db/changes/10200-normality/00-itemLastEntries.sql deleted file mode 100644 index ce600b39f..000000000 --- a/db/changes/10200-normality/00-itemLastEntries.sql +++ /dev/null @@ -1,44 +0,0 @@ - -USE `vn`; -DROP procedure IF EXISTS `vn`.`itemLastEntries`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE) -BEGIN - SELECT - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.`grouping`, - b.groupingMode, - b.weight, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - 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) - ORDER BY tr.landed DESC , b.id DESC; -END$$ - -DELIMITER ; -; diff --git a/db/changes/10200-normality/00-zoneEstimatedDelivery.sql b/db/changes/10200-normality/00-zoneEstimatedDelivery.sql deleted file mode 100644 index 8cf30796e..000000000 --- a/db/changes/10200-normality/00-zoneEstimatedDelivery.sql +++ /dev/null @@ -1,47 +0,0 @@ -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn`.`zoneEstimatedDelivery` AS - SELECT - `t`.`zoneFk` AS `zoneFk`, - CAST((CURDATE() + INTERVAL ((HOUR(`zc`.`hour`) * 60) + MINUTE(`zc`.`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 - ((((((((`ticket` `t` - JOIN `ticketStateToday` `tst` ON ((`tst`.`ticket` = `t`.`id`))) - JOIN `state` `s` ON ((`s`.`id` = `tst`.`state`))) - JOIN `saleVolume` `sv` ON ((`sv`.`ticketFk` = `t`.`id`))) - LEFT JOIN `lastHourProduction` `lhp` ON ((`lhp`.`warehouseFk` = `t`.`warehouseFk`))) - JOIN `warehouse` `w` ON ((`w`.`id` = `t`.`warehouseFk`))) - JOIN `warehouseAlias` `wa` ON ((`wa`.`id` = `w`.`aliasFk`))) - LEFT JOIN `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 - ((`wa`.`name` = 'Silla') - AND (CAST(`t`.`shipped` AS DATE) = CURDATE())) - GROUP BY `t`.`zoneFk`; \ No newline at end of file diff --git a/db/changes/10200-normality/01-zoneETD.sql b/db/changes/10200-normality/01-zoneETD.sql deleted file mode 100644 index e4cf48548..000000000 --- a/db/changes/10200-normality/01-zoneETD.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn`.`zone_ETD` AS - SELECT - `zed`.`zoneFk` AS `zoneFk`, - `zed`.`hourTheoretical` AS `HoraTeórica`, - `zed`.`totalVolume` AS `volumenTotal`, - `zed`.`remainingVolume` AS `volumenPendiente`, - `zed`.`speed` AS `velocidad`, - `zed`.`hourEffective` AS `HoraPráctica`, - `zed`.`minutesLess` AS `minutesLess`, - `zed`.`etc` AS `etc` - FROM - `vn`.`zoneEstimatedDelivery` `zed` \ No newline at end of file diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index ae20b019c..9c05923cf 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -23,7 +23,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'10190',0,'production',NULL); +INSERT INTO `config` VALUES (1,'10210',0,'production',NULL); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:50:54 +-- Dump completed on 2020-09-09 11:46:28 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:50:55 +-- Dump completed on 2020-09-09 11:46:30 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -119,7 +119,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(219,'Account','acl','READ','ALLOW','ROLE','account'),(220,'Account','getCurrentUserData','READ','ALLOW','ROLE','account'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','*','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(219,'Account','acl','READ','ALLOW','ROLE','account'),(220,'Account','getCurrentUserData','READ','ALLOW','ROLE','account'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','*','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -142,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:50:56 +-- Dump completed on 2020-09-09 11:46:30 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -227,7 +227,7 @@ UNLOCK TABLES; LOCK TABLES `tag` WRITE; /*!40000 ALTER TABLE `tag` DISABLE KEYS */; -INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL,'inkFk'),(2,NULL,'Forma',1,0,NULL,NULL,NULL,NULL),(3,NULL,'Material',1,0,NULL,NULL,NULL,NULL),(4,NULL,'Longitud',1,1,NULL,'mm',NULL,'size'),(5,NULL,'Diámetro',1,1,NULL,'mm',NULL,NULL),(6,NULL,'Perímetro',1,1,NULL,'mm',NULL,NULL),(7,NULL,'Ancho de la base',1,1,NULL,'mm',NULL,NULL),(8,NULL,'Altura',1,1,NULL,'mm',NULL,'size'),(9,NULL,'Volumen',1,1,NULL,'ml',NULL,NULL),(10,NULL,'Densidad',1,1,NULL,NULL,NULL,NULL),(11,NULL,'Calidad',1,0,NULL,NULL,NULL,NULL),(12,NULL,'Textura',1,0,NULL,NULL,NULL,NULL),(13,NULL,'Material del mango',1,0,NULL,NULL,NULL,NULL),(14,NULL,'Compra mínima',1,0,NULL,NULL,NULL,NULL),(15,NULL,'Nº pétalos',1,1,NULL,NULL,NULL,NULL),(16,NULL,'Ancho',1,1,NULL,'mm',NULL,NULL),(18,NULL,'Profundidad',1,1,NULL,'mm',NULL,NULL),(19,NULL,'Largo',1,1,NULL,'mm',NULL,'size'),(20,NULL,'Ancho superior',1,1,NULL,'mm',NULL,NULL),(21,NULL,'Ancho inferior',1,1,NULL,'mm',NULL,NULL),(22,NULL,'Gramaje',1,1,NULL,'g',NULL,NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL,'stems'),(24,NULL,'Estado',1,0,NULL,NULL,NULL,NULL),(25,NULL,'Color principal',0,0,'ink',NULL,NULL,NULL),(26,NULL,'Color secundario',0,0,'ink',NULL,NULL,NULL),(27,NULL,'Longitud(cm)',1,1,NULL,'cm',NULL,NULL),(28,NULL,'Diámetro base',1,1,'','mm',NULL,NULL),(29,NULL,'Colección',1,0,NULL,NULL,NULL,NULL),(30,NULL,'Uds / caja',1,1,NULL,NULL,NULL,NULL),(31,NULL,'Contenido',1,0,NULL,NULL,NULL,NULL),(32,NULL,'Peso',1,1,NULL,'g',NULL,NULL),(33,NULL,'Grosor',1,1,NULL,'mm',NULL,NULL),(34,NULL,'Marca',1,0,NULL,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL,'originFk'),(36,NULL,'Proveedor',1,0,NULL,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL,'producerFk'),(38,NULL,'Duración',1,1,NULL,'s',NULL,NULL),(39,NULL,'Flor',1,0,NULL,NULL,NULL,NULL),(40,NULL,'Soporte',1,0,NULL,NULL,NULL,NULL),(41,NULL,'Tamaño flor',1,0,NULL,NULL,NULL,NULL),(42,NULL,'Apertura',1,0,NULL,NULL,NULL,NULL),(43,NULL,'Tallo',1,0,NULL,NULL,NULL,NULL),(44,NULL,'Nº hojas',1,1,NULL,NULL,NULL,NULL),(45,NULL,'Dimensiones',1,0,NULL,NULL,NULL,NULL),(46,NULL,'Diámetro boca',1,1,NULL,'mm',NULL,NULL),(47,NULL,'Nº flores',1,1,NULL,NULL,NULL,NULL),(48,NULL,'Uds / paquete',1,1,NULL,NULL,NULL,NULL),(49,NULL,'Maceta',1,1,NULL,'cm',NULL,NULL),(50,NULL,'Textura flor',1,0,NULL,NULL,NULL,NULL),(51,NULL,'Textura hoja',1,0,NULL,NULL,NULL,NULL),(52,NULL,'Tipo de IVA',1,0,NULL,NULL,NULL,NULL),(53,NULL,'Tronco',1,0,NULL,NULL,NULL,NULL),(54,NULL,'Hoja',1,0,NULL,NULL,NULL,NULL),(55,NULL,'Formato',1,0,NULL,NULL,NULL,NULL),(56,NULL,'Genero',1,0,NULL,NULL,NULL,NULL),(57,NULL,'Especie',1,0,NULL,NULL,NULL,NULL),(58,NULL,'Variedad',1,0,NULL,NULL,NULL,NULL),(59,NULL,'Medida grande',1,0,NULL,NULL,NULL,NULL),(60,NULL,'Medida mediano',1,0,NULL,NULL,NULL,NULL),(61,NULL,'Medida pequeño',1,0,NULL,NULL,NULL,NULL),(63,NULL,'Recipiente interior',1,0,NULL,NULL,NULL,NULL),(64,NULL,'Material secundario',1,0,NULL,NULL,NULL,NULL),(65,NULL,'Colores',1,0,NULL,NULL,NULL,NULL),(66,NULL,'Referencia',1,0,NULL,NULL,NULL,NULL),(67,'category','Categoria',1,0,NULL,NULL,NULL,NULL),(68,NULL,'Amb',1,0,NULL,NULL,NULL,NULL),(69,NULL,'Anchura',1,1,NULL,'cm',NULL,NULL),(70,NULL,'Hueco interior',1,0,NULL,NULL,NULL,NULL),(71,NULL,'Tamaño',1,0,NULL,NULL,NULL,NULL),(72,NULL,'Color botón',1,0,NULL,NULL,NULL,NULL),(73,NULL,'Tamaño minimo del botón',1,0,NULL,NULL,NULL,NULL),(74,NULL,'Obtentor',1,0,NULL,NULL,NULL,NULL),(75,NULL,'Longitud del brote',1,0,NULL,NULL,NULL,NULL),(76,NULL,'Tallos / u.v.',1,0,NULL,NULL,NULL,NULL),(77,NULL,'Madera de',1,0,NULL,NULL,NULL,NULL),(78,NULL,'Unidad de venta',1,0,NULL,NULL,NULL,NULL),(79,NULL,'Temporal',1,0,NULL,NULL,NULL,NULL),(80,NULL,'Gramaje/tallo',1,1,NULL,'g',NULL,NULL),(81,NULL,'Peso/paquete',1,1,NULL,'g',NULL,NULL),(82,NULL,'Flexibilidad del tallo',1,0,NULL,NULL,NULL,NULL),(83,NULL,'Nº planchas',1,1,NULL,NULL,NULL,NULL),(84,NULL,'Nº páginas',1,1,NULL,NULL,NULL,NULL),(85,NULL,'Editorial',1,0,NULL,NULL,NULL,NULL),(86,NULL,'Idioma',1,0,NULL,NULL,NULL,NULL),(87,NULL,'Fecha publicación',1,0,NULL,NULL,NULL,NULL),(88,NULL,'Cubierta',1,0,NULL,NULL,NULL,NULL),(89,NULL,'Encuadernación',1,0,NULL,NULL,NULL,NULL),(90,NULL,'Autor',1,0,NULL,NULL,NULL,NULL),(91,NULL,'Envoltorio',1,0,NULL,NULL,NULL,NULL),(92,NULL,'Nombre temporal',1,0,NULL,NULL,NULL,NULL),(93,NULL,'Modelo',1,0,NULL,NULL,NULL,NULL),(94,NULL,'Producto',1,0,NULL,NULL,NULL,NULL),(95,NULL,'Título',1,0,NULL,NULL,NULL,NULL),(96,NULL,'Tomo',1,0,NULL,NULL,NULL,NULL),(97,NULL,'Articulo',1,0,NULL,NULL,NULL,NULL),(98,NULL,'Metodo de cultivo',1,0,NULL,NULL,NULL,NULL),(99,NULL,'Edad',1,0,NULL,NULL,NULL,NULL),(100,NULL,'Agotado',1,0,NULL,NULL,NULL,NULL),(101,NULL,'Altura con asa',1,1,NULL,'cm',NULL,NULL),(102,NULL,'Nº tallos',1,1,NULL,NULL,NULL,NULL),(103,NULL,'Cultivo',1,0,NULL,NULL,NULL,NULL),(104,NULL,'Sabor',1,0,NULL,NULL,NULL,NULL),(105,NULL,'Talla',1,0,NULL,NULL,NULL,NULL),(106,NULL,'Calibre',1,1,NULL,NULL,NULL,NULL),(107,NULL,'Dulzura',1,1,NULL,'bx',NULL,NULL),(108,NULL,'Piezas',1,0,NULL,NULL,NULL,NULL),(109,NULL,'Altura con patas',1,0,NULL,NULL,NULL,NULL),(110,NULL,'Envase',1,0,NULL,NULL,NULL,NULL),(111,NULL,'Nº piezas',1,0,NULL,NULL,NULL,NULL),(112,NULL,'Uso',1,0,NULL,'cm',NULL,NULL),(113,NULL,'Color luz',1,0,NULL,NULL,NULL,NULL),(114,NULL,'Capacidad',1,0,NULL,NULL,NULL,NULL),(184,NULL,'Tallos por paquete',1,0,NULL,NULL,NULL,NULL),(205,NULL,'Apertura',1,0,NULL,NULL,'S05',NULL),(219,NULL,'Altura',1,0,NULL,NULL,'S20','size'),(552,NULL,'fout kenmerk',1,0,NULL,NULL,'081',NULL),(553,NULL,'Potinhoud',1,0,NULL,NULL,'A01',NULL),(554,NULL,'Marketingconcept',1,0,NULL,NULL,'A02',NULL),(555,NULL,'Leeftijd',1,0,NULL,NULL,'A03',NULL),(556,NULL,'Uitgangsmateriaal',1,0,NULL,NULL,'A04',NULL),(557,NULL,'Kleurbehandeld',1,0,NULL,NULL,'A05','inkFk'),(558,NULL,'Verzorging: Standplaats',1,0,NULL,NULL,'A06',NULL),(559,NULL,'Verzorging: Water',1,0,NULL,NULL,'A07',NULL),(560,NULL,'Verzorging: Voeding',1,0,NULL,NULL,'A08',NULL),(561,NULL,'Verzorging: Temperatuur',1,0,NULL,NULL,'A09',NULL),(562,NULL,'Verzorging: Specifieke in',1,0,NULL,NULL,'A10',NULL),(563,NULL,'Verzorging: Consumptie',1,0,NULL,NULL,'A11',NULL),(564,NULL,'Nabehandeling',1,0,NULL,NULL,'A13',NULL),(565,NULL,'Artikel beeld',1,0,NULL,NULL,'A23',NULL),(566,NULL,'Hoofdkleur 1',1,0,NULL,NULL,'B01',NULL),(567,NULL,'Hoofdkleur 2',1,0,NULL,NULL,'B02',NULL),(568,NULL,'RHS hoofdkleur 1',1,0,NULL,NULL,'B03',NULL),(569,NULL,'RHS hoofdkleur 2',1,0,NULL,NULL,'B04',NULL),(570,NULL,'Hoofdkleur 1 blad',1,0,NULL,NULL,'B05',NULL),(571,NULL,'Hoofdkleur 2 blad',1,0,NULL,NULL,'B06',NULL),(572,NULL,'RHS hoofdkleur 1 blad',1,0,NULL,NULL,'B07',NULL),(573,NULL,'RHS hoofdkleur 2 blad',1,0,NULL,NULL,'B08',NULL),(574,NULL,'Botanisch beeld',1,0,NULL,NULL,'B09',NULL),(575,NULL,'Hoofdkleur bes/vrucht',1,0,NULL,NULL,'B10',NULL),(576,NULL,'RHS hoofdkleur bes/vrucht',1,0,NULL,NULL,'B11',NULL),(577,NULL,'UPOV hoofdkleur 1 bloem',1,0,NULL,NULL,'B12',NULL),(578,NULL,'UPOV hoofdkleur 2 bloem',1,0,NULL,NULL,'B13',NULL),(579,NULL,'UPOV hoofdkleur 1 blad',1,0,NULL,NULL,'B14',NULL),(580,NULL,'UPOV hoofdkleur 2 blad',1,0,NULL,NULL,'B15',NULL),(581,NULL,'UPOV hoofdkleur bes/vruch',1,0,NULL,NULL,'B16',NULL),(582,NULL,'Negatieve keurcode 1',1,0,NULL,NULL,'K01',NULL),(583,NULL,'Negatieve keurcode 2',1,0,NULL,NULL,'K02',NULL),(584,NULL,'Bedrijfskenmerk fytosanit',1,0,NULL,NULL,'K03',NULL),(585,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K04',NULL),(586,NULL,'Certificaten MPS-TraceCer',1,0,NULL,NULL,'K05',NULL),(587,NULL,'Overige leveranciersinfor',1,0,NULL,NULL,'K07',NULL),(588,NULL,'Certificaten MPS-GAP',1,0,NULL,NULL,'K08',NULL),(589,NULL,'Betrouwbaarheidsindex kla',1,0,NULL,NULL,'K11',NULL),(590,NULL,'Betrouwbaarheidsindex waa',1,0,NULL,NULL,'K12',NULL),(591,NULL,'Productkwaliteitslabel',1,0,NULL,NULL,'K13',NULL),(592,NULL,'Label Fair Flowers Fair P',1,0,NULL,NULL,'K14',NULL),(593,NULL,'Certificaten Socialy Qual',1,0,NULL,NULL,'K15',NULL),(594,NULL,'Certificaten GlobalGAP',1,0,NULL,NULL,'K16',NULL),(595,NULL,'Certificaten MPS Quality',1,0,NULL,NULL,'K17',NULL),(596,NULL,'Certificaten biologisch',1,0,NULL,NULL,'K18',NULL),(597,NULL,'Certificaten eetbare prod',1,0,NULL,NULL,'K19',NULL),(598,NULL,'Certificaten Florimark',1,0,NULL,NULL,'K20',NULL),(599,NULL,'Certificaten Milieukeur',1,0,NULL,NULL,'K21',NULL),(600,NULL,'Certificaten Kenya Flower',1,0,NULL,NULL,'K22',NULL),(601,NULL,'Certificaten Fairtrade',1,0,NULL,NULL,'K23',NULL),(602,NULL,'Keurmerk MPS-ProductProof',1,0,NULL,NULL,'K24',NULL),(603,NULL,'Certificaten ISO',1,0,NULL,NULL,'K25',NULL),(604,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K26',NULL),(605,NULL,'Certificaten Florverde',1,0,NULL,NULL,'K27',NULL),(606,NULL,'Certificaten Ethical Trad',1,0,NULL,NULL,'K28',NULL),(607,NULL,'Certificaten Ethiopian EH',1,0,NULL,NULL,'K29',NULL),(608,NULL,'Certificaten gewasbescher',1,0,NULL,NULL,'K30',NULL),(609,NULL,'Certificaten SAN',1,0,NULL,NULL,'K31',NULL),(610,NULL,'Certificaten GRASP',1,0,NULL,NULL,'K32',NULL),(611,NULL,'Label Fair Flora',1,0,NULL,NULL,'K33',NULL),(612,NULL,'GLobalG.A.P. Chain of Cus',1,0,NULL,NULL,'K34',NULL),(613,NULL,'Fust',1,0,NULL,NULL,'L01',NULL),(614,NULL,'Stapelwagen',1,0,NULL,NULL,'L02',NULL),(615,NULL,'Aantal legborden veilings',1,0,NULL,NULL,'L03',NULL),(616,NULL,'Aantal legborden Deense s',1,0,NULL,NULL,'L04',NULL),(617,NULL,'Aantal onderstellen Deens',1,0,NULL,NULL,'L05',NULL),(618,NULL,'Fustsoort',1,0,NULL,NULL,'L06',NULL),(619,NULL,'Fustmateriaal',1,0,NULL,NULL,'L07',NULL),(620,NULL,'Aantal legborden Eurostap',1,0,NULL,NULL,'L08',NULL),(621,NULL,'Aantal onderstellen Euros',1,0,NULL,NULL,'L09',NULL),(622,NULL,'Tallos/bolsa',1,0,NULL,NULL,'L11',''),(623,NULL,'Aantal bossen per bundel',1,0,NULL,NULL,'L12',NULL),(624,NULL,'Aantal stuks per fust',1,0,NULL,NULL,'L13',NULL),(625,NULL,'Aantal bossen per fust',1,0,NULL,NULL,'L14',NULL),(626,NULL,'Aantal bundels per fust',1,0,NULL,NULL,'L15',NULL),(627,NULL,'Aantal bossen per hoes',1,0,NULL,NULL,'L16',NULL),(628,NULL,'Aantal bundels per hoes',1,0,NULL,NULL,'L17',NULL),(629,NULL,'Fustlabel',1,0,NULL,NULL,'L18',NULL),(630,NULL,'Karlabel',1,0,NULL,NULL,'L19',NULL),(631,NULL,'Service productlabel',1,0,NULL,NULL,'L20',NULL),(632,NULL,'Service fustlabel',1,0,NULL,NULL,'L21',NULL),(633,NULL,'Service karlabel',1,0,NULL,NULL,'L22',NULL),(634,NULL,'Aantal fusten per laag',1,0,NULL,NULL,'L23',NULL),(635,NULL,'Presentatie per schapm2',1,0,NULL,NULL,'L24',NULL),(636,NULL,'Positieve keurcode fytosa',1,0,NULL,NULL,'P01',NULL),(637,NULL,'Positieve keurcode kwalit',1,0,NULL,NULL,'P02',NULL),(638,NULL,'Positieve keurcode veilin',1,0,NULL,NULL,'P03',NULL),(639,NULL,'Maceta',1,1,NULL,'cm','S01',NULL),(640,NULL,'Altura',1,0,NULL,NULL,'S02','size'),(641,NULL,'nº plantas',1,0,NULL,NULL,'S03',NULL),(642,NULL,'Diámetro',1,0,NULL,NULL,'S04',NULL),(644,NULL,'Combinatiehoogte',1,0,NULL,NULL,'S06',NULL),(645,NULL,'Plantas/Maceta',1,0,NULL,NULL,'S07',NULL),(646,NULL,'Dikte',1,0,NULL,NULL,'S08',NULL),(647,NULL,'nº flores',1,0,NULL,NULL,'S09',NULL),(648,NULL,'Min aantal bloemtrossen p',1,0,NULL,NULL,'S10',NULL),(649,NULL,'nº ramales',1,0,NULL,NULL,'S11',NULL),(650,NULL,'Minimum aantal bollen per',1,0,NULL,NULL,'S12',NULL),(651,NULL,'Minimum aantal bladeren p',1,0,NULL,NULL,'S13',NULL),(652,NULL,'Minimum stamhoogte',1,0,NULL,NULL,'S14',NULL),(653,NULL,'Altura caja',1,0,NULL,NULL,'S15',NULL),(654,NULL,'Lengte scheuten',1,0,NULL,NULL,'S16',NULL),(655,NULL,'Min aant vertakkingen pr ',1,0,NULL,NULL,'S17',NULL),(656,NULL,'Altura del capullo',1,0,NULL,NULL,'S19',NULL),(658,NULL,'Peso tallo',1,0,NULL,NULL,'S21',NULL),(659,NULL,'nº flores',1,0,NULL,NULL,'S22',NULL),(660,NULL,'Diámetro de la flor',1,0,NULL,NULL,'S23',NULL),(661,NULL,'Minimum bloemschedelengte',1,0,NULL,NULL,'S24',NULL),(662,NULL,'Aantal bloemkoppen per tr',1,0,NULL,NULL,'S25',NULL),(663,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S26',NULL),(664,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S27',NULL),(665,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S28',NULL),(666,NULL,'Longitud inflorescencia',1,0,NULL,NULL,'S29',NULL),(667,NULL,'Verpakkingswijze snijbloe',1,0,NULL,NULL,'S30',NULL),(668,NULL,'Minimum aant bloemen per ',1,0,NULL,NULL,'S31',NULL),(669,NULL,'Longitud',1,0,NULL,NULL,'S32',NULL),(670,NULL,'Jaartal sortering hout',1,0,NULL,NULL,'S33',NULL),(671,NULL,'Diámetro de la hoja',1,0,NULL,NULL,'S34',NULL),(672,NULL,'Peso paquete',1,0,NULL,NULL,'S35',NULL),(673,NULL,'Maximum planthoogte',1,0,NULL,NULL,'S36',NULL),(674,NULL,'Maximum plantdiameter',1,0,NULL,NULL,'S37',NULL),(675,NULL,'Max aantal bloemen/bloeiw',1,0,NULL,NULL,'S38',NULL),(676,NULL,'Maximum aantal takken per',1,0,NULL,NULL,'S39',NULL),(677,NULL,'Maximum aantal bollen per',1,0,NULL,NULL,'S40',NULL),(678,NULL,'Maximum stamhoogte',1,0,NULL,NULL,'S41',NULL),(679,NULL,'Longitud mínima',1,0,NULL,NULL,'S42','size'),(680,NULL,'Maximum aantal knoppen sn',1,0,NULL,NULL,'S43',NULL),(681,NULL,'Maximum bloemdiameter',1,0,NULL,NULL,'S44',NULL),(682,NULL,'Maximum bloeiwijzelengte',1,0,NULL,NULL,'S45',NULL),(683,NULL,'Aantal vruchten / trossen',1,0,NULL,NULL,'S46',NULL),(684,NULL,'Verpakkingswijze',1,0,NULL,NULL,'S47',NULL),(685,NULL,'Minimum vruchtdiameter',1,0,NULL,NULL,'S48',NULL),(686,NULL,'Bolomvang',1,0,NULL,NULL,'S49',NULL),(687,NULL,'Bloem/bes/vruchtkleur 1',1,0,NULL,NULL,'S50',NULL),(688,NULL,'Potvorm',1,0,NULL,NULL,'S51',NULL),(689,NULL,'Potkleur',1,0,NULL,NULL,'S52',NULL),(690,NULL,'Material maceta',1,0,NULL,NULL,'S53',NULL),(691,NULL,'Plantvorm',1,0,NULL,NULL,'S54',NULL),(692,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S55',NULL),(693,NULL,'Teeltwijze',1,0,NULL,NULL,'S56',NULL),(694,NULL,'Teeltmedium',1,0,NULL,NULL,'S57',NULL),(695,NULL,'Hoesmateriaal',1,0,NULL,NULL,'S58',NULL),(696,NULL,'Hoesvorm',1,0,NULL,NULL,'S59',NULL),(697,NULL,'Hoesbedrukking algemeen',1,0,NULL,NULL,'S60',NULL),(698,NULL,'Extra toevoegingen',1,0,NULL,NULL,'S61',NULL),(699,NULL,'Land van herkomst (bedrij',1,0,NULL,NULL,'S62',NULL),(700,NULL,'Verpakte orchidee',1,0,NULL,NULL,'S63',NULL),(701,NULL,'Hoesbedrukking extra',1,0,NULL,NULL,'S64',NULL),(702,NULL,'Voorbehandeling',1,0,NULL,NULL,'S65',NULL),(703,NULL,'Overige niet in pot',1,0,NULL,NULL,'S66',NULL),(704,NULL,'Vorm snijbloemen',1,0,NULL,NULL,'S67',NULL),(705,NULL,'Buigzaamheid bloemsteel',1,0,NULL,NULL,'S68',NULL),(706,NULL,'Hoeskleur',1,0,NULL,NULL,'S69',NULL),(707,NULL,'Extra deco materiaal',1,0,NULL,NULL,'S70',NULL),(708,NULL,'Productkleur',1,0,NULL,NULL,'S71','inkFk'),(709,NULL,'Productmateriaal',1,0,NULL,NULL,'S72',NULL),(710,NULL,'Materiaalhoogte',1,0,NULL,NULL,'S73',NULL),(711,NULL,'Materiaaldiameter',1,0,NULL,NULL,'S74',NULL),(712,NULL,'Barcode',1,0,NULL,NULL,'S75',NULL),(713,NULL,'Productlabel',1,0,NULL,NULL,'S76',NULL),(714,NULL,'Eetbaar/ niet eetbaar',1,0,NULL,NULL,'S77',NULL),(715,NULL,'Plantmaat zonder pot',1,0,NULL,NULL,'S78',NULL),(716,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S79',NULL),(717,NULL,'Maximum percentage oud ho',1,0,NULL,NULL,'S80',NULL),(718,NULL,'Maximum lengte verschil',1,0,NULL,NULL,'S81',NULL),(719,NULL,'Bladkleur',1,0,NULL,NULL,'S82',NULL),(720,NULL,'Plantgewicht',1,0,NULL,NULL,'S83',NULL),(721,NULL,'Diámetro',1,0,NULL,NULL,'S84',NULL),(722,NULL,'Bloem/bes/vruchtkleur 2',1,0,NULL,NULL,'S85',NULL),(723,NULL,'Winterhardheid (USDA zone',1,0,NULL,NULL,'S86',NULL),(724,NULL,'Kleurbehandeld',1,0,NULL,NULL,'S87','inkFk'),(725,NULL,'Bloem-/bladkleurverdeling',1,0,NULL,NULL,'S88',NULL),(726,NULL,'Diámetro del capullo',1,0,NULL,NULL,'S89',NULL),(727,NULL,'Volume inhoud',1,0,NULL,NULL,'S90',NULL),(728,NULL,'Vruchtbenaming',1,0,NULL,NULL,'S91',NULL),(729,NULL,'Vaaslevenindex',1,0,NULL,NULL,'S92',NULL),(730,NULL,'Overige informatie plante',1,0,NULL,NULL,'S93',NULL),(731,NULL,'Overige informatie snijbl',1,0,NULL,NULL,'S94',NULL),(732,NULL,'Toepassingsmogelijkheid',1,0,NULL,NULL,'S95',NULL),(733,NULL,'Productbeeld aanvoerder',1,0,NULL,NULL,'S96',NULL),(734,NULL,'MPS certificering',1,0,NULL,NULL,'S97',NULL),(735,NULL,'Kwaliteitsgroep',1,0,NULL,NULL,'S98',NULL),(736,NULL,'Artikelomschrijving',1,0,NULL,NULL,'S99',NULL),(737,NULL,'BTW-tarief',1,0,NULL,NULL,'T01',NULL),(738,NULL,'Prijseenheid',1,0,NULL,NULL,'T02',NULL),(739,NULL,'Transactievorm',1,0,NULL,NULL,'T03',NULL),(740,NULL,'Handelsverpakking voorwaa',1,0,NULL,NULL,'T10',NULL),(741,NULL,'Consumentenverpakking voo',1,0,NULL,NULL,'T11',NULL),(742,NULL,'Leveringsvoorwaarden',1,0,NULL,NULL,'T12',NULL),(743,NULL,'PT heffing voorwaarden',1,0,NULL,NULL,'T13',NULL),(744,NULL,'Serviceheffing voorwaarde',1,0,NULL,NULL,'T14',NULL),(745,NULL,'Algemene voorwaarden',1,0,NULL,NULL,'T15',NULL),(746,NULL,'Marktvorm',1,0,NULL,NULL,'T16',NULL),(747,NULL,'Themadagen',1,0,NULL,NULL,'T17',NULL),(748,NULL,'Handelscategorie',1,0,NULL,NULL,'T18',NULL),(749,NULL,'Producentengroepen',1,0,NULL,NULL,'T19',NULL),(750,NULL,'Favorieten Id',1,0,NULL,NULL,'T20',NULL),(751,NULL,'Verkoopeenheid',1,0,NULL,NULL,'T21',NULL),(752,NULL,'Veilgroep voorkeur',1,0,NULL,NULL,'V01',NULL),(753,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V02',NULL),(754,NULL,'Keurmeesternummer FloraHo',1,0,NULL,NULL,'V03',NULL),(755,NULL,'Rijnummer Rijnsburg',1,0,NULL,NULL,'V04',NULL),(756,NULL,'Verwerkingslocatie FloraH',1,0,NULL,NULL,'V05',NULL),(757,NULL,'FloraHolland Financial',1,0,NULL,NULL,'V06',NULL),(758,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V07',NULL),(759,NULL,'Benefiet veiling',1,0,NULL,NULL,'V08',NULL),(760,NULL,'Kloksoort',1,0,NULL,NULL,'V09',NULL),(761,NULL,'Minimumprijs aanvoerder',1,0,NULL,NULL,'V10',NULL),(762,NULL,'Rest aantallen',1,0,NULL,NULL,'V11',NULL),(763,NULL,'Veilsoort',1,0,NULL,NULL,'V12',NULL),(764,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V13',NULL),(765,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V14',NULL),(766,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V15',NULL),(767,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V16',NULL),(768,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V17',NULL),(769,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V18',NULL),(770,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V19',NULL),(771,NULL,'Gereserveerd',1,0,NULL,NULL,'V20',NULL),(772,NULL,'Veilgroep Aalsmeer',1,0,NULL,NULL,'V21',NULL),(773,NULL,'Promotie kenmerk FloraHol',1,0,NULL,NULL,'V22',NULL),(774,NULL,'Verrekening snijbloemenvo',1,0,NULL,NULL,'V23',NULL),(775,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V24',NULL),(776,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V25',NULL),(777,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V26',NULL),(778,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V27',NULL),(779,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V28',NULL),(780,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V29',NULL),(781,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V30',NULL),(782,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V31',NULL),(783,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V32',NULL),(784,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V33',NULL),(785,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V34',NULL),(786,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V35',NULL),(787,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V36',NULL),(788,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V37',NULL),(789,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V38',NULL),(790,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V39',NULL),(791,NULL,'Gereserveerd',1,0,NULL,NULL,'V40',NULL),(792,NULL,'Tussenopslag klok Plantio',1,0,NULL,NULL,'V41',NULL),(793,NULL,'Soort ladingsdrager Plant',1,0,NULL,NULL,'V42',NULL),(794,NULL,'Logistiek middel Plantion',1,0,NULL,NULL,'V43',NULL),(795,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V44',NULL),(796,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V45',NULL),(797,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V46',NULL),(798,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V47',NULL),(799,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V48',NULL),(800,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V49',NULL),(801,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V50',NULL),(802,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V51',NULL),(803,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V52',NULL),(804,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V53',NULL),(805,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V54',NULL),(806,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V55',NULL),(807,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V56',NULL),(808,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V57',NULL),(809,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V58',NULL),(810,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V59',NULL),(811,NULL,'Gereserveerd',1,0,NULL,NULL,'V60',NULL),(812,NULL,'Veilgroep Plantion Ede',1,0,NULL,NULL,'V61',NULL),(813,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V62',NULL),(814,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V63',NULL),(815,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V64',NULL),(816,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V65',NULL),(817,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V66',NULL),(818,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V67',NULL),(819,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V68',NULL),(820,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V69',NULL),(821,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V70',NULL),(822,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V71',NULL),(823,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V72',NULL),(824,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V73',NULL),(825,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V74',NULL),(826,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V75',NULL),(827,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V76',NULL),(828,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V77',NULL),(829,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V78',NULL),(830,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V79',NULL),(831,NULL,'Toegevoegde waardes VRM',1,0,NULL,NULL,'V80',NULL),(832,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V81',NULL),(833,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V82',NULL),(834,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V83',NULL),(835,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V84',NULL),(836,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V85',NULL),(837,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V86',NULL),(838,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V87',NULL),(839,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V88',NULL),(840,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V89',NULL),(841,NULL,'Veiling',1,0,NULL,NULL,'V99',NULL),(842,NULL,'kopersaantallen',1,0,NULL,NULL,'Z01',NULL); +INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL,'inkFk'),(2,NULL,'Forma',1,0,NULL,NULL,NULL,NULL),(3,NULL,'Material',1,0,NULL,NULL,NULL,NULL),(4,NULL,'Longitud',1,1,NULL,'mm',NULL,'size'),(5,NULL,'Diámetro',1,1,NULL,'mm',NULL,'diameter'),(6,NULL,'Perímetro',1,1,NULL,'mm',NULL,NULL),(7,NULL,'Ancho de la base',1,1,NULL,'mm',NULL,NULL),(8,NULL,'Altura',1,1,NULL,'mm',NULL,'size'),(9,NULL,'Volumen',1,1,NULL,'ml',NULL,NULL),(10,NULL,'Densidad',1,1,NULL,NULL,NULL,NULL),(11,NULL,'Calidad',1,0,NULL,NULL,NULL,NULL),(12,NULL,'Textura',1,0,NULL,NULL,NULL,NULL),(13,NULL,'Material del mango',1,0,NULL,NULL,NULL,NULL),(14,NULL,'Compra mínima',1,0,NULL,NULL,NULL,NULL),(15,NULL,'Nº pétalos',1,1,NULL,NULL,NULL,NULL),(16,NULL,'Ancho',1,1,NULL,'mm',NULL,NULL),(18,NULL,'Profundidad',1,1,NULL,'mm',NULL,NULL),(19,NULL,'Largo',1,1,NULL,'mm',NULL,'size'),(20,NULL,'Ancho superior',1,1,NULL,'mm',NULL,NULL),(21,NULL,'Ancho inferior',1,1,NULL,'mm',NULL,NULL),(22,NULL,'Gramaje',1,1,NULL,'g',NULL,NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL,'stems'),(24,NULL,'Estado',1,0,NULL,NULL,NULL,NULL),(25,NULL,'Color principal',0,0,'ink',NULL,NULL,NULL),(26,NULL,'Color secundario',0,0,'ink',NULL,NULL,NULL),(27,NULL,'Longitud(cm)',1,1,NULL,'cm',NULL,NULL),(28,NULL,'Diámetro base',1,1,'','mm',NULL,'diameter'),(29,NULL,'Colección',1,0,NULL,NULL,NULL,NULL),(30,NULL,'Uds / caja',1,1,NULL,NULL,NULL,NULL),(31,NULL,'Contenido',1,0,NULL,NULL,NULL,NULL),(32,NULL,'Peso',1,1,NULL,'g',NULL,NULL),(33,NULL,'Grosor',1,1,NULL,'mm',NULL,NULL),(34,NULL,'Marca',1,0,NULL,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL,'originFk'),(36,NULL,'Proveedor',1,0,NULL,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL,'producerFk'),(38,NULL,'Duración',1,1,NULL,'s',NULL,NULL),(39,NULL,'Flor',1,0,NULL,NULL,NULL,NULL),(40,NULL,'Soporte',1,0,NULL,NULL,NULL,NULL),(41,NULL,'Tamaño flor',1,0,NULL,NULL,NULL,NULL),(42,NULL,'Apertura',1,0,NULL,NULL,NULL,NULL),(43,NULL,'Tallo',1,0,NULL,NULL,NULL,NULL),(44,NULL,'Nº hojas',1,1,NULL,NULL,NULL,NULL),(45,NULL,'Dimensiones',1,0,NULL,NULL,NULL,NULL),(46,NULL,'Diámetro boca',1,1,NULL,'mm',NULL,NULL),(47,NULL,'Nº flores',1,1,NULL,NULL,NULL,NULL),(48,NULL,'Uds / paquete',1,1,NULL,NULL,NULL,NULL),(49,NULL,'Maceta',1,1,NULL,'cm',NULL,'diameter'),(50,NULL,'Textura flor',1,0,NULL,NULL,NULL,NULL),(51,NULL,'Textura hoja',1,0,NULL,NULL,NULL,NULL),(52,NULL,'Tipo de IVA',1,0,NULL,NULL,NULL,NULL),(53,NULL,'Tronco',1,0,NULL,NULL,NULL,NULL),(54,NULL,'Hoja',1,0,NULL,NULL,NULL,NULL),(55,NULL,'Formato',1,0,NULL,NULL,NULL,NULL),(56,NULL,'Genero',1,0,NULL,NULL,NULL,NULL),(57,NULL,'Especie',1,0,NULL,NULL,NULL,NULL),(58,NULL,'Variedad',1,0,NULL,NULL,NULL,NULL),(59,NULL,'Medida grande',1,0,NULL,NULL,NULL,NULL),(60,NULL,'Medida mediano',1,0,NULL,NULL,NULL,NULL),(61,NULL,'Medida pequeño',1,0,NULL,NULL,NULL,NULL),(63,NULL,'Recipiente interior',1,0,NULL,NULL,NULL,NULL),(64,NULL,'Material secundario',1,0,NULL,NULL,NULL,NULL),(65,NULL,'Colores',1,0,NULL,NULL,NULL,NULL),(66,NULL,'Referencia',1,0,NULL,NULL,NULL,NULL),(67,'category','Categoria',1,0,NULL,NULL,NULL,NULL),(68,NULL,'Amb',1,0,NULL,NULL,NULL,NULL),(69,NULL,'Anchura',1,1,NULL,'cm',NULL,NULL),(70,NULL,'Hueco interior',1,0,NULL,NULL,NULL,NULL),(71,NULL,'Tamaño',1,0,NULL,NULL,NULL,NULL),(72,NULL,'Color botón',1,0,NULL,NULL,NULL,NULL),(73,NULL,'Tamaño minimo del botón',1,0,NULL,NULL,NULL,NULL),(74,NULL,'Obtentor',1,0,NULL,NULL,NULL,NULL),(75,NULL,'Longitud del brote',1,0,NULL,NULL,NULL,NULL),(76,NULL,'Tallos / u.v.',1,0,NULL,NULL,NULL,NULL),(77,NULL,'Madera de',1,0,NULL,NULL,NULL,NULL),(78,NULL,'Unidad de venta',1,0,NULL,NULL,NULL,NULL),(79,NULL,'Temporal',1,0,NULL,NULL,NULL,NULL),(80,NULL,'Gramaje/tallo',1,1,NULL,'g',NULL,NULL),(81,NULL,'Peso/paquete',1,1,NULL,'g',NULL,NULL),(82,NULL,'Flexibilidad del tallo',1,0,NULL,NULL,NULL,NULL),(83,NULL,'Nº planchas',1,1,NULL,NULL,NULL,NULL),(84,NULL,'Nº páginas',1,1,NULL,NULL,NULL,NULL),(85,NULL,'Editorial',1,0,NULL,NULL,NULL,NULL),(86,NULL,'Idioma',1,0,NULL,NULL,NULL,NULL),(87,NULL,'Fecha publicación',1,0,NULL,NULL,NULL,NULL),(88,NULL,'Cubierta',1,0,NULL,NULL,NULL,NULL),(89,NULL,'Encuadernación',1,0,NULL,NULL,NULL,NULL),(90,NULL,'Autor',1,0,NULL,NULL,NULL,NULL),(91,NULL,'Envoltorio',1,0,NULL,NULL,NULL,NULL),(92,NULL,'Nombre temporal',1,0,NULL,NULL,NULL,NULL),(93,NULL,'Modelo',1,0,NULL,NULL,NULL,NULL),(94,NULL,'Producto',1,0,NULL,NULL,NULL,NULL),(95,NULL,'Título',1,0,NULL,NULL,NULL,NULL),(96,NULL,'Tomo',1,0,NULL,NULL,NULL,NULL),(97,NULL,'Articulo',1,0,NULL,NULL,NULL,NULL),(98,NULL,'Metodo de cultivo',1,0,NULL,NULL,NULL,NULL),(99,NULL,'Edad',1,0,NULL,NULL,NULL,NULL),(100,NULL,'Agotado',1,0,NULL,NULL,NULL,NULL),(101,NULL,'Altura con asa',1,1,NULL,'cm',NULL,NULL),(102,NULL,'Nº tallos',1,1,NULL,NULL,NULL,NULL),(103,NULL,'Cultivo',1,0,NULL,NULL,NULL,NULL),(104,NULL,'Sabor',1,0,NULL,NULL,NULL,NULL),(105,NULL,'Talla',1,0,NULL,NULL,NULL,NULL),(106,NULL,'Calibre',1,1,NULL,NULL,NULL,NULL),(107,NULL,'Dulzura',1,1,NULL,'bx',NULL,NULL),(108,NULL,'Piezas',1,0,NULL,NULL,NULL,NULL),(109,NULL,'Altura con patas',1,0,NULL,NULL,NULL,NULL),(110,NULL,'Envase',1,0,NULL,NULL,NULL,NULL),(111,NULL,'Nº piezas',1,0,NULL,NULL,NULL,NULL),(112,NULL,'Uso',1,0,NULL,'cm',NULL,NULL),(113,NULL,'Color luz',1,0,NULL,NULL,NULL,NULL),(114,NULL,'Capacidad',1,0,NULL,NULL,NULL,NULL),(184,NULL,'Tallos por paquete',1,0,NULL,NULL,NULL,NULL),(205,NULL,'Apertura',1,0,NULL,NULL,'S05',NULL),(219,NULL,'Altura',1,0,NULL,NULL,'S20','size'),(552,NULL,'fout kenmerk',1,0,NULL,NULL,'081',NULL),(553,NULL,'Potinhoud',1,0,NULL,NULL,'A01',NULL),(554,NULL,'Marketingconcept',1,0,NULL,NULL,'A02',NULL),(555,NULL,'Leeftijd',1,0,NULL,NULL,'A03',NULL),(556,NULL,'Uitgangsmateriaal',1,0,NULL,NULL,'A04',NULL),(557,NULL,'Kleurbehandeld',1,0,NULL,NULL,'A05','inkFk'),(558,NULL,'Verzorging: Standplaats',1,0,NULL,NULL,'A06',NULL),(559,NULL,'Verzorging: Water',1,0,NULL,NULL,'A07',NULL),(560,NULL,'Verzorging: Voeding',1,0,NULL,NULL,'A08',NULL),(561,NULL,'Verzorging: Temperatuur',1,0,NULL,NULL,'A09',NULL),(562,NULL,'Verzorging: Specifieke in',1,0,NULL,NULL,'A10',NULL),(563,NULL,'Verzorging: Consumptie',1,0,NULL,NULL,'A11',NULL),(564,NULL,'Nabehandeling',1,0,NULL,NULL,'A13',NULL),(565,NULL,'Artikel beeld',1,0,NULL,NULL,'A23',NULL),(566,NULL,'Hoofdkleur 1',1,0,NULL,NULL,'B01',NULL),(567,NULL,'Hoofdkleur 2',1,0,NULL,NULL,'B02',NULL),(568,NULL,'RHS hoofdkleur 1',1,0,NULL,NULL,'B03',NULL),(569,NULL,'RHS hoofdkleur 2',1,0,NULL,NULL,'B04',NULL),(570,NULL,'Hoofdkleur 1 blad',1,0,NULL,NULL,'B05',NULL),(571,NULL,'Hoofdkleur 2 blad',1,0,NULL,NULL,'B06',NULL),(572,NULL,'RHS hoofdkleur 1 blad',1,0,NULL,NULL,'B07',NULL),(573,NULL,'RHS hoofdkleur 2 blad',1,0,NULL,NULL,'B08',NULL),(574,NULL,'Botanisch beeld',1,0,NULL,NULL,'B09',NULL),(575,NULL,'Hoofdkleur bes/vrucht',1,0,NULL,NULL,'B10',NULL),(576,NULL,'RHS hoofdkleur bes/vrucht',1,0,NULL,NULL,'B11',NULL),(577,NULL,'UPOV hoofdkleur 1 bloem',1,0,NULL,NULL,'B12',NULL),(578,NULL,'UPOV hoofdkleur 2 bloem',1,0,NULL,NULL,'B13',NULL),(579,NULL,'UPOV hoofdkleur 1 blad',1,0,NULL,NULL,'B14',NULL),(580,NULL,'UPOV hoofdkleur 2 blad',1,0,NULL,NULL,'B15',NULL),(581,NULL,'UPOV hoofdkleur bes/vruch',1,0,NULL,NULL,'B16',NULL),(582,NULL,'Negatieve keurcode 1',1,0,NULL,NULL,'K01',NULL),(583,NULL,'Negatieve keurcode 2',1,0,NULL,NULL,'K02',NULL),(584,NULL,'Bedrijfskenmerk fytosanit',1,0,NULL,NULL,'K03',NULL),(585,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K04',NULL),(586,NULL,'Certificaten MPS-TraceCer',1,0,NULL,NULL,'K05',NULL),(587,NULL,'Overige leveranciersinfor',1,0,NULL,NULL,'K07',NULL),(588,NULL,'Certificaten MPS-GAP',1,0,NULL,NULL,'K08',NULL),(589,NULL,'Betrouwbaarheidsindex kla',1,0,NULL,NULL,'K11',NULL),(590,NULL,'Betrouwbaarheidsindex waa',1,0,NULL,NULL,'K12',NULL),(591,NULL,'Productkwaliteitslabel',1,0,NULL,NULL,'K13',NULL),(592,NULL,'Label Fair Flowers Fair P',1,0,NULL,NULL,'K14',NULL),(593,NULL,'Certificaten Socialy Qual',1,0,NULL,NULL,'K15',NULL),(594,NULL,'Certificaten GlobalGAP',1,0,NULL,NULL,'K16',NULL),(595,NULL,'Certificaten MPS Quality',1,0,NULL,NULL,'K17',NULL),(596,NULL,'Certificaten biologisch',1,0,NULL,NULL,'K18',NULL),(597,NULL,'Certificaten eetbare prod',1,0,NULL,NULL,'K19',NULL),(598,NULL,'Certificaten Florimark',1,0,NULL,NULL,'K20',NULL),(599,NULL,'Certificaten Milieukeur',1,0,NULL,NULL,'K21',NULL),(600,NULL,'Certificaten Kenya Flower',1,0,NULL,NULL,'K22',NULL),(601,NULL,'Certificaten Fairtrade',1,0,NULL,NULL,'K23',NULL),(602,NULL,'Keurmerk MPS-ProductProof',1,0,NULL,NULL,'K24',NULL),(603,NULL,'Certificaten ISO',1,0,NULL,NULL,'K25',NULL),(604,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K26',NULL),(605,NULL,'Certificaten Florverde',1,0,NULL,NULL,'K27',NULL),(606,NULL,'Certificaten Ethical Trad',1,0,NULL,NULL,'K28',NULL),(607,NULL,'Certificaten Ethiopian EH',1,0,NULL,NULL,'K29',NULL),(608,NULL,'Certificaten gewasbescher',1,0,NULL,NULL,'K30',NULL),(609,NULL,'Certificaten SAN',1,0,NULL,NULL,'K31',NULL),(610,NULL,'Certificaten GRASP',1,0,NULL,NULL,'K32',NULL),(611,NULL,'Label Fair Flora',1,0,NULL,NULL,'K33',NULL),(612,NULL,'GLobalG.A.P. Chain of Cus',1,0,NULL,NULL,'K34',NULL),(613,NULL,'Fust',1,0,NULL,NULL,'L01',NULL),(614,NULL,'Stapelwagen',1,0,NULL,NULL,'L02',NULL),(615,NULL,'Aantal legborden veilings',1,0,NULL,NULL,'L03',NULL),(616,NULL,'Aantal legborden Deense s',1,0,NULL,NULL,'L04',NULL),(617,NULL,'Aantal onderstellen Deens',1,0,NULL,NULL,'L05',NULL),(618,NULL,'Fustsoort',1,0,NULL,NULL,'L06',NULL),(619,NULL,'Fustmateriaal',1,0,NULL,NULL,'L07',NULL),(620,NULL,'Aantal legborden Eurostap',1,0,NULL,NULL,'L08',NULL),(621,NULL,'Aantal onderstellen Euros',1,0,NULL,NULL,'L09',NULL),(622,NULL,'Tallos/bolsa',1,0,NULL,NULL,'L11',''),(623,NULL,'Aantal bossen per bundel',1,0,NULL,NULL,'L12',NULL),(624,NULL,'Aantal stuks per fust',1,0,NULL,NULL,'L13',NULL),(625,NULL,'Aantal bossen per fust',1,0,NULL,NULL,'L14',NULL),(626,NULL,'Aantal bundels per fust',1,0,NULL,NULL,'L15',NULL),(627,NULL,'Aantal bossen per hoes',1,0,NULL,NULL,'L16',NULL),(628,NULL,'Aantal bundels per hoes',1,0,NULL,NULL,'L17',NULL),(629,NULL,'Fustlabel',1,0,NULL,NULL,'L18',NULL),(630,NULL,'Karlabel',1,0,NULL,NULL,'L19',NULL),(631,NULL,'Service productlabel',1,0,NULL,NULL,'L20',NULL),(632,NULL,'Service fustlabel',1,0,NULL,NULL,'L21',NULL),(633,NULL,'Service karlabel',1,0,NULL,NULL,'L22',NULL),(634,NULL,'Aantal fusten per laag',1,0,NULL,NULL,'L23',NULL),(635,NULL,'Presentatie per schapm2',1,0,NULL,NULL,'L24',NULL),(636,NULL,'Positieve keurcode fytosa',1,0,NULL,NULL,'P01',NULL),(637,NULL,'Positieve keurcode kwalit',1,0,NULL,NULL,'P02',NULL),(638,NULL,'Positieve keurcode veilin',1,0,NULL,NULL,'P03',NULL),(639,NULL,'Maceta',1,1,NULL,'cm','S01','diameter'),(640,NULL,'Altura',1,0,NULL,NULL,'S02','size'),(641,NULL,'nº plantas',1,0,NULL,NULL,'S03',NULL),(642,NULL,'Diámetro',1,0,NULL,NULL,'S04',NULL),(644,NULL,'Combinatiehoogte',1,0,NULL,NULL,'S06',NULL),(645,NULL,'Plantas/Maceta',1,0,NULL,NULL,'S07',NULL),(646,NULL,'Dikte',1,0,NULL,NULL,'S08',NULL),(647,NULL,'nº flores',1,0,NULL,NULL,'S09',NULL),(648,NULL,'Min aantal bloemtrossen p',1,0,NULL,NULL,'S10',NULL),(649,NULL,'nº ramales',1,0,NULL,NULL,'S11',NULL),(650,NULL,'Minimum aantal bollen per',1,0,NULL,NULL,'S12',NULL),(651,NULL,'Minimum aantal bladeren p',1,0,NULL,NULL,'S13',NULL),(652,NULL,'Minimum stamhoogte',1,0,NULL,NULL,'S14',NULL),(653,NULL,'Altura caja',1,0,NULL,NULL,'S15',NULL),(654,NULL,'Lengte scheuten',1,0,NULL,NULL,'S16',NULL),(655,NULL,'Min aant vertakkingen pr ',1,0,NULL,NULL,'S17',NULL),(656,NULL,'Altura del capullo',1,0,NULL,NULL,'S19',NULL),(658,NULL,'Peso tallo',1,0,NULL,NULL,'S21',NULL),(659,NULL,'nº flores',1,0,NULL,NULL,'S22',NULL),(660,NULL,'Diámetro de la flor',1,0,NULL,NULL,'S23',NULL),(661,NULL,'Minimum bloemschedelengte',1,0,NULL,NULL,'S24',NULL),(662,NULL,'Aantal bloemkoppen per tr',1,0,NULL,NULL,'S25',NULL),(663,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S26',NULL),(664,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S27',NULL),(665,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S28',NULL),(666,NULL,'Longitud inflorescencia',1,0,NULL,NULL,'S29',NULL),(667,NULL,'Verpakkingswijze snijbloe',1,0,NULL,NULL,'S30',NULL),(668,NULL,'Minimum aant bloemen per ',1,0,NULL,NULL,'S31',NULL),(669,NULL,'Longitud',1,0,NULL,NULL,'S32',NULL),(670,NULL,'Jaartal sortering hout',1,0,NULL,NULL,'S33',NULL),(671,NULL,'Diámetro de la hoja',1,0,NULL,NULL,'S34',NULL),(672,NULL,'Peso paquete',1,0,NULL,NULL,'S35',NULL),(673,NULL,'Maximum planthoogte',1,0,NULL,NULL,'S36',NULL),(674,NULL,'Maximum plantdiameter',1,0,NULL,NULL,'S37',NULL),(675,NULL,'Max aantal bloemen/bloeiw',1,0,NULL,NULL,'S38',NULL),(676,NULL,'Maximum aantal takken per',1,0,NULL,NULL,'S39',NULL),(677,NULL,'Maximum aantal bollen per',1,0,NULL,NULL,'S40',NULL),(678,NULL,'Maximum stamhoogte',1,0,NULL,NULL,'S41',NULL),(679,NULL,'Longitud mínima',1,0,NULL,NULL,'S42','size'),(680,NULL,'Maximum aantal knoppen sn',1,0,NULL,NULL,'S43',NULL),(681,NULL,'Maximum bloemdiameter',1,0,NULL,NULL,'S44',NULL),(682,NULL,'Maximum bloeiwijzelengte',1,0,NULL,NULL,'S45',NULL),(683,NULL,'Aantal vruchten / trossen',1,0,NULL,NULL,'S46',NULL),(684,NULL,'Verpakkingswijze',1,0,NULL,NULL,'S47',NULL),(685,NULL,'Minimum vruchtdiameter',1,0,NULL,NULL,'S48',NULL),(686,NULL,'Bolomvang',1,0,NULL,NULL,'S49',NULL),(687,NULL,'Bloem/bes/vruchtkleur 1',1,0,NULL,NULL,'S50',NULL),(688,NULL,'Potvorm',1,0,NULL,NULL,'S51',NULL),(689,NULL,'Potkleur',1,0,NULL,NULL,'S52',NULL),(690,NULL,'Material maceta',1,0,NULL,NULL,'S53',NULL),(691,NULL,'Plantvorm',1,0,NULL,NULL,'S54',NULL),(692,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S55',NULL),(693,NULL,'Teeltwijze',1,0,NULL,NULL,'S56',NULL),(694,NULL,'Teeltmedium',1,0,NULL,NULL,'S57',NULL),(695,NULL,'Hoesmateriaal',1,0,NULL,NULL,'S58',NULL),(696,NULL,'Hoesvorm',1,0,NULL,NULL,'S59',NULL),(697,NULL,'Hoesbedrukking algemeen',1,0,NULL,NULL,'S60',NULL),(698,NULL,'Extra toevoegingen',1,0,NULL,NULL,'S61',NULL),(699,NULL,'Land van herkomst (bedrij',1,0,NULL,NULL,'S62',NULL),(700,NULL,'Verpakte orchidee',1,0,NULL,NULL,'S63',NULL),(701,NULL,'Hoesbedrukking extra',1,0,NULL,NULL,'S64',NULL),(702,NULL,'Voorbehandeling',1,0,NULL,NULL,'S65',NULL),(703,NULL,'Overige niet in pot',1,0,NULL,NULL,'S66',NULL),(704,NULL,'Vorm snijbloemen',1,0,NULL,NULL,'S67',NULL),(705,NULL,'Buigzaamheid bloemsteel',1,0,NULL,NULL,'S68',NULL),(706,NULL,'Hoeskleur',1,0,NULL,NULL,'S69',NULL),(707,NULL,'Extra deco materiaal',1,0,NULL,NULL,'S70',NULL),(708,NULL,'Productkleur',1,0,NULL,NULL,'S71','inkFk'),(709,NULL,'Productmateriaal',1,0,NULL,NULL,'S72',NULL),(710,NULL,'Materiaalhoogte',1,0,NULL,NULL,'S73',NULL),(711,NULL,'Materiaaldiameter',1,0,NULL,NULL,'S74',NULL),(712,NULL,'Barcode',1,0,NULL,NULL,'S75',NULL),(713,NULL,'Productlabel',1,0,NULL,NULL,'S76',NULL),(714,NULL,'Eetbaar/ niet eetbaar',1,0,NULL,NULL,'S77',NULL),(715,NULL,'Plantmaat zonder pot',1,0,NULL,NULL,'S78',NULL),(716,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S79',NULL),(717,NULL,'Maximum percentage oud ho',1,0,NULL,NULL,'S80',NULL),(718,NULL,'Maximum lengte verschil',1,0,NULL,NULL,'S81',NULL),(719,NULL,'Bladkleur',1,0,NULL,NULL,'S82',NULL),(720,NULL,'Plantgewicht',1,0,NULL,NULL,'S83',NULL),(721,NULL,'Diámetro',1,0,NULL,NULL,'S84',NULL),(722,NULL,'Bloem/bes/vruchtkleur 2',1,0,NULL,NULL,'S85',NULL),(723,NULL,'Winterhardheid (USDA zone',1,0,NULL,NULL,'S86',NULL),(724,NULL,'Kleurbehandeld',1,0,NULL,NULL,'S87','inkFk'),(725,NULL,'Bloem-/bladkleurverdeling',1,0,NULL,NULL,'S88',NULL),(726,NULL,'Diámetro del capullo',1,0,NULL,NULL,'S89',NULL),(727,NULL,'Volume inhoud',1,0,NULL,NULL,'S90',NULL),(728,NULL,'Vruchtbenaming',1,0,NULL,NULL,'S91',NULL),(729,NULL,'Vaaslevenindex',1,0,NULL,NULL,'S92',NULL),(730,NULL,'Overige informatie plante',1,0,NULL,NULL,'S93',NULL),(731,NULL,'Overige informatie snijbl',1,0,NULL,NULL,'S94',NULL),(732,NULL,'Toepassingsmogelijkheid',1,0,NULL,NULL,'S95',NULL),(733,NULL,'Productbeeld aanvoerder',1,0,NULL,NULL,'S96',NULL),(734,NULL,'MPS certificering',1,0,NULL,NULL,'S97',NULL),(735,NULL,'Kwaliteitsgroep',1,0,NULL,NULL,'S98',NULL),(736,NULL,'Artikelomschrijving',1,0,NULL,NULL,'S99',NULL),(737,NULL,'BTW-tarief',1,0,NULL,NULL,'T01',NULL),(738,NULL,'Prijseenheid',1,0,NULL,NULL,'T02',NULL),(739,NULL,'Transactievorm',1,0,NULL,NULL,'T03',NULL),(740,NULL,'Handelsverpakking voorwaa',1,0,NULL,NULL,'T10',NULL),(741,NULL,'Consumentenverpakking voo',1,0,NULL,NULL,'T11',NULL),(742,NULL,'Leveringsvoorwaarden',1,0,NULL,NULL,'T12',NULL),(743,NULL,'PT heffing voorwaarden',1,0,NULL,NULL,'T13',NULL),(744,NULL,'Serviceheffing voorwaarde',1,0,NULL,NULL,'T14',NULL),(745,NULL,'Algemene voorwaarden',1,0,NULL,NULL,'T15',NULL),(746,NULL,'Marktvorm',1,0,NULL,NULL,'T16',NULL),(747,NULL,'Themadagen',1,0,NULL,NULL,'T17',NULL),(748,NULL,'Handelscategorie',1,0,NULL,NULL,'T18',NULL),(749,NULL,'Producentengroepen',1,0,NULL,NULL,'T19',NULL),(750,NULL,'Favorieten Id',1,0,NULL,NULL,'T20',NULL),(751,NULL,'Verkoopeenheid',1,0,NULL,NULL,'T21',NULL),(752,NULL,'Veilgroep voorkeur',1,0,NULL,NULL,'V01',NULL),(753,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V02',NULL),(754,NULL,'Keurmeesternummer FloraHo',1,0,NULL,NULL,'V03',NULL),(755,NULL,'Rijnummer Rijnsburg',1,0,NULL,NULL,'V04',NULL),(756,NULL,'Verwerkingslocatie FloraH',1,0,NULL,NULL,'V05',NULL),(757,NULL,'FloraHolland Financial',1,0,NULL,NULL,'V06',NULL),(758,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V07',NULL),(759,NULL,'Benefiet veiling',1,0,NULL,NULL,'V08',NULL),(760,NULL,'Kloksoort',1,0,NULL,NULL,'V09',NULL),(761,NULL,'Minimumprijs aanvoerder',1,0,NULL,NULL,'V10',NULL),(762,NULL,'Rest aantallen',1,0,NULL,NULL,'V11',NULL),(763,NULL,'Veilsoort',1,0,NULL,NULL,'V12',NULL),(764,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V13',NULL),(765,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V14',NULL),(766,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V15',NULL),(767,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V16',NULL),(768,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V17',NULL),(769,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V18',NULL),(770,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V19',NULL),(771,NULL,'Gereserveerd',1,0,NULL,NULL,'V20',NULL),(772,NULL,'Veilgroep Aalsmeer',1,0,NULL,NULL,'V21',NULL),(773,NULL,'Promotie kenmerk FloraHol',1,0,NULL,NULL,'V22',NULL),(774,NULL,'Verrekening snijbloemenvo',1,0,NULL,NULL,'V23',NULL),(775,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V24',NULL),(776,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V25',NULL),(777,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V26',NULL),(778,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V27',NULL),(779,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V28',NULL),(780,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V29',NULL),(781,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V30',NULL),(782,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V31',NULL),(783,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V32',NULL),(784,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V33',NULL),(785,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V34',NULL),(786,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V35',NULL),(787,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V36',NULL),(788,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V37',NULL),(789,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V38',NULL),(790,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V39',NULL),(791,NULL,'Gereserveerd',1,0,NULL,NULL,'V40',NULL),(792,NULL,'Tussenopslag klok Plantio',1,0,NULL,NULL,'V41',NULL),(793,NULL,'Soort ladingsdrager Plant',1,0,NULL,NULL,'V42',NULL),(794,NULL,'Logistiek middel Plantion',1,0,NULL,NULL,'V43',NULL),(795,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V44',NULL),(796,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V45',NULL),(797,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V46',NULL),(798,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V47',NULL),(799,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V48',NULL),(800,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V49',NULL),(801,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V50',NULL),(802,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V51',NULL),(803,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V52',NULL),(804,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V53',NULL),(805,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V54',NULL),(806,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V55',NULL),(807,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V56',NULL),(808,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V57',NULL),(809,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V58',NULL),(810,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V59',NULL),(811,NULL,'Gereserveerd',1,0,NULL,NULL,'V60',NULL),(812,NULL,'Veilgroep Plantion Ede',1,0,NULL,NULL,'V61',NULL),(813,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V62',NULL),(814,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V63',NULL),(815,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V64',NULL),(816,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V65',NULL),(817,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V66',NULL),(818,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V67',NULL),(819,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V68',NULL),(820,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V69',NULL),(821,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V70',NULL),(822,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V71',NULL),(823,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V72',NULL),(824,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V73',NULL),(825,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V74',NULL),(826,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V75',NULL),(827,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V76',NULL),(828,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V77',NULL),(829,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V78',NULL),(830,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V79',NULL),(831,NULL,'Toegevoegde waardes VRM',1,0,NULL,NULL,'V80',NULL),(832,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V81',NULL),(833,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V82',NULL),(834,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V83',NULL),(835,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V84',NULL),(836,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V85',NULL),(837,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V86',NULL),(838,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V87',NULL),(839,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V88',NULL),(840,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V89',NULL),(841,NULL,'Veiling',1,0,NULL,NULL,'V99',NULL),(842,NULL,'kopersaantallen',1,0,NULL,NULL,'Z01',NULL),(843,NULL,'Caducidad',1,0,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `tag` ENABLE KEYS */; UNLOCK TABLES; @@ -340,7 +340,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:51:01 +-- Dump completed on 2020-09-09 11:46:35 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -378,7 +378,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:51:01 +-- Dump completed on 2020-09-09 11:46:35 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -436,7 +436,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:51:03 +-- Dump completed on 2020-09-09 11:46:36 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -511,7 +511,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,1040,1,'Av espioca 100',552703),(2,'Mercaflor',19,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL),(4,'VNH',NULL,NULL,3,NULL,NULL),(5,'Madrid',28,2852,5,'Av constitución 3',554145),(6,'Vilassar',88,88031,2,'Cami del Crist, 33',556412),(7,'Tenerife',NULL,NULL,10,NULL,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,1056,1,'Av espioca 100',552703),(2,'Mercaflor',19,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL),(4,'VNH',NULL,NULL,3,NULL,NULL),(5,'Madrid',28,2852,5,'Av constitución 3',554145),(6,'Vilassar',88,88031,2,'Cami del Crist, 33',556412),(7,'Tenerife',NULL,NULL,10,NULL,NULL); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -524,4 +524,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:51:04 +-- Dump completed on 2020-09-09 11:46:38 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index ce0c634ac..3514cb4d4 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1910,6 +1910,7 @@ 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', 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'; @@ -2655,14 +2656,14 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2020-08-05 02:45:17' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2020-08-05 03:00:00' ON COMPLETION PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -3161,7 +3162,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 PROCEDURE IF EXISTS `clientNewBorn_Update__` */; +/*!50003 DROP PROCEDURE IF EXISTS `clientNewBorn_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -3171,24 +3172,82 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clientNewBorn_Update__`() -BEGIN +CREATE DEFINER=`root`@`%` PROCEDURE `clientNewBorn_recalc`() +BLOCK1: BEGIN - DECLARE fromDated DATE DEFAULT '2019-04-01'; - - -- Eliminamos clientes que ya no son nuevos - DELETE FROM bs.clientNewBorn - WHERE shipped < TIMESTAMPADD(YEAR,-1,CURDATE()); + DECLARE vClientFk INT; + DECLARE vShipped DATE; + DECLARE vPreviousShipped DATE; + DECLARE vDone boolean; + DECLARE cur cursor for + + SELECT clientFk, firstShipped + FROM bs.clientNewBorn; - -- Clientes nuevos - REPLACE bs.clientNewBorn(clientFk,shipped) - SELECT t.clientFk, MIN(t.shipped) as shipped - FROM vn.ticket t - WHERE shipped > '2001-01-01' - GROUP BY t.clientFk - HAVING shipped >= GREATEST(TIMESTAMPADD(YEAR,-1,CURDATE()), fromDated); - -END ;; + DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; + SET vDone := FALSE; + + DELETE FROM bs.clientNewBorn WHERE isModified = FALSE; + + INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped) + SELECT c.id, MAX(t.shipped), MAX(t.shipped) + 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 + GROUP BY c.id; + OPEN cur; + + LOOP1: LOOP + SET vDone := FALSE; + FETCH cur INTO vClientFk, vShipped; + + IF vDone THEN + CLOSE cur; + LEAVE LOOP1; + END IF; + + BLOCK2: BEGIN + DECLARE vCurrentShipped DATE; + DECLARE vDone2 boolean; + DECLARE cur2 CURSOR FOR + SELECT shipped + FROM vn.ticket + WHERE clientFk = vClientFk AND shipped <= CURDATE() + ORDER BY shipped DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone2 = TRUE; + SET vDone2 := FALSE; + OPEN cur2; + + SET vPreviousShipped := vShipped; + LOOP2: LOOP + SET vDone2 := FALSE; + FETCH cur2 INTO vCurrentShipped; + + IF DATEDIFF(vPreviousShipped,vCurrentShipped) > 365 THEN + UPDATE bs.clientNewBorn + SET firstShipped = vPreviousShipped + WHERE clientFk= vClientFk; + + CLOSE cur2; + LEAVE LOOP2; + END IF; + + SET vPreviousShipped := vCurrentShipped; + + IF vDone2 THEN + UPDATE bs.clientNewBorn + SET firstShipped = vCurrentShipped + WHERE clientFk= vClientFk; + CLOSE cur2; + LEAVE LOOP2; + END IF; + + END LOOP LOOP2; + END BLOCK2; + END LOOP LOOP1; +END BLOCK1 ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -3205,6 +3264,131 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto`(IN vWorker INT, vDate DATE) +BEGIN + DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01'); + DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate)); + + CALL vn.worker_GetHierarchy(vWorker); + + INSERT IGNORE INTO tmp.workerHierarchyList (workerFk) + SELECT wd2.workerFk + FROM vn.workerDepartment wd2 + WHERE wd2.workerFk = vWorker; + + -- Falta que en algunos casos solo tenga en cuenta los tipos afectados. + SELECT + c.Id_Cliente id_cliente, + c.calidad, + c.Cliente cliente, + cr.recobro * 100 tarifa, + c.Telefono telefono, + c.movil, + c.POBLACION poblacion, + p.`name` provincia, + vn2008.red(f.futur) futur, + c.Credito credito, + pm.`name` forma_pago, + vn2008.red(c365 / 12) consumo_medio365, + vn2008.red(c365) consumo365, + vn2008.red(CmLy.peso) peso_mes_año_pasado, + vn2008.red(CmLy.peso * 1.19) objetivo, + tr.CodigoTrabajador, + vn2008.red(mes_actual.consumo) consumoMes, + vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, + DATE(LastTicket) ultimo_ticket, + dead.muerto, + g.Greuge, + cr.recobro + FROM + vn2008.Clientes c + LEFT JOIN + (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge + FROM vn2008.Greuges g + JOIN vn.`client` c ON c.id = g.Id_Cliente + LEFT JOIN vn.worker w ON c.salesPersonFk = w.id + WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker) + GROUP BY Id_Cliente + ) g ON g.Id_Cliente = c.Id_Cliente + LEFT JOIN + vn2008.province p ON p.province_id = c.province_id + JOIN + vn2008.pay_met pm ON pm.id = c.pay_met_id + LEFT JOIN + vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + LEFT JOIN + bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 + FROM bs.ventas v + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate + GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT + Id_Cliente, SUM(importe) consumo + FROM + bs.ventas v + INNER JOIN vn2008.Clientes c USING (Id_Cliente) + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) + GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT t.Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur + FROM vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND t.Fecha BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate)) + GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente + LEFT JOIN + (SELECT MAX(t.Fecha) LastTicket, c.Id_Cliente + FROM vn2008.Tickets t + JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente + LEFT JOIN + ( + SELECT SUM(importe) peso, c.Id_Cliente + FROM bs.ventas v + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE fecha BETWEEN vAYearAgoStarted and vAYearAgoEnded + AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente + LEFT JOIN + (SELECT c.Id_Cliente, + IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + FROM vn2008.Facturas f + JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador + WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente + JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador; + + DROP TEMPORARY TABLE tmp.workerHierarchyList; +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `comercialesCompleto__` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto__`(IN vWorker INT, vDate DATE) BEGIN CALL vn.worker_GetHierarchy(vWorker); @@ -3348,17 +3532,17 @@ 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 PROCEDURE IF EXISTS `comercialesCompleto__` */; +/*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto___` */; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto__`(IN vWorker INT, vDate DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto___`(IN vWorker INT, vDate DATE) BEGIN CALL vn.worker_GetHierarchy(vWorker); @@ -6085,7 +6269,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2017-01-23 13:15:58' ON COMPLETION NOT PRESERVE ENABLE DO CALL cacheCalc_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2017-01-23 13:15:58' ON COMPLETION NOT PRESERVE ENABLE DO CALL cacheCalc_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -6103,7 +6287,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2019-04-29 13:06:16' ON COMPLETION NOT PRESERVE ENABLE DO CALL cache_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2019-04-29 13:06:16' ON COMPLETION NOT PRESERVE ENABLE DO CALL cache_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -7208,9 +7392,9 @@ CREATE TABLE `bucket` ( `bucket_id` int(11) unsigned NOT NULL, `bucket_type_id` mediumint(8) unsigned NOT NULL, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `x_size` mediumint(8) unsigned NOT NULL, - `y_size` mediumint(8) unsigned NOT NULL, - `z_size` mediumint(8) unsigned NOT NULL, + `x_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', + `y_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', + `z_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', `entry_date` date DEFAULT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, @@ -7392,7 +7576,8 @@ CREATE TABLE `feature` ( `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, - PRIMARY KEY (`item_id`,`feature_type_id`) + PRIMARY KEY (`item_id`,`feature_type_id`), + KEY `feature_ix1` (`feature_value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -7658,7 +7843,11 @@ CREATE TABLE `marketPlace` ( `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `supplierFk` int(11) NOT NULL DEFAULT '1433', `isOffered` tinyint(2) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) + `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', + PRIMARY KEY (`id`), + KEY `marketPlaceisOfferedIdx` (`isOffered`), + KEY `marketPlaceMaxLatestIdx` (`MaxLatestDeliveryHour`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -7746,6 +7935,50 @@ 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 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `edi`.`putOrder_AFTER_UPDATE` AFTER UPDATE ON `putOrder` FOR EACH ROW +BEGIN + DECLARE vSaleFk INT; + DECLARE vOrderStatusDenied INT DEFAULT 3; + IF NEW.OrderStatus = vOrderStatusDenied AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) THEN + SELECT s.id INTO vSaleFk + FROM vn.sale s + 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() + AND i.supplyResponseFk = NEW.supplyResponseID; + + UPDATE vn.sale s + SET s.quantity = 0 + WHERE s.id = vSaleFk; + + INSERT INTO vn.mail (sender, `subject`, body) + SELECT CONCAT(account.userGetNameFromId(c.salesPersonFk), '@verdnatura.es'), + 'Error con disponible Floramondo', + CONCAT('El articulo ', s.concept, ' del ticket ', t.id , + ' ha sido cancelado por Floramondo. ', + ' Se ha actualizado la cantidad a 0. ', + 'https://salix.verdnatura.es/#!/ticket/', t.id ,'/summary') + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.`client` c ON c.id = t.clientFk + WHERE s.id = vSaleFk; + END IF; +END */;; +DELIMITER ; +/*!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 */ ; -- -- Table structure for table `specie` @@ -7784,6 +8017,52 @@ CREATE TABLE `supplier` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `supplyOffer__` +-- + +DROP TABLE IF EXISTS `supplyOffer__`; +/*!50001 DROP VIEW IF EXISTS `supplyOffer__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `supplyOffer__` AS SELECT + 1 AS `diId`, + 1 AS `srId`, + 1 AS `Item_ArticleCode`, + 1 AS `product_name`, + 1 AS `company_name`, + 1 AS `Price`, + 1 AS `Quality`, + 1 AS `s1`, + 1 AS `s2`, + 1 AS `s3`, + 1 AS `s4`, + 1 AS `s5`, + 1 AS `s6`, + 1 AS `NumberOfUnits`, + 1 AS `EmbalageCode`, + 1 AS `LatestDeliveryDateTime`, + 1 AS `EarliestDespatchDateTime`, + 1 AS `FirstOrderDateTime`, + 1 AS `LatestOrderDateTime`, + 1 AS `NumberOfItemsPerCask`, + 1 AS `NumberOfLayersPerTrolley`, + 1 AS `MinimumNumberToOrder`, + 1 AS `MaximumNumberToOrder`, + 1 AS `IncrementalOrderableQuantity`, + 1 AS `PackingPrice`, + 1 AS `MarketPlaceID`, + 1 AS `PictureReference`, + 1 AS `group_id`, + 1 AS `marketPlace`, + 1 AS `DeliveryPrice`, + 1 AS `ChargeAmount`, + 1 AS `MinimumQuantity`, + 1 AS `MaximumQuantity`, + 1 AS `OrderUnit`, + 1 AS `IncrementalOrderUnit`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `supplyResponse` -- @@ -7844,7 +8123,10 @@ CREATE TABLE `supplyResponse` ( PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`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`) + KEY `supplyResponse_Ix1` (`Item_ArticleCode`), + KEY `supplyResponseMarcketIdx` (`MarketPlaceID`), + KEY `supplyResponseNumberOfUnitsIdx` (`NumberOfUnits`), + KEY `supplyResponseEmbalageCodeIdx` (`EmbalageCode`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -7893,14 +8175,14 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 5 MINUTE STARTS '2020-07-29 01:58:29' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 5 MINUTE STARTS '2020-07-29 01:58:29' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -8591,16 +8873,342 @@ DELIMITER ; /*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh`() +BEGIN + DECLARE vLanded DATETIME; + DECLARE done INT DEFAULT FALSE; + DECLARE vFreeId INT; + DECLARE vSupplyResponseFk INT; + DECLARE vLastInserted DATETIME; + + DECLARE cur1 CURSOR FOR + SELECT newId + FROM vn.item_Free_Id; + + DECLARE cur2 CURSOR FOR + SELECT srId + FROM itemToInsert; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp; + CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY + SELECT * FROM ( + SELECT * + FROM edi.supplyOffer + ORDER BY NumberOfUnits DESC) t + JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id + GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Price, Quality, NumberOfItemsPerCask, EmbalageCode; + + DROP TEMPORARY TABLE IF EXISTS edi.offer; + CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`)) ENGINE = MEMORY + SELECT so.*, ev1.type_description s1Value, ev2.type_description s2Value, ev3.type_description s3Value, + ev4.type_description s4Value, ev5.type_description s5Value, ev6.type_description s6Value, + eif1.feature ef1, eif2.feature ef2, eif3.feature ef3, eif4.feature ef4, eif5.feature ef5, eif6.feature ef6 + FROM tmp so + LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode + AND eif1.presentation_order = 1 AND eif1.expiry_date IS NULL + LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode + AND eif2.presentation_order = 2 AND eif2.expiry_date IS NULL + LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode + AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL + LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode + AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL + LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode + AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL + LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode + AND eif6.presentation_order = 6 AND eif6.expiry_date IS NULL + LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature AND so.s1 = ev1.type_value + LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature AND so.s2 = ev2.type_value + LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature AND so.s3 = ev3.type_value + LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature AND so.s4 = ev4.type_value + LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature AND so.s5 = ev5.type_value + LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value; + + DROP TEMPORARY TABLE tmp; + + -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos + UPDATE IGNORE edi.offer o + LEFT JOIN vn.item iExist ON iExist.supplyResponseFk = o.srID + JOIN vn.item i ON i.name = o.product_name + AND i.subname <=> o.company_name + AND i.value5 <=> o.s1Value + AND i.value6 <=> o.s2Value + AND i.value7 <=> o.s3Value + AND i.value8 <=> o.s4Value + AND i.value9 <=> o.s5Value + AND i.value10 <=> o.s6Value + SET i.supplyResponseFk = o.srID + WHERE iExist.id IS NULL; + + DROP TEMPORARY TABLE IF EXISTS itemToInsert; + CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY + SELECT o.*, 999999 as itemFk + FROM edi.offer o + LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId + WHERE i.id IS NULL; + + -- Reciclado de nº de item + + OPEN cur1; + OPEN cur2; + +read_loop: LOOP + + FETCH cur2 INTO vSupplyResponseFk; + + IF done THEN + + LEAVE read_loop; + + END IF; + + FETCH cur1 INTO vFreeId; + + IF done THEN + + CLOSE cur1; + OPEN cur1; + FETCH cur1 INTO vFreeId; + + END IF; + + IF done THEN + + UPDATE itemToInsert + SET itemFk = NULL + WHERE itemFk = 999999; + + LEAVE read_loop; + + END IF; + + UPDATE itemToInsert + SET itemFk = vFreeId + WHERE srId = vSupplyResponseFk; + +END LOOP; + + CLOSE cur1; + CLOSE cur2; + + + -- Insertamos todos los items en Articles de la oferta + INSERT INTO vn.item( id, + `name`, + longName, + subName, + expenceFk, + typeFk, + intrastatFk, + originFk, + supplyResponseFk) + SELECT itemFk, + product_name, + product_name, + company_name, + expenseFk, + itemTypeFk, + intrastatFk, + originFk, + `srId` + FROM itemToInsert; + + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) + SELECT i.id, PictureReference + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.srId; + + -- Inserta si se añadiesen tags nuevos + INSERT IGNORE INTO vn.tag (name, ediTypeFk) + SELECT description, type_id FROM edi.type; + + -- Inserta los tags sólo en los articulos nuevos + + -- desabilita el trigger para recalcular los tags al final + SET @isTriggerDisabled = TRUE; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , CONCAT(ii.product_name,IF(ii.Quality != 'A1', CONCAT(' ',ii.Quality),'')), 1 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Producto' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.company_name, 4 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Productor' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s1Value, 5 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef1 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s1Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s2Value, 6 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef2 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s2Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s3Value, 7 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef3 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s3Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 8 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef4 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s4Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 9 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef5 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s5Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 10 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef6 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s6Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 11 + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + JOIN vn.tag t ON t.`name` = 'Color' + JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' + JOIN vn.ink ON ink.dutchCode = f.feature_value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 12 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Calidad' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + DROP TABLE IF EXISTS tmp.item; + CREATE TABLE tmp.item + (PRIMARY KEY (id)) + SELECT i.id FROM vn.item i + JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; + + CALL vn.item_refreshTags(); + + SET @isTriggerDisabled = FALSE; + + SELECT MIN(LatestOrderDateTime) INTO vLanded + FROM edi.offer o + JOIN marketPlace mp ON mp.id = o.MarketPlaceID + WHERE mp.isLatestOrderDateTimeRelevant; + + SET @myEntry := vn.floramondo_getEntry(vLanded); + IF @myEntry THEN + + -- Inserta la oferta obsoleta + DELETE b FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + LEFT JOIN edi.offer o ON i.supplyResponseFk = o.`srId` + WHERE b.entryFk = @myEntry AND o.`srId` IS NULL; + -- actualiza la oferta existente + UPDATE vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.offer o ON i.supplyResponseFk = o.`srId` + SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, + b.buyingValue = o.price + WHERE b.entryFk = @myEntry + AND (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); + + SET vLastInserted := NOW(); + -- Inserta la oferta + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, + packageFk, + deliveryFk) + + SELECT @myEntry, + i.id, + o.NumberOfUnits * o.NumberOfItemsPerCask as quantity, + o.Price, + o.NumberOfUnits as etiquetas, + o.NumberOfItemsPerCask as packing, + o.MinimumQuantity * o.NumberOfItemsPerCask as `grouping`, + 1, -- Obliga al Packing + o.embalageCode, + o.diId + FROM edi.offer o + JOIN vn.item i ON i.supplyResponseFk = o.srId + LEFT JOIN vn.buy b ON i.id = b.itemFk AND b.entryFk = @myEntry + JOIN vn.packaging p ON p.id like o.embalageCode -- llevar esta linea i mirar de crear els packages a temps real + WHERE b.id IS NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; + CREATE TEMPORARY TABLE tmp.buyRecalc + SELECT id from vn.buy where entryFk = @myEntry AND created >= vLastInserted; + + CALL vn.buy_recalcPrices(); + END IF; + DROP TEMPORARY TABLE + edi.offer, + itemToInsert; + + DROP TABLE tmp.item; + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `floramondo_offerRefresh_beta` */; +/*!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' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh`() +CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh_beta`() BEGIN DECLARE vLanded DATE; + DECLARE done INT DEFAULT FALSE; + DECLARE vFreeId INT; + DECLARE vSupplyResponseFk INT; + DECLARE cur1 CURSOR FOR + SELECT newId + FROM vn.item_Free_Id; + + DECLARE cur2 CURSOR FOR + SELECT srId + FROM itemToInsert; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DROP TEMPORARY TABLE IF EXISTS tmp; CREATE TEMPORARY TABLE tmp ENGINE = MEMORY SELECT * FROM ( @@ -8608,7 +9216,6 @@ BEGIN FROM edi.supplyOffer JOIN edi.marketPlace mp ON mp.id = MarketPlaceID WHERE mp.isOffered = TRUE - -- OR diId IN(35413041, 35408673, 35335122, 35400930) ORDER BY NumberOfUnits DESC) t JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Price, Quality, NumberOfItemsPerCask, EmbalageCode; @@ -8653,16 +9260,61 @@ BEGIN AND i.value10 <=> o.s6Value SET i.supplyResponseFk = o.srID WHERE iExist.id IS NULL; - + DROP TEMPORARY TABLE IF EXISTS itemToInsert; CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY - SELECT o.* + SELECT o.*, 999999 as itemFk FROM edi.offer o LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId WHERE i.id IS NULL; - + + -- Reciclado de nº de item + + OPEN cur1; + OPEN cur2; + +read_loop: LOOP + + FETCH cur2 INTO vSupplyResponseFk; + + IF done THEN + + LEAVE read_loop; + + END IF; + + FETCH cur1 INTO vFreeId; + + IF done THEN + + CLOSE cur1; + OPEN cur1; + FETCH cur1 INTO vFreeId; + + END IF; + + IF done THEN + + UPDATE itemToInsert + SET itemFk = NULL + WHERE itemFk = 999999; + + LEAVE read_loop; + + END IF; + + UPDATE itemToInsert + SET itemFk = vFreeId + WHERE srId = vSupplyResponseFk; + +END LOOP; + + CLOSE cur1; + CLOSE cur2; + + -- Insertamos todos los items en Articles de la oferta - INSERT IGNORE INTO vn.item(`name`, + INSERT INTO vn.item(`name`, longName, subName, expenceFk, @@ -8679,7 +9331,7 @@ BEGIN originFk, srId FROM itemToInsert; - + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) SELECT i.id, PictureReference FROM itemToInsert ii @@ -8703,7 +9355,7 @@ BEGIN INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id , ii.company_name, 4 FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Marca' + JOIN vn.tag t ON t.`name` = 'Productor' JOIN vn.item i ON i.supplyResponseFk = ii.srId; INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) @@ -8714,7 +9366,7 @@ BEGIN WHERE s1Value; INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , REPLACE(s2Value," en 'op'","+") , 6 + SELECT i.id, t.id , s2Value, 6 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef2 JOIN vn.item i ON i.supplyResponseFk = ii.srId @@ -8730,8 +9382,9 @@ BEGIN INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id , ii.Quality, 8 FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Calidad' - JOIN vn.item i ON i.supplyResponseFk = ii.srId; + JOIN vn.tag t ON t.ediTypeFk = ii.ef4 + JOIN vn.item i ON i.supplyResponseFk = ii.srId + WHERE s4Value; INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id , s5Value, 9 @@ -8739,7 +9392,29 @@ BEGIN JOIN vn.tag t ON t.ediTypeFk = ii.ef5 JOIN vn.item i ON i.supplyResponseFk = ii.srId WHERE s5Value; - + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 10 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef6 + JOIN vn.item i ON i.supplyResponseFk = ii.srId + WHERE s6Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 11 + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.srId + JOIN vn.tag t ON t.`name` = 'Color' + JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' + JOIN vn.ink ON ink.dutchCode = f.feature_value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 12 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Calidad' + JOIN vn.item i ON i.supplyResponseFk = ii.srId; + DROP TABLE IF EXISTS tmp.item; CREATE TABLE tmp.item (PRIMARY KEY (id)) @@ -8768,7 +9443,7 @@ BEGIN SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, b.buyingValue = o.price WHERE b.entryFk = @myEntry; - + -- Inserta la oferta INSERT INTO vn.buy(entryFk, itemFk, @@ -8794,6 +9469,7 @@ BEGIN FROM edi.offer o JOIN vn.item i ON i.supplyResponseFk = o.srId LEFT JOIN vn.buy b ON i.id = b.itemFk + JOIN vn.packaging p ON p.id = o.embalageCode -- llevar esta linea i mirar de crear els packages a temps real WHERE b.id IS NULL AND NOT b.entryFk <=> @myEntry; CALL vn2008.buy_tarifas_entry(@myEntry); @@ -8803,7 +9479,625 @@ BEGIN itemToInsert; DROP TABLE tmp.item; + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `floramondo_offerRefresh_gamma` */; +/*!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' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh_gamma`() +BEGIN + DECLARE vLanded DATETIME; + DECLARE done INT DEFAULT FALSE; + DECLARE vFreeId INT; + DECLARE vSupplyResponseFk INT; + + DECLARE cur1 CURSOR FOR + SELECT newId + FROM vn.item_Free_Id; + + DECLARE cur2 CURSOR FOR + SELECT srId + FROM itemToInsert; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp; + CREATE TEMPORARY TABLE tmp (INDEX (`srID`), INDEX (`EmbalageCode`)) ENGINE = MEMORY + SELECT * FROM ( + SELECT * + FROM edi.supplyOffer + JOIN edi.marketPlace mp ON mp.id = MarketPlaceID + WHERE mp.isOffered = TRUE + ORDER BY NumberOfUnits DESC) t + JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id + GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Price, Quality, NumberOfItemsPerCask, EmbalageCode; + + DROP TEMPORARY TABLE IF EXISTS edi.offer; + CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`)) ENGINE = MEMORY + SELECT so.*, ev1.type_description s1Value, ev2.type_description s2Value, ev3.type_description s3Value, + ev4.type_description s4Value, ev5.type_description s5Value, ev6.type_description s6Value, + eif1.feature ef1, eif2.feature ef2, eif3.feature ef3, eif4.feature ef4, eif5.feature ef5, eif6.feature ef6 + FROM tmp so + LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode + AND eif1.presentation_order = 1 AND eif1.expiry_date IS NULL + LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode + AND eif2.presentation_order = 2 AND eif2.expiry_date IS NULL + LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode + AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL + LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode + AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL + LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode + AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL + LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode + AND eif6.presentation_order = 6 AND eif6.expiry_date IS NULL + LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature AND so.s1 = ev1.type_value + LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature AND so.s2 = ev2.type_value + LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature AND so.s3 = ev3.type_value + LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature AND so.s4 = ev4.type_value + LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature AND so.s5 = ev5.type_value + LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value; + + DROP TEMPORARY TABLE tmp; + + -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos + UPDATE IGNORE edi.offer o + LEFT JOIN vn.item iExist ON iExist.supplyResponseFk = o.srID + JOIN vn.item i ON i.name = o.product_name + AND i.subname <=> o.company_name + AND i.value5 <=> o.s1Value + AND i.value6 <=> o.s2Value + AND i.value7 <=> o.s3Value + AND i.value8 <=> o.s4Value + AND i.value9 <=> o.s5Value + AND i.value10 <=> o.s6Value + SET i.supplyResponseFk = o.srID + WHERE iExist.id IS NULL; + + DROP TEMPORARY TABLE IF EXISTS itemToInsert; + CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY + SELECT o.*, 999999 as itemFk + FROM edi.offer o + LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId + WHERE i.id IS NULL; + + -- Reciclado de nº de item + + OPEN cur1; + OPEN cur2; + +read_loop: LOOP + + FETCH cur2 INTO vSupplyResponseFk; + + IF done THEN + + LEAVE read_loop; + + END IF; + + FETCH cur1 INTO vFreeId; + + IF done THEN + + CLOSE cur1; + OPEN cur1; + FETCH cur1 INTO vFreeId; + + END IF; + + IF done THEN + + UPDATE itemToInsert + SET itemFk = NULL + WHERE itemFk = 999999; + + LEAVE read_loop; + + END IF; + + UPDATE itemToInsert + SET itemFk = vFreeId + WHERE srId = vSupplyResponseFk; + +END LOOP; + + CLOSE cur1; + CLOSE cur2; + + + -- Insertamos todos los items en Articles de la oferta + INSERT INTO vn.item( id, + `name`, + longName, + subName, + expenceFk, + typeFk, + intrastatFk, + originFk, + supplyResponseFk, + compression) + SELECT iti.itemFk, + iti.product_name, + iti.product_name, + iti.company_name, + iti.expenseFk, + iti.itemTypeFk, + iti.intrastatFk, + iti.originFk, + iti.srId, + IF(it.categoryFk = 1, 0.7, 1) -- Flor cortada. Eliminar en 2021 + FROM itemToInsert iti + JOIN vn.itemType it ON it.id = iti.itemTypeFk; + + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) + SELECT i.id, PictureReference + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.srId; + + -- Inserta si se añadiesen tags nuevos + INSERT IGNORE INTO vn.tag (name, ediTypeFk) + SELECT description, type_id FROM edi.type; + + -- Inserta los tags sólo en los articulos nuevos + + -- desabilita el trigger para recalcular los tags al final + SET @isTriggerDisabled = TRUE; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , CONCAT(ii.product_name,IF(ii.Quality != 'A1', CONCAT(' ',ii.Quality),'')), 1 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Producto' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.company_name, 4 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Productor' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s1Value, 5 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef1 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s1Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s2Value, 6 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef2 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s2Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s3Value, 7 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef3 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s3Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 8 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef4 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s4Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 9 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef5 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s5Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 10 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef6 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s6Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 11 + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + JOIN vn.tag t ON t.`name` = 'Color' + JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' + JOIN vn.ink ON ink.dutchCode = f.feature_value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 12 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Calidad' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + DROP TABLE IF EXISTS tmp.item; + CREATE TABLE tmp.item + (PRIMARY KEY (id)) + SELECT i.id FROM vn.item i + JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; + + CALL vn.item_refreshTags(); + + SET @isTriggerDisabled = FALSE; + + SELECT MIN(LatestOrderDateTime) INTO vLanded + FROM edi.offer o + JOIN marketPlace mp ON mp.id = o.MarketPlaceID + WHERE mp.isLatestOrderDateTimeRelevant; + + SET @myEntry := vn.floramondo_getEntry(vLanded); + IF @myEntry THEN + -- Inserta la oferta obsoleta + DELETE b FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + LEFT JOIN edi.offer o ON i.supplyResponseFk = o.srId + WHERE b.entryFk = @myEntry AND o.id IS NULL; + -- actualiza la oferta existente + UPDATE vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.offer o ON i.supplyResponseFk = o.srId + SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, + b.buyingValue = o.price + WHERE b.entryFk = @myEntry + AND (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); + + -- Inserta la oferta + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, + packageFk, + deliveryFk) + + SELECT @myEntry, + i.id, + o.NumberOfUnits * o.NumberOfItemsPerCask as quantity, + o.Price, + o.NumberOfUnits as etiquetas, + o.NumberOfItemsPerCask as packing, + o.MinimumQuantity * o.NumberOfItemsPerCask as `grouping`, + 1, -- Obliga al Packing + o.embalageCode, + o.diId + FROM edi.offer o + JOIN vn.item i ON i.supplyResponseFk = o.srId + LEFT JOIN vn.buy b ON i.id = b.itemFk + JOIN vn.packaging p ON p.id = o.embalageCode -- llevar esta linea i mirar de crear els packages a temps real + WHERE b.id IS NULL AND NOT b.entryFk <=> @myEntry; + + CALL vn2008.buy_tarifas_entry(@myEntry); + END IF; + DROP TEMPORARY TABLE + edi.offer, + itemToInsert; + + DROP TABLE tmp.item; + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `floramondo_offerRefresh__` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `floramondo_offerRefresh__`() +BEGIN + DECLARE vLanded DATETIME; + DECLARE done INT DEFAULT FALSE; + DECLARE vFreeId INT; + DECLARE vSupplyResponseFk INT; + + DECLARE cur1 CURSOR FOR + SELECT newId + FROM vn.item_Free_Id; + + DECLARE cur2 CURSOR FOR + SELECT srId + FROM itemToInsert; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp; + CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY + SELECT * FROM ( + SELECT * + FROM edi.supplyOffer + ORDER BY NumberOfUnits DESC) t + JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id + GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Price, Quality, NumberOfItemsPerCask, EmbalageCode; + + DROP TEMPORARY TABLE IF EXISTS edi.offer; + CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`)) ENGINE = MEMORY + SELECT so.*, ev1.type_description s1Value, ev2.type_description s2Value, ev3.type_description s3Value, + ev4.type_description s4Value, ev5.type_description s5Value, ev6.type_description s6Value, + eif1.feature ef1, eif2.feature ef2, eif3.feature ef3, eif4.feature ef4, eif5.feature ef5, eif6.feature ef6 + FROM tmp so + LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode + AND eif1.presentation_order = 1 AND eif1.expiry_date IS NULL + LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode + AND eif2.presentation_order = 2 AND eif2.expiry_date IS NULL + LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode + AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL + LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode + AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL + LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode + AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL + LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode + AND eif6.presentation_order = 6 AND eif6.expiry_date IS NULL + LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature AND so.s1 = ev1.type_value + LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature AND so.s2 = ev2.type_value + LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature AND so.s3 = ev3.type_value + LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature AND so.s4 = ev4.type_value + LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature AND so.s5 = ev5.type_value + LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value; + + DROP TEMPORARY TABLE tmp; + + -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos + UPDATE IGNORE edi.offer o + LEFT JOIN vn.item iExist ON iExist.supplyResponseFk = o.srID + JOIN vn.item i ON i.name = o.product_name + AND i.subname <=> o.company_name + AND i.value5 <=> o.s1Value + AND i.value6 <=> o.s2Value + AND i.value7 <=> o.s3Value + AND i.value8 <=> o.s4Value + AND i.value9 <=> o.s5Value + AND i.value10 <=> o.s6Value + SET i.supplyResponseFk = o.srID + WHERE iExist.id IS NULL; + + DROP TEMPORARY TABLE IF EXISTS itemToInsert; + CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY + SELECT o.*, 999999 as itemFk + FROM edi.offer o + LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId + WHERE i.id IS NULL; + + -- Reciclado de nº de item + + OPEN cur1; + OPEN cur2; + +read_loop: LOOP + + FETCH cur2 INTO vSupplyResponseFk; + + IF done THEN + + LEAVE read_loop; + + END IF; + + FETCH cur1 INTO vFreeId; + + IF done THEN + + CLOSE cur1; + OPEN cur1; + FETCH cur1 INTO vFreeId; + + END IF; + + IF done THEN + + UPDATE itemToInsert + SET itemFk = NULL + WHERE itemFk = 999999; + + LEAVE read_loop; + + END IF; + + UPDATE itemToInsert + SET itemFk = vFreeId + WHERE srId = vSupplyResponseFk; + +END LOOP; + + CLOSE cur1; + CLOSE cur2; + + + -- Insertamos todos los items en Articles de la oferta + INSERT INTO vn.item( id, + `name`, + longName, + subName, + expenceFk, + typeFk, + intrastatFk, + originFk, + supplyResponseFk) + SELECT itemFk, + product_name, + product_name, + company_name, + expenseFk, + itemTypeFk, + intrastatFk, + originFk, + `srId` + FROM itemToInsert; + + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) + SELECT i.id, PictureReference + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.srId; + + -- Inserta si se añadiesen tags nuevos + INSERT IGNORE INTO vn.tag (name, ediTypeFk) + SELECT description, type_id FROM edi.type; + + -- Inserta los tags sólo en los articulos nuevos + + -- desabilita el trigger para recalcular los tags al final + SET @isTriggerDisabled = TRUE; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , CONCAT(ii.product_name,IF(ii.Quality != 'A1', CONCAT(' ',ii.Quality),'')), 1 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Producto' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.company_name, 4 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Productor' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s1Value, 5 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef1 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s1Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s2Value, 6 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef2 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s2Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s3Value, 7 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef3 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s3Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 8 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef4 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s4Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 9 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef5 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s5Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 10 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef6 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE s6Value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 11 + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + JOIN vn.tag t ON t.`name` = 'Color' + JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' + JOIN vn.ink ON ink.dutchCode = f.feature_value; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 12 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Calidad' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; + + DROP TABLE IF EXISTS tmp.item; + CREATE TABLE tmp.item + (PRIMARY KEY (id)) + SELECT i.id FROM vn.item i + JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; + + CALL vn.item_refreshTags(); + + SET @isTriggerDisabled = FALSE; + + SELECT MIN(LatestOrderDateTime) INTO vLanded + FROM edi.offer o + JOIN marketPlace mp ON mp.id = o.MarketPlaceID + WHERE mp.isLatestOrderDateTimeRelevant; + + SET @myEntry := vn.floramondo_getEntry(vLanded); + IF @myEntry THEN + + -- Inserta la oferta obsoleta + DELETE b FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + LEFT JOIN edi.offer o ON i.supplyResponseFk = o.`srId` + WHERE b.entryFk = @myEntry AND o.`srId` IS NULL; + -- actualiza la oferta existente + UPDATE vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.offer o ON i.supplyResponseFk = o.`srId` + SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, + b.buyingValue = o.price + WHERE b.entryFk = @myEntry + AND (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); + + -- Inserta la oferta + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, + packageFk, + deliveryFk) + + SELECT @myEntry, + i.id, + o.NumberOfUnits * o.NumberOfItemsPerCask as quantity, + o.Price, + o.NumberOfUnits as etiquetas, + o.NumberOfItemsPerCask as packing, + o.MinimumQuantity * o.NumberOfItemsPerCask as `grouping`, + 1, -- Obliga al Packing + o.embalageCode, + o.diId + FROM edi.offer o + JOIN vn.item i ON i.supplyResponseFk = o.srId + LEFT JOIN vn.buy b ON i.id = b.itemFk + JOIN vn.packaging p ON p.id = o.embalageCode -- llevar esta linea i mirar de crear els packages a temps real + WHERE b.id IS NULL AND NOT b.entryFk <=> @myEntry; + + CALL vn2008.buy_tarifas_entry(@myEntry); + END IF; + DROP TEMPORARY TABLE + edi.offer, + itemToInsert; + + DROP TABLE tmp.item; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10311,9 +11605,9 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -12382,7 +13676,7 @@ BEGIN FROM edi.deliveryInformation di JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - WHERE i.id = vItem + WHERE i.id = vItem AND di.LatestDeliveryDateTime > NOW() LIMIT 1; END LOOP; @@ -12626,7 +13920,7 @@ BEGIN concept = vConcept, quantity = vAmount, price = vPrice, - priceFixed = 0, + priceFixed = FALSE, isPriceFixed = TRUE; SET vSale = LAST_INSERT_ID(); @@ -12641,7 +13935,18 @@ BEGIN END IF; UPDATE order_row SET Id_Movimiento = vSale WHERE id = vRowId; - + + INSERT INTO edi.putOrder (deliveryInformationID, + supplyResponseId, + quantity, + EndUserPartyId, + EndUserPartyGLN) + SELECT di.ID, i.supplyResponseFk, vAmount / NumberOfItemsPerCask, FALSE, vClientId + FROM edi.deliveryInformation di + JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + WHERE i.id = vItem + LIMIT 1; END LOOP; CLOSE cRows; @@ -13306,6 +14611,7 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_undo` */; +ALTER DATABASE `hedera` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -13313,10 +14619,10 @@ DELIMITER ; /*!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 = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransaction_undo`(vSelf INT) -BEGIN +p: BEGIN DECLARE vCustomer INT; DECLARE vAmount DOUBLE; DECLARE vReceipt INT; @@ -13385,13 +14691,13 @@ BEGIN AND DATE(FECHA) = vDate AND EURODEBE = vAmount LIMIT 1; - + -- Actualiza la transaccion UPDATE tpvTransaction SET response = NULL, status = 'started' WHERE id = vSelf; - + COMMIT; END ;; DELIMITER ; @@ -13399,6 +14705,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 */ ; +ALTER DATABASE `hedera` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `visitUser_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15986,14 +17293,14 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2019-06-17 05:00:00' ON COMPLETION PRESERVE ENABLE DO CALL log_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2019-06-17 02:45:00' ON COMPLETION PRESERVE ENABLE DO CALL log_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -18330,6 +19637,7 @@ DROP TABLE IF EXISTS `accountingType`; CREATE TABLE `accountingType` ( `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', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='descripcio dels valors de la columna "cash" de la taula vn2008.Bancios'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -18493,6 +19801,9 @@ BEGIN WHERE id = NEW.clientFk; END IF; END IF; + IF NEW.isDefaultAddress AND NEW.isActive = FALSE THEN + CALL util.throw ('Cannot desactivate the default address'); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -19376,7 +20687,7 @@ DROP TABLE IF EXISTS `claim`; CREATE TABLE `claim` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ticketCreated` date NOT NULL, - `claimDepartmentFk` tinyint(3) unsigned DEFAULT NULL, + `claimDepartmentFk__` tinyint(3) unsigned DEFAULT NULL, `claimStateFk` int(10) unsigned NOT NULL DEFAULT '1', `observation` text COLLATE utf8_unicode_ci, `clientFk` int(11) NOT NULL, @@ -19387,14 +20698,14 @@ CREATE TABLE `claim` ( `ticketFk` int(11) DEFAULT NULL, `hasToPickUp` tinyint(1) NOT NULL, PRIMARY KEY (`id`), - KEY `cl_dep_id` (`claimDepartmentFk`), + KEY `cl_dep_id` (`claimDepartmentFk__`), KEY `cl_est_id` (`claimStateFk`), KEY `Id_Cliente` (`clientFk`), KEY `Id_Trabajador` (`workerFk`), KEY `cl_main_ticketFk_idx` (`ticketFk`), CONSTRAINT `cl_main_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_3` FOREIGN KEY (`claimStateFk`) REFERENCES `claimState` (`id`) ON UPDATE CASCADE, - CONSTRAINT `claim_ibfk_4` FOREIGN KEY (`claimDepartmentFk`) REFERENCES `vn2008`.`cl_dep` (`id`) ON UPDATE CASCADE, + CONSTRAINT `claim_ibfk_4` FOREIGN KEY (`claimDepartmentFk__`) REFERENCES `vn2008`.`cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_5` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19410,8 +20721,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`), @@ -19702,7 +21013,7 @@ CREATE TABLE `client` ( `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' COMMENT 'Deprecated', + `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', @@ -19753,6 +21064,9 @@ CREATE TABLE `client` ( `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', + `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Tipo de transacción por defecto asociado al cliente en SAGE', + `transferorFk` int(11) DEFAULT NULL COMMENT 'Cliente que le ha transmitido la titularidad de la empresa', PRIMARY KEY (`id`), UNIQUE KEY `IF` (`fi`), KEY `Id_Trabajador` (`salesPersonFk`), @@ -19768,12 +21082,16 @@ CREATE TABLE `client` ( KEY `codpos` (`codposOLD`,`postcode`), KEY `fk_Clientes_entity_idx` (`bankEntityFk`), KEY `typeFk` (`typeFk`), + KEY `client_taxTypeSageFk_idx` (`taxTypeSageFk`), + KEY `client_transactionTypeSageFk_idx` (`transactionTypeSageFk`), CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`contactChannelFk`) REFERENCES `contactChannel` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_ibfk_2` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_ibfk_3` FOREIGN KEY (`salesPersonFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `client_ibfk_4` FOREIGN KEY (`defaultAddressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `client_ibfk_5` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, + CONSTRAINT `client_taxTypeSageFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, + CONSTRAINT `client_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientTypeFk`) REFERENCES `clientType` (`id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -21000,9 +22318,9 @@ CREATE TABLE `creditClassification` ( /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -21013,7 +22331,7 @@ BEGIN END IF; IF NEW.dateEnd IS NOT NULL AND OLD.dateEnd IS NULL THEN UPDATE `client` c - SET creditInsurance = 0 WHERE c.id = NEW.client; + SET creditInsurance = NULL WHERE c.id = NEW.client; END IF; END */;; DELIMITER ; @@ -21407,6 +22725,20 @@ CREATE TABLE `deviceProductionUser` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `disabilityGrade` +-- + +DROP TABLE IF EXISTS `disabilityGrade`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `dms` -- @@ -21661,6 +22993,44 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE ) 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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_INSERT` BEFORE INSERT ON `duaTax` FOR EACH ROW +BEGIN + SET NEW.rate = duaTax_getRate(NEW.duaFk, NEW.taxClassFk); + SET NEW.tax = NEW.base * NEW.rate / 100; +END */;; +DELIMITER ; +/*!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 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_UPDATE` BEFORE UPDATE ON `duaTax` FOR EACH ROW +BEGIN + SET NEW.rate = duaTax_getRate(NEW.duaFk, NEW.taxClassFk); + SET NEW.tax = NEW.base * NEW.rate / 100; +END */;; +DELIMITER ; +/*!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 */ ; -- -- Temporary table structure for view `ediGenus` @@ -22419,14 +23789,37 @@ CREATE TABLE `expeditionScan` ( `expeditionFk` int(11) NOT NULL, `scanned` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `palletFk` int(11) NOT NULL, + `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `expeditionFk_UNIQUE` (`expeditionFk`), KEY `expeditionScan_fk1_idx` (`expeditionFk`), KEY `expeditionScan_fk2_idx` (`palletFk`), + KEY `expeditionScan_fk3_idx` (`workerFk`), CONSTRAINT `expeditionScan_fk1` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `expeditionScan_fk2` FOREIGN KEY (`palletFk`) REFERENCES `expeditionPallet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `expeditionScan_fk2` FOREIGN KEY (`palletFk`) REFERENCES `expeditionPallet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `expeditionScan_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) 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 */ ; +/*!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' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`expeditionScan_BEFORE_INSERT` BEFORE INSERT ON `expeditionScan` FOR EACH ROW +BEGIN + + SET NEW.workerFk = vn.getUser(); + +END */;; +DELIMITER ; +/*!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 */ ; -- -- Temporary table structure for view `expeditionScan_Monitor` @@ -22638,6 +24031,7 @@ DROP TABLE IF EXISTS `floramondoConfig`; CREATE TABLE `floramondoConfig` ( `id` int(11) NOT NULL, `entryFk` int(11) DEFAULT NULL COMMENT 'ultima entrada de floramondo', + `nextLanded` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22832,7 +24226,11 @@ CREATE TABLE `ink` ( `showOrder` int(11) NOT NULL, `ball` blob, `isCargex` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) + `dutchCode` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `hex` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL, + 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 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22989,6 +24387,20 @@ CREATE TABLE `invoiceCorrectionType` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- 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 VIEW `invoiceInAwb__` AS SELECT + 1 AS `invoiceInFk`, + 1 AS `awbFk`, + 1 AS `dua`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `invoiceInEntry__` -- @@ -23332,9 +24744,9 @@ CREATE TABLE `item` ( `hasKgPrice` tinyint(1) NOT NULL DEFAULT '0', `sectorFk` int(11) DEFAULT '2', `isFloramondo` tinyint(1) NOT NULL DEFAULT '0', + `isFragile` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'articulos solo para recogidas por su fragilidad', PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), - KEY `Article` (`name`), KEY `Color` (`inkFk`), KEY `id_origen` (`originFk`), KEY `Codintrastat` (`intrastatFk`), @@ -23344,6 +24756,7 @@ CREATE TABLE `item` ( KEY `ArticlesIsActive_idx` (`isActive`), KEY `item_ibfk_6_idx` (`sectorFk`), KEY `item_expenceFk` (`expenceFk`), + KEY `Article` (`name`,`subName`,`value5`,`value6`,`value7`,`value8`,`value9`,`value10`), CONSTRAINT `item_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `origin` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_2` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, @@ -23357,9 +24770,9 @@ CREATE TABLE `item` ( /*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!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' */ ; DELIMITER ;; @@ -23382,6 +24795,8 @@ BEGIN SET NEW.compression = vCompression; END IF; + + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -23767,6 +25182,9 @@ 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, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 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'; @@ -24665,6 +26083,18 @@ CREATE TABLE `itemVerdecora` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona nuestros articulos con los de Verdecora'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `item_Free_Id` +-- + +DROP TABLE IF EXISTS `item_Free_Id`; +/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `item_Free_Id` AS SELECT + 1 AS `newId`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `kk` -- @@ -24689,6 +26119,8 @@ SET character_set_client = utf8; /*!50001 CREATE VIEW `labelInfo` AS SELECT 1 AS `itemId`, 1 AS `itemName`, + 1 AS `stickers`, + 1 AS `life`, 1 AS `colorCode`, 1 AS `stems`, 1 AS `category`, @@ -24787,7 +26219,7 @@ DROP TABLE IF EXISTS `mail`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mail` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `replyTo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -25236,6 +26668,7 @@ CREATE TABLE `packaging` ( `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', PRIMARY KEY (`id`), KEY `packaging_fk1` (`itemFk`), KEY `packaging_fk2_idx` (`freightItemFk`), @@ -26232,7 +27665,7 @@ DROP TABLE IF EXISTS `receipt`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `receipt` ( `Id` int(11) NOT NULL AUTO_INCREMENT, - `invoiceFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `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', `payed` datetime DEFAULT NULL, @@ -27101,6 +28534,19 @@ SET character_set_client = utf8; 1 AS `shipped`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `salesPersonSince` +-- + +DROP TABLE IF EXISTS `salesPersonSince`; +/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `salesPersonSince` AS SELECT + 1 AS `workerFk`, + 1 AS `started`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `salesPreparedLastHour` -- @@ -27616,7 +29062,8 @@ CREATE TABLE `state` ( `isOK` tinyint(4) NOT NULL DEFAULT '0', `graphCategory` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), - UNIQUE KEY `code_UNIQUE` (`code`) + UNIQUE KEY `code_UNIQUE` (`code`), + KEY `state_id3` (`semaphore`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27689,6 +29136,9 @@ CREATE TABLE `supplier` ( `postcodeFk` int(11) unsigned DEFAULT NULL, `postCode` char(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, `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', PRIMARY KEY (`id`), UNIQUE KEY `cuenta` (`account`), UNIQUE KEY `NIF` (`nif`), @@ -27697,10 +29147,16 @@ CREATE TABLE `supplier` ( KEY `province_id` (`provinceFk`), KEY `pay_dem_id` (`payDemFk`), KEY `codpos` (`postCode`), + KEY `supplier_taxTypeFk_idx` (`taxTypeSageFk`), + KEY `supplier_withholdingFk_idx` (`withholdingSageFk`), + KEY `supplier_transactionFk_idx` (`transactionTypeSageFk`), CONSTRAINT `Id_Pais` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, - CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE + CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, + CONSTRAINT `supplier_taxTypeFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, + CONSTRAINT `supplier_transactionFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, + CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28075,6 +29531,7 @@ DELIMITER ;; BEGIN DECLARE vClientType VARCHAR(255); DECLARE vStateCode VARCHAR(255); + DECLARE vTransferorFirstShipped DATE; -- Borrar cuando se cambie el insert ticket en la APP móvil @@ -28092,10 +29549,15 @@ BEGIN FROM state WHERE `code` = vStateCode COLLATE utf8_general_ci; - IF YEAR(NEW.shipped) > 2000 THEN + IF YEAR(NEW.shipped) > 2000 THEN + SELECT cnb.firstShipped INTO vTransferorFirstShipped + FROM bs.clientNewBorn cnb + JOIN `client` c ON c.transferorFk = cnb.clientFk + WHERE c.id = NEW.clientFk; + INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) - VALUES(NEW.clientFk, NEW.shipped, NEW.shipped) - ON DUPLICATE KEY UPDATE lastShipped = NEW.shipped; + VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, CURDATE()), CURDATE()) + ON DUPLICATE KEY UPDATE lastShipped = CURDATE(); END IF; END */;; DELIMITER ; @@ -28131,6 +29593,7 @@ BEGIN SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); SET NEW.routeFk = NULL; + SET NEW.zoneFk = NULL; END IF; IF NEW.routeFk AND NEW.isDeleted THEN @@ -28161,6 +29624,22 @@ BEGIN CALL stock.log_add('ticket', NEW.id, OLD.id); END IF; + IF !(NEW.addressFk <=> OLD.addressFk) THEN + DELETE t + FROM ticketObservation t + JOIN observationType ot ON ot.id = t.observationTypeFk + WHERE t.ticketFk = NEW.id AND + ot.description = 'Repartidor'; + IF ROW_COUNT() > 0 THEN + INSERT INTO ticketLog (originFk, userFk, action, description) + VALUES (NEW.id, account.userGetId(), 'delete', CONCAT ('Notas de repartidor por cambio de consignatario')); + END IF; + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT NEW.id, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN address a ON a.id = ao.addressFk + WHERE a.id = NEW.addressFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28508,6 +29987,7 @@ CREATE TABLE `ticketParking` ( `ticketFk` int(11) NOT NULL, `parkingFk` int(11) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), UNIQUE KEY `ticketFk_UNIQUE` (`ticketFk`), @@ -28516,6 +29996,26 @@ CREATE TABLE `ticketParking` ( 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'; /*!40101 SET character_set_client = @saved_cs_client */; +/*!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' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT` BEFORE INSERT ON `ticketParking` FOR EACH ROW +BEGIN + + SET NEW.workerFk = vn.getUser(); + +END */;; +DELIMITER ; +/*!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 */ ; -- -- Temporary table structure for view `ticketPreviousPreparingList` @@ -29753,6 +31253,33 @@ CREATE TABLE `workerHourPrice` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `workerIrpf` +-- + +DROP TABLE IF EXISTS `workerIrpf`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerIrpf` ( + `workerFk` int(11) NOT NULL, + `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', + `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, + PRIMARY KEY (`workerFk`), + KEY `workerIrpf_disabilityGradeFk` (`disabilityGradeFk`), + CONSTRAINT `workerIrpf_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerIrpf_wokerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 1 - 4 y 5 '; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `workerJourney` -- @@ -29896,6 +31423,31 @@ SET character_set_client = utf8; 1 AS `mediaValue`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `workerRelatives` +-- + +DROP TABLE IF EXISTS `workerRelatives`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerRelatives` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(11) NOT NULL, + `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, + 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `workerSpeedExpedition` -- @@ -30422,6 +31974,25 @@ CREATE TABLE `zoneConfig` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `zoneEstimatedDelivery` +-- + +DROP TABLE IF EXISTS `zoneEstimatedDelivery`; +/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `zoneEstimatedDelivery` AS SELECT + 1 AS `zoneFk`, + 1 AS `hourTheoretical`, + 1 AS `totalVolume`, + 1 AS `remainingVolume`, + 1 AS `speed`, + 1 AS `hourEffective`, + 1 AS `minutesLess`, + 1 AS `etc`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `zoneEvent` -- @@ -30628,9 +32199,9 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -30697,7 +32268,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN DECLARE vCurrentCount INT; DECLARE vCheckSum INT; @@ -30828,9 +32399,9 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -30846,9 +32417,9 @@ DELIMITER ;; /*!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 character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -31950,6 +33521,42 @@ BEGIN RETURN curRate; +END ;; +DELIMITER ; +/*!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 `duaTax_getRate` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-sysadmin`@`%` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass INT) RETURNS decimal(5,2) + DETERMINISTIC +BEGIN + DECLARE vCountryFk INTEGER; + + SELECT s.countryFk INTO vCountryFk + FROM dua d + JOIN supplier s ON s.id = d.companyFk + WHERE d.id = vDua; + + RETURN (SELECT rate + FROM + (SELECT taxClassFk, rate + FROM invoiceInTaxBookingAccount + WHERE effectived <= CURDATE() + AND countryFk = vCountryFk + AND taxClassFk = vTaxClass + ORDER BY effectived DESC + ) ba1 + GROUP BY taxClassFk); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32184,7 +33791,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `floramondo_getEntry`(vLanded DATE) RETURNS int(11) +CREATE DEFINER=`root`@`%` FUNCTION `floramondo_getEntry`(vLanded DATETIME) RETURNS int(11) READS SQL DATA BEGIN @@ -32214,10 +33821,14 @@ BEGIN END IF; END IF; + SELECT entryFk INTO previousEntryFk FROM floramondoConfig; IF NOT (previousEntryFk <=> vEntryFk) THEN DELETE FROM buy WHERE entryFk = previousEntryFk; - REPLACE INTO floramondoConfig SET entryFk = vEntryFk; + DELETE FROM entry WHERE id = previousEntryFk; + UPDATE floramondoConfig SET entryFk = vEntryFk; + UPDATE floramondoConfig SET nextLanded = vLanded + WHERE vLanded IS NOT NULL; END IF; RETURN vEntryFk; @@ -32243,6 +33854,61 @@ BEGIN DECLARE vTravelFk INT; DECLARE vWarehouseOutName VARCHAR(50) DEFAULT 'Holanda'; + DECLARE vWarehouseInName VARCHAR(50) DEFAULT 'VNH'; + DECLARE vAgencyModeName VARCHAR(50) DEFAULT 'HOLANDA DIRECTO'; + + IF vLanded THEN + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + FROM vn.travel tr + JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN vn.agencyMode am ON am.id = tr.agencyFk + WHERE wIn.name = vWarehouseInName + AND wOut.name = vWarehouseOutName + AND am.name = vAgencyModeName + AND landed = vLanded; + + IF NOT vTravelFk THEN + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) + SELECT vLanded, curdate(), wIn.id, wOut.id, am.id + FROM vn.warehouse wIn + JOIN vn.warehouse wOut ON wOut.name = vWarehouseOutName + JOIN vn.agencyMode am ON am.name = vAgencyModeName + WHERE wIn.name = vWarehouseInName; + + SELECT MAX(tr.id) INTO vTravelFk + FROM vn.travel tr + JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE wIn.name = vWarehouseInName + AND wOut.name = vWarehouseOutName + AND landed = vLanded; + END IF; + END IF; + RETURN vTravelFk; +END ;; +DELIMITER ; +/*!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 `floramondo_getTravel__` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `floramondo_getTravel__`(vLanded DATE) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vTravelFk INT; + DECLARE vWarehouseOutName VARCHAR(50) DEFAULT 'Holanda'; DECLARE vWarehouseInName VARCHAR(50) DEFAULT 'VNH'; IF vLanded THEN @@ -35364,88 +37030,6 @@ BEGIN END IF; -END ;; -DELIMITER ; -/*!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 PROCEDURE IF EXISTS `buy_afterUpsert___` */; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `buy_afterUpsert___`(vSelf INT) -BEGIN -/** - * Triggered actions when a buy is updated or inserted. - * - * @param vSelf The buy reference - */ - DECLARE vEntryFk INT; - DECLARE vItemFk INT; - DECLARE vStickers INT; - DECLARE vPacking INT; - DECLARE vWarehouse INT; - DECLARE vWarehouseOut INT; - DECLARE vIsMerchandise BOOL; - DECLARE vIsFeedStock BOOL; - - - SELECT entryFk, itemFk, stickers, packing - INTO vEntryFk, vItemFk, vStickers, vPacking - FROM buy - WHERE id = vSelf; - - SELECT t.warehouseInFk, t.warehouseOutFk - INTO vWarehouse, vWarehouseOut - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.id = vEntryFk; - - SELECT k.merchandise - INTO vIsMerchandise - FROM itemCategory k - JOIN itemType it ON it.categoryFk = k.id - JOIN item i ON i.typeFk = it.id - WHERE i.id = vItemFk; - - IF vIsMerchandise THEN - - REPLACE itemCost SET - itemFk = vItemFk, - warehouseFk = vWarehouse, - cm3 = buy_getUnitVolume(vSelf); - - UPDATE vn.itemCost ic - JOIN vn.item i ON i.id = ic.itemFk - SET ic.cm3delivery = i.compression * ic.cm3 - WHERE ic.itemFk = vItemFk - AND ic.warehouseFk = vWarehouse; - - END IF; - - SELECT isFeedStock INTO vIsFeedStock - FROM warehouse WHERE id = vWarehouseOut AND id <> 13; - - IF vIsFeedStock THEN - INSERT IGNORE INTO producer(`name`) - SELECT es.company_name - FROM buy b - JOIN edi.ekt be ON be.id = b.ektFk - JOIN edi.supplier es ON es.supplier_id = be.pro - WHERE b.id = vSelf; - - IF buy_hasNotifyPassport(vSelf, vItemFk) THEN - CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); - END IF; - END IF; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35522,6 +37106,60 @@ 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 PROCEDURE IF EXISTS `buy_recalcPrices` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `buy_recalcPrices`() +BEGIN +/** + * Recalcula los precios para las compras insertadas en tmp.buyRecalc + * + * @param tmp.buyRecalc (id) + */ + DECLARE vLanded DATE; + DECLARE vWarehouseFk INT; + + SELECT t.landed, t.warehouseInFk INTO vLanded, vWarehouseFk + FROM tmp.buyRecalc br + JOIN buy b ON b.id = br.id + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + LIMIT 1; + + CALL vn.rate_getPrices(vLanded, vWarehouseFk); + + -- quitado los cubos a floramondo revisar en buy_tarifas_entry + UPDATE buy b + JOIN tmp.buyRecalc br ON br.id = b.id + LEFT JOIN packaging p ON p.id = b.packageFk + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN itemType it ON it.id = i.typeFk + JOIN travel tr ON tr.id = e.travelFk + JOIN agencyMode am ON am.id = tr.agencyFk + JOIN tmp.rate r + SET b.freightValue = @PF:= + ROUND(IFNULL(((am.m3 * @cm3:= item_getVolume(b.itemFk, b.packageFk)) / 1000000) / b.packing,0),3), + b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3), + b.packageValue = @EF:= IF(p.isPackageReturnable != 0, 0, ROUND(IFNULL(p.`value` / b.packing ,0),3)), + b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 + b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2), + b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2); + + DROP TEMPORARY TABLE tmp.rate; +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `buy_updateGrouping` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -35544,7 +37182,7 @@ FROM vn2008.t_item_last_buy b INNER JOIN vn2008.Compres c ON c.Id_Compra = b.buy_id where b.warehouse_id = vWarehouseFk AND b.item_id =vItemFk; -UPDATE vn.buy SET grouping = vGrouping WHERE id = lastId; +UPDATE vn.buy SET `grouping` = vGrouping WHERE id = lastId; END ;; DELIMITER ; @@ -36181,9 +37819,9 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -36313,7 +37951,12 @@ proc: BEGIN JOIN component c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; + JOIN vn.item i ON i.id = tcb.itemFk + WHERE c.id = vDiscountLastItemComponent + AND c.tax <> 0 + AND tcc.minPrice < tcc.rate3 + AND sp.value IS NULL + AND i.supplyResponseFk IS NULL; -- FLORAMONDO INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 @@ -37062,9 +38705,9 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -37129,7 +38772,7 @@ BEGIN SELECT clientFk, SUM(amount) risk FROM client c JOIN tClientRisk cr ON cr.clientFk = c.id - WHERE c.isActive + -- WHERE c.isActive JGF 11/08/2020 a Rodrigo no le aparecia el riesgo de su cliente 17567 GROUP BY c.id; END ;; DELIMITER ; @@ -37428,6 +39071,95 @@ 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 PROCEDURE IF EXISTS `clientNewBorn_recalc__` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `clientNewBorn_recalc__`() +BLOCK1: BEGIN + + DECLARE vClientFk INT; + DECLARE vShipped DATE; + DECLARE vPreviousShipped DATE; + DECLARE vDone boolean; + DECLARE cur cursor for + SELECT clientFk, firstShipped + FROM bs.clientNewBorn; + DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; + SET vDone := FALSE; + TRUNCATE bs.clientNewBorn; + INSERT INTO bs.clientNewBorn + SELECT c.id, MAX(t.shipped), MAX(t.shipped) + FROM vn.client c + JOIN vn.ticket t on t.clientFk = c.id + WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, CURDATE()) AND CURDATE() + GROUP BY c.id; + OPEN cur; + + LOOP1: LOOP + SET vDone := FALSE; + FETCH cur INTO vClientFk, vShipped; + + IF vDone THEN + CLOSE cur; + LEAVE LOOP1; + END IF; + + BLOCK2: BEGIN + DECLARE vCurrentShipped DATE; + DECLARE vDone2 boolean; + DECLARE cur2 CURSOR FOR + SELECT shipped + FROM vn.ticket + WHERE clientFk = vClientFk AND shipped <= CURDATE() + ORDER BY shipped DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone2 = TRUE; + SET vDone2 := FALSE; + OPEN cur2; + + SET vPreviousShipped := vShipped; + LOOP2: LOOP + SET vDone2 := FALSE; + FETCH cur2 INTO vCurrentShipped; + + + IF DATEDIFF(vPreviousShipped,vCurrentShipped) > 365 THEN + + UPDATE bs.clientNewBorn + SET firstShipped = vPreviousShipped + WHERE clientFk= vClientFk; + + CLOSE cur2; + LEAVE LOOP2; + END IF; + SET vPreviousShipped := vCurrentShipped; + + IF vDone2 THEN + + UPDATE bs.clientNewBorn + SET firstShipped = vCurrentShipped + WHERE clientFk= vClientFk; + CLOSE cur2; + LEAVE LOOP2; + END IF; + + END LOOP LOOP2; + + END BLOCK2; + END LOOP LOOP1; +END BLOCK1 ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `clientPackagingOverstock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -38112,6 +39844,185 @@ BEGIN tmp.salePlacementList_2, tmp.salePlacementList_3; +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `collectionPlacement_get_gamma` */; +/*!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' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionPlacement_get_gamma`(vParamFk INT(11)) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + ENGINE = MEMORY + SELECT 0000000 as ticketFk, + 0000000 as saleFk, + 0000000 as itemFk, + FALSE as isStowaway, + 0 as quantity; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vParamFk + UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk + WHERE tc.collectionFk = vParamFk; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE s.ticketFk = vParamFk + AND t.shipped > '2020-01-01' + UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + WHERE sw.shipFk = vParamFk; + + DELETE FROM tmp.sale + WHERE saleFk = 0; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN tmp.sale ts ON ts.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + UPDATE tmp.sale ts + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk + SET ts.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2; + CREATE TEMPORARY TABLE tmp.sale2 + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT DISTINCT saleFk FROM tmp.sale; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT b.itemFk, + CASE b.groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN b.packing + ELSE b.`grouping` + END AS `grouping` + FROM buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.warehouse_id = vWarehouseFk + ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; + CREATE TEMPORARY TABLE tmp.salePlacementList + ENGINE MEMORY + + SELECT ts.saleFk, + ts.itemFk, + CONCAT( + IF( iss.id, + CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), + ''), + p.`code`) COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + 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,-vCurrentYear,ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, + 0 as saleOrder, + sc.isPreviousPrepared, + iss.id as itemShelvingSaleFk, + ts.ticketFk + ,iss.id + , st.saleFk as salePreviousPrepared + , iss.userFk + FROM tmp.sale ts + LEFT JOIN (SELECT DISTINCT st.saleFk + FROM vn.saleTracking st + JOIN tmp.sale2 s2 ON s2.saleFk = st.saleFk + JOIN vn.state s ON s.id = st.stateFk + WHERE st.isChecked + AND s.semaphore = 1) st ON st.saleFk = ts.saleFk + JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id + LEFT JOIN vn.worker wk ON wk.id = iss.userFk + WHERE w.aliasFk = vWarehouseAliasFk + HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL + ; + -- select * from tmp.salePlacementList; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; + CREATE TEMPORARY TABLE tmp.salePlacementList_2 + ENGINE MEMORY + SELECT saleFk, priority as olderPriority + FROM (SELECT saleFk, priority + FROM tmp.salePlacementList + ORDER BY IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2), priority + ) sub + GROUP BY saleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; + CREATE TEMPORARY TABLE tmp.salePlacementList_3 + ENGINE MEMORY + SELECT s1.saleFk, `order`as saleOrder + FROM tmp.salePlacementList s1 + JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; + + UPDATE tmp.salePlacementList s1 + JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk + SET s1.saleOrder = s3.saleOrder; + + SELECT * + FROM tmp.salePlacementList + ORDER BY saleOrder, IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2),priority; + + DROP TEMPORARY TABLE + tmp.sale, + tmp.sale2, + tmp.`grouping`, + tmp.grouping2, + tmp.salePlacementList_2, + tmp.salePlacementList_3; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38129,6 +40040,108 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get`(vCollectionFk INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT t.id, clientFk, id as showTicketFk + FROM vn.ticket t + WHERE id = vCollectionFk + AND shipped > '2020-01-01' + UNION ALL + SELECT tc.ticketFk id, clientFk, tc.ticketFk as showTicketFk + FROM vn.ticketCollection tc + JOIN vn.ticket t ON t.id = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + CREATE TEMPORARY TABLE tmp.ticket2 + SELECT sw.id, t.clientFk, sw.shipFk showTicketFk + FROM vn.stowaway sw + JOIN tmp.ticket t ON t.id = sw.shipFk; + + INSERT INTO tmp.ticket + SELECT * FROM tmp.ticket2; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket3; + CREATE TEMPORARY TABLE tmp.ticket3 + SELECT * FROM tmp.ticket; + + SELECT showTicketFk ticketFk, + s.id as saleFk, + s.itemFk, + s.quantity, + i.longName, + i.size, + s.reserved, + MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, + MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, + MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, + ic.color, + ip.productor, + s.discount, + s.price, + i.stems, + i.category, + o.code AS origin, + t.clientFk, + s.originalQuantity, + TRIM(CONCAT(LPAD(i.longName,30,' '), ' ',RPAD(IFNULL(i.size,''),5,' '))) as line1, + TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) as line2, + TRIM(CONCAT(ic.color, IF(MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) AND t.id != t.showTicketFk, CONCAT(' [ TICKET ',t.id,' ] '),''), IFNULL(LPAD(st.parkingCode,40,' '),''))) as line3, + s.isAdded, + str.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk + c.workerFk, + IFNULL(SUM(iss.quantity),0) as pickedQuantity + FROM vn.sale s + JOIN tmp.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id + LEFT JOIN vn.state st ON st.id = str.stateFk + LEFT JOIN vn.itemColor ic ON ic.itemFk = s.itemFk + LEFT JOIN vn.itemProductor ip ON ip.itemFk = s.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + LEFT JOIN vn.collection c ON c.id = tc.collectionFk + LEFT JOIN (SELECT st.saleFk, p.`code` as parkingCode + FROM vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk + JOIN vn.sale sa ON sa.id = st.saleFk + JOIN tmp.ticket3 t ON t.id = sa.ticketFk + JOIN vn.ticketParking tp ON tp.ticketFk = sa.ticketFk + JOIN vn.parking p ON p.id = tp.parkingFk + WHERE st.isChecked + AND s.semaphore = 1 + GROUP BY st.saleFk) st ON st.saleFk = s.id + GROUP BY s.id + HAVING quantity > 0 OR workerFk != vn.getUser() + ; + + + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticket2; + DROP TEMPORARY TABLE tmp.ticket3; + + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `collectionSale_get_gamma` */; +/*!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' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get_gamma`(vCollectionFk INT) BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket; @@ -38189,6 +40202,7 @@ BEGIN LEFT JOIN vn.origin o ON o.id = i.originFk LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id LEFT JOIN vn.collection c ON c.id = tc.collectionFk + /* LEFT JOIN (SELECT st.saleFk, p.`code` as parkingCode FROM vn.saleTracking st JOIN vn.state s ON s.id = st.stateFk @@ -38198,196 +40212,7 @@ BEGIN WHERE st.isChecked AND s.semaphore = 1 GROUP BY st.saleFk) st ON st.saleFk = s.id - GROUP BY s.id - HAVING quantity > 0 OR workerFk != vn.getUser() - ; - - - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticket2; - - -END ;; -DELIMITER ; -/*!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 PROCEDURE IF EXISTS `collectionSale_get_beta` */; -/*!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' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get_beta`(vCollectionFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT t.id, clientFk, id as showTicketFk - FROM vn.ticket t - WHERE id = vCollectionFk - AND shipped > '2020-01-01' - UNION ALL - SELECT tc.ticketFk id, clientFk, tc.ticketFk as showTicketFk - FROM vn.ticketCollection tc - JOIN vn.ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - CREATE TEMPORARY TABLE tmp.ticket2 - SELECT sw.id, t.clientFk, sw.shipFk showTicketFk - FROM vn.stowaway sw - JOIN tmp.ticket t ON t.id = sw.shipFk; - - INSERT INTO tmp.ticket - SELECT * FROM tmp.ticket2; - - SELECT showTicketFk ticketFk, - s.id as saleFk, - s.itemFk, - s.quantity, - i.longName, - i.size, - s.reserved, - MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, - MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, - MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, - ic.color, - ip.productor, - s.discount, - s.price, - i.stems, - i.category, - o.code AS origin, - t.clientFk, - s.originalQuantity, - TRIM(CONCAT(LPAD(i.longName,30,' '), ' ',RPAD(IFNULL(i.size,''),5,' '))) as line1, - TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) as line2, - TRIM(CONCAT(ic.color, IF(MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) AND t.id != t.showTicketFk, CONCAT(' [ TICKET ',t.id,' ] '),''), IFNULL(LPAD(st.parkingCode,40,' '),''))) as line3, - s.isAdded, - str.originalQuantity as startQuantity, - c.workerFk, - IFNULL(SUM(iss.quantity),0) as pickedQuantity - FROM vn.sale s - JOIN tmp.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 - LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id - LEFT JOIN vn.state st ON st.id = str.stateFk - LEFT JOIN vn.itemColor ic ON ic.itemFk = s.itemFk - LEFT JOIN vn.itemProductor ip ON ip.itemFk = s.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN vn.collection c ON c.id = tc.collectionFk - LEFT JOIN (SELECT st.saleFk, p.`code` as parkingCode - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - JOIN vn.sale sa ON sa.id = st.saleFk - JOIN vn.ticketParking tp ON tp.ticketFk = sa.ticketFk - JOIN vn.parking p ON p.id = tp.parkingFk - WHERE st.isChecked - AND s.semaphore = 1 - GROUP BY st.saleFk) st ON st.saleFk = s.id - GROUP BY s.id - HAVING quantity > 0 OR workerFk != vn.getUser() - ; - - - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticket2; - - -END ;; -DELIMITER ; -/*!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 PROCEDURE IF EXISTS `collectionSale_get__` */; -/*!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' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get__`(vCollectionFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT t.id, clientFk, id as showTicketFk - FROM vn.ticket t - WHERE id = vCollectionFk - AND shipped > '2020-01-01' - UNION ALL - SELECT tc.ticketFk id, clientFk, tc.ticketFk as showTicketFk - FROM vn.ticketCollection tc - JOIN vn.ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - CREATE TEMPORARY TABLE tmp.ticket2 - SELECT sw.id, t.clientFk, sw.shipFk showTicketFk - FROM vn.stowaway sw - JOIN tmp.ticket t ON t.id = sw.shipFk; - - INSERT INTO tmp.ticket - SELECT * FROM tmp.ticket2; - - SELECT showTicketFk ticketFk, - s.id as saleFk, - s.itemFk, - s.quantity, - i.longName, - i.size, - s.reserved, - MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, - MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, - MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, - ic.color, - ip.productor, - s.discount, - s.price, - i.stems, - i.category, - o.code AS origin, - t.clientFk, - s.originalQuantity, - TRIM(CONCAT(LPAD(i.longName,30,' '), ' ',RPAD(IFNULL(i.size,''),5,' '))) as line1, - TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) as line2, - TRIM(CONCAT(ic.color, IF(MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) AND t.id != t.showTicketFk, CONCAT(' [ TICKET ',t.id,' ] '),''), IFNULL(LPAD(st.parkingCode,40,' '),''))) as line3, - s.isAdded, - str.originalQuantity as startQuantity, - c.workerFk - FROM vn.sale s - JOIN tmp.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 - LEFT JOIN vn.state st ON st.id = str.stateFk - LEFT JOIN vn.itemColor ic ON ic.itemFk = s.itemFk - LEFT JOIN vn.itemProductor ip ON ip.itemFk = s.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN vn.collection c ON c.id = tc.collectionFk - LEFT JOIN (SELECT st.saleFk, p.`code` as parkingCode - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - JOIN vn.sale sa ON sa.id = st.saleFk - JOIN vn.ticketParking tp ON tp.ticketFk = sa.ticketFk - JOIN vn.parking p ON p.id = tp.parkingFk - WHERE st.isChecked - AND s.semaphore = 1 - GROUP BY st.saleFk) st ON st.saleFk = s.id + */ GROUP BY s.id HAVING quantity > 0 OR workerFk != vn.getUser() ; @@ -40497,9 +42322,9 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -40531,6 +42356,153 @@ BEGIN CLAVE, FACTURA) + SELECT + vBookNumber, + d.bookEntried, + '4700000999', + CONCAT('DUA ',d.`code`), + sum(dt.base * dt.rate / 100) EUROHABER, + 'R', + d.companyFk, + vDuaFk, + vDuaFk + FROM duaTax dt + JOIN dua d ON d.id = dt.duaFk + WHERE dt.duaFk = vDuaFk; + + -- Apuntes por tipo de IVA y proveedor + + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + AUXILIAR, + SERIE, + FECHA_EX, + FECHA_OP, + FACTURAEX, + NFACTICK, + L340, + LDIFADUAN, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + TERIDNIF, + TERNIF, + TERNOM, + empresa_id, + FECREGCON + ) + + SELECT + vBookNumber ASIEN, + vBookDated FECHA, + tr.account SUBCTA, + '4330002067' CONTRA, + sum(dt.tax) EURODEBE, + sum(dt.base) BASEEURO, + CONCAT('DUA nº',d.code) CONCEPTO, + d.id FACTURA, + dt.rate IVA, + '*' AUXILIAR, + 'D' SERIE, + d.issued FECHA_EX, + d.operated FECHA_OP, + d.code FACTURAEX, + 1 NFACTICK, + 1 L340, + TRUE LDIFADUAN, + 1 TIPOCLAVE, + 1 TIPOEXENCI, + 1 TIPONOSUJE, + 5 TIPOFACT, + 1 TIPORECTIF, + IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, + s.nif TERNIF, + s.name TERNOM, + d.companyFk, + d.booked FECREGCON + FROM duaTax dt + JOIN dua d ON dt.duaFk = d.id + JOIN (SELECT account, rate + FROM + (SELECT rate, account + FROM invoiceInTaxBookingAccount ta + WHERE ta.effectived <= vBookDated + AND taxAreaFk = 'WORLD' + ORDER BY ta.effectived DESC + ) tba + GROUP BY rate + ) tr ON tr.rate = dt.rate + JOIN supplier s ON s.id = d.companyFk + WHERE d.id = vDuaFk + GROUP BY dt.rate; + + SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte + FROM XDiario + WHERE ASIEN = vBookNumber; + + UPDATE XDiario + SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, + EURODEBE = EURODEBE - vDiff + WHERE id = vApunte; + + UPDATE dua + SET ASIEN = vBookNumber + WHERE id = vDuaFk; + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `duaTaxBooking__` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `duaTaxBooking__`(vDuaFk INT) +BEGIN + DECLARE vBookNumber INT; + DECLARE vBookDated DATE; + DECLARE vDiff DECIMAL(10,2); + DECLARE vApunte BIGINT; + + SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated + FROM dua + WHERE id = vDuaFk; + + IF vBookNumber IS NULL OR NOT vBookNumber THEN + CALL ledger_next(vBookNumber); + END IF; + + -- Apunte de la aduana + + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONCEPTO, + EUROHABER, + SERIE, + empresa_id, + CLAVE, + FACTURA) + SELECT vBookNumber, d.bookEntried, @@ -40650,7 +42622,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 PROCEDURE IF EXISTS `duaTaxBooking__` */; +/*!50003 DROP PROCEDURE IF EXISTS `duaTaxUpdate__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -40660,166 +42632,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `duaTaxBooking__`(vDuaFk INT) -BEGIN - -- BERNAT: WORKING IN THIS FILE - DECLARE vBookNumber INT; - DECLARE vBookDated DATE; - DECLARE vDiff DECIMAL(10,2); - DECLARE vApunte BIGINT; - - SELECT IFNULL(d.ASIEN,MAX(x.ASIEN) + 1 ) - INTO vBookNumber - FROM vn2008.XDiario x - LEFT JOIN dua d ON d.id = vDuaFk ; - - SELECT IFNULL(bookEntried, CURDATE()) INTO vBookDated - FROM dua - WHERE id = vDuaFk; - - -- Apunte de la aduana - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONCEPTO, - EUROHABER, - SERIE, - empresa_id, - CLAVE, - FACTURA) - - SELECT - vBookNumber, - d.bookEntried, - '4700000999', - CONCAT('DUA ',d.code), - sum(di.amount * tr.rate / 100) EUROHABER, - 'R', - d.companyFk, - vDuaFk, - vDuaFk - FROM duaIntrastat di - JOIN intrastat ist ON ist.id = di.intrastatFk - JOIN (SELECT rate, taxClassFk - FROM - (SELECT rate, taxClassFk - FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - ORDER BY ta.effectived DESC - ) tba - GROUP BY taxClassFk - ) tr ON tr.taxClassFk = ist.taxClassFk - JOIN dua d ON d.id = di.duaFk - WHERE di.duaFk = vDuaFk; - - -- Apuntes por tipo de IVA y proveedor - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - BASEEURO, - CONCEPTO, - FACTURA, - IVA, - AUXILIAR, - SERIE, - FECHA_EX, - FECHA_OP, - FACTURAEX, - NFACTICK, - L340, - LDIFADUAN, - TIPOCLAVE, - TIPOEXENCI, - TIPONOSUJE, - TIPOFACT, - TIPORECTIF, - TERIDNIF, - TERNIF, - TERNOM, - empresa_id, - FECREGCON - ) - - SELECT - vBookNumber ASIEN, - vBookDated FECHA, - tr.account SUBCTA, - '4330002067' CONTRA, - sum(dt.tax) EURODEBE, - sum(dt.base) BASEEURO, - CONCAT('DUA nº',d.code) CONCEPTO, - d.id FACTURA, - dt.rate IVA, - '*' AUXILIAR, - 'D' SERIE, - d.issued FECHA_EX, - d.operated FECHA_OP, - d.code FACTURAEX, - 1 NFACTICK, - 1 L340, - TRUE LDIFADUAN, - 1 TIPOCLAVE, - 1 TIPOEXENCI, - 1 TIPONOSUJE, - 5 TIPOFACT, - 1 TIPORECTIF, - IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, - s.nif TERNIF, - s.name TERNOM, - d.companyFk, - d.booked FECREGCON - FROM duaTax dt - JOIN dua d ON dt.duaFk = d.id - JOIN (SELECT account, rate - FROM - (SELECT rate, account - FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - AND taxAreaFk = 'WORLD' - ORDER BY ta.effectived DESC - ) tba - GROUP BY rate - ) tr ON tr.rate = dt.rate - JOIN supplier s ON s.id = d.companyFk - WHERE d.id = vDuaFk - GROUP BY dt.rate; - - SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte - FROM vn2008.XDiario - WHERE ASIEN = vBookNumber; - - UPDATE vn2008.XDiario - SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, - EURODEBE = EURODEBE - vDiff - WHERE id = vApunte; - - UPDATE vn.dua - SET ASIEN = vBookNumber - WHERE id = vDuaFk; - -END ;; -DELIMITER ; -/*!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 PROCEDURE IF EXISTS `duaTaxUpdate` */; -/*!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' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `duaTaxUpdate`(vDuaFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `duaTaxUpdate__`(vDuaFk INT) BEGIN DECLARE vSPAIN INT DEFAULT 1; @@ -40890,6 +42703,68 @@ BEGIN dt.tax = dt.base * ba2.rate / 100; +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `duaTax_doRecalc` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `duaTax_doRecalc`(vDuaFk INT) +BEGIN +/** + * Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular +**/ + DELETE FROM duaTax + WHERE duaFk = vDuaFk; + + INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) + SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base + FROM intrastat ist + JOIN + (SELECT + e.supplierFk, + i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN + ( + SELECT i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk + GROUP BY i.intrastatFk + + ) tei ON tei.intrastatFk = i.intrastatFk + JOIN + ( + SELECT intrastatFk, sum(amount) as amount + FROM duaIntrastat + WHERE duaFk = vDuaFk + GROUP BY intrastatFK + ) di ON di.intrastatFk = i.intrastatFk + WHERE de.duaFk = vDuaFk + GROUP BY e.supplierFk, i.intrastatFk + HAVING Base + ) sub ON ist.id = sub.intrastatFk + GROUP BY ist.taxClassFk, sub.supplierFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -43109,7 +44984,7 @@ BEGIN n.bookEntried FECHA, tc.code SUBCTA, s.supplierAccount CONTRA, - ROUND(tc.rate/100 * SUM(it.taxableBase) + 0.0001, 2) EURODEBE, + SUM(ROUND(tc.rate/100 * it.taxableBase + 0.0001, 2)) EURODEBE, SUM(it.taxableBase) BASEEURO, GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, vSerialNumber FACTURA, @@ -43185,7 +45060,7 @@ BEGIN n.bookEntried FECHA, tcLink.code SUBCTA, s.supplierAccount CONTRA, - ROUND(tcLink.rate/100*SUM(it.taxableBase) + 0.0001,2) EUROHABER, + SUM(ROUND(tcLink.rate/100*it.taxableBase + 0.0001,2)) EUROHABER, ROUND(SUM(it.taxableBase),2) BASEEURO, GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, vSerialNumber FACTURA, @@ -43258,7 +45133,7 @@ BEGIN INTO vSerial FROM newInvoiceIn; - SELECT SUM(iit.taxableBase * IF(vSerial = 'R', 1 +(tc.rate/100),1)), + SELECT SUM(iit.taxableBase * IF(vSerial = 'R' AND tc.`type` <> 'I', 1 +(tc.rate/100),1)), SUM(iit.foreignValue * IF(vSerial = 'R', 1 +(tc.rate/100),1)), iit.taxableBase/iit.foreignValue INTO vTotalAmount, vTotalAmountDivisa, vRate @@ -43402,7 +45277,7 @@ BEGIN LEFT JOIN (SELECT eWithheld.id FROM invoiceInTax hold JOIN expence eWithheld ON eWithheld.id = hold.expenceFk AND eWithheld.isWithheld - WHERE hold.invoiceInFk = 58262 LIMIT 1 + WHERE hold.invoiceInFk = vInvoiceInId LIMIT 1 ) eWithheld ON TRUE WHERE tc.type != '-' AND tc.isActive @@ -43478,7 +45353,7 @@ BEGIN JOIN expence e ON e.id = it.expenceFk AND e.taxTypeFk = tc.taxTypeFk WHERE tc.isActive - AND (tc.type = 'S' OR MID(s.supplierAccount,4,1) = '1') + AND (tc.type in('S','I') OR MID(s.supplierAccount,4,1) = '1') GROUP BY tcLink.rate, e.id; -- Actualización del registro original @@ -45376,17 +47251,17 @@ 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 PROCEDURE IF EXISTS `itemLastEntries` */; +/*!50003 DROP PROCEDURE IF EXISTS `itemLastEntries__` */; /*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!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' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries`(IN `vItem` INT, IN `vDays` DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE) BEGIN SELECT w.id AS warehouseFk, @@ -45823,9 +47698,9 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -46603,7 +48478,6 @@ BEGIN DECLARE vWarehouseFk INT DEFAULT 0; DECLARE vSonSectorFk INT; - SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk FROM vn.worker w JOIN vn.sector s ON s.code = w.code @@ -46644,7 +48518,7 @@ BEGIN a.available, SUM(IF(s.sonFk = vSectorFk, iss.visible, 0)) upstairs, SUM(IF(iss.sectorFk = vSectorFk, iss.visible, 0)) downstairs, - IFNULL(v.visible,0) as visible, + IF(it.isPackaging, NULL, IFNULL(v.visible,0)) as visible, vSectorFk as sectorFk FROM vn.itemShelvingStock iss @@ -46654,6 +48528,7 @@ BEGIN LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk WHERE vSectorFk IN (iss.sectorFk, s.sonFk) + GROUP BY iss.itemFk UNION ALL @@ -46665,7 +48540,7 @@ BEGIN IFNULL(a.available,0) as available, 0 upstairs, 0 downstairs, - v.visible, + IF(it.isPackaging, NULL, v.visible) visible, vSectorFk as sectorFk FROM cache.visible v JOIN vn.item i on i.id = v.item_id @@ -47084,7 +48959,7 @@ BEGIN DECLARE vCurrentTime VARCHAR(5); DECLARE vParkedStuff INT; - CALL cache.visible_refresh(vCalc, FALSE, vWarehouseFk); + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); SELECT IFNULL(visible,0) INTO vVisible FROM cache.visible @@ -47775,9 +49650,9 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -47818,8 +49693,7 @@ BEGIN UPDATE item i JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value` - WHERE i.subName IS NULL; + SET i.subName = it.`value`; UPDATE item i JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id @@ -48427,7 +50301,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `kk`(IN vItemId INT, IN vWarehouse INT) +CREATE DEFINER=`z-sysadmin`@`%` PROCEDURE `kk`(IN vItemId INT, IN vWarehouse INT) BEGIN DECLARE vDateInventory DATETIME; DECLARE vCurdate DATE DEFAULT CURDATE(); @@ -49097,17 +50971,17 @@ 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 PROCEDURE IF EXISTS `nestAdd` */; +/*!50003 DROP PROCEDURE IF EXISTS `nestAdd__` */; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nestAdd`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100)) +CREATE DEFINER=`root`@`%` PROCEDURE `nestAdd__`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100)) BEGIN DECLARE vSql TEXT; DECLARE vTableClone VARCHAR(45); @@ -49187,17 +51061,17 @@ 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 PROCEDURE IF EXISTS `nestLeave` */; +/*!50003 DROP PROCEDURE IF EXISTS `nestLeave__` */; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nestLeave`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `nestLeave__`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT) BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.tree; @@ -49225,17 +51099,17 @@ 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 PROCEDURE IF EXISTS `nestTree` */; +/*!50003 DROP PROCEDURE IF EXISTS `nestTree__` */; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nestTree`( +CREATE DEFINER=`root`@`%` PROCEDURE `nestTree__`( vSourceSchema VARCHAR(45), vSourceTable VARCHAR(45), vDestinationSchema VARCHAR(45), @@ -50182,6 +52056,47 @@ 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 PROCEDURE IF EXISTS `rate_getPrices` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rate_getPrices`(vLanded DATE, vWarehouseFk INT) +BEGIN + + -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + + DROP TEMPORARY TABLE IF EXISTS tmp.rate; + CREATE TEMPORARY TABLE tmp.rate + ENGINE = MEMORY + SELECT * FROM + ( + SELECT * FROM + ( + SELECT DISTINCT rate0, rate1, rate2, rate3 + FROM vn.rate + WHERE dated <= vLanded + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC + + ) sub + UNION ALL + SELECT rate0, rate1, rate2, rate3 + FROM rateConfig + ) sub2 + LIMIT 1; + +END ;; +DELIMITER ; +/*!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 PROCEDURE IF EXISTS `recipe_Cook` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56470,20 +58385,20 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_close`() +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_close`(vTicketFk INT) BEGIN /** * Realiza el cierre de todos los * tickets de la tabla ticketClosure. + * + * @param vTicketFk Id del ticket */ DECLARE vDone BOOL; DECLARE vClientFk INT; - DECLARE vTicketFk INT; + DECLARE vCurTicketFk INT; DECLARE vIsTaxDataChecked BOOL; DECLARE vCompanyFk INT; DECLARE vShipped DATE; - DECLARE vPriority INT DEFAULT 1; - DECLARE vReportDeliveryNote INT DEFAULT 1; DECLARE vNewInvoiceId INT; DECLARE vHasDailyInvoice BOOL; DECLARE vWithPackage BOOL; @@ -56497,18 +58412,19 @@ BEGIN RESIGNAL; END; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure2; - CREATE TEMPORARY TABLE tmp.ticketClosure2 - SELECT ticketFk FROM tmp.ticketClosure; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; + CREATE TEMPORARY TABLE tmp.ticketClosure + SELECT vTicketFk AS ticketFk; + INSERT INTO tmp.ticketClosure SELECT id FROM stowaway s - JOIN tmp.ticketClosure2 tc ON s.shipFk = tc.ticketFk; + WHERE s.shipFk = vTicketFk; OPEN cur; proc: LOOP SET vDone = FALSE; - FETCH cur INTO vTicketFk; + FETCH cur INTO vCurTicketFk; IF vDone THEN LEAVE proc; @@ -56535,23 +58451,23 @@ BEGIN JOIN province p ON p.id = c.provinceFk JOIN country co ON co.id = p.countryFk JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.id = vTicketFk; + WHERE t.id = vCurTicketFk; INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) - (SELECT vTicketFk, p.id, COUNT(*) + (SELECT vCurTicketFk, p.id, COUNT(*) FROM expedition e JOIN packaging p ON p.itemFk = e.itemFk - WHERE e.ticketFk = vTicketFk AND p.isPackageReturnable + WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable AND vWithPackage GROUP BY p.itemFk); -- No retornables o no catalogados INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) - (SELECT e.itemFk, vTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 + (SELECT e.itemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 FROM expedition e JOIN item i ON i.id = e.itemFk LEFT JOIN packaging p ON p.itemFk = i.id - WHERE e.ticketFk = vTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 + WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 AND getSpecialPrice(e.itemFk, vClientFk) > 0 GROUP BY e.itemFk); @@ -56560,7 +58476,7 @@ BEGIN IF(vHasDailyInvoice) AND vHasToInvoice THEN -- Facturacion rapida - CALL ticketTrackingAdd(vTicketFk, 'DELIVERED', NULL); + CALL ticketTrackingAdd(vCurTicketFk, 'DELIVERED', NULL); -- Facturar si está contabilizado IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( @@ -56572,16 +58488,13 @@ BEGIN vNewInvoiceId); END IF; ELSE - -- Albaran_print - CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), NULL); + CALL ticketTrackingAdd(vCurTicketFk, (SELECT vn.getAlert3State(vCurTicketFk)), NULL); END IF; - - -- ticketClosure end END LOOP; CLOSE cur; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure2; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63507,6 +65420,24 @@ USE `cache`; USE `edi`; +-- +-- Final view structure for view `supplyOffer__` +-- + +/*!50001 DROP VIEW IF EXISTS `supplyOffer__`*/; +/*!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_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `supplyOffer__` AS select `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`,`sr`.`EmbalageCode` 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`,`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` from (((((`deliveryInformation` `di` join `supplyResponse` `sr` on((`sr`.`ID` = `di`.`supplyResponseID`))) join `supplier` `s` on((`s`.`glnAddressCode` = `sr`.`SupplierGLN`))) join `bucket` `b` on((`b`.`bucket_id` = `sr`.`EmbalageCode`))) join `item` `i` on((`i`.`id` = `sr`.`Item_ArticleCode`))) join `marketPlace` `mp` on(((`mp`.`id` = `sr`.`MarketPlaceID`) and (`mp`.`isOffered` = 1)))) where ((`sr`.`NumberOfUnits` > 0) and (now() between `di`.`FirstOrderDateTime` and `di`.`LatestOrderDateTime`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Current Database: `hedera` -- @@ -64749,6 +66680,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `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_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `invoiceInEntry__` -- @@ -65091,6 +67040,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `item_Free_Id` +-- + +/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 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 `labelInfo` -- @@ -65104,7 +67071,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`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 */; @@ -65325,6 +67292,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `salesPersonSince` +-- + +/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; +/*!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_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 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 `salesPreparedLastHour` -- @@ -65775,6 +67760,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `zoneEstimatedDelivery` +-- + +/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast((curdate() + interval ((hour(`zc`.`hour`) * 60) + minute(`zc`.`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`))) 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 ((`wa`.`name` = 'Silla') and (cast(`t`.`shipped` as date) = 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 */; + -- -- Final view structure for view `zone_ETD` -- @@ -65788,7 +67791,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `zone_ETD` AS select `t`.`zoneFk` AS `zoneFk`,cast((curdate() + interval ((hour(`zc`.`hour`) * 60) + minute(`zc`.`hour`)) minute) as time) AS `HoraTeórica`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volumenTotal`,cast(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0)) as decimal(5,1)) AS `volumenPendiente`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `velocidad`,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 `HoraPráctica`,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`))) 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 ((`wa`.`name` = 'Silla') and (cast(`t`.`shipped` as date) = curdate())) group by `t`.`zoneFk` */; +/*!50001 VIEW `zone_ETD` AS select `zed`.`zoneFk` AS `zoneFk`,`zed`.`hourTheoretical` AS `HoraTeórica`,`zed`.`totalVolume` AS `volumenTotal`,`zed`.`remainingVolume` AS `volumenPendiente`,`zed`.`speed` AS `velocidad`,`zed`.`hourEffective` AS `HoraPráctica`,`zed`.`minutesLess` AS `minutesLess`,`zed`.`etc` AS `etc` from `vn`.`zoneEstimatedDelivery` `zed` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -65808,4 +67811,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-08-11 11:57:36 +-- Dump completed on 2020-09-09 11:59:03 diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 1483af48b..18519d440 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -7,6 +7,6 @@ describe('Client get', () => { expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); - expect(result.debt).toEqual(879.38); + expect(result.debt).toEqual(889.38); }); }); diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js index 60696e344..9e539c219 100644 --- a/modules/client/back/methods/client/specs/getDebt.spec.js +++ b/modules/client/back/methods/client/specs/getDebt.spec.js @@ -4,7 +4,7 @@ describe('client getDebt()', () => { it('should return the client debt', async() => { let result = await app.models.Client.getDebt(101); - expect(result.debt).toEqual(879.38); + expect(result.debt).toEqual(889.38); }); }); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 3c79060a8..e4ebd9c67 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -17,7 +17,7 @@ describe('client summary()', () => { it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(879.38); + expect(result.debt.debt).toEqual(889.38); }); it('should return a summary object containing averageInvoiced', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 312b95ad5..c03a41975 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -42,7 +42,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await app.models.Ticket.filter(ctx, filter); - expect(result.length).toEqual(11); + expect(result.length).toEqual(10); }); it('should return the tickets matching the problems on null', async() => { -- 2.40.1 From fb3f01151cffb4dee3424e920580a7dc91608abe Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 9 Sep 2020 13:49:03 +0200 Subject: [PATCH 2/6] update fixtures --- db/dump/fixtures.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 22fa2076a..b451fce99 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -688,11 +688,11 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk (5, 'CON', 'Container', 3, NULL, 35, 1), (6, 'ALS', 'Alstroemeria', 1, 31, 35, 0); -INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`) +INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) VALUES - ('YEL', 'Yellow', 1, 1), - ('BLU', 'Blue', 1, 2), - ('RED', 'Red', 1, 3); + ('YEL', 'Yellow', 1, 1, 'FFFF33'), + ('BLU', 'Blue', 1, 2, '1436DE'), + ('RED', 'Red', 1, 3, 'FF0000'); INSERT INTO `vn`.`origin`(`id`,`code`, `name`) VALUES -- 2.40.1 From 4f50106e92a289933cd4a269a4b128853678abc7 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 10 Sep 2020 08:08:00 +0200 Subject: [PATCH 3/6] fix fixtures --- db/dump/fixtures.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b451fce99..17419a5d0 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -690,9 +690,9 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) VALUES - ('YEL', 'Yellow', 1, 1, 'FFFF33'), - ('BLU', 'Blue', 1, 2, '1436DE'), - ('RED', 'Red', 1, 3, 'FF0000'); + ('YEL', 'Yellow', 1, 1, 'F4D03F'), + ('BLU', 'Blue', 1, 2, '5DADE2'), + ('RED', 'Red', 1, 3, 'EC7063'); INSERT INTO `vn`.`origin`(`id`,`code`, `name`) VALUES -- 2.40.1 From 87fab5f57c9c9ebef4d55fefcd43f6a7069fc5b7 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 10 Sep 2020 11:34:32 +0200 Subject: [PATCH 4/6] delete duplicated fixtures --- db/dump/fixtures.sql | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 17419a5d0..08b9dcc11 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -690,9 +690,11 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) VALUES - ('YEL', 'Yellow', 1, 1, 'F4D03F'), - ('BLU', 'Blue', 1, 2, '5DADE2'), - ('RED', 'Red', 1, 3, 'EC7063'); + ('YEL', 'Yellow', 1, 1, 'F4D03F'), + ('BLU', 'Blue', 1, 2, '5DADE2'), + ('RED', 'Red', 1, 3, 'EC7063'), + ('SLV', 'Silver', 1, 4, 'CACFD2'), + ('BRW', 'Brown', 1, 5, 'DC7633'); INSERT INTO `vn`.`origin`(`id`,`code`, `name`) VALUES @@ -765,26 +767,6 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `create (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 18), (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18), (10, 7, 7, 71, CURDATE(), 1, 1, 1, 18); - -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`) - VALUES - (1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 67, 1, NULL), - (2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66, 1, NULL), - (3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 65, 1, NULL), - (4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 69, 2, NULL), - (5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 74, 2, NULL), - (6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 62, 2, NULL), - (7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 64, 2, NULL), - (8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 75, 1, NULL), - (9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 76, 1, NULL), - (10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 77, 1, NULL), - (11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 78, 2, NULL), - (12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 82, 2, NULL), - (13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 83, 2, NULL), - (14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 84, 2, NULL), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL), - (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL), - (71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 88, 2, NULL); INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`) VALUES @@ -797,18 +779,7 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack ('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); -INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `packagingFk`) - VALUES - (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1), - (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 1), - (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 3, 1, 1), - (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 1), - (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1), - (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 1, 1, 1), - (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 1, 1, 1), - (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 1), - (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1), - (10, 7, 7, 71, CURDATE(), 1, 1, 1, 1); + INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`) VALUES -- 2.40.1 From e8384e3ec9c463d22ca33a90eeb8d0b18c32548a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 10 Sep 2020 13:26:04 +0200 Subject: [PATCH 5/6] added packageFk as column --- modules/entry/back/methods/entry/latestBuysFilter.js | 3 ++- modules/entry/front/latest-buys/index.html | 2 ++ modules/entry/front/latest-buys/locale/en.yml | 3 ++- modules/entry/front/latest-buys/locale/es.yml | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index dffe5793d..3240652cd 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -125,7 +125,8 @@ module.exports = Self => { b.price2, b.price3, b.ektFk, - b.weight + b.weight, + b.packageFk FROM cache.last_buy lb LEFT JOIN cache.visible v ON v.item_id = lb.item_id AND v.calc_id = @calc_id diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index 4aa3aeae2..ea00b51b8 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -53,6 +53,7 @@ Min price Ekt Weight + PackageName @@ -126,6 +127,7 @@ {{::buy.minPrice | currency: 'EUR':2}} {{::buy.ektFk | dashIfEmpty}} {{::buy.weight}} + {{::buy.packageFk}} diff --git a/modules/entry/front/latest-buys/locale/en.yml b/modules/entry/front/latest-buys/locale/en.yml index 4f53d6126..48dda861b 100644 --- a/modules/entry/front/latest-buys/locale/en.yml +++ b/modules/entry/front/latest-buys/locale/en.yml @@ -1 +1,2 @@ -Minimun amount: Minimun purchase quantity \ No newline at end of file +Minimun amount: Minimun purchase quantity +PackageName: Package \ No newline at end of file diff --git a/modules/entry/front/latest-buys/locale/es.yml b/modules/entry/front/latest-buys/locale/es.yml index 7144caa8a..18bc1a689 100644 --- a/modules/entry/front/latest-buys/locale/es.yml +++ b/modules/entry/front/latest-buys/locale/es.yml @@ -10,4 +10,5 @@ Min price: Precio min Ekt: Ekt Weight: Peso Minimun amount: Cantidad mínima de compra -Field to edit: Campo a editar \ No newline at end of file +Field to edit: Campo a editar +PackageName: Cubo -- 2.40.1 From ecc7ae398c47f13182adad70d6209b3297341e76 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 10 Sep 2020 14:32:44 +0200 Subject: [PATCH 6/6] column order --- modules/entry/front/latest-buys/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index ea00b51b8..b7912a6da 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -33,6 +33,7 @@ Id Packing Grouping + Quantity Description Size Type @@ -42,7 +43,6 @@ Active Family Entry - Quantity Buying value Freight value Commission value @@ -90,6 +90,7 @@ {{::buy.grouping | dashIfEmpty}} + {{::buy.quantity}} {{::buy.description | dashIfEmpty}} @@ -116,7 +117,6 @@ {{::buy.entryFk}} - {{::buy.quantity}} {{::buy.buyingValue | currency: 'EUR':2}} {{::buy.freightValue | currency: 'EUR':2}} {{::buy.comissionValue | currency: 'EUR':2}} -- 2.40.1