(29,1,1,'mob-1785258708547522-547522','completed','document',3,'{\"record\":{\"id\":3,\"model\":\"document\",\"external_id\":\"204ae27c-2b94-4e5a-9e41-3cd0b4d45ac5\",\"number_full\":\"B001-3\",\"series\":\"B001\",\"number\":3,\"document_type_id\":\"03\",\"document_type_description\":\"BOLETA DE VENTA ELECTR\\u00d3NICA\",\"state_type_id\":\"01\",\"state_type_description\":\"Registrado\",\"date_of_issue\":\"2026-07-28\",\"time_of_issue\":\"12:11:48\",\"currency_type_id\":\"PEN\",\"exchange_rate_sale\":1,\"payment_condition_id\":\"01\",\"payment_method_type_id\":\"01\",\"seller_id\":1,\"additional_information\":[\"\"],\"subtotal\":2,\"total_taxed\":0,\"total_exonerated\":2,\"total_unaffected\":0,\"total_value\":2,\"total_igv\":0,\"total_taxes\":0,\"total\":2,\"customer\":{\"id\":1,\"name\":\"Clientes - Varios\",\"number\":\"99999999\",\"identity_document_type_id\":\"0\",\"description\":\"99999999 - Clientes - Varios\"},\"items_count\":1,\"items\":[{\"id\":4,\"item_id\":520,\"description\":\"3-GEL 10ML SUSPENSION ORAL\",\"internal_id\":\"2\",\"unit_type_id\":\"NIU\",\"quantity\":1,\"unit_price\":2,\"total_value\":2,\"total_igv\":0,\"total\":2,\"affectation_igv_type_id\":\"20\"}],\"payments\":[{\"id\":92,\"payment_method_type_id\":\"01\",\"payment_destination_id\":null,\"reference\":null,\"payment\":2,\"date_of_payment\":\"2026-07-28T05:00:00.000000Z\"}],\"fees\":[{\"id\":1,\"date\":\"2026-04-01T05:00:00.000000Z\",\"currency_type_id\":\"PEN\",\"amount\":0}],\"pdf_url\":\"https:\\/\\/demo.sysfarma.pe\\/print\\/document\\/204ae27c-2b94-4e5a-9e41-3cd0b4d45ac5\\/a4\",\"ticket_url\":\"https:\\/\\/demo.sysfarma.pe\\/print\\/document\\/204ae27c-2b94-4e5a-9e41-3cd0b4d45ac5\\/ticket\",\"print_payload_url\":\"https:\\/\\/demo.sysfarma.pe\\/api\\/mobile\\/v1\\/documents\\/3\\/print-payload?model=document\"},\"legacy\":{\"success\":true,\"data\":{\"number\":\"B001-3\",\"filename\":\"00000000000-03-B001-3\",\"external_id\":\"204ae27c-2b94-4e5a-9e41-3cd0b4d45ac5\",\"state_type_id\":\"01\",\"state_type_description\":\"Registrado\",\"number_to_letter\":\"Dos  con 00\\/100 \",\"hash\":null,\"qr\":\"iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAIAAACzY+a1AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4AQCbgGR\\/Af\\/\\/\\/w[BLOB]I[BLOB]g[BLOB]I[BLOB]g[BLOB]I[BLOB]g[BLOB]I[BLOB]g[BLOB]I[BLOB]g[BLOB]QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD\\/\\/\\/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAD\\/\\/\\/8AAAAAAAAAAAABAQEAAAAAAAAAAAD\\/\\/\\/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAAAAAAD\\/\\/\\/8AAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD\\/\\/\\[BLOB]\\/\\/\\/\\/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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28 12:11:49','2026-07-28 12:11:49'),(30,1,1,'mob-1785258814373880-373880','completed','sale_note',1,'{\"record\":{\"id\":1,\"model\":\"sale_note\",\"external_id\":\"b9f1f3b8-9ce1-4d77-a784-517e9b2b6d51\",\"number_full\":\"NV01-1\",\"series\":\"NV01\",\"number\":1,\"document_type_id\":\"80\",\"document_type_description\":\"Nota de venta\",\"state_type_id\":\"01\",\"state_type_description\":\"Registrado\",\"date_of_issue\":\"2026-07-28\",\"time_of_issue\":\"12:13:34\",\"currency_type_id\":\"PEN\",\"exchange_rate_sale\":1,\"payment_condition_id\":\"01\",\"payment_method_type_id\":\"01\",\"seller_id\":1,\"additional_information\":null,\"subtotal\":2,\"total_taxed\":0,\"total_exonerated\":2,\"total_unaffected\":0,\"total_value\":2,\"total_igv\":0,\"total_taxes\":0,\"total\":2,\"customer\":{\"id\":1,\"name\":\"Clientes - Varios\",\"number\":\"99999999\",\"identity_document_type_id\":\"0\",\"description\":\"99999999 - Clientes - Varios\"},\"items_count\":1,\"items\":[{\"id\":1,\"item_id\":520,\"description\":\"3-GEL 10ML SUSPENSION ORAL\",\"internal_id\":\"2\",\"unit_type_id\":\"NIU\",\"quantity\":1,\"unit_price\":2,\"total_value\":2,\"total_igv\":0,\"total\":2,\"affectation_igv_type_id\":\"20\"}],\"payments\":[{\"id\":22,\"payment_method_type_id\":\"01\",\"payment_destination_id\":null,\"reference\":null,\"payment\":2,\"date_of_payment\":\"2026-07-28T05:00:00.000000Z\"}],\"fees\":[],\"pdf_url\":\"https:\\/\\/demo.sysfarma.pe\\/sale-notes\\/print\\/b9f1f3b8-9ce1-4d77-a784-517e9b2b6d51\\/a4\",\"ticket_url\":\"https:\\/\\/demo.sysfarma.pe\\/sale-notes\\/print\\/b9f1f3b8-9ce1-4d77-a784-517e9b2b6d51\\/ticket\",\"print_payload_url\":\"https:\\/\\/demo.sysfarma.pe\\/api\\/mobile\\/v1\\/documents\\/1\\/print-payload?model=sale_note\"},\"legacy\":{\"success\":true,\"data\":{\"id\":1,\"number\":\"NV01-1\",\"external_id\":\"b9f1f3b8-9ce1-4d77-a784-517e9b2b6d51\",\"filename\":\"NV01-1-20260728\",\"print_ticket\":\"https:\\/\\/demo.sysfarma.pe\\/sale-notes\\/print\\/b9f1f3b8-9ce1-4d77-a784-517e9b2b6d51\\/ticket\"}}}',NULL,'2026-07-28 12:13:35','2026-07-28 12:13:35');
COMMIT;

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

--
-- Table structure for table `mobile_physical_counts`
--

CREATE TABLE `mobile_physical_counts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `establishment_id` int(10) unsigned NOT NULL,
  `warehouse_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `status` varchar(30) NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT NULL,
  `submitted_by` int(10) unsigned DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `approved_by` int(10) unsigned DEFAULT NULL,
  `rejected_at` timestamp NULL DEFAULT NULL,
  `rejected_by` int(10) unsigned DEFAULT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `cancelled_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `mobile_physical_counts_warehouse_id_status_index` (`warehouse_id`,`status`),
  KEY `mobile_physical_counts_user_id_status_index` (`user_id`,`status`),
  KEY `mobile_physical_counts_submitted_by_foreign` (`submitted_by`),
  KEY `mobile_physical_counts_approved_by_foreign` (`approved_by`),
  KEY `mobile_physical_counts_rejected_by_foreign` (`rejected_by`),
  KEY `mobile_physical_counts_cancelled_by_foreign` (`cancelled_by`),
  KEY `mobile_physical_counts_est_status_created_idx` (`establishment_id`,`status`,`created_at`),
  CONSTRAINT `mobile_physical_counts_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_counts_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_counts_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `mobile_physical_counts_rejected_by_foreign` FOREIGN KEY (`rejected_by`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_counts_submitted_by_foreign` FOREIGN KEY (`submitted_by`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_counts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_counts_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mobile_physical_counts`
--

SET autocommit=0;
INSERT INTO `mobile_physical_counts` VALUES (1,1,1,1,'draft',NULL,'2026-05-20 18:48:23',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 18:48:23','2026-05-20 18:48:23'),(2,1,1,1,'draft',NULL,'2026-05-20 19:05:58',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 19:05:58','2026-05-20 19:05:58'),(3,1,1,1,'draft',NULL,'2026-05-20 19:51:53',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 19:51:53','2026-05-20 19:51:53'),(4,1,1,1,'draft',NULL,'2026-05-20 19:55:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 19:55:28','2026-05-20 19:55:28'),(5,1,1,1,'draft',NULL,'2026-05-20 22:52:29',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 22:52:29','2026-05-20 23:07:34'),(6,1,1,1,'draft',NULL,'2026-05-20 23:54:40',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-05-20 23:54:40','2026-05-20 23:54:40'),(7,1,1,1,'draft',NULL,'2026-07-23 12:59:17',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-07-23 12:59:17','2026-07-23 12:59:17'),(8,1,1,1,'draft',NULL,'2026-07-26 14:24:26',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-07-26 14:24:26','2026-07-26 14:24:26');
COMMIT;

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

--
-- Table structure for table `mobile_physical_count_events`
--

CREATE TABLE `mobile_physical_count_events` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `physical_count_id` int(10) unsigned NOT NULL,
  `line_id` int(10) unsigned DEFAULT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_unit_type_id` int(10) unsigned DEFAULT NULL,
  `lot_group_id` int(10) unsigned DEFAULT NULL,
  `barcode` varchar(100) DEFAULT NULL,
  `factor` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `quantity` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `quantity_base` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `source` varchar(30) NOT NULL DEFAULT 'scan',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `mobile_physical_count_events_physical_count_id_item_id_index` (`physical_count_id`,`item_id`),
  KEY `mobile_physical_count_events_line_id_foreign` (`line_id`),
  KEY `mobile_physical_count_events_user_id_foreign` (`user_id`),
  KEY `mobile_physical_count_events_item_id_foreign` (`item_id`),
  KEY `mobile_physical_count_events_item_unit_type_id_foreign` (`item_unit_type_id`),
  KEY `mobile_physical_count_events_lot_group_id_foreign` (`lot_group_id`),
  CONSTRAINT `mobile_physical_count_events_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `mobile_physical_count_events_item_unit_type_id_foreign` FOREIGN KEY (`item_unit_type_id`) REFERENCES `item_unit_types` (`id`),
  CONSTRAINT `mobile_physical_count_events_line_id_foreign` FOREIGN KEY (`line_id`) REFERENCES `mobile_physical_count_lines` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mobile_physical_count_events_lot_group_id_foreign` FOREIGN KEY (`lot_group_id`) REFERENCES `item_lots_group` (`id`),
  CONSTRAINT `mobile_physical_count_events_physical_count_id_foreign` FOREIGN KEY (`physical_count_id`) REFERENCES `mobile_physical_counts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `mobile_physical_count_events_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mobile_physical_count_events`
--

SET autocommit=0;
INSERT INTO `mobile_physical_count_events` VALUES (1,3,NULL,1,24,NULL,NULL,NULL,1.0000,1.0000,1.0000,'manual',NULL,'2026-05-20 19:52:10'),(2,3,NULL,1,24,NULL,NULL,NULL,1.0000,1.0000,1.0000,'manual',NULL,'2026-05-20 19:52:11'),(3,5,2,1,23,NULL,7,NULL,1.0000,1.0000,1.0000,'manual',NULL,'2026-05-20 23:06:44'),(4,5,2,1,23,NULL,7,NULL,1.0000,0.0000,0.0000,'submit','Conteo enviado a revision web.','2026-05-20 23:06:53'),(5,5,2,1,23,NULL,7,NULL,1.0000,0.0000,0.0000,'request_correction','Conteo devuelto a correccion.','2026-05-20 23:07:34'),(6,5,2,1,23,NULL,7,NULL,1.0000,0.0000,0.0000,'request_correction','Conteo devuelto a correccion.','2026-05-20 23:08:26'),(7,1,3,1,24,NULL,8,NULL,1.0000,1.0000,1.0000,'manual',NULL,'2026-05-21 00:02:59'),(8,3,NULL,1,24,NULL,NULL,NULL,1.0000,0.0000,-2.0000,'remove',NULL,'2026-05-21 14:09:20');
COMMIT;

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

--
-- Table structure for table `mobile_physical_count_lines`
--

CREATE TABLE `mobile_physical_count_lines` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `physical_count_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_unit_type_id` int(10) unsigned DEFAULT NULL,
  `lot_group_id` int(10) unsigned DEFAULT NULL,
  `lot_code` varchar(100) DEFAULT NULL,
  `line_key` varchar(160) NOT NULL,
  `counted_qty_base` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `system_qty_snapshot` decimal(12,4) DEFAULT NULL,
  `difference_qty` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `inventory_id` int(10) unsigned DEFAULT NULL,
  `scanned_times` int(10) unsigned NOT NULL DEFAULT 0,
  `notes` text DEFAULT NULL,
  `last_counted_by` int(10) unsigned DEFAULT NULL,
  `last_counted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `mobile_physical_count_lines_unique` (`physical_count_id`,`line_key`),
  KEY `mobile_physical_count_lines_item_id_lot_group_id_index` (`item_id`,`lot_group_id`),
  KEY `mobile_physical_count_lines_item_unit_type_id_foreign` (`item_unit_type_id`),
  KEY `mobile_physical_count_lines_lot_group_id_foreign` (`lot_group_id`),
  KEY `mobile_physical_count_lines_last_counted_by_foreign` (`last_counted_by`),
  KEY `mobile_physical_count_lines_inventory_id_foreign` (`inventory_id`),
  CONSTRAINT `mobile_physical_count_lines_inventory_id_foreign` FOREIGN KEY (`inventory_id`) REFERENCES `inventories` (`id`),
  CONSTRAINT `mobile_physical_count_lines_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `mobile_physical_count_lines_item_unit_type_id_foreign` FOREIGN KEY (`item_unit_type_id`) REFERENCES `item_unit_types` (`id`),
  CONSTRAINT `mobile_physical_count_lines_last_counted_by_foreign` FOREIGN KEY (`last_counted_by`) REFERENCES `users` (`id`),
  CONSTRAINT `mobile_physical_count_lines_lot_group_id_foreign` FOREIGN KEY (`lot_group_id`) REFERENCES `item_lots_group` (`id`),
  CONSTRAINT `mobile_physical_count_lines_physical_count_id_foreign` FOREIGN KEY (`physical_count_id`) REFERENCES `mobile_physical_counts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mobile_physical_count_lines`
--

SET autocommit=0;
INSERT INTO `mobile_physical_count_lines` VALUES (2,5,23,NULL,7,'HR-A2','23|lot:7',1.0000,200.0000,-199.0000,NULL,1,NULL,1,'2026-05-20 23:06:44','2026-05-20 23:06:44','2026-05-20 23:06:44'),(3,1,24,NULL,8,'ND-B1','24|lot:8',1.0000,70.0000,-69.0000,NULL,1,NULL,1,'2026-05-21 00:02:59','2026-05-21 00:02:59','2026-05-21 00:02:59');
COMMIT;

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

--
-- Table structure for table `mobile_push_devices`
--

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `modules`
--

CREATE TABLE `modules` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `value` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `order_menu` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `modules`
--

SET autocommit=0;
INSERT INTO `modules` VALUES (1,'documents','Ventas',2,NULL,NULL),(2,'purchases','Compras',7,NULL,NULL),(3,'advanced','Documentos Avanzados',8,NULL,NULL),(4,'reports','Reportes',9,NULL,NULL),(5,'configuration','Configuration',12,NULL,NULL),(6,'pos','Punto de venta (POS)',3,NULL,NULL),(7,'dashboard','Dashboard',1,NULL,NULL),(8,'inventory','Inventario',7,NULL,NULL),(9,'accounting','Contabilidad',10,NULL,NULL),(10,'ecommerce','Ecommerce',4,NULL,NULL),(11,'cuenta','Cuenta',13,NULL,NULL),(12,'finance','Finanzas',11,NULL,NULL),(14,'establishments','Usuarios/Locales & Series',7,NULL,NULL),(15,'hotels','Hoteles',14,NULL,NULL),(16,'documentary-procedure','Trámite documentario',15,NULL,NULL),(17,'items','Productos/Servicios',5,NULL,NULL),(18,'persons','Clientes',6,NULL,NULL),(19,'digemid','Farmacos',15,'2025-12-27 11:51:09','2025-12-27 11:51:09'),(20,'apps','Apps',13,NULL,NULL),(21,'suscription_app','Suscriptiones',16,NULL,NULL),(22,'production_app','Producción',17,NULL,NULL),(23,'restaurant_app','Restaurante',18,NULL,NULL),(24,'full_suscription_app','Suscripción Servicios SAAS',17,NULL,NULL),(25,'generate_link_app','Generador de link de pago',19,NULL,NULL),(26,'app_2_generator','Generador APP 2.0',20,NULL,NULL),(27,'guia','Guia de remisión',3,NULL,NULL),(33,'veterinary','Veterinaria',20,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(34,'clinica','Clínica',20,'2026-06-30 14:47:39','2026-06-30 14:47:39');
COMMIT;

-- Dumped table `modules` with 28 row(s)
--

--
-- Table structure for table `module_levels`
--

CREATE TABLE `module_levels` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `value` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `module_id` int(10) unsigned NOT NULL,
  `route_name` varchar(255) DEFAULT NULL,
  `route_path` varchar(255) DEFAULT NULL,
  `label_menu` varchar(3) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `module_levels_module_id_foreign` (`module_id`),
  CONSTRAINT `module_levels_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `module_levels`
--

SET autocommit=0;
INSERT INTO `module_levels` VALUES (1,'new_document','Nuevo comprobante',1,'tenant.documents.create','/documents/create','NC',NULL,NULL),(2,'list_document','L. Comprobantes',1,NULL,NULL,NULL,NULL,NULL),(3,'document_not_sent','Doc. No enviados',1,NULL,NULL,NULL,NULL,NULL),(4,'document_contingengy','Doc. Contingencia',1,NULL,NULL,NULL,NULL,NULL),(5,'catalogs','Catálogos',1,NULL,NULL,NULL,NULL,NULL),(6,'summary_voided','Resúmenes y Anulaciones',1,NULL,NULL,NULL,NULL,NULL),(7,'quotations','Cotizaciones',1,NULL,NULL,NULL,NULL,NULL),(8,'sale_notes','Notas de Venta',1,'tenant.sale_notes.index','/sale-notes','NV',NULL,NULL),(9,'incentives','Comisiones',1,NULL,NULL,NULL,NULL,NULL),(10,'sale-opportunity','Oportunidad de venta',1,NULL,NULL,NULL,NULL,NULL),(11,'contracts','Contratos',1,NULL,NULL,NULL,NULL,NULL),(12,'order-note','Pedidos',1,'tenant.order_notes.index','/order-notes','PED',NULL,NULL),(13,'technical-service','Servicios de soporte técnico',1,NULL,NULL,NULL,NULL,NULL),(14,'regularize_shipping','CPE pendientes de rectificación',1,NULL,NULL,NULL,NULL,NULL),(15,'pos','Punto de venta',6,'tenant.pos.index','/pos','POS',NULL,NULL),(16,'cash','Caja chica POS',6,NULL,NULL,NULL,NULL,NULL),(17,'ecommerce','Ir a la tienda',10,NULL,NULL,NULL,NULL,NULL),(18,'ecommerce_orders','Pedidos',10,NULL,NULL,NULL,NULL,NULL),(19,'ecommerce_items','Productos tienda virtual',10,NULL,NULL,NULL,NULL,NULL),(20,'ecommerce_tags','Etiquetas',10,NULL,NULL,NULL,NULL,NULL),(21,'ecommerce_promotions','Promociones - Banners',10,NULL,NULL,NULL,NULL,NULL),(22,'ecommerce_settings','Configuración',10,NULL,NULL,NULL,NULL,NULL),(23,'items','Productos',17,'tenant.items.index','/items','PRO',NULL,NULL),(24,'items_packs','Packs',17,NULL,NULL,NULL,NULL,NULL),(25,'items_services','Servicios',17,NULL,NULL,NULL,NULL,NULL),(26,'items_categories','Categorías',17,NULL,NULL,NULL,NULL,NULL),(27,'items_brands','Marcas',17,NULL,NULL,NULL,NULL,NULL),(28,'items_lots','Series',17,NULL,NULL,NULL,NULL,NULL),(29,'clients','Clientes',18,NULL,NULL,NULL,NULL,NULL),(30,'clients_types','Tipos de clientes',18,NULL,NULL,NULL,NULL,NULL),(31,'purchases_create','Nueva Compra',2,'tenant.purchases.create','/purchases/create','NC',NULL,NULL),(32,'purchases_list','Listado',2,NULL,NULL,NULL,NULL,NULL),(33,'purchases_orders','Ordenes de compra',2,NULL,NULL,NULL,NULL,NULL),(34,'purchases_expenses','Gastos diversos',2,NULL,NULL,NULL,NULL,NULL),(35,'purchases_suppliers','Proveedores',2,NULL,NULL,NULL,NULL,NULL),(36,'purchases_quotations','Solicitar cotización',2,NULL,NULL,NULL,NULL,NULL),(37,'purchases_fixed_assets_items','Activos fijos - Ítems',2,NULL,NULL,NULL,NULL,NULL),(38,'purchases_fixed_assets_purchases','Activos fijos - Compras',2,NULL,NULL,NULL,NULL,NULL),(39,'inventory','Movimientos',8,'inventory.index','/inventory','INV',NULL,NULL),(40,'inventory_transfers','Traslados',8,NULL,NULL,NULL,NULL,NULL),(41,'inventory_devolutions','Devoluciones',8,NULL,NULL,NULL,NULL,NULL),(42,'inventory_report_kardex','Reporte kardex',8,NULL,NULL,NULL,NULL,NULL),(43,'inventory_report','Reporte inventario',8,NULL,NULL,NULL,NULL,NULL),(44,'inventory_report_valued_kardex','Kardex valorizado',8,NULL,NULL,NULL,NULL,'2025-12-27 11:51:15'),(45,'users','Usuarios',14,'tenant.users.index','/users','USR',NULL,NULL),(46,'users_establishments','Establecimientos',14,'tenant.establishments.index','/establishments','ES',NULL,NULL),(47,'advanced_retentions','Retenciones',3,NULL,NULL,NULL,NULL,NULL),(49,'advanced_perceptions','Percepciones',3,NULL,NULL,NULL,NULL,NULL),(50,'advanced_order_forms','Ordenes de pedido',3,NULL,NULL,NULL,NULL,NULL),(51,'account_report','Exportar reporte',9,NULL,NULL,NULL,NULL,NULL),(52,'account_formats','Exportar formatos',9,NULL,NULL,NULL,NULL,NULL),(53,'account_summary','Reporte resumido - Ventas',9,NULL,NULL,NULL,NULL,NULL),(54,'finances_movements','Movimientos',12,NULL,NULL,NULL,NULL,NULL),(55,'finances_incomes','Ingresos',12,NULL,NULL,NULL,NULL,NULL),(56,'finances_unpaid','Cuentas por cobrar',12,NULL,NULL,NULL,NULL,NULL),(57,'finances_to_pay','Cuentas por pagar',12,NULL,NULL,NULL,NULL,NULL),(58,'finances_payments','Pagos',12,NULL,NULL,NULL,NULL,NULL),(59,'finances_balance','Balance',12,NULL,NULL,NULL,NULL,NULL),(60,'finances_payment_method_types','Ingresos y Egresos - M. Pago',12,NULL,NULL,NULL,NULL,NULL),(61,'account_users_settings','Configuración',11,NULL,NULL,NULL,NULL,NULL),(62,'account_users_list','Lista de pagos',11,NULL,NULL,NULL,NULL,NULL),(63,'hotels_reception','Recepción',15,NULL,NULL,NULL,NULL,NULL),(64,'hotels_rates','Tarifas',15,NULL,NULL,NULL,NULL,NULL),(65,'hotels_floors','Pisos',15,NULL,NULL,NULL,NULL,NULL),(66,'hotels_cats','Categorías',15,NULL,NULL,NULL,NULL,NULL),(67,'hotels_rooms','Habitaciones',15,NULL,NULL,NULL,NULL,NULL),(68,'documentary_offices','Oficinas',16,NULL,NULL,NULL,NULL,NULL),(69,'documentary_process','Procesos',16,NULL,NULL,NULL,NULL,NULL),(70,'documentary_documents','Tipos de documento',16,NULL,NULL,NULL,NULL,NULL),(71,'documentary_actions','Acciones',16,NULL,NULL,NULL,NULL,NULL),(72,'documentary_files','Expedientes',16,NULL,NULL,NULL,NULL,NULL),(73,'digemid','Productos (legado)',19,NULL,NULL,NULL,'2025-12-27 11:51:09','2025-12-27 11:51:09'),(74,'documentary_requirements','Requerimientos',16,NULL,NULL,NULL,'2025-12-27 11:51:09','2025-12-27 11:51:09'),(75,'inventory_item_extra_data','Datos extra de items',8,NULL,NULL,NULL,NULL,NULL),(76,'configuration_company','Empresa',5,'tenant.companies.create','/companies/create','ME',NULL,NULL),(77,'configuration_advance','Avanzado',5,NULL,NULL,NULL,NULL,NULL),(78,'configuration_visual','Visual',5,NULL,NULL,NULL,NULL,NULL),(79,'advanced_purchase_settlements','Liquidaciones de compra',3,NULL,NULL,NULL,NULL,NULL),(80,'suscription_app_client','Cliente',21,NULL,NULL,NULL,NULL,NULL),(81,'suscription_app_service','Servicio',21,NULL,NULL,NULL,NULL,NULL),(82,'suscription_app_payments','Pagos',21,NULL,NULL,NULL,NULL,NULL),(83,'suscription_app_plans','Planes',21,NULL,NULL,NULL,NULL,NULL),(85,'digemid_health_report','Cumplimiento Regulatorio',19,'reports.compliance.index','/prescriptions/digemid/compliance','CUM','2026-04-01 09:07:58','2026-04-01 09:07:58'),(86,'digemid_doctors','Medicos',19,'tenant.prescriptions.doctors.index','/prescriptions/doctors','MED','2026-04-01 09:07:58','2026-04-01 09:07:58'),(87,'digemid_cie10','CIE 10',19,'tenant.prescriptions.cie10.index','/prescriptions/cie10','C10','2026-04-01 09:07:58','2026-04-01 09:07:58'),(88,'digemid_psychotropics_report','Reporte de Psicotropicos',19,'tenant.prescriptions.reports.index','/prescriptions/reports','RPS','2026-04-01 09:07:58','2026-04-01 09:07:58'),(89,'digemid_purchase_reception','Recepcion de productos farmaceuticos',19,'tenant.reports.purchases.format_09.index','/reports/purchases/format_09','RPF','2026-04-01 09:07:58','2026-04-01 09:07:58'),(90,'items_coupons','Cupones',17,NULL,NULL,NULL,'2026-04-01 09:07:58','2026-04-01 09:07:58'),(91,'veterinary','Veterinaria',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(92,'vet_panel','Panel',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(93,'vet_pets','Mascotas',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(94,'vet_appointments','Citas / Agenda',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(95,'vet_boardings','Hospedaje',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(96,'vet_reminders','Recordatorios',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(97,'vet_memberships','Membresías',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(98,'vet_reports','Reportes',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(99,'vet_settings','Configuración',33,NULL,NULL,NULL,'2026-06-28 02:01:00','2026-06-28 02:01:00'),(100,'clinica','Clínica',34,NULL,NULL,NULL,'2026-06-30 14:47:39','2026-06-30 14:47:39'),(101,'inventory_reconciliation','Reporte de conciliación de inventario',8,'reports.inventory_reconciliation.index','/reports/inventory-reconciliation','REC','2026-07-30 16:51:13','2026-07-30 16:51:13');
COMMIT;

-- Dumped table `module_levels` with 99 row(s)
--

--
-- 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=642 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
INSERT INTO `module_level_user` VALUES (1,76,0),(2,77,0),(3,78,0),(307,1,7),(308,2,7),(309,3,7),(310,4,7),(311,5,7),(312,6,7),(313,7,7),(314,8,7),(315,9,7),(316,10,7),(317,11,7),(318,12,7),(319,13,7),(320,14,7),(321,15,7),(322,16,7),(323,17,7),(324,18,7),(325,19,7),(326,20,7),(327,21,7),(328,22,7),(329,23,7),(330,24,7),(331,25,7),(332,26,7),(333,27,7),(334,28,7),(335,90,7),(336,29,7),(337,30,7),(338,31,7),(339,32,7),(340,33,7),(341,34,7),(342,35,7),(343,36,7),(344,37,7),(345,38,7),(346,85,7),(347,86,7),(348,87,7),(349,88,7),(350,89,7),(424,1,8),(425,2,8),(426,3,8),(427,4,8),(428,5,8),(429,6,8),(430,7,8),(431,8,8),(432,9,8),(433,10,8),(434,11,8),(435,12,8),(436,13,8),(437,14,8),(438,15,8),(439,16,8),(440,23,8),(441,24,8),(442,25,8),(443,26,8),(444,27,8),(445,28,8),(446,90,8),(447,29,8),(448,30,8),(449,1,9),(450,2,9),(451,15,9),(452,16,9),(453,23,9),(527,1,1),(528,2,1),(529,3,1),(530,4,1),(531,5,1),(532,6,1),(533,7,1),(534,8,1),(535,9,1),(536,10,1),(537,11,1),(538,12,1),(539,13,1),(540,14,1),(541,15,1),(542,16,1),(543,17,1),(544,18,1),(545,19,1),(546,20,1),(547,21,1),(548,22,1),(549,23,1),(550,24,1),(551,25,1),(552,26,1),(553,27,1),(554,28,1),(555,29,1),(556,30,1),(557,31,1),(558,32,1),(559,33,1),(560,34,1),(561,35,1),(562,36,1),(563,37,1),(564,38,1),(565,39,1),(566,40,1),(567,41,1),(568,42,1),(569,43,1),(570,44,1),(571,45,1),(572,46,1),(573,47,1),(574,49,1),(575,50,1),(576,51,1),(577,52,1),(578,53,1),(579,54,1),(580,55,1),(581,56,1),(582,57,1),(583,58,1),(584,59,1),(585,60,1),(586,61,1),(587,62,1),(588,75,1),(589,76,1),(590,77,1),(591,78,1),(592,79,1),(593,85,1),(594,86,1),(595,87,1),(596,88,1),(597,89,1),(598,90,1),(599,100,1),(600,31,8),(601,32,8),(602,33,8),(603,34,8),(604,35,8),(605,36,8),(606,37,8),(607,38,8),(608,39,8),(609,40,8),(610,41,8),(611,42,8),(612,43,8),(613,44,8),(614,75,8),(615,45,8),(616,46,8),(617,47,8),(618,49,8),(619,50,8),(620,79,8),(621,51,8),(622,52,8),(623,53,8),(624,54,8),(625,55,8),(626,56,8),(627,57,8),(628,58,8),(629,59,8),(630,60,8),(631,76,8),(632,77,8),(633,78,8),(634,61,8),(635,62,8),(636,85,8),(637,86,8),(638,87,8),(639,88,8),(640,89,8),(641,100,8);
COMMIT;

-- Dumped table `module_level_user` with 192 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=176 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
INSERT INTO `module_user` VALUES (32,7,2),(33,7,3),(34,7,4),(35,7,5),(36,7,6),(37,7,3),(90,1,7),(91,6,7),(92,10,7),(93,17,7),(94,18,7),(95,2,7),(96,4,7),(97,19,7),(116,1,8),(117,6,8),(118,17,8),(119,18,8),(120,1,9),(121,6,9),(122,17,9),(142,1,1),(143,2,1),(144,3,1),(145,4,1),(146,5,1),(147,6,1),(148,7,1),(149,8,1),(150,9,1),(151,10,1),(152,11,1),(153,12,1),(154,14,1),(155,17,1),(156,18,1),(157,19,1),(158,20,1),(159,25,1),(160,27,1),(161,34,1),(162,7,8),(163,2,8),(164,8,8),(165,14,8),(166,3,8),(167,4,8),(168,9,8),(169,12,8),(170,5,8),(171,11,8),(172,20,8),(173,19,8),(174,25,8),(175,34,8);
COMMIT;

-- Dumped table `module_user` with 55 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,
  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,
  `shipping_address` varchar(255) DEFAULT NULL,
  `items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `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,
  `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=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
INSERT INTO `orders` VALUES (1,'a564b27d-fcc9-4619-b348-2dad0b06abb9','{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"71447870\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"san roque 512\",\"correo_electronico\":\"admin@gmail.com\",\"telefono\":\"928159302\",\"identity_document_type_id\":\"1\"}','direccion 1','[{\"id\":23,\"name\":\"Paracetamol demo alta rotacion\",\"active_principle\":null,\"description\":\"Paracetamol demo alta rotacion\",\"text_filter\":null,\"model\":null,\"factory_code\":null,\"barcode\":\"DEMO-PHARM-HIGH\",\"technical_specifications\":null,\"item_type_id\":\"01\",\"internal_id\":\"DEMO-PHARM-HIGH\",\"item_code\":null,\"date_of_due\":null,\"account_id\":null,\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"currency_type_id\":\"PEN\",\"sale_unit_price\":\"1.00\",\"purchase_has_igv\":true,\"has_igv\":true,\"subject_to_detraction\":false,\"purchase_unit_price\":0.4,\"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\":1,\"image\":\"imagen-no-disponible.jpg\",\"image_medium\":\"imagen-no-disponible.jpg\",\"image_small\":\"imagen-no-disponible.jpg\",\"stock\":\"197.0000\",\"stock_min\":\"2.00\",\"has_plastic_bag_taxes\":0,\"lot_code\":null,\"lots_enabled\":1,\"series_enabled\":0,\"percentage_of_profit\":\"0.00\",\"has_perception\":0,\"percentage_perception\":null,\"attributes\":null,\"active\":1,\"web_platform_id\":null,\"created_at\":\"2026-05-10T04:19:54.000000Z\",\"updated_at\":\"2026-05-10T06:37:51.000000Z\",\"warehouse_id\":null,\"owner_warehouse_id\":null,\"status\":1,\"apply_store\":1,\"apply_restaurant\":0,\"code\":null,\"concentration\":null,\"formula\":null,\"drug_code\":null,\"points\":null,\"cod_digemid\":null,\"sanitary\":null,\"requires_prescription\":0,\"generic\":0,\"location_id\":null,\"is_for_production\":false,\"second_name\":null,\"item_type\":{\"id\":\"01\",\"description\":\"Producto\"},\"unit_type\":{\"id\":\"NIU\",\"active\":1,\"symbol\":null,\"description\":\"Unidades\"},\"currency_type\":{\"id\":\"PEN\",\"active\":1,\"symbol\":\"S\\/\",\"description\":\"Soles\"},\"warehouses\":[{\"id\":23,\"item_id\":23,\"warehouse_id\":1,\"stock\":\"200.0000\",\"created_at\":\"2026-05-10T04:19:54.000000Z\",\"updated_at\":\"2026-05-10T06:32:23.000000Z\",\"warehouse\":{\"id\":1,\"establishment_id\":1,\"description\":\"Almac\\u00e9n Oficina Principal\",\"created_at\":\"2025-12-27T16:51:17.000000Z\",\"updated_at\":\"2025-12-27T16:51:17.000000Z\"}}],\"item_unit_types\":[{\"id\":25,\"description\":\"Unidad\",\"item_id\":23,\"unit_type_id\":\"NIU\",\"quantity_unit\":1,\"price1\":1,\"price2\":0.94,\"price3\":0.9,\"price_default\":1,\"barcode\":\"DEMO-PHARM-HIGH-NIU\",\"deleted_at\":null,\"unit_type\":{\"id\":\"NIU\",\"active\":1,\"symbol\":null,\"description\":\"Unidades\"}},{\"id\":26,\"description\":\"Bl?ster x10\",\"item_id\":23,\"unit_type_id\":\"BL\",\"quantity_unit\":10,\"price1\":10,\"price2\":9.4,\"price3\":9,\"price_default\":0,\"barcode\":\"DEMO-PHARM-HIGH-BL10\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BL\",\"active\":1,\"symbol\":null,\"description\":\"Bl\\u00edster\"}},{\"id\":27,\"description\":\"Caja x100\",\"item_id\":23,\"unit_type_id\":\"BX\",\"quantity_unit\":100,\"price1\":100,\"price2\":94,\"price3\":90,\"price_default\":0,\"barcode\":\"DEMO-PHARM-HIGH-BX100\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BX\",\"active\":1,\"symbol\":null,\"description\":\"Caja\"}}],\"tags\":[],\"item_lots\":[],\"cantidad\":1,\"sub_total\":\"1.00\",\"exchange_rate_sale\":null}]',1.00,'efectivo',NULL,NULL,1,'{\"acciones\":{\"enviar_email\":true,\"formato_pdf\":\"a4\"},\"serie_documento\":null,\"numero_documento\":\"#\",\"fecha_de_emision\":\"2026-05-20\",\"hora_de_emision\":\"11:30:09\",\"codigo_tipo_operacion\":\"0101\",\"codigo_tipo_documento\":\"80\",\"codigo_tipo_moneda\":\"PEN\",\"fecha_de_vencimiento\":\"2026-05-20\",\"datos_del_cliente_o_receptor\":{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"71447870\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"san roque 512\",\"correo_electronico\":\"admin@gmail.com\",\"telefono\":\"928159302\",\"identity_document_type_id\":\"1\"},\"totales\":{\"total_exportacion\":0,\"total_operaciones_gravadas\":\"0.85\",\"total_operaciones_inafectas\":0,\"total_operaciones_exoneradas\":\"0.00\",\"total_operaciones_gratuitas\":0,\"total_igv\":\"0.15\",\"total_impuestos\":\"0.15\",\"total_valor\":\"0.85\",\"total_venta\":\"1.00\"},\"items\":[{\"codigo_interno\":\"DEMO-PHARM-HIGH\",\"descripcion\":\"Paracetamol demo alta rotacion\",\"codigo_producto_sunat\":null,\"unidad_de_medida\":\"NIU\",\"cantidad\":1,\"valor_unitario\":0.8474576271186441,\"codigo_tipo_precio\":\"01\",\"precio_unitario\":\"1.00\",\"codigo_tipo_afectacion_igv\":\"10\",\"total_base_igv\":0.8474576271186441,\"porcentaje_igv\":18,\"total_igv\":0.15254237288135586,\"total_impuestos\":0.15254237288135586,\"total_valor_item\":0.8474576271186441,\"total_item\":1,\"actualizar_descripcion\":false,\"nombre_producto_pdf\":null}]}','2026-05-20 11:30:49','2026-05-20 11:30:49',NULL,0),(2,'57abbb38-ce7b-4ff4-a6e3-7c698ac0d1c4','{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"70199427\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"san roque 512\",\"correo_electronico\":\"admin@gmail.com\",\"telefono\":\"928159302\",\"identity_document_type_id\":\"1\"}','direccion 1','[{\"id\":27,\"name\":\"DEXAMETAN Tableta 4 mg\",\"active_principle\":\"deporte\",\"description\":\"DEXAMETAN Tableta 4 mg\",\"text_filter\":null,\"model\":null,\"factory_code\":null,\"barcode\":\"46536\",\"technical_specifications\":null,\"item_type_id\":\"01\",\"internal_id\":\"46536\",\"item_code\":null,\"date_of_due\":null,\"account_id\":null,\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"currency_type_id\":\"PEN\",\"sale_unit_price\":\"8.00\",\"purchase_has_igv\":true,\"has_igv\":true,\"subject_to_detraction\":false,\"purchase_unit_price\":4,\"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\":8,\"image\":\"imagen-no-disponible.jpg\",\"image_medium\":\"imagen-no-disponible.jpg\",\"image_small\":\"imagen-no-disponible.jpg\",\"stock\":\"6.0000\",\"stock_min\":\"2.00\",\"has_plastic_bag_taxes\":0,\"lot_code\":null,\"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\":\"2026-05-10T04:19:54.000000Z\",\"updated_at\":\"2026-06-21T03:08:49.000000Z\",\"warehouse_id\":null,\"owner_warehouse_id\":null,\"status\":1,\"apply_store\":1,\"apply_restaurant\":0,\"code\":46536,\"concentration\":\"4 mg\",\"formula\":\"Tableta\",\"drug_code\":null,\"points\":null,\"cod_digemid\":\"46536\",\"sanitary\":\"EN05515\",\"condition_storage\":\"< 25C\\u00b0\",\"requires_prescription\":0,\"generic\":0,\"location_id\":null,\"is_for_production\":false,\"second_name\":null,\"item_type\":{\"id\":\"01\",\"description\":\"Producto\"},\"unit_type\":{\"id\":\"NIU\",\"active\":1,\"symbol\":null,\"description\":\"Unidades\"},\"currency_type\":{\"id\":\"PEN\",\"active\":1,\"symbol\":\"S\\/\",\"description\":\"Soles\"},\"warehouses\":[{\"id\":27,\"item_id\":27,\"warehouse_id\":1,\"stock\":\"6.0000\",\"created_at\":\"2026-05-10T04:19:54.000000Z\",\"updated_at\":\"2026-06-21T03:08:49.000000Z\",\"warehouse\":{\"id\":1,\"establishment_id\":1,\"description\":\"Almac\\u00e9n Oficina Principal\",\"created_at\":\"2025-12-27T16:51:17.000000Z\",\"updated_at\":\"2025-12-27T16:51:17.000000Z\"}}],\"item_unit_types\":[{\"id\":37,\"description\":\"Unidad\",\"item_id\":27,\"unit_type_id\":\"NIU\",\"quantity_unit\":1,\"price1\":8,\"price2\":7.52,\"price3\":7.2,\"price_default\":1,\"barcode\":\"DEMO-PHARM-STOCKOUT-NIU\",\"deleted_at\":null,\"unit_type\":{\"id\":\"NIU\",\"active\":1,\"symbol\":null,\"description\":\"Unidades\"}},{\"id\":38,\"description\":\"Bl?ster x10\",\"item_id\":27,\"unit_type_id\":\"BL\",\"quantity_unit\":10,\"price1\":80,\"price2\":75.2,\"price3\":72,\"price_default\":0,\"barcode\":\"DEMO-PHARM-STOCKOUT-BL10\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BL\",\"active\":1,\"symbol\":null,\"description\":\"Bl\\u00edster\"}},{\"id\":39,\"description\":\"Caja x100\",\"item_id\":27,\"unit_type_id\":\"BX\",\"quantity_unit\":100,\"price1\":800,\"price2\":752,\"price3\":720,\"price_default\":0,\"barcode\":\"DEMO-PHARM-STOCKOUT-BX100\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BX\",\"active\":1,\"symbol\":null,\"description\":\"Caja\"}},{\"id\":43,\"description\":\"Caja\",\"item_id\":27,\"unit_type_id\":\"BX\",\"quantity_unit\":100,\"price1\":0,\"price2\":0,\"price3\":0,\"price_default\":1,\"barcode\":\"43BX100\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BX\",\"active\":1,\"symbol\":null,\"description\":\"Caja\"}},{\"id\":44,\"description\":\"Bl\\u00edster\",\"item_id\":27,\"unit_type_id\":\"BL\",\"quantity_unit\":10,\"price1\":0,\"price2\":0,\"price3\":0,\"price_default\":1,\"barcode\":\"44BL10\",\"deleted_at\":null,\"unit_type\":{\"id\":\"BL\",\"active\":1,\"symbol\":null,\"description\":\"Bl\\u00edster\"}},{\"id\":45,\"description\":\"Unidad\",\"item_id\":27,\"unit_type_id\":\"NIU\",\"quantity_unit\":1,\"price1\":0,\"price2\":0,\"price3\":0,\"price_default\":1,\"barcode\":\"45NIU1\",\"deleted_at\":null,\"unit_type\":{\"id\":\"NIU\",\"active\":1,\"symbol\":null,\"description\":\"Unidades\"}}],\"tags\":[],\"item_lots\":[],\"cantidad\":1,\"sub_total\":\"8.00\",\"exchange_rate_sale\":null}]',8.00,'efectivo',NULL,NULL,1,'{\"acciones\":{\"enviar_email\":true,\"formato_pdf\":\"a4\"},\"serie_documento\":\"B001\",\"numero_documento\":\"#\",\"fecha_de_emision\":\"2026-06-25\",\"hora_de_emision\":\"12:51:48\",\"codigo_tipo_operacion\":\"0101\",\"codigo_tipo_documento\":\"03\",\"codigo_tipo_moneda\":\"PEN\",\"fecha_de_vencimiento\":\"2026-06-25\",\"datos_del_cliente_o_receptor\":{\"codigo_tipo_documento_identidad\":\"1\",\"numero_documento\":\"70199427\",\"apellidos_y_nombres_o_razon_social\":\"Administrador\",\"codigo_pais\":\"PE\",\"ubigeo\":\"150101\",\"direccion\":\"san roque 512\",\"correo_electronico\":\"admin@gmail.com\",\"telefono\":\"928159302\",\"identity_document_type_id\":\"1\"},\"totales\":{\"total_exportacion\":0,\"total_operaciones_gravadas\":\"6.78\",\"total_operaciones_inafectas\":0,\"total_operaciones_exoneradas\":\"0.00\",\"total_operaciones_gratuitas\":0,\"total_igv\":\"1.22\",\"total_impuestos\":\"1.22\",\"total_valor\":\"6.78\",\"total_venta\":\"8.00\"},\"items\":[{\"codigo_interno\":\"46536\",\"descripcion\":\"DEXAMETAN Tableta 4 mg\",\"codigo_producto_sunat\":null,\"unidad_de_medida\":\"NIU\",\"cantidad\":1,\"valor_unitario\":6.779661016949153,\"codigo_tipo_precio\":\"01\",\"precio_unitario\":\"8.00\",\"codigo_tipo_afectacion_igv\":\"10\",\"total_base_igv\":6.779661016949153,\"porcentaje_igv\":18,\"total_igv\":1.2203389830508469,\"total_impuestos\":1.2203389830508469,\"total_valor_item\":6.779661016949153,\"total_item\":8,\"actualizar_descripcion\":false,\"nombre_producto_pdf\":null}]}','2026-06-25 12:52:19','2026-06-25 12:52:19',NULL,0);
COMMIT;

-- Dumped table `orders` with 2 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,
  `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,
  `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,
  `delivery` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `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,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `optional` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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,
  `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,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(3) 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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `additional_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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`),
  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_soap_type_id_foreign` (`soap_type_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,
  `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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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,
  `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,
  `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,
  `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`
--

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`
--

SET autocommit=0;
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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
COMMIT;

-- Dumped table `payment_links` with 0 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',
  `active_pos` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Visible en POS para contado',
  `pos_bank_account_id` int(10) unsigned DEFAULT NULL COMMENT 'Cuenta bancaria por defecto en POS contado. Null => caja',
  `is_visible` tinyint(1) NOT NULL DEFAULT 1,
  KEY `payment_method_types_id_index` (`id`),
  KEY `payment_method_types_is_credit_index` (`is_credit`),
  KEY `payment_method_types_active_pos_index` (`active_pos`),
  KEY `payment_method_types_pos_bank_account_id_index` (`pos_bank_account_id`)
) 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,1,NULL,1),('02','Yape',0,NULL,NULL,0,0,1,NULL,1),('03','Plin',0,NULL,NULL,0,0,1,NULL,1),('04','Transferencia',0,NULL,NULL,0,0,1,NULL,1),('05','Factura a 30 dias',0,NULL,30,1,0,0,NULL,1),('09','Credito',0,NULL,NULL,1,0,0,NULL,1);
COMMIT;

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

--
-- Table structure 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,
  `series` varchar(255) NOT NULL,
  `exchange_rate` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `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,
  `birthdate` date DEFAULT NULL,
  `gender` char(1) 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,
  `person_type_id` int(10) unsigned DEFAULT NULL,
  `contact` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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,
  `price_list` tinyint(3) unsigned NOT NULL DEFAULT 1,
  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=19 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,NULL,'PE',NULL,'15','1501','150101',NULL,'-',NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2025-12-27 11:51:14','2026-04-12 23:00:06',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(3,'customers','1','52321443','QA Cliente E2E 52321443',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'QA Address 52321443',NULL,NULL,'qa.e2e.customer.52321443@example.com',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-12 22:53:49','2026-04-12 22:53:49',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(4,'customers','1','52652385','QA Cliente E2E 52652385',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'QA Address 52652385',NULL,NULL,'qa.e2e.customer.52652385@example.com',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-12 22:59:19','2026-04-12 22:59:19',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(5,'customers','1','54796677','QA Cliente E2E 54796677',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'QA Address 54796677',NULL,NULL,'qa.e2e.customer.54796677@example.com',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-12 23:35:03','2026-04-12 23:35:03',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(6,'customers','1','88822771','QA Cliente E2E 88822771',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'QA Address 88822771',NULL,NULL,'qa.e2e.customer.88822771@example.com',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-13 09:02:09','2026-04-13 09:02:09',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(7,'customers','1','75478910','VEGA SALAZAR, JEAN CLAUDE',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-13 23:17:23','2026-04-13 23:17:23',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(8,'customers','6','10754789102','VEGA SALAZAR JEAN CLAUDE',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-13 23:17:48','2026-04-13 23:17:48',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(9,'suppliers','6','10754789102','VEGA SALAZAR JEAN CLAUDE',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-04-13 23:55:35','2026-04-13 23:55:35',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(10,'suppliers','6','20999999991','Proveedor Demo Farmacia',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Direccion demo proveedor',NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-05-09 23:19:54','2026-05-09 23:19:54',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(11,'customers','1','70999999','Cliente Demo Farmacia',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Direccion demo cliente',NULL,NULL,NULL,NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-05-09 23:19:54','2026-05-09 23:19:54',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(12,'customers','1','70000001','Cliente Mostrador Demo',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Lima Demo',NULL,NULL,'mostrador.demo@softlte.org.pe',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-05-10 01:31:14','2026-05-10 01:31:14',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(13,'customers','6','20111111111','Botica Mayorista Demo SAC',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Lima Demo',NULL,NULL,'mayorista.demo@softlte.org.pe',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-05-10 01:31:14','2026-05-10 01:31:14',1,0,NULL,0,NULL,NULL,0,'01',0.00,2),(14,'customers','6','20444444444','Cl?nica Convenio Demo SAC',NULL,NULL,NULL,NULL,NULL,'PE',NULL,'15','1501','150101',NULL,'Lima Demo',NULL,NULL,'convenio.demo@softlte.org.pe',NULL,0.00,0,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,'2026-05-10 01:31:14','2026-05-10 01:31:14',1,0,NULL,0,NULL,NULL,0,'01',0.00,3),(15,'suppliers','6','20608557190','FP MAYORISTA S.A.C.',NULL,NULL,'QUIMICA SUIZA',NULL,'01FF0400032582','PE',NULL,'15','1501','150115',NULL,'CAL. VICTOR ALZAMORA NRO. 147','HABIDO','ACTIVO',NULL,NULL,0.00,0,2,'{\"full_name\":null,\"phone\":null}',NULL,0.00,1,NULL,NULL,NULL,'2026-06-04 18:57:36','2026-06-04 18:57:36',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(16,'customers','1','41230077','SALAZAR ESQUEN, MARIBEL',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,NULL,'{\"full_name\":null,\"phone\":null}',NULL,0.00,1,NULL,NULL,NULL,'2026-07-04 09:41:26','2026-07-04 09:41:26',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(17,'customers','6','10468523731','RIMARACHIN HUAMAN MELITA ESTHER',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,'HABIDO','ACTIVO',NULL,NULL,0.00,0,NULL,'{\"full_name\":null,\"phone\":null}',NULL,0.00,1,NULL,NULL,NULL,'2026-07-06 13:01:30','2026-07-06 13:01:30',1,0,NULL,0,NULL,NULL,0,'01',0.00,1),(18,'customers','1','41257809','RIMARACHIN HUAMAN, CLIDER',NULL,NULL,NULL,NULL,NULL,'PE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00,0,NULL,'{\"full_name\":null,\"phone\":null}',NULL,0.00,1,NULL,NULL,'diabético','2026-07-06 13:17:05','2026-07-06 13:24:54',1,0,NULL,0,NULL,NULL,0,'01',0.00,1);
COMMIT;

-- Dumped table `persons` with 17 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','2025-12-27 11:51:00','2025-12-27 11:51:00'),(2,'Distribuidor','2025-12-27 11:51:00','2025-12-27 11:51:00');
COMMIT;

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

--
-- Table structure for table `pharmacy_configurations`
--

CREATE TABLE `pharmacy_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `establishment_id` int(10) unsigned NOT NULL,
  `profit_field` tinyint(1) NOT NULL DEFAULT 0,
  `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 `pharmacy_configurations`
--

SET autocommit=0;
INSERT INTO `pharmacy_configurations` VALUES (1,1,0,'2026-04-01 09:10:57','2026-04-01 09:10:57');
COMMIT;

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

--
-- Table structure for table `points`
--

CREATE TABLE `points` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(10) unsigned NOT NULL,
  `folio` varchar(255) NOT NULL,
  `points` double(8,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `banned` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `points_person_id_foreign` (`person_id`),
  CONSTRAINT `points_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `persons` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `points`
--

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `pos_parked_sales`
--

CREATE TABLE `pos_parked_sales` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` char(36) NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `cash_id` int(10) unsigned NOT NULL,
  `created_by_user_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned DEFAULT NULL,
  `label` varchar(255) DEFAULT NULL,
  `payload` longtext NOT NULL,
  `locked_by_user_id` int(10) unsigned DEFAULT NULL,
  `lock_expires_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `pos_parked_sales_uuid_unique` (`uuid`),
  KEY `idx_pos_parked_sales_cash_id` (`cash_id`),
  KEY `idx_pos_parked_sales_created_by` (`created_by_user_id`),
  KEY `idx_pos_parked_sales_lock_expires` (`lock_expires_at`),
  KEY `idx_pos_parked_sales_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pos_parked_sales`
--

SET autocommit=0;
COMMIT;

-- Dumped table `pos_parked_sales` with 0 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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `prescription_cie10`
--

CREATE TABLE `prescription_cie10` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `diagnoses_code` varchar(255) NOT NULL,
  `diagnoses_description` 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 `prescription_cie10`
--

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `prescription_doctors`
--

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

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `prescription_prescriptions`
--

CREATE TABLE `prescription_prescriptions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `presentation_unit_type_id` int(10) unsigned DEFAULT NULL,
  `document_id` int(10) unsigned DEFAULT NULL,
  `sale_note_id` int(10) unsigned DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `prescription_number` varchar(255) DEFAULT NULL,
  `prescription_date` date DEFAULT NULL,
  `prescription_doctor_id` int(10) unsigned DEFAULT NULL,
  `doctor_name` varchar(255) DEFAULT NULL,
  `prescription_cie10_id` int(10) unsigned DEFAULT NULL,
  `diagnosis_text` varchar(255) DEFAULT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `warehouse_id` int(10) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `prescription_prescriptions_customer_id_foreign` (`customer_id`),
  KEY `prescription_prescriptions_item_id_foreign` (`item_id`),
  KEY `prescription_prescriptions_prescription_doctor_id_foreign` (`prescription_doctor_id`),
  KEY `prescription_prescriptions_prescription_cie10_id_foreign` (`prescription_cie10_id`),
  KEY `prescription_prescriptions_user_id_foreign` (`user_id`),
  KEY `prescription_prescriptions_warehouse_id_foreign` (`warehouse_id`),
  KEY `prescription_presentation_idx` (`presentation_unit_type_id`),
  CONSTRAINT `prescription_prescriptions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `prescription_prescriptions_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `prescription_prescriptions_prescription_cie10_id_foreign` FOREIGN KEY (`prescription_cie10_id`) REFERENCES `prescription_cie10` (`id`),
  CONSTRAINT `prescription_prescriptions_prescription_doctor_id_foreign` FOREIGN KEY (`prescription_doctor_id`) REFERENCES `prescription_doctors` (`id`),
  CONSTRAINT `prescription_prescriptions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `prescription_prescriptions_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `prescription_prescriptions`
--

SET autocommit=0;
INSERT INTO `prescription_prescriptions` VALUES (1,13,28,34,1,NULL,4,'55555','2026-05-12',NULL,'555',NULL,'555',1,1,'2026-05-11 17:46:03','2026-05-11 17:46:03'),(2,13,24,31,1,NULL,4,'55555','2026-05-12',NULL,'555',NULL,'555',1,1,'2026-05-11 17:46:03','2026-05-11 17:46:03');
COMMIT;

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

--
-- Table structure for table `procedures`
--

CREATE TABLE `procedures` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `is_available` tinyint(1) NOT NULL DEFAULT 0,
  `status` tinyint(1) 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 `procedures`
--

SET autocommit=0;
COMMIT;

-- Dumped table `procedures` with 0 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,
  `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,
  `item_unit_type_id` int(10) unsigned DEFAULT 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`),
  KEY `promotion_iut_idx` (`item_unit_type_id`),
  CONSTRAINT `promotions_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `promotions_item_unit_type_id_fk` FOREIGN KEY (`item_unit_type_id`) REFERENCES `item_unit_types` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
COMMIT;

-- Dumped table `promotions` with 0 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,
  `xml_fingerprint_sha256` char(64) DEFAULT 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,
  `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_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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchases_xml_fingerprint_unique` (`xml_fingerprint_sha256`),
  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`),
  KEY `purchases_supplier_document_series_number_idx` (`supplier_id`,`document_type_id`,`series`,`number`),
  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,
  `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,4) NOT NULL DEFAULT 0.0000,
  `percentage_igv` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_igv` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `system_isc_type_id` varchar(255) DEFAULT NULL,
  `total_base_isc` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `percentage_isc` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_isc` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_base_other_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `percentage_other_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_other_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `price_type_id` varchar(255) NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_charge` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_discount` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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',
  `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,
  `currency_type_id` varchar(255) NOT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `total_prepayment` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_charge` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_discount` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_exportation` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_free` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxed` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_unaffected` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_exonerated` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_igv` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_base_isc` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_isc` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_base_other_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_other_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_taxes` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total_value` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `total` decimal(12,4) 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`),
  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_soap_type_id_foreign` (`soap_type_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,
  `quantity` int(11) 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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  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,
  `purchase_fee_id` bigint(20) unsigned DEFAULT 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`),
  KEY `purchase_payments_purchase_fee_id_index` (`purchase_fee_id`),
  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 AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
INSERT INTO `purchase_payments` VALUES (1,16,NULL,'2026-04-15','01',0,NULL,NULL,5.00),(2,17,NULL,'2026-04-15','01',0,NULL,NULL,2.00),(3,17,NULL,'2026-04-15','01',0,NULL,NULL,3.00),(4,1,NULL,'2026-05-19','01',0,NULL,NULL,8.00);
COMMIT;

-- Dumped table `purchase_payments` with 4 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,
  `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,
  `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,
  `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`
--

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,
  `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 `purchase_xml_imports`
--

CREATE TABLE `purchase_xml_imports` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `import_id` char(36) NOT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'previewed',
  `supplier_id` int(10) unsigned DEFAULT NULL,
  `supplier_ruc` varchar(15) DEFAULT NULL,
  `document_type_id` varchar(2) DEFAULT NULL,
  `series` varchar(20) DEFAULT NULL,
  `number` varchar(20) DEFAULT NULL,
  `xml_fingerprint_sha256` char(64) NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`payload`)),
  `issues` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`issues`)),
  `resolutions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`resolutions`)),
  `confirmed_purchase_id` int(10) unsigned DEFAULT NULL,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchase_xml_imports_import_id_unique` (`import_id`),
  KEY `purchase_xml_imports_created_by_foreign` (`created_by`),
  KEY `purchase_xml_imports_supplier_id_foreign` (`supplier_id`),
  KEY `purchase_xml_imports_confirmed_purchase_id_foreign` (`confirmed_purchase_id`),
  KEY `purchase_xml_imports_status_index` (`status`),
  KEY `purchase_xml_imports_fingerprint_idx` (`xml_fingerprint_sha256`),
  CONSTRAINT `purchase_xml_imports_confirmed_purchase_id_foreign` FOREIGN KEY (`confirmed_purchase_id`) REFERENCES `purchases` (`id`),
  CONSTRAINT `purchase_xml_imports_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `purchase_xml_imports_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_xml_imports`
--

SET autocommit=0;
COMMIT;

-- Dumped table `purchase_xml_imports` 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,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(3) 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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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`),
  KEY `quotations_user_id_foreign` (`user_id`),
  KEY `quotations_establishment_id_foreign` (`establishment_id`),
  KEY `quotations_customer_id_foreign` (`customer_id`),
  KEY `quotations_soap_type_id_foreign` (`soap_type_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,
  `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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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',0,'2025-12-27 11:51:12','2025-12-27 11:51:12'),(2,'tenant.reports.purchases.general_items.index','reports/purchases/general_items','Compras - Reporte general de productos',0,'2025-12-27 11:51:12','2025-12-27 11:51:12'),(3,'tenant.reports.purchases.index','reports/purchases','Compras - Compras totales',0,'2025-12-27 11:51:12','2025-12-27 11:51:12');
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,
  `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`
--

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,
  `exchange_rate` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `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,
  `voided_by_user_id` int(10) unsigned DEFAULT NULL,
  `voided_at` timestamp NULL DEFAULT NULL,
  `voided_reason` varchar(255) 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,
  `soap_type_id` char(2) NOT NULL,
  `state_type_id` char(2) NOT NULL,
  `prefix` char(2) NOT NULL DEFAULT 'NV',
  `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,
  `currency_type_id` varchar(255) NOT NULL,
  `payment_condition_id` char(2) NOT NULL DEFAULT '01',
  `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',
  `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,
  `coupon_id` int(10) unsigned DEFAULT NULL,
  `coupon_code` varchar(50) DEFAULT 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_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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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_suscription_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,
  `total_points` double(8,2) NOT NULL DEFAULT 0.00,
  `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,
  `prescription_doctor_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sale_notes_unique_filename_unique` (`unique_filename`),
  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_soap_type_id_foreign` (`soap_type_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`),
  KEY `sale_notes_payment_condition_id_foreign` (`payment_condition_id`),
  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_condition_id_foreign` FOREIGN KEY (`payment_condition_id`) REFERENCES `payment_conditions` (`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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

SET autocommit=0;
COMMIT;

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

--
-- Table structure for table `sale_note_fee`
--

CREATE TABLE `sale_note_fee` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_note_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` varchar(2) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_note_fee_sale_note_id_foreign` (`sale_note_id`),
  KEY `sale_note_fee_currency_type_id_foreign` (`currency_type_id`),
  KEY `sale_note_fee_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `sale_note_fee_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `sale_note_fee_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `sale_note_fee_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_fee`
--

SET autocommit=0;
COMMIT;

-- Dumped table `sale_note_fee` with 0 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,
  `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,
  `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,
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
