-- Table structure for table `module_level_user`
--

CREATE TABLE `module_level_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `module_level_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `module_level_user`
--

SET autocommit=0;
INSERT INTO `module_level_user` VALUES (1,77,0),(2,78,0),(3,79,0),(4,1,1),(5,2,1),(6,3,1),(7,4,1),(8,5,1),(9,6,1),(10,7,1),(11,8,1),(12,9,1),(13,10,1),(14,11,1),(15,12,1),(16,13,1),(17,14,1),(18,15,1),(19,16,1),(20,84,1),(21,17,1),(22,18,1),(23,19,1),(24,20,1),(25,21,1),(26,22,1),(27,23,1),(28,24,1),(29,25,1),(30,26,1),(31,27,1),(32,28,1),(33,29,1),(34,30,1),(35,31,1),(36,32,1),(37,33,1),(38,34,1),(39,35,1),(40,36,1),(41,37,1),(42,38,1),(43,39,1),(44,40,1),(45,41,1),(46,42,1),(47,43,1),(48,44,1),(49,75,1),(50,45,1),(51,46,1),(52,47,1),(53,48,1),(54,49,1),(55,50,1),(56,79,1),(57,51,1),(58,52,1),(59,53,1),(60,54,1),(61,55,1),(62,56,1),(63,57,1),(64,58,1),(65,59,1),(66,60,1),(67,76,1),(68,77,1),(69,78,1),(70,61,1),(71,62,1),(72,63,1),(73,64,1),(74,65,1),(75,66,1),(76,67,1),(77,68,1),(78,69,1),(79,70,1),(80,71,1),(81,72,1),(82,74,1),(83,73,1),(84,80,1),(85,81,1),(86,82,1),(87,83,1);
COMMIT;

-- Dumped table `module_level_user` with 87 row(s)
--

--
-- Table structure for table `module_user`
--

CREATE TABLE `module_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `module_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `module_user`
--

SET autocommit=0;
INSERT INTO `module_user` VALUES (1,7,1),(2,20,1),(3,1,1),(4,6,1),(5,10,1),(6,17,1),(7,18,1),(8,2,1),(9,8,1),(10,14,1),(11,3,1),(12,4,1),(13,9,1),(14,12,1),(15,5,1),(16,11,1),(17,15,1),(18,16,1),(19,19,1),(20,21,1),(21,22,1),(22,24,1),(23,23,1),(24,25,1),(25,26,1),(26,10,2),(27,10,3);
COMMIT;

-- Dumped table `module_user` with 27 row(s)
--

--
-- Table structure for table `notes`
--

CREATE TABLE `notes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `note_type` enum('credit','debit') NOT NULL,
  `note_credit_type_id` varchar(255) DEFAULT NULL,
  `note_debit_type_id` varchar(255) DEFAULT NULL,
  `note_description` varchar(255) NOT NULL,
  `affected_document_id` int(10) unsigned DEFAULT NULL,
  `data_affected_document` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_affected_document`)),
  PRIMARY KEY (`id`),
  KEY `notes_document_id_foreign` (`document_id`),
  KEY `notes_note_credit_type_id_foreign` (`note_credit_type_id`),
  KEY `notes_note_debit_type_id_foreign` (`note_debit_type_id`),
  KEY `notes_affected_document_id_foreign` (`affected_document_id`),
  CONSTRAINT `notes_affected_document_id_foreign` FOREIGN KEY (`affected_document_id`) REFERENCES `documents` (`id`),
  CONSTRAINT `notes_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `notes_note_credit_type_id_foreign` FOREIGN KEY (`note_credit_type_id`) REFERENCES `cat_note_credit_types` (`id`),
  CONSTRAINT `notes_note_debit_type_id_foreign` FOREIGN KEY (`note_debit_type_id`) REFERENCES `cat_note_debit_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `notes`
--

SET autocommit=0;
COMMIT;

-- Dumped table `notes` with 0 row(s)
--

--
-- Table structure for table `offline_configurations`
--

CREATE TABLE `offline_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `is_client` tinyint(1) NOT NULL DEFAULT 0,
  `token_server` varchar(255) DEFAULT NULL,
  `url_server` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `offline_configurations`
--

SET autocommit=0;
INSERT INTO `offline_configurations` VALUES (1,0,NULL,NULL,NULL,NULL);
COMMIT;

-- Dumped table `offline_configurations` with 1 row(s)
--

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `external_id` char(36) NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `shipping_address` varchar(255) DEFAULT NULL,
  `items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`items`)),
  `total` decimal(12,2) NOT NULL,
  `reference_payment` varchar(255) NOT NULL,
  `document_external_id` char(36) DEFAULT NULL,
  `number_document` varchar(255) DEFAULT NULL,
  `status_order_id` tinyint(3) unsigned DEFAULT NULL,
  `purchase` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`purchase`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `apply_restaurant` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `orders_status_order_id_foreign` (`status_order_id`),
  CONSTRAINT `orders_status_order_id_foreign` FOREIGN KEY (`status_order_id`) REFERENCES `status_orders` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `orders`
--

SET autocommit=0;
INSERT INTO `orders` VALUES (1,'45cb3708-2da4-4d4d-ab52-0b51f869079a','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}','direccion 1','[{\"id\": 1, \"line\": \"Desintoxicante\", \"name\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo.\", \"image\": \"0001-20241124182846.jpeg\", \"model\": \"Bolsa\", \"stock\": \"15.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"0001\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"3.00\", \"sub_total\": \"76.00\", \"account_id\": null, \"attributes\": [], \"created_at\": \"2024-11-24T23:28:46.000000Z\", \"updated_at\": \"2024-11-24T23:29:42.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": \"2026-05-13T05:00:00.000000Z\", \"description\": \"PRUNEX1\", \"image_small\": \"0001-20241124182846_small.jpeg\", \"internal_id\": \"0001\", \"second_name\": \"Purgante Fuxion\", \"text_filter\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo. Purgante Fuxion PRUNEX1 Bolsa 0001 0001\", \"factory_code\": null, \"image_medium\": \"0001-20241124182846_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": null, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"76.00\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 45.6, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"40.00\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',76.00,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 11.593220338983043, \"total_item\": 76, \"descripcion\": \"PRUNEX1\", \"codigo_interno\": \"0001\", \"porcentaje_igv\": 18, \"total_base_igv\": 64.40677966101694, \"valor_unitario\": 64.40677966101694, \"precio_unitario\": \"76.00\", \"total_impuestos\": 11.593220338983043, \"total_valor_item\": 64.40677966101694, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"11.59\", \"total_valor\": \"64.41\", \"total_venta\": \"76.00\", \"total_impuestos\": \"11.59\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"64.41\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"18:31:59\", \"serie_documento\": \"B001\", \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"03\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}}','2024-11-24 18:34:19','2024-11-24 18:34:19',NULL,0),(2,'e410a7b1-4f9f-47b1-b206-f28082a3f276','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}','direccion 1','[{\"id\": 1, \"name\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo.\", \"tags\": [], \"image\": \"0001-20241124182846.jpeg\", \"images\": [], \"has_igv\": true, \"cantidad\": 1, \"sale_unit\": 76, \"sub_total\": \"76.00\", \"attributes\": [], \"description\": \"PRUNEX1\", \"image_small\": \"0001-20241124182846_small.jpeg\", \"internal_id\": \"0001\", \"second_name\": \"Purgante Fuxion\", \"image_medium\": \"0001-20241124182846_medium.jpeg\", \"promotion_id\": null, \"unit_type_id\": \"NIU\", \"sale_unit_price\": \"76.00\", \"currency_type_id\": \"PEN\", \"exchange_rate_sale\": null, \"currency_type_symbol\": \"S/\", \"technical_specifications\": null, \"sale_affectation_igv_type_id\": \"10\"}]',76.00,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 11.593220338983043, \"total_item\": 76, \"descripcion\": \"PRUNEX1\", \"codigo_interno\": \"0001\", \"porcentaje_igv\": 18, \"total_base_igv\": 64.40677966101694, \"valor_unitario\": 64.40677966101694, \"precio_unitario\": \"76.00\", \"total_impuestos\": 11.593220338983043, \"total_valor_item\": 64.40677966101694, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"11.59\", \"total_valor\": \"64.41\", \"total_venta\": \"76.00\", \"total_impuestos\": \"11.59\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"64.41\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"18:49:34\", \"serie_documento\": null, \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"80\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}}','2024-11-24 18:50:20','2024-11-24 18:50:20',NULL,0),(3,'121c8d6c-1fde-4a94-874b-cabc35a4ba2a','{\"ubigeo\": \"150101\", \"telefono\": \"952133840\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"74468928\", \"correo_electronico\": \"nilver@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Nilver Fernández\"}','direccion 1','[{\"id\": 1, \"line\": \"Desintoxicante\", \"name\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo.\", \"image\": \"0001-20241124182846.jpeg\", \"model\": \"Bolsa\", \"stock\": \"15.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"0001\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"3.00\", \"sub_total\": \"76.00\", \"account_id\": null, \"attributes\": [], \"created_at\": \"2024-11-24T23:28:46.000000Z\", \"updated_at\": \"2024-11-24T23:29:42.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": \"2026-05-13T05:00:00.000000Z\", \"description\": \"PRUNEX1\", \"image_small\": \"0001-20241124182846_small.jpeg\", \"internal_id\": \"0001\", \"second_name\": \"Purgante Fuxion\", \"text_filter\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo. Purgante Fuxion PRUNEX1 Bolsa 0001 0001\", \"factory_code\": null, \"image_medium\": \"0001-20241124182846_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": null, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"76.00\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 45.6, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"40.00\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',76.00,'efectivo',NULL,NULL,2,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 11.593220338983043, \"total_item\": 76, \"descripcion\": \"PRUNEX1\", \"codigo_interno\": \"0001\", \"porcentaje_igv\": 18, \"total_base_igv\": 64.40677966101694, \"valor_unitario\": 64.40677966101694, \"precio_unitario\": \"76.00\", \"total_impuestos\": 11.593220338983043, \"total_valor_item\": 64.40677966101694, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"11.59\", \"total_valor\": \"64.41\", \"total_venta\": \"76.00\", \"total_impuestos\": \"11.59\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"64.41\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"18:56:36\", \"serie_documento\": null, \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"80\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"952133840\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"74468928\", \"correo_electronico\": \"nilver@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Nilver Fernández\"}}','2024-11-24 18:57:23','2024-11-24 18:59:21',NULL,0),(4,'c4621f82-54a4-49b8-8944-8d843d64d6cc','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}','direccion 1','[{\"id\": 2, \"line\": null, \"name\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable.\", \"image\": \"rexet-20241124191613.jpeg\", \"model\": null, \"stock\": \"3.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"000000000002\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"1.00\", \"sub_total\": \"129.50\", \"account_id\": null, \"attributes\": [{\"value\": \"Bolsa\", \"duration\": null, \"end_date\": null, \"start_date\": null, \"description\": \"Modelo\", \"attribute_type_id\": \"5013\"}], \"created_at\": \"2024-11-25T00:16:13.000000Z\", \"updated_at\": \"2024-11-25T00:19:18.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": null, \"description\": \"REXET\", \"image_small\": \"rexet-20241124191613_small.jpeg\", \"internal_id\": \"0002\", \"second_name\": \"Desintoxicante epatico\", \"text_filter\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable. Desintoxicante epatico REXET 000000000002 0002\", \"factory_code\": null, \"image_medium\": \"rexet-20241124191613_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": 1, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"129.50\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 77.7, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"66.67\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',129.50,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 19.754237288135585, \"total_item\": 129.5, \"descripcion\": \"REXET\", \"codigo_interno\": \"0002\", \"porcentaje_igv\": 18, \"total_base_igv\": 109.7457627118644, \"valor_unitario\": 109.7457627118644, \"precio_unitario\": \"129.50\", \"total_impuestos\": 19.754237288135585, \"total_valor_item\": 109.7457627118644, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"19.75\", \"total_valor\": \"109.75\", \"total_venta\": \"129.50\", \"total_impuestos\": \"19.75\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"109.75\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"19:20:52\", \"serie_documento\": \"B001\", \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"03\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}}','2024-11-24 19:21:28','2024-11-24 19:21:28',NULL,0),(5,'8953919d-da87-49db-ac31-fe47e4c23521','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}','direccion 1','[{\"id\": 2, \"line\": null, \"name\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable.\", \"image\": \"rexet-20241124191613.jpeg\", \"model\": null, \"stock\": \"3.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"000000000002\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"1.00\", \"sub_total\": \"129.50\", \"account_id\": null, \"attributes\": [{\"value\": \"Bolsa\", \"duration\": null, \"end_date\": null, \"start_date\": null, \"description\": \"Modelo\", \"attribute_type_id\": \"5013\"}], \"created_at\": \"2024-11-25T00:16:13.000000Z\", \"updated_at\": \"2024-11-25T00:19:18.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": null, \"description\": \"REXET\", \"image_small\": \"rexet-20241124191613_small.jpeg\", \"internal_id\": \"0002\", \"second_name\": \"Desintoxicante epatico\", \"text_filter\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable. Desintoxicante epatico REXET 000000000002 0002\", \"factory_code\": null, \"image_medium\": \"rexet-20241124191613_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": 1, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"129.50\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 77.7, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"66.67\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',129.50,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 19.754237288135585, \"total_item\": 129.5, \"descripcion\": \"REXET\", \"codigo_interno\": \"0002\", \"porcentaje_igv\": 18, \"total_base_igv\": 109.7457627118644, \"valor_unitario\": 109.7457627118644, \"precio_unitario\": \"129.50\", \"total_impuestos\": 19.754237288135585, \"total_valor_item\": 109.7457627118644, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"19.75\", \"total_valor\": \"109.75\", \"total_venta\": \"129.50\", \"total_impuestos\": \"19.75\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"109.75\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"19:20:52\", \"serie_documento\": \"B001\", \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"03\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}}','2024-11-24 19:21:45','2024-11-24 19:21:45',NULL,0),(6,'e4baedd3-faf9-4c05-91ff-cb1b7ffacd43','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}','direccion 1','[{\"id\": 2, \"line\": null, \"name\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable.\", \"image\": \"rexet-20241124191613.jpeg\", \"model\": null, \"stock\": \"3.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"000000000002\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"1.00\", \"sub_total\": \"129.50\", \"account_id\": null, \"attributes\": [{\"value\": \"Bolsa\", \"duration\": null, \"end_date\": null, \"start_date\": null, \"description\": \"Modelo\", \"attribute_type_id\": \"5013\"}], \"created_at\": \"2024-11-25T00:16:13.000000Z\", \"updated_at\": \"2024-11-25T00:19:18.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": null, \"description\": \"REXET\", \"image_small\": \"rexet-20241124191613_small.jpeg\", \"internal_id\": \"0002\", \"second_name\": \"Desintoxicante epatico\", \"text_filter\": \"MIX DE CONCENTRADOS DE FRUTAS Y VEGETALES (TUNA ROJA, ALCACHOFA, HIERBA LUISA, PEREJIL, ACEROLA, CLOROFILA) + BICARBONATO DE SODIO + MIX DE MINERALES (ZINC, MAGNESIO) +  VITAMINAS DEL COMPLEJO B, VITAMINA C Y D + L-TAURINA Y L-CISTEÍNA (DE COLÁGENO)  Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable. Desintoxicante epatico REXET 000000000002 0002\", \"factory_code\": null, \"image_medium\": \"rexet-20241124191613_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": 1, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"129.50\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 77.7, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"66.67\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',129.50,'efectivo','e1487abf-46b9-4347-8067-50daec76ccb3','B001-1',2,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 19.754237288135585, \"total_item\": 129.5, \"descripcion\": \"REXET\", \"codigo_interno\": \"0002\", \"porcentaje_igv\": 18, \"total_base_igv\": 109.7457627118644, \"valor_unitario\": 109.7457627118644, \"precio_unitario\": \"129.50\", \"total_impuestos\": 19.754237288135585, \"total_valor_item\": 109.7457627118644, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"19.75\", \"total_valor\": \"109.75\", \"total_venta\": \"129.50\", \"total_impuestos\": \"19.75\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"109.75\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"19:22:33\", \"serie_documento\": \"B001\", \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"03\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"diegopotosi23@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Diego\"}}','2024-11-24 19:23:49','2024-11-24 19:26:43',NULL,0),(7,'a5c57782-bfc7-496b-9443-b9f226a9d1b2','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205593\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}','direccion 1','[{\"id\": 2, \"line\": null, \"name\": \"Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable.\", \"image\": \"rexet-20241124191613.jpeg\", \"model\": null, \"stock\": \"2.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"000000000002\", \"has_igv\": true, \"has_isc\": 0, \"brand_id\": null, \"cantidad\": 1, \"favorite\": false, \"lot_code\": null, \"sanitary\": null, \"item_code\": null, \"stock_min\": \"1.00\", \"sub_total\": \"129.50\", \"account_id\": null, \"attributes\": [{\"value\": \"Bolsa\", \"duration\": null, \"end_date\": null, \"start_date\": null, \"description\": \"Modelo\", \"attribute_type_id\": \"5013\"}], \"created_at\": \"2024-11-25T00:16:13.000000Z\", \"updated_at\": \"2024-11-25T00:26:40.000000Z\", \"apply_store\": 1, \"category_id\": null, \"cod_digemid\": null, \"date_of_due\": null, \"description\": \"REXET\", \"image_small\": \"rexet-20241124191613_small.jpeg\", \"internal_id\": \"0002\", \"second_name\": \"Desintoxicante epatico\", \"text_filter\": \"Bebida efervescente que aporta nutrientes conocidos por ayudar a proteger el hígado y promover su función desintoxicante de manera saludable. Desintoxicante epatico REXET 000000000002 0002\", \"factory_code\": null, \"image_medium\": \"rexet-20241124191613_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 0, \"unit_type_id\": \"NIU\", \"warehouse_id\": 1, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"129.50\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 77.7, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"66.67\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',129.50,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 19.754237288135585, \"total_item\": 129.5, \"descripcion\": \"REXET\", \"codigo_interno\": \"0002\", \"porcentaje_igv\": 18, \"total_base_igv\": 109.7457627118644, \"valor_unitario\": 109.7457627118644, \"precio_unitario\": \"129.50\", \"total_impuestos\": 19.754237288135585, \"total_valor_item\": 109.7457627118644, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"19.75\", \"total_valor\": \"109.75\", \"total_venta\": \"129.50\", \"total_impuestos\": \"19.75\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"109.75\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"19:30:57\", \"serie_documento\": null, \"fecha_de_emision\": \"2024-11-24\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-11-24\", \"codigo_tipo_documento\": \"80\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205593\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}}','2024-11-24 19:31:18','2024-11-24 19:31:18',NULL,0),(8,'c2f8bc9e-8a28-4982-b6cb-9ad10f85466c','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}','direccion 1','[{\"id\": 52, \"name\": \"Prunex1 - Doypack 28 sticks x 5gr\", \"tags\": [], \"image\": \"imagen-no-disponible.jpg\", \"images\": [], \"has_igv\": false, \"cantidad\": 1, \"sale_unit\": 76, \"sub_total\": \"89.68\", \"attributes\": [], \"description\": \"Prunex1 - Doypack 28 sticks x 5gr\", \"image_small\": \"imagen-no-disponible.jpg\", \"internal_id\": \"BI052\", \"second_name\": \"Prunex1 - Doypack 28 sticks x 5gr\", \"image_medium\": \"imagen-no-disponible.jpg\", \"promotion_id\": null, \"unit_type_id\": \"NIU\", \"sale_unit_price\": \"89.68\", \"currency_type_id\": \"PEN\", \"exchange_rate_sale\": null, \"currency_type_symbol\": \"S/\", \"technical_specifications\": null, \"sale_affectation_igv_type_id\": \"10\"}]',89.68,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 13.679999999999993, \"total_item\": 89.68, \"descripcion\": \"Prunex1 - Doypack 28 sticks x 5gr\", \"codigo_interno\": \"BI052\", \"porcentaje_igv\": 18, \"total_base_igv\": 76.00000000000001, \"valor_unitario\": 76.00000000000001, \"precio_unitario\": \"89.68\", \"total_impuestos\": 13.679999999999993, \"total_valor_item\": 76.00000000000001, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"13.68\", \"total_valor\": \"76.00\", \"total_venta\": \"89.68\", \"total_impuestos\": \"13.68\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"76.00\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"17:50:14\", \"serie_documento\": \"B001\", \"fecha_de_emision\": \"2024-12-04\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-12-04\", \"codigo_tipo_documento\": \"03\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"70205993\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"1\", \"codigo_tipo_documento_identidad\": \"1\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}}','2024-12-04 17:50:36','2024-12-04 17:50:36',NULL,0),(9,'e3a28848-f368-443d-aae1-659b002b1fc5','{\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"102059939\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"6\", \"codigo_tipo_documento_identidad\": \"6\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}','direccion 1','[{\"id\": 51, \"line\": null, \"name\": \"Prunex1 - Caja 7 sticks x 5gr\", \"image\": \"BI051-20241206012933.jpeg\", \"model\": \"GA051\", \"stock\": \"100.0000\", \"active\": 1, \"is_set\": 0, \"status\": 1, \"barcode\": \"B1000051\", \"has_igv\": false, \"has_isc\": 0, \"brand_id\": 4, \"cantidad\": 1, \"favorite\": false, \"lot_code\": \"323282\", \"sanitary\": null, \"item_code\": \"51121753\", \"stock_min\": \"10.00\", \"sub_total\": \"21.00\", \"account_id\": null, \"attributes\": [], \"created_at\": \"2024-12-04T22:38:10.000000Z\", \"updated_at\": \"2024-12-06T06:29:33.000000Z\", \"apply_store\": 1, \"category_id\": 4, \"cod_digemid\": null, \"date_of_due\": \"2026-01-23T05:00:00.000000Z\", \"description\": \"Prunex1 - Caja 7 sticks x 5gr\", \"image_small\": \"BI051-20241206012933_small.jpeg\", \"internal_id\": \"BI051\", \"second_name\": \"Prunex1 - Caja 7 sticks x 5gr\", \"text_filter\": \"Prunex1 - Caja 7 sticks x 5gr Prunex1 - Caja 7 sticks x 5gr Prunex1 - Caja 7 sticks x 5gr GA051 B1000051 BI051 FUXION FUXION\", \"factory_code\": null, \"image_medium\": \"BI051-20241206012933_medium.jpeg\", \"item_type_id\": \"01\", \"lots_enabled\": 1, \"unit_type_id\": \"NIU\", \"warehouse_id\": 1, \"currency_type\": {\"id\": \"PEN\", \"active\": 1, \"symbol\": \"S/\", \"description\": \"Soles\"}, \"item_code_gs1\": null, \"has_perception\": 0, \"percentage_isc\": \"0.00\", \"series_enabled\": 0, \"commission_type\": null, \"exchange_points\": false, \"sale_unit_price\": \"21.00\", \"suggested_price\": \"0.00\", \"web_platform_id\": null, \"apply_restaurant\": 0, \"currency_type_id\": \"PEN\", \"purchase_has_igv\": true, \"purchase_has_isc\": false, \"commission_amount\": null, \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": 0, \"exchange_rate_sale\": null, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"purchase_unit_price\": 0, \"sale_unit_price_set\": null, \"percentage_of_profit\": \"0.00\", \"has_plastic_bag_taxes\": 0, \"percentage_perception\": null, \"subject_to_detraction\": false, \"purchase_percentage_isc\": \"0.00\", \"amount_plastic_bag_taxes\": \"0.10\", \"technical_specifications\": null, \"purchase_system_isc_type_id\": null, \"sale_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}]',21.00,'efectivo',NULL,NULL,1,'{\"items\": [{\"cantidad\": 1, \"total_igv\": 3.203389830508474, \"total_item\": 21, \"descripcion\": \"Prunex1 - Caja 7 sticks x 5gr\", \"codigo_interno\": \"BI051\", \"porcentaje_igv\": 18, \"total_base_igv\": 17.796610169491522, \"valor_unitario\": 17.796610169491522, \"precio_unitario\": \"21.00\", \"total_impuestos\": 3.203389830508474, \"total_valor_item\": 17.796610169491522, \"unidad_de_medida\": \"NIU\", \"codigo_tipo_precio\": \"01\", \"nombre_producto_pdf\": null, \"codigo_producto_sunat\": null, \"actualizar_descripcion\": false, \"codigo_tipo_afectacion_igv\": \"10\"}], \"totales\": {\"total_igv\": \"3.20\", \"total_valor\": \"17.80\", \"total_venta\": \"21.00\", \"total_impuestos\": \"3.20\", \"total_exportacion\": 0, \"total_operaciones_gravadas\": \"17.80\", \"total_operaciones_gratuitas\": 0, \"total_operaciones_inafectas\": 0, \"total_operaciones_exoneradas\": \"0.00\"}, \"acciones\": {\"formato_pdf\": \"a4\", \"enviar_email\": true}, \"hora_de_emision\": \"01:44:43\", \"serie_documento\": \"F001\", \"fecha_de_emision\": \"2024-12-06\", \"numero_documento\": \"#\", \"codigo_tipo_moneda\": \"PEN\", \"fecha_de_vencimiento\": \"2024-12-06\", \"codigo_tipo_documento\": \"01\", \"codigo_tipo_operacion\": \"0101\", \"datos_del_cliente_o_receptor\": {\"ubigeo\": \"150101\", \"telefono\": \"931087394\", \"direccion\": \"Chota\", \"codigo_pais\": \"PE\", \"numero_documento\": \"102059939\", \"correo_electronico\": \"fernandeznilver830@gmail.com\", \"identity_document_type_id\": \"6\", \"codigo_tipo_documento_identidad\": \"6\", \"apellidos_y_nombres_o_razon_social\": \"Administrador\"}}','2024-12-06 01:45:02','2024-12-06 01:45:02',NULL,0),(10,'b676cc07-e51c-410d-8031-649be908d859','{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"74468928\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"Chota\",\"correo_electronico\":\"fernandeznilver830@gmail.com\",\"telefono\":\"931087394\",\"identity_document_type_id\":\"1\"}','direccion 1','[{\"id\":1,\"name\":\"Bebida saludable alcalinizante que te ayuda a promover la limpieza de elementos t\\u00f3xicos de tu organismo y equilibrar el pH de tu cuerpo, para que puedas vivir sano y con energ\\u00eda.\",\"second_name\":\"\\u00a1MANT\\u00c9N TU CUERPO BALANCEADO, LIMPIO Y DESINTOXICADO!\",\"description\":\"Alpha Balance - Doypack 28 sticks x 5gr\",\"text_filter\":\"Bebida saludable alcalinizante que te ayuda a promover la limpieza de elementos t\\u00f3xicos de tu organismo y equilibrar el pH de tu cuerpo, para que puedas vivir sano y con energ\\u00eda. \\u00a1MANT\\u00c9N TU CUERPO BALANCEADO, LIMPIO Y DESINTOXICADO! Alpha Balance - Doypack 28 sticks x 5gr GA001 B1000001 BI001 1. LIMPIA FUXION\",\"model\":\"GA001\",\"factory_code\":null,\"barcode\":\"B1000001\",\"technical_specifications\":\"Preparaci\\u00f3n:\\nDisolver el contenido de un stick en un vaso con 180 ml de agua fr\\u00eda.\\n\\nRecomendaci\\u00f3n de Consumo:\\nToma uno o dos sticks al d\\u00eda a la hora que lo desees. De preferencia al levantarte o con tu jugo del desayuno.\",\"item_type_id\":\"01\",\"internal_id\":\"BI001\",\"item_code\":\"51121703\",\"date_of_due\":\"2025-12-04T05:00:00.000000Z\",\"account_id\":null,\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"currency_type_id\":\"PEN\",\"sale_unit_price\":\"129.50\",\"purchase_has_igv\":true,\"has_igv\":false,\"subject_to_detraction\":false,\"purchase_unit_price\":0,\"has_isc\":0,\"restrict_sale_cpe\":false,\"exchange_points\":false,\"quantity_of_points\":0,\"commission_amount\":null,\"line\":null,\"commission_type\":null,\"amount_plastic_bag_taxes\":\"0.10\",\"system_isc_type_id\":null,\"percentage_isc\":\"0.00\",\"suggested_price\":\"0.00\",\"purchase_has_isc\":false,\"purchase_system_isc_type_id\":null,\"purchase_percentage_isc\":\"0.00\",\"sale_affectation_igv_type_id\":\"10\",\"purchase_affectation_igv_type_id\":\"10\",\"calculate_quantity\":0,\"sale_unit_price_set\":null,\"is_set\":0,\"favorite\":false,\"category_id\":1,\"brand_id\":4,\"image\":\"BI001-20241205000645.jpg\",\"image_medium\":\"BI001-20241205000645_medium.jpg\",\"image_small\":\"BI001-20241205000645_small.jpg\",\"stock\":\"115.0000\",\"stock_min\":\"10.00\",\"has_plastic_bag_taxes\":0,\"lot_code\":\"323232\",\"lots_enabled\":1,\"series_enabled\":0,\"percentage_of_profit\":\"0.00\",\"has_perception\":0,\"percentage_perception\":null,\"attributes\":[],\"active\":1,\"web_platform_id\":null,\"created_at\":\"2024-12-04T22:38:09.000000Z\",\"updated_at\":\"2024-12-06T15:53:55.000000Z\",\"warehouse_id\":1,\"status\":1,\"apply_store\":1,\"apply_restaurant\":0,\"cod_digemid\":null,\"sanitary\":null,\"is_for_production\":false,\"currency_type\":{\"id\":\"PEN\",\"active\":1,\"symbol\":\"S\\/\",\"description\":\"Soles\"},\"cantidad\":1,\"sub_total\":\"129.50\",\"exchange_rate_sale\":null}]',129.50,'efectivo',NULL,NULL,1,'{\"acciones\":{\"enviar_email\":true,\"formato_pdf\":\"a4\"},\"serie_documento\":\"B001\",\"numero_documento\":\"#\",\"fecha_de_emision\":\"2025-01-29\",\"hora_de_emision\":\"18:47:06\",\"codigo_tipo_operacion\":\"0101\",\"codigo_tipo_documento\":\"03\",\"codigo_tipo_moneda\":\"PEN\",\"fecha_de_vencimiento\":\"2025-01-29\",\"datos_del_cliente_o_receptor\":{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"74468928\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"Chota\",\"correo_electronico\":\"fernandeznilver830@gmail.com\",\"telefono\":\"931087394\",\"identity_document_type_id\":\"1\"},\"totales\":{\"total_exportacion\":0,\"total_operaciones_gravadas\":\"109.75\",\"total_operaciones_inafectas\":0,\"total_operaciones_exoneradas\":\"0.00\",\"total_operaciones_gratuitas\":0,\"total_igv\":\"19.75\",\"total_impuestos\":\"19.75\",\"total_valor\":\"109.75\",\"total_venta\":\"129.50\"},\"items\":[{\"codigo_interno\":\"BI001\",\"descripcion\":\"Alpha Balance - Doypack 28 sticks x 5gr\",\"codigo_producto_sunat\":null,\"unidad_de_medida\":\"NIU\",\"cantidad\":1,\"valor_unitario\":109.74576271186441545069101266562938690185546875,\"codigo_tipo_precio\":\"01\",\"precio_unitario\":\"129.50\",\"codigo_tipo_afectacion_igv\":\"10\",\"total_base_igv\":109.74576271186441545069101266562938690185546875,\"porcentaje_igv\":18,\"total_igv\":19.75423728813558454930898733437061309814453125,\"total_impuestos\":19.75423728813558454930898733437061309814453125,\"total_valor_item\":109.74576271186441545069101266562938690185546875,\"total_item\":129.5,\"actualizar_descripcion\":false,\"nombre_producto_pdf\":null}]}','2025-01-29 18:47:39','2025-01-29 18:47:39',NULL,0);
COMMIT;

-- Dumped table `orders` with 10 row(s)
--

--
-- Table structure for table `order_forms`
--

CREATE TABLE `order_forms` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` varchar(255) 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`)),
  `observations` text NOT NULL,
  `transport_mode_type_id` varchar(255) NOT NULL,
  `transfer_reason_type_id` varchar(255) NOT NULL,
  `transfer_reason_description` varchar(255) NOT NULL,
  `date_of_shipping` date NOT NULL,
  `transshipment_indicator` tinyint(1) NOT NULL,
  `port_code` varchar(255) DEFAULT NULL,
  `unit_type_id` varchar(255) NOT NULL,
  `total_weight` decimal(10,2) NOT NULL,
  `packages_number` int(11) NOT NULL,
  `container_number` int(11) DEFAULT NULL,
  `origin` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`origin`)),
  `delivery` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`delivery`)),
  `dispatcher_id` int(10) unsigned NOT NULL,
  `driver_id` int(10) unsigned NOT NULL,
  `license_plates` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`license_plates`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `optional` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`optional`)),
  `filename` varchar(255) DEFAULT NULL,
  `qr` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `order_forms_dispatcher_id_foreign` (`dispatcher_id`),
  KEY `order_forms_driver_id_foreign` (`driver_id`),
  KEY `order_forms_user_id_foreign` (`user_id`),
  KEY `order_forms_establishment_id_foreign` (`establishment_id`),
  KEY `order_forms_soap_type_id_foreign` (`soap_type_id`),
  KEY `order_forms_state_type_id_foreign` (`state_type_id`),
  KEY `order_forms_customer_id_foreign` (`customer_id`),
  KEY `order_forms_unit_type_id_foreign` (`unit_type_id`),
  KEY `order_forms_transport_mode_type_id_foreign` (`transport_mode_type_id`),
  KEY `order_forms_transfer_reason_type_id_foreign` (`transfer_reason_type_id`),
  KEY `order_forms_date_of_issue_index` (`date_of_issue`),
  CONSTRAINT `order_forms_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `order_forms_dispatcher_id_foreign` FOREIGN KEY (`dispatcher_id`) REFERENCES `dispatchers` (`id`),
  CONSTRAINT `order_forms_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`),
  CONSTRAINT `order_forms_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `order_forms_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `order_forms_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `order_forms_transfer_reason_type_id_foreign` FOREIGN KEY (`transfer_reason_type_id`) REFERENCES `cat_transfer_reason_types` (`id`),
  CONSTRAINT `order_forms_transport_mode_type_id_foreign` FOREIGN KEY (`transport_mode_type_id`) REFERENCES `cat_transport_mode_types` (`id`),
  CONSTRAINT `order_forms_unit_type_id_foreign` FOREIGN KEY (`unit_type_id`) REFERENCES `cat_unit_types` (`id`),
  CONSTRAINT `order_forms_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_forms`
--

SET autocommit=0;
COMMIT;

-- Dumped table `order_forms` with 0 row(s)
--

--
-- Table structure for table `order_form_items`
--

CREATE TABLE `order_form_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_form_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `order_form_items_order_form_id_foreign` (`order_form_id`),
  KEY `order_form_items_item_id_foreign` (`item_id`),
  CONSTRAINT `order_form_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `order_form_items_order_form_id_foreign` FOREIGN KEY (`order_form_id`) REFERENCES `order_forms` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_form_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `order_form_items` with 0 row(s)
--

--
-- Table structure for table `order_notes`
--

CREATE TABLE `order_notes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(3) NOT NULL,
  `document_type_id` char(2) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `delivery_date` date DEFAULT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `shipping_address` text DEFAULT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `payment_method_type_id` char(2) DEFAULT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `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_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,
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `additional_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`additional_data`)),
  `filename` varchar(255) DEFAULT NULL,
  `observation` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `quotation_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con cotizaciones',
  PRIMARY KEY (`id`),
  UNIQUE KEY `order_notes_series_number_unique` (`soap_type_id`,`series`,`number`),
  KEY `order_notes_user_id_foreign` (`user_id`),
  KEY `order_notes_establishment_id_foreign` (`establishment_id`),
  KEY `order_notes_customer_id_foreign` (`customer_id`),
  KEY `order_notes_state_type_id_foreign` (`state_type_id`),
  KEY `order_notes_currency_type_id_foreign` (`currency_type_id`),
  KEY `order_notes_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `order_notes_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `order_notes_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `order_notes_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `order_notes_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `order_notes_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `order_notes_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `order_notes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_notes`
--

SET autocommit=0;
COMMIT;

-- Dumped table `order_notes` with 0 row(s)
--

--
-- Table structure for table `order_note_items`
--

CREATE TABLE `order_note_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_note_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `quantity_factor` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `percentage_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,
  `percentage_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) DEFAULT 0.00 COMMENT 'Impuesto bolsa plastica',
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `additional_information` longtext DEFAULT NULL COMMENT 'Informacion adcional',
  `warehouse_id` int(10) unsigned DEFAULT NULL,
  `name_product_pdf` longtext DEFAULT NULL COMMENT 'Nombre del producto para el pdf',
  PRIMARY KEY (`id`),
  KEY `order_note_items_order_note_id_foreign` (`order_note_id`),
  KEY `order_note_items_item_id_foreign` (`item_id`),
  KEY `order_note_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `order_note_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `order_note_items_price_type_id_foreign` (`price_type_id`),
  KEY `order_note_items_warehouse_id_foreign` (`warehouse_id`),
  CONSTRAINT `order_note_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `order_note_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `order_note_items_order_note_id_foreign` FOREIGN KEY (`order_note_id`) REFERENCES `order_notes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `order_note_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `order_note_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`),
  CONSTRAINT `order_note_items_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_note_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `order_note_items` with 0 row(s)
--

--
-- Table structure for table `origin_addresses`
--

CREATE TABLE `origin_addresses` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `address` varchar(255) NOT NULL,
  `location_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`location_id`)),
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `is_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 `origin_addresses`
--

SET autocommit=0;
COMMIT;

-- Dumped table `origin_addresses` with 0 row(s)
--

--
-- Table structure for table `packaging`
--

CREATE TABLE `packaging` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `item_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  `soap_type_id` char(2) DEFAULT NULL,
  `item_extra_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`item_extra_data`)),
  `establishment_id` int(10) unsigned DEFAULT NULL,
  `quantity` decimal(8,2) DEFAULT 0.00,
  `number_packages` decimal(8,2) DEFAULT 0.00,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`item`)),
  `observation` longtext DEFAULT NULL,
  `lot_code` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `date_start` date DEFAULT NULL,
  `time_start` time DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `time_end` time DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `packaging_collaborator` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `packaging_soap_type_id_foreign` (`soap_type_id`),
  CONSTRAINT `packaging_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `packaging`
--

SET autocommit=0;
COMMIT;

-- Dumped table `packaging` with 0 row(s)
--

--
-- Table structure for table `padrones`
--

CREATE TABLE `padrones` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `ruc` varchar(255) NOT NULL,
  `nombre_razon_social` varchar(155) NOT NULL,
  `estado_contribuyente` varchar(100) NOT NULL,
  `condicion_domicilio` varchar(100) NOT NULL,
  `ubigeo` varchar(50) NOT NULL,
  `tipo_via` varchar(20) NOT NULL,
  `nombre_via` varchar(50) NOT NULL,
  `codigo_zona` varchar(155) NOT NULL,
  `tipo_zona` varchar(20) NOT NULL,
  `numero` varchar(155) NOT NULL,
  `interior` varchar(50) NOT NULL,
  `lote` varchar(20) NOT NULL,
  `departamento` varchar(100) NOT NULL,
  `manzana` varchar(20) NOT NULL,
  `kilometro` varchar(20) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `padrones_ruc_index` (`ruc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `padrones`
--

SET autocommit=0;
COMMIT;

-- Dumped table `padrones` with 0 row(s)
--

--
-- Table structure for table `password_resets`
--

CREATE TABLE `password_resets` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `password_resets`
--

SET autocommit=0;
COMMIT;

-- Dumped table `password_resets` with 0 row(s)
--

--
-- Table structure for table `payment_conditions`
--

CREATE TABLE `payment_conditions` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `days` int(11) NOT NULL DEFAULT 0,
  `is_locked` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `payment_conditions_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_conditions`
--

SET autocommit=0;
INSERT INTO `payment_conditions` VALUES ('01','Contado',0,1,1),('02','Crédito',0,1,1);
COMMIT;

-- Dumped table `payment_conditions` with 2 row(s)
--

--
-- Table structure for table `payment_configurations`
--

CREATE TABLE `payment_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `enabled_yape` tinyint(1) NOT NULL,
  `qrcode_yape` varchar(255) DEFAULT NULL,
  `name_yape` varchar(255) DEFAULT NULL,
  `telephone_yape` varchar(255) DEFAULT NULL,
  `enabled_mp` tinyint(1) NOT NULL DEFAULT 0,
  `access_token_mp` varchar(255) DEFAULT NULL,
  `public_key_mp` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_configurations`
--

SET autocommit=0;
INSERT INTO `payment_configurations` VALUES (1,1,'qr_yape_1_20241206020144.jpg','NILVER FERNANDEZ CAMACHO','952133840',0,NULL,NULL,'2024-11-24 16:57:46','2024-12-06 02:01:44');
COMMIT;

-- Dumped table `payment_configurations` with 1 row(s)
--

--
-- Table structure for table `payment_files`
--

CREATE TABLE `payment_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filename` varchar(255) NOT NULL,
  `payment_id` int(11) NOT NULL,
  `payment_type` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `payment_index` (`payment_id`,`payment_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_files`
--

SET autocommit=0;
COMMIT;

-- Dumped table `payment_files` with 0 row(s)
--

--
-- Table structure for table `payment_links`
--

CREATE TABLE `payment_links` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `soap_type_id` char(2) NOT NULL,
  `uuid` char(36) NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `payment_link_type_id` char(2) NOT NULL,
  `payment_id` int(11) DEFAULT NULL,
  `payment_type` varchar(255) DEFAULT NULL,
  `total` decimal(12,2) NOT NULL,
  `uploaded_filename` varchar(255) DEFAULT NULL,
  `query_transaction` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `payment_links_uuid_unique` (`uuid`),
  KEY `payment_index` (`payment_id`,`payment_type`),
  KEY `payment_links_user_id_foreign` (`user_id`),
  KEY `payment_links_soap_type_id_foreign` (`soap_type_id`),
  KEY `payment_links_payment_link_type_id_foreign` (`payment_link_type_id`),
  CONSTRAINT `payment_links_payment_link_type_id_foreign` FOREIGN KEY (`payment_link_type_id`) REFERENCES `payment_link_types` (`id`),
  CONSTRAINT `payment_links_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `payment_links_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_links`
--

SET autocommit=0;
INSERT INTO `payment_links` VALUES (1,'01','befd4c0a-13be-4d73-85d5-2552814d3c2d',1,'01',NULL,NULL,76.00,NULL,0,'2024-12-06 01:49:00','2024-12-06 01:49:00');
COMMIT;

-- Dumped table `payment_links` with 1 row(s)
--

--
-- Table structure for table `payment_link_types`
--

CREATE TABLE `payment_link_types` (
  `id` char(2) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_link_types`
--

SET autocommit=0;
INSERT INTO `payment_link_types` VALUES ('01','Yape'),('02','Mercado Pago');
COMMIT;

-- Dumped table `payment_link_types` with 2 row(s)
--

--
-- Table structure for table `payment_method_types`
--

CREATE TABLE `payment_method_types` (
  `id` char(2) NOT NULL,
  `description` varchar(255) NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `charge` decimal(12,2) DEFAULT NULL,
  `number_days` int(11) DEFAULT NULL,
  `is_credit` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Define si es tipo credito',
  `is_cash` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Define si es es efectivo',
  KEY `payment_method_types_id_index` (`id`),
  KEY `payment_method_types_is_credit_index` (`is_credit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_method_types`
--

SET autocommit=0;
INSERT INTO `payment_method_types` VALUES ('01','Efectivo',0,NULL,NULL,0,1),('02','Tarjeta de crédito',1,NULL,NULL,0,0),('03','Tarjeta de débito',1,NULL,NULL,0,0),('04','Transferencia',0,NULL,NULL,0,0),('05','Factura a 30 días',0,NULL,30,1,0),('06','Tarjeta crédito visa',1,3.68,NULL,0,0),('07','Contado contraentrega',0,NULL,NULL,0,0),('08','A 30 días',0,NULL,30,1,0),('09','Crédito',1,NULL,NULL,1,0),('10','Contado',0,NULL,NULL,0,1),('11','YAPE',0,NULL,0,0,0);
COMMIT;

-- Dumped table `payment_method_types` with 11 row(s)
--

--
-- Table structure for table `perceptions`
--

CREATE TABLE `perceptions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `establishment` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`establishment`)),
  `external_id` char(36) NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `ubl_version` varchar(255) NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date 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) NOT NULL,
  `perception_type_id` varchar(255) NOT NULL,
  `observations` text DEFAULT NULL,
  `total_perception` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `optional` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`optional`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `filename` varchar(255) DEFAULT NULL,
  `time_of_issue` time NOT NULL,
  `hash` varchar(255) 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,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `perceptions_user_id_foreign` (`user_id`),
  KEY `perceptions_establishment_id_foreign` (`establishment_id`),
  KEY `perceptions_soap_type_id_foreign` (`soap_type_id`),
  KEY `perceptions_state_type_id_foreign` (`state_type_id`),
  KEY `perceptions_document_type_id_foreign` (`document_type_id`),
  KEY `perceptions_currency_type_id_foreign` (`currency_type_id`),
  KEY `perceptions_perception_type_id_foreign` (`perception_type_id`),
  KEY `perceptions_customer_id_foreign` (`customer_id`),
  KEY `perceptions_number_index` (`number`),
  KEY `perceptions_series_index` (`series`),
  CONSTRAINT `perceptions_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `perceptions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `perceptions_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `perceptions_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `perceptions_perception_type_id_foreign` FOREIGN KEY (`perception_type_id`) REFERENCES `cat_perception_types` (`id`),
  CONSTRAINT `perceptions_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `perceptions_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `perceptions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `perceptions`
--

SET autocommit=0;
COMMIT;

-- Dumped table `perceptions` with 0 row(s)
--

--
-- Table structure for table `perception_documents`
--

CREATE TABLE `perception_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `perception_id` int(10) unsigned NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_perception` date NOT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `total_document` decimal(10,2) NOT NULL,
  `total_perception` decimal(10,2) NOT NULL,
  `payments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`payments`)),
  `series` varchar(255) NOT NULL,
  `exchange_rate` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`exchange_rate`)),
  `total_to_pay` decimal(10,2) NOT NULL,
  `total_payment` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `perception_details_perception_id_foreign` (`perception_id`),
  KEY `perception_documents_document_type_id_foreign` (`document_type_id`),
  KEY `perception_documents_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `perception_details_perception_id_foreign` FOREIGN KEY (`perception_id`) REFERENCES `perceptions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `perception_documents_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `perception_documents_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `perception_documents`
--

SET autocommit=0;
COMMIT;

-- Dumped table `perception_documents` with 0 row(s)
--

--
-- Table structure for table `persons`
--

CREATE TABLE `persons` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` enum('customers','suppliers') NOT NULL,
  `identity_document_type_id` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `text_filter` longtext DEFAULT NULL,
  `trade_name` varchar(255) DEFAULT NULL,
  `internal_code` varchar(100) DEFAULT NULL,
  `barcode` varchar(150) DEFAULT NULL,
  `country_id` char(2) NOT NULL,
  `nationality_id` char(2) DEFAULT NULL,
  `department_id` char(2) DEFAULT NULL,
  `province_id` char(4) DEFAULT NULL,
  `district_id` char(6) DEFAULT NULL,
  `address_type_id` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `condition` varchar(255) DEFAULT NULL,
  `state` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `telephone` varchar(255) DEFAULT NULL,
  `accumulated_points` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'sistema por puntos',
  `perception_agent` tinyint(1) NOT NULL DEFAULT 0,
  `is_agent_retention` tinyint(1) NOT NULL DEFAULT 0,
  `person_type_id` int(10) unsigned DEFAULT NULL,
  `contact` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`contact`)),
  `comment` varchar(255) DEFAULT NULL,
  `percentage_perception` decimal(12,2) DEFAULT NULL,
  `enabled` tinyint(1) NOT NULL DEFAULT 1,
  `website` text DEFAULT NULL COMMENT 'Sitio Web',
  `zone` longtext DEFAULT NULL COMMENT 'Zona',
  `observation` longtext DEFAULT NULL COMMENT 'Observaciones',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `credit_days` int(10) unsigned DEFAULT 0 COMMENT 'establece los dias de credito',
  `optional_email` longtext DEFAULT NULL COMMENT 'Conjunto de correos de envio',
  `parent_id` int(10) unsigned DEFAULT 0 COMMENT 'Se relaciona con si mismo, numero mayor a 0 es el id del padre.',
  `zone_id` int(10) unsigned DEFAULT NULL,
  `seller_id` int(10) unsigned DEFAULT NULL,
  `has_discount` tinyint(1) NOT NULL DEFAULT 0,
  `discount_type` char(2) NOT NULL DEFAULT '01',
  `discount_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`id`),
  KEY `persons_identity_document_type_id_foreign` (`identity_document_type_id`),
  KEY `persons_country_id_foreign` (`country_id`),
  KEY `persons_department_id_foreign` (`department_id`),
  KEY `persons_province_id_foreign` (`province_id`),
  KEY `persons_district_id_foreign` (`district_id`),
  KEY `persons_name_index` (`name`),
  KEY `persons_number_index` (`number`),
  KEY `persons_type_index` (`type`),
  KEY `persons_person_type_id_foreign` (`person_type_id`),
  KEY `persons_enabled_index` (`enabled`),
  KEY `persons_address_type_id_foreign` (`address_type_id`),
  KEY `persons_seller_id_index` (`seller_id`),
  KEY `persons_nationality_id_foreign` (`nationality_id`),
  CONSTRAINT `persons_address_type_id_foreign` FOREIGN KEY (`address_type_id`) REFERENCES `cat_address_types` (`id`),
  CONSTRAINT `persons_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`),
  CONSTRAINT `persons_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`),
  CONSTRAINT `persons_district_id_foreign` FOREIGN KEY (`district_id`) REFERENCES `districts` (`id`),
  CONSTRAINT `persons_identity_document_type_id_foreign` FOREIGN KEY (`identity_document_type_id`) REFERENCES `cat_identity_document_types` (`id`),
  CONSTRAINT `persons_nationality_id_foreign` FOREIGN KEY (`nationality_id`) REFERENCES `countries` (`id`),
  CONSTRAINT `persons_person_type_id_foreign` FOREIGN KEY (`person_type_id`) REFERENCES `person_types` (`id`),
  CONSTRAINT `persons_province_id_foreign` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `persons`
--

SET autocommit=0;
INSERT INTO `persons` VALUES (1,'customers','0','99999999','Clientes - Varios',NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2024-11-24 16:57:49','2024-11-24 16:57:49',1,0,NULL,0,NULL,NULL,0,'01',0.00),(2,'customers','1','74468928','Nilver Fernández',NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Chota',NULL,NULL,'nilver@gmail.com','952133840',0.00,0,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2024-11-24 18:59:14','2024-11-24 18:59:14',1,0,NULL,0,NULL,NULL,0,'01',0.00),(3,'customers','1','70205993','Diego',NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Chota',NULL,NULL,'diegopotosi23@gmail.com','931087394',0.00,0,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2024-11-24 19:26:40','2024-11-24 19:26:40',1,0,NULL,0,NULL,NULL,0,'01',0.00);
COMMIT;

-- Dumped table `persons` with 3 row(s)
--

--
-- Table structure for table `person_address`
--

CREATE TABLE `person_address` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(10) unsigned NOT NULL,
  `department_id` char(2) DEFAULT NULL,
  `province_id` char(4) DEFAULT NULL,
  `district_id` char(6) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `person_address_person_id_foreign` (`person_id`),
  KEY `person_address_department_id_foreign` (`department_id`),
  KEY `person_address_province_id_foreign` (`province_id`),
  KEY `person_address_district_id_foreign` (`district_id`),
  CONSTRAINT `person_address_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`),
  CONSTRAINT `person_address_district_id_foreign` FOREIGN KEY (`district_id`) REFERENCES `districts` (`id`),
  CONSTRAINT `person_address_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `person_address_province_id_foreign` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `person_address`
--

SET autocommit=0;
COMMIT;

-- Dumped table `person_address` with 0 row(s)
--

--
-- Table structure for table `person_addresses`
--

CREATE TABLE `person_addresses` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(10) unsigned NOT NULL,
  `country_id` char(2) NOT NULL,
  `department_id` char(2) DEFAULT NULL,
  `province_id` char(4) DEFAULT NULL,
  `district_id` char(6) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `main` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `person_addresses_person_id_foreign` (`person_id`),
  KEY `person_addresses_country_id_foreign` (`country_id`),
  KEY `person_addresses_department_id_foreign` (`department_id`),
  KEY `person_addresses_province_id_foreign` (`province_id`),
  KEY `person_addresses_district_id_foreign` (`district_id`),
  CONSTRAINT `person_addresses_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`),
  CONSTRAINT `person_addresses_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`),
  CONSTRAINT `person_addresses_district_id_foreign` FOREIGN KEY (`district_id`) REFERENCES `districts` (`id`),
  CONSTRAINT `person_addresses_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `person_addresses_province_id_foreign` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `person_addresses`
--

SET autocommit=0;
COMMIT;

-- Dumped table `person_addresses` with 0 row(s)
--

--
-- Table structure for table `person_types`
--

CREATE TABLE `person_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` text NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `person_types`
--

SET autocommit=0;
INSERT INTO `person_types` VALUES (1,'Interno','2024-11-24 16:57:28','2024-11-24 16:57:28'),(2,'Distribuidor','2024-11-24 16:57:28','2024-11-24 16:57:28');
COMMIT;

-- Dumped table `person_types` with 2 row(s)
--

--
-- Table structure for table `preprinted_format_templates`
--

CREATE TABLE `preprinted_format_templates` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `formats` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `preprinted_format_templates`
--

SET autocommit=0;
INSERT INTO `preprinted_format_templates` VALUES (1,'custom'),(2,'static');
COMMIT;

-- Dumped table `preprinted_format_templates` with 2 row(s)
--

--
-- Table structure for table `production`
--

CREATE TABLE `production` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT 0,
  `soap_type_id` char(2) DEFAULT NULL,
  `item_id` int(10) unsigned DEFAULT 0,
  `inventory_id_reference` int(10) unsigned DEFAULT NULL,
  `quantity` decimal(12,4) DEFAULT 0.0000 COMMENT 'Peso dle insumo ',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `machine_id` int(10) unsigned NOT NULL DEFAULT 0,
  `production_order` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `comment` longtext DEFAULT NULL,
  `date_start` date DEFAULT NULL,
  `time_start` time DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `time_end` time DEFAULT NULL,
  `lot_code` varchar(255) DEFAULT NULL,
  `item_extra_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`item_extra_data`)),
  `mix_date_start` date DEFAULT NULL,
  `mix_time_start` time DEFAULT NULL,
  `mix_date_end` date DEFAULT NULL,
  `mix_time_end` time DEFAULT NULL,
  `informative` tinyint(3) unsigned DEFAULT 0,
  `agreed` decimal(8,2) DEFAULT 0.00,
  `imperfect` decimal(8,2) DEFAULT 0.00,
  `proccess_type` longtext DEFAULT NULL,
  `production_collaborator` text DEFAULT NULL,
  `mix_collaborator` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `production_soap_type_id_foreign` (`soap_type_id`),
  CONSTRAINT `production_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `production`
--

SET autocommit=0;
COMMIT;

-- Dumped table `production` with 0 row(s)
--

--
-- Table structure for table `promotions`
--

CREATE TABLE `promotions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `type` varchar(255) DEFAULT NULL,
  `image` varchar(255) NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `apply_restaurant` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `promotions_item_id_foreign` (`item_id`),
  CONSTRAINT `promotions_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `promotions`
--

SET autocommit=0;
INSERT INTO `promotions` VALUES (1,'LIMPIA TU COLON','NO ESPERES A SUFRIR CANCER DE COLON',NULL,'no-esperes-a-sufrir-cancer-de-colon-20241206121902.jpg',52,0,'2024-12-06 12:16:45','2024-12-06 12:21:58',0),(2,'BIOPRO','TU CUERPO ES TU MEJOR DEFENSA',NULL,'tu-cuerpo-es-tu-mejor-defensa-20241206122745.png',9,1,'2024-12-06 12:26:12','2024-12-06 12:27:45',0);
COMMIT;

-- Dumped table `promotions` with 2 row(s)
--

--
-- Table structure for table `provinces`
--

CREATE TABLE `provinces` (
  `id` char(4) NOT NULL,
  `department_id` char(2) NOT NULL,
  `description` varchar(255) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `provinces_department_id_foreign` (`department_id`),
  KEY `provinces_id_index` (`id`),
  CONSTRAINT `provinces_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `provinces`
--

SET autocommit=0;
INSERT INTO `provinces` VALUES ('0101','01','Chachapoyas',1),('0102','01','Bagua',1),('0103','01','Bongará',1),('0104','01','Condorcanqui',1),('0105','01','Luya',1),('0106','01','Rodríguez de Mendoza',1),('0107','01','Utcubamba',1),('0201','02','Huaraz',1),('0202','02','Aija',1),('0203','02','Antonio Raymondi',1),('0204','02','Asunción',1),('0205','02','Bolognesi',1),('0206','02','Carhuaz',1),('0207','02','Carlos Fermín Fitzcarrald',1),('0208','02','Casma',1),('0209','02','Corongo',1),('0210','02','Huari',1),('0211','02','Huarmey',1),('0212','02','Huaylas',1),('0213','02','Mariscal Luzuriaga',1),('0214','02','Ocros',1),('0215','02','Pallasca',1),('0216','02','Pomabamba',1),('0217','02','Recuay',1),('0218','02','Santa',1),('0219','02','Sihuas',1),('0220','02','Yungay',1),('0301','03','Abancay',1),('0302','03','Andahuaylas',1),('0303','03','Antabamba',1),('0304','03','Aymaraes',1),('0305','03','Cotabambas',1),('0306','03','Chincheros',1),('0307','03','Grau',1),('0401','04','Arequipa',1),('0402','04','Camaná',1),('0403','04','Caravelí',1),('0404','04','Castilla',1),('0405','04','Caylloma',1),('0406','04','Condesuyos',1),('0407','04','Islay',1),('0408','04','La Uniòn',1),('0501','05','Huamanga',1),('0502','05','Cangallo',1),('0503','05','Huanca Sancos',1),('0504','05','Huanta',1),('0505','05','La Mar',1),('0506','05','Lucanas',1),('0507','05','Parinacochas',1),('0508','05','Pàucar del Sara Sara',1),('0509','05','Sucre',1),('0510','05','Víctor Fajardo',1),('0511','05','Vilcas Huamán',1),('0601','06','Cajamarca',1),('0602','06','Cajabamba',1),('0603','06','Celendín',1),('0604','06','Chota',1),('0605','06','Contumazá',1),('0606','06','Cutervo',1),('0607','06','Hualgayoc',1),('0608','06','Jaén',1),('0609','06','San Ignacio',1),('0610','06','San Marcos',1),('0611','06','San Miguel',1),('0612','06','San Pablo',1),('0613','06','Santa Cruz',1),('0701','07','Prov. Const. del Callao',1),('0801','08','Cusco',1),('0802','08','Acomayo',1),('0803','08','Anta',1),('0804','08','Calca',1),('0805','08','Canas',1),('0806','08','Canchis',1),('0807','08','Chumbivilcas',1),('0808','08','Espinar',1),('0809','08','La Convención',1),('0810','08','Paruro',1),('0811','08','Paucartambo',1),('0812','08','Quispicanchi',1),('0813','08','Urubamba',1),('0901','09','Huancavelica',1),('0902','09','Acobamba',1),('0903','09','Angaraes',1),('0904','09','Castrovirreyna',1),('0905','09','Churcampa',1),('0906','09','Huaytará',1),('0907','09','Tayacaja',1),('1001','10','Huánuco',1),('1002','10','Ambo',1),('1003','10','Dos de Mayo',1),('1004','10','Huacaybamba',1),('1005','10','Huamalíes',1),('1006','10','Leoncio Prado',1),('1007','10','Marañón',1),('1008','10','Pachitea',1),('1009','10','Puerto Inca',1),('1010','10','Lauricocha',1),('1011','10','Yarowilca',1),('1101','11','Ica',1),('1102','11','Chincha',1),('1103','11','Nasca',1),('1104','11','Palpa',1),('1105','11','Pisco',1),('1201','12','Huancayo',1),('1202','12','Concepción',1),('1203','12','Chanchamayo',1),('1204','12','Jauja',1),('1205','12','Junín',1),('1206','12','Satipo',1),('1207','12','Tarma',1),('1208','12','Yauli',1),('1209','12','Chupaca',1),('1301','13','Trujillo',1),('1302','13','Ascope',1),('1303','13','Bolívar',1),('1304','13','Chepén',1),('1305','13','Julcán',1),('1306','13','Otuzco',1),('1307','13','Pacasmayo',1),('1308','13','Pataz',1),('1309','13','Sánchez Carrión',1),('1310','13','Santiago de Chuco',1),('1311','13','Gran Chimú',1),('1312','13','Virú',1),('1401','14','Chiclayo',1),('1402','14','Ferreñafe',1),('1403','14','Lambayeque',1),('1501','15','Lima',1),('1502','15','Barranca',1),('1503','15','Cajatambo',1),('1504','15','Canta',1),('1505','15','Cañete',1),('1506','15','Huaral',1),('1507','15','Huarochirí',1),('1508','15','Huaura',1),('1509','15','Oyón',1),('1510','15','Yauyos',1),('1601','16','Maynas',1),('1602','16','Alto Amazonas',1),('1603','16','Loreto',1),('1604','16','Mariscal Ramón Castilla',1),('1605','16','Requena',1),('1606','16','Ucayali',1),('1607','16','Datem del Marañón',1),('1608','16','Putumayo',1),('1701','17','Tambopata',1),('1702','17','Manu',1),('1703','17','Tahuamanu',1),('1801','18','Mariscal Nieto',1),('1802','18','General Sánchez Cerro',1),('1803','18','Ilo',1),('1901','19','Pasco',1),('1902','19','Daniel Alcides Carrión',1),('1903','19','Oxapampa',1),('2001','20','Piura',1),('2002','20','Ayabaca',1),('2003','20','Huancabamba',1),('2004','20','Morropón',1),('2005','20','Paita',1),('2006','20','Sullana',1),('2007','20','Talara',1),('2008','20','Sechura',1),('2101','21','Puno',1),('2102','21','Azángaro',1),('2103','21','Carabaya',1),('2104','21','Chucuito',1),('2105','21','El Collao',1),('2106','21','Huancané',1),('2107','21','Lampa',1),('2108','21','Melgar',1),('2109','21','Moho',1),('2110','21','San Antonio de Putina',1),('2111','21','San Román',1),('2112','21','Sandia',1),('2113','21','Yunguyo',1),('2201','22','Moyobamba',1),('2202','22','Bellavista',1),('2203','22','El Dorado',1),('2204','22','Huallaga',1),('2205','22','Lamas',1),('2206','22','Mariscal Cáceres',1),('2207','22','Picota',1),('2208','22','Rioja',1),('2209','22','San Martín',1),('2210','22','Tocache',1),('2301','23','Tacna',1),('2302','23','Candarave',1),('2303','23','Jorge Basadre',1),('2304','23','Tarata',1),('2401','24','Tumbes',1),('2402','24','Contralmirante Villar',1),('2403','24','Zarumilla',1),('2501','25','Coronel Portillo',1),('2502','25','Atalaya',1),('2503','25','Padre Abad',1),('2504','25','Purús',1);
COMMIT;

-- Dumped table `provinces` with 196 row(s)
--

--
-- Table structure for table `purchases`
--

CREATE TABLE `purchases` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `group_id` char(2) NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `time_of_issue` time NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `purchase_order_id` int(10) unsigned DEFAULT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `payment_condition_id` varchar(255) DEFAULT NULL,
  `observation` text DEFAULT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `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_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_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `total_canceled` tinyint(1) NOT NULL DEFAULT 0,
  `customer_id` int(10) unsigned DEFAULT NULL,
  `perception_date` date DEFAULT NULL,
  `perception_number` int(11) DEFAULT NULL,
  `total_perception` decimal(12,2) DEFAULT NULL,
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchases_user_id_foreign` (`user_id`),
  KEY `purchases_establishment_id_foreign` (`establishment_id`),
  KEY `purchases_supplier_id_foreign` (`supplier_id`),
  KEY `purchases_soap_type_id_foreign` (`soap_type_id`),
  KEY `purchases_state_type_id_foreign` (`state_type_id`),
  KEY `purchases_group_id_foreign` (`group_id`),
  KEY `purchases_document_type_id_foreign` (`document_type_id`),
  KEY `purchases_currency_type_id_foreign` (`currency_type_id`),
  KEY `purchases_purchase_order_id_foreign` (`purchase_order_id`),
  KEY `purchases_customer_id_foreign` (`customer_id`),
  KEY `purchases_payment_condition_id_foreign` (`payment_condition_id`),
  CONSTRAINT `purchases_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `purchases_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `purchases_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `purchases_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `purchases_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`),
  CONSTRAINT `purchases_payment_condition_id_foreign` FOREIGN KEY (`payment_condition_id`) REFERENCES `general_payment_conditions` (`id`),
  CONSTRAINT `purchases_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`),
  CONSTRAINT `purchases_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `purchases_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `purchases_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `purchases_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchases`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchases` with 0 row(s)
--

--
-- Table structure for table `purchase_fee`
--

CREATE TABLE `purchase_fee` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_method_type_id` char(2) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_fee_purchase_id_foreign` (`purchase_id`),
  KEY `purchase_fee_currency_type_id_foreign` (`currency_type_id`),
  KEY `purchase_fee_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `purchase_fee_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `purchase_fee_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `purchase_fee_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_fee`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_fee` with 0 row(s)
--

--
-- Table structure for table `purchase_items`
--

CREATE TABLE `purchase_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `item_lot_group_id` int(10) unsigned DEFAULT NULL,
  `lot_code` varchar(255) DEFAULT NULL,
  `quantity` decimal(12,4) NOT NULL,
  `unit_value` decimal(16,6) NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `percentage_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,
  `percentage_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `warehouse_id` int(10) unsigned DEFAULT NULL,
  `name_product_pdf` longtext DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_items_purchase_id_foreign` (`purchase_id`),
  KEY `purchase_items_item_id_foreign` (`item_id`),
  KEY `purchase_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `purchase_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `purchase_items_price_type_id_foreign` (`price_type_id`),
  KEY `purchase_items_warehouse_id_foreign` (`warehouse_id`),
  KEY `purchase_items_item_lot_group_id_index` (`item_lot_group_id`),
  CONSTRAINT `purchase_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `purchase_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `purchase_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `purchase_items_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE,
  CONSTRAINT `purchase_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`),
  CONSTRAINT `purchase_items_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_items` with 0 row(s)
--

--
-- Table structure for table `purchase_orders`
--

CREATE TABLE `purchase_orders` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` varchar(255) NOT NULL DEFAULT 'OC',
  `document_type_id` char(2) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `time_of_issue` time NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `currency_type_id` varchar(255) NOT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `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_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_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `upload_filename` varchar(255) DEFAULT NULL,
  `purchase_quotation_id` int(10) unsigned DEFAULT NULL,
  `sale_opportunity_id` int(10) unsigned DEFAULT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchase_orders_series_number_unique` (`soap_type_id`,`series`,`number`),
  KEY `purchase_orders_purchase_quotation_id_foreign` (`purchase_quotation_id`),
  KEY `purchase_orders_user_id_foreign` (`user_id`),
  KEY `purchase_orders_establishment_id_foreign` (`establishment_id`),
  KEY `purchase_orders_supplier_id_foreign` (`supplier_id`),
  KEY `purchase_orders_state_type_id_foreign` (`state_type_id`),
  KEY `purchase_orders_currency_type_id_foreign` (`currency_type_id`),
  KEY `purchase_orders_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `purchase_orders_sale_opportunity_id_foreign` (`sale_opportunity_id`),
  CONSTRAINT `purchase_orders_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `purchase_orders_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `purchase_orders_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `purchase_orders_purchase_quotation_id_foreign` FOREIGN KEY (`purchase_quotation_id`) REFERENCES `purchase_quotations` (`id`),
  CONSTRAINT `purchase_orders_sale_opportunity_id_foreign` FOREIGN KEY (`sale_opportunity_id`) REFERENCES `sale_opportunities` (`id`),
  CONSTRAINT `purchase_orders_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `purchase_orders_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `purchase_orders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `purchase_orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_orders`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_orders` with 0 row(s)
--

--
-- Table structure for table `purchase_order_items`
--

CREATE TABLE `purchase_order_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_order_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` int(11) NOT NULL,
  `quantity_factor` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `percentage_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,
  `percentage_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  PRIMARY KEY (`id`),
  KEY `purchase_order_items_purchase_order_id_foreign` (`purchase_order_id`),
  KEY `purchase_order_items_item_id_foreign` (`item_id`),
  KEY `purchase_order_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `purchase_order_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `purchase_order_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `purchase_order_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `purchase_order_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `purchase_order_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `purchase_order_items_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  CONSTRAINT `purchase_order_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_order_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_order_items` with 0 row(s)
--

--
-- Table structure for table `purchase_payments`
--

CREATE TABLE `purchase_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_payments_purchase_id_foreign` (`purchase_id`),
  KEY `purchase_payments_card_brand_id_foreign` (`card_brand_id`),
  KEY `purchase_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `purchase_payments_date_of_payment_index` (`date_of_payment`),
  CONSTRAINT `purchase_payments_card_brand_id_foreign` FOREIGN KEY (`card_brand_id`) REFERENCES `card_brands` (`id`),
  CONSTRAINT `purchase_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `purchase_payments_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_payments` with 0 row(s)
--

--
-- Table structure for table `purchase_quotations`
--

CREATE TABLE `purchase_quotations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `suppliers` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`suppliers`)),
  `filename` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_quotations_user_id_foreign` (`user_id`),
  KEY `purchase_quotations_establishment_id_foreign` (`establishment_id`),
  KEY `purchase_quotations_soap_type_id_foreign` (`soap_type_id`),
  KEY `purchase_quotations_state_type_id_foreign` (`state_type_id`),
  CONSTRAINT `purchase_quotations_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `purchase_quotations_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `purchase_quotations_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `purchase_quotations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_quotations`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_quotations` with 0 row(s)
--

--
-- Table structure for table `purchase_quotation_items`
--

CREATE TABLE `purchase_quotation_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_quotation_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_quotation_items_purchase_quotation_id_foreign` (`purchase_quotation_id`),
  KEY `purchase_quotation_items_item_id_foreign` (`item_id`),
  CONSTRAINT `purchase_quotation_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `purchase_quotation_items_purchase_quotation_id_foreign` FOREIGN KEY (`purchase_quotation_id`) REFERENCES `purchase_quotations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_quotation_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_quotation_items` with 0 row(s)
--

--
-- Table structure for table `purchase_settlements`
--

CREATE TABLE `purchase_settlements` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `ubl_version` varchar(255) NOT NULL,
  `operation_type_id` varchar(255) NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `operation_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`operation_data`)),
  `currency_type_id` varchar(255) NOT NULL,
  `payment_method_type_id` char(2) DEFAULT NULL,
  `exchange_rate_sale` decimal(12,2) NOT NULL,
  `total_prepayment` 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_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,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`prepayments`)),
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`related`)),
  `observations` text DEFAULT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `hash` varchar(255) 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,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchase_settlements_filename_unique` (`filename`),
  KEY `purchase_settlements_user_id_foreign` (`user_id`),
  KEY `purchase_settlements_establishment_id_foreign` (`establishment_id`),
  KEY `purchase_settlements_supplier_id_foreign` (`supplier_id`),
  KEY `purchase_settlements_soap_type_id_foreign` (`soap_type_id`),
  KEY `purchase_settlements_state_type_id_foreign` (`state_type_id`),
  KEY `purchase_settlements_document_type_id_foreign` (`document_type_id`),
  KEY `purchase_settlements_currency_type_id_foreign` (`currency_type_id`),
  KEY `purchase_settlements_operation_type_id_foreign` (`operation_type_id`),
  KEY `purchase_settlements_series_index` (`series`),
  KEY `purchase_settlements_number_index` (`number`),
  KEY `purchase_settlements_date_of_issue_index` (`date_of_issue`),
  KEY `purchase_settlements_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `purchase_settlements_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `purchase_settlements_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `purchase_settlements_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `purchase_settlements_operation_type_id_foreign` FOREIGN KEY (`operation_type_id`) REFERENCES `cat_operation_types` (`id`),
  CONSTRAINT `purchase_settlements_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `purchase_settlements_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `purchase_settlements_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `purchase_settlements_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `purchase_settlements_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_settlements`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_settlements` with 0 row(s)
--

--
-- Table structure for table `purchase_settlement_items`
--

CREATE TABLE `purchase_settlement_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_settlement_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,2) NOT NULL,
  `unit_value` decimal(12,2) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(12,2) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `income_tax_affectation_igv_type_id` varchar(255) DEFAULT NULL,
  `income_retention_percentage` decimal(12,2) NOT NULL DEFAULT 0.00,
  `income_retention_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`id`),
  KEY `purchase_settlement_items_purchase_settlement_id_foreign` (`purchase_settlement_id`),
  KEY `purchase_settlement_items_item_id_foreign` (`item_id`),
  KEY `p_s_i_income_tax_affectation_igv_type_id_fk` (`income_tax_affectation_igv_type_id`),
  KEY `purchase_settlement_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `purchase_settlement_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `p_s_i_income_tax_affectation_igv_type_id_fk` FOREIGN KEY (`income_tax_affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `purchase_settlement_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `purchase_settlement_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `purchase_settlement_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `purchase_settlement_items_purchase_settlement_id_foreign` FOREIGN KEY (`purchase_settlement_id`) REFERENCES `purchase_settlements` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_settlement_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_settlement_items` with 0 row(s)
--

--
-- Table structure for table `purchase_settlement_payments`
--

CREATE TABLE `purchase_settlement_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_settlement_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `change` decimal(12,2) NOT NULL DEFAULT 0.00,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_settlement_payments_purchase_settlement_id_foreign` (`purchase_settlement_id`),
  KEY `purchase_settlement_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `purchase_settlement_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `purchase_settlement_payments_purchase_settlement_id_foreign` FOREIGN KEY (`purchase_settlement_id`) REFERENCES `purchase_settlements` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_settlement_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_settlement_payments` with 0 row(s)
--

--
-- Table structure for table `quotations`
--

CREATE TABLE `quotations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `seller_id` int(10) unsigned DEFAULT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(3) NOT NULL,
  `document_type_id` char(2) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `date_of_due` varchar(255) DEFAULT NULL,
  `delivery_date` varchar(255) DEFAULT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `shipping_address` text DEFAULT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `payment_method_type_id` char(2) DEFAULT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `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_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,
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `filename` varchar(255) DEFAULT NULL,
  `terms_condition` text DEFAULT NULL,
  `referential_information` varchar(100) DEFAULT NULL,
  `account_number` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `contact` varchar(255) DEFAULT NULL,
  `changed` tinyint(1) NOT NULL DEFAULT 0,
  `sale_opportunity_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `description` varchar(1000) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `quotations_series_number_unique` (`soap_type_id`,`series`,`number`),
  KEY `quotations_user_id_foreign` (`user_id`),
  KEY `quotations_establishment_id_foreign` (`establishment_id`),
  KEY `quotations_customer_id_foreign` (`customer_id`),
  KEY `quotations_state_type_id_foreign` (`state_type_id`),
  KEY `quotations_currency_type_id_foreign` (`currency_type_id`),
  KEY `quotations_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `quotations_sale_opportunity_id_foreign` (`sale_opportunity_id`),
  CONSTRAINT `quotations_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `quotations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `quotations_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `quotations_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `quotations_sale_opportunity_id_foreign` FOREIGN KEY (`sale_opportunity_id`) REFERENCES `sale_opportunities` (`id`),
  CONSTRAINT `quotations_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `quotations_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `quotations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotations`
--

SET autocommit=0;
COMMIT;

-- Dumped table `quotations` with 0 row(s)
--

--
-- Table structure for table `quotation_items`
--

CREATE TABLE `quotation_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `quotation_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `quantity_factor` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `percentage_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,
  `percentage_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `additional_information` longtext DEFAULT NULL COMMENT 'Informacion adicional',
  `warehouse_id` int(10) unsigned DEFAULT 0 COMMENT 'Id de warehouse',
  `name_product_pdf` longtext DEFAULT NULL COMMENT 'Nombre de producto en el pdf',
  PRIMARY KEY (`id`),
  KEY `quotation_items_quotation_id_foreign` (`quotation_id`),
  KEY `quotation_items_item_id_foreign` (`item_id`),
  KEY `quotation_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `quotation_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `quotation_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `quotation_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `quotation_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `quotation_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `quotation_items_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `quotation_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotation_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `quotation_items` with 0 row(s)
--

--
-- Table structure for table `quotation_payments`
--

CREATE TABLE `quotation_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `quotation_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `change` decimal(12,2) DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `quotation_payments_quotation_id_foreign` (`quotation_id`),
  KEY `quotation_payments_card_brand_id_foreign` (`card_brand_id`),
  KEY `quotation_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `quotation_payments_card_brand_id_foreign` FOREIGN KEY (`card_brand_id`) REFERENCES `card_brands` (`id`),
  CONSTRAINT `quotation_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `quotation_payments_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotation_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `quotation_payments` with 0 row(s)
--

--
-- Table structure for table `rel_user_to_documentary_offices`
--

CREATE TABLE `rel_user_to_documentary_offices` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `active` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'usuario asociado',
  `documentary_office_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'etapa asociada',
  `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 `rel_user_to_documentary_offices`
--

SET autocommit=0;
COMMIT;

-- Dumped table `rel_user_to_documentary_offices` with 0 row(s)
--

--
-- Table structure for table `report_configurations`
--

CREATE TABLE `report_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `route_name` varchar(255) NOT NULL,
  `route_path` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `convert_pen` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `report_configurations_route_name_unique` (`route_name`),
  UNIQUE KEY `report_configurations_route_path_unique` (`route_path`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `report_configurations`
--

SET autocommit=0;
INSERT INTO `report_configurations` VALUES (1,'tenant.reports.general_items.index','reports/general-items','Ventas - Reporte general de productos',1,'2024-11-24 16:57:46','2024-12-06 01:59:58'),(2,'tenant.reports.purchases.general_items.index','reports/purchases/general_items','Compras - Reporte general de productos',1,'2024-11-24 16:57:46','2024-12-06 01:59:59'),(3,'tenant.reports.purchases.index','reports/purchases','Compras - Compras totales',1,'2024-11-24 16:57:46','2024-12-06 02:00:01');
COMMIT;

-- Dumped table `report_configurations` with 3 row(s)
--

--
-- Table structure for table `restaurant_configurations`
--

CREATE TABLE `restaurant_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `menu_pos` tinyint(1) NOT NULL,
  `menu_order` tinyint(1) NOT NULL,
  `menu_tables` tinyint(1) NOT NULL,
  `first_menu` varchar(255) NOT NULL,
  `tables_quantity` int(11) NOT NULL DEFAULT 15,
  `menu_bar` tinyint(1) NOT NULL DEFAULT 1,
  `menu_kitchen` tinyint(1) NOT NULL DEFAULT 1,
  `items_maintenance` tinyint(1) NOT NULL DEFAULT 0,
  `enabled_environment_1` tinyint(1) NOT NULL DEFAULT 1,
  `enabled_environment_2` tinyint(1) NOT NULL DEFAULT 0,
  `tables_quantity_environment_2` int(11) NOT NULL DEFAULT 5,
  `enabled_environment_3` tinyint(1) NOT NULL DEFAULT 0,
  `tables_quantity_environment_3` int(11) NOT NULL DEFAULT 5,
  `enabled_environment_4` tinyint(1) NOT NULL DEFAULT 0,
  `tables_quantity_environment_4` int(11) NOT NULL DEFAULT 5,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `restaurant_configurations`
--

SET autocommit=0;
INSERT INTO `restaurant_configurations` VALUES (1,1,1,1,'POS',15,1,1,0,1,0,5,0,5,0,5);
COMMIT;

-- Dumped table `restaurant_configurations` with 1 row(s)
--

--
-- Table structure for table `restaurant_notes`
--

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

--
-- Dumping data for table `restaurant_notes`
--

SET autocommit=0;
COMMIT;

-- Dumped table `restaurant_notes` with 0 row(s)
--

--
-- Table structure for table `restaurant_roles`
--

CREATE TABLE `restaurant_roles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `restaurant_roles`
--

SET autocommit=0;
INSERT INTO `restaurant_roles` VALUES (1,'MOZO','Mozo','Usuario que genera pedidos en mesas',NULL,NULL),(2,'CAJA','Caja','Usuario que genera pago de pedidos',NULL,NULL),(3,'ADM','Administrador','Usuario con permisos totales',NULL,NULL),(6,'KITBAR','Cocina/Bar','Usuario con acceso a cocina y bar',NULL,NULL);
COMMIT;

-- Dumped table `restaurant_roles` with 4 row(s)
--

--
-- Table structure for table `restaurant_tables`
--

CREATE TABLE `restaurant_tables` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `status` varchar(255) NOT NULL,
  `products` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`products`)),
  `total` decimal(12,2) NOT NULL,
  `personas` int(11) NOT NULL,
  `cliente` varchar(255) DEFAULT NULL,
  `comentarios` varchar(255) DEFAULT NULL,
  `label` varchar(255) NOT NULL,
  `shape` varchar(255) NOT NULL,
  `environment` varchar(255) NOT NULL,
  `waiter` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `restaurant_tables`
--

SET autocommit=0;
COMMIT;

-- Dumped table `restaurant_tables` with 0 row(s)
--

--
-- Table structure for table `restaurant_table_envs`
--

CREATE TABLE `restaurant_table_envs` (
  `id` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `active` tinyint(1) NOT NULL,
  `tables_quantity` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `restaurant_table_envs`
--

SET autocommit=0;
INSERT INTO `restaurant_table_envs` VALUES (1,'Ambiente 1',1,25),(2,'Ambiente 2',1,25),(3,'Ambiente 3',1,25),(4,'Ambiente 4',1,25);
COMMIT;

-- Dumped table `restaurant_table_envs` with 4 row(s)
--

--
-- Table structure for table `retentions`
--

CREATE TABLE `retentions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `ubl_version` varchar(255) NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` char(4) NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `retention_type_id` varchar(255) NOT NULL,
  `observations` text DEFAULT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `total_retention` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `optional` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`optional`)),
  `filename` varchar(255) DEFAULT NULL,
  `hash` varchar(255) DEFAULT NULL,
  `soap_shipping_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`soap_shipping_response`)),
  `has_xml` tinyint(1) NOT NULL DEFAULT 0,
  `has_pdf` tinyint(1) NOT NULL DEFAULT 0,
  `has_cdr` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `retentions_user_id_foreign` (`user_id`),
  KEY `retentions_establishment_id_foreign` (`establishment_id`),
  KEY `retentions_soap_type_id_foreign` (`soap_type_id`),
  KEY `retentions_state_type_id_foreign` (`state_type_id`),
  KEY `retentions_document_type_id_foreign` (`document_type_id`),
  KEY `retentions_supplier_id_foreign` (`supplier_id`),
  KEY `retentions_retention_type_id_foreign` (`retention_type_id`),
  KEY `retentions_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `retentions_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `retentions_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `retentions_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `retentions_retention_type_id_foreign` FOREIGN KEY (`retention_type_id`) REFERENCES `cat_retention_types` (`id`),
  CONSTRAINT `retentions_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `retentions_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `retentions_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `retentions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `retentions`
--

SET autocommit=0;
COMMIT;

-- Dumped table `retentions` with 0 row(s)
--

--
-- Table structure for table `retention_documents`
--

CREATE TABLE `retention_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `retention_id` int(10) unsigned NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `currency_type_id` varchar(255) NOT NULL,
  `total_document` decimal(10,2) NOT NULL,
  `payments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`payments`)),
  `exchange_rate` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`exchange_rate`)),
  `date_of_retention` date NOT NULL,
  `total_retention` decimal(10,2) NOT NULL,
  `total_to_pay` decimal(10,2) NOT NULL,
  `total_payment` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `retention_documents_retention_id_foreign` (`retention_id`),
  KEY `retention_documents_document_type_id_foreign` (`document_type_id`),
  KEY `retention_documents_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `retention_documents_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `retention_documents_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `retention_documents_retention_id_foreign` FOREIGN KEY (`retention_id`) REFERENCES `retentions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `retention_documents`
--

SET autocommit=0;
COMMIT;

-- Dumped table `retention_documents` with 0 row(s)
--

--
-- Table structure for table `sale_notes`
--

CREATE TABLE `sale_notes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(2) NOT NULL,
  `document_type_id` char(2) NOT NULL,
  `series` varchar(255) DEFAULT NULL,
  `number` int(11) DEFAULT 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) NOT NULL,
  `payment_method_type_id` char(2) DEFAULT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `point_system` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indica si 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`)),
  `created_from_pos` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indica si se registro desde pos',
  `apply_concurrency` tinyint(1) NOT NULL DEFAULT 0,
  `enabled_concurrency` tinyint(1) NOT NULL DEFAULT 0,
  `automatic_date_of_issue` date DEFAULT NULL,
  `quantity_period` int(11) DEFAULT NULL,
  `type_period` varchar(255) DEFAULT NULL,
  `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,
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `additional_information` text DEFAULT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `unique_filename` varchar(255) DEFAULT NULL,
  `quotation_id` int(10) unsigned DEFAULT NULL,
  `order_note_id` int(10) unsigned DEFAULT NULL,
  `technical_service_id` int(10) unsigned DEFAULT NULL,
  `order_id` int(10) unsigned DEFAULT NULL,
  `total_canceled` tinyint(1) NOT NULL DEFAULT 0,
  `changed` tinyint(1) NOT NULL DEFAULT 0,
  `paid` tinyint(1) NOT NULL DEFAULT 0,
  `license_plate` varchar(255) DEFAULT NULL,
  `plate_number` varchar(255) DEFAULT NULL,
  `reference_data` varchar(500) DEFAULT NULL,
  `agent_id` int(10) unsigned DEFAULT NULL,
  `observation` text DEFAULT NULL,
  `purchase_order` varchar(50) DEFAULT NULL,
  `document_id` int(10) unsigned DEFAULT NULL,
  `user_rel_subscription_plan_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con suscripciones',
  `due_date` date DEFAULT NULL COMMENT 'Fecha de vencimiento',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `seller_id` int(10) unsigned DEFAULT 0,
  `grade` text DEFAULT NULL COMMENT 'Grado designado - utilizado en matricula',
  `section` text DEFAULT NULL COMMENT 'Seccion designado - utilizado en matricula',
  `terms_condition` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sale_notes_unique_filename_unique` (`unique_filename`),
  UNIQUE KEY `sale_notes_series_number_unique` (`soap_type_id`,`series`,`number`),
  KEY `sale_notes_user_id_foreign` (`user_id`),
  KEY `sale_notes_establishment_id_foreign` (`establishment_id`),
  KEY `sale_notes_customer_id_foreign` (`customer_id`),
  KEY `sale_notes_state_type_id_foreign` (`state_type_id`),
  KEY `sale_notes_currency_type_id_foreign` (`currency_type_id`),
  KEY `sale_notes_quotation_id_foreign` (`quotation_id`),
  KEY `sale_notes_apply_concurrency_index` (`apply_concurrency`),
  KEY `sale_notes_type_period_index` (`type_period`),
  KEY `sale_notes_quantity_period_index` (`quantity_period`),
  KEY `sale_notes_automatic_date_of_issue_index` (`automatic_date_of_issue`),
  KEY `sale_notes_enabled_concurrency_index` (`enabled_concurrency`),
  KEY `sale_notes_order_note_id_foreign` (`order_note_id`),
  KEY `sale_notes_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `sale_notes_order_id_foreign` (`order_id`),
  KEY `sale_notes_technical_service_id_foreign` (`technical_service_id`),
  KEY `sale_notes_agent_id_foreign` (`agent_id`),
  KEY `sale_notes_changed_index` (`changed`),
  CONSTRAINT `sale_notes_agent_id_foreign` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`),
  CONSTRAINT `sale_notes_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `sale_notes_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `sale_notes_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `sale_notes_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
  CONSTRAINT `sale_notes_order_note_id_foreign` FOREIGN KEY (`order_note_id`) REFERENCES `order_notes` (`id`),
  CONSTRAINT `sale_notes_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `sale_notes_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `sale_notes_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `sale_notes_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `sale_notes_technical_service_id_foreign` FOREIGN KEY (`technical_service_id`) REFERENCES `technical_services` (`id`),
  CONSTRAINT `sale_notes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_notes`
--

SET autocommit=0;
INSERT INTO `sale_notes` VALUES (1,1,'ad9047fa-02a1-4df3-ad55-bcb95c08c593',1,'{\"code\": \"0000\", \"logo\": null, \"email\": \"fernandeznilver830@gmail.com\", \"address\": \"-\", \"country\": {\"id\": \"PE\", \"description\": \"PERU\"}, \"district\": {\"id\": \"150101\", \"description\": \"Lima\"}, \"province\": {\"id\": \"1501\", \"description\": \"Lima\"}, \"telephone\": \"-\", \"country_id\": \"PE\", \"department\": {\"id\": \"15\", \"description\": \"LIMA\"}, \"district_id\": \"150101\", \"province_id\": \"1501\", \"web_address\": null, \"urbanization\": null, \"department_id\": \"15\", \"trade_address\": null, \"aditional_information\": null}','01','11','NV','80','NV01',1,'2024-11-24','18:56:36',2,'{\"name\": \"Nilver Fernández\", \"email\": \"nilver@gmail.com\", \"number\": \"74468928\", \"address\": \"Chota\", \"country\": {\"id\": \"PE\", \"description\": \"PERU\"}, \"district\": {\"id\": \"150101\", \"description\": \"Lima\"}, \"province\": {\"id\": \"1501\", \"description\": \"Lima\"}, \"telephone\": \"952133840\", \"address_id\": null, \"country_id\": \"PE\", \"department\": {\"id\": \"15\", \"description\": \"LIMA\"}, \"trade_name\": null, \"district_id\": \"150101\", \"province_id\": \"1501\", \"address_type\": {\"id\": null, \"description\": null}, \"department_id\": \"15\", \"internal_code\": null, \"address_type_id\": null, \"perception_agent\": false, \"identity_document_type\": {\"id\": \"1\", \"description\": \"DNI\"}, \"identity_document_type_id\": \"1\"}','PEN',NULL,1.000,0,NULL,0,0,0,NULL,0,NULL,0.00,0.00,0.00,0.00,0.00,64.41,0.00,0.00,11.59,0.00,0.00,0.00,0.00,0.00,0.00,11.59,64.41,0.00,76.00,0,'[]','[]',NULL,'[]',NULL,NULL,NULL,NULL,'','NV01-1-20241124','NV01-1-20241124',NULL,NULL,NULL,3,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'2024-11-24 18:59:20','2024-12-04 17:24:52',1,NULL,NULL,NULL);
COMMIT;

-- Dumped table `sale_notes` with 1 row(s)
--

--
-- Table structure for table `sale_note_items`
--

CREATE TABLE `sale_note_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_note_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `quantity_factor` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `percentage_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,
  `percentage_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,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `additional_information` text DEFAULT NULL,
  `inventory_kardex_id` int(10) unsigned DEFAULT NULL,
  `warehouse_id` int(10) unsigned DEFAULT NULL,
  `name_product_pdf` longtext DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_note_items_sale_note_id_foreign` (`sale_note_id`),
  KEY `sale_note_items_item_id_foreign` (`item_id`),
  KEY `sale_note_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `sale_note_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `sale_note_items_price_type_id_foreign` (`price_type_id`),
  KEY `sale_note_items_inventory_kardex_id_foreign` (`inventory_kardex_id`),
  KEY `sale_note_items_warehouse_id_foreign` (`warehouse_id`),
  CONSTRAINT `sale_note_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `sale_note_items_inventory_kardex_id_foreign` FOREIGN KEY (`inventory_kardex_id`) REFERENCES `inventory_kardex` (`id`),
  CONSTRAINT `sale_note_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `sale_note_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `sale_note_items_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `sale_note_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`),
  CONSTRAINT `sale_note_items_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_note_items`
--

SET autocommit=0;
INSERT INTO `sale_note_items` VALUES (1,1,1,'{\"id\": 1, \"lots\": [], \"name\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo.\", \"tags\": [], \"brand\": null, \"extra\": {\"colors\": null, \"CatItemSize\": null, \"CatItemStatus\": null, \"CatItemMoldCavity\": null, \"CatItemMoldProperty\": null, \"CatItemUnitBusiness\": null, \"CatItemProductFamily\": null, \"CatItemUnitsPerPackage\": null, \"CatItemPackageMeasurement\": null}, \"model\": \"Bolsa\", \"stock\": \"15.0000\", \"active\": true, \"colors\": [], \"is_set\": false, \"barcode\": \"0001\", \"has_igv\": true, \"has_isc\": false, \"tags_id\": [], \"category\": null, \"lot_code\": null, \"sanitary\": null, \"supplies\": [], \"image_url\": \"https://fuxion.nilverfernandez.com/storage/uploads/items/0001-20241124182846.jpeg\", \"item_code\": null, \"name_disa\": null, \"stock_min\": \"3.00\", \"attributes\": [], \"created_at\": \"2024-11-24 18:28:46\", \"laboratory\": null, \"lots_group\": [], \"updated_at\": \"2024-11-24 18:29:42\", \"warehouses\": [{\"stock\": \"15.0000\", \"checked\": true, \"warehouse_id\": 1, \"warehouse_description\": \"Almacén Oficina Principal\"}], \"CatItemSize\": [], \"apply_store\": true, \"cod_digemid\": null, \"date_of_due\": \"2026-05-13T05:00:00.000000Z\", \"description\": \"PRUNEX1\", \"internal_id\": \"0001\", \"second_name\": \"Purgante Fuxion\", \"text_filter\": \"MIX DE FIBRAS (PSYLLIUM, INULINA DE ACHICORIA, MUCÍLAGO DE LINAZA) + GUINDÓN EN POLVO + KELP + ANÍS ESTRELLA  Té herbal a base de mix de fibras solubles y extracto de guindón, los cuales representan una alternativa eficaz en casos de molestias por tránsito intestinal lento que retrasan la respuesta saludable de tu organismo. Purgante Fuxion PRUNEX1 Bolsa 0001 0001\", \"factory_code\": null, \"lots_enabled\": false, \"unit_type_id\": \"NIU\", \"warehouse_id\": null, \"CatItemStatus\": [], \"item_code_gs1\": null, \"IdLoteSelected\": null, \"percentage_isc\": \"0.00\", \"series_enabled\": false, \"stock_by_extra\": {\"total\": null, \"colors\": {\"total\": null, \"detailed\": []}, \"CatItemSize\": {\"total\": null, \"detailed\": []}, \"CatItemStatus\": {\"total\": null, \"detailed\": []}, \"CatItemMoldCavity\": {\"total\": null, \"detailed\": []}, \"CatItemMoldProperty\": {\"total\": null, \"detailed\": []}, \"CatItemUnitBusiness\": {\"total\": null, \"detailed\": []}, \"CatItemProductFamily\": {\"total\": null, \"detailed\": []}, \"CatItemUnitsPerPackage\": {\"total\": null, \"detailed\": []}, \"CatItemPackageMeasurement\": {\"total\": null, \"detailed\": []}}, \"unit_type_text\": \"Unidades\", \"exchange_points\": false, \"image_url_small\": \"https://fuxion.nilverfernandez.com/storage/uploads/items/0001-20241124182846_small.jpeg\", \"item_unit_types\": [], \"sale_unit_price\": 76, \"apply_restaurant\": false, \"currency_type_id\": \"PEN\", \"full_description\": \"0001 - PRUNEX1 -\", \"image_url_medium\": \"https://fuxion.nilverfernandez.com/storage/uploads/items/0001-20241124182846_medium.jpeg\", \"name_product_pdf\": \"<p>PRUNEX1</p>\", \"purchase_has_igv\": true, \"CatItemMoldCavity\": [], \"is_for_production\": false, \"restrict_sale_cpe\": false, \"calculate_quantity\": false, \"quantity_of_points\": 0, \"system_isc_type_id\": null, \"CatItemMoldProperty\": [], \"CatItemUnitBusiness\": [], \"exportable_pharmacy\": false, \"has_igv_description\": \"Si\", \"purchase_unit_price\": 45.6, \"purchase_unit_value\": 38.6440678, \"CatItemProductFamily\": [], \"category_description\": null, \"currency_type_symbol\": \"S/\", \"exchanged_for_points\": false, \"has_plastic_bag_taxes\": false, \"item_warehouse_prices\": [{\"id\": 1, \"price\": 76, \"item_id\": 1, \"description\": \"Almacén Oficina Principal\", \"warehouse_id\": 1}], \"original_unit_type_id\": \"NIU\", \"subject_to_detraction\": false, \"warehouse_description\": \"Almacén Oficina Principal\", \"CatItemUnitsPerPackage\": [], \"amount_sale_unit_price\": 76, \"amount_plastic_bag_taxes\": \"0.10\", \"sale_unit_price_with_igv\": \"S/ 76.00\", \"used_points_for_exchange\": null, \"CatItemPackageMeasurement\": [], \"sale_affectation_igv_type\": {\"id\": \"10\", \"free\": 0, \"active\": 1, \"description\": \"Gravado - Operación Onerosa\", \"exportation\": 0}, \"change_free_affectation_igv\": false, \"purchase_has_igv_description\": \"Si\", \"sale_affectation_igv_type_id\": \"10\", \"original_affectation_igv_type_id\": \"10\", \"purchase_affectation_igv_type_id\": \"10\"}',1.0000,1.0000,64.406780,'10',64.41,18.00,11.59,NULL,0.00,0.00,0.00,0.00,0.00,0.00,0.00,11.59,'01',76.000000,64.41,0.00,0.00,76.00,'[]','[]','[]',NULL,2,NULL,NULL);
COMMIT;

-- Dumped table `sale_note_items` with 1 row(s)
--

--
-- Table structure for table `sale_note_migration`
--

CREATE TABLE `sale_note_migration` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_notes_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `success` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `url` varchar(255) NOT NULL,
  `remote_id` int(10) unsigned NOT NULL DEFAULT 0,
  `number` varchar(255) DEFAULT NULL,
  `data` longtext DEFAULT NULL,
  `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 `sale_note_migration`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_note_migration` with 0 row(s)
--

--
-- Table structure for table `sale_note_payments`
--

CREATE TABLE `sale_note_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_note_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `change` decimal(12,2) DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_note_payments_sale_note_id_foreign` (`sale_note_id`),
  KEY `sale_note_payments_card_brand_id_foreign` (`card_brand_id`),
  KEY `sale_note_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `sale_note_payments_date_of_payment_index` (`date_of_payment`),
  CONSTRAINT `sale_note_payments_card_brand_id_foreign` FOREIGN KEY (`card_brand_id`) REFERENCES `card_brands` (`id`),
  CONSTRAINT `sale_note_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `sale_note_payments_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_note_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_note_payments` with 0 row(s)
--

--
-- Table structure for table `sale_opportunities`
--

CREATE TABLE `sale_opportunities` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) 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) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` varchar(255) 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) NOT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `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_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `detail` text DEFAULT NULL,
  `observation` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_opportunities_user_id_foreign` (`user_id`),
  KEY `sale_opportunities_establishment_id_foreign` (`establishment_id`),
  KEY `sale_opportunities_customer_id_foreign` (`customer_id`),
  KEY `sale_opportunities_soap_type_id_foreign` (`soap_type_id`),
  KEY `sale_opportunities_state_type_id_foreign` (`state_type_id`),
  KEY `sale_opportunities_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `sale_opportunities_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `sale_opportunities_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `sale_opportunities_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `sale_opportunities_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `sale_opportunities_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `sale_opportunities_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_opportunities`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_opportunities` with 0 row(s)
--

--
-- Table structure for table `sale_opportunity_files`
--

CREATE TABLE `sale_opportunity_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_opportunity_id` int(10) unsigned NOT NULL,
  `filename` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_opportunity_files_sale_opportunity_id_foreign` (`sale_opportunity_id`),
  CONSTRAINT `sale_opportunity_files_sale_opportunity_id_foreign` FOREIGN KEY (`sale_opportunity_id`) REFERENCES `sale_opportunities` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_opportunity_files`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_opportunity_files` with 0 row(s)
--

--
-- Table structure for table `sale_opportunity_items`
--

CREATE TABLE `sale_opportunity_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_opportunity_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) NOT NULL,
  `total_base_igv` decimal(12,2) NOT NULL,
  `percentage_igv` decimal(12,2) NOT NULL,
  `total_igv` decimal(12,2) NOT NULL,
  `total_taxes` decimal(12,2) NOT NULL,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  PRIMARY KEY (`id`),
  KEY `sale_opportunity_items_sale_opportunity_id_foreign` (`sale_opportunity_id`),
  KEY `sale_opportunity_items_item_id_foreign` (`item_id`),
  KEY `sale_opportunity_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `sale_opportunity_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `sale_opportunity_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `sale_opportunity_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `sale_opportunity_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `sale_opportunity_items_sale_opportunity_id_foreign` FOREIGN KEY (`sale_opportunity_id`) REFERENCES `sale_opportunities` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_opportunity_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_opportunity_items` with 0 row(s)
--

--
-- Table structure for table `series`
--

CREATE TABLE `series` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `establishment_id` int(10) unsigned NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `contingency` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `series_establishment_id_foreign` (`establishment_id`),
  KEY `series_document_type_id_foreign` (`document_type_id`),
  CONSTRAINT `series_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `series_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `series`
--

SET autocommit=0;
INSERT INTO `series` VALUES (1,1,'01','F001',0,NULL,NULL),(2,1,'03','B001',0,NULL,NULL),(3,1,'07','FC01',0,NULL,NULL),(4,1,'07','BC01',0,NULL,NULL),(5,1,'08','FD01',0,NULL,NULL),(6,1,'08','BD01',0,NULL,NULL),(7,1,'20','R001',0,NULL,NULL),(8,1,'09','T001',0,NULL,NULL),(9,1,'40','P001',0,NULL,NULL),(10,1,'80','NV01',0,NULL,NULL),(11,1,'04','L001',0,NULL,NULL),(12,1,'U2','NIA1',0,NULL,NULL),(13,1,'U3','NSA1',0,NULL,NULL),(14,1,'U4','NTA1',0,NULL,NULL);
COMMIT;

-- Dumped table `series` with 14 row(s)
--

--
-- Table structure for table `series_configurations`
--

CREATE TABLE `series_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `series_id` int(10) unsigned NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `series_configurations_series_id_foreign` (`series_id`),
  KEY `series_configurations_series_index` (`series`),
  KEY `series_configurations_number_index` (`number`),
  KEY `series_configurations_document_type_id_foreign` (`document_type_id`),
  CONSTRAINT `series_configurations_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `series_configurations_series_id_foreign` FOREIGN KEY (`series_id`) REFERENCES `series` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `series_configurations`
--

SET autocommit=0;
COMMIT;

-- Dumped table `series_configurations` with 0 row(s)
--

--
-- Table structure for table `skins`
--

CREATE TABLE `skins` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `skins`
--

SET autocommit=0;
INSERT INTO `skins` VALUES (1,'Default','default.css',1,NULL,NULL),(2,'Light','light.css',1,NULL,NULL),(3,'New','new.css',1,NULL,NULL);
COMMIT;

-- Dumped table `skins` with 3 row(s)
--

--
-- Table structure for table `soap_types`
--

CREATE TABLE `soap_types` (
  `id` char(2) NOT NULL,
  `description` varchar(255) NOT NULL,
  KEY `soap_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `soap_types`
--

SET autocommit=0;
INSERT INTO `soap_types` VALUES ('01','Demo'),('02','Producción'),('03','Interno');
COMMIT;

-- Dumped table `soap_types` with 3 row(s)
--

--
-- Table structure for table `state_types`
--

CREATE TABLE `state_types` (
  `id` char(2) NOT NULL,
  `description` varchar(255) NOT NULL,
  KEY `state_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `state_types`
--

SET autocommit=0;
INSERT INTO `state_types` VALUES ('01','Registrado'),('03','Enviado'),('05','Aceptado'),('07','Observado'),('09','Rechazado'),('11','Anulado'),('13','Por anular');
COMMIT;

-- Dumped table `state_types` with 7 row(s)
--

--
-- Table structure for table `status_orders`
--

CREATE TABLE `status_orders` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(30) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `status_orders`
--

SET autocommit=0;
INSERT INTO `status_orders` VALUES (1,'Pago sin verificar','2024-11-24 16:57:35',NULL),(2,'Pago verificado','2024-11-24 16:57:35',NULL),(3,'Despachado','2024-11-24 16:57:35',NULL),(4,'Confirmado por el cliente','2024-11-24 16:57:35',NULL);
COMMIT;

-- Dumped table `status_orders` with 4 row(s)
--

--
-- Table structure for table `subscription_grade`
--

CREATE TABLE `subscription_grade` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subscription_grade`
--

SET autocommit=0;
INSERT INTO `subscription_grade` VALUES (1,'1er'),(2,'2do'),(3,'3ro'),(4,'4to'),(5,'5to'),(6,'6to'),(7,'7mo'),(8,'8vo');
COMMIT;

-- Dumped table `subscription_grade` with 8 row(s)
--

--
-- Table structure for table `subscription_plans`
--

CREATE TABLE `subscription_plans` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cat_period_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con el periodo de tiempo',
  `name` text NOT NULL COMMENT 'Nombre del plan',
  `description` longtext NOT NULL COMMENT 'Descripcion del plan',
  `total` double(12,2) DEFAULT 0.00 COMMENT 'El total del costo del plan',
  `currency_type_id` varchar(255) DEFAULT NULL,
  `payment_method_type_id` varchar(255) DEFAULT NULL,
  `quantity_period` int(10) unsigned DEFAULT NULL,
  `exchange_rate_sale` double(13,3) DEFAULT 0.000,
  `total_prepayment` double(12,2) DEFAULT 0.00,
  `total_charge` double(12,2) DEFAULT 0.00,
  `total_discount` double(12,2) DEFAULT 0.00,
  `total_exportation` double(12,2) DEFAULT 0.00,
  `total_free` double(12,2) DEFAULT 0.00,
  `total_taxed` double(12,2) DEFAULT 0.00,
  `total_unaffected` double(12,2) DEFAULT 0.00,
  `total_exonerated` double(12,2) DEFAULT 0.00,
  `total_igv` double(12,2) DEFAULT 0.00,
  `total_igv_free` double(12,2) DEFAULT 0.00,
  `total_base_isc` double(12,2) DEFAULT 0.00,
  `total_isc` double(12,2) DEFAULT 0.00,
  `total_base_other_taxes` double(12,2) DEFAULT 0.00,
  `total_other_taxes` double(12,2) DEFAULT 0.00,
  `total_taxes` double(12,2) DEFAULT 0.00,
  `total_value` double(12,2) DEFAULT 0.00,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `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`)),
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `terms_condition` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subscription_plans`
--

SET autocommit=0;
INSERT INTO `subscription_plans` VALUES (1,1,'Matricula Escolar','Demostración de matricula escolar',1.00,'PEN','01',12,0.000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
COMMIT;

-- Dumped table `subscription_plans` with 1 row(s)
--

--
-- Table structure for table `subscription_section`
--

CREATE TABLE `subscription_section` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subscription_section`
--

SET autocommit=0;
INSERT INTO `subscription_section` VALUES (1,'A'),(2,'B'),(3,'C'),(4,'D'),(5,'E'),(6,'F'),(7,'G'),(8,'H');
COMMIT;

-- Dumped table `subscription_section` with 8 row(s)
--

--
-- Table structure for table `summaries`
--

CREATE TABLE `summaries` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `summary_status_type_id` varchar(255) NOT NULL,
  `ubl_version` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_reference` date NOT NULL,
  `identifier` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `unique_filename` varchar(255) DEFAULT NULL,
  `ticket` varchar(255) DEFAULT NULL,
  `has_ticket` tinyint(1) NOT NULL DEFAULT 0,
  `has_cdr` tinyint(1) NOT NULL DEFAULT 0,
  `soap_shipping_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`soap_shipping_response`)),
  `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`)),
  `unknown_error_status_response` tinyint(1) NOT NULL DEFAULT 0,
  `manually_regularized` tinyint(1) NOT NULL DEFAULT 0,
  `error_manually_regularized` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`error_manually_regularized`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `summaries_unique_filename_unique` (`unique_filename`),
  KEY `summaries_user_id_foreign` (`user_id`),
  KEY `summaries_soap_type_id_foreign` (`soap_type_id`),
  KEY `summaries_state_type_id_foreign` (`state_type_id`),
  KEY `summaries_summary_status_type_id_foreign` (`summary_status_type_id`),
  KEY `summaries_date_of_issue_index` (`date_of_issue`),
  CONSTRAINT `summaries_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `summaries_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `summaries_summary_status_type_id_foreign` FOREIGN KEY (`summary_status_type_id`) REFERENCES `cat_summary_status_types` (`id`),
  CONSTRAINT `summaries_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `summaries`
--

SET autocommit=0;
COMMIT;

-- Dumped table `summaries` with 0 row(s)
--

--
-- Table structure for table `summary_documents`
--

CREATE TABLE `summary_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `summary_id` int(10) unsigned NOT NULL,
  `document_id` int(10) unsigned NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `summary_documents_summary_id_foreign` (`summary_id`),
  KEY `summary_documents_document_id_foreign` (`document_id`),
  CONSTRAINT `summary_documents_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  CONSTRAINT `summary_documents_summary_id_foreign` FOREIGN KEY (`summary_id`) REFERENCES `summaries` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `summary_documents`
--

SET autocommit=0;
COMMIT;

-- Dumped table `summary_documents` with 0 row(s)
--

--
-- Table structure for table `system_activity_logs`
--

CREATE TABLE `system_activity_logs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL,
  `system_activity_log_type_id` varchar(255) DEFAULT NULL,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `origin_id` int(11) DEFAULT NULL,
  `origin_type` varchar(255) DEFAULT NULL,
  `ip` varchar(255) DEFAULT NULL,
  `device_name` varchar(255) DEFAULT NULL,
  `device_type` varchar(255) DEFAULT NULL,
  `platform_name` varchar(255) DEFAULT NULL,
  `platform_version` varchar(255) DEFAULT NULL,
  `browser_name` varchar(255) DEFAULT NULL,
  `browser_version` varchar(255) DEFAULT NULL,
  `request_email` varchar(255) DEFAULT NULL,
  `route` varchar(255) DEFAULT NULL,
  `location` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`location`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payment_index` (`origin_id`,`origin_type`),
  KEY `system_activity_logs_user_id_foreign` (`user_id`),
  KEY `system_activity_logs_auth_transaction_type_index` (`system_activity_log_type_id`),
  KEY `system_activity_logs_date_index` (`date`),
  KEY `system_activity_logs_time_index` (`time`),
  KEY `system_activity_logs_device_type_index` (`device_type`),
  CONSTRAINT `system_activity_logs_system_activity_log_type_id_foreign` FOREIGN KEY (`system_activity_log_type_id`) REFERENCES `system_activity_log_types` (`id`),
  CONSTRAINT `system_activity_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_activity_logs`
--

SET autocommit=0;
INSERT INTO `system_activity_logs` VALUES (1,1,'login','2024-11-24','18:01:32',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 18:01:32','2024-11-24 18:01:32'),(2,2,'login','2024-11-24','18:49:07',2,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 18:49:07','2024-11-24 18:49:07'),(3,2,'login','2024-11-24','18:49:35',2,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 18:49:35','2024-11-24 18:49:35'),(4,3,'login','2024-11-24','18:56:34',3,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','130.0.6723.107',NULL,NULL,NULL,'2024-11-24 18:56:34','2024-11-24 18:56:34'),(5,2,'logout','2024-11-24','19:03:50',2,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 19:03:50','2024-11-24 19:03:50'),(6,1,'login','2024-11-24','19:06:48',1,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 19:06:48','2024-11-24 19:06:48'),(7,2,'login','2024-11-24','19:20:48',2,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 19:20:48','2024-11-24 19:20:48'),(8,2,'login','2024-11-24','19:20:50',2,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 19:20:50','2024-11-24 19:20:50'),(9,2,'login','2024-11-24','19:22:32',2,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-11-24 19:22:32','2024-11-24 19:22:32'),(10,1,'login','2024-12-04','16:32:45',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 16:32:45','2024-12-04 16:32:45'),(11,NULL,'failed','2024-12-04','17:09:54',NULL,NULL,NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 17:09:54','2024-12-04 17:09:54'),(12,1,'login','2024-12-04','17:10:27',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 17:10:27','2024-12-04 17:10:27'),(13,1,'login','2024-12-04','23:27:40',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 23:27:40','2024-12-04 23:27:40'),(14,1,'logout','2024-12-04','23:45:21',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 23:45:21','2024-12-04 23:45:21'),(15,1,'login','2024-12-04','23:57:58',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-04 23:57:58','2024-12-04 23:57:58'),(16,1,'logout','2024-12-05','00:00:20',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-05 00:00:20','2024-12-05 00:00:20'),(17,1,'login','2024-12-05','00:00:53',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-05 00:00:53','2024-12-05 00:00:53'),(18,1,'login','2024-12-06','00:31:03',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 00:31:03','2024-12-06 00:31:03'),(19,1,'logout','2024-12-06','02:04:04',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 02:04:04','2024-12-06 02:04:04'),(20,1,'login','2024-12-06','02:05:51',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 02:05:51','2024-12-06 02:05:51'),(21,1,'logout','2024-12-06','02:08:27',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 02:08:27','2024-12-06 02:08:27'),(22,1,'login','2024-12-06','02:08:52',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 02:08:52','2024-12-06 02:08:52'),(23,1,'logout','2024-12-06','02:10:21',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 02:10:21','2024-12-06 02:10:21'),(24,1,'login','2024-12-06','10:41:22',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 10:41:22','2024-12-06 10:41:22'),(25,1,'logout','2024-12-06','11:50:52',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 11:50:52','2024-12-06 11:50:52'),(26,1,'login','2024-12-06','11:52:20',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 11:52:20','2024-12-06 11:52:20'),(27,1,'login','2024-12-06','12:21:37',1,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 12:21:37','2024-12-06 12:21:37'),(28,2,'login','2024-12-06','12:56:33',2,'Modules\\User\\Models\\User',NULL,'WebKit','phone','AndroidOS','10','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-06 12:56:33','2024-12-06 12:56:33'),(29,2,'login','2024-12-07','22:49:38',2,'Modules\\User\\Models\\User',NULL,'WebKit','desktop','Windows','10.0','Chrome','131.0.0.0',NULL,NULL,NULL,'2024-12-07 22:49:38','2024-12-07 22:49:38'),(30,1,'login','2025-01-29','18:45:36',1,'Modules\\User\\Models\\User','181.176.45.230','WebKit','phone','AndroidOS','10','Chrome','132.0.0.0',NULL,NULL,'{\"country_name\":\"Peru\",\"country_code\":\"PE\",\"region_code\":\"LIM\",\"region_name\":\"Lima region\",\"city_name\":\"San Isidro\",\"latitude\":\"-12.0965\",\"longitude\":\"-77.0426\",\"timezone\":\"America\\/Lima\"}','2025-01-29 18:45:36','2025-01-29 18:45:36');
COMMIT;

-- Dumped table `system_activity_logs` with 30 row(s)
--

--
-- Table structure for table `system_activity_log_types`
--

CREATE TABLE `system_activity_log_types` (
  `id` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_activity_log_types`
--

SET autocommit=0;
INSERT INTO `system_activity_log_types` VALUES ('companies_certificate','Actualización del campo certificado en configuración de empresa'),('companies_name','Actualización del campo nombre en configuración de empresa'),('companies_number','Actualización del campo número en configuración de empresa'),('companies_soap_password','Actualización del campo SOAP Contraseña en configuración de empresa'),('companies_soap_send_id','Actualización del campo SOAP envío en configuración de empresa'),('companies_soap_type_id','Actualización del campo SOAP tipo en configuración de empresa'),('companies_soap_url','Actualización del campo SOAP url envío en configuración de empresa'),('companies_soap_username','Actualización del campo SOAP Usuario en configuración de empresa'),('failed','Error de inicio de sesión'),('level_module_access_error','Error de acceso al submódulo (no tiene permiso)'),('login','Iniciar sesión'),('login_lockout','Bloqueo de usuario por exceder límite de intentos permitidos al iniciar sesión'),('logout','Cerrar sesión'),('module_access_error','Error de acceso al módulo (no tiene permiso)');
COMMIT;

-- Dumped table `system_activity_log_types` with 14 row(s)
--

--
-- Table structure for table `tags`
--

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

--
-- Dumping data for table `tags`
--

SET autocommit=0;
INSERT INTO `tags` VALUES (1,'1.LIMPIA','LIMPIEZA DE ORGANIZMO','2024-12-06 02:00:55','2024-12-06 10:54:50',1),(2,'2. REGENERA','REGENERA','2024-12-06 10:55:12','2024-12-06 10:55:12',1),(3,'3. REVITALIZA','REVITALIZA','2024-12-06 10:55:22','2024-12-06 10:55:22',1),(4,'LÍNEA INMUNOLÓGICA','LÍNEA INMUNOLÓGICA','2024-12-06 10:55:39','2024-12-06 10:55:39',1),(5,'LÍNEA CONTROL DE PESO','LÍNEA CONTROL DE PESO','2024-12-06 10:55:49','2024-12-06 10:55:49',1),(6,'LÍNEA ANTI-EDAD','LÍNEA ANTI-EDAD','2024-12-06 10:55:58','2024-12-06 10:55:58',1),(7,'LÍNEA VIGOR MENTAL','LÍNEA VIGOR MENTAL','2024-12-06 10:56:04','2024-12-06 10:56:04',1),(8,'LÍNEA SPORT','LÍNEA SPORT','2024-12-06 10:56:11','2024-12-06 10:56:11',1),(9,'LÍNEA GASTRONÓMICA','LÍNEA GASTRONÓMICA','2024-12-06 10:56:18','2024-12-06 10:56:18',1),(10,'MERCHANDISING','MERCHANDISING','2024-12-06 10:56:27','2024-12-06 11:25:10',0),(11,'NUEVO MERCHANDISING','NUEVO MERCHANDISING','2024-12-06 10:56:39','2024-12-06 11:25:14',0),(12,'PROMOCIONES','PROMOCIONES','2024-12-06 10:56:46','2024-12-06 10:56:46',1),(13,'COMBOS - INICIA EN GRANDE','COMBOS - INICIA EN GRANDE','2024-12-06 10:56:53','2024-12-06 10:56:53',1);
COMMIT;

-- Dumped table `tags` with 13 row(s)
--

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `class` varchar(255) NOT NULL,
  `execution_time` time NOT NULL,
  `output` longtext DEFAULT NULL,
  `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 `tasks`
--

SET autocommit=0;
COMMIT;

-- Dumped table `tasks` with 0 row(s)
--

--
-- Table structure for table `technical_services`
--

CREATE TABLE `technical_services` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `establishment_id` int(10) unsigned DEFAULT 0,
  `establishment` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`establishment`)),
  `customer_id` int(10) unsigned NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `currency_type_id` text DEFAULT NULL,
  `payment_condition_id` text DEFAULT NULL,
  `payment_method_type_id` text DEFAULT NULL,
  `seller_id` int(10) unsigned DEFAULT 0,
  `exchange_rate_sale` decimal(13,3) DEFAULT 0.000,
  `total_prepayment` decimal(12,2) DEFAULT 0.00,
  `total_charge` decimal(12,2) DEFAULT 0.00,
  `total_discount` decimal(12,2) DEFAULT 0.00,
  `total_exportation` decimal(12,2) DEFAULT 0.00,
  `total_free` decimal(12,2) DEFAULT 0.00,
  `total_taxed` decimal(12,2) DEFAULT 0.00,
  `total_unaffected` decimal(12,2) DEFAULT 0.00,
  `total_exonerated` decimal(12,2) DEFAULT 0.00,
  `total_igv` decimal(12,2) DEFAULT 0.00,
  `total_igv_free` decimal(12,2) DEFAULT 0.00,
  `total_base_isc` decimal(12,2) DEFAULT 0.00,
  `total_isc` decimal(12,2) DEFAULT 0.00,
  `total_base_other_taxes` decimal(12,2) DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) DEFAULT 0.00,
  `total_plastic_bag_taxes` decimal(6,2) DEFAULT 0.00,
  `total_taxes` decimal(12,2) DEFAULT 0.00,
  `total_value` decimal(12,2) DEFAULT 0.00,
  `subtotal` decimal(12,2) DEFAULT 0.00,
  `total` decimal(12,2) DEFAULT 0.00,
  `is_editable` tinyint(3) unsigned DEFAULT 0,
  `cellphone` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `description` text NOT NULL,
  `state` text NOT NULL,
  `reason` text NOT NULL,
  `serial_number` varchar(255) NOT NULL,
  `filename` varchar(255) DEFAULT NULL,
  `cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `prepayment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `activities` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `brand` varchar(255) DEFAULT NULL,
  `equipment` varchar(255) DEFAULT NULL,
  `important_note` text DEFAULT NULL,
  `repair` tinyint(1) NOT NULL DEFAULT 0,
  `warranty` tinyint(1) NOT NULL DEFAULT 0,
  `maintenance` tinyint(1) NOT NULL DEFAULT 0,
  `diagnosis` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `technical_services_user_id_foreign` (`user_id`),
  KEY `technical_services_soap_type_id_foreign` (`soap_type_id`),
  KEY `technical_services_customer_id_foreign` (`customer_id`),
  KEY `technical_services_date_of_issue_index` (`date_of_issue`),
  KEY `technical_services_serial_number_index` (`serial_number`),
  CONSTRAINT `technical_services_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `technical_services_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `technical_services_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `technical_services`
--

SET autocommit=0;
COMMIT;

-- Dumped table `technical_services` with 0 row(s)
--

--
-- Table structure for table `technical_service_items`
--

CREATE TABLE `technical_service_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `technical_services_id` int(10) unsigned DEFAULT 0 COMMENT 'Id de technical_services',
  `item_id` int(10) unsigned DEFAULT 0 COMMENT 'Id de item',
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Json con el contenido de item' CHECK (json_valid(`item`)),
  `quantity` double(12,4) DEFAULT 0.0000 COMMENT 'Cantidad de item usado',
  `unit_value` double(16,6) DEFAULT 0.000000 COMMENT 'unit_value',
  `affectation_igv_type_id` longtext DEFAULT NULL COMMENT 'Tipo de afectacion dde igv. cat_affectation_igv_types',
  `total_base_igv` double(12,2) DEFAULT 0.00 COMMENT 'Monto base del IGV',
  `percentage_igv` double(12,2) DEFAULT 0.00,
  `total_igv` double(12,2) DEFAULT 0.00,
  `system_isc_type_id` longtext DEFAULT NULL,
  `total_base_isc` double(12,2) DEFAULT 0.00,
  `percentage_isc` double(12,2) DEFAULT 0.00,
  `total_isc` double(12,2) DEFAULT 0.00,
  `total_base_other_taxes` double(12,2) DEFAULT 0.00,
  `percentage_other_taxes` double(12,2) DEFAULT 0.00,
  `total_other_taxes` double(12,2) DEFAULT 0.00,
  `total_plastic_bag_taxes` double(6,2) DEFAULT 0.00,
  `total_taxes` double(12,2) DEFAULT 0.00,
  `price_type_id` longtext DEFAULT NULL,
  `unit_price` double(16,6) DEFAULT 0.000000,
  `total_value` double(12,2) DEFAULT 0.00,
  `total_charge` double(12,2) DEFAULT 0.00,
  `total_discount` double(12,2) DEFAULT 0.00,
  `total` double(12,2) DEFAULT 0.00,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Atributos' CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Descuentos' CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Cargos' CHECK (json_valid(`charges`)),
  `additional_information` longtext DEFAULT NULL COMMENT 'Informacion adicional',
  `warehouse_id` int(10) unsigned DEFAULT 0 COMMENT 'Id de item',
  `name_product_pdf` longtext DEFAULT NULL COMMENT 'Nombre de producto en el pdf',
  `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 `technical_service_items`
--

SET autocommit=0;
COMMIT;

-- Dumped table `technical_service_items` with 0 row(s)
--

--
-- Table structure for table `technical_service_payments`
--

CREATE TABLE `technical_service_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `technical_service_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) NOT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `change` decimal(12,2) NOT NULL DEFAULT 0.00,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `technical_service_payments_technical_service_id_foreign` (`technical_service_id`),
  KEY `technical_service_payments_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `technical_service_payments_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `technical_service_payments_technical_service_id_foreign` FOREIGN KEY (`technical_service_id`) REFERENCES `technical_services` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `technical_service_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `technical_service_payments` with 0 row(s)
--

--
-- Table structure for table `tips`
--

CREATE TABLE `tips` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `soap_type_id` char(2) NOT NULL,
  `date` date NOT NULL COMMENT 'Fecha de registro',
  `origin_date_of_issue` date NOT NULL COMMENT 'Fecha del documento origen de la propina',
  `origin_id` int(11) NOT NULL,
  `origin_type` varchar(255) NOT NULL,
  `worker_full_name` varchar(255) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `origin_index` (`origin_id`,`origin_type`),
  KEY `tips_soap_type_id_foreign` (`soap_type_id`),
  KEY `tips_date_index` (`date`),
  KEY `tips_origin_date_of_issue_index` (`origin_date_of_issue`),
  KEY `tips_worker_full_name_index` (`worker_full_name`),
  CONSTRAINT `tips_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tips`
--

SET autocommit=0;
COMMIT;

-- Dumped table `tips` with 0 row(s)
--

--
-- Table structure for table `track_api_peru_services`
--

CREATE TABLE `track_api_peru_services` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `service` int(10) unsigned DEFAULT 0 COMMENT 'Tipo de servicio  1 => sunat/dni, 2 => validacion_multiple_cpe, 3 => CPE, 4 => tipo_de_cambio, 5 => printer_ticket',
  `date_of_issue` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `track_api_peru_services`
--

SET autocommit=0;
COMMIT;

-- Dumped table `track_api_peru_services` with 0 row(s)
--

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `payment_link_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) DEFAULT NULL,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `uuid` char(36) NOT NULL,
  `description` varchar(255) NOT NULL,
  `payment_id` varchar(255) DEFAULT NULL,
  `amount` decimal(16,2) NOT NULL,
  `transaction_state_id` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transactions_uuid_unique` (`uuid`),
  KEY `transactions_payment_link_id_foreign` (`payment_link_id`),
  KEY `transactions_transaction_state_id_foreign` (`transaction_state_id`),
  KEY `transactions_date_index` (`date`),
  KEY `transactions_time_index` (`time`),
  KEY `transactions_description_index` (`description`),
  KEY `transactions_payment_id_index` (`payment_id`),
  KEY `transactions_amount_index` (`amount`),
  KEY `transactions_soap_type_id_foreign` (`soap_type_id`),
  CONSTRAINT `transactions_payment_link_id_foreign` FOREIGN KEY (`payment_link_id`) REFERENCES `payment_links` (`id`),
  CONSTRAINT `transactions_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `transactions_transaction_state_id_foreign` FOREIGN KEY (`transaction_state_id`) REFERENCES `transaction_states` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transactions`
--

SET autocommit=0;
COMMIT;

-- Dumped table `transactions` with 0 row(s)
--

--
-- Table structure for table `transaction_queries`
--

CREATE TABLE `transaction_queries` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`response`)),
  `transaction_id` int(10) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `transaction_queries_transaction_id_foreign` (`transaction_id`),
  CONSTRAINT `transaction_queries_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transaction_queries`
--

SET autocommit=0;
COMMIT;

-- Dumped table `transaction_queries` with 0 row(s)
--

--
-- Table structure for table `transaction_states`
--

CREATE TABLE `transaction_states` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `success` tinyint(1) NOT NULL,
  `status` varchar(255) NOT NULL,
  `status_detail` varchar(255) NOT NULL,
  `original_message` varchar(255) NOT NULL,
  `user_message` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `transaction_states_name_index` (`name`),
  KEY `transaction_states_success_index` (`success`),
  KEY `transaction_states_status_index` (`status`),
  KEY `transaction_states_status_detail_index` (`status_detail`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transaction_states`
--

SET autocommit=0;
INSERT INTO `transaction_states` VALUES ('00','Rechazado (Error desconocido)',0,'other','other','Error desconocido','Lo sentimos, ocurrió un error inesperado.'),('01','Aceptado',1,'approved','accredited','¡Listo! Se acreditó tu pago. En tu resumen verás el cargo de amount como statement_descriptor.','¡Listo! Se acreditó tu pago. En tu resumen verás el cargo del pago.'),('02','En proceso',1,'in_process','pending_contingency','Estamos procesando tu pago. No te preocupes, menos de 2 días hábiles te avisaremos por e-mail si se acreditó.','Estamos procesando tu pago. No te preocupes, en menos de 2 días hábiles te avisaremos por e-mail si se acreditó.'),('03','En proceso',1,'in_process','pending_review_manual','Estamos procesando tu pago. No te preocupes, menos de 2 días hábiles te avisaremos por e-mail si se acreditó o si necesitamos más información.','Estamos procesando tu pago. No te preocupes, en menos de 2 días hábiles te avisaremos por e-mail si se acreditó o si necesitamos más información.'),('04','Rechazado',0,'rejected','cc_rejected_bad_filled_card_number','Revisa el número de tarjeta.','Lo sentimos, ocurrió un inconveniente. Revisa el número de tarjeta.'),('05','Rechazado',0,'rejected','cc_rejected_bad_filled_date','Revisa la fecha de vencimiento.','Lo sentimos, ocurrió un inconveniente. Revisa la fecha de vencimiento.'),('06','Rechazado',0,'rejected','cc_rejected_bad_filled_other','Revisa los datos.','Lo sentimos, ocurrió un inconveniente. Revisa los datos.'),('07','Rechazado',0,'rejected','cc_rejected_bad_filled_security_code','Revisa el código de seguridad de la tarjeta.','Lo sentimos, ocurrió un inconveniente. Revisa el código de seguridad de la tarjeta.'),('08','Rechazado',0,'rejected','cc_rejected_blacklist','No pudimos procesar tu pago.','Lo sentimos, ocurrió un inconveniente. No pudimos procesar tu pago.'),('09','Rechazado',0,'rejected','cc_rejected_call_for_authorize','Debes autorizar ante payment_method_id el pago de amount.','Debes autorizar ante el medio de pago, el pago a realizar.'),('10','Rechazado',0,'rejected','cc_rejected_card_disabled','Llama a payment_method_id para activar tu tarjeta o usa otro medio de pago. El teléfono está al dorso de tu tarjeta.','Llama a la entidad para activar tu tarjeta o usa otro medio de pago. El teléfono está al dorso de tu tarjeta.'),('11','Rechazado',0,'rejected','cc_rejected_card_error','No pudimos procesar tu pago.','Lo sentimos, ocurrió un inconveniente. No pudimos procesar tu pago.'),('12','Rechazado',0,'rejected','cc_rejected_duplicated_payment','Ya hiciste un pago por ese valor. Si necesitas volver a pagar usa otra tarjeta u otro medio de pago.','Ya hiciste un pago por ese valor. Si necesitas volver a pagar usa otra tarjeta u otro medio de pago.'),('13','Rechazado',0,'rejected','cc_rejected_high_risk','Tu pago fue rechazado. Elige otro de los medios de pago, te recomendamos con medios en efectivo.','Tu pago fue rechazado. Elige otro de los medios de pago, te recomendamos con medios en efectivo.'),('14','Rechazado',0,'rejected','cc_rejected_insufficient_amount','Tu payment_method_id no tiene fondos suficientes.','Lo sentimos, ocurrió un inconveniente. Tu medio de pago no tiene fondos suficientes.'),('15','Rechazado',0,'rejected','cc_rejected_invalid_installments','payment_method_id no procesa pagos en installments cuotas.','Para el medio de pago ingresado, no se puede procesar los pagos en la cantidad de cuotas seleccionadas.'),('16','Rechazado',0,'rejected','cc_rejected_max_attempts','Llegaste al límite de intentos permitidos. Elige otra tarjeta u otro medio de pago.','Llegaste al límite de intentos permitidos. Elige otra tarjeta u otro medio de pago.'),('17','Rechazado',0,'rejected','cc_rejected_other_reason','payment_method_id no procesó el pago.','Lo sentimos, ocurrió un inconveniente. El pago no pudo ser procesado por el medio usado');
COMMIT;

-- Dumped table `transaction_states` with 18 row(s)
--

--
-- Table structure for table `transfer_account_payments`
--

CREATE TABLE `transfer_account_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `origin_id` int(10) unsigned DEFAULT 0 COMMENT 'id Cuenta de origen',
  `origin_type` text DEFAULT NULL COMMENT 'Modelo de origen',
  `destiny_id` int(10) unsigned DEFAULT 0 COMMENT 'id Cuenta de destino',
  `destiny_type` text DEFAULT NULL COMMENT 'Modelo de destino',
  `amount` decimal(9,2) DEFAULT 0.00 COMMENT 'Monto a transferir',
  `date_of_movement` datetime DEFAULT NULL COMMENT 'Fecha de movimiento',
  `user_id` int(10) unsigned DEFAULT 0 COMMENT 'Usuario que realiza el movimiento',
  `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 `transfer_account_payments`
--

SET autocommit=0;
COMMIT;

-- Dumped table `transfer_account_payments` with 0 row(s)
--

--
-- Table structure for table `transports`
--

CREATE TABLE `transports` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `plate_number` varchar(50) NOT NULL,
  `model` varchar(255) NOT NULL,
  `brand` varchar(255) NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `is_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 `transports`
--

SET autocommit=0;
COMMIT;

-- Dumped table `transports` with 0 row(s)
--

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `api_token` varchar(255) DEFAULT NULL,
  `establishment_id` int(10) unsigned DEFAULT NULL,
  `type` enum('admin','seller','integrator','client') NOT NULL,
  `permission_force_send_by_summary` tinyint(1) NOT NULL DEFAULT 0,
  `permission_edit_cpe` tinyint(1) NOT NULL DEFAULT 0,
  `permission_edit_sale_note` tinyint(1) NOT NULL DEFAULT 0,
  `create_payment` tinyint(1) NOT NULL DEFAULT 1,
  `delete_purchase` tinyint(1) NOT NULL DEFAULT 1,
  `annular_purchase` tinyint(1) NOT NULL DEFAULT 1,
  `edit_purchase` tinyint(1) NOT NULL DEFAULT 1,
  `delete_payment` tinyint(1) NOT NULL DEFAULT 1,
  `recreate_documents` tinyint(1) NOT NULL DEFAULT 0,
  `locked` tinyint(1) NOT NULL DEFAULT 0,
  `multiple_default_document_types` tinyint(1) NOT NULL DEFAULT 0,
  `photo_filename` varchar(255) DEFAULT NULL,
  `position` varchar(255) DEFAULT NULL,
  `contract_date` date DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `corporate_cell_phone` varchar(255) DEFAULT NULL,
  `personal_cell_phone` varchar(255) DEFAULT NULL,
  `corporate_email` varchar(255) DEFAULT NULL,
  `personal_email` varchar(255) DEFAULT NULL,
  `last_names` varchar(255) DEFAULT NULL,
  `names` varchar(255) DEFAULT NULL,
  `identity_document_type_id` varchar(255) DEFAULT NULL,
  `number` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `telephone` varchar(255) DEFAULT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `last_password_update` datetime DEFAULT NULL,
  `restaurant_role_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `document_id` char(255) DEFAULT NULL COMMENT 'Relacion con tipo de documentos',
  `series_id` int(10) unsigned DEFAULT NULL COMMENT 'Relacion con series',
  `zone_id` int(10) unsigned DEFAULT NULL,
  `change_seller` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`),
  UNIQUE KEY `users_api_token_unique` (`api_token`),
  KEY `users_establishment_id_foreign` (`establishment_id`),
  KEY `users_restaurant_role_id_foreign` (`restaurant_role_id`),
  CONSTRAINT `users_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `users_restaurant_role_id_foreign` FOREIGN KEY (`restaurant_role_id`) REFERENCES `restaurant_roles` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

SET autocommit=0;
INSERT INTO `users` VALUES (1,'Administrador','fernandeznilver830@gmail.com',NULL,'$2y$10$kiIjdMeTrE7DfsS.HJ/qt.rejPvszj1W3iY8ux6iKkASDCpAmk4a2','ZfnVTVWg26ZnGpNruhEyhlMJjt1qnFNntwpU3yXqAJKQcKvNDn',1,'admin',0,1,0,1,1,1,1,1,0,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'1','70205993','Chota','931087394',NULL,'2024-11-24 16:57:54',NULL,NULL,'2024-11-24 19:26:42',NULL,NULL,NULL,0),(2,'Diego','diegopotosi23@gmail.com',NULL,'$2y$10$du1IU.yKq8DxmgNBYnrv/.47pGCa5eUbPxgLGI96rdo7pO2MuumyS','2Z0bpEpntBrWtsMVa2W9uWQbjb2aokayHxT1m0dXbjSmRMLTmg',1,'client',0,0,0,1,1,1,1,1,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Chota','931087394',NULL,NULL,NULL,'2024-11-24 18:49:07','2024-11-24 18:50:21',NULL,NULL,NULL,0),(3,'Nilver Fernández','nilver@gmail.com',NULL,'$2y$10$xtrhHPEBb.tB7WcJpLZ/4uCiMVnU9Wzd3J/YW8z3tRXD50spNg9Lu','KFGvfdAhGcIJJbRePfaCGa8qJ2xbbGsVgjAgK5pZzLUk6ipn3F',1,'client',0,0,0,1,1,1,1,1,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Chota','952133840',NULL,NULL,NULL,'2024-11-24 18:56:34','2024-11-24 18:57:24',NULL,NULL,NULL,0);
COMMIT;

-- Dumped table `users` with 3 row(s)
--

--
-- Table structure for table `user_commissions`
--

CREATE TABLE `user_commissions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  `type` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_commissions_user_id_foreign` (`user_id`),
  CONSTRAINT `user_commissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_commissions`
--

SET autocommit=0;
COMMIT;

-- Dumped table `user_commissions` with 0 row(s)
--

--
-- Table structure for table `user_default_document_types`
--

CREATE TABLE `user_default_document_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `document_type_id` varchar(255) NOT NULL,
  `series_id` int(10) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_default_document_types_user_id_foreign` (`user_id`),
  KEY `user_default_document_types_document_type_id_foreign` (`document_type_id`),
  KEY `user_default_document_types_series_id_foreign` (`series_id`),
  CONSTRAINT `user_default_document_types_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `user_default_document_types_series_id_foreign` FOREIGN KEY (`series_id`) REFERENCES `series` (`id`),
  CONSTRAINT `user_default_document_types_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_default_document_types`
--

SET autocommit=0;
COMMIT;

-- Dumped table `user_default_document_types` with 0 row(s)
--

--
-- Table structure for table `user_rel_subscription_plans`
--

CREATE TABLE `user_rel_subscription_plans` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con usuario',
  `subscription_plan_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con planes de suscripcion',
  `cat_period_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con el periodo de tiempo',
  `items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'Pega los items relacionados a modo de standar' CHECK (json_valid(`items`)),
  `editable` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si ya ha sido adquirido, no puede ser modificado',
  `deletable` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si ya ha sido adquirido, no puede ser borrado',
  `start_date` date DEFAULT NULL COMMENT 'Fecha de inicio',
  `sale_notes` text DEFAULT NULL,
  `documents` text DEFAULT NULL,
  `dates_of_documents` text DEFAULT NULL,
  `automatic_date_of_issue` date DEFAULT NULL,
  `customer_id` int(10) unsigned DEFAULT 0,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `parent_customer_id` int(10) unsigned DEFAULT 0,
  `parent_customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`parent_customer`)),
  `children_customer_id` int(10) unsigned DEFAULT 0,
  `children_customer` longtext DEFAULT NULL,
  `quantity_period` int(10) unsigned DEFAULT 0,
  `apply_concurrency` int(10) unsigned NOT NULL DEFAULT 0,
  `enabled_concurrency` int(10) unsigned NOT NULL DEFAULT 1 COMMENT 'Se pasará a nota de ventas como activo',
  `currency_type_id` varchar(255) DEFAULT NULL,
  `payment_method_type_id` varchar(255) DEFAULT NULL,
  `exchange_rate_sale` double(13,3) DEFAULT 0.000,
  `total_prepayment` double(12,2) DEFAULT 0.00,
  `total_charge` double(12,2) DEFAULT 0.00,
  `total_discount` double(12,2) DEFAULT 0.00,
  `total_exportation` double(12,2) DEFAULT 0.00,
  `total_free` double(12,2) DEFAULT 0.00,
  `total_taxed` double(12,2) DEFAULT 0.00,
  `total_unaffected` double(12,2) DEFAULT 0.00,
  `total_exonerated` double(12,2) DEFAULT 0.00,
  `total_igv` double(12,2) DEFAULT 0.00,
  `total_igv_free` double(12,2) DEFAULT 0.00,
  `total_base_isc` double(12,2) DEFAULT 0.00,
  `total_isc` double(12,2) DEFAULT 0.00,
  `total_base_other_taxes` double(12,2) DEFAULT 0.00,
  `total_other_taxes` double(12,2) DEFAULT 0.00,
  `total_taxes` double(12,2) DEFAULT 0.00,
  `total_value` double(12,2) DEFAULT 0.00,
  `total` decimal(12,2) DEFAULT 0.00,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `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`)),
  `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`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `terms_condition` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `grade` text DEFAULT NULL COMMENT 'Grado designado - utilizado en matricula',
  `section` text DEFAULT NULL COMMENT 'Seccion designado - utilizado en matricula',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_rel_subscription_plans`
--

SET autocommit=0;
COMMIT;

-- Dumped table `user_rel_subscription_plans` with 0 row(s)
--

--
-- Table structure for table `voided`
--

CREATE TABLE `voided` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) NOT NULL,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `ubl_version` varchar(255) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_reference` date NOT NULL,
  `identifier` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `ticket` varchar(255) DEFAULT NULL,
  `has_ticket` tinyint(1) NOT NULL DEFAULT 0,
  `has_cdr` tinyint(1) NOT NULL DEFAULT 0,
  `soap_shipping_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`soap_shipping_response`)),
  `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`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `voided_user_id_foreign` (`user_id`),
  KEY `voided_soap_type_id_foreign` (`soap_type_id`),
  KEY `voided_state_type_id_foreign` (`state_type_id`),
  CONSTRAINT `voided_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `voided_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `voided_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `voided`
--

SET autocommit=0;
COMMIT;

-- Dumped table `voided` with 0 row(s)
--

--
-- Table structure for table `voided_documents`
--

CREATE TABLE `voided_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `voided_id` int(10) unsigned NOT NULL,
  `document_id` int(10) unsigned NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `voided_documents_voided_id_foreign` (`voided_id`),
  KEY `voided_documents_document_id_foreign` (`document_id`),
  CONSTRAINT `voided_documents_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  CONSTRAINT `voided_documents_voided_id_foreign` FOREIGN KEY (`voided_id`) REFERENCES `voided` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `voided_documents`
--

SET autocommit=0;
COMMIT;

-- Dumped table `voided_documents` with 0 row(s)
--

--
-- Table structure for table `waiters`
--

CREATE TABLE `waiters` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `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 `waiters`
--

SET autocommit=0;
COMMIT;

-- Dumped table `waiters` with 0 row(s)
--

--
-- Table structure for table `warehouses`
--

CREATE TABLE `warehouses` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `establishment_id` int(10) unsigned NOT NULL,
  `description` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `warehouses_establishment_id_foreign` (`establishment_id`),
  CONSTRAINT `warehouses_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warehouses`
--

SET autocommit=0;
INSERT INTO `warehouses` VALUES (1,1,'Almacén Oficina Principal','2024-11-24 16:57:54','2024-11-24 16:57:54');
COMMIT;

-- Dumped table `warehouses` with 1 row(s)
--

--
-- Table structure for table `web_platforms`
--

CREATE TABLE `web_platforms` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `web_platforms`
--

SET autocommit=0;
INSERT INTO `web_platforms` VALUES (1,'Saga Falabella',NULL,NULL),(2,'Mercado Libre ',NULL,NULL),(3,'Linio',NULL,NULL);
COMMIT;

-- Dumped table `web_platforms` with 3 row(s)
--

--
-- Table structure for table `workers`
--

CREATE TABLE `workers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `identity_document_type_id` varchar(255) NOT NULL,
  `number` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `birth_date` date NOT NULL,
  `admission_date` date NOT NULL,
  `occupation` varchar(255) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `telephone` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `workers_identity_document_type_id_foreign` (`identity_document_type_id`),
  KEY `workers_number_index` (`number`),
  KEY `workers_name_index` (`name`),
  CONSTRAINT `workers_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 `workers`
--

SET autocommit=0;
COMMIT;

-- Dumped table `workers` with 0 row(s)
--

--
-- Table structure for table `zones`
--

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

--
-- Dumping data for table `zones`
--

SET autocommit=0;
COMMIT;

-- Dumped table `zones` with 0 row(s)
--


