--
-- Host: localhost    Database: tenancy_campero
-- ------------------------------------------------------


--
-- Table structure for table `account_payments`
--

CREATE TABLE `account_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date_of_payment` date NOT NULL,
  `date_of_payment_real` date DEFAULT NULL,
  `reference_id` int(10) unsigned DEFAULT NULL,
  `payment_method_type_id` int(10) unsigned DEFAULT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` int(10) unsigned DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  `state` tinyint(1) NOT NULL DEFAULT 0,
  `reference_payment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `account_payments`
--


--
-- Table structure for table `accounting_ledger`
--

CREATE TABLE `accounting_ledger` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `month` smallint(5) unsigned DEFAULT 0 COMMENT 'Numero de mes',
  `year` mediumint(8) unsigned DEFAULT 0 COMMENT 'Numero de mes',
  `date_of_report` date DEFAULT NULL,
  `code_account` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Codigo de plan de cuenta',
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de cuenta',
  `last_month_total` double(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Debe ser el valor del total del mes pasado',
  `credits` double(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Créditos en el mes',
  `debs` double(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Debitos en el mes',
  `final_total` double(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Saldo Final de mes',
  `serialize_data` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'datos serialziados en bruto.',
  `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 `accounting_ledger`
--


--
-- Table structure for table `accounting_ledger_task`
--

CREATE TABLE `accounting_ledger_task` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `month` smallint(5) unsigned DEFAULT 0 COMMENT 'Numero de mes',
  `year` mediumint(8) unsigned DEFAULT 0 COMMENT 'Numero de mes',
  `last_rum` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `accounting_ledger_task`
--


--
-- Table structure for table `accounts`
--

CREATE TABLE `accounts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci 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 `accounts`
--


--
-- Table structure for table `agents`
--

CREATE TABLE `agents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `internal_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telephone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `agents_internal_id_unique` (`internal_id`),
  KEY `agents_name_index` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `agents`
--


--
-- Table structure for table `app_configurations`
--

CREATE TABLE `app_configurations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `show_image_item` tinyint(1) NOT NULL DEFAULT 1,
  `print_format_pdf` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ticket',
  `card_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'multicolored',
  `theme_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'blue',
  `header_waves` tinyint(1) NOT NULL DEFAULT 0,
  `direct_send_documents_whatsapp` tinyint(1) NOT NULL DEFAULT 0,
  `direct_print` tinyint(1) NOT NULL DEFAULT 0,
  `app_mode` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default',
  `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 `app_configurations`
--

INSERT INTO `app_configurations` VALUES (1,1,'ticket','multicolored','blue',0,0,0,'default','2022-11-24 16:24:25','2022-11-24 16:24:25');

--
-- Table structure for table `app_module_user`
--

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

--
-- Dumping data for table `app_module_user`
--

INSERT INTO `app_module_user` VALUES (1,1,1),(2,2,1),(3,3,1),(4,4,1),(5,5,1),(6,6,1),(7,7,1),(8,8,1),(9,9,1),(10,10,1),(11,11,1),(12,12,1),(13,13,1);

--
-- Table structure for table `app_modules`
--

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

--
-- Dumping data for table `app_modules`
--

INSERT INTO `app_modules` VALUES (1,'invoice','Factura electrónica',1,NULL,NULL),(2,'invoice-ticket','Boleta electrónica',2,NULL,NULL),(3,'sale-note','Nota de venta',3,NULL,NULL),(4,'order-note','Pedido',4,NULL,NULL),(5,'purchase','Compra',5,NULL,NULL),(6,'documents','Lista de comprobantes',6,NULL,NULL),(7,'report-sales','Reportes',7,NULL,NULL),(8,'validate-document','Validar cpe',8,NULL,NULL),(9,'customers','Clientes',9,NULL,NULL),(10,'items','Productos',10,NULL,NULL),(11,'cash','Caja',11,NULL,NULL),(12,'configuration','Configuración',12,NULL,NULL),(13,'quotation','Cotización',13,NULL,NULL);

--
-- Table structure for table `bank_accounts`
--

CREATE TABLE `bank_accounts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bank_id` int(10) unsigned NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `cci` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `initial_balance` decimal(12,2) NOT NULL DEFAULT 0.00,
  `show_in_documents` tinyint(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  KEY `bank_accounts_bank_id_foreign` (`bank_id`),
  KEY `bank_accounts_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `bank_accounts_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`),
  CONSTRAINT `bank_accounts_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_accounts`
--


--
-- Table structure for table `bank_loan_fee`
--

CREATE TABLE `bank_loan_fee` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bank_loan_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Relacion con el metodo de pago, Nulo es pago a cuotas',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_loan_fee`
--


--
-- Table structure for table `bank_loan_items`
--

CREATE TABLE `bank_loan_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bank_loan_id` int(10) unsigned NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `total` decimal(12,2) DEFAULT 0.00,
  `total_interest` decimal(12,2) DEFAULT 0.00,
  `total_ingress` decimal(12,2) DEFAULT 0.00,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_loan_items`
--


--
-- Table structure for table `bank_loan_payments`
--

CREATE TABLE `bank_loan_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bank_loan_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_loan_payments`
--


--
-- Table structure for table `bank_loan_reasons`
--

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

--
-- Dumping data for table `bank_loan_reasons`
--

INSERT INTO `bank_loan_reasons` VALUES (1,'Varios');

--
-- Table structure for table `bank_loan_types`
--

CREATE TABLE `bank_loan_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT 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 `bank_loan_types`
--

INSERT INTO `bank_loan_types` VALUES (1,'Prestamo','2022-11-24 16:24:23','2022-11-24 16:24:23');

--
-- Table structure for table `bank_loans`
--

CREATE TABLE `bank_loans` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `bank_loan_type_id` int(10) unsigned NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `bank_id` int(10) unsigned NOT NULL,
  `bank_account_id` int(10) unsigned NOT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `bank` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`bank`)),
  `exchange_rate_sale` decimal(12,2) DEFAULT 0.00,
  `total` decimal(12,2) DEFAULT 0.00,
  `total_interest` decimal(12,2) DEFAULT 0.00,
  `total_ingress` decimal(12,2) DEFAULT 0.00,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `state_type_id` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_loans`
--


--
-- Table structure for table `banks`
--

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

--
-- Dumping data for table `banks`
--

INSERT INTO `banks` VALUES (1,'BANCO SCOTIABANK',NULL,NULL,1),(2,'BANCO DE CREDITO DEL PERU',NULL,NULL,1),(3,'BANCO DE COMERCIO',NULL,NULL,1),(4,'BANCO PICHINCHA',NULL,NULL,1),(5,'BBVA CONTINENTAL',NULL,NULL,1),(6,'INTERBANK',NULL,NULL,1);

--
-- Table structure for table `billing_cycles`
--

CREATE TABLE `billing_cycles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date_time_start` datetime NOT NULL,
  `renew` tinyint(1) NOT NULL DEFAULT 0,
  `quantity_documents` int(11) 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 `billing_cycles`
--


--
-- Table structure for table `brands`
--

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

--
-- Dumping data for table `brands`
--


--
-- Table structure for table `business_turns`
--

CREATE TABLE `business_turns` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` 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=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `business_turns`
--

INSERT INTO `business_turns` VALUES (1,'hotel','Hoteles',0,'2022-11-24 16:24:13','2022-11-24 16:24:13'),(2,'transport','Empresa de transporte de pasajeros',0,'2022-11-24 16:24:13','2022-11-24 16:24:13'),(3,'restaurant','Restaurantes',0,'2022-11-24 16:24:13','2022-11-24 16:24:13'),(4,'tap','Grifos',0,'2022-11-24 16:24:13','2022-11-24 16:24:13');

--
-- Table structure for table `card_brands`
--

CREATE TABLE `card_brands` (
  `id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `card_brands_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `card_brands`
--

INSERT INTO `card_brands` VALUES ('01','Visa',1),('02','Mastercard',1);

--
-- Table structure for table `cash`
--

CREATE TABLE `cash` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `date_opening` date NOT NULL,
  `time_opening` time NOT NULL,
  `date_closed` date DEFAULT NULL,
  `time_closed` time DEFAULT NULL,
  `beginning_balance` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `final_balance` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `income` decimal(12,4) NOT NULL DEFAULT 0.0000,
  `state` tinyint(1) NOT NULL DEFAULT 0,
  `reference_number` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `apply_restaurant` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `cash_user_id_foreign` (`user_id`),
  KEY `cash_date_opening_index` (`date_opening`),
  KEY `cash_income_index` (`income`),
  KEY `cash_state_index` (`state`),
  KEY `cash_reference_number_index` (`reference_number`),
  CONSTRAINT `cash_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cash`
--

INSERT INTO `cash` VALUES (1,1,'2022-11-26','14:39:24',NULL,NULL,0.0000,0.0000,0.0000,1,NULL,'2022-11-26 14:39:24','2022-11-26 14:39:24',0),(2,2,'2022-12-06','15:58:58',NULL,NULL,0.0000,0.0000,0.0000,1,NULL,'2022-12-06 15:58:58','2022-12-06 15:58:58',0);

--
-- Table structure for table `cash_document_credits`
--

CREATE TABLE `cash_document_credits` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cash_id` int(10) unsigned NOT NULL,
  `cash_id_processed` int(10) unsigned DEFAULT NULL,
  `document_id` int(10) unsigned DEFAULT NULL,
  `sale_note_id` int(10) unsigned DEFAULT NULL,
  `status` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cash_document_credits_document_id_foreign` (`document_id`),
  KEY `cash_document_credits_sale_note_id_foreign` (`sale_note_id`),
  KEY `cash_document_credits_cash_id_foreign` (`cash_id`),
  CONSTRAINT `cash_document_credits_cash_id_foreign` FOREIGN KEY (`cash_id`) REFERENCES `cash` (`id`),
  CONSTRAINT `cash_document_credits_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),
  CONSTRAINT `cash_document_credits_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cash_document_credits`
--


--
-- Table structure for table `cash_documents`
--

CREATE TABLE `cash_documents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cash_id` int(10) unsigned NOT NULL,
  `document_id` int(10) unsigned DEFAULT NULL,
  `sale_note_id` int(10) unsigned DEFAULT NULL,
  `technical_service_id` int(10) unsigned DEFAULT NULL,
  `expense_payment_id` int(10) unsigned DEFAULT NULL,
  `purchase_id` int(10) unsigned DEFAULT NULL,
  `bank_loan_payment_id` int(10) unsigned DEFAULT NULL,
  `quotation_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cash_documents_cash_id_foreign` (`cash_id`),
  KEY `cash_documents_document_id_foreign` (`document_id`),
  KEY `cash_documents_sale_note_id_foreign` (`sale_note_id`),
  KEY `cash_documents_expense_payment_id_foreign` (`expense_payment_id`),
  KEY `cash_documents_technical_service_id_foreign` (`technical_service_id`),
  KEY `cash_documents_purchase_id_foreign` (`purchase_id`),
  KEY `cash_documents_quotation_id_foreign` (`quotation_id`),
  CONSTRAINT `cash_documents_cash_id_foreign` FOREIGN KEY (`cash_id`) REFERENCES `cash` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_documents_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_documents_expense_payment_id_foreign` FOREIGN KEY (`expense_payment_id`) REFERENCES `expense_payments` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_documents_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_documents_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `cash_documents_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_documents_technical_service_id_foreign` FOREIGN KEY (`technical_service_id`) REFERENCES `technical_services` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cash_documents`
--

INSERT INTO `cash_documents` VALUES (1,2,1,NULL,NULL,NULL,NULL,NULL,NULL),(2,2,2,NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `cash_transactions`
--

CREATE TABLE `cash_transactions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cash_id` int(10) unsigned NOT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment` decimal(14,4) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `cash_transactions_cash_id_foreign` (`cash_id`),
  KEY `cash_transactions_payment_method_type_id_foreign` (`payment_method_type_id`),
  CONSTRAINT `cash_transactions_cash_id_foreign` FOREIGN KEY (`cash_id`) REFERENCES `cash` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cash_transactions_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cash_transactions`
--

INSERT INTO `cash_transactions` VALUES (1,1,'01','2022-11-26','Saldo inicial',0.0000),(2,2,'01','2022-12-06','Saldo inicial',0.0000);

--
-- Table structure for table `cat_accounting_ledger_code_account`
--

CREATE TABLE `cat_accounting_ledger_code_account` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code_account` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Codigo de plan de cuenta',
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de cuenta',
  `disabled` tinyint(3) unsigned DEFAULT 0 COMMENT 'Permite realizar modificaciones',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_accounting_ledger_code_account`
--

INSERT INTO `cat_accounting_ledger_code_account` VALUES (1,'1','Activos',1,NULL,NULL),(2,'1.1','Activos corrientes',1,NULL,NULL),(3,'1.1.1','Efectivo y equivalentes de efectivo',1,NULL,NULL),(4,'1.1.1.1','Caja',1,NULL,NULL),(5,'1.1.1.2','Bancos',1,NULL,NULL),(6,'1.1.2','Deudores comerciales y otras cuentas por cobrar',1,NULL,NULL),(7,'1.1.2.0','Activos por impuestos corrientes',1,NULL,NULL),(8,'1.1.2.1','Otras cuentas por cobrar',1,NULL,NULL),(9,'1.1.3','Inventarios',1,NULL,NULL),(10,'1.1.4','Inversiones a corto plazo',1,NULL,NULL),(11,'1.1.5','Otros activos corrientes',1,NULL,NULL),(12,'1.2','Activos no corrientes',1,NULL,NULL),(13,'1.2.1','Propiedad, planta y equipo (Activos fijos)',1,NULL,NULL),(14,'1.2.2','Otros Activos no corrientes',1,NULL,NULL),(15,'2','Pasivos',1,NULL,NULL),(16,'2.1','Pasivos corrientes',1,NULL,NULL),(17,'2.1.1','Cuentas por pagar',1,NULL,NULL),(18,'2.1.1.1','Otras cuentas por pagar',1,NULL,NULL),(19,'2.1.2','Provisiones',1,NULL,NULL),(20,'2.1.3','Obligaciones laborales y de seguridad social',1,NULL,NULL),(21,'2.1.4','Pasivos por impuestos corrientes',1,NULL,NULL),(22,'2.1.4.1','Impuestos por pagar',1,NULL,NULL),(23,'2.1.4.2','Retenciones por pagar',1,NULL,NULL),(24,'2.1.5','Cuentas por pagar con costo financiero',1,NULL,NULL),(25,'2.1.6','Obligaciones financieras',1,NULL,NULL),(26,'2.1.6.1','Tarjetas de crédito',1,NULL,NULL),(27,'2.1.7','Otros pasivos corrientes',1,NULL,NULL),(28,'2.2','Pasivos no corrientes',1,NULL,NULL),(29,'2.2.1','Préstamos a largo plazo',1,NULL,NULL),(30,'2.2.2','Otros pasivos no corrientes',1,NULL,NULL),(31,'3','Patrimonio',1,NULL,NULL),(32,'3.1','Capital social',1,NULL,NULL),(33,'3.2','Ganancias acumuladas',1,NULL,NULL),(34,'3.3','Ajustes por saldos iniciales',1,NULL,NULL),(35,'3.3.1','Ajustes iniciales en bancos',1,NULL,NULL),(36,'3.3.2','Ajustes iniciales en inventario',1,NULL,NULL),(37,'4','Ingresos',1,NULL,NULL),(38,'4.1','Ingresos de actividades ordinarias',1,NULL,NULL),(39,'4.2','Otros Ingresos',1,NULL,NULL),(40,'4.2.1','Otros ingresos diversos',1,NULL,NULL);

--
-- Table structure for table `cat_address_types`
--

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

--
-- Dumping data for table `cat_address_types`
--

INSERT INTO `cat_address_types` VALUES ('01','Punto de venta'),('02','Producción'),('03','Extracción'),('04','Explotación'),('05','Otros');

--
-- Table structure for table `cat_affectation_igv_types`
--

CREATE TABLE `cat_affectation_igv_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `exportation` tinyint(1) DEFAULT NULL,
  `free` tinyint(1) DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_affectation_igv_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_affectation_igv_types`
--

INSERT INTO `cat_affectation_igv_types` VALUES ('10',1,0,0,'Gravado - Operación Onerosa'),('11',1,0,1,'Gravado – Retiro por premio'),('12',1,0,1,'Gravado – Retiro por donación'),('13',1,0,1,'Gravado – Retiro'),('14',1,0,1,'Gravado – Retiro por publicidad'),('15',1,0,1,'Gravado – Bonificaciones'),('16',1,0,1,'Gravado – Retiro por entrega a trabajadores'),('17',0,0,1,'Gravado – IVAP'),('20',1,0,0,'Exonerado - Operación Onerosa'),('21',1,0,1,'Exonerado – Transferencia Gratuita'),('30',1,0,0,'Inafecto - Operación Onerosa'),('31',1,0,1,'Inafecto – Retiro por Bonificación'),('32',1,0,1,'Inafecto – Retiro'),('33',1,0,1,'Inafecto – Retiro por Muestras Médicas'),('34',1,0,1,'Inafecto - Retiro por Convenio Colectivo'),('35',1,0,1,'Inafecto – Retiro por premio'),('36',1,0,1,'Inafecto - Retiro por publicidad'),('37',1,0,1,'Inafecto - Transferencia gratuita'),('40',1,1,0,'Exportación de bienes o servicios');

--
-- Table structure for table `cat_attribute_types`
--

CREATE TABLE `cat_attribute_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_attribute_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_attribute_types`
--

INSERT INTO `cat_attribute_types` VALUES ('3001',1,'Detracciones: Recursos Hidrobiológicos-Matrícula de la embarcación'),('3002',1,'Detracciones: Recursos Hidrobiológicos-Nombre de la embarcación'),('3003',1,'Detracciones: Recursos Hidrobiológicos-Tipo de especie vendida'),('3004',1,'Detracciones: Recursos Hidrobiológicos-Lugar de descarga'),('3005',1,'Detracciones: Recursos Hidrobiológicos-Fecha de descarga'),('3006',1,'Detracciones: Recursos Hidrobiológicos-Cantidad de especie vendida'),('3050',1,'Transportre Terreste - Número de asiento'),('3051',1,'Transporte Terrestre - Información de manifiesto de pasajeros'),('3052',1,'Transporte Terrestre - Número de documento de identidad del pasajero'),('3053',1,'Transporte Terrestre - Tipo de documento de identidad del pasajero'),('3054',1,'Transporte Terrestre - Nombres y apellidos del pasajero'),('3055',1,'Transporte Terrestre - Ciudad o lugar de destino - Ubigeo'),('3056',1,'Transporte Terrestre - Ciudad o lugar de destino - Dirección detallada'),('3057',1,'Transporte Terrestre - Ciudad o lugar de origen - Ubigeo'),('3058',1,'Transporte Terrestre - Ciudad o lugar de origen - Dirección detallada'),('3059',1,'Transporte Terrestre - Fecha de inicio programado'),('3060',1,'Transporte Terrestre - Hora de inicio programado'),('4000',1,'Beneficio Hospedajes-Paquete turístico: Código de país de emisión del pasaporte'),('4001',1,'Beneficio Hospedajes: Código de país de residencia del sujeto no domiciliado'),('4002',1,'Beneficio Hospedajes: Fecha de ingreso al país'),('4003',1,'Beneficio Hospedajes: Fecha de Ingreso al Establecimiento'),('4004',1,'Beneficio Hospedajes: Fecha de Salida del Establecimiento'),('4005',1,'Beneficio Hospedajes: Número de Días de Permanencia'),('4006',1,'Beneficio Hospedajes: Fecha de Consumo'),('4007',1,'Beneficio Hospedajes-Paquete turístico: Nombres y apellidos del huesped'),('4008',1,'Beneficio Hospedajes-Paquete turístico: Tipo de documento de identidad del huesped'),('4009',1,'Beneficio Hospedajes-Paquete turístico: Número de documento de identidad del huesped'),('4030',1,'Carta Porte Aéreo:  Lugar de origen - Código de ubigeo'),('4031',1,'Carta Porte Aéreo:  Lugar de origen - Dirección detallada'),('4032',1,'Carta Porte Aéreo:  Lugar de destino - Código de ubigeo'),('4033',1,'Carta Porte Aéreo:  Lugar de destino - Dirección detallada'),('4040',1,'BVME transporte ferroviario: Pasajero - Apellidos y Nombres'),('4041',1,'BVME transporte ferroviario: Pasajero - Tipo de documento de identidad'),('4042',1,'BVME transporte ferroviario: Servicio transporte: Ciudad o lugar de origen - Código de ubigeo'),('4043',1,'BVME transporte ferroviario: Servicio transporte: Ciudad o lugar de origen - Dirección detallada'),('4044',1,'BVME transporte ferroviario: Servicio transporte: Ciudad o lugar de destino - Código de ubigeo'),('4045',1,'BVME transporte ferroviario: Servicio transporte: Ciudad o lugar de destino - Dirección detallada'),('4046',1,'BVME transporte ferroviario: Servicio transporte:Número de asiento'),('4047',1,'BVME transporte ferroviario: Servicio transporte: Hora programada de inicio de viaje'),('4048',1,'BVME transporte ferroviario: Servicio transporte: Fecha programada de inicio de viaje'),('4049',1,'BVME transporte ferroviario: Pasajero - Número de documento de identidad'),('4060',1,'Regalía Petrolera: Decreto Supremo de aprobación del contrato'),('4061',1,'Regalía Petrolera: Area de contrato (Lote)'),('4062',1,'Regalía Petrolera: Periodo de pago - Fecha de inicio'),('4063',1,'Regalía Petrolera: Periodo de pago - Fecha de fin'),('4064',1,'Regalía Petrolera: Fecha de Pago'),('5000',1,'Proveedores Estado: Número de Expediente'),('5001',1,'Proveedores Estado: Código de Unidad Ejecutora'),('5002',1,'Proveedores Estado: N° de Proceso de Selección'),('5003',1,'Proveedores Estado: N° de Contrato'),('5010',1,'Numero de Placa'),('5011',1,'Categoria'),('5012',1,'Marca'),('5013',1,'Modelo'),('5014',1,'Color'),('5015',1,'Motor'),('5016',1,'Combustible'),('5017',1,'Form. Rodante'),('5018',1,'VIN'),('5019',1,'Serie/Chasis'),('5020',1,'Año fabricacion'),('5021',1,'Año modelo'),('5022',1,'Version'),('5023',1,'Ejes'),('5024',1,'Asientos'),('5025',1,'Pasajeros'),('5026',1,'Ruedas'),('5027',1,'Carroceria'),('5028',1,'Potencia'),('5029',1,'Cilindros'),('5030',1,'Ciliindrada'),('5031',1,'Peso Bruto'),('5032',1,'Peso Neto'),('5033',1,'Carga Util'),('5034',1,'Longitud'),('5035',1,'Altura'),('5036',1,'Ancho'),('6000',1,'Comercialización de Oro:  Código Unico Concesión Minera'),('6001',1,'Comercialización de Oro:  N° declaración compromiso'),('6002',1,'Comercialización de Oro:  N° Reg. Especial .Comerci. Oro'),('6003',1,'Comercialización de Oro:  N° Resolución que autoriza Planta de Beneficio'),('6004',1,'Comercialización de Oro: Ley Mineral (% concent. oro)'),('7000',1,'Gastos Art. 37 Renta:  Número de Placa'),('7001',1,'Créditos Hipotecarios: Tipo de préstamo'),('7002',1,'Créditos Hipotecarios: Indicador de Primera Vivienda'),('7003',1,'Créditos Hipotecarios: Partida Registral'),('7004',1,'Créditos Hipotecarios: Número de contrato'),('7005',1,'Créditos Hipotecarios: Fecha de otorgamiento del crédito'),('7006',1,'Créditos Hipotecarios: Dirección del predio - Código de ubigeo'),('7007',1,'Créditos Hipotecarios: Dirección del predio - Dirección completa'),('7008',1,'Créditos Hipotecarios: Dirección del predio - Urbanización'),('7009',1,'Créditos Hipotecarios: Dirección del predio - Provincia'),('7010',1,'Créditos Hipotecarios: Dirección del predio - Distrito'),('7011',1,'Créditos Hipotecarios: Dirección del predio - Departamento'),('7020',1,'Partida Arancelaria');

--
-- Table structure for table `cat_charge_discount_types`
--

CREATE TABLE `cat_charge_discount_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `base` tinyint(1) NOT NULL,
  `level` enum('item','global') COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('discount','charge') COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_charge_discount_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_charge_discount_types`
--

INSERT INTO `cat_charge_discount_types` VALUES ('00',1,1,'item','discount','Descuentos que afectan la base imponible del IGV/IVAP'),('01',1,0,'item','discount','Descuentos que no afectan la base imponible del IGV/IVAP'),('02',1,1,'global','discount','Descuentos globales que afectan la base imponible del IGV/IVAP'),('03',1,0,'global','discount','Descuentos globales que no afectan la base imponible del IGV/IVAP'),('04',0,1,'global','discount','Descuentos globales por anticipos gravados que afectan la base imponible del IGV/IVAP'),('05',0,0,'global','discount','Descuentos globales por anticipos exonerados'),('06',0,0,'global','discount','Descuentos globales por anticipos inafectos'),('45',0,1,'global','charge','FISE'),('46',1,0,'global','charge','Recargo al consumo y/o propinas'),('47',1,1,'item','charge','Cargos que afectan la base imponible del IGV/IVAP'),('48',1,0,'item','charge','Cargos que no afectan la base imponible del IGV/IVAP'),('49',1,1,'global','charge','Cargos globales que afectan la base imponible del IGV/IVAP'),('50',1,0,'global','charge','Cargos globales que no afectan la base imponible del IGV/IVAP'),('51',0,1,'global','charge','Percepción venta interna'),('52',0,1,'global','charge','Percepción a la adquisición de combustible'),('53',0,1,'global','charge','Percepción realizada al agente de percepción con tasa especial'),('62',1,0,'global','discount','Retención del IGV');

--
-- Table structure for table `cat_colors_items`
--

CREATE TABLE `cat_colors_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre del color',
  `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 `cat_colors_items`
--


--
-- Table structure for table `cat_currency_types`
--

CREATE TABLE `cat_currency_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `symbol` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_currency_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_currency_types`
--

INSERT INTO `cat_currency_types` VALUES ('PEN',1,'S/','Soles'),('USD',1,'$','Dólares Americanos');

--
-- Table structure for table `cat_detraction_types`
--

CREATE TABLE `cat_detraction_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `percentage` decimal(6,2) NOT NULL,
  `operation_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_detraction_types_operation_type_id_foreign` (`operation_type_id`),
  KEY `cat_detraction_types_id_index` (`id`),
  CONSTRAINT `cat_detraction_types_operation_type_id_foreign` FOREIGN KEY (`operation_type_id`) REFERENCES `cat_operation_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_detraction_types`
--

INSERT INTO `cat_detraction_types` VALUES ('001',1,'Azúcar y melaza de caña',10.00,'1001'),('003',1,'Alcohol etílico',10.00,'1001'),('005',1,'Maíz amarillo duro',4.00,'1001'),('008',1,'Madera',4.00,'1001'),('016',1,'Aceite de pescado',10.00,'1001'),('019',1,'Arrendamiento de bienes',10.00,'1001'),('020',1,'Mantenimiento y reparación de bienes muebles',12.00,'1001'),('022',1,'Otros servicios empresariales',12.00,'1001'),('023',1,'Leche',4.00,'1001'),('025',1,'Fabricación de bienes por encargo',10.00,'1001'),('027',1,'Servicio de transporte de carga',4.00,'1004');

--
-- Table structure for table `cat_digemid`
--

CREATE TABLE `cat_digemid` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `item_id` int(10) unsigned NOT NULL COMMENT 'Id de la tabla de item',
  `cod_digemid` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Codigo digmid',
  `nom_prod` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Nombre segun digemid',
  `concent` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Dosificacion segun digemid',
  `nom_form_farm` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nom_form_farm_simplif` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `presentac` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fracciones` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fec_vcto_reg_sanitario` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `num_reg_san` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nom_titular` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `prices` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `max_prices` int(10) unsigned DEFAULT 0,
  `active` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `last_update` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_digemid`
--


--
-- Table structure for table `cat_document_types`
--

CREATE TABLE `cat_document_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `short` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_document_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_document_types`
--

INSERT INTO `cat_document_types` VALUES ('01',1,'FT','FACTURA ELECTRÓNICA'),('03',1,'BV','BOLETA DE VENTA ELECTRÓNICA'),('07',1,'NC','NOTA DE CRÉDITO'),('08',1,'ND','NOTA DE DÉBITO'),('09',1,NULL,'GUIA DE REMISIÓN REMITENTE'),('20',1,NULL,'COMPROBANTE DE RETENCIÓN ELECTRÓNICA'),('31',1,NULL,'Guía de remisión transportista'),('40',1,NULL,'COMPROBANTE DE PERCEPCIÓN ELECTRÓNICA'),('71',0,NULL,'Guia de remisión remitente complementaria'),('72',0,NULL,'Guia de remisión transportista complementaria'),('GU75',1,NULL,'GUÍA'),('NE76',1,NULL,'NOTA DE ENTRADA'),('80',1,NULL,'NOTA DE VENTA'),('02',1,NULL,'RECIBO POR HONORARIOS'),('14',1,NULL,'SERVICIOS PÚBLICOS'),('04',1,NULL,'LIQUIDACIÓN DE COMPRA'),('U2',1,NULL,'Guía de Ingreso Almacén'),('U3',1,NULL,'Guía de Salida Almacén'),('U4',1,NULL,'Guía de Transferencia Almacén');

--
-- Table structure for table `cat_identity_document_types`
--

CREATE TABLE `cat_identity_document_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_identity_document_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_identity_document_types`
--

INSERT INTO `cat_identity_document_types` VALUES ('0',1,'Doc.trib.no.dom.sin.ruc'),('1',1,'DNI'),('4',1,'CE'),('6',1,'RUC'),('7',1,'Pasaporte'),('A',0,'Ced. Diplomática de identidad'),('B',0,'Documento identidad país residencia-no.d'),('C',0,'Tax Identification Number - TIN – Doc Trib PP.NN'),('D',0,'Identification Number - IN – Doc Trib PP. JJ'),('E',0,'TAM- Tarjeta Andina de Migración');

--
-- Table structure for table `cat_item_mold_cavities`
--

CREATE TABLE `cat_item_mold_cavities` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de cavidades del molde',
  `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 `cat_item_mold_cavities`
--


--
-- Table structure for table `cat_item_mold_properties`
--

CREATE TABLE `cat_item_mold_properties` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de propiedades por molde',
  `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 `cat_item_mold_properties`
--


--
-- Table structure for table `cat_item_package_measurements`
--

CREATE TABLE `cat_item_package_measurements` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de medidas del paquete',
  `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 `cat_item_package_measurements`
--


--
-- Table structure for table `cat_item_product_family`
--

CREATE TABLE `cat_item_product_family` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de familia d eproductos',
  `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 `cat_item_product_family`
--


--
-- Table structure for table `cat_item_size`
--

CREATE TABLE `cat_item_size` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de unidad de medida',
  `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 `cat_item_size`
--


--
-- Table structure for table `cat_item_status`
--

CREATE TABLE `cat_item_status` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre del status',
  `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 `cat_item_status`
--


--
-- Table structure for table `cat_item_unit_business`
--

CREATE TABLE `cat_item_unit_business` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de unidad de negocio',
  `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 `cat_item_unit_business`
--


--
-- Table structure for table `cat_item_units_per_package`
--

CREATE TABLE `cat_item_units_per_package` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre de unidades por paquete',
  `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 `cat_item_units_per_package`
--


--
-- Table structure for table `cat_legend_types`
--

CREATE TABLE `cat_legend_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_legend_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_legend_types`
--

INSERT INTO `cat_legend_types` VALUES ('1000',1,'Monto en Letras'),('1002',1,'TRANSFERENCIA GRATUITA DE UN BIEN Y/O SERVICIO PRESTADO GRATUITAMENTE'),('2000',1,'COMPROBANTE DE PERCEPCIÓN'),('2001',1,'BIENES TRANSFERIDOS EN LA AMAZONÍA REGIÓN SELVA PARA SER CONSUMIDOS EN LA MISMA'),('2002',1,'SERVICIOS PRESTADOS EN LA AMAZONÍA  REGIÓN SELVA PARA SER CONSUMIDOS EN LA MISMA'),('2003',1,'CONTRATOS DE CONSTRUCCIÓN EJECUTADOS  EN LA AMAZONÍA REGIÓN SELVA'),('2004',1,'Agencia de Viaje - Paquete turístico'),('2005',1,'Venta realizada por emisor itinerante'),('2006',1,'Operación sujeta a detracción'),('2007',1,'Operación sujeta al IVAP'),('2008',1,'VENTA EXONERADA DEL IGV-ISC-IPM. PROHIBIDA LA VENTA FUERA DE LA ZONA COMERCIAL DE TACNA'),('2009',1,'PRIMERA VENTA DE MERCANCÍA IDENTIFICABLE ENTRE USUARIOS DE LA ZONA COMERCIAL'),('2010',1,'Restitucion Simplificado de Derechos Arancelarios');

--
-- Table structure for table `cat_note_credit_types`
--

CREATE TABLE `cat_note_credit_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_note_credit_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_note_credit_types`
--

INSERT INTO `cat_note_credit_types` VALUES ('01',1,'Anulación de la operación'),('02',1,'Anulación por error en el RUC'),('03',1,'Corrección por error en la descripción'),('04',1,'Descuento global'),('05',1,'Descuento por ítem'),('06',1,'Devolución total'),('07',1,'Devolución por ítem'),('08',1,'Bonificación'),('09',1,'Disminución en el valor'),('10',1,'Otros Conceptos'),('11',1,'Ajustes de operaciones de exportación'),('12',1,'Ajustes afectos al IVAP'),('13',1,'Ajustes – montos y/o fechas de pago');

--
-- Table structure for table `cat_note_debit_types`
--

CREATE TABLE `cat_note_debit_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_note_debit_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_note_debit_types`
--

INSERT INTO `cat_note_debit_types` VALUES ('01',1,'Intereses por mora'),('02',1,'Aumento en el valor'),('03',1,'Penalidades/ otros conceptos'),('10',1,'Ajustes de operaciones de exportación'),('11',1,'Ajustes afectos al IVAP');

--
-- Table structure for table `cat_operation_types`
--

CREATE TABLE `cat_operation_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `exportation` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_operation_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_operation_types`
--

INSERT INTO `cat_operation_types` VALUES ('0101',1,0,'Venta interna'),('0112',0,0,'Venta Interna - Sustenta Gastos Deducibles Persona Natural'),('0113',0,0,'Venta Interna - NRUS'),('0200',1,1,'Exportación de Bienes'),('0201',0,1,'Exportación de Servicios – Prestación servicios realizados íntegramente en el país'),('0202',0,1,'Exportación de Servicios – Prestación de servicios de hospedaje No Domiciliado'),('0203',0,1,'Exportación de Servicios – Transporte de navieras'),('0204',0,1,'Exportación de Servicios – Servicios a naves y aeronaves de bandera extranjera'),('0205',0,1,'Exportación de Servicios - Servicios que conformen un Paquete Turístico'),('0206',0,1,'Exportación de Servicios – Servicios complementarios al transporte de carga'),('0207',0,1,'Exportación de Servicios – Suministro de energía eléctrica a favor de sujetos domiciliados en ZED'),('0208',0,1,'Exportación de Servicios – Prestación servicios realizados parcialmente en el extranjero'),('0301',0,0,'Operaciones con Carta de porte aéreo (emitidas en el ámbito nacional)'),('0302',0,0,'Operaciones de Transporte ferroviario de pasajeros'),('0303',0,0,'Operaciones de Pago de regalía petrolera'),('0401',1,0,'Ventas no domiciliados que no califican como exportación'),('1001',1,0,'Operación Sujeta a Detracción'),('1002',0,0,'Operación Sujeta a Detracción- Recursos Hidrobiológicos'),('1003',0,0,'Operación Sujeta a Detracción- Servicios de Transporte Pasajeros'),('1004',1,0,'Operación Sujeta a Detracción- Servicios de Transporte Carga'),('2001',0,0,'Operación Sujeta a Percepción'),('0501',1,0,'Compra interna');

--
-- Table structure for table `cat_other_tax_concept_types`
--

CREATE TABLE `cat_other_tax_concept_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_other_tax_concept_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_other_tax_concept_types`
--

INSERT INTO `cat_other_tax_concept_types` VALUES ('1000',1,'Total valor de venta - operaciones exportadas'),('1001',1,'Total valor de venta - operaciones gravadas'),('1002',1,'Total valor de venta - operaciones inafectas'),('1003',1,'Total valor de venta - operaciones exoneradas'),('1004',1,'Total valor de venta – Operaciones gratuitas'),('1005',1,'Sub total de venta'),('2001',1,'Percepciones'),('2002',1,'Retenciones'),('2003',1,'Detracciones'),('2004',1,'Bonificaciones'),('2005',1,'Total descuentos'),('3001',1,'FISE (Ley 29852) Fondo Inclusión Social Energético');

--
-- Table structure for table `cat_payment_method_types`
--

CREATE TABLE `cat_payment_method_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_payment_method_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_payment_method_types`
--

INSERT INTO `cat_payment_method_types` VALUES ('001',1,'Depósito en cuenta'),('002',1,'Giro'),('003',1,'Transferencia de fondos'),('004',1,'Orden de pago'),('005',1,'Tarjeta de débito'),('006',1,'Tarjeta de crédito emitida en el país por una empresa del sistema financiero'),('007',1,'Cheques con la cláusula de \"NO NEGOCIABLE\", \"INTRANSFERIBLES\", \"NO A LA ORDEN\" u otra equivalente, a que se refiere el inciso g) del artículo 5° de la ley'),('008',1,'Efectivo, por operaciones en las que no existe obligación de utilizar medio de pago'),('009',1,'Efectivo, en los demás casos'),('010',1,'Medios de pago usados en comercio exterior'),('011',1,'Documentos emitidos por las EDPYMES y las cooperativas de ahorro y crédito no autorizadas a captar depósitos del público'),('012',1,'Tarjeta de crédito emitida en el país o en el exterior por una empresa no perteneciente al sistema financiero, cuyo objeto principal sea la emisión y administración de tarjetas de crédito'),('013',1,'Tarjetas de crédito emitidas en el exterior por empresas bancarias o financieras no domiciliadas'),('101',1,'Transferencias – Comercio exterior'),('102',1,'Cheques bancarios - Comercio exterior'),('103',1,'Orden de pago simple - Comercio exterior'),('104',1,'Orden de pago documentario - Comercio exterior'),('105',1,'Remesa simple - Comercio exterior'),('106',1,'Remesa documentaria - Comercio exterior'),('107',1,'Carta de crédito simple - Comercio exterior'),('108',1,'Carta de crédito documentario - Comercio exterior'),('999',1,'Otros medios de pago');

--
-- Table structure for table `cat_perception_types`
--

CREATE TABLE `cat_perception_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `percentage` decimal(10,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_perception_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_perception_types`
--

INSERT INTO `cat_perception_types` VALUES ('01',1,2.00,'Percepción Venta Interna'),('02',1,1.00,'Percepción a la adquisición de combustible'),('03',1,0.50,'Percepción realizada al agente de percepción con tasa especial');

--
-- Table structure for table `cat_periods`
--

CREATE TABLE `cat_periods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `period` char(1) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Define si es dia, mes o año - D/M/Y',
  `name` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nombre del periodo',
  `active` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si esta activo',
  `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 `cat_periods`
--

INSERT INTO `cat_periods` VALUES (1,'M','Mensual',1,NULL,NULL),(2,'Y','Anual',1,NULL,NULL);

--
-- Table structure for table `cat_price_types`
--

CREATE TABLE `cat_price_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_price_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_price_types`
--

INSERT INTO `cat_price_types` VALUES ('01',1,'Precio unitario (incluye el IGV)'),('02',1,'Valor referencial unitario en operaciones no onerosas');

--
-- Table structure for table `cat_related_documents_types`
--

CREATE TABLE `cat_related_documents_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_related_documents_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_related_documents_types`
--

INSERT INTO `cat_related_documents_types` VALUES ('01',1,'Numeración DAM'),('02',1,'Número de orden de entrega'),('03',1,'Número SCOP'),('04',1,'Número de manifiesto de carga'),('05',1,'Número de constancia de detracción'),('06',1,'Otros');

--
-- Table structure for table `cat_related_tax_document_types`
--

CREATE TABLE `cat_related_tax_document_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_related_tax_document_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_related_tax_document_types`
--

INSERT INTO `cat_related_tax_document_types` VALUES ('01',1,'Factura – emitida para corregir error en el RUC'),('02',1,'Factura – emitida por anticipos'),('03',1,'Boleta de Venta – emitida por anticipos'),('04',1,'Ticket de Salida - ENAPU'),('05',1,'Código SCOP'),('99',1,'Otros');

--
-- Table structure for table `cat_retention_types`
--

CREATE TABLE `cat_retention_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `percentage` decimal(10,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_retention_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_retention_types`
--

INSERT INTO `cat_retention_types` VALUES ('01',1,3.00,'Tasa 3%'),('02',1,6.00,'Tasa 6%');

--
-- Table structure for table `cat_summary_status_types`
--

CREATE TABLE `cat_summary_status_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_summary_status_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_summary_status_types`
--

INSERT INTO `cat_summary_status_types` VALUES ('1',1,'Adicionar'),('2',1,'Modificar'),('3',1,'Anulado');

--
-- Table structure for table `cat_system_isc_types`
--

CREATE TABLE `cat_system_isc_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_system_isc_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_system_isc_types`
--

INSERT INTO `cat_system_isc_types` VALUES ('01',1,'Sistema al valor'),('02',1,'Aplicación del Monto Fijo'),('03',1,'Sistema de Precios de Venta al Público');

--
-- Table structure for table `cat_transfer_reason_types`
--

CREATE TABLE `cat_transfer_reason_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `discount_stock` tinyint(1) DEFAULT 0,
  KEY `cat_transfer_reason_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_transfer_reason_types`
--

INSERT INTO `cat_transfer_reason_types` VALUES ('01',1,'Venta',0),('02',1,'Compra',0),('04',1,'Traslado entre establecimientos de la misma empresa',0),('08',1,'Importación',0),('09',1,'Exportación',0),('13',1,'Otros no comprendido en ningún código del presente catálogo',0),('14',1,'Venta sujeta a confirmación del comprador',0),('18',1,'Traslado emisor itinerante de comprobantes de pago Aquí no se está considerando el traslado a zona primaria.',0),('19',0,'Traslado a zona primaria',0),('03',1,'Venta con entrega a terceros',0),('05',1,'Consignación',0),('06',1,'Devolución',0),('07',1,'Recojo de bienes transformados',0),('17',1,'Traslado de bienes para transformación',0);

--
-- Table structure for table `cat_transport_mode_types`
--

CREATE TABLE `cat_transport_mode_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_transport_mode_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_transport_mode_types`
--

INSERT INTO `cat_transport_mode_types` VALUES ('01',1,'Transporte público'),('02',1,'Transporte privado');

--
-- Table structure for table `cat_unit_types`
--

CREATE TABLE `cat_unit_types` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `symbol` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  KEY `cat_unit_types_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cat_unit_types`
--

INSERT INTO `cat_unit_types` VALUES ('ZZ',1,NULL,'Servicio'),('BX',1,NULL,'Caja'),('GLL',1,NULL,'Galones'),('GRM',1,NULL,'Gramos'),('KGM',1,NULL,'Kilos'),('LTR',1,NULL,'Litros'),('MTR',1,NULL,'Metros'),('FOT',1,NULL,'Pies'),('INH',1,NULL,'Pulgadas'),('NIU',1,NULL,'Unidades'),('YRD',1,NULL,'Yardas'),('HUR',1,NULL,'Hora'),('TM',0,NULL,'Toneladas'),('TNE',1,NULL,'Toneladas');

--
-- Table structure for table `categories`
--

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

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` VALUES (1,'PLATOS CHIFA','2022-11-26 14:38:39','2022-11-26 14:38:39'),(2,'PLATOS ESPECIALES','2022-11-26 14:38:40','2022-11-26 14:38:40'),(3,'POLLO A LA BRASA','2022-11-26 14:38:40','2022-11-26 14:38:40'),(4,'PARRILLAS','2022-11-26 14:38:40','2022-11-26 14:38:40'),(5,'BEBIDAS HELADAS','2022-11-26 14:38:41','2022-11-26 14:38:41'),(6,'BEBIDAS CALIENTES','2022-11-26 14:38:41','2022-11-26 14:38:41'),(7,'GASEOSAS','2022-11-26 14:38:41','2022-11-26 14:38:41'),(8,'CERVEZAS','2022-11-26 14:38:41','2022-11-26 14:38:41'),(9,'PLATOS A LA CARTA','2022-11-26 14:38:41','2022-11-26 14:38:41'),(10,'PARRILLAS MIXTAS','2022-11-26 14:38:42','2022-11-26 14:38:42');

--
-- Table structure for table `charge_padrones`
--

CREATE TABLE `charge_padrones` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `state` tinyint(1) NOT NULL DEFAULT 0,
  `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 `charge_padrones`
--


--
-- Table structure for table `client_error_types`
--

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

--
-- Dumping data for table `client_error_types`
--

INSERT INTO `client_error_types` VALUES ('data_entry','Errores de ingreso de datos'),('token_creation','Errores en la creación del token de tarjeta');

--
-- Table structure for table `client_errors`
--

CREATE TABLE `client_errors` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_error_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_message` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_message` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `client_errors_client_error_type_id_foreign` (`client_error_type_id`),
  KEY `client_errors_code_index` (`code`),
  CONSTRAINT `client_errors_client_error_type_id_foreign` FOREIGN KEY (`client_error_type_id`) REFERENCES `client_error_types` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `client_errors`
--

INSERT INTO `client_errors` VALUES (1,'205','data_entry','parameter cardNumber can not be null/empty','Ingresa el número de tu tarjeta.'),(2,'208','data_entry','parameter cardExpirationMonth can not be null/empty','Elige un mes.'),(3,'209','data_entry','parameter cardExpirationYear can not be null/empty','Elige un año.'),(4,'212','data_entry','parameter docType can not be null/empty','Ingresa tu tipo de documento.'),(5,'213','data_entry','The parameter cardholder.document.subtype can not be null or empty','Ingresa tu documento.'),(6,'214','data_entry','parameter docNumber can not be null/empty','Ingresa tu documento.'),(7,'220','data_entry','parameter cardIssuerId can not be null/empty','Ingresa tu banco.'),(8,'221','data_entry','parameter cardholderName can not be null/empty','Ingresa el nombre y apellido.'),(9,'224','data_entry','parameter securityCode can not be null/empty','Ingresa el código de seguridad.'),(10,'E301','data_entry','invalid parameter cardNumber','Ingresa un número de tarjeta válido.'),(11,'E302','data_entry','invalid parameter securityCode','Revisa el código de seguridad.'),(12,'316','data_entry','invalid parameter cardholderName','Ingresa un nombre válido.'),(13,'322','data_entry','	invalid parameter docType','El tipo de documento es inválido.'),(14,'323','data_entry','invalid parameter cardholder.document.subtype','Revisa tu documento.'),(15,'324','data_entry','invalid parameter docNumber','El documento es inválido.'),(16,'325','data_entry','invalid parameter cardExpirationMonth','El mes es inválido'),(17,'326','data_entry','invalid parameter cardExpirationYear','El año es inválido'),(18,'default','data_entry','Otro código de error','Revisa los datos.'),(19,'106','token_creation','Cannot operate between users from different countries','No puedes realizar pagos a otros países.'),(20,'109','token_creation','Invalid number of shares for this payment_method_id','El medio de pago no procesa pagos en installments cuotas. Elige otra tarjeta u otro medio de pago.'),(21,'126','token_creation','The action requested is not valid for the current payment state','No pudimos procesar tu pago.'),(22,'129','token_creation','Cannot pay this amount with this paymentMethod','El medio de pago no procesa pagos del monto seleccionado. Elige otra tarjeta u otro medio de pago.'),(23,'145','token_creation','Invalid users involved','Una de las partes con la que intentas hacer el pago es de prueba y la otra es usuario real.'),(24,'150','token_creation','The payer_id cannot do payments currently','No puedes realizar pagos.'),(25,'151','token_creation','The payer_id cannot do payments with this payment_method_id','No puedes realizar pagos.'),(26,'160','token_creation','Collector not allowed to operate','No pudimos procesar tu pago.'),(27,'204','token_creation','Unavailable payment_method','El medio de pago no está disponible en este momento. Elige otra tarjeta u otro medio de pago.'),(28,'801','token_creation','Already posted the same request in the last minute','Realizaste un pago similar hace instantes. Intenta de nuevo en unos minutos.'),(29,'default','token_creation','Otro código de error','No pudimos procesar tu pago.');

--
-- Table structure for table `columns_to_reports`
--

CREATE TABLE `columns_to_reports` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `report` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `columns` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`columns`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `columns_to_reports_user_id_foreign` (`user_id`),
  CONSTRAINT `columns_to_reports_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `columns_to_reports`
--

INSERT INTO `columns_to_reports` VALUES (1,1,'client_index','{\"observation\":{\"title\":\"Observacion\",\"visible\":false},\"zone\":{\"title\":\"Zona\",\"visible\":false},\"website\":{\"title\":\"Sitio Web\",\"visible\":false},\"person_type\":{\"title\":\"Tipo de cliente\",\"visible\":false},\"credit_days\":{\"title\":\"D\\u00edas de cr\\u00e9dito\",\"visible\":false},\"seller\":{\"title\":\"Vendedor asignado\",\"visible\":false},\"email\":{\"title\":\"Correo electr\\u00f3nico\",\"visible\":false},\"telephone\":{\"title\":\"Tel\\u00e9fono\",\"visible\":false},\"department\":{\"title\":\"Departamento\",\"visible\":false},\"province\":{\"title\":\"Provincia\",\"visible\":false},\"district\":{\"title\":\"Distrito\",\"visible\":false}}','2022-11-26 14:43:41','2022-11-26 14:43:41'),(2,2,'document_index','{\"notes\":{\"title\":\"Notas C\\/D\",\"visible\":false},\"dispatch\":{\"title\":\"Gu\\u00eda de Remisi\\u00f3n\",\"visible\":false},\"plate_numbers\":{\"title\":\"Placa\",\"visible\":false},\"user_name\":{\"title\":\"Usuario\",\"visible\":false},\"exchange_rate_sale\":{\"title\":\"Tipo de cambio\",\"visible\":false},\"total_exportation\":{\"title\":\"T.Exportaci\\u00f3n\",\"visible\":false},\"total_free\":{\"title\":\"T.Gratuito\",\"visible\":false},\"total_unaffected\":{\"title\":\"T.Inafecto\",\"visible\":false},\"total_exonerated\":{\"title\":\"T.Exonerado\",\"visible\":true},\"date_of_due\":{\"title\":\"F. Vencimiento\",\"visible\":false},\"guides\":{\"title\":\"Guias\",\"visible\":false},\"sales_note\":{\"title\":\"Nota de ventas\",\"visible\":false},\"order_note\":{\"title\":\"Pedidos\",\"visible\":false},\"send_it\":{\"title\":\"Correo enviado al destinatario\",\"visible\":false},\"total\":{\"title\":\"Total\",\"visible\":false},\"currency_type_id\":{\"title\":\"Moneda\",\"visible\":false},\"purchase_order\":{\"title\":\"Orden de Compra\",\"visible\":false},\"soap_type\":{\"title\":\"Soap\",\"visible\":false},\"balance\":{\"title\":\"Saldo\",\"visible\":false},\"total_charge\":{\"title\":\"T.Cargos\",\"visible\":false},\"date_payment\":{\"title\":\"Fecha de pago\",\"visible\":false}}','2022-12-06 16:02:17','2022-12-14 07:54:17'),(3,1,'document_index','{\"notes\":{\"title\":\"Notas C\\/D\",\"visible\":false},\"dispatch\":{\"title\":\"Gu\\u00eda de Remisi\\u00f3n\",\"visible\":false},\"plate_numbers\":{\"title\":\"Placa\",\"visible\":false},\"user_name\":{\"title\":\"Usuario\",\"visible\":false},\"exchange_rate_sale\":{\"title\":\"Tipo de cambio\",\"visible\":false},\"total_exportation\":{\"title\":\"T.Exportaci\\u00f3n\",\"visible\":false},\"total_free\":{\"title\":\"T.Gratuito\",\"visible\":false},\"total_unaffected\":{\"title\":\"T.Inafecto\",\"visible\":false},\"total_exonerated\":{\"title\":\"T.Exonerado\",\"visible\":true},\"date_of_due\":{\"title\":\"F. Vencimiento\",\"visible\":false},\"guides\":{\"title\":\"Guias\",\"visible\":false},\"sales_note\":{\"title\":\"Nota de ventas\",\"visible\":false},\"order_note\":{\"title\":\"Pedidos\",\"visible\":false},\"send_it\":{\"title\":\"Correo enviado al destinatario\",\"visible\":false},\"total\":{\"title\":\"Total\",\"visible\":false},\"currency_type_id\":{\"title\":\"Moneda\",\"visible\":false},\"purchase_order\":{\"title\":\"Orden de Compra\",\"visible\":false},\"soap_type\":{\"title\":\"Soap\",\"visible\":false},\"balance\":{\"title\":\"Saldo\",\"visible\":false},\"total_charge\":{\"title\":\"T.Cargos\",\"visible\":false},\"date_payment\":{\"title\":\"Fecha de pago\",\"visible\":false}}','2022-12-06 18:15:16','2022-12-06 18:15:26');

--
-- Table structure for table `company_accounts`
--

CREATE TABLE `company_accounts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `subtotal_pen` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_pen` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `igv_pen` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subtotal_usd` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_usd` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `igv_usd` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_accounts`
--

INSERT INTO `company_accounts` VALUES (1,'70111','12121','40111','70111','12122','40111');

--
-- Table structure for table `configuration_ecommerce`
--

CREATE TABLE `configuration_ecommerce` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `information_contact_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `information_contact_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `information_contact_phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `information_contact_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_whatsapp` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `script_paypal` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `link_youtube` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `link_twitter` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `link_facebook` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tag_support` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tag_dollar` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tag_shipping` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `token_public_culqui` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `token_private_culqui` text COLLATE utf8mb4_unicode_ci 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 `configuration_ecommerce`
--

INSERT INTO `configuration_ecommerce` VALUES (1,'Admin','admin@mail.com','01 505-5555',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `configuration_mi_tienda_pe`
--

CREATE TABLE `configuration_mi_tienda_pe` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `establishment_id` int(10) unsigned DEFAULT 1,
  `series_order_note_id` int(10) unsigned DEFAULT 0,
  `series_document_ft_id` int(10) unsigned DEFAULT 0,
  `series_document_bt_id` int(10) unsigned DEFAULT 0,
  `user_id` int(10) unsigned DEFAULT 0,
  `payment_destination_id` int(10) unsigned DEFAULT 0,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `autogenerate` tinyint(3) unsigned DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `configuration_mi_tienda_pe`
--


--
-- Table structure for table `contract_items`
--

CREATE TABLE `contract_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `contract_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `name_product_pdf` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contract_items_contract_id_foreign` (`contract_id`),
  KEY `contract_items_item_id_foreign` (`item_id`),
  KEY `contract_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `contract_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `contract_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `contract_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `contract_items_contract_id_foreign` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `contract_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `contract_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `contract_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 `contract_items`
--


--
-- Table structure for table `contract_payments`
--

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

--
-- Dumping data for table `contract_payments`
--


--
-- Table structure for table `contract_state_types`
--

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

--
-- Dumping data for table `contract_state_types`
--

INSERT INTO `contract_state_types` VALUES ('01','Registrado'),('05','Entregado'),('09','Rechazado');

--
-- Table structure for table `contracts`
--

CREATE TABLE `contracts` (
  `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) COLLATE utf8mb4_unicode_ci NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `establishment` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`establishment`)),
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `prefix` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `delivery_date` date DEFAULT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `customer` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`customer`)),
  `shipping_address` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `total_prepayment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exportation` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_free` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxed` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_unaffected` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exonerated` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_igv` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`prepayments`)),
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`guides`)),
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`related`)),
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`perception`)),
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`detraction`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `terms_condition` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `account_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `changed` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `quotation_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contracts_user_id_foreign` (`user_id`),
  KEY `contracts_establishment_id_foreign` (`establishment_id`),
  KEY `contracts_customer_id_foreign` (`customer_id`),
  KEY `contracts_soap_type_id_foreign` (`soap_type_id`),
  KEY `contracts_currency_type_id_foreign` (`currency_type_id`),
  KEY `contracts_payment_method_type_id_foreign` (`payment_method_type_id`),
  KEY `contracts_quotation_id_foreign` (`quotation_id`),
  KEY `contracts_state_type_id_foreign` (`state_type_id`),
  CONSTRAINT `contracts_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `contracts_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `contracts_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `contracts_payment_method_type_id_foreign` FOREIGN KEY (`payment_method_type_id`) REFERENCES `payment_method_types` (`id`),
  CONSTRAINT `contracts_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `contracts_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `contracts_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `contract_state_types` (`id`),
  CONSTRAINT `contracts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `contracts`
--


--
-- Table structure for table `countries`
--

CREATE TABLE `countries` (
  `id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `countries_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `countries`
--

INSERT INTO `countries` VALUES ('AX','AALAND ISLANDS',1),('AF','AFGHANISTAN',1),('AL','ALBANIA',1),('DZ','ALGERIA',1),('AS','AMERICAN SAMOA',1),('AD','ANDORRA',1),('AO','ANGOLA',1),('AI','ANGUILLA',1),('AQ','ANTARCTICA',1),('AG','ANTIGUA AND BARBUDA',1),('AR','ARGENTINA',1),('AM','ARMENIA',1),('AW','ARUBA',1),('AU','AUSTRALIA',1),('AT','AUSTRIA',1),('AZ','AZERBAIJAN',1),('BS','BAHAMAS',1),('BH','BAHRAIN',1),('BD','BANGLADESH',1),('BB','BARBADOS',1),('BY','BELARUS',1),('BE','BELGIUM',1),('BZ','BELIZE',1),('BJ','BENIN',1),('BM','BERMUDA',1),('BT','BHUTAN',1),('BO','BOLIVIA',1),('BA','BOSNIA AND HERZEGOWINA',1),('BW','BOTSWANA',1),('BV','BOUVET ISLAND',1),('BR','BRAZIL',1),('IO','BRITISH INDIAN OCEAN TERRITORY',1),('BN','BRUNEI DARUSSALAM',1),('BG','BULGARIA',1),('BF','BURKINA FASO',1),('BI','BURUNDI',1),('KH','CAMBODIA',1),('CM','CAMEROON',1),('CA','CANADA',1),('CV','CAPE VERDE',1),('KY','CAYMAN ISLANDS',1),('CF','CENTRAL AFRICAN REPUBLIC',1),('TD','CHAD',1),('CL','CHILE',1),('CN','CHINA',1),('CX','CHRISTMAS ISLAND',1),('CC','COCOS (KEELING) ISLANDS',1),('CO','COLOMBIA',1),('KM','COMOROS',1),('CD','CONGO, Democratic Republic of (was Zaire)',1),('CG','CONGO, Republic of',1),('CK','COOK ISLANDS',1),('CR','COSTA RICA',1),('CI','COTE D`IVOIRE',1),('HR','CROATIA (local name: Hrvatska)',1),('CU','CUBA',1),('CY','CYPRUS',1),('CZ','CZECH REPUBLIC',1),('DK','DENMARK',1),('DJ','DJIBOUTI',1),('DM','DOMINICA',1),('DO','DOMINICAN REPUBLIC',1),('EC','ECUADOR',1),('EG','EGYPT',1),('SV','EL SALVADOR',1),('GQ','EQUATORIAL GUINEA',1),('ER','ERITREA',1),('EE','ESTONIA',1),('ET','ETHIOPIA',1),('FK','FALKLAND ISLANDS (MALVINAS)',1),('FO','FAROE ISLANDS',1),('FJ','FIJI',1),('FI','FINLAND',1),('FR','FRANCE',1),('GF','FRENCH GUIANA',1),('PF','FRENCH POLYNESIA',1),('TF','FRENCH SOUTHERN TERRITORIES',1),('GA','GABON',1),('GM','GAMBIA',1),('GE','GEORGIA',1),('DE','GERMANY',1),('GH','GHANA',1),('GI','GIBRALTAR',1),('GR','GREECE',1),('GL','GREENLAND',1),('GD','GRENADA',1),('GP','GUADELOUPE',1),('GU','GUAM',1),('GT','GUATEMALA',1),('GN','GUINEA',1),('GW','GUINEA-BISSAU',1),('GY','GUYANA',1),('HT','HAITI',1),('HM','HEARD AND MC DONALD ISLANDS',1),('HN','HONDURAS',1),('HK','HONG KONG',1),('HU','HUNGARY',1),('IS','ICELAND',1),('IN','INDIA',1),('ID','INDONESIA',1),('IR','IRAN (ISLAMIC REPUBLIC OF)',1),('IQ','IRAQ',1),('IE','IRELAND',1),('IL','ISRAEL',1),('IT','ITALY',1),('JM','JAMAICA',1),('JP','JAPAN',1),('JO','JORDAN',1),('KZ','KAZAKHSTAN',1),('KE','KENYA',1),('KI','KIRIBATI',1),('KP','KOREA, DEMOCRATIC PEOPLE`S REPUBLIC OF',1),('KR','KOREA, REPUBLIC OF',1),('KW','KUWAIT',1),('KG','KYRGYZSTAN',1),('LA','LAO PEOPLE`S DEMOCRATIC REPUBLIC',1),('LV','LATVIA',1),('LB','LEBANON',1),('LS','LESOTHO',1),('LR','LIBERIA',1),('LY','LIBYAN ARAB JAMAHIRIYA',1),('LI','LIECHTENSTEIN',1),('LT','LITHUANIA',1),('LU','LUXEMBOURG',1),('MO','MACAU',1),('MK','MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',1),('MG','MADAGASCAR',1),('MW','MALAWI',1),('MY','MALAYSIA',1),('MV','MALDIVES',1),('ML','MALI',1),('MT','MALTA',1),('MH','MARSHALL ISLANDS',1),('MQ','MARTINIQUE',1),('MR','MAURITANIA',1),('MU','MAURITIUS',1),('YT','MAYOTTE',1),('MX','MEXICO',1),('FM','MICRONESIA, FEDERATED STATES OF',1),('MD','MOLDOVA, REPUBLIC OF',1),('MC','MONACO',1),('MN','MONGOLIA',1),('MS','MONTSERRAT',1),('MA','MOROCCO',1),('MZ','MOZAMBIQUE',1),('MM','MYANMAR',1),('NA','NAMIBIA',1),('NR','NAURU',1),('NP','NEPAL',1),('NL','NETHERLANDS',1),('AN','NETHERLANDS ANTILLES',1),('NC','NEW CALEDONIA',1),('NZ','NEW ZEALAND',1),('NI','NICARAGUA',1),('NE','NIGER',1),('NG','NIGERIA',1),('NU','NIUE',1),('NF','NORFOLK ISLAND',1),('MP','NORTHERN MARIANA ISLANDS',1),('NO','NORWAY',1),('OM','OMAN',1),('PK','PAKISTAN',1),('PW','PALAU',1),('PS','PALESTINIAN TERRITORY, Occupied',1),('PA','PANAMA',1),('PG','PAPUA NEW GUINEA',1),('PY','PARAGUAY',1),('PE','PERU',1),('PH','PHILIPPINES',1),('PN','PITCAIRN',1),('PL','POLAND',1),('PT','PORTUGAL',1),('PR','PUERTO RICO',1),('QA','QATAR',1),('RE','REUNION',1),('RO','ROMANIA',1),('RU','RUSSIAN FEDERATION',1),('RW','RWANDA',1),('SH','SAINT HELENA',1),('KN','SAINT KITTS AND NEVIS',1),('LC','SAINT LUCIA',1),('PM','SAINT PIERRE AND MIQUELON',1),('VC','SAINT VINCENT AND THE GRENADINES',1),('WS','SAMOA',1),('SM','SAN MARINO',1),('ST','SAO TOME AND PRINCIPE',1),('SA','SAUDI ARABIA',1),('SN','SENEGAL',1),('CS','SERBIA AND MONTENEGRO',1),('SC','SEYCHELLES',1),('SL','SIERRA LEONE',1),('SG','SINGAPORE',1),('SK','SLOVAKIA',1),('SI','SLOVENIA',1),('SB','SOLOMON ISLANDS',1),('SO','SOMALIA',1),('ZA','SOUTH AFRICA',1),('GS','SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS',1),('ES','SPAIN',1),('LK','SRI LANKA',1),('SD','SUDAN',1),('SR','SURINAME',1),('SJ','SVALBARD AND JAN MAYEN ISLANDS',1),('SZ','SWAZILAND',1),('SE','SWEDEN',1),('CH','SWITZERLAND',1),('SY','SYRIAN ARAB REPUBLIC',1),('TW','TAIWAN',1),('TJ','TAJIKISTAN',1),('TZ','TANZANIA, UNITED REPUBLIC OF',1),('TH','THAILAND',1),('TL','TIMOR-LESTE',1),('TG','TOGO',1),('TK','TOKELAU',1),('TO','TONGA',1),('TT','TRINIDAD AND TOBAGO',1),('TN','TUNISIA',1),('TR','TURKEY',1),('TM','TURKMENISTAN',1),('TC','TURKS AND CAICOS ISLANDS',1),('TV','TUVALU',1),('UG','UGANDA',1),('UA','UKRAINE',1),('AE','UNITED ARAB EMIRATES',1),('GB','UNITED KINGDOM',1),('US','UNITED STATES',1),('UM','UNITED STATES MINOR OUTLYING ISLANDS',1),('UY','URUGUAY',1),('UZ','UZBEKISTAN',1),('VU','VANUATU',1),('VA','VATICAN CITY STATE (HOLY SEE)',1),('VE','VENEZUELA',1),('VN','VIET NAM',1),('VG','VIRGIN ISLANDS (BRITISH)',1),('VI','VIRGIN ISLANDS (U.S.)',1),('WF','WALLIS AND FUTUNA ISLANDS',1),('EH','WESTERN SAHARA',1),('YE','YEMEN',1),('ZM','ZAMBIA',1),('ZW','ZIMBABWE',1);

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `departments_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` VALUES ('01','AMAZONAS',1),('02','ÁNCASH',1),('03','APURIMAC',1),('04','AREQUIPA',1),('05','AYACUCHO',1),('06','CAJAMARCA',1),('07','CALLAO',1),('08','CUSCO',1),('09','HUANCAVELICA',1),('10','HUÁNUCO',1),('11','ICA',1),('12','JUNÍN',1),('13','LA LIBERTAD',1),('14','LAMBAYEQUE',1),('15','LIMA',1),('16','LORETO',1),('17','MADRE DE DIOS',1),('18','MOQUEGUA',1),('19','PASCO',1),('20','PIURA',1),('21','PUNO',1),('22','SAN MARTIN',1),('23','TACNA',1),('24','TUMBES',1),('25','UCAYALI',1);

--
-- Table structure for table `devolution_items`
--

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

--
-- Dumping data for table `devolution_items`
--


--
-- Table structure for table `devolution_reasons`
--

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

--
-- Dumping data for table `devolution_reasons`
--

INSERT INTO `devolution_reasons` VALUES (1,'Productos vencidos',NULL,NULL),(2,'Productos dañados',NULL,NULL),(3,'Productos con errores de Fábrica',NULL,NULL);

--
-- Table structure for table `devolutions`
--

CREATE TABLE `devolutions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `prefix` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `devolution_reason_id` int(10) unsigned NOT NULL,
  `observation` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `devolutions_user_id_foreign` (`user_id`),
  KEY `devolutions_establishment_id_foreign` (`establishment_id`),
  KEY `devolutions_devolution_reason_id_foreign` (`devolution_reason_id`),
  KEY `devolutions_soap_type_id_foreign` (`soap_type_id`),
  KEY `devolutions_state_type_id_foreign` (`state_type_id`),
  CONSTRAINT `devolutions_devolution_reason_id_foreign` FOREIGN KEY (`devolution_reason_id`) REFERENCES `devolution_reasons` (`id`),
  CONSTRAINT `devolutions_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `devolutions_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `devolutions_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `devolutions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `devolutions`
--


--
-- Table structure for table `dispatch_addresses`
--

CREATE TABLE `dispatch_addresses` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(10) unsigned NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `location_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`location_id`)),
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dispatch_address_unique` (`person_id`,`address`),
  CONSTRAINT `dispatch_addresses_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `persons` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dispatch_addresses`
--


--
-- Table structure for table `dispatch_items`
--

CREATE TABLE `dispatch_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `dispatch_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `name_product_pdf` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `additional_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`additional_data`)),
  PRIMARY KEY (`id`),
  KEY `dispatch_items_dispatch_id_foreign` (`dispatch_id`),
  KEY `dispatch_items_item_id_foreign` (`item_id`),
  CONSTRAINT `dispatch_items_dispatch_id_foreign` FOREIGN KEY (`dispatch_id`) REFERENCES `dispatches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `dispatch_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dispatch_items`
--


--
-- Table structure for table `dispatch_sale_notes`
--

CREATE TABLE `dispatch_sale_notes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sale_note_id` int(10) unsigned NOT NULL,
  `date_dispatch` date DEFAULT NULL,
  `time_dispatch` time DEFAULT NULL,
  `person_pick` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `person_dispatch` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `dispatch_sale_notes_sale_note_id_foreign` (`sale_note_id`),
  CONSTRAINT `dispatch_sale_notes_sale_note_id_foreign` FOREIGN KEY (`sale_note_id`) REFERENCES `sale_notes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dispatch_sale_notes`
--


--
-- Table structure for table `dispatchers`
--

CREATE TABLE `dispatchers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `identity_document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number_mtc` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT 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`),
  KEY `dispatchers_identity_document_type_id_foreign` (`identity_document_type_id`),
  KEY `dispatchers_number_index` (`number`),
  KEY `dispatchers_name_index` (`name`),
  CONSTRAINT `dispatchers_identity_document_type_id_foreign` FOREIGN KEY (`identity_document_type_id`) REFERENCES `cat_identity_document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dispatchers`
--


--
-- Table structure for table `districts`
--

CREATE TABLE `districts` (
  `id` char(6) COLLATE utf8mb4_unicode_ci NOT NULL,
  `province_id` char(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  KEY `districts_province_id_foreign` (`province_id`),
  KEY `districts_id_index` (`id`),
  CONSTRAINT `districts_province_id_foreign` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `districts`
--

INSERT INTO `districts` VALUES ('010101','0101','Chachapoyas',1),('010102','0101','Asunción',1),('010103','0101','Balsas',1),('010104','0101','Cheto',1),('010105','0101','Chiliquin',1),('010106','0101','Chuquibamba',1),('010107','0101','Granada',1),('010108','0101','Huancas',1),('010109','0101','La Jalca',1),('010110','0101','Leimebamba',1),('010111','0101','Levanto',1),('010112','0101','Magdalena',1),('010113','0101','Mariscal Castilla',1),('010114','0101','Molinopampa',1),('010115','0101','Montevideo',1),('010116','0101','Olleros',1),('010117','0101','Quinjalca',1),('010118','0101','San Francisco de Daguas',1),('010119','0101','San Isidro de Maino',1),('010120','0101','Soloco',1),('010121','0101','Sonche',1),('010201','0102','Bagua',1),('010202','0102','Aramango',1),('010203','0102','Copallin',1),('010204','0102','El Parco',1),('010205','0102','Imaza',1),('010206','0102','La Peca',1),('010301','0103','Jumbilla',1),('010302','0103','Chisquilla',1),('010303','0103','Churuja',1),('010304','0103','Corosha',1),('010305','0103','Cuispes',1),('010306','0103','Florida',1),('010307','0103','Jazan',1),('010308','0103','Recta',1),('010309','0103','San Carlos',1),('010310','0103','Shipasbamba',1),('010311','0103','Valera',1),('010312','0103','Yambrasbamba',1),('010401','0104','Nieva',1),('010402','0104','El Cenepa',1),('010403','0104','Río Santiago',1),('010501','0105','Lamud',1),('010502','0105','Camporredondo',1),('010503','0105','Cocabamba',1),('010504','0105','Colcamar',1),('010505','0105','Conila',1),('010506','0105','Inguilpata',1),('010507','0105','Longuita',1),('010508','0105','Lonya Chico',1),('010509','0105','Luya',1),('010510','0105','Luya Viejo',1),('010511','0105','María',1),('010512','0105','Ocalli',1),('010513','0105','Ocumal',1),('010514','0105','Pisuquia',1),('010515','0105','Providencia',1),('010516','0105','San Cristóbal',1),('010517','0105','San Francisco de Yeso',1),('010518','0105','San Jerónimo',1),('010519','0105','San Juan de Lopecancha',1),('010520','0105','Santa Catalina',1),('010521','0105','Santo Tomas',1),('010522','0105','Tingo',1),('010523','0105','Trita',1),('010601','0106','San Nicolás',1),('010602','0106','Chirimoto',1),('010603','0106','Cochamal',1),('010604','0106','Huambo',1),('010605','0106','Limabamba',1),('010606','0106','Longar',1),('010607','0106','Mariscal Benavides',1),('010608','0106','Milpuc',1),('010609','0106','Omia',1),('010610','0106','Santa Rosa',1),('010611','0106','Totora',1),('010612','0106','Vista Alegre',1),('010701','0107','Bagua Grande',1),('010702','0107','Cajaruro',1),('010703','0107','Cumba',1),('010704','0107','El Milagro',1),('010705','0107','Jamalca',1),('010706','0107','Lonya Grande',1),('010707','0107','Yamon',1),('020101','0201','Huaraz',1),('020102','0201','Cochabamba',1),('020103','0201','Colcabamba',1),('020104','0201','Huanchay',1),('020105','0201','Independencia',1),('020106','0201','Jangas',1),('020107','0201','La Libertad',1),('020108','0201','Olleros',1),('020109','0201','Pampas Grande',1),('020110','0201','Pariacoto',1),('020111','0201','Pira',1),('020112','0201','Tarica',1),('020201','0202','Aija',1),('020202','0202','Coris',1),('020203','0202','Huacllan',1),('020204','0202','La Merced',1),('020205','0202','Succha',1),('020301','0203','Llamellin',1),('020302','0203','Aczo',1),('020303','0203','Chaccho',1),('020304','0203','Chingas',1),('020305','0203','Mirgas',1),('020306','0203','San Juan de Rontoy',1),('020401','0204','Chacas',1),('020402','0204','Acochaca',1),('020501','0205','Chiquian',1),('020502','0205','Abelardo Pardo Lezameta',1),('020503','0205','Antonio Raymondi',1),('020504','0205','Aquia',1),('020505','0205','Cajacay',1),('020506','0205','Canis',1),('020507','0205','Colquioc',1),('020508','0205','Huallanca',1),('020509','0205','Huasta',1),('020510','0205','Huayllacayan',1),('020511','0205','La Primavera',1),('020512','0205','Mangas',1),('020513','0205','Pacllon',1),('020514','0205','San Miguel de Corpanqui',1),('020515','0205','Ticllos',1),('020601','0206','Carhuaz',1),('020602','0206','Acopampa',1),('020603','0206','Amashca',1),('020604','0206','Anta',1),('020605','0206','Ataquero',1),('020606','0206','Marcara',1),('020607','0206','Pariahuanca',1),('020608','0206','San Miguel de Aco',1),('020609','0206','Shilla',1),('020610','0206','Tinco',1),('020611','0206','Yungar',1),('020701','0207','San Luis',1),('020702','0207','San Nicolás',1),('020703','0207','Yauya',1),('020801','0208','Casma',1),('020802','0208','Buena Vista Alta',1),('020803','0208','Comandante Noel',1),('020804','0208','Yautan',1),('020901','0209','Corongo',1),('020902','0209','Aco',1),('020903','0209','Bambas',1),('020904','0209','Cusca',1),('020905','0209','La Pampa',1),('020906','0209','Yanac',1),('020907','0209','Yupan',1),('021001','0210','Huari',1),('021002','0210','Anra',1),('021003','0210','Cajay',1),('021004','0210','Chavin de Huantar',1),('021005','0210','Huacachi',1),('021006','0210','Huacchis',1),('021007','0210','Huachis',1),('021008','0210','Huantar',1),('021009','0210','Masin',1),('021010','0210','Paucas',1),('021011','0210','Ponto',1),('021012','0210','Rahuapampa',1),('021013','0210','Rapayan',1),('021014','0210','San Marcos',1),('021015','0210','San Pedro de Chana',1),('021016','0210','Uco',1),('021101','0211','Huarmey',1),('021102','0211','Cochapeti',1),('021103','0211','Culebras',1),('021104','0211','Huayan',1),('021105','0211','Malvas',1),('021201','0212','Caraz',1),('021202','0212','Huallanca',1),('021203','0212','Huata',1),('021204','0212','Huaylas',1),('021205','0212','Mato',1),('021206','0212','Pamparomas',1),('021207','0212','Pueblo Libre',1),('021208','0212','Santa Cruz',1),('021209','0212','Santo Toribio',1),('021210','0212','Yuracmarca',1),('021301','0213','Piscobamba',1),('021302','0213','Casca',1),('021303','0213','Eleazar Guzmán Barron',1),('021304','0213','Fidel Olivas Escudero',1),('021305','0213','Llama',1),('021306','0213','Llumpa',1),('021307','0213','Lucma',1),('021308','0213','Musga',1),('021401','0214','Ocros',1),('021402','0214','Acas',1),('021403','0214','Cajamarquilla',1),('021404','0214','Carhuapampa',1),('021405','0214','Cochas',1),('021406','0214','Congas',1),('021407','0214','Llipa',1),('021408','0214','San Cristóbal de Rajan',1),('021409','0214','San Pedro',1),('021410','0214','Santiago de Chilcas',1),('021501','0215','Cabana',1),('021502','0215','Bolognesi',1),('021503','0215','Conchucos',1),('021504','0215','Huacaschuque',1),('021505','0215','Huandoval',1),('021506','0215','Lacabamba',1),('021507','0215','Llapo',1),('021508','0215','Pallasca',1),('021509','0215','Pampas',1),('021510','0215','Santa Rosa',1),('021511','0215','Tauca',1),('021601','0216','Pomabamba',1),('021602','0216','Huayllan',1),('021603','0216','Parobamba',1),('021604','0216','Quinuabamba',1),('021701','0217','Recuay',1),('021702','0217','Catac',1),('021703','0217','Cotaparaco',1),('021704','0217','Huayllapampa',1),('021705','0217','Llacllin',1),('021706','0217','Marca',1),('021707','0217','Pampas Chico',1),('021708','0217','Pararin',1),('021709','0217','Tapacocha',1),('021710','0217','Ticapampa',1),('021801','0218','Chimbote',1),('021802','0218','Cáceres del Perú',1),('021803','0218','Coishco',1),('021804','0218','Macate',1),('021805','0218','Moro',1),('021806','0218','Nepeña',1),('021807','0218','Samanco',1),('021808','0218','Santa',1),('021809','0218','Nuevo Chimbote',1),('021901','0219','Sihuas',1),('021902','0219','Acobamba',1),('021903','0219','Alfonso Ugarte',1),('021904','0219','Cashapampa',1),('021905','0219','Chingalpo',1),('021906','0219','Huayllabamba',1),('021907','0219','Quiches',1),('021908','0219','Ragash',1),('021909','0219','San Juan',1),('021910','0219','Sicsibamba',1),('022001','0220','Yungay',1),('022002','0220','Cascapara',1),('022003','0220','Mancos',1),('022004','0220','Matacoto',1),('022005','0220','Quillo',1),('022006','0220','Ranrahirca',1),('022007','0220','Shupluy',1),('022008','0220','Yanama',1),('030101','0301','Abancay',1),('030102','0301','Chacoche',1),('030103','0301','Circa',1),('030104','0301','Curahuasi',1),('030105','0301','Huanipaca',1),('030106','0301','Lambrama',1),('030107','0301','Pichirhua',1),('030108','0301','San Pedro de Cachora',1),('030109','0301','Tamburco',1),('030201','0302','Andahuaylas',1),('030202','0302','Andarapa',1),('030203','0302','Chiara',1),('030204','0302','Huancarama',1),('030205','0302','Huancaray',1),('030206','0302','Huayana',1),('030207','0302','Kishuara',1),('030208','0302','Pacobamba',1),('030209','0302','Pacucha',1),('030210','0302','Pampachiri',1),('030211','0302','Pomacocha',1),('030212','0302','San Antonio de Cachi',1),('030213','0302','San Jerónimo',1),('030214','0302','San Miguel de Chaccrampa',1),('030215','0302','Santa María de Chicmo',1),('030216','0302','Talavera',1),('030217','0302','Tumay Huaraca',1),('030218','0302','Turpo',1),('030219','0302','Kaquiabamba',1),('030220','0302','José María Arguedas',1),('030301','0303','Antabamba',1),('030302','0303','El Oro',1),('030303','0303','Huaquirca',1),('030304','0303','Juan Espinoza Medrano',1),('030305','0303','Oropesa',1),('030306','0303','Pachaconas',1),('030307','0303','Sabaino',1),('030401','0304','Chalhuanca',1),('030402','0304','Capaya',1),('030403','0304','Caraybamba',1),('030404','0304','Chapimarca',1),('030405','0304','Colcabamba',1),('030406','0304','Cotaruse',1),('030407','0304','Ihuayllo',1),('030408','0304','Justo Apu Sahuaraura',1),('030409','0304','Lucre',1),('030410','0304','Pocohuanca',1),('030411','0304','San Juan de Chacña',1),('030412','0304','Sañayca',1),('030413','0304','Soraya',1),('030414','0304','Tapairihua',1),('030415','0304','Tintay',1),('030416','0304','Toraya',1),('030417','0304','Yanaca',1),('030501','0305','Tambobamba',1),('030502','0305','Cotabambas',1),('030503','0305','Coyllurqui',1),('030504','0305','Haquira',1),('030505','0305','Mara',1),('030506','0305','Challhuahuacho',1),('030601','0306','Chincheros',1),('030602','0306','Anco_Huallo',1),('030603','0306','Cocharcas',1),('030604','0306','Huaccana',1),('030605','0306','Ocobamba',1),('030606','0306','Ongoy',1),('030607','0306','Uranmarca',1),('030608','0306','Ranracancha',1),('030609','0306','Rocchacc',1),('030610','0306','El Porvenir',1),('030701','0307','Chuquibambilla',1),('030702','0307','Curpahuasi',1),('030703','0307','Gamarra',1),('030704','0307','Huayllati',1),('030705','0307','Mamara',1),('030706','0307','Micaela Bastidas',1),('030707','0307','Pataypampa',1),('030708','0307','Progreso',1),('030709','0307','San Antonio',1),('030710','0307','Santa Rosa',1),('030711','0307','Turpay',1),('030712','0307','Vilcabamba',1),('030713','0307','Virundo',1),('030714','0307','Curasco',1),('040101','0401','Arequipa',1),('040102','0401','Alto Selva Alegre',1),('040103','0401','Cayma',1),('040104','0401','Cerro Colorado',1),('040105','0401','Characato',1),('040106','0401','Chiguata',1),('040107','0401','Jacobo Hunter',1),('040108','0401','La Joya',1),('040109','0401','Mariano Melgar',1),('040110','0401','Miraflores',1),('040111','0401','Mollebaya',1),('040112','0401','Paucarpata',1),('040113','0401','Pocsi',1),('040114','0401','Polobaya',1),('040115','0401','Quequeña',1),('040116','0401','Sabandia',1),('040117','0401','Sachaca',1),('040118','0401','San Juan de Siguas',1),('040119','0401','San Juan de Tarucani',1),('040120','0401','Santa Isabel de Siguas',1),('040121','0401','Santa Rita de Siguas',1),('040122','0401','Socabaya',1),('040123','0401','Tiabaya',1),('040124','0401','Uchumayo',1),('040125','0401','Vitor',1),('040126','0401','Yanahuara',1),('040127','0401','Yarabamba',1),('040128','0401','Yura',1),('040129','0401','José Luis Bustamante Y Rivero',1),('040201','0402','Camaná',1),('040202','0402','José María Quimper',1),('040203','0402','Mariano Nicolás Valcárcel',1),('040204','0402','Mariscal Cáceres',1),('040205','0402','Nicolás de Pierola',1),('040206','0402','Ocoña',1),('040207','0402','Quilca',1),('040208','0402','Samuel Pastor',1),('040301','0403','Caravelí',1),('040302','0403','Acarí',1),('040303','0403','Atico',1),('040304','0403','Atiquipa',1),('040305','0403','Bella Unión',1),('040306','0403','Cahuacho',1),('040307','0403','Chala',1),('040308','0403','Chaparra',1),('040309','0403','Huanuhuanu',1),('040310','0403','Jaqui',1),('040311','0403','Lomas',1),('040312','0403','Quicacha',1),('040313','0403','Yauca',1),('040401','0404','Aplao',1),('040402','0404','Andagua',1),('040403','0404','Ayo',1),('040404','0404','Chachas',1),('040405','0404','Chilcaymarca',1),('040406','0404','Choco',1),('040407','0404','Huancarqui',1),('040408','0404','Machaguay',1),('040409','0404','Orcopampa',1),('040410','0404','Pampacolca',1),('040411','0404','Tipan',1),('040412','0404','Uñon',1),('040413','0404','Uraca',1),('040414','0404','Viraco',1),('040501','0405','Chivay',1),('040502','0405','Achoma',1),('040503','0405','Cabanaconde',1),('040504','0405','Callalli',1),('040505','0405','Caylloma',1),('040506','0405','Coporaque',1),('040507','0405','Huambo',1),('040508','0405','Huanca',1),('040509','0405','Ichupampa',1),('040510','0405','Lari',1),('040511','0405','Lluta',1),('040512','0405','Maca',1),('040513','0405','Madrigal',1),('040514','0405','San Antonio de Chuca',1),('040515','0405','Sibayo',1),('040516','0405','Tapay',1),('040517','0405','Tisco',1),('040518','0405','Tuti',1),('040519','0405','Yanque',1),('040520','0405','Majes',1),('040601','0406','Chuquibamba',1),('040602','0406','Andaray',1),('040603','0406','Cayarani',1),('040604','0406','Chichas',1),('040605','0406','Iray',1),('040606','0406','Río Grande',1),('040607','0406','Salamanca',1),('040608','0406','Yanaquihua',1),('040701','0407','Mollendo',1),('040702','0407','Cocachacra',1),('040703','0407','Dean Valdivia',1),('040704','0407','Islay',1),('040705','0407','Mejia',1),('040706','0407','Punta de Bombón',1),('040801','0408','Cotahuasi',1),('040802','0408','Alca',1),('040803','0408','Charcana',1),('040804','0408','Huaynacotas',1),('040805','0408','Pampamarca',1),('040806','0408','Puyca',1),('040807','0408','Quechualla',1),('040808','0408','Sayla',1),('040809','0408','Tauria',1),('040810','0408','Tomepampa',1),('040811','0408','Toro',1),('050101','0501','Ayacucho',1),('050102','0501','Acocro',1),('050103','0501','Acos Vinchos',1),('050104','0501','Carmen Alto',1),('050105','0501','Chiara',1),('050106','0501','Ocros',1),('050107','0501','Pacaycasa',1),('050108','0501','Quinua',1),('050109','0501','San José de Ticllas',1),('050110','0501','San Juan Bautista',1),('050111','0501','Santiago de Pischa',1),('050112','0501','Socos',1),('050113','0501','Tambillo',1),('050114','0501','Vinchos',1),('050115','0501','Jesús Nazareno',1),('050116','0501','Andrés Avelino Cáceres Dorregaray',1),('050201','0502','Cangallo',1),('050202','0502','Chuschi',1),('050203','0502','Los Morochucos',1),('050204','0502','María Parado de Bellido',1),('050205','0502','Paras',1),('050206','0502','Totos',1),('050301','0503','Sancos',1),('050302','0503','Carapo',1),('050303','0503','Sacsamarca',1),('050304','0503','Santiago de Lucanamarca',1),('050401','0504','Huanta',1),('050402','0504','Ayahuanco',1),('050403','0504','Huamanguilla',1),('050404','0504','Iguain',1),('050405','0504','Luricocha',1),('050406','0504','Santillana',1),('050407','0504','Sivia',1),('050408','0504','Llochegua',1),('050409','0504','Canayre',1),('050410','0504','Uchuraccay',1),('050411','0504','Pucacolpa',1),('050412','0504','Chaca',1),('050501','0505','San Miguel',1),('050502','0505','Anco',1),('050503','0505','Ayna',1),('050504','0505','Chilcas',1),('050505','0505','Chungui',1),('050506','0505','Luis Carranza',1),('050507','0505','Santa Rosa',1),('050508','0505','Tambo',1),('050509','0505','Samugari',1),('050510','0505','Anchihuay',1),('050601','0506','Puquio',1),('050602','0506','Aucara',1),('050603','0506','Cabana',1),('050604','0506','Carmen Salcedo',1),('050605','0506','Chaviña',1),('050606','0506','Chipao',1),('050607','0506','Huac-Huas',1),('050608','0506','Laramate',1),('050609','0506','Leoncio Prado',1),('050610','0506','Llauta',1),('050611','0506','Lucanas',1),('050612','0506','Ocaña',1),('050613','0506','Otoca',1),('050614','0506','Saisa',1),('050615','0506','San Cristóbal',1),('050616','0506','San Juan',1),('050617','0506','San Pedro',1),('050618','0506','San Pedro de Palco',1),('050619','0506','Sancos',1),('050620','0506','Santa Ana de Huaycahuacho',1),('050621','0506','Santa Lucia',1),('050701','0507','Coracora',1),('050702','0507','Chumpi',1),('050703','0507','Coronel Castañeda',1),('050704','0507','Pacapausa',1),('050705','0507','Pullo',1),('050706','0507','Puyusca',1),('050707','0507','San Francisco de Ravacayco',1),('050708','0507','Upahuacho',1),('050801','0508','Pausa',1),('050802','0508','Colta',1),('050803','0508','Corculla',1),('050804','0508','Lampa',1),('050805','0508','Marcabamba',1),('050806','0508','Oyolo',1),('050807','0508','Pararca',1),('050808','0508','San Javier de Alpabamba',1),('050809','0508','San José de Ushua',1),('050810','0508','Sara Sara',1),('050901','0509','Querobamba',1),('050902','0509','Belén',1),('050903','0509','Chalcos',1),('050904','0509','Chilcayoc',1),('050905','0509','Huacaña',1),('050906','0509','Morcolla',1),('050907','0509','Paico',1),('050908','0509','San Pedro de Larcay',1),('050909','0509','San Salvador de Quije',1),('050910','0509','Santiago de Paucaray',1),('050911','0509','Soras',1),('051001','0510','Huancapi',1),('051002','0510','Alcamenca',1),('051003','0510','Apongo',1),('051004','0510','Asquipata',1),('051005','0510','Canaria',1),('051006','0510','Cayara',1),('051007','0510','Colca',1),('051008','0510','Huamanquiquia',1),('051009','0510','Huancaraylla',1),('051010','0510','Huaya',1),('051011','0510','Sarhua',1),('051012','0510','Vilcanchos',1),('051101','0511','Vilcas Huaman',1),('051102','0511','Accomarca',1),('051103','0511','Carhuanca',1),('051104','0511','Concepción',1),('051105','0511','Huambalpa',1),('051106','0511','Independencia',1),('051107','0511','Saurama',1),('051108','0511','Vischongo',1),('060101','0601','Cajamarca',1),('060102','0601','Asunción',1),('060103','0601','Chetilla',1),('060104','0601','Cospan',1),('060105','0601','Encañada',1),('060106','0601','Jesús',1),('060107','0601','Llacanora',1),('060108','0601','Los Baños del Inca',1),('060109','0601','Magdalena',1),('060110','0601','Matara',1),('060111','0601','Namora',1),('060112','0601','San Juan',1),('060201','0602','Cajabamba',1),('060202','0602','Cachachi',1),('060203','0602','Condebamba',1),('060204','0602','Sitacocha',1),('060301','0603','Celendín',1),('060302','0603','Chumuch',1),('060303','0603','Cortegana',1),('060304','0603','Huasmin',1),('060305','0603','Jorge Chávez',1),('060306','0603','José Gálvez',1),('060307','0603','Miguel Iglesias',1),('060308','0603','Oxamarca',1),('060309','0603','Sorochuco',1),('060310','0603','Sucre',1),('060311','0603','Utco',1),('060312','0603','La Libertad de Pallan',1),('060401','0604','Chota',1),('060402','0604','Anguia',1),('060403','0604','Chadin',1),('060404','0604','Chiguirip',1),('060405','0604','Chimban',1),('060406','0604','Choropampa',1),('060407','0604','Cochabamba',1),('060408','0604','Conchan',1),('060409','0604','Huambos',1),('060410','0604','Lajas',1),('060411','0604','Llama',1),('060412','0604','Miracosta',1),('060413','0604','Paccha',1),('060414','0604','Pion',1),('060415','0604','Querocoto',1),('060416','0604','San Juan de Licupis',1),('060417','0604','Tacabamba',1),('060418','0604','Tocmoche',1),('060419','0604','Chalamarca',1),('060501','0605','Contumaza',1),('060502','0605','Chilete',1),('060503','0605','Cupisnique',1),('060504','0605','Guzmango',1),('060505','0605','San Benito',1),('060506','0605','Santa Cruz de Toledo',1),('060507','0605','Tantarica',1),('060508','0605','Yonan',1),('060601','0606','Cutervo',1),('060602','0606','Callayuc',1),('060603','0606','Choros',1),('060604','0606','Cujillo',1),('060605','0606','La Ramada',1),('060606','0606','Pimpingos',1),('060607','0606','Querocotillo',1),('060608','0606','San Andrés de Cutervo',1),('060609','0606','San Juan de Cutervo',1),('060610','0606','San Luis de Lucma',1),('060611','0606','Santa Cruz',1),('060612','0606','Santo Domingo de la Capilla',1),('060613','0606','Santo Tomas',1),('060614','0606','Socota',1),('060615','0606','Toribio Casanova',1),('060701','0607','Bambamarca',1),('060702','0607','Chugur',1),('060703','0607','Hualgayoc',1),('060801','0608','Jaén',1),('060802','0608','Bellavista',1),('060803','0608','Chontali',1),('060804','0608','Colasay',1),('060805','0608','Huabal',1),('060806','0608','Las Pirias',1),('060807','0608','Pomahuaca',1),('060808','0608','Pucara',1),('060809','0608','Sallique',1),('060810','0608','San Felipe',1),('060811','0608','San José del Alto',1),('060812','0608','Santa Rosa',1),('060901','0609','San Ignacio',1),('060902','0609','Chirinos',1),('060903','0609','Huarango',1),('060904','0609','La Coipa',1),('060905','0609','Namballe',1),('060906','0609','San José de Lourdes',1),('060907','0609','Tabaconas',1),('061001','0610','Pedro Gálvez',1),('061002','0610','Chancay',1),('061003','0610','Eduardo Villanueva',1),('061004','0610','Gregorio Pita',1),('061005','0610','Ichocan',1),('061006','0610','José Manuel Quiroz',1),('061007','0610','José Sabogal',1),('061101','0611','San Miguel',1),('061102','0611','Bolívar',1),('061103','0611','Calquis',1),('061104','0611','Catilluc',1),('061105','0611','El Prado',1),('061106','0611','La Florida',1),('061107','0611','Llapa',1),('061108','0611','Nanchoc',1),('061109','0611','Niepos',1),('061110','0611','San Gregorio',1),('061111','0611','San Silvestre de Cochan',1),('061112','0611','Tongod',1),('061113','0611','Unión Agua Blanca',1),('061201','0612','San Pablo',1),('061202','0612','San Bernardino',1),('061203','0612','San Luis',1),('061204','0612','Tumbaden',1),('061301','0613','Santa Cruz',1),('061302','0613','Andabamba',1),('061303','0613','Catache',1),('061304','0613','Chancaybaños',1),('061305','0613','La Esperanza',1),('061306','0613','Ninabamba',1),('061307','0613','Pulan',1),('061308','0613','Saucepampa',1),('061309','0613','Sexi',1),('061310','0613','Uticyacu',1),('061311','0613','Yauyucan',1),('070101','0701','Callao',1),('070102','0701','Bellavista',1),('070103','0701','Carmen de la Legua Reynoso',1),('070104','0701','La Perla',1),('070105','0701','La Punta',1),('070106','0701','Ventanilla',1),('070107','0701','Mi Perú',1),('080101','0801','Cusco',1),('080102','0801','Ccorca',1),('080103','0801','Poroy',1),('080104','0801','San Jerónimo',1),('080105','0801','San Sebastian',1),('080106','0801','Santiago',1),('080107','0801','Saylla',1),('080108','0801','Wanchaq',1),('080201','0802','Acomayo',1),('080202','0802','Acopia',1),('080203','0802','Acos',1),('080204','0802','Mosoc Llacta',1),('080205','0802','Pomacanchi',1),('080206','0802','Rondocan',1),('080207','0802','Sangarara',1),('080301','0803','Anta',1),('080302','0803','Ancahuasi',1),('080303','0803','Cachimayo',1),('080304','0803','Chinchaypujio',1),('080305','0803','Huarocondo',1),('080306','0803','Limatambo',1),('080307','0803','Mollepata',1),('080308','0803','Pucyura',1),('080309','0803','Zurite',1),('080401','0804','Calca',1),('080402','0804','Coya',1),('080403','0804','Lamay',1),('080404','0804','Lares',1),('080405','0804','Pisac',1),('080406','0804','San Salvador',1),('080407','0804','Taray',1),('080408','0804','Yanatile',1),('080501','0805','Yanaoca',1),('080502','0805','Checca',1),('080503','0805','Kunturkanki',1),('080504','0805','Langui',1),('080505','0805','Layo',1),('080506','0805','Pampamarca',1),('080507','0805','Quehue',1),('080508','0805','Tupac Amaru',1),('080601','0806','Sicuani',1),('080602','0806','Checacupe',1),('080603','0806','Combapata',1),('080604','0806','Marangani',1),('080605','0806','Pitumarca',1),('080606','0806','San Pablo',1),('080607','0806','San Pedro',1),('080608','0806','Tinta',1),('080701','0807','Santo Tomas',1),('080702','0807','Capacmarca',1),('080703','0807','Chamaca',1),('080704','0807','Colquemarca',1),('080705','0807','Livitaca',1),('080706','0807','Llusco',1),('080707','0807','Quiñota',1),('080708','0807','Velille',1),('080801','0808','Espinar',1),('080802','0808','Condoroma',1),('080803','0808','Coporaque',1),('080804','0808','Ocoruro',1),('080805','0808','Pallpata',1),('080806','0808','Pichigua',1),('080807','0808','Suyckutambo',1),('080808','0808','Alto Pichigua',1),('080901','0809','Santa Ana',1),('080902','0809','Echarate',1),('080903','0809','Huayopata',1),('080904','0809','Maranura',1),('080905','0809','Ocobamba',1),('080906','0809','Quellouno',1),('080907','0809','Kimbiri',1),('080908','0809','Santa Teresa',1),('080909','0809','Vilcabamba',1),('080910','0809','Pichari',1),('080911','0809','Inkawasi',1),('080912','0809','Villa Virgen',1),('080913','0809','Villa Kintiarina',1),('081001','0810','Paruro',1),('081002','0810','Accha',1),('081003','0810','Ccapi',1),('081004','0810','Colcha',1),('081005','0810','Huanoquite',1),('081006','0810','Omacha',1),('081007','0810','Paccaritambo',1),('081008','0810','Pillpinto',1),('081009','0810','Yaurisque',1),('081101','0811','Paucartambo',1),('081102','0811','Caicay',1),('081103','0811','Challabamba',1),('081104','0811','Colquepata',1),('081105','0811','Huancarani',1),('081106','0811','Kosñipata',1),('081201','0812','Urcos',1),('081202','0812','Andahuaylillas',1),('081203','0812','Camanti',1),('081204','0812','Ccarhuayo',1),('081205','0812','Ccatca',1),('081206','0812','Cusipata',1),('081207','0812','Huaro',1),('081208','0812','Lucre',1),('081209','0812','Marcapata',1),('081210','0812','Ocongate',1),('081211','0812','Oropesa',1),('081212','0812','Quiquijana',1),('081301','0813','Urubamba',1),('081302','0813','Chinchero',1),('081303','0813','Huayllabamba',1),('081304','0813','Machupicchu',1),('081305','0813','Maras',1),('081306','0813','Ollantaytambo',1),('081307','0813','Yucay',1),('090101','0901','Huancavelica',1),('090102','0901','Acobambilla',1),('090103','0901','Acoria',1),('090104','0901','Conayca',1),('090105','0901','Cuenca',1),('090106','0901','Huachocolpa',1),('090107','0901','Huayllahuara',1),('090108','0901','Izcuchaca',1),('090109','0901','Laria',1),('090110','0901','Manta',1),('090111','0901','Mariscal Cáceres',1),('090112','0901','Moya',1),('090113','0901','Nuevo Occoro',1),('090114','0901','Palca',1),('090115','0901','Pilchaca',1),('090116','0901','Vilca',1),('090117','0901','Yauli',1),('090118','0901','Ascensión',1),('090119','0901','Huando',1),('090201','0902','Acobamba',1),('090202','0902','Andabamba',1),('090203','0902','Anta',1),('090204','0902','Caja',1),('090205','0902','Marcas',1),('090206','0902','Paucara',1),('090207','0902','Pomacocha',1),('090208','0902','Rosario',1),('090301','0903','Lircay',1),('090302','0903','Anchonga',1),('090303','0903','Callanmarca',1),('090304','0903','Ccochaccasa',1),('090305','0903','Chincho',1),('090306','0903','Congalla',1),('090307','0903','Huanca-Huanca',1),('090308','0903','Huayllay Grande',1),('090309','0903','Julcamarca',1),('090310','0903','San Antonio de Antaparco',1),('090311','0903','Santo Tomas de Pata',1),('090312','0903','Secclla',1),('090401','0904','Castrovirreyna',1),('090402','0904','Arma',1),('090403','0904','Aurahua',1),('090404','0904','Capillas',1),('090405','0904','Chupamarca',1),('090406','0904','Cocas',1),('090407','0904','Huachos',1),('090408','0904','Huamatambo',1),('090409','0904','Mollepampa',1),('090410','0904','San Juan',1),('090411','0904','Santa Ana',1),('090412','0904','Tantara',1),('090413','0904','Ticrapo',1),('090501','0905','Churcampa',1),('090502','0905','Anco',1),('090503','0905','Chinchihuasi',1),('090504','0905','El Carmen',1),('090505','0905','La Merced',1),('090506','0905','Locroja',1),('090507','0905','Paucarbamba',1),('090508','0905','San Miguel de Mayocc',1),('090509','0905','San Pedro de Coris',1),('090510','0905','Pachamarca',1),('090511','0905','Cosme',1),('090601','0906','Huaytara',1),('090602','0906','Ayavi',1),('090603','0906','Córdova',1),('090604','0906','Huayacundo Arma',1),('090605','0906','Laramarca',1),('090606','0906','Ocoyo',1),('090607','0906','Pilpichaca',1),('090608','0906','Querco',1),('090609','0906','Quito-Arma',1),('090610','0906','San Antonio de Cusicancha',1),('090611','0906','San Francisco de Sangayaico',1),('090612','0906','San Isidro',1),('090613','0906','Santiago de Chocorvos',1),('090614','0906','Santiago de Quirahuara',1),('090615','0906','Santo Domingo de Capillas',1),('090616','0906','Tambo',1),('090701','0907','Pampas',1),('090702','0907','Acostambo',1),('090703','0907','Acraquia',1),('090704','0907','Ahuaycha',1),('090705','0907','Colcabamba',1),('090706','0907','Daniel Hernández',1),('090707','0907','Huachocolpa',1),('090709','0907','Huaribamba',1),('090710','0907','Ñahuimpuquio',1),('090711','0907','Pazos',1),('090713','0907','Quishuar',1),('090714','0907','Salcabamba',1),('090715','0907','Salcahuasi',1),('090716','0907','San Marcos de Rocchac',1),('090717','0907','Surcubamba',1),('090718','0907','Tintay Puncu',1),('090719','0907','Quichuas',1),('090720','0907','Andaymarca',1),('090721','0907','Roble',1),('090722','0907','Pichos',1),('100101','1001','Huanuco',1),('100102','1001','Amarilis',1),('100103','1001','Chinchao',1),('100104','1001','Churubamba',1),('100105','1001','Margos',1),('100106','1001','Quisqui (Kichki)',1),('100107','1001','San Francisco de Cayran',1),('100108','1001','San Pedro de Chaulan',1),('100109','1001','Santa María del Valle',1),('100110','1001','Yarumayo',1),('100111','1001','Pillco Marca',1),('100112','1001','Yacus',1),('100113','1001','San Pablo de Pillao',1),('100201','1002','Ambo',1),('100202','1002','Cayna',1),('100203','1002','Colpas',1),('100204','1002','Conchamarca',1),('100205','1002','Huacar',1),('100206','1002','San Francisco',1),('100207','1002','San Rafael',1),('100208','1002','Tomay Kichwa',1),('100301','1003','La Unión',1),('100307','1003','Chuquis',1),('100311','1003','Marías',1),('100313','1003','Pachas',1),('100316','1003','Quivilla',1),('100317','1003','Ripan',1),('100321','1003','Shunqui',1),('100322','1003','Sillapata',1),('100323','1003','Yanas',1),('100401','1004','Huacaybamba',1),('100402','1004','Canchabamba',1),('100403','1004','Cochabamba',1),('100404','1004','Pinra',1),('100501','1005','Llata',1),('100502','1005','Arancay',1),('100503','1005','Chavín de Pariarca',1),('100504','1005','Jacas Grande',1),('100505','1005','Jircan',1),('100506','1005','Miraflores',1),('100507','1005','Monzón',1),('100508','1005','Punchao',1),('100509','1005','Puños',1),('100510','1005','Singa',1),('100511','1005','Tantamayo',1),('100601','1006','Rupa-Rupa',1),('100602','1006','Daniel Alomía Robles',1),('100603','1006','Hermílio Valdizan',1),('100604','1006','José Crespo y Castillo',1),('100605','1006','Luyando',1),('100606','1006','Mariano Damaso Beraun',1),('100607','1006','Pucayacu',1),('100608','1006','Castillo Grande',1),('100701','1007','Huacrachuco',1),('100702','1007','Cholon',1),('100703','1007','San Buenaventura',1),('100704','1007','La Morada',1),('100705','1007','Santa Rosa de Alto Yanajanca',1),('100801','1008','Panao',1),('100802','1008','Chaglla',1),('100803','1008','Molino',1),('100804','1008','Umari',1),('100901','1009','Puerto Inca',1),('100902','1009','Codo del Pozuzo',1),('100903','1009','Honoria',1),('100904','1009','Tournavista',1),('100905','1009','Yuyapichis',1),('101001','1010','Jesús',1),('101002','1010','Baños',1),('101003','1010','Jivia',1),('101004','1010','Queropalca',1),('101005','1010','Rondos',1),('101006','1010','San Francisco de Asís',1),('101007','1010','San Miguel de Cauri',1),('101101','1011','Chavinillo',1),('101102','1011','Cahuac',1),('101103','1011','Chacabamba',1),('101104','1011','Aparicio Pomares',1),('101105','1011','Jacas Chico',1),('101106','1011','Obas',1),('101107','1011','Pampamarca',1),('101108','1011','Choras',1),('110101','1101','Ica',1),('110102','1101','La Tinguiña',1),('110103','1101','Los Aquijes',1),('110104','1101','Ocucaje',1),('110105','1101','Pachacutec',1),('110106','1101','Parcona',1),('110107','1101','Pueblo Nuevo',1),('110108','1101','Salas',1),('110109','1101','San José de Los Molinos',1),('110110','1101','San Juan Bautista',1),('110111','1101','Santiago',1),('110112','1101','Subtanjalla',1),('110113','1101','Tate',1),('110114','1101','Yauca del Rosario',1),('110201','1102','Chincha Alta',1),('110202','1102','Alto Laran',1),('110203','1102','Chavin',1),('110204','1102','Chincha Baja',1),('110205','1102','El Carmen',1),('110206','1102','Grocio Prado',1),('110207','1102','Pueblo Nuevo',1),('110208','1102','San Juan de Yanac',1),('110209','1102','San Pedro de Huacarpana',1),('110210','1102','Sunampe',1),('110211','1102','Tambo de Mora',1),('110301','1103','Nasca',1),('110302','1103','Changuillo',1),('110303','1103','El Ingenio',1),('110304','1103','Marcona',1),('110305','1103','Vista Alegre',1),('110401','1104','Palpa',1),('110402','1104','Llipata',1),('110403','1104','Río Grande',1),('110404','1104','Santa Cruz',1),('110405','1104','Tibillo',1),('110501','1105','Pisco',1),('110502','1105','Huancano',1),('110503','1105','Humay',1),('110504','1105','Independencia',1),('110505','1105','Paracas',1),('110506','1105','San Andrés',1),('110507','1105','San Clemente',1),('110508','1105','Tupac Amaru Inca',1),('120101','1201','Huancayo',1),('120104','1201','Carhuacallanga',1),('120105','1201','Chacapampa',1),('120106','1201','Chicche',1),('120107','1201','Chilca',1),('120108','1201','Chongos Alto',1),('120111','1201','Chupuro',1),('120112','1201','Colca',1),('120113','1201','Cullhuas',1),('120114','1201','El Tambo',1),('120116','1201','Huacrapuquio',1),('120117','1201','Hualhuas',1),('120119','1201','Huancan',1),('120120','1201','Huasicancha',1),('120121','1201','Huayucachi',1),('120122','1201','Ingenio',1),('120124','1201','Pariahuanca',1),('120125','1201','Pilcomayo',1),('120126','1201','Pucara',1),('120127','1201','Quichuay',1),('120128','1201','Quilcas',1),('120129','1201','San Agustín',1),('120130','1201','San Jerónimo de Tunan',1),('120132','1201','Saño',1),('120133','1201','Sapallanga',1),('120134','1201','Sicaya',1),('120135','1201','Santo Domingo de Acobamba',1),('120136','1201','Viques',1),('120201','1202','Concepción',1),('120202','1202','Aco',1),('120203','1202','Andamarca',1),('120204','1202','Chambara',1),('120205','1202','Cochas',1),('120206','1202','Comas',1),('120207','1202','Heroínas Toledo',1),('120208','1202','Manzanares',1),('120209','1202','Mariscal Castilla',1),('120210','1202','Matahuasi',1),('120211','1202','Mito',1),('120212','1202','Nueve de Julio',1),('120213','1202','Orcotuna',1),('120214','1202','San José de Quero',1),('120215','1202','Santa Rosa de Ocopa',1),('120301','1203','Chanchamayo',1),('120302','1203','Perene',1),('120303','1203','Pichanaqui',1),('120304','1203','San Luis de Shuaro',1),('120305','1203','San Ramón',1),('120306','1203','Vitoc',1),('120401','1204','Jauja',1),('120402','1204','Acolla',1),('120403','1204','Apata',1),('120404','1204','Ataura',1),('120405','1204','Canchayllo',1),('120406','1204','Curicaca',1),('120407','1204','El Mantaro',1),('120408','1204','Huamali',1),('120409','1204','Huaripampa',1),('120410','1204','Huertas',1),('120411','1204','Janjaillo',1),('120412','1204','Julcán',1),('120413','1204','Leonor Ordóñez',1),('120414','1204','Llocllapampa',1),('120415','1204','Marco',1),('120416','1204','Masma',1),('120417','1204','Masma Chicche',1),('120418','1204','Molinos',1),('120419','1204','Monobamba',1),('120420','1204','Muqui',1),('120421','1204','Muquiyauyo',1),('120422','1204','Paca',1),('120423','1204','Paccha',1),('120424','1204','Pancan',1),('120425','1204','Parco',1),('120426','1204','Pomacancha',1),('120427','1204','Ricran',1),('120428','1204','San Lorenzo',1),('120429','1204','San Pedro de Chunan',1),('120430','1204','Sausa',1),('120431','1204','Sincos',1),('120432','1204','Tunan Marca',1),('120433','1204','Yauli',1),('120434','1204','Yauyos',1),('120501','1205','Junin',1),('120502','1205','Carhuamayo',1),('120503','1205','Ondores',1),('120504','1205','Ulcumayo',1),('120601','1206','Satipo',1),('120602','1206','Coviriali',1),('120603','1206','Llaylla',1),('120604','1206','Mazamari',1),('120605','1206','Pampa Hermosa',1),('120606','1206','Pangoa',1),('120607','1206','Río Negro',1),('120608','1206','Río Tambo',1),('120609','1206','Vizcatan del Ene',1),('120701','1207','Tarma',1),('120702','1207','Acobamba',1),('120703','1207','Huaricolca',1),('120704','1207','Huasahuasi',1),('120705','1207','La Unión',1),('120706','1207','Palca',1),('120707','1207','Palcamayo',1),('120708','1207','San Pedro de Cajas',1),('120709','1207','Tapo',1),('120801','1208','La Oroya',1),('120802','1208','Chacapalpa',1),('120803','1208','Huay-Huay',1),('120804','1208','Marcapomacocha',1),('120805','1208','Morococha',1),('120806','1208','Paccha',1),('120807','1208','Santa Bárbara de Carhuacayan',1),('120808','1208','Santa Rosa de Sacco',1),('120809','1208','Suitucancha',1),('120810','1208','Yauli',1),('120901','1209','Chupaca',1),('120902','1209','Ahuac',1),('120903','1209','Chongos Bajo',1),('120904','1209','Huachac',1),('120905','1209','Huamancaca Chico',1),('120906','1209','San Juan de Iscos',1),('120907','1209','San Juan de Jarpa',1),('120908','1209','Tres de Diciembre',1),('120909','1209','Yanacancha',1),('130101','1301','Trujillo',1),('130102','1301','El Porvenir',1),('130103','1301','Florencia de Mora',1),('130104','1301','Huanchaco',1),('130105','1301','La Esperanza',1),('130106','1301','Laredo',1),('130107','1301','Moche',1),('130108','1301','Poroto',1),('130109','1301','Salaverry',1),('130110','1301','Simbal',1),('130111','1301','Victor Larco Herrera',1),('130201','1302','Ascope',1),('130202','1302','Chicama',1),('130203','1302','Chocope',1),('130204','1302','Magdalena de Cao',1),('130205','1302','Paijan',1),('130206','1302','Rázuri',1),('130207','1302','Santiago de Cao',1),('130208','1302','Casa Grande',1),('130301','1303','Bolívar',1),('130302','1303','Bambamarca',1),('130303','1303','Condormarca',1),('130304','1303','Longotea',1),('130305','1303','Uchumarca',1),('130306','1303','Ucuncha',1),('130401','1304','Chepen',1),('130402','1304','Pacanga',1),('130403','1304','Pueblo Nuevo',1),('130501','1305','Julcan',1),('130502','1305','Calamarca',1),('130503','1305','Carabamba',1),('130504','1305','Huaso',1),('130601','1306','Otuzco',1),('130602','1306','Agallpampa',1),('130604','1306','Charat',1),('130605','1306','Huaranchal',1),('130606','1306','La Cuesta',1),('130608','1306','Mache',1),('130610','1306','Paranday',1),('130611','1306','Salpo',1),('130613','1306','Sinsicap',1),('130614','1306','Usquil',1),('130701','1307','San Pedro de Lloc',1),('130702','1307','Guadalupe',1),('130703','1307','Jequetepeque',1),('130704','1307','Pacasmayo',1),('130705','1307','San José',1),('130801','1308','Tayabamba',1),('130802','1308','Buldibuyo',1),('130803','1308','Chillia',1),('130804','1308','Huancaspata',1),('130805','1308','Huaylillas',1),('130806','1308','Huayo',1),('130807','1308','Ongon',1),('130808','1308','Parcoy',1),('130809','1308','Pataz',1),('130810','1308','Pias',1),('130811','1308','Santiago de Challas',1),('130812','1308','Taurija',1),('130813','1308','Urpay',1),('130901','1309','Huamachuco',1),('130902','1309','Chugay',1),('130903','1309','Cochorco',1),('130904','1309','Curgos',1),('130905','1309','Marcabal',1),('130906','1309','Sanagoran',1),('130907','1309','Sarin',1),('130908','1309','Sartimbamba',1),('131001','1310','Santiago de Chuco',1),('131002','1310','Angasmarca',1),('131003','1310','Cachicadan',1),('131004','1310','Mollebamba',1),('131005','1310','Mollepata',1),('131006','1310','Quiruvilca',1),('131007','1310','Santa Cruz de Chuca',1),('131008','1310','Sitabamba',1),('131101','1311','Cascas',1),('131102','1311','Lucma',1),('131103','1311','Marmot',1),('131104','1311','Sayapullo',1),('131201','1312','Viru',1),('131202','1312','Chao',1),('131203','1312','Guadalupito',1),('140101','1401','Chiclayo',1),('140102','1401','Chongoyape',1),('140103','1401','Eten',1),('140104','1401','Eten Puerto',1),('140105','1401','José Leonardo Ortiz',1),('140106','1401','La Victoria',1),('140107','1401','Lagunas',1),('140108','1401','Monsefu',1),('140109','1401','Nueva Arica',1),('140110','1401','Oyotun',1),('140111','1401','Picsi',1),('140112','1401','Pimentel',1),('140113','1401','Reque',1),('140114','1401','Santa Rosa',1),('140115','1401','Saña',1),('140116','1401','Cayalti',1),('140117','1401','Patapo',1),('140118','1401','Pomalca',1),('140119','1401','Pucala',1),('140120','1401','Tuman',1),('140201','1402','Ferreñafe',1),('140202','1402','Cañaris',1),('140203','1402','Incahuasi',1),('140204','1402','Manuel Antonio Mesones Muro',1),('140205','1402','Pitipo',1),('140206','1402','Pueblo Nuevo',1),('140301','1403','Lambayeque',1),('140302','1403','Chochope',1),('140303','1403','Illimo',1),('140304','1403','Jayanca',1),('140305','1403','Mochumi',1),('140306','1403','Morrope',1),('140307','1403','Motupe',1),('140308','1403','Olmos',1),('140309','1403','Pacora',1),('140310','1403','Salas',1),('140311','1403','San José',1),('140312','1403','Tucume',1),('150101','1501','Lima',1),('150102','1501','Ancón',1),('150103','1501','Ate',1),('150104','1501','Barranco',1),('150105','1501','Breña',1),('150106','1501','Carabayllo',1),('150107','1501','Chaclacayo',1),('150108','1501','Chorrillos',1),('150109','1501','Cieneguilla',1),('150110','1501','Comas',1),('150111','1501','El Agustino',1),('150112','1501','Independencia',1),('150113','1501','Jesús María',1),('150114','1501','La Molina',1),('150115','1501','La Victoria',1),('150116','1501','Lince',1),('150117','1501','Los Olivos',1),('150118','1501','Lurigancho',1),('150119','1501','Lurin',1),('150120','1501','Magdalena del Mar',1),('150121','1501','Pueblo Libre',1),('150122','1501','Miraflores',1),('150123','1501','Pachacamac',1),('150124','1501','Pucusana',1),('150125','1501','Puente Piedra',1),('150126','1501','Punta Hermosa',1),('150127','1501','Punta Negra',1),('150128','1501','Rímac',1),('150129','1501','San Bartolo',1),('150130','1501','San Borja',1),('150131','1501','San Isidro',1),('150132','1501','San Juan de Lurigancho',1),('150133','1501','San Juan de Miraflores',1),('150134','1501','San Luis',1),('150135','1501','San Martín de Porres',1),('150136','1501','San Miguel',1),('150137','1501','Santa Anita',1),('150138','1501','Santa María del Mar',1),('150139','1501','Santa Rosa',1),('150140','1501','Santiago de Surco',1),('150141','1501','Surquillo',1),('150142','1501','Villa El Salvador',1),('150143','1501','Villa María del Triunfo',1),('150201','1502','Barranca',1),('150202','1502','Paramonga',1),('150203','1502','Pativilca',1),('150204','1502','Supe',1),('150205','1502','Supe Puerto',1),('150301','1503','Cajatambo',1),('150302','1503','Copa',1),('150303','1503','Gorgor',1),('150304','1503','Huancapon',1),('150305','1503','Manas',1),('150401','1504','Canta',1),('150402','1504','Arahuay',1),('150403','1504','Huamantanga',1),('150404','1504','Huaros',1),('150405','1504','Lachaqui',1),('150406','1504','San Buenaventura',1),('150407','1504','Santa Rosa de Quives',1),('150501','1505','San Vicente de Cañete',1),('150502','1505','Asia',1),('150503','1505','Calango',1),('150504','1505','Cerro Azul',1),('150505','1505','Chilca',1),('150506','1505','Coayllo',1),('150507','1505','Imperial',1),('150508','1505','Lunahuana',1),('150509','1505','Mala',1),('150510','1505','Nuevo Imperial',1),('150511','1505','Pacaran',1),('150512','1505','Quilmana',1),('150513','1505','San Antonio',1),('150514','1505','San Luis',1),('150515','1505','Santa Cruz de Flores',1),('150516','1505','Zúñiga',1),('150601','1506','Huaral',1),('150602','1506','Atavillos Alto',1),('150603','1506','Atavillos Bajo',1),('150604','1506','Aucallama',1),('150605','1506','Chancay',1),('150606','1506','Ihuari',1),('150607','1506','Lampian',1),('150608','1506','Pacaraos',1),('150609','1506','San Miguel de Acos',1),('150610','1506','Santa Cruz de Andamarca',1),('150611','1506','Sumbilca',1),('150612','1506','Veintisiete de Noviembre',1),('150701','1507','Matucana',1),('150702','1507','Antioquia',1),('150703','1507','Callahuanca',1),('150704','1507','Carampoma',1),('150705','1507','Chicla',1),('150706','1507','Cuenca',1),('150707','1507','Huachupampa',1),('150708','1507','Huanza',1),('150709','1507','Huarochiri',1),('150710','1507','Lahuaytambo',1),('150711','1507','Langa',1),('150712','1507','Laraos',1),('150713','1507','Mariatana',1),('150714','1507','Ricardo Palma',1),('150715','1507','San Andrés de Tupicocha',1),('150716','1507','San Antonio',1),('150717','1507','San Bartolomé',1),('150718','1507','San Damian',1),('150719','1507','San Juan de Iris',1),('150720','1507','San Juan de Tantaranche',1),('150721','1507','San Lorenzo de Quinti',1),('150722','1507','San Mateo',1),('150723','1507','San Mateo de Otao',1),('150724','1507','San Pedro de Casta',1),('150725','1507','San Pedro de Huancayre',1),('150726','1507','Sangallaya',1),('150727','1507','Santa Cruz de Cocachacra',1),('150728','1507','Santa Eulalia',1),('150729','1507','Santiago de Anchucaya',1),('150730','1507','Santiago de Tuna',1),('150731','1507','Santo Domingo de Los Olleros',1),('150732','1507','Surco',1),('150801','1508','Huacho',1),('150802','1508','Ambar',1),('150803','1508','Caleta de Carquin',1),('150804','1508','Checras',1),('150805','1508','Hualmay',1),('150806','1508','Huaura',1),('150807','1508','Leoncio Prado',1),('150808','1508','Paccho',1),('150809','1508','Santa Leonor',1),('150810','1508','Santa María',1),('150811','1508','Sayan',1),('150812','1508','Vegueta',1),('150901','1509','Oyon',1),('150902','1509','Andajes',1),('150903','1509','Caujul',1),('150904','1509','Cochamarca',1),('150905','1509','Navan',1),('150906','1509','Pachangara',1),('151001','1510','Yauyos',1),('151002','1510','Alis',1),('151003','1510','Allauca',1),('151004','1510','Ayaviri',1),('151005','1510','Azángaro',1),('151006','1510','Cacra',1),('151007','1510','Carania',1),('151008','1510','Catahuasi',1),('151009','1510','Chocos',1),('151010','1510','Cochas',1),('151011','1510','Colonia',1),('151012','1510','Hongos',1),('151013','1510','Huampara',1),('151014','1510','Huancaya',1),('151015','1510','Huangascar',1),('151016','1510','Huantan',1),('151017','1510','Huañec',1),('151018','1510','Laraos',1),('151019','1510','Lincha',1),('151020','1510','Madean',1),('151021','1510','Miraflores',1),('151022','1510','Omas',1),('151023','1510','Putinza',1),('151024','1510','Quinches',1),('151025','1510','Quinocay',1),('151026','1510','San Joaquín',1),('151027','1510','San Pedro de Pilas',1),('151028','1510','Tanta',1),('151029','1510','Tauripampa',1),('151030','1510','Tomas',1),('151031','1510','Tupe',1),('151032','1510','Viñac',1),('151033','1510','Vitis',1),('160101','1601','Iquitos',1),('160102','1601','Alto Nanay',1),('160103','1601','Fernando Lores',1),('160104','1601','Indiana',1),('160105','1601','Las Amazonas',1),('160106','1601','Mazan',1),('160107','1601','Napo',1),('160108','1601','Punchana',1),('160110','1601','Torres Causana',1),('160112','1601','Belén',1),('160113','1601','San Juan Bautista',1),('160201','1602','Yurimaguas',1),('160202','1602','Balsapuerto',1),('160205','1602','Jeberos',1),('160206','1602','Lagunas',1),('160210','1602','Santa Cruz',1),('160211','1602','Teniente Cesar López Rojas',1),('160301','1603','Nauta',1),('160302','1603','Parinari',1),('160303','1603','Tigre',1),('160304','1603','Trompeteros',1),('160305','1603','Urarinas',1),('160401','1604','Ramón Castilla',1),('160402','1604','Pebas',1),('160403','1604','Yavari',1),('160404','1604','San Pablo',1),('160501','1605','Requena',1),('160502','1605','Alto Tapiche',1),('160503','1605','Capelo',1),('160504','1605','Emilio San Martín',1),('160505','1605','Maquia',1),('160506','1605','Puinahua',1),('160507','1605','Saquena',1),('160508','1605','Soplin',1),('160509','1605','Tapiche',1),('160510','1605','Jenaro Herrera',1),('160511','1605','Yaquerana',1),('160601','1606','Contamana',1),('160602','1606','Inahuaya',1),('160603','1606','Padre Márquez',1),('160604','1606','Pampa Hermosa',1),('160605','1606','Sarayacu',1),('160606','1606','Vargas Guerra',1),('160701','1607','Barranca',1),('160702','1607','Cahuapanas',1),('160703','1607','Manseriche',1),('160704','1607','Morona',1),('160705','1607','Pastaza',1),('160706','1607','Andoas',1),('160801','1608','Putumayo',1),('160802','1608','Rosa Panduro',1),('160803','1608','Teniente Manuel Clavero',1),('160804','1608','Yaguas',1),('170101','1701','Tambopata',1),('170102','1701','Inambari',1),('170103','1701','Las Piedras',1),('170104','1701','Laberinto',1),('170201','1702','Manu',1),('170202','1702','Fitzcarrald',1),('170203','1702','Madre de Dios',1),('170204','1702','Huepetuhe',1),('170301','1703','Iñapari',1),('170302','1703','Iberia',1),('170303','1703','Tahuamanu',1),('180101','1801','Moquegua',1),('180102','1801','Carumas',1),('180103','1801','Cuchumbaya',1),('180104','1801','Samegua',1),('180105','1801','San Cristóbal',1),('180106','1801','Torata',1),('180201','1802','Omate',1),('180202','1802','Chojata',1),('180203','1802','Coalaque',1),('180204','1802','Ichuña',1),('180205','1802','La Capilla',1),('180206','1802','Lloque',1),('180207','1802','Matalaque',1),('180208','1802','Puquina',1),('180209','1802','Quinistaquillas',1),('180210','1802','Ubinas',1),('180211','1802','Yunga',1),('180301','1803','Ilo',1),('180302','1803','El Algarrobal',1),('180303','1803','Pacocha',1),('190101','1901','Chaupimarca',1),('190102','1901','Huachon',1),('190103','1901','Huariaca',1),('190104','1901','Huayllay',1),('190105','1901','Ninacaca',1),('190106','1901','Pallanchacra',1),('190107','1901','Paucartambo',1),('190108','1901','San Francisco de Asís de Yarusyacan',1),('190109','1901','Simon Bolívar',1),('190110','1901','Ticlacayan',1),('190111','1901','Tinyahuarco',1),('190112','1901','Vicco',1),('190113','1901','Yanacancha',1),('190201','1902','Yanahuanca',1),('190202','1902','Chacayan',1),('190203','1902','Goyllarisquizga',1),('190204','1902','Paucar',1),('190205','1902','San Pedro de Pillao',1),('190206','1902','Santa Ana de Tusi',1),('190207','1902','Tapuc',1),('190208','1902','Vilcabamba',1),('190301','1903','Oxapampa',1),('190302','1903','Chontabamba',1),('190303','1903','Huancabamba',1),('190304','1903','Palcazu',1),('190305','1903','Pozuzo',1),('190306','1903','Puerto Bermúdez',1),('190307','1903','Villa Rica',1),('190308','1903','Constitución',1),('200101','2001','Piura',1),('200104','2001','Castilla',1),('200105','2001','Catacaos',1),('200107','2001','Cura Mori',1),('200108','2001','El Tallan',1),('200109','2001','La Arena',1),('200110','2001','La Unión',1),('200111','2001','Las Lomas',1),('200114','2001','Tambo Grande',1),('200115','2001','Veintiseis de Octubre',1),('200201','2002','Ayabaca',1),('200202','2002','Frias',1),('200203','2002','Jilili',1),('200204','2002','Lagunas',1),('200205','2002','Montero',1),('200206','2002','Pacaipampa',1),('200207','2002','Paimas',1),('200208','2002','Sapillica',1),('200209','2002','Sicchez',1),('200210','2002','Suyo',1),('200301','2003','Huancabamba',1),('200302','2003','Canchaque',1),('200303','2003','El Carmen de la Frontera',1),('200304','2003','Huarmaca',1),('200305','2003','Lalaquiz',1),('200306','2003','San Miguel de El Faique',1),('200307','2003','Sondor',1),('200308','2003','Sondorillo',1),('200401','2004','Chulucanas',1),('200402','2004','Buenos Aires',1),('200403','2004','Chalaco',1),('200404','2004','La Matanza',1),('200405','2004','Morropon',1),('200406','2004','Salitral',1),('200407','2004','San Juan de Bigote',1),('200408','2004','Santa Catalina de Mossa',1),('200409','2004','Santo Domingo',1),('200410','2004','YAMANGO',1),('200501','2005','PAITA',1),('200502','2005','AMOTAPE',1),('200503','2005','ARENAL',1),('200504','2005','COLAN',1),('200505','2005','LA HUACA',1),('200506','2005','Tamarindo',1),('200507','2005','Vichayal',1),('200601','2006','SULLANA',1),('200602','2006','Bellavista',1),('200603','2006','Ignacio Escudero',1),('200604','2006','Lancones',1),('200605','2006','Marcavelica',1),('200606','2006','Miguel Checa',1),('200607','2006','Querecotillo',1),('200608','2006','Salitral',1),('200701','2007','PARIÑAS',1),('200702','2007','EL ALTO',1),('200703','2007','LA BREA',1),('200704','2007','LOBITOS',1),('200705','2007','Los Organos',1),('200706','2007','MANCORA',1),('200801','2008','SECHURA',1),('200802','2008','Bellavista de la Unión',1),('200803','2008','BERNAL',1),('200804','2008','Cristo Nos Valga',1),('200805','2008','Vice',1),('200806','2008','Rinconada Llicuar',1),('210101','2101','Puno',1),('210102','2101','Acora',1),('210103','2101','Amantani',1),('210104','2101','Atuncolla',1),('210105','2101','Capachica',1),('210106','2101','Chucuito',1),('210107','2101','Coata',1),('210108','2101','Huata',1),('210109','2101','Mañazo',1),('210110','2101','Paucarcolla',1),('210111','2101','Pichacani',1),('210112','2101','Plateria',1),('210113','2101','San Antonio',1),('210114','2101','Tiquillaca',1),('210115','2101','Vilque',1),('210201','2102','Azángaro',1),('210202','2102','Achaya',1),('210203','2102','Arapa',1),('210204','2102','Asillo',1),('210205','2102','Caminaca',1),('210206','2102','Chupa',1),('210207','2102','José Domingo Choquehuanca',1),('210208','2102','Muñani',1),('210209','2102','Potoni',1),('210210','2102','Saman',1),('210211','2102','San Anton',1),('210212','2102','San José',1),('210213','2102','San Juan de Salinas',1),('210214','2102','Santiago de Pupuja',1),('210215','2102','Tirapata',1),('210301','2103','Macusani',1),('210302','2103','Ajoyani',1),('210303','2103','Ayapata',1),('210304','2103','Coasa',1),('210305','2103','Corani',1),('210306','2103','Crucero',1),('210307','2103','Ituata',1),('210308','2103','Ollachea',1),('210309','2103','San Gaban',1),('210310','2103','Usicayos',1),('210401','2104','Juli',1),('210402','2104','Desaguadero',1),('210403','2104','Huacullani',1),('210404','2104','Kelluyo',1),('210405','2104','Pisacoma',1),('210406','2104','Pomata',1),('210407','2104','Zepita',1),('210501','2105','Ilave',1),('210502','2105','Capazo',1),('210503','2105','Pilcuyo',1),('210504','2105','Santa Rosa',1),('210505','2105','Conduriri',1),('210601','2106','Huancane',1),('210602','2106','Cojata',1),('210603','2106','Huatasani',1),('210604','2106','Inchupalla',1),('210605','2106','Pusi',1),('210606','2106','Rosaspata',1),('210607','2106','Taraco',1),('210608','2106','Vilque Chico',1),('210701','2107','Lampa',1),('210702','2107','Cabanilla',1),('210703','2107','Calapuja',1),('210704','2107','Nicasio',1),('210705','2107','Ocuviri',1),('210706','2107','Palca',1),('210707','2107','Paratia',1),('210708','2107','Pucara',1),('210709','2107','Santa Lucia',1),('210710','2107','Vilavila',1),('210801','2108','Ayaviri',1),('210802','2108','Antauta',1),('210803','2108','Cupi',1),('210804','2108','Llalli',1),('210805','2108','Macari',1),('210806','2108','Nuñoa',1),('210807','2108','Orurillo',1),('210808','2108','Santa Rosa',1),('210809','2108','Umachiri',1),('210901','2109','Moho',1),('210902','2109','Conima',1),('210903','2109','Huayrapata',1),('210904','2109','Tilali',1),('211001','2110','Putina',1),('211002','2110','Ananea',1),('211003','2110','Pedro Vilca Apaza',1),('211004','2110','Quilcapuncu',1),('211005','2110','Sina',1),('211101','2111','Juliaca',1),('211102','2111','Cabana',1),('211103','2111','Cabanillas',1),('211104','2111','Caracoto',1),('211105','2111','San Miguel',1),('211201','2112','Sandia',1),('211202','2112','Cuyocuyo',1),('211203','2112','Limbani',1),('211204','2112','Patambuco',1),('211205','2112','Phara',1),('211206','2112','Quiaca',1),('211207','2112','San Juan del Oro',1),('211208','2112','Yanahuaya',1),('211209','2112','Alto Inambari',1),('211210','2112','San Pedro de Putina Punco',1),('211301','2113','Yunguyo',1),('211302','2113','Anapia',1),('211303','2113','Copani',1),('211304','2113','Cuturapi',1),('211305','2113','Ollaraya',1),('211306','2113','Tinicachi',1),('211307','2113','Unicachi',1),('220101','2201','Moyobamba',1),('220102','2201','Calzada',1),('220103','2201','Habana',1),('220104','2201','Jepelacio',1),('220105','2201','Soritor',1),('220106','2201','Yantalo',1),('220201','2202','Bellavista',1),('220202','2202','Alto Biavo',1),('220203','2202','Bajo Biavo',1),('220204','2202','Huallaga',1),('220205','2202','San Pablo',1),('220206','2202','San Rafael',1),('220301','2203','San José de Sisa',1),('220302','2203','Agua Blanca',1),('220303','2203','San Martín',1),('220304','2203','Santa Rosa',1),('220305','2203','Shatoja',1),('220401','2204','Saposoa',1),('220402','2204','Alto Saposoa',1),('220403','2204','El Eslabón',1),('220404','2204','Piscoyacu',1),('220405','2204','Sacanche',1),('220406','2204','Tingo de Saposoa',1),('220501','2205','Lamas',1),('220502','2205','Alonso de Alvarado',1),('220503','2205','Barranquita',1),('220504','2205','Caynarachi',1),('220505','2205','Cuñumbuqui',1),('220506','2205','Pinto Recodo',1),('220507','2205','Rumisapa',1),('220508','2205','San Roque de Cumbaza',1),('220509','2205','Shanao',1),('220510','2205','Tabalosos',1),('220511','2205','Zapatero',1),('220601','2206','Juanjuí',1),('220602','2206','Campanilla',1),('220603','2206','Huicungo',1),('220604','2206','Pachiza',1),('220605','2206','Pajarillo',1),('220701','2207','Picota',1),('220702','2207','Buenos Aires',1),('220703','2207','Caspisapa',1),('220704','2207','Pilluana',1),('220705','2207','Pucacaca',1),('220706','2207','San Cristóbal',1),('220707','2207','San Hilarión',1),('220708','2207','Shamboyacu',1),('220709','2207','Tingo de Ponasa',1),('220710','2207','Tres Unidos',1),('220801','2208','Rioja',1),('220802','2208','Awajun',1),('220803','2208','Elías Soplin Vargas',1),('220804','2208','Nueva Cajamarca',1),('220805','2208','Pardo Miguel',1),('220806','2208','Posic',1),('220807','2208','San Fernando',1),('220808','2208','Yorongos',1),('220809','2208','Yuracyacu',1),('220901','2209','Tarapoto',1),('220902','2209','Alberto Leveau',1),('220903','2209','Cacatachi',1),('220904','2209','Chazuta',1),('220905','2209','Chipurana',1),('220906','2209','El Porvenir',1),('220907','2209','Huimbayoc',1),('220908','2209','Juan Guerra',1),('220909','2209','La Banda de Shilcayo',1),('220910','2209','Morales',1),('220911','2209','Papaplaya',1),('220912','2209','San Antonio',1),('220913','2209','Sauce',1),('220914','2209','Shapaja',1),('221001','2210','Tocache',1),('221002','2210','Nuevo Progreso',1),('221003','2210','Polvora',1),('221004','2210','Shunte',1),('221005','2210','Uchiza',1),('230101','2301','Tacna',1),('230102','2301','Alto de la Alianza',1),('230103','2301','Calana',1),('230104','2301','Ciudad Nueva',1),('230105','2301','Inclan',1),('230106','2301','Pachia',1),('230107','2301','Palca',1),('230108','2301','Pocollay',1),('230109','2301','Sama',1),('230110','2301','Coronel Gregorio Albarracín Lanchipa',1),('230111','2301','La Yarada los Palos',1),('230201','2302','Candarave',1),('230202','2302','Cairani',1),('230203','2302','Camilaca',1),('230204','2302','Curibaya',1),('230205','2302','Huanuara',1),('230206','2302','Quilahuani',1),('230301','2303','Locumba',1),('230302','2303','Ilabaya',1),('230303','2303','Ite',1),('230401','2304','Tarata',1),('230402','2304','Héroes Albarracín',1),('230403','2304','Estique',1),('230404','2304','Estique-Pampa',1),('230405','2304','Sitajara',1),('230406','2304','Susapaya',1),('230407','2304','Tarucachi',1),('230408','2304','Ticaco',1),('240101','2401','Tumbes',1),('240102','2401','Corrales',1),('240103','2401','La Cruz',1),('240104','2401','Pampas de Hospital',1),('240105','2401','San Jacinto',1),('240106','2401','San Juan de la Virgen',1),('240201','2402','Zorritos',1),('240202','2402','Casitas',1),('240203','2402','Canoas de Punta Sal',1),('240301','2403','Zarumilla',1),('240302','2403','Aguas Verdes',1),('240303','2403','Matapalo',1),('240304','2403','Papayal',1),('250101','2501','Calleria',1),('250102','2501','Campoverde',1),('250103','2501','Iparia',1),('250104','2501','Masisea',1),('250105','2501','Yarinacocha',1),('250106','2501','Nueva Requena',1),('250107','2501','Manantay',1),('250201','2502','Raymondi',1),('250202','2502','Sepahua',1),('250203','2502','Tahuania',1),('250204','2502','Yurua',1),('250301','2503','Padre Abad',1),('250302','2503','Irazola',1),('250303','2503','Curimana',1),('250304','2503','Neshuya',1),('250305','2503','Alexander Von Humboldt',1),('250401','2504','Purus',1),('250307','2503','Boqueron',1),('080915','0809','Kumpirushiato',1),('080916','0809','Cielo Punco',1),('080917','0809','Manitea',1),('080918','0809','Megantoni',1),('080919','0809','Union Ashaninka',1),('080914','0809','Megantoni',1),('050511','0505','Oronccoy',1);

--
-- Table structure for table `document_fee`
--

CREATE TABLE `document_fee` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_method_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Relacion con el metodo de pago, Nulo es pago a cuotas',
  PRIMARY KEY (`id`),
  KEY `document_fee_document_id_foreign` (`document_id`),
  KEY `document_fee_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `document_fee_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `document_fee_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_fee`
--


--
-- Table structure for table `document_hotels`
--

CREATE TABLE `document_hotels` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `identity_document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sex` enum('M','F') COLLATE utf8mb4_unicode_ci NOT NULL,
  `age` int(11) NOT NULL,
  `civil_status` enum('S','C','V','D') COLLATE utf8mb4_unicode_ci NOT NULL,
  `nacionality` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `origin` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `room_number` int(11) NOT NULL,
  `date_entry` date NOT NULL,
  `time_entry` time NOT NULL,
  `date_exit` date NOT NULL,
  `time_exit` time NOT NULL,
  `ocupation` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `room_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `guests` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`guests`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `document_hotels_document_id_foreign` (`document_id`),
  KEY `document_hotels_identity_document_type_id_foreign` (`identity_document_type_id`),
  CONSTRAINT `document_hotels_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `document_hotels_identity_document_type_id_foreign` FOREIGN KEY (`identity_document_type_id`) REFERENCES `cat_identity_document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_hotels`
--


--
-- Table structure for table `document_items`
--

CREATE TABLE `document_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `document_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `additional_information` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `warehouse_id` int(10) unsigned DEFAULT NULL,
  `name_product_pdf` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `additional_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`additional_data`)),
  `name_product_xml` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `document_items_document_id_foreign` (`document_id`),
  KEY `document_items_item_id_foreign` (`item_id`),
  KEY `document_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `document_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `document_items_price_type_id_foreign` (`price_type_id`),
  KEY `document_items_warehouse_id_foreign` (`warehouse_id`),
  CONSTRAINT `document_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `document_items_document_id_foreign` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  CONSTRAINT `document_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  CONSTRAINT `document_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `document_items_system_isc_type_id_foreign` FOREIGN KEY (`system_isc_type_id`) REFERENCES `cat_system_isc_types` (`id`),
  CONSTRAINT `document_items_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_items`
--

INSERT INTO `document_items` VALUES (1,1,74,'{\"description\":\"1 litro CHICHA MORADA\",\"item_type_id\":\"01\",\"internal_id\":\"BI074\",\"item_code\":\"\",\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"presentation\":[],\"amount_plastic_bag_taxes\":\"0.10\",\"is_set\":0,\"lots\":[],\"IdLoteSelected\":null,\"model\":null,\"sanitary\":null,\"cod_digemid\":null,\"date_of_due\":null,\"has_igv\":true,\"unit_price\":15,\"purchase_unit_price\":0,\"exchanged_for_points\":false,\"used_points_for_exchange\":null,\"extra\":{\"colors\":null,\"CatItemUnitsPerPackage\":null,\"CatItemMoldProperty\":null,\"CatItemProductFamily\":null,\"CatItemMoldCavity\":null,\"CatItemPackageMeasurement\":null,\"CatItemStatus\":null,\"CatItemUnitBusiness\":null,\"CatItemSize\":null,\"string\":{\"colors\":\"\",\"CatItemUnitsPerPackage\":\"\",\"CatItemMoldProperty\":\"\",\"CatItemProductFamily\":\"\",\"CatItemMoldCavity\":\"\",\"CatItemPackageMeasurement\":\"\",\"CatItemStatus\":\"\",\"CatItemUnitBusiness\":\"\",\"CatItemSize\":\"\"}}}',1.0000,15.000000,'20',15.00,18.00,0.00,NULL,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,'01',15.000000,15.00,0.00,0.00,15.00,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL),(2,1,44,'{\"description\":\"Tallar\\u00edn taypa especial\",\"item_type_id\":\"01\",\"internal_id\":\"BI044\",\"item_code\":\"\",\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"presentation\":[],\"amount_plastic_bag_taxes\":\"0.10\",\"is_set\":0,\"lots\":[],\"IdLoteSelected\":null,\"model\":null,\"sanitary\":null,\"cod_digemid\":null,\"date_of_due\":null,\"has_igv\":true,\"unit_price\":35,\"purchase_unit_price\":0,\"exchanged_for_points\":false,\"used_points_for_exchange\":null,\"extra\":{\"colors\":null,\"CatItemUnitsPerPackage\":null,\"CatItemMoldProperty\":null,\"CatItemProductFamily\":null,\"CatItemMoldCavity\":null,\"CatItemPackageMeasurement\":null,\"CatItemStatus\":null,\"CatItemUnitBusiness\":null,\"CatItemSize\":null,\"string\":{\"colors\":\"\",\"CatItemUnitsPerPackage\":\"\",\"CatItemMoldProperty\":\"\",\"CatItemProductFamily\":\"\",\"CatItemMoldCavity\":\"\",\"CatItemPackageMeasurement\":\"\",\"CatItemStatus\":\"\",\"CatItemUnitBusiness\":\"\",\"CatItemSize\":\"\"}}}',1.0000,35.000000,'20',35.00,18.00,0.00,NULL,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,'01',35.000000,35.00,0.00,0.00,35.00,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL),(3,2,80,'{\"description\":\"1 litro BATIDO DE DURAZNO\",\"item_type_id\":\"01\",\"internal_id\":\"BI080\",\"item_code\":\"\",\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"presentation\":[],\"amount_plastic_bag_taxes\":\"0.10\",\"is_set\":0,\"lots\":[],\"IdLoteSelected\":null,\"model\":null,\"sanitary\":null,\"cod_digemid\":null,\"date_of_due\":null,\"has_igv\":true,\"unit_price\":16,\"purchase_unit_price\":0,\"exchanged_for_points\":false,\"used_points_for_exchange\":null,\"extra\":{\"colors\":null,\"CatItemUnitsPerPackage\":null,\"CatItemMoldProperty\":null,\"CatItemProductFamily\":null,\"CatItemMoldCavity\":null,\"CatItemPackageMeasurement\":null,\"CatItemStatus\":null,\"CatItemUnitBusiness\":null,\"CatItemSize\":null,\"string\":{\"colors\":\"\",\"CatItemUnitsPerPackage\":\"\",\"CatItemMoldProperty\":\"\",\"CatItemProductFamily\":\"\",\"CatItemMoldCavity\":\"\",\"CatItemPackageMeasurement\":\"\",\"CatItemStatus\":\"\",\"CatItemUnitBusiness\":\"\",\"CatItemSize\":\"\"}}}',1.0000,16.000000,'20',16.00,18.00,0.00,NULL,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,'01',16.000000,16.00,0.00,0.00,16.00,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL),(4,2,46,'{\"description\":\"1\\/2 POLLO\",\"item_type_id\":\"01\",\"internal_id\":\"BI046\",\"item_code\":\"\",\"item_code_gs1\":null,\"unit_type_id\":\"NIU\",\"presentation\":[],\"amount_plastic_bag_taxes\":\"0.10\",\"is_set\":0,\"lots\":[],\"IdLoteSelected\":null,\"model\":null,\"sanitary\":null,\"cod_digemid\":null,\"date_of_due\":null,\"has_igv\":true,\"unit_price\":30,\"purchase_unit_price\":0,\"exchanged_for_points\":false,\"used_points_for_exchange\":null,\"extra\":{\"colors\":null,\"CatItemUnitsPerPackage\":null,\"CatItemMoldProperty\":null,\"CatItemProductFamily\":null,\"CatItemMoldCavity\":null,\"CatItemPackageMeasurement\":null,\"CatItemStatus\":null,\"CatItemUnitBusiness\":null,\"CatItemSize\":null,\"string\":{\"colors\":\"\",\"CatItemUnitsPerPackage\":\"\",\"CatItemMoldProperty\":\"\",\"CatItemProductFamily\":\"\",\"CatItemMoldCavity\":\"\",\"CatItemPackageMeasurement\":\"\",\"CatItemStatus\":\"\",\"CatItemUnitBusiness\":\"\",\"CatItemSize\":\"\"}}}',1.0000,30.000000,'20',30.00,18.00,0.00,NULL,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,'01',30.000000,30.00,0.00,0.00,30.00,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL);

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

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

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

INSERT INTO `document_payments` VALUES (1,1,'2022-12-06','01',0,NULL,NULL,1,NULL,50.00),(2,2,'2022-12-06','01',0,NULL,NULL,1,NULL,46.00);

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


--
-- Table structure for table `download_tray`
--

CREATE TABLE `download_tray` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL,
  `module` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `format` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'IN_PROCESS',
  `date_init` datetime DEFAULT NULL,
  `date_end` datetime DEFAULT NULL,
  `payload_request` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `download_tray_user_id_foreign` (`user_id`),
  CONSTRAINT `download_tray_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `download_tray`
--


--
-- Table structure for table `drivers`
--

CREATE TABLE `drivers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `identity_document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `license` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `telephone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 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`),
  KEY `drivers_identity_document_type_id_foreign` (`identity_document_type_id`),
  KEY `drivers_number_index` (`number`),
  KEY `drivers_name_index` (`name`),
  CONSTRAINT `drivers_identity_document_type_id_foreign` FOREIGN KEY (`identity_document_type_id`) REFERENCES `cat_identity_document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `drivers`
--


--
-- Table structure for table `email_send_log`
--

CREATE TABLE `email_send_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `relation_id` int(10) unsigned DEFAULT 0 COMMENT 'Id de modelo',
  `type` int(10) unsigned DEFAULT 0 COMMENT 'Tipo de relacion',
  `relation_model` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Modelo a relacion',
  `file_line` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Archivo qu elo llama',
  `sendit` tinyint(3) unsigned DEFAULT 1 COMMENT 'Booleano para envio de correo',
  `email` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Correo de destino',
  `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 `email_send_log`
--


--
-- Table structure for table `establishments`
--

CREATE TABLE `establishments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `country_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `department_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `province_id` char(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `district_id` char(6) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `telephone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `aditional_information` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `web_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `trade_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `customer_id` int(10) unsigned DEFAULT NULL,
  `logo` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `template_pdf` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default',
  `has_igv_31556` tinyint(1) NOT NULL DEFAULT 0,
  `template_ticket_pdf` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `establishments_country_id_foreign` (`country_id`),
  KEY `establishments_department_id_foreign` (`department_id`),
  KEY `establishments_province_id_foreign` (`province_id`),
  KEY `establishments_district_id_foreign` (`district_id`),
  CONSTRAINT `establishments_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`),
  CONSTRAINT `establishments_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`),
  CONSTRAINT `establishments_district_id_foreign` FOREIGN KEY (`district_id`) REFERENCES `districts` (`id`),
  CONSTRAINT `establishments_province_id_foreign` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `establishments`
--

INSERT INTO `establishments` VALUES (1,'Oficina Principal','PE','06','0608','060801','CAL. VILLANUEVA PINILLOS NRO. 366','campero@gmail.com','968144204','0000',NULL,NULL,NULL,NULL,NULL,'default',0,'default',NULL,'2022-11-26 14:44:26');

--
-- Table structure for table `exchange_rates`
--

CREATE TABLE `exchange_rates` (
  `date` date NOT NULL,
  `sale_original` decimal(13,3) NOT NULL,
  `purchase_original` decimal(13,3) NOT NULL,
  `purchase` decimal(13,3) NOT NULL,
  `sale` decimal(13,3) NOT NULL,
  `date_original` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `exchange_rates`
--

INSERT INTO `exchange_rates` VALUES ('2022-11-26',3.873,3.865,3.865,3.873,'2022-11-26','2022-11-26 14:39:30','2022-11-26 14:39:30'),('2022-12-06',3.848,3.844,3.844,3.848,'2022-12-06','2022-12-06 15:52:17','2022-12-06 15:52:17'),('2022-12-07',3.851,3.843,3.843,3.851,'2022-12-07','2022-12-07 20:42:31','2022-12-07 20:42:31'),('2022-12-14',3.840,3.828,3.828,3.840,'2022-12-13','2022-12-14 07:49:29','2022-12-14 07:49:29');

--
-- Table structure for table `expense_items`
--

CREATE TABLE `expense_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `expense_id` int(10) unsigned NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `expense_items_expense_id_foreign` (`expense_id`),
  CONSTRAINT `expense_items_expense_id_foreign` FOREIGN KEY (`expense_id`) REFERENCES `expenses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_items`
--


--
-- Table structure for table `expense_method_types`
--

CREATE TABLE `expense_method_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_method_types`
--

INSERT INTO `expense_method_types` VALUES (1,'CAJA GENERAL',0),(2,'Tarjeta de crédito',1),(3,'Tarjeta de débito',1);

--
-- Table structure for table `expense_payments`
--

CREATE TABLE `expense_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `expense_id` int(10) unsigned NOT NULL,
  `date_of_payment` date NOT NULL,
  `expense_method_type_id` int(10) unsigned NOT NULL,
  `has_card` tinyint(1) NOT NULL DEFAULT 0,
  `card_brand_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `expense_payments_expense_id_foreign` (`expense_id`),
  KEY `expense_payments_card_brand_id_foreign` (`card_brand_id`),
  KEY `expense_payments_expense_method_type_id_foreign` (`expense_method_type_id`),
  KEY `expense_payments_date_of_payment_index` (`date_of_payment`),
  CONSTRAINT `expense_payments_card_brand_id_foreign` FOREIGN KEY (`card_brand_id`) REFERENCES `card_brands` (`id`),
  CONSTRAINT `expense_payments_expense_id_foreign` FOREIGN KEY (`expense_id`) REFERENCES `expenses` (`id`) ON DELETE CASCADE,
  CONSTRAINT `expense_payments_expense_method_type_id_foreign` FOREIGN KEY (`expense_method_type_id`) REFERENCES `expense_method_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_payments`
--


--
-- Table structure for table `expense_reasons`
--

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

--
-- Dumping data for table `expense_reasons`
--

INSERT INTO `expense_reasons` VALUES (1,'Varios'),(2,'Representación de la organización'),(3,'Trabajo de campo');

--
-- Table structure for table `expense_types`
--

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

--
-- Dumping data for table `expense_types`
--

INSERT INTO `expense_types` VALUES (1,'PLANILLA','2022-11-24 16:24:11','2022-11-24 16:24:11'),(2,'RECIBO POR HONORARIO','2022-11-24 16:24:11','2022-11-24 16:24:11'),(3,'SERVICIO PÚBLICO','2022-11-24 16:24:11','2022-11-24 16:24:11'),(4,'OTROS','2022-11-24 16:24:11','2022-11-24 16:24:11');

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `expense_type_id` int(10) unsigned NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `expense_reason_id` int(10) unsigned NOT NULL DEFAULT 1,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state_type_id` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `expenses_filename_unique` (`filename`),
  KEY `expenses_user_id_foreign` (`user_id`),
  KEY `expenses_establishment_id_foreign` (`establishment_id`),
  KEY `expenses_supplier_id_foreign` (`supplier_id`),
  KEY `expenses_expense_type_id_foreign` (`expense_type_id`),
  KEY `expenses_currency_type_id_foreign` (`currency_type_id`),
  KEY `expenses_expense_reason_id_foreign` (`expense_reason_id`),
  KEY `expenses_soap_type_id_foreign` (`soap_type_id`),
  KEY `expenses_state_type_id_foreign` (`state_type_id`),
  CONSTRAINT `expenses_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `expenses_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `expenses_expense_reason_id_foreign` FOREIGN KEY (`expense_reason_id`) REFERENCES `expense_reasons` (`id`),
  CONSTRAINT `expenses_expense_type_id_foreign` FOREIGN KEY (`expense_type_id`) REFERENCES `expense_types` (`id`),
  CONSTRAINT `expenses_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `expenses_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `expenses_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expenses`
--


--
-- Table structure for table `fixed_asset_items`
--

CREATE TABLE `fixed_asset_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `item_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `internal_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `unit_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_unit_price` decimal(16,6) NOT NULL,
  `purchase_affectation_igv_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fixed_asset_items_item_type_id_foreign` (`item_type_id`),
  KEY `fixed_asset_items_unit_type_id_foreign` (`unit_type_id`),
  KEY `fixed_asset_items_currency_type_id_foreign` (`currency_type_id`),
  KEY `fixed_asset_items_purchase_affectation_igv_type_id_foreign` (`purchase_affectation_igv_type_id`),
  CONSTRAINT `fixed_asset_items_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `fixed_asset_items_item_type_id_foreign` FOREIGN KEY (`item_type_id`) REFERENCES `item_types` (`id`),
  CONSTRAINT `fixed_asset_items_purchase_affectation_igv_type_id_foreign` FOREIGN KEY (`purchase_affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `fixed_asset_items_unit_type_id_foreign` FOREIGN KEY (`unit_type_id`) REFERENCES `cat_unit_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `fixed_asset_items`
--


--
-- Table structure for table `fixed_asset_purchase_items`
--

CREATE TABLE `fixed_asset_purchase_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fixed_asset_purchase_id` int(10) unsigned NOT NULL,
  `fixed_asset_item_id` int(10) unsigned NOT NULL,
  `item` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item`)),
  `quantity` decimal(12,4) NOT NULL,
  `unit_value` decimal(16,6) NOT NULL,
  `affectation_igv_type_id` varchar(255) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci 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) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_price` decimal(16,6) NOT NULL,
  `total_value` decimal(12,2) NOT NULL,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  PRIMARY KEY (`id`),
  KEY `fixed_asset_purchase_items_fixed_asset_purchase_id_foreign` (`fixed_asset_purchase_id`),
  KEY `fixed_asset_purchase_items_fixed_asset_item_id_foreign` (`fixed_asset_item_id`),
  KEY `fixed_asset_purchase_items_affectation_igv_type_id_foreign` (`affectation_igv_type_id`),
  KEY `fixed_asset_purchase_items_system_isc_type_id_foreign` (`system_isc_type_id`),
  KEY `fixed_asset_purchase_items_price_type_id_foreign` (`price_type_id`),
  CONSTRAINT `fixed_asset_purchase_items_affectation_igv_type_id_foreign` FOREIGN KEY (`affectation_igv_type_id`) REFERENCES `cat_affectation_igv_types` (`id`),
  CONSTRAINT `fixed_asset_purchase_items_fixed_asset_item_id_foreign` FOREIGN KEY (`fixed_asset_item_id`) REFERENCES `fixed_asset_items` (`id`),
  CONSTRAINT `fixed_asset_purchase_items_fixed_asset_purchase_id_foreign` FOREIGN KEY (`fixed_asset_purchase_id`) REFERENCES `fixed_asset_purchases` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fixed_asset_purchase_items_price_type_id_foreign` FOREIGN KEY (`price_type_id`) REFERENCES `cat_price_types` (`id`),
  CONSTRAINT `fixed_asset_purchase_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 `fixed_asset_purchase_items`
--


--
-- Table structure for table `fixed_asset_purchases`
--

CREATE TABLE `fixed_asset_purchases` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `establishment_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `group_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `document_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `series` char(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `date_of_due` date DEFAULT NULL,
  `time_of_issue` time NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `supplier` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`supplier`)),
  `currency_type_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `exchange_rate_sale` decimal(13,3) NOT NULL,
  `total_prepayment` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_charge` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exportation` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_free` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxed` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_unaffected` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_exonerated` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_igv` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_isc` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_base_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_other_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_taxes` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `customer_id` int(10) unsigned DEFAULT NULL,
  `perception_date` date DEFAULT NULL,
  `perception_number` int(11) DEFAULT NULL,
  `total_perception` decimal(12,2) DEFAULT NULL,
  `charges` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`charges`)),
  `discounts` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`discounts`)),
  `prepayments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`prepayments`)),
  `guides` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`guides`)),
  `related` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`related`)),
  `perception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`perception`)),
  `detraction` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`detraction`)),
  `legends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`legends`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fixed_asset_purchases_user_id_foreign` (`user_id`),
  KEY `fixed_asset_purchases_establishment_id_foreign` (`establishment_id`),
  KEY `fixed_asset_purchases_supplier_id_foreign` (`supplier_id`),
  KEY `fixed_asset_purchases_customer_id_foreign` (`customer_id`),
  KEY `fixed_asset_purchases_soap_type_id_foreign` (`soap_type_id`),
  KEY `fixed_asset_purchases_state_type_id_foreign` (`state_type_id`),
  KEY `fixed_asset_purchases_group_id_foreign` (`group_id`),
  KEY `fixed_asset_purchases_document_type_id_foreign` (`document_type_id`),
  KEY `fixed_asset_purchases_currency_type_id_foreign` (`currency_type_id`),
  CONSTRAINT `fixed_asset_purchases_currency_type_id_foreign` FOREIGN KEY (`currency_type_id`) REFERENCES `cat_currency_types` (`id`),
  CONSTRAINT `fixed_asset_purchases_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `fixed_asset_purchases_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `fixed_asset_purchases_establishment_id_foreign` FOREIGN KEY (`establishment_id`) REFERENCES `establishments` (`id`),
  CONSTRAINT `fixed_asset_purchases_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`),
  CONSTRAINT `fixed_asset_purchases_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `fixed_asset_purchases_state_type_id_foreign` FOREIGN KEY (`state_type_id`) REFERENCES `state_types` (`id`),
  CONSTRAINT `fixed_asset_purchases_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `persons` (`id`),
  CONSTRAINT `fixed_asset_purchases_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `fixed_asset_purchases`
--


--
-- Table structure for table `format_templates`
--

CREATE TABLE `format_templates` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `formats` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `urls` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`urls`)),
  `is_custom_ticket` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `format_templates`
--

INSERT INTO `format_templates` VALUES (1,'con_valor_unitario',NULL,0),(2,'default',NULL,0),(3,'default2',NULL,0),(4,'font_sm',NULL,0),(5,'font_sw2',NULL,0),(6,'legend_amazonia',NULL,0),(7,'model1',NULL,0),(8,'model2',NULL,0),(9,'model3',NULL,0),(10,'model4',NULL,0),(11,'modelw80',NULL,0),(12,'santiago',NULL,0),(13,'top_placa',NULL,0),(14,'unit_types_desc',NULL,0);

--
-- Table structure for table `full_suscription_user_data`
--

CREATE TABLE `full_suscription_user_data` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(10) unsigned DEFAULT 0,
  `discord_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `slack_channel` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `discord_channel` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `gitlab_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `full_suscription_user_data`
--


--
-- Table structure for table `general_payment_conditions`
--

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

--
-- Dumping data for table `general_payment_conditions`
--

INSERT INTO `general_payment_conditions` VALUES ('01','Contado'),('02','Crédito'),('03','Crédito con cuotas');

--
-- Table structure for table `global_payments`
--

CREATE TABLE `global_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `destination_id` int(11) DEFAULT NULL,
  `destination_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payment_id` int(11) NOT NULL,
  `payment_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `destination_index` (`destination_id`,`destination_type`),
  KEY `payment_index` (`payment_id`,`payment_type`),
  KEY `global_payments_soap_type_id_foreign` (`soap_type_id`),
  KEY `global_payments_user_id_foreign` (`user_id`),
  CONSTRAINT `global_payments_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `global_payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `global_payments`
--

INSERT INTO `global_payments` VALUES (1,'01',1,'App\\Models\\Tenant\\Cash',1,'Modules\\Pos\\Models\\CashTransaction',1,'2022-11-26 14:39:24','2022-11-26 14:39:24'),(2,'02',2,'App\\Models\\Tenant\\Cash',2,'Modules\\Pos\\Models\\CashTransaction',2,'2022-12-06 15:58:58','2022-12-06 15:58:58'),(3,'02',2,'App\\Models\\Tenant\\Cash',1,'App\\Models\\Tenant\\DocumentPayment',2,'2022-12-06 16:00:34','2022-12-06 16:00:34'),(4,'02',2,'App\\Models\\Tenant\\Cash',2,'App\\Models\\Tenant\\DocumentPayment',2,'2022-12-06 16:20:51','2022-12-06 16:20:51');

--
-- Table structure for table `groups`
--

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

--
-- Dumping data for table `groups`
--

INSERT INTO `groups` VALUES ('01','Facturas'),('02','Boletas');

--
-- Table structure for table `guide_files`
--

CREATE TABLE `guide_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filename` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Nombre de archivo',
  `purchase_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con purchases',
  `document_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con documents',
  `order_note_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con order_notes',
  `quotation_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con quotations',
  `sale_note_id` int(10) unsigned DEFAULT 0 COMMENT 'Relacion con sale_notes',
  `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 `guide_files`
--


--
-- Table structure for table `guide_items`
--

CREATE TABLE `guide_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `guide_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` decimal(20,8) NOT NULL,
  `unit_cost` decimal(20,8) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `guide_items_guide_id_foreign` (`guide_id`),
  KEY `guide_items_item_id_foreign` (`item_id`),
  CONSTRAINT `guide_items_guide_id_foreign` FOREIGN KEY (`guide_id`) REFERENCES `guides` (`id`) ON DELETE CASCADE,
  CONSTRAINT `guide_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `guide_items`
--


--
-- Table structure for table `guides`
--

CREATE TABLE `guides` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `external_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `warehouse_id` int(10) unsigned NOT NULL,
  `soap_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `document_type_id` char(2) COLLATE utf8mb4_unicode_ci NOT NULL,
  `series` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `number` int(11) NOT NULL,
  `date_of_issue` date NOT NULL,
  `time_of_issue` time NOT NULL,
  `inventory_transaction_id` char(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guideable_id` int(10) unsigned DEFAULT NULL,
  `guideable_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `observations` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `guides_series_number_unique` (`soap_type_id`,`document_type_id`,`series`,`number`),
  KEY `guides_user_id_foreign` (`user_id`),
  KEY `guides_warehouse_id_foreign` (`warehouse_id`),
  KEY `guides_document_type_id_foreign` (`document_type_id`),
  KEY `guides_inventory_transaction_id_foreign` (`inventory_transaction_id`),
  CONSTRAINT `guides_document_type_id_foreign` FOREIGN KEY (`document_type_id`) REFERENCES `cat_document_types` (`id`),
  CONSTRAINT `guides_inventory_transaction_id_foreign` FOREIGN KEY (`inventory_transaction_id`) REFERENCES `inventory_transactions` (`id`),
  CONSTRAINT `guides_soap_type_id_foreign` FOREIGN KEY (`soap_type_id`) REFERENCES `soap_types` (`id`),
  CONSTRAINT `guides_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `guides_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
