
--
-- Table structure for table `document_payments`
--

CREATE TABLE `document_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_received` tinyint(1) DEFAULT NULL,
  `change` decimal(12,2) DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `document_payments_document_id_foreign` (`document_id`),
  KEY `document_payments_card_brand_id_foreign` (`card_brand_id`),
  KEY `document_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `document_payments_date_of_payment_index` (`date_of_payment`),
  CONSTRAINT `document_payments_card_brand_id_foreign` FOREIGN KEY (`card_brand_id`) REFERENCES `card_brands` (`id`),
  CONSTRAINT `document_payments_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `document_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=462 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_payments`
--

INSERT INTO `document_payments` VALUES (3,3,'2022-01-24','01',0,NULL,NULL,NULL,NULL,413.00),(4,4,'2022-01-24','01',0,NULL,NULL,NULL,NULL,350.00),(5,5,'2022-01-27','01',0,NULL,NULL,NULL,NULL,171.10),(6,34,'2022-03-16','01',0,NULL,NULL,NULL,NULL,97.00),(7,35,'2022-03-16','01',0,NULL,NULL,NULL,NULL,0.00),(8,61,'2022-04-20','01',0,NULL,NULL,NULL,NULL,720.00),(9,62,'2022-04-22','01',0,NULL,NULL,NULL,NULL,225.00),(10,63,'2022-04-22','01',0,NULL,NULL,NULL,NULL,225.00),(11,64,'2022-04-25','01',0,NULL,NULL,NULL,NULL,640.00),(12,65,'2022-04-27','01',0,NULL,NULL,NULL,NULL,50.00),(13,66,'2022-05-01','01',0,NULL,NULL,NULL,NULL,10.00),(14,67,'2022-05-06','01',0,NULL,NULL,NULL,NULL,882.00),(15,68,'2022-05-06','01',0,NULL,NULL,NULL,42.50,227.50),(16,69,'2022-05-09','01',0,NULL,NULL,NULL,NULL,65.00),(17,70,'2022-05-17','01',0,NULL,NULL,NULL,NULL,146.00),(18,71,'2022-05-17','01',0,NULL,NULL,NULL,NULL,38.00),(19,72,'2022-05-17','01',0,NULL,NULL,NULL,NULL,225.00),(20,73,'2022-05-17','01',0,NULL,NULL,NULL,5.00,322.00),(21,74,'2022-05-18','01',0,NULL,NULL,NULL,NULL,350.00),(22,75,'2022-05-21','01',0,NULL,NULL,NULL,NULL,56.00),(23,76,'2022-05-21','01',0,NULL,NULL,NULL,NULL,36.00),(24,77,'2022-05-21','01',0,NULL,NULL,NULL,NULL,27.00),(25,78,'2022-05-27','01',0,NULL,NULL,NULL,1.00,11.00),(26,79,'2022-05-27','01',0,NULL,NULL,NULL,NULL,270.00),(27,80,'2022-05-27','01',0,NULL,NULL,NULL,NULL,220.00),(28,81,'2022-05-28','01',0,NULL,NULL,NULL,NULL,90.00),(29,82,'2022-06-01','01',0,NULL,NULL,NULL,NULL,75.00),(30,83,'2022-06-25','01',0,NULL,NULL,NULL,NULL,104.00),(31,84,'2022-06-30','01',0,NULL,NULL,NULL,NULL,1525.50),(32,85,'2022-07-02','01',0,NULL,NULL,NULL,NULL,84.00),(33,86,'2022-07-06','01',0,NULL,NULL,NULL,NULL,300.00),(34,87,'2022-07-06','01',0,NULL,NULL,NULL,NULL,120.00),(35,88,'2022-07-09','01',0,NULL,NULL,NULL,5.00,85.00),(36,89,'2022-07-09','01',0,NULL,NULL,NULL,NULL,30.00),(37,90,'2022-07-10','01',0,NULL,NULL,NULL,2.00,73.00),(38,91,'2022-07-10','01',0,NULL,NULL,NULL,NULL,75.00),(39,92,'2022-07-10','01',0,NULL,NULL,NULL,3.00,72.00),(40,93,'2022-07-16','01',0,NULL,NULL,NULL,NULL,111.50),(41,94,'2022-07-16','01',0,NULL,NULL,NULL,NULL,350.00),(42,95,'2022-07-16','01',0,NULL,NULL,NULL,NULL,195.00),(43,96,'2022-07-16','01',0,NULL,NULL,NULL,NULL,250.00),(44,97,'2022-07-16','01',0,NULL,NULL,NULL,NULL,140.00),(45,98,'2022-07-16','01',0,NULL,NULL,NULL,NULL,120.00),(46,99,'2022-07-16','01',0,NULL,NULL,NULL,NULL,260.00),(47,100,'2022-07-16','01',0,NULL,NULL,NULL,NULL,450.00),(48,101,'2022-07-16','01',0,NULL,NULL,NULL,NULL,180.00),(49,102,'2022-07-16','01',0,NULL,NULL,NULL,NULL,204.00),(50,103,'2022-07-16','01',0,NULL,NULL,NULL,NULL,150.00),(51,104,'2022-07-16','01',0,NULL,NULL,NULL,NULL,420.00),(52,105,'2022-07-16','01',0,NULL,NULL,NULL,NULL,300.00),(53,106,'2022-07-16','01',0,NULL,NULL,NULL,NULL,350.00),(54,107,'2022-07-16','01',0,NULL,NULL,NULL,NULL,220.00),(55,108,'2022-07-16','01',0,NULL,NULL,NULL,NULL,90.00),(56,109,'2022-07-16','01',0,NULL,NULL,NULL,NULL,225.00),(57,110,'2022-07-22','01',0,NULL,NULL,NULL,NULL,260.00),(58,111,'2022-07-22','01',0,NULL,NULL,NULL,NULL,75.00),(59,112,'2022-07-22','01',0,NULL,NULL,NULL,NULL,200.00),(60,113,'2022-07-22','01',0,NULL,NULL,NULL,NULL,350.00),(61,114,'2022-07-22','01',0,NULL,NULL,NULL,6.00,114.00),(62,115,'2022-07-24','01',0,NULL,NULL,NULL,NULL,30.00),(63,116,'2022-07-24','01',0,NULL,NULL,NULL,NULL,165.00),(64,117,'2022-07-24','01',0,NULL,NULL,NULL,NULL,170.00),(65,118,'2022-07-24','01',0,NULL,NULL,NULL,NULL,229.00),(66,119,'2022-07-28','01',0,NULL,NULL,NULL,NULL,202.00),(67,120,'2022-07-28','01',0,NULL,NULL,NULL,NULL,180.00),(68,121,'2022-07-28','01',0,NULL,NULL,NULL,NULL,255.00),(69,122,'2022-07-28','01',0,NULL,NULL,NULL,NULL,191.00),(70,123,'2022-07-28','01',0,NULL,NULL,NULL,NULL,200.00),(71,124,'2022-07-28','01',0,NULL,NULL,NULL,NULL,222.00),(72,125,'2022-07-28','01',0,NULL,NULL,NULL,NULL,238.00),(73,126,'2022-07-28','01',0,NULL,NULL,NULL,NULL,194.00),(74,127,'2022-07-28','01',0,NULL,NULL,NULL,NULL,240.00),(75,128,'2022-07-28','01',0,NULL,NULL,NULL,NULL,210.00),(76,129,'2022-07-28','01',0,NULL,NULL,NULL,NULL,260.00),(77,130,'2022-07-28','01',0,NULL,NULL,NULL,NULL,158.00),(78,131,'2022-07-28','01',0,NULL,NULL,NULL,NULL,200.00),(79,132,'2022-07-28','01',0,NULL,NULL,NULL,NULL,292.00),(80,133,'2022-07-28','01',0,NULL,NULL,NULL,NULL,270.00),(81,134,'2022-07-28','01',0,NULL,NULL,NULL,NULL,234.00),(82,135,'2022-07-29','01',0,NULL,NULL,NULL,0.00,30.00),(83,136,'2022-07-29','01',0,NULL,NULL,NULL,NULL,30.00),(84,137,'2022-07-30','01',0,NULL,NULL,NULL,10.00,440.00),(85,138,'2022-07-30','01',0,NULL,NULL,NULL,NULL,46.00),(86,139,'2022-07-31','01',0,NULL,NULL,NULL,NULL,300.00),(87,140,'2022-07-31','01',0,NULL,NULL,NULL,NULL,350.00),(88,141,'2022-07-31','01',0,NULL,NULL,NULL,NULL,385.00),(89,142,'2022-07-31','01',0,NULL,NULL,NULL,NULL,346.00),(90,143,'2022-07-31','01',0,NULL,NULL,NULL,NULL,420.00),(91,144,'2022-07-31','01',0,NULL,NULL,NULL,NULL,400.00),(92,145,'2022-07-31','01',0,NULL,NULL,NULL,NULL,387.00),(93,146,'2022-07-31','01',0,NULL,NULL,NULL,NULL,420.00),(94,147,'2022-07-31','01',0,NULL,NULL,NULL,NULL,342.00),(95,148,'2022-07-31','01',0,NULL,NULL,NULL,10.00,162.00),(96,149,'2022-07-31','01',0,NULL,NULL,NULL,NULL,420.00),(97,150,'2022-08-03','01',0,NULL,NULL,NULL,NULL,250.00),(98,151,'2022-08-03','01',0,NULL,NULL,NULL,5.00,255.00),(99,152,'2022-08-03','01',0,NULL,NULL,NULL,NULL,220.00),(100,153,'2022-08-03','01',0,NULL,NULL,NULL,30.00,660.00),(101,154,'2022-08-03','01',0,NULL,NULL,NULL,NULL,170.00),(102,155,'2022-08-15','01',0,NULL,NULL,NULL,NULL,76.00),(103,156,'2022-08-19','01',0,NULL,NULL,NULL,20.00,230.00),(104,157,'2022-08-19','01',0,NULL,NULL,NULL,NULL,144.00),(105,158,'2022-08-27','01',0,NULL,NULL,NULL,NULL,65.00),(106,159,'2022-08-27','01',0,NULL,NULL,NULL,NULL,500.00),(107,160,'2022-08-27','01',0,NULL,NULL,NULL,NULL,500.00),(108,161,'2022-08-30','01',0,NULL,NULL,NULL,NULL,30.00),(109,162,'2022-08-30','01',0,NULL,NULL,NULL,20.00,330.00),(110,163,'2022-08-30','01',0,NULL,NULL,NULL,10.00,110.00),(111,164,'2022-08-30','01',0,NULL,NULL,NULL,NULL,100.00),(112,165,'2022-08-30','01',0,NULL,NULL,NULL,NULL,146.00),(113,166,'2022-08-30','01',0,NULL,NULL,NULL,NULL,313.00),(114,167,'2022-08-30','01',0,NULL,NULL,NULL,NULL,384.00),(115,168,'2022-08-30','01',0,NULL,NULL,NULL,NULL,486.00),(116,169,'2022-08-30','01',0,NULL,NULL,NULL,NULL,430.00),(117,170,'2022-08-30','01',0,NULL,NULL,NULL,NULL,434.00),(118,171,'2022-08-30','01',0,NULL,NULL,NULL,NULL,420.00),(119,172,'2022-08-30','01',0,NULL,NULL,NULL,NULL,450.00),(120,173,'2022-08-30','01',0,NULL,NULL,NULL,NULL,420.00),(121,174,'2022-08-30','01',0,NULL,NULL,NULL,NULL,360.00),(122,175,'2022-08-30','01',0,NULL,NULL,NULL,NULL,390.00),(123,176,'2022-08-30','01',0,NULL,NULL,NULL,NULL,420.00),(124,177,'2022-08-30','01',0,NULL,NULL,NULL,NULL,420.00),(125,178,'2022-08-31','01',0,NULL,NULL,NULL,NULL,80.00),(126,180,'2022-09-02','01',0,NULL,NULL,NULL,NULL,640.00),(127,181,'2022-09-02','01',0,NULL,NULL,NULL,NULL,93.00),(128,182,'2022-09-02','01',0,NULL,NULL,NULL,2.00,68.64),(129,183,'2022-09-08','01',0,NULL,NULL,NULL,4.00,15.16),(130,184,'2022-09-08','01',0,NULL,NULL,NULL,4.00,15.16),(131,185,'2022-09-08','01',0,NULL,NULL,NULL,9.00,230.00),(132,186,'2022-09-08','01',0,NULL,NULL,NULL,10.00,150.00),(133,187,'2022-09-08','01',0,NULL,NULL,NULL,10.00,136.00),(134,188,'2022-09-09','01',0,NULL,NULL,NULL,18.00,275.00),(135,189,'2022-09-09','01',0,NULL,NULL,NULL,40.00,121.00),(136,190,'2022-09-11','01',0,NULL,NULL,NULL,10.00,140.00),(137,191,'2022-09-11','01',0,NULL,NULL,NULL,22.00,141.00),(138,192,'2022-09-11','01',0,NULL,NULL,NULL,22.00,141.00),(139,193,'2022-09-13','01',0,NULL,NULL,NULL,NULL,563.00),(140,194,'2022-09-14','01',0,NULL,NULL,NULL,16.00,230.00),(141,195,'2022-09-14','01',0,NULL,NULL,NULL,NULL,121.00),(142,196,'2022-09-14','01',0,NULL,NULL,NULL,NULL,275.00),(143,197,'2022-09-14','01',0,NULL,NULL,NULL,NULL,680.00),(144,198,'2022-09-14','01',0,NULL,NULL,NULL,NULL,160.00),(145,199,'2022-09-15','01',0,NULL,NULL,NULL,NULL,150.00),(146,200,'2022-09-15','01',0,NULL,NULL,NULL,NULL,282.00),(147,201,'2022-09-16','01',0,NULL,NULL,NULL,NULL,553.00),(148,202,'2022-09-17','01',0,NULL,NULL,NULL,2.00,13.00),(149,203,'2022-09-17','01',0,NULL,NULL,NULL,NULL,1300.00),(150,204,'2022-09-19','01',0,NULL,NULL,NULL,5.00,140.00),(151,205,'2022-09-19','01',0,NULL,NULL,NULL,1.00,185.00),(152,206,'2022-09-20','01',0,NULL,NULL,NULL,22.00,141.00),(153,207,'2022-09-20','01',0,NULL,NULL,NULL,NULL,150.00),(154,208,'2022-09-20','01',0,NULL,NULL,NULL,NULL,221.30),(155,209,'2022-09-20','01',0,NULL,NULL,NULL,NULL,425.00),(156,210,'2022-09-20','01',0,NULL,NULL,NULL,NULL,180.00),(157,211,'2022-09-20','01',0,NULL,NULL,NULL,NULL,530.70),(158,212,'2022-09-21','01',0,NULL,NULL,NULL,5.00,95.00),(159,213,'2022-09-21','01',0,NULL,NULL,NULL,3.00,110.00),(160,214,'2022-09-23','01',0,NULL,NULL,NULL,NULL,150.00),(161,215,'2022-09-23','01',0,NULL,NULL,NULL,10.00,240.00),(162,216,'2022-09-23','01',0,NULL,NULL,NULL,20.00,110.00),(163,217,'2022-09-23','01',0,NULL,NULL,NULL,10.00,170.00),(164,218,'2022-09-24','01',0,NULL,NULL,NULL,8.00,109.00),(165,219,'2022-09-24','01',0,NULL,NULL,NULL,5.00,50.00),(166,220,'2022-09-24','01',0,NULL,NULL,NULL,7.00,142.00),(167,221,'2022-09-24','01',0,NULL,NULL,NULL,NULL,120.00),(168,222,'2022-09-24','01',0,NULL,NULL,NULL,5.00,30.00),(169,223,'2022-09-27','01',0,NULL,NULL,NULL,3.00,42.00),(170,224,'2022-09-28','01',0,NULL,NULL,NULL,NULL,150.00),(171,225,'2022-09-28','01',0,NULL,NULL,NULL,NULL,597.00),(172,226,'2022-09-28','01',0,NULL,NULL,NULL,NULL,330.00),(173,227,'2022-09-28','01',0,NULL,NULL,NULL,NULL,567.00),(174,228,'2022-09-28','01',0,NULL,NULL,NULL,20.00,260.00),(175,229,'2022-09-29','01',0,NULL,NULL,NULL,NULL,30.00),(176,230,'2022-09-29','01',0,NULL,NULL,NULL,5.00,55.00),(177,231,'2022-09-30','01',0,NULL,NULL,NULL,25.00,555.00),(178,232,'2022-09-30','01',0,NULL,NULL,NULL,22.00,230.00),(179,233,'2022-10-01','01',0,NULL,NULL,NULL,15.00,200.00),(180,234,'2022-10-01','01',0,NULL,NULL,NULL,16.00,384.00),(181,235,'2022-10-01','01',0,NULL,NULL,NULL,340.00,1580.00),(182,236,'2022-10-01','01',0,NULL,NULL,NULL,NULL,410.00),(183,237,'2022-10-01','01',0,NULL,NULL,NULL,NULL,678.00),(184,238,'2022-10-01','01',0,NULL,NULL,NULL,25.00,300.00),(185,239,'2022-10-03','01',0,NULL,NULL,NULL,8.00,88.00),(186,240,'2022-10-03','01',0,NULL,NULL,NULL,NULL,139.00),(187,241,'2022-10-04','01',0,NULL,NULL,NULL,NULL,180.00),(188,242,'2022-10-05','01',0,NULL,NULL,NULL,20.00,260.00),(189,243,'2022-10-05','01',0,NULL,NULL,NULL,NULL,170.00),(190,244,'2022-10-05','01',0,NULL,NULL,NULL,NULL,180.00),(191,245,'2022-10-05','01',0,NULL,NULL,NULL,10.00,200.00),(192,246,'2022-10-05','01',0,NULL,NULL,NULL,NULL,3.00),(193,247,'2022-10-05','01',0,NULL,NULL,NULL,NULL,6.00),(194,248,'2022-10-06','01',0,NULL,NULL,NULL,22.00,170.00),(195,249,'2022-10-06','01',0,NULL,NULL,NULL,32.00,160.00),(196,250,'2022-10-08','01',0,NULL,NULL,NULL,10.00,135.00),(197,251,'2022-10-08','01',0,NULL,NULL,NULL,NULL,720.00),(198,252,'2022-10-09','01',0,NULL,NULL,NULL,10.00,230.00),(199,253,'2022-10-09','01',0,NULL,NULL,NULL,NULL,120.00),(200,254,'2022-10-10','01',0,NULL,NULL,NULL,NULL,270.00),(201,255,'2022-10-10','01',0,NULL,NULL,NULL,15.00,420.00),(202,256,'2022-10-10','01',0,NULL,NULL,NULL,10.00,140.00),(203,257,'2022-10-10','01',0,NULL,NULL,NULL,20.00,200.00),(204,258,'2022-10-10','01',0,NULL,NULL,NULL,3.00,90.00),(205,259,'2022-10-10','01',0,NULL,NULL,NULL,3.00,90.00),(206,260,'2022-10-10','01',0,NULL,NULL,NULL,20.00,440.00),(207,261,'2022-10-10','01',0,NULL,NULL,NULL,11.00,179.00),(208,262,'2022-10-11','01',0,NULL,NULL,NULL,9.00,170.00),(209,263,'2022-10-11','01',0,NULL,NULL,NULL,26.00,479.00),(210,264,'2022-10-11','01',0,NULL,NULL,NULL,NULL,479.00),(211,265,'2022-10-12','01',0,NULL,NULL,NULL,NULL,156.00),(212,266,'2022-10-12','01',0,NULL,NULL,NULL,NULL,156.00),(213,267,'2022-10-12','01',0,NULL,NULL,NULL,10.00,146.00),(214,268,'2022-10-13','01',0,NULL,NULL,NULL,8.00,131.00),(215,269,'2022-10-14','01',0,NULL,NULL,NULL,20.00,420.00),(216,270,'2022-10-18','01',0,NULL,NULL,NULL,NULL,3.00),(217,271,'2022-10-17','01',0,NULL,NULL,NULL,NULL,1000.00),(218,272,'2022-10-19','01',0,NULL,NULL,NULL,10.00,110.00),(219,273,'2022-09-15','01',0,NULL,NULL,NULL,NULL,45.00),(220,274,'2022-10-19','01',0,NULL,NULL,NULL,8.00,135.00),(221,275,'2022-10-19','01',0,NULL,NULL,NULL,18.00,302.00),(222,276,'2022-10-15','01',0,NULL,NULL,NULL,NULL,230.00),(223,277,'2022-10-15','01',0,NULL,NULL,NULL,NULL,78.00),(224,278,'2022-10-21','01',0,NULL,NULL,NULL,NULL,645.00),(225,279,'2022-10-21','01',0,NULL,NULL,NULL,NULL,903.00),(226,280,'2022-10-21','01',0,NULL,NULL,NULL,NULL,480.00),(227,281,'2022-10-21','01',0,NULL,NULL,NULL,NULL,280.00),(228,282,'2022-10-21','01',0,NULL,NULL,NULL,24.00,516.00),(229,283,'2022-10-22','01',0,NULL,NULL,NULL,10.00,240.00),(230,284,'2022-10-22','01',0,NULL,NULL,NULL,29.00,156.00),(231,285,'2022-10-25','01',0,NULL,NULL,NULL,NULL,118.00),(232,286,'2022-10-25','01',0,NULL,NULL,NULL,10.00,382.00),(233,287,'2022-10-27','01',0,NULL,NULL,NULL,10.00,150.00),(234,288,'2022-10-27','01',0,NULL,NULL,NULL,2.00,10.00),(235,289,'2022-10-27','01',0,NULL,NULL,NULL,NULL,10.00),(236,290,'2022-10-28','01',0,NULL,NULL,NULL,NULL,45.00),(237,291,'2022-10-28','01',0,NULL,NULL,NULL,NULL,348.00),(238,292,'2022-10-29','01',0,NULL,NULL,NULL,NULL,130.00),(239,293,'2022-10-31','01',0,NULL,NULL,NULL,20.00,620.00),(240,294,'2022-11-03','01',0,NULL,NULL,NULL,10.00,230.00),(241,295,'2022-11-12','01',0,NULL,NULL,1,NULL,388.50),(242,296,'2022-11-17','01',0,NULL,NULL,1,NULL,2256.00),(243,297,'2022-11-17','01',0,NULL,NULL,1,NULL,1580.00),(244,298,'2022-11-17','01',0,NULL,NULL,1,NULL,1500.00),(245,299,'2022-11-17','01',0,NULL,NULL,1,NULL,743.00),(246,300,'2022-11-23','01',0,NULL,NULL,1,NULL,84.00),(247,301,'2022-11-23','01',0,NULL,NULL,1,NULL,435.00),(248,302,'2022-11-23','01',0,NULL,NULL,1,NULL,906.00),(249,303,'2022-11-24','01',0,NULL,NULL,NULL,10.00,60.00),(250,304,'2022-11-25','01',0,NULL,NULL,NULL,NULL,100.00),(251,305,'2022-11-26','01',0,NULL,NULL,NULL,8.00,42.00),(252,306,'2022-11-26','01',0,NULL,NULL,NULL,NULL,80.00),(253,307,'2022-11-26','01',0,NULL,NULL,NULL,NULL,216.00),(254,308,'2022-11-26','01',0,NULL,NULL,NULL,NULL,75.00),(255,309,'2022-11-28','01',0,NULL,NULL,NULL,NULL,225.00),(256,310,'2022-11-28','01',0,NULL,NULL,NULL,10.00,175.00),(257,311,'2022-11-29','01',0,NULL,NULL,NULL,NULL,347.00),(258,312,'2022-11-29','01',0,NULL,NULL,NULL,16.00,423.00),(259,313,'2022-11-29','01',0,NULL,NULL,NULL,3.00,111.00),(260,314,'2022-11-29','01',0,NULL,NULL,NULL,NULL,238.50),(261,315,'2022-11-29','01',0,NULL,NULL,NULL,NULL,138.00),(262,316,'2022-11-30','01',0,NULL,NULL,NULL,NULL,15.00),(263,317,'2022-11-30','01',0,NULL,NULL,NULL,NULL,30.00),(264,318,'2022-12-01','01',0,NULL,NULL,1,NULL,270.00),(265,319,'2022-12-01','01',0,NULL,NULL,1,NULL,210.00),(266,320,'2022-12-01','01',0,NULL,NULL,NULL,NULL,840.00),(267,321,'2022-12-02','01',0,NULL,NULL,NULL,NULL,240.00),(268,322,'2022-12-03','01',0,NULL,NULL,1,NULL,109.00),(269,323,'2022-12-03','01',0,NULL,NULL,1,NULL,175.00),(270,324,'2022-12-03','01',0,NULL,NULL,NULL,NULL,21.00),(271,325,'2022-12-03','01',0,NULL,NULL,NULL,5.00,70.00),(272,326,'2022-12-05','01',0,NULL,NULL,NULL,NULL,200.00),(273,327,'2022-12-05','01',0,NULL,NULL,NULL,NULL,355.00),(274,328,'2022-12-05','01',0,NULL,NULL,NULL,NULL,170.00),(275,329,'2022-12-07','01',0,NULL,NULL,1,NULL,516.00),(276,330,'2022-12-07','01',0,NULL,NULL,1,NULL,270.00),(277,331,'2022-12-07','01',0,NULL,NULL,NULL,27.00,557.00),(278,332,'2022-12-08','01',0,NULL,NULL,NULL,NULL,24.00),(279,333,'2022-12-09','01',0,NULL,NULL,NULL,2.00,170.00),(280,334,'2022-12-02','01',0,NULL,NULL,NULL,NULL,864.00),(281,335,'2022-12-10','01',0,NULL,NULL,NULL,10.00,230.00),(282,336,'2022-12-10','01',0,NULL,NULL,NULL,10.00,230.00),(283,337,'2022-12-10','01',0,NULL,NULL,NULL,NULL,50.00),(284,338,'2022-12-10','01',0,NULL,NULL,NULL,NULL,50.00),(285,339,'2022-12-10','01',0,NULL,NULL,NULL,NULL,50.00),(286,340,'2022-12-10','01',0,NULL,NULL,NULL,NULL,50.00),(287,341,'2022-12-10','01',0,NULL,NULL,NULL,NULL,48.00),(288,342,'2022-12-10','01',0,NULL,NULL,NULL,NULL,48.00),(289,343,'2022-12-13','01',0,NULL,NULL,1,NULL,272.00),(290,344,'2022-12-13','01',0,NULL,NULL,1,NULL,160.00),(291,345,'2022-12-13','01',0,NULL,NULL,1,NULL,216.00),(292,346,'2022-12-13','01',0,NULL,NULL,1,NULL,187.00),(293,347,'2022-12-15','01',0,NULL,NULL,1,NULL,704.00),(294,348,'2022-12-15','01',0,NULL,NULL,1,NULL,670.00),(295,349,'2022-12-15','01',0,NULL,NULL,NULL,NULL,30.00),(296,350,'2022-12-15','01',0,NULL,NULL,NULL,NULL,972.00),(297,351,'2022-12-17','01',0,NULL,NULL,NULL,NULL,107.00),(298,352,'2022-12-19','01',0,NULL,NULL,NULL,10.00,70.00),(299,353,'2022-12-10','01',0,NULL,NULL,NULL,2.00,106.00),(300,354,'2022-12-20','01',0,NULL,NULL,NULL,2.00,106.00),(301,355,'2022-12-20','01',0,NULL,NULL,NULL,2.00,106.00),(302,356,'2022-12-20','01',0,NULL,NULL,1,NULL,108.00),(303,357,'2022-12-20','01',0,NULL,NULL,1,NULL,106.00),(304,358,'2022-12-20','01',0,NULL,NULL,NULL,2.00,106.00),(305,359,'2022-12-20','01',0,NULL,NULL,NULL,25.00,425.00),(306,360,'2022-12-20','01',0,NULL,NULL,NULL,10.00,120.00),(307,361,'2022-12-20','01',0,NULL,NULL,NULL,10.00,120.00),(308,362,'2022-12-21','01',0,NULL,NULL,NULL,3.00,200.00),(309,363,'2022-12-21','01',0,NULL,NULL,NULL,NULL,234.00),(310,364,'2022-12-21','01',0,NULL,NULL,NULL,NULL,603.00),(311,365,'2022-12-21','01',0,NULL,NULL,NULL,NULL,1170.00),(312,366,'2022-12-22','01',0,NULL,NULL,NULL,9.00,45.00),(313,367,'2022-12-23','01',0,NULL,NULL,NULL,NULL,600.00),(314,368,'2022-12-23','01',0,NULL,NULL,NULL,NULL,700.00),(315,369,'2022-12-23','01',0,NULL,NULL,NULL,NULL,250.00),(316,370,'2022-12-24','01',0,NULL,NULL,NULL,NULL,48.00),(317,371,'2022-12-26','01',0,NULL,NULL,NULL,NULL,540.00),(318,372,'2022-12-26','01',0,NULL,NULL,NULL,3.00,222.00),(319,373,'2022-12-27','01',0,NULL,NULL,NULL,NULL,270.00),(320,374,'2022-12-27','01',0,NULL,NULL,NULL,10.00,171.50),(321,375,'2022-12-27','01',0,NULL,NULL,NULL,NULL,96.00),(322,376,'2022-12-28','01',0,NULL,NULL,NULL,NULL,665.00),(323,377,'2022-12-28','01',0,NULL,NULL,NULL,NULL,225.00),(324,378,'2022-12-29','01',0,NULL,NULL,NULL,NULL,180.00),(325,379,'2022-12-30','01',0,NULL,NULL,NULL,NULL,2000.00),(326,380,'2022-12-30','01',0,NULL,NULL,NULL,NULL,2000.00),(327,381,'2022-12-30','01',0,NULL,NULL,NULL,NULL,2000.00),(328,382,'2022-12-30','01',0,NULL,NULL,NULL,NULL,2283.00),(329,383,'2022-12-30','01',0,NULL,NULL,NULL,10.00,150.00),(330,384,'2022-12-30','01',0,NULL,NULL,NULL,NULL,1080.00),(331,385,'2022-12-30','01',0,NULL,NULL,NULL,NULL,36.00),(332,386,'2022-12-31','01',0,NULL,NULL,NULL,NULL,250.00),(333,387,'2023-01-02','01',0,NULL,NULL,NULL,20.00,220.00),(334,388,'2023-01-02','01',0,NULL,NULL,NULL,NULL,140.00),(335,389,'2023-01-03','01',0,NULL,NULL,NULL,15.00,235.00),(336,390,'2023-01-03','01',0,NULL,NULL,NULL,NULL,50.00),(337,391,'2023-01-03','01',0,NULL,NULL,NULL,5.00,65.00),(338,392,'2023-01-03','01',0,NULL,NULL,NULL,1.00,122.00),(339,393,'2023-01-03','01',0,NULL,NULL,NULL,10.00,450.00),(340,394,'2023-01-05','01',0,NULL,NULL,1,NULL,2000.00),(341,395,'2023-01-05','01',0,NULL,NULL,1,NULL,2000.00),(342,396,'2023-01-05','01',0,NULL,NULL,1,NULL,2000.00),(343,397,'2023-01-06','01',0,NULL,NULL,NULL,10.00,210.00),(344,398,'2023-01-06','01',0,NULL,NULL,NULL,NULL,52.00),(345,399,'2023-01-07','01',0,NULL,NULL,NULL,20.00,220.00),(346,400,'2023-01-09','01',0,NULL,NULL,NULL,15.00,365.00),(347,401,'2023-01-09','01',0,NULL,NULL,NULL,NULL,207.00),(348,402,'2023-01-09','01',0,NULL,NULL,NULL,5.00,80.00),(349,403,'2023-01-10','01',0,NULL,NULL,NULL,NULL,120.00),(350,404,'2023-01-10','01',0,NULL,NULL,NULL,NULL,120.00),(351,405,'2023-01-10','01',0,NULL,NULL,NULL,NULL,117.00),(352,406,'2023-01-11','01',0,NULL,NULL,NULL,NULL,60.00),(353,407,'2023-01-12','01',0,NULL,NULL,NULL,NULL,20.00),(354,408,'2023-01-12','01',0,NULL,NULL,NULL,NULL,30.00),(355,409,'2023-01-12','01',0,NULL,NULL,1,NULL,700.00),(356,410,'2023-01-13','01',0,NULL,NULL,1,NULL,1032.00),(357,411,'2023-01-13','01',0,NULL,NULL,1,NULL,1032.00),(358,412,'2023-01-13','01',0,NULL,NULL,NULL,NULL,146.00),(359,413,'2023-01-14','01',0,NULL,NULL,1,NULL,516.00),(360,414,'2023-01-14','01',0,NULL,NULL,1,NULL,235.00),(361,415,'2023-01-14','01',0,NULL,NULL,1,NULL,164.00),(362,416,'2023-01-14','01',0,NULL,NULL,1,NULL,300.00),(364,417,'2023-01-16','01',0,NULL,NULL,NULL,NULL,350.00),(365,418,'2023-01-16','01',0,NULL,NULL,1,NULL,360.00),(366,419,'2023-01-16','01',0,NULL,NULL,NULL,NULL,400.00),(367,420,'2023-01-16','01',0,NULL,NULL,NULL,NULL,228.00),(368,421,'2023-01-16','01',0,NULL,NULL,NULL,NULL,520.00),(369,422,'2023-01-16','01',0,NULL,NULL,NULL,NULL,60.00),(370,423,'2023-01-17','01',0,NULL,NULL,1,NULL,102.00),(372,425,'2023-01-18','01',0,NULL,NULL,NULL,1.50,52.50),(373,424,'2023-01-18','01',0,NULL,NULL,NULL,2.50,274.00),(374,426,'2023-01-18','01',0,NULL,NULL,1,NULL,570.00),(375,427,'2023-01-18','01',0,NULL,NULL,NULL,NULL,625.00),(376,428,'2023-01-18','01',0,NULL,NULL,NULL,NULL,636.00),(377,429,'2023-01-19','01',0,NULL,NULL,NULL,3.00,85.00),(378,430,'2023-01-19','01',0,NULL,NULL,NULL,NULL,659.00),(379,431,'2023-01-20','01',0,NULL,NULL,NULL,NULL,750.00),(380,432,'2023-01-21','01',0,NULL,NULL,1,NULL,617.00),(381,433,'2023-01-21','01',0,NULL,NULL,NULL,NULL,783.00),(382,434,'2023-01-21','01',0,NULL,NULL,NULL,NULL,108.00),(383,435,'2023-01-23','01',0,NULL,NULL,1,NULL,642.00),(384,436,'2023-01-23','01',0,NULL,NULL,1,NULL,385.00),(385,437,'2023-01-23','01',0,NULL,NULL,1,NULL,240.00),(386,438,'2023-01-23','01',0,NULL,NULL,1,NULL,578.00),(387,439,'2023-01-23','01',0,NULL,NULL,1,NULL,835.00),(388,440,'2023-01-24','01',0,NULL,NULL,NULL,5.00,240.00),(389,441,'2023-01-24','01',0,NULL,NULL,NULL,NULL,70.00),(390,442,'2023-01-25','01',0,NULL,NULL,NULL,30.00,360.00),(391,443,'2023-01-25','01',0,NULL,NULL,NULL,30.00,220.00),(392,444,'2023-01-25','01',0,NULL,NULL,1,NULL,351.50),(393,445,'2023-01-26','01',0,NULL,NULL,1,NULL,106.00),(394,446,'2023-01-26','01',0,NULL,NULL,NULL,NULL,165.00),(395,447,'2023-01-26','01',0,NULL,NULL,1,NULL,767.00),(396,448,'2023-01-26','01',0,NULL,NULL,1,NULL,165.00),(397,449,'2023-01-26','01',0,NULL,NULL,NULL,NULL,150.00),(398,450,'2023-01-27','01',0,NULL,NULL,1,NULL,410.00),(399,451,'2023-01-27','01',0,NULL,NULL,1,NULL,864.00),(400,452,'2023-01-27','01',0,NULL,NULL,NULL,NULL,12.00),(401,453,'2023-01-28','01',0,NULL,NULL,NULL,NULL,100.00),(402,454,'2023-01-30','01',0,NULL,NULL,NULL,NULL,160.00),(403,455,'2023-01-30','01',0,NULL,NULL,NULL,15.00,603.00),(404,456,'2023-01-30','01',0,NULL,NULL,NULL,5.00,710.00),(405,457,'2023-01-30','01',0,NULL,NULL,NULL,NULL,25.00),(406,458,'2023-01-30','01',0,NULL,NULL,NULL,10.00,70.00),(407,459,'2023-01-31','01',0,NULL,NULL,NULL,NULL,1100.00),(408,460,'2023-01-31','01',0,NULL,NULL,1,NULL,1378.00),(409,461,'2023-01-31','01',0,NULL,NULL,NULL,NULL,235.00),(410,462,'2023-01-31','01',0,NULL,NULL,NULL,NULL,650.00),(411,463,'2023-01-31','01',0,NULL,NULL,NULL,NULL,258.00),(412,464,'2023-02-01','01',0,NULL,NULL,NULL,NULL,54.00),(413,465,'2023-02-01','01',0,NULL,NULL,NULL,NULL,400.00),(414,466,'2023-02-02','01',0,NULL,NULL,NULL,NULL,551.00),(416,467,'2023-02-03','01',0,NULL,NULL,NULL,NULL,1914.00),(417,468,'2023-02-04','01',0,NULL,NULL,NULL,NULL,295.00),(418,469,'2023-02-04','01',0,NULL,NULL,NULL,NULL,634.00),(419,470,'2023-02-04','01',0,NULL,NULL,NULL,NULL,300.00),(420,471,'2023-02-06','01',0,NULL,NULL,NULL,NULL,36.00),(421,472,'2023-02-06','01',0,NULL,NULL,NULL,1.00,80.00),(422,473,'2023-02-08','01',0,NULL,NULL,NULL,NULL,18.00),(423,474,'2023-02-08','01',0,NULL,NULL,NULL,NULL,165.00),(424,475,'2023-02-08','01',0,NULL,NULL,1,NULL,545.00),(425,476,'2023-02-08','01',0,NULL,NULL,1,NULL,663.00),(426,477,'2023-02-08','01',0,NULL,NULL,1,NULL,606.00),(427,478,'2023-02-08','01',0,NULL,NULL,1,NULL,270.00),(428,479,'2023-02-10','01',0,NULL,NULL,1,NULL,15.00),(429,480,'2023-02-10','01',0,NULL,NULL,NULL,NULL,132.00),(430,481,'2023-02-14','01',0,NULL,NULL,1,NULL,240.00),(431,482,'2023-02-14','01',0,NULL,NULL,NULL,NULL,35.00),(432,483,'2023-02-15','01',0,NULL,NULL,NULL,NULL,280.00),(433,484,'2023-02-16','01',0,NULL,NULL,NULL,NULL,110.00),(434,485,'2023-02-16','01',0,NULL,NULL,NULL,4.00,225.00),(435,486,'2023-02-16','01',0,NULL,NULL,NULL,NULL,60.00),(436,487,'2023-02-17','01',0,NULL,NULL,NULL,NULL,30.00),(437,488,'2023-02-18','01',0,NULL,NULL,NULL,7.40,2102.00),(438,489,'2023-02-20','01',0,NULL,NULL,1,NULL,661.00),(439,490,'2023-02-20','01',0,NULL,NULL,NULL,NULL,668.00),(440,491,'2023-02-20','01',0,NULL,NULL,NULL,NULL,396.00),(441,492,'2023-02-20','01',0,NULL,NULL,NULL,NULL,120.00),(442,493,'2023-02-21','01',0,NULL,NULL,NULL,2.40,90.00),(443,494,'2023-02-21','01',0,NULL,NULL,NULL,0.10,112.00),(444,495,'2023-02-21','01',0,NULL,NULL,NULL,NULL,220.00),(445,496,'2023-02-21','01',0,NULL,NULL,NULL,NULL,1280.00),(446,497,'2023-02-22','01',0,NULL,NULL,NULL,NULL,184.00),(447,498,'2023-02-22','01',0,NULL,NULL,NULL,NULL,181.00),(448,499,'2023-02-23','01',0,NULL,NULL,NULL,NULL,210.00),(449,500,'2023-02-23','01',0,NULL,NULL,NULL,2.00,47.00),(450,501,'2023-02-23','01',0,NULL,NULL,NULL,NULL,1100.00),(451,502,'2023-02-24','01',0,NULL,NULL,NULL,NULL,12.00),(452,503,'2023-02-25','01',0,NULL,NULL,1,NULL,5730.00),(453,504,'2023-02-27','01',0,NULL,NULL,NULL,5.00,25.00),(454,505,'2023-02-27','01',0,NULL,NULL,NULL,10.00,482.80),(455,506,'2023-02-27','01',0,NULL,NULL,NULL,7.00,43.00),(456,507,'2023-02-27','01',0,NULL,NULL,NULL,10.00,120.00),(457,508,'2023-02-28','01',0,NULL,NULL,NULL,NULL,360.00),(458,509,'2023-02-28','01',0,NULL,NULL,NULL,NULL,155.00),(459,510,'2023-02-28','01',0,NULL,NULL,NULL,NULL,150.00),(460,511,'2023-03-01','01',0,NULL,NULL,NULL,NULL,277.00),(461,512,'2023-03-01','01',0,NULL,NULL,NULL,NULL,330.00);

--
-- Table structure for table `document_transports`
--

CREATE TABLE `document_transports` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `seat_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `passenger_manifest` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `identity_document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number_identity_document` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `passenger_fullname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `origin_district_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`origin_district_id`)),
  `origin_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `destinatation_district_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`destinatation_district_id`)),
  `destinatation_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `start_time` time DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `document_transports_document_id_foreign` (`document_id`),
  KEY `document_transports_identity_document_type_id_foreign` (`identity_document_type_id`),
  CONSTRAINT `document_transports_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `document_transports_identity_document_type_id_foreign` FOREIGN KEY (`identity_document_type_id`) REFERENCES `cat_identity_document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_transports`
--


--
-- Table structure for table `documentary_actions`
--

CREATE TABLE `documentary_actions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_actions`
--


--
-- Table structure for table `documentary_documents`
--

CREATE TABLE `documentary_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_documents`
--


--
-- Table structure for table `documentary_file_offices`
--

CREATE TABLE `documentary_file_offices` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `documentary_file_id` int(10) unsigned NOT NULL,
  `documentary_office_id` int(10) unsigned NOT NULL,
  `documentary_action_id` int(10) unsigned NOT NULL DEFAULT 0,
  `status` enum('POR DERIVAR','POR RECIBIR','EN PROCESO','FINALIZADO','ARCHIVADO') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POR DERIVAR',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `office_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Nombre de la etapa',
  `process_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Nombre del tramite',
  `documentary_process_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Tramite relacionado',
  `complete` int(11) NOT NULL DEFAULT 0 COMMENT 'Define si la etapa esta completa',
  `start_date` datetime DEFAULT NULL COMMENT 'Fecha de inicio',
  `end_date` datetime DEFAULT NULL COMMENT 'Fecha de finalizacion',
  `days` int(10) unsigned DEFAULT 0 COMMENT 'dias para el tramite',
  `observation` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `documentary_file_offices_documentary_file_id_foreign` (`documentary_file_id`),
  KEY `documentary_file_offices_documentary_office_id_foreign` (`documentary_office_id`),
  KEY `documentary_file_offices_documentary_action_id_foreign` (`documentary_action_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_file_offices`
--


--
-- Table structure for table `documentary_files`
--

CREATE TABLE `documentary_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL,
  `documentary_document_id` int(10) unsigned DEFAULT 0,
  `documentary_process_id` int(10) unsigned NOT NULL,
  `number` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `year` int(10) unsigned NOT NULL,
  `invoice` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_register` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `time_register` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL,
  `person_id` int(10) unsigned NOT NULL,
  `sender` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subject` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attached_file` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `observation` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('RECIBIDO','DERIVADO','FINALIZADO','ARCHIVADO') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'RECIBIDO',
  `documentary_office_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Define el ultimo proceso',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `requirements` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_archive` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'define si el tramite es simplificado',
  `is_simplify` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'define si el tramite es simplificado',
  `documentary_guides_number_status_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Cuando es simplificado, se usará este status',
  `is_completed` tinyint(1) NOT NULL DEFAULT 0,
  `establishment_id` int(10) unsigned NOT NULL DEFAULT 0,
  `date_end` datetime DEFAULT NULL COMMENT 'Fecha de finalización',
  PRIMARY KEY (`id`),
  KEY `documentary_files_documentary_document_id_foreign` (`documentary_document_id`),
  KEY `documentary_files_documentary_process_id_foreign` (`documentary_process_id`),
  KEY `documentary_files_person_id_foreign` (`person_id`),
  KEY `documentary_files_user_id_foreign` (`user_id`),
  CONSTRAINT `documentary_files_documentary_process_id_foreign` FOREIGN KEY (`documentary_process_id`) REFERENCES `documentary_processes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `documentary_files_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `persons` (`id`) ON DELETE CASCADE,
  CONSTRAINT `documentary_files_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_files`
--


--
-- Table structure for table `documentary_files_archives`
--

CREATE TABLE `documentary_files_archives` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'usuario asociado',
  `documentary_file_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Solicitud asociada',
  `documentary_office_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'etapa asociada',
  `observation` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'observacion',
  `attached_file` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'etapa asociada',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `documentary_guides_number_id` int(10) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_files_archives`
--


--
-- Table structure for table `documentary_files_requirements`
--

CREATE TABLE `documentary_files_requirements` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Nombre a mostrar',
  `file` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Define si tiene archivo',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_files_requirements`
--


--
-- Table structure for table `documentary_guides_number`
--

CREATE TABLE `documentary_guides_number` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_file_id` int(10) unsigned DEFAULT 0 COMMENT 'Expediente relacionado',
  `doc_office_id` int(10) unsigned DEFAULT 0 COMMENT 'Etapa observada',
  `guide` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Especifica la guia',
  `origin` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Especifica la instucion',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `date_of_due` datetime DEFAULT NULL,
  `observation` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_take` datetime DEFAULT NULL COMMENT 'Fecha estimada de finalización',
  `date_end` datetime DEFAULT NULL COMMENT 'Fecha de finalización',
  `documentary_guides_number_status_id` int(10) unsigned DEFAULT 0 COMMENT 'relacionado con documentary_guides_number_status',
  `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Responsable',
  `total_day` int(10) unsigned DEFAULT 1,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_guides_number`
--


--
-- Table structure for table `documentary_guides_number_status`
--

CREATE TABLE `documentary_guides_number_status` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_guides_number_status`
--

INSERT INTO `documentary_guides_number_status` VALUES (1,'En Calificación',NULL),(2,'Concluidos',NULL),(3,'Observados',NULL),(4,'Archivados',NULL);

--
-- Table structure for table `documentary_observation`
--

CREATE TABLE `documentary_observation` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_file_id` int(10) unsigned DEFAULT 0 COMMENT 'Expediente relacionado',
  `observation` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Conjunto de etapas.',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_observation`
--


--
-- Table structure for table `documentary_offices`
--

CREATE TABLE `documentary_offices` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `days` mediumint(8) unsigned NOT NULL DEFAULT 0,
  `default` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_offices`
--

INSERT INTO `documentary_offices` VALUES (1,'Caja','',1,'2022-01-24 11:17:30','2022-01-24 11:17:30',0,0,NULL),(2,'Procesos','',1,'2022-01-24 11:17:30','2022-01-24 11:17:30',0,0,NULL),(3,'Seguimiento','',1,'2022-01-24 11:17:30','2022-01-24 11:17:30',0,0,NULL),(4,'Validacion','',1,'2022-01-24 11:17:30','2022-01-24 11:17:30',0,0,NULL);

--
-- Table structure for table `documentary_processes`
--

CREATE TABLE `documentary_processes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `price` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `documentary_offices` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'etapas que contiene',
  `documentary_offices_order` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_processes`
--


--
-- Table structure for table `documentary_processes_rel_file`
--

CREATE TABLE `documentary_processes_rel_file` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_processes_id` int(10) unsigned DEFAULT 0 COMMENT 'Requerimiento relacionado',
  `doc_file_id` int(10) unsigned DEFAULT 0 COMMENT 'Expediente relacionado',
  `doc_office_id` int(10) unsigned DEFAULT 0 COMMENT 'Etapa actual',
  `stages` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Conjunto de etapas.',
  `complete` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Define si se ha completado',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_processes_rel_file`
--


--
-- Table structure for table `documentary_processes_rel_off`
--

CREATE TABLE `documentary_processes_rel_off` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_processes_id` int(10) unsigned DEFAULT 0 COMMENT 'Requerimiento relacionado',
  `doc_offices_id` int(10) unsigned DEFAULT 0 COMMENT 'Proceso relacionado',
  `active` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Status de la relacion',
  `order` int(10) unsigned DEFAULT 1 COMMENT 'Establece el orden del proceso',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_processes_rel_off`
--


--
-- Table structure for table `documentary_processes_rel_req`
--

CREATE TABLE `documentary_processes_rel_req` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_processes_id` int(10) unsigned DEFAULT 0 COMMENT 'Requerimiento relacionado',
  `doc_files_requirements_id` int(10) unsigned DEFAULT 0 COMMENT 'Proceso relacionado',
  `active` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Status de la relacion',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documentary_processes_rel_req`
--


--
-- Table structure for table `documents`
--

CREATE TABLE `documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `establishment` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`establishment`)),
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ubl_version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ticket_single_shipment` tinyint(1) NOT NULL DEFAULT 0,
  `force_send_by_summary` tinyint(1) NOT NULL DEFAULT 0,
  `group_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `series` char(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payment_condition_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `purchase_order` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `plate_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quotation_id` int(10) unsigned DEFAULT NULL,
  `sale_note_id` int(10) unsigned DEFAULT NULL,
  `user_rel_suscription_plan_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con suscripciones',
  `technical_service_id` int(10) unsigned DEFAULT NULL,
  `order_note_id` int(10) unsigned DEFAULT NULL,
  `dispatch_id` int(10) unsigned DEFAULT NULL,
  `seller_id` int(10) unsigned DEFAULT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `point_system` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indica si el documento se uso en sistema por puntos',
  `point_system_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'datos de sistema por puntos' CHECK (json_valid(`point_system_data`)),
  `automatic_date_of_issue` date DEFAULT NULL,
  `type_period` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quantity_period` int(11) DEFAULT NULL,
  `enabled_concurrency` tinyint(3) unsigned DEFAULT 0,
  `apply_concurrency` tinyint(3) unsigned DEFAULT 0,
  `total_prepayment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exportation` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_free` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxed` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_unaffected` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exonerated` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_igv` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_igv_free` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_plastic_bag_taxes` decimal(6,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `subtotal` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `dispatch_ticket_pdf` tinyint(1) NOT NULL DEFAULT 0,
  `has_prepayment` tinyint(1) NOT NULL DEFAULT 0,
  `affectation_type_prepayment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `was_deducted_prepayment` tinyint(1) NOT NULL DEFAULT 0,
  `pending_amount_prepayment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_pending_payment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`prepayments`)),
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`guides`)),
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`related`)),
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`perception`)),
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`detraction`)),
  `retention` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`retention`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `additional_information` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `additional_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`additional_data`)),
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `unique_filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hash` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `qr` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ' ',
  `reference_data` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `agent_id` int(10) unsigned DEFAULT NULL,
  `has_xml` tinyint(1) NOT NULL DEFAULT 0,
  `has_pdf` tinyint(1) NOT NULL DEFAULT 0,
  `has_cdr` tinyint(1) NOT NULL DEFAULT 0,
  `data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)),
  `send_server` tinyint(1) NOT NULL DEFAULT 1,
  `success_shipping_status` tinyint(1) NOT NULL DEFAULT 0,
  `shipping_status` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`shipping_status`)),
  `success_sunat_shipping_status` tinyint(1) NOT NULL DEFAULT 0,
  `sunat_shipping_status` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`sunat_shipping_status`)),
  `query_status` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`query_status`)),
  `success_query_status` tinyint(1) NOT NULL DEFAULT 0,
  `total_canceled` tinyint(1) NOT NULL DEFAULT 0,
  `soap_shipping_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`soap_shipping_response`)),
  `regularize_shipping` tinyint(1) NOT NULL DEFAULT 0,
  `response_regularize_shipping` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`response_regularize_shipping`)),
  `send_to_pse` tinyint(1) NOT NULL DEFAULT 0,
  `response_signature_pse` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`response_signature_pse`)),
  `response_send_cdr_pse` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`response_send_cdr_pse`)),
  `sale_notes_relateds` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'registros asociados cuando se genera cpe desde multiples notas de venta' CHECK (json_valid(`sale_notes_relateds`)),
  `terms_condition` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `folio` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `is_editable` tinyint(1) NOT NULL DEFAULT 0,
  `grade` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Grado designado - utilizado en matricula',
  `section` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Seccion designado - utilizado en matricula',
  PRIMARY KEY (`id`),
  UNIQUE KEY `documents_unique_filename_unique` (`unique_filename`),
  KEY `documents_user_id_foreign` (`user_id`),
  KEY `documents_establishment_id_foreign` (`establishment_id`),
  KEY `documents_customer_id_foreign` (`customer_id`),
  KEY `documents_soap_type_id_foreign` (`soap_type_id`),
  KEY `documents_state_type_id_foreign` (`state_type_id`),
  KEY `documents_group_id_foreign` (`group_id`),
  KEY `documents_document_type_id_foreign` (`document_type_id`),
  KEY `documents_currency_type_id_foreign` (`currency_type_id`),
  KEY `documents_quotation_id_foreign` (`quotation_id`),
  KEY `documents_external_id_index` (`external_id`),
  KEY `documents_sale_note_id_foreign` (`sale_note_id`),
  KEY `documents_series_index` (`series`),
  KEY `documents_number_index` (`number`),
  KEY `documents_date_of_issue_index` (`date_of_issue`),
  KEY `documents_order_note_id_foreign` (`order_note_id`),
  KEY `documents_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `documents_seller_id_foreign` (`seller_id`),
  KEY `documents_payment_condition_id_foreign` (`payment_condition_id`),
  KEY `documents_dispatch_id_foreign` (`dispatch_id`),
  KEY `documents_technical_service_id_foreign` (`technical_service_id`),
  KEY `documents_type_period_index` (`type_period`),
  KEY `documents_regularize_shipping_index` (`regularize_shipping`),
  KEY `documents_ticket_single_shipment_index` (`ticket_single_shipment`),
  KEY `documents_agent_id_foreign` (`agent_id`),
  KEY `documents_force_send_by_summary_index` (`force_send_by_summary`),
  CONSTRAINT `documents_agent_id_foreign` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`),
  CONSTRAINT `documents_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `documents_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `documents_dispatch_id_foreign` FOREIGN KEY (`dispatch_id`) REFERENCES `dispatches` (`id`),
  CONSTRAINT `documents_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `documents_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `documents_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`),
  CONSTRAINT `documents_order_note_id_foreign` FOREIGN KEY (`order_note_id`) REFERENCES `order_notes` (`id`),
  CONSTRAINT `documents_payment_condition_id_foreign` FOREIGN KEY (`payment_condition_id`) REFERENCES `payment_conditions` (`id`),
  CONSTRAINT `documents_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `documents_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `documents_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`),
  CONSTRAINT `documents_seller_id_foreign` FOREIGN KEY (`seller_id`) REFERENCES `users` (`id`),
  CONSTRAINT `documents_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `documents_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `documents_technical_service_id_foreign` FOREIGN KEY (`technical_service_id`) REFERENCES `technical_services` (`id`),
  CONSTRAINT `documents_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=513 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documents`
--

INSERT INTO `documents` VALUES (3,1,'dfad861c-e695-42e2-bae9-15db096eaf36',1,'{\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"urbanization\":null,\"address\":\"-\",\"email\":\"loceriasunion@softlte.net.pe\",\"telephone\":\"-\",\"code\":\"0000\",\"trade_address\":null,\"web_address\":null,\"aditional_information\":null,\"logo\":null}','02','11','2.1',0,0,'01','01','F003',1,'2022-01-24','18:39:46',2,'{\"identity_document_type_id\":\"6\",\"identity_document_type\":{\"id\":\"6\",\"description\":\"RUC\"},\"number\":\"20608817248\",\"name\":\"FUNERARIA LOS ANGELES DE LA GUARDA S.A.C.\",\"trade_name\":null,\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"address\":\"JR. RICARDO PALMA NRO. 564 - -\",\"email\":null,\"telephone\":null,\"perception_agent\":false,\"address_id\":null,\"internal_code\":null,\"address_type_id\":null,\"address_type\":{\"id\":null,\"description\":null}}','PEN','01',NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,1,3.834,0,NULL,NULL,NULL,NULL,0,0,0.00,0.00,0.00,0.00,0.00,350.00,0.00,0.00,63.00,0.00,0.00,0.00,0.00,0.00,0.00,63.00,350.00,413.00,413.00,0,0,NULL,0,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"code\":1000,\"value\":\"Cuatrocientos trece  con 00\\/100 \"}]',NULL,NULL,'10802930041-01-F003-1','10802930041-01-F003-1','xk3h/5iS/nHaMBLea3e3uKUqYUg=','[encoded data, 90460 characters]',NULL,NULL,0,0,0,NULL,0,0,NULL,0,NULL,NULL,0,1,'{\"sent\":true,\"code\":\"0\",\"description\":\"La Factura numero F003-1, ha sido aceptada\",\"notes\":[]}',0,NULL,0,NULL,NULL,NULL,'',NULL,'2022-01-24 18:41:47','2022-01-24 22:27:57',1,NULL,NULL),(4,1,'ee572e04-ee4b-43bc-9825-29a3bf3b70f4',1,'{\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"urbanization\":null,\"address\":\"-\",\"email\":\"loceriasunion@softlte.net.pe\",\"telephone\":\"-\",\"code\":\"0000\",\"trade_address\":null,\"web_address\":null,\"aditional_information\":null,\"logo\":null}','02','05','2.1',0,0,'01','01','F003',2,'2022-01-24','22:30:17',2,'{\"identity_document_type_id\":\"6\",\"identity_document_type\":{\"id\":\"6\",\"description\":\"RUC\"},\"number\":\"20608817248\",\"name\":\"FUNERARIA LOS ANGELES DE LA GUARDA S.A.C.\",\"trade_name\":null,\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"address\":\"JR. RICARDO PALMA NRO. 564 - -\",\"email\":null,\"telephone\":null,\"perception_agent\":false,\"address_id\":null,\"internal_code\":null,\"address_type_id\":null,\"address_type\":{\"id\":null,\"description\":null}}','PEN','01',NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,1,3.834,0,NULL,NULL,NULL,NULL,0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,350.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,350.00,350.00,350.00,0,0,NULL,0,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"code\":1000,\"value\":\"Trescientos cincuenta  con 00\\/100 \"}]',NULL,NULL,'10802930041-01-F003-2','10802930041-01-F003-2','2E8ulEP2RjD46WZOlhVVFb+GBkI=','[encoded data, 90460 characters]',NULL,NULL,0,0,0,NULL,0,0,NULL,0,NULL,NULL,0,1,'{\"sent\":true,\"code\":\"0\",\"description\":\"La Factura numero F003-2, ha sido aceptada\",\"notes\":[]}',0,NULL,0,NULL,NULL,NULL,'',NULL,'2022-01-24 22:30:55','2022-01-24 22:30:57',1,NULL,NULL),(5,1,'c553d5f1-27ba-4af9-8391-e4d362f7e911',1,'{\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"urbanization\":null,\"address\":\"-\",\"email\":\"loceriasunion@softlte.net.pe\",\"telephone\":\"-\",\"code\":\"0000\",\"trade_address\":null,\"web_address\":null,\"aditional_information\":null,\"logo\":null}','02','11','2.1',0,0,'01','01','F003',3,'2022-01-27','16:38:23',3,'{\"identity_document_type_id\":\"6\",\"identity_document_type\":{\"id\":\"6\",\"description\":\"RUC\"},\"number\":\"20542380455\",\"name\":\"COOPERATIVA DE SERVICIOS MULTIPLES ECOFOREST LTDA\",\"trade_name\":null,\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"06\",\"department\":{\"id\":\"06\",\"description\":\"CAJAMARCA\"},\"province_id\":\"0608\",\"province\":{\"id\":\"0608\",\"description\":\"Ja\\u00e9n\"},\"district_id\":\"060801\",\"district\":{\"id\":\"060801\",\"description\":\"Ja\\u00e9n\"},\"address\":\"AV. PAKAMUROS - 2DO PISO NRO. 2071 SEC. PUEBLO LIBRE\",\"email\":null,\"telephone\":null,\"perception_agent\":false,\"address_id\":null,\"internal_code\":null,\"address_type_id\":null,\"address_type\":{\"id\":null,\"description\":null}}','PEN','01',NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,1,3.852,0,NULL,NULL,NULL,NULL,0,0,0.00,0.00,0.00,0.00,0.00,145.00,0.00,0.00,26.10,0.00,0.00,0.00,0.00,0.00,0.00,26.10,145.00,171.10,171.10,0,0,NULL,0,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"code\":1000,\"value\":\"Ciento setenta y un  con 10\\/100 \"}]',NULL,NULL,'10802930041-01-F003-3','10802930041-01-F003-3','Uc9cZYe+e2fDrrHEzu6A5UA9HSU=','[encoded data, 90460 characters]',NULL,NULL,0,0,0,NULL,0,0,NULL,0,NULL,NULL,0,1,'{\"sent\":true,\"code\":\"0\",\"description\":\"La Factura numero F003-3, ha sido aceptada\",\"notes\":[]}',1,'{\"code\":\"env:Client\",\"description\":\"Internal Error (from client)\"}',0,NULL,NULL,NULL,'',NULL,'2022-01-27 17:02:15','2022-02-11 16:05:10',1,NULL,NULL),(6,1,'4a9aa7c9-4422-4bc2-aa49-ad8ad7ea6fa3',1,'{\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"urbanization\":null,\"address\":\"-\",\"email\":\"loceriasunion@softlte.net.pe\",\"telephone\":\"-\",\"code\":\"0000\",\"trade_address\":null,\"web_address\":null,\"aditional_information\":null,\"logo\":null}','02','05','2.1',0,0,'01','01','F003',4,'2022-01-27','17:05:14',3,'{\"identity_document_type_id\":\"6\",\"identity_document_type\":{\"id\":\"6\",\"description\":\"RUC\"},\"number\":\"20542380455\",\"name\":\"COOPERATIVA DE SERVICIOS MULTIPLES ECOFOREST LTDA\",\"trade_name\":null,\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"06\",\"department\":{\"id\":\"06\",\"description\":\"CAJAMARCA\"},\"province_id\":\"0608\",\"province\":{\"id\":\"0608\",\"description\":\"Ja\\u00e9n\"},\"district_id\":\"060801\",\"district\":{\"id\":\"060801\",\"description\":\"Ja\\u00e9n\"},\"address\":\"AV. PAKAMUROS - 2DO PISO NRO. 2071 SEC. PUEBLO LIBRE\",\"email\":null,\"telephone\":null,\"perception_agent\":false,\"address_id\":null,\"internal_code\":null,\"address_type_id\":null,\"address_type\":{\"id\":null,\"description\":null}}','PEN','01',NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,1,3.852,0,NULL,NULL,NULL,NULL,0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,145.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,145.00,145.00,145.00,0,0,NULL,0,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"code\":1000,\"value\":\"Ciento cuarenta y cinco  con 00\\/100 \"}]',NULL,NULL,'10802930041-01-F003-4','10802930041-01-F003-4','2+CumVMwUSIIG5qVEl78dc3c1zg=','[encoded data, 90460 characters]',NULL,NULL,0,0,0,NULL,0,0,NULL,0,NULL,NULL,0,0,'{\"sent\":true,\"code\":\"0\",\"description\":\"La Factura numero F003-4, ha sido aceptada\",\"notes\":[]}',1,'{\"code\":\"HTTP\",\"description\":\"Bad Gateway\"}',0,NULL,NULL,NULL,'',NULL,'2022-01-27 17:07:21','2022-01-27 20:10:37',1,NULL,NULL),(7,1,'f6a68934-4bc8-42f3-a74c-1b4c978e9d96',1,'{\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":\"01\",\"department\":{\"id\":\"01\",\"description\":\"AMAZONAS\"},\"province_id\":\"0107\",\"province\":{\"id\":\"0107\",\"description\":\"Utcubamba\"},\"district_id\":\"010701\",\"district\":{\"id\":\"010701\",\"description\":\"Bagua Grande\"},\"urbanization\":null,\"address\":\"-\",\"email\":\"loceriasunion@softlte.net.pe\",\"telephone\":\"-\",\"code\":\"0000\",\"trade_address\":null,\"web_address\":null,\"aditional_information\":null,\"logo\":null}','02','05','2.1',0,0,'02','03','B003',1,'2022-01-27','18:55:05',1,'{\"identity_document_type_id\":\"0\",\"identity_document_type\":{\"id\":\"0\",\"description\":\"Doc.trib.no.dom.sin.ruc\"},\"number\":\"99999999\",\"name\":\"Clientes - Varios\",\"trade_name\":null,\"country_id\":\"PE\",\"country\":{\"id\":\"PE\",\"description\":\"PERU\"},\"department_id\":null,\"department\":{\"id\":null,\"description\":null},\"province_id\":null,\"province\":{\"id\":null,\"description\":null},\"district_id\":null,\"district\":{\"id\":null,\"description\":null},\"address\":null,\"email\":null,\"telephone\":null,\"perception_agent\":false,\"address_id\":null,\"internal_code\":null,\"address_type_id\":null,\"address_type\":{\"id\":null,\"description\":null}}','PEN','01',NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,1,3.852,0,NULL,NULL,NULL,NULL,0,0,0.00,0.00,0.00,0.00,0.00,75.00,0.00,0.00,13.50,0.00,0.00,0.00,0.00,0.00,0.00,13.50,75.00,88.50,88.50,0,0,NULL,0,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"code\":1000,\"value\":\"Ochenta y ocho  con 50\\/100 \"}]',NULL,NULL,'10802930041-03-B003-1','10802930041-03-B003-1','fuXVgOifjMHrYI+yEnbMvUOBhrI=','[encoded data, 90460 characters]',NULL,NULL,0,0,0,NULL,0,0,NULL,0,NULL,NULL,0,0,NULL,0,NULL,0,NULL,NULL,NULL,'',NULL,'2022-01-27 19:01:01','2022-06-16 21:46:39',1,NULL,NULL),