CREATE TABLE `SII_REQUEST_LOG` (
  `id` int NOT NULL AUTO_INCREMENT,
  `rut_empresa` varchar(12) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `rut_usuario` varchar(12) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `ruta` varchar(500) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `payload` text COLLATE utf8mb4_spanish_ci DEFAULT (NULL),
  `periodo` int DEFAULT NULL,
  `tramo` varchar(10) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `tipoRCV` varchar(10) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `fechaConsumo` datetime DEFAULT NULL,
  `id_usuario` int DEFAULT NULL,
  `id_empresa_seleccionada` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci


CREATE TABLE `SII_RESPONSE_COMPRAS_LOG` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `id_request` bigint NOT NULL,
  `tipoDTEString` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `tipoDTE` bigint NOT NULL,
  `tipoCompra` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `rutProveedor` varchar(12) COLLATE utf8mb4_spanish_ci NOT NULL,
  `razonSocial` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `folio` bigint NOT NULL,
  `fechaEmision` date NOT NULL,
  `fechaRecepcion` datetime DEFAULT NULL,
  `acuseRecibo` varchar(100) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `montoExento` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoNeto` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoIvaRecuperable` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoIvaNoRecuperable` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `codigoIvaNoRecuperable` bigint NOT NULL DEFAULT '0',
  `montoTotal` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoNetoActivoFijo` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ivaActivoFijo` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ivaUsoComun` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `impuestoSinDerechoCredito` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ivaNoRetenido` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `tabacosPuros` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `tabacosCigarrillos` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `tabacosElaborados` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `totalOtrosImpuestos` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `valorOtroImpuesto` decimal(13,4) DEFAULT NULL,
  `tasaOtroImpuesto` decimal(13,4) DEFAULT NULL,
  `tipoDocReferencia` bigint NOT NULL DEFAULT '0',
  `folioDocReferencia` bigint NOT NULL,
  `referencias` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `referenciado` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `reparos` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `otrosImpuestos` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `estado` varchar(100) COLLATE utf8mb4_spanish_ci DEFAULT NULL,
  `id_voucherImportacion` bigint DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_sii_c_id_voucherImportacion` (`id_voucherImportacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci



CREATE TABLE `SII_RESPONSE_VENTAS_LOG` (
  `id` int NOT NULL AUTO_INCREMENT,
  `id_request` int NOT NULL,
  `tipoDTEString` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `tipoDTE` int NOT NULL,
  `tipoCompra` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `rutCliente` varchar(12) COLLATE utf8mb4_spanish_ci NOT NULL,
  `razonSocial` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `folio` int NOT NULL,
  `fechaEmision` date NOT NULL,
  `fechaRecepcion` datetime NOT NULL,
  `acuseRecibo` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `montoExento` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoNeto` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoIvaRecuperable` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `montoTotal` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ivaNoRetenido` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `totalOtrosImpuestos` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `valorOtroImpuesto` decimal(13,4) DEFAULT NULL,
  `tasaOtroImpuesto` decimal(13,4) DEFAULT NULL,
  `tipoDocReferencia` int NOT NULL,
  `referencias` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `referenciado` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `reparos` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `otrosImpuestos` text COLLATE utf8mb4_spanish_ci NOT NULL,
  `estado` varchar(100) COLLATE utf8mb4_spanish_ci NOT NULL,
  `id_voucherImportacion` bigint DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_sii_v_id_voucherImportacion` (`id_voucherImportacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci

