CREATE TABLE `16_menu_dinamico` (
  `id` int(11) NOT NULL,
  `pai` int(11) NOT NULL DEFAULT '0',
  `icone` varchar(255) DEFAULT NULL,
  `descricao` varchar(255) NOT NULL DEFAULT '',
  `link` varchar(255) NOT NULL DEFAULT '',
  `ordenacao` int(11) NOT NULL DEFAULT '0',
  `target` varchar(10) NOT NULL,
  `hint` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `AbonoC1C2` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `Siniestro`,
 1 AS `Cliente`,
 1 AS `Asignado`,
 1 AS `estado`,
 1 AS `nrofactura`,
 1 AS `assigned_user_id`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `Cuota1`,
 1 AS `Cuota2`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`,
 1 AS `nrocuotas`*/;
CREATE TABLE `Actulaizar_casos_borrados` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `caso` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `Asesoria_Legal` AS SELECT 
 1 AS `id`,
 1 AS `Nro_Siniestro`,
 1 AS `Factura_pagada`,
 1 AS `Estado`,
 1 AS `Fecha_Sismo_Nuevo`,
 1 AS `Fecha_Denuncio`,
 1 AS `Tipo_Siniestro`,
 1 AS `Perdida_Reclamada`,
 1 AS `Perdida_Determinada`,
 1 AS `Deducible_Afecto`,
 1 AS `Perdida_Indemnizable`,
 1 AS `Indemnizacion`,
 1 AS `Perdida_Recuperable_Pesos`,
 1 AS `Direccion_Siniestro`,
 1 AS `Fecha_Visita`,
 1 AS `Fecha_Presupuesto`,
 1 AS `Fecha_Informe_Liquidacion`,
 1 AS `Fecha_Impugnacion`,
 1 AS `Fecha_Respuesta_Impugnacion`,
 1 AS `Fecha_Preinspeccion`,
 1 AS `Banco`,
 1 AS `Entidad_Liquidadora`,
 1 AS `Contrato_Firmado`,
 1 AS `Porcentaje_Pago`,
 1 AS `Nombre`,
 1 AS `Telefono`,
 1 AS `Email`,
 1 AS `Comuna_Siniestro`,
 1 AS `Ciudad_Caso`,
 1 AS `Fecha_creacion_caso`,
 1 AS `Comania_seguros`,
 1 AS `Captador`,
 1 AS `Rut`,
 1 AS `Id_Cliente`,
 1 AS `paymentsin_status`,
 1 AS `valoruf`,
 1 AS `creadaaslegal`*/;
/*!50001 CREATE VIEW `C1` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `Siniestro`,
 1 AS `Cliente`,
 1 AS `Asignado`,
 1 AS `nrofactura`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `Cuota1`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`,
 1 AS `valorcuota`,
 1 AS `nrocuotas`,
 1 AS `assigned_user_id`*/;
/*!50001 CREATE VIEW `C1C2` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `Siniestro`,
 1 AS `nrofactura`,
 1 AS `Cliente`,
 1 AS `Asignado`,
 1 AS `assigned_user_id`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `Cuota1`,
 1 AS `Cuota2`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`,
 1 AS `abonopagado`*/;
/*!50001 CREATE VIEW `C2` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `Siniestro`,
 1 AS `Cliente`,
 1 AS `Asignado`,
 1 AS `nrofactura`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `Cuota2`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`,
 1 AS `valorcuota`,
 1 AS `nrocuotas`,
 1 AS `assigned_user_id`*/;
CREATE TABLE `ClayCrm` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) DEFAULT NULL,
  `Fecha_Emision` date NOT NULL,
  `Mes_Año` varchar(10) NOT NULL,
  `Codigo_SII` varchar(50) NOT NULL,
  `Tipo` varchar(100) NOT NULL,
  `Emitida_Recibida` varchar(50) NOT NULL,
  `Num_Factura` int(32) NOT NULL,
  `Nro_caso` varchar(100) DEFAULT NULL,
  `1er_Item` varchar(100) NOT NULL,
  `Razon_Social_Emisor` varchar(100) NOT NULL,
  `RUT_Emisor` varchar(100) NOT NULL,
  `Direccion_Emisor` varchar(100) NOT NULL,
  `Razon_Social_Receptor` varchar(100) NOT NULL,
  `RUT_Receptor` varchar(100) NOT NULL,
  `Direccion_Receptor` varchar(100) NOT NULL,
  `Exento` varchar(100) NOT NULL,
  `Neto` varchar(100) NOT NULL,
  `Total_Neto` varchar(100) NOT NULL,
  `IVA` varchar(100) NOT NULL,
  `Otros_Impuestos` varchar(100) NOT NULL,
  `Total` varchar(100) NOT NULL,
  `Saldo` varchar(100) NOT NULL,
  `Pagado` varchar(100) NOT NULL,
  `Contabilizado` varchar(100) NOT NULL,
  `Rechazado` varchar(100) NOT NULL,
  `Monto_Incobrable` varchar(100) NOT NULL,
  `Vendedor` varchar(100) DEFAULT NULL,
  `Email` varchar(100) DEFAULT NULL,
  `Telefono` varchar(100) DEFAULT NULL,
  `Telefono2` varchar(100) DEFAULT NULL,
  `Suscripcion_SUS` varchar(100) DEFAULT NULL,
  `Caso_Siniestro_SUS` varchar(100) DEFAULT NULL,
  `Estado_Caso_Siniestro_SUS` varchar(100) DEFAULT NULL,
  `Fecha_suscripcion_SUS` varchar(100) DEFAULT NULL,
  `Captador_SUS` varchar(100) DEFAULT NULL,
  `Monto_SUS` varchar(100) DEFAULT NULL,
  `Saldo_CRM_SUS` varchar(100) DEFAULT NULL,
  `Estado_Factura_SUS` varchar(100) DEFAULT NULL,
  `Nro_Factura_SUS` varchar(100) DEFAULT NULL,
  `Fecha_Factura_SUS` varchar(100) DEFAULT NULL,
  `Nota_Credito_SUS` int(1) DEFAULT NULL,
  `Pagada_NC_SUS` varchar(100) DEFAULT NULL,
  `Nro_Nota_Credito_SUS` varchar(100) DEFAULT NULL,
  `Rut_Cliente_SUS` varchar(100) DEFAULT NULL,
  `Suscripcion_DDA` varchar(100) DEFAULT NULL,
  `Caso_Siniestro_DDA` varchar(100) DEFAULT NULL,
  `Estado_Caso_Siniestro_DDA` varchar(100) DEFAULT NULL,
  `Estado_Demanda_DDA` varchar(100) DEFAULT NULL,
  `Fecha_suscripcion_DDA` varchar(100) DEFAULT NULL,
  `Captador_DDA` varchar(100) DEFAULT NULL,
  `Monto_DDA` varchar(100) DEFAULT NULL,
  `Saldo_CRM_DDA` varchar(100) DEFAULT NULL,
  `Nro_Factura_DDA` varchar(100) DEFAULT NULL,
  `Estado_Factura_DDA` varchar(100) DEFAULT NULL,
  `Rut_Cliente_DDA` varchar(100) DEFAULT NULL,
  `Cobranza_COB` varchar(100) DEFAULT NULL,
  `Caso_Siniestro_COB` varchar(100) DEFAULT NULL,
  `Estado_Caso_Siniestro_COB` varchar(100) DEFAULT NULL,
  `Nro_Factura_COB` varchar(100) DEFAULT NULL,
  `Monto_Factura_COB` varchar(100) DEFAULT NULL,
  `Fecha_Factura_COB` varchar(100) DEFAULT NULL,
  `Estado_Cobranza_COB` varchar(100) DEFAULT NULL,
  `Rut_Cliente_COB` varchar(100) DEFAULT NULL,
  `Valida_RUT_OK` varchar(100) DEFAULT NULL,
  `Valida_Monto_OK` varchar(100) DEFAULT NULL,
  `Valida_Fecha_OK` varchar(100) DEFAULT NULL,
  `OK_SALDO_COBRA` varchar(100) DEFAULT NULL,
  `OK_SALDO_SUS` varchar(100) DEFAULT NULL,
  `OK_SALDO_SUS_DDA` varchar(100) DEFAULT NULL,
  `Valida_Estado_OK` varchar(100) DEFAULT NULL,
  `Valida_Existe_OK` varchar(100) DEFAULT NULL,
  `SUSCRIPCION_EX` int(2) DEFAULT NULL,
  `SUSCRIPCION_DDA_EX` int(2) DEFAULT NULL,
  `COBRANZA_EX` int(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2037 DEFAULT CHARSET=utf8;
CREATE TABLE `ClayCrm_comision` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  `Fecha_Emision` datetime NOT NULL,
  `Mes_Año` varchar(10) NOT NULL,
  `Codigo_SII` varchar(50) NOT NULL,
  `Tipo` varchar(10) NOT NULL,
  `Emitida_Recibida` varchar(50) NOT NULL,
  `Num_Factura` int(32) NOT NULL,
  `Nro_caso` varchar(100) NOT NULL,
  `1er_Item` varchar(100) NOT NULL,
  `Razon_Social_Emisor` varchar(100) NOT NULL,
  `RUT_Emisor` varchar(100) NOT NULL,
  `Direccion_Emisor` varchar(100) NOT NULL,
  `Razon_Social_Receptor` varchar(100) NOT NULL,
  `RUT_Receptor` varchar(100) NOT NULL,
  `Direccion_Receptor` varchar(100) NOT NULL,
  `Exento` varchar(100) NOT NULL,
  `Neto` varchar(100) NOT NULL,
  `Total_Neto` varchar(100) NOT NULL,
  `IVA` varchar(100) NOT NULL,
  `Otros_Impuestos` varchar(100) NOT NULL,
  `Total` varchar(100) NOT NULL,
  `Saldo` varchar(100) NOT NULL,
  `Pagado` varchar(100) NOT NULL,
  `Contabilizado` varchar(100) NOT NULL,
  `Rechazado` varchar(100) NOT NULL,
  `Monto_Incobrable` varchar(100) NOT NULL,
  `Vendedor` varchar(100) NOT NULL,
  `Email` varchar(100) NOT NULL,
  `Telefono` varchar(100) NOT NULL,
  `Telefono2` varchar(100) NOT NULL,
  `Suscripcion_SUS` varchar(100) NOT NULL,
  `Caso_Siniestro_SUS` varchar(100) NOT NULL,
  `Estado_Caso_Siniestro_SUS` varchar(100) NOT NULL,
  `Fecha_suscripcion_SUS` varchar(100) NOT NULL,
  `Captador_SUS` varchar(100) NOT NULL,
  `Monto_SUS` varchar(100) NOT NULL,
  `Saldo_CRM_SUS` varchar(100) NOT NULL,
  `Estado_Factura_SUS` varchar(100) NOT NULL,
  `Nro_Factura_SUS` varchar(100) NOT NULL,
  `Fecha_Factura_SUS` varchar(100) NOT NULL,
  `Nota_Credito_SUS` int(1) NOT NULL,
  `Pagada_NC_SUS` varchar(100) NOT NULL,
  `Nro_Nota_Credito_SUS` varchar(100) NOT NULL,
  `Rut_Cliente_SUS` varchar(100) NOT NULL,
  `Suscripcion_DDA` varchar(100) NOT NULL,
  `Caso_Siniestro_DDA` varchar(100) NOT NULL,
  `Estado_Caso_Siniestro_DDA` varchar(100) NOT NULL,
  `Estado_Demanda_DDA` varchar(100) NOT NULL,
  `Fecha_suscripcion_DDA` varchar(100) NOT NULL,
  `Captador_DDA` varchar(100) NOT NULL,
  `Monto_DDA` varchar(100) NOT NULL,
  `Saldo_CRM_DDA` varchar(100) NOT NULL,
  `Nro_Factura_DDA` varchar(100) NOT NULL,
  `Estado_Factura_DDA` varchar(100) NOT NULL,
  `Rut_Cliente_DDA` varchar(100) NOT NULL,
  `Cobranza_COB` varchar(100) NOT NULL,
  `Caso_Siniestro_COB` varchar(100) NOT NULL,
  `Estado_Caso_Siniestro_COB` varchar(100) NOT NULL,
  `Nro_Factura_COB` varchar(100) NOT NULL,
  `Monto_Factura_COB` varchar(100) NOT NULL,
  `Fecha_Factura_COB` varchar(100) NOT NULL,
  `Estado_Cobranza_COB` varchar(100) NOT NULL,
  `Rut_Cliente_COB` varchar(100) NOT NULL,
  `Valida_RUT_OK` varchar(100) NOT NULL,
  `Valida_Monto_OK` varchar(100) NOT NULL,
  `Valida_Fecha_OK` varchar(100) NOT NULL,
  `OK_SALDO_COBRA` varchar(100) NOT NULL,
  `OK_SALDO_SUS` varchar(100) NOT NULL,
  `OK_SALDO_SUS_DDA` varchar(100) NOT NULL,
  `Valida_Estado_OK` varchar(100) NOT NULL,
  `Valida_Existe_OK` varchar(100) NOT NULL,
  `SUSCRIPCION_EX` int(2) NOT NULL,
  `SUSCRIPCION_DDA_EX` int(2) NOT NULL,
  `COBRANZA_EX` int(2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3365 DEFAULT CHARSET=utf8;
CREATE TABLE `ClayDuplicados` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_Modulo` varchar(100) NOT NULL,
  `Rut_Cliente_crm` varchar(100) NOT NULL,
  `Nro_Siniestro` varchar(100) NOT NULL,
  `Nro_Factura_Duplicada` varchar(100) NOT NULL,
  `Modulo` varchar(100) NOT NULL,
  `Fecha_Factura_clay` varchar(100) NOT NULL,
  `Fecha_Factura_crm` varchar(100) NOT NULL,
  `Monto_clay` int(10) NOT NULL,
  `Saldo_clay` int(10) NOT NULL,
  `Monto_crm` int(10) NOT NULL,
  `Saldo_crm` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `Clay_comision_pagos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Nro_de_Caso_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Nombre_del_Cliente_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Valor_del_Plan_Suscripción` varchar(100) NOT NULL,
  `Captador_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Fecha_de_creación_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Tipo_de_Siniestro_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Contrato_Firmado_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Abono_Pagado_Suscripción` varchar(100) NOT NULL,
  `Fecha_de_Pago_Abono_Suscripción` varchar(100) NOT NULL,
  `Nro_de_Factura_Suscripción` varchar(100) NOT NULL,
  `Valor_del_Plan_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Comisión_Pagada_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Fecha_Pago_Comisión_Caso_de_Siniestro` varchar(100) NOT NULL,
  `Ciudad_(Siniestro)_Caso_de_Siniestro` varchar(100) NOT NULL,
  `fecha_de_firma` varchar(100) NOT NULL,
  `firma_ok` varchar(100) NOT NULL,
  `fecha_deabono_pagado` varchar(100) NOT NULL,
  `pagado_si` varchar(100) NOT NULL,
  `cuanto_pago` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=66 DEFAULT CHARSET=utf8;
CREATE TABLE `Claycons_cobra` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  `Nro_Caso` varchar(100) NOT NULL,
  `Estado_Siniestro` varchar(100) NOT NULL,
  `Estado_de_Cobranza` varchar(100) NOT NULL,
  `Num_Factura_clay` int(10) NOT NULL,
  `Num_Factura_crm` int(10) NOT NULL,
  `Rev_Nro_Factura_clay_crm` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay` varchar(100) NOT NULL,
  `Fecha_de_Factura_crm` varchar(100) NOT NULL,
  `Rev_Fecha_Factura_clay_crm` varchar(100) NOT NULL,
  `Rut_Cliente_clay` varchar(100) NOT NULL,
  `Rut_Cliente_crm` varchar(100) NOT NULL,
  `Rev_Rut_Cliente_clay_crm` varchar(100) NOT NULL,
  `Nombre` varchar(100) NOT NULL,
  `Email` varchar(100) NOT NULL,
  `Telefono_1` varchar(100) NOT NULL,
  `Telefono_2` varchar(100) NOT NULL,
  `Monto_clay` int(10) NOT NULL,
  `Valor_Factura_Pesos` int(10) NOT NULL,
  `Saldo_CLAY` int(10) NOT NULL,
  `Saldo_CRM` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=128 DEFAULT CHARSET=utf8;
CREATE TABLE `Claycons_sus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  `Nro_Caso` varchar(100) NOT NULL,
  `Estado_Siniestro` varchar(100) NOT NULL,
  `Num_Factura_clay` int(10) NOT NULL,
  `Num_Factura_crm` int(10) NOT NULL,
  `Rev_Nro_Factura_clay_crm` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay` varchar(100) NOT NULL,
  `Fecha_de_Factura_crm` varchar(100) NOT NULL,
  `Rev_Fecha_Factura_clay_crm` varchar(100) NOT NULL,
  `Rut_Cliente_clay` varchar(100) NOT NULL,
  `Rut_Cliente_crm` varchar(100) NOT NULL,
  `Rev_Rut_Cliente_clay_crm` varchar(100) NOT NULL,
  `Nombre` varchar(100) NOT NULL,
  `Email` varchar(100) NOT NULL,
  `Telefono_1` varchar(100) NOT NULL,
  `Telefono_2` varchar(100) NOT NULL,
  `Comuna` varchar(100) NOT NULL,
  `Monto_del_presupuesto` int(10) NOT NULL,
  `Monto_clay` int(10) NOT NULL,
  `Valor_del_Plan` int(10) NOT NULL,
  `Saldo_CLAY` int(10) NOT NULL,
  `Saldo_CRM` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1122 DEFAULT CHARSET=utf8;
CREATE TABLE `Claycons_sus_cobra` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo_sus` varchar(100) NOT NULL,
  `Nro_Caso_sus` varchar(100) NOT NULL,
  `Estado_Siniestro_sus` varchar(100) NOT NULL,
  `Num_Factura_clay_sus` int(10) NOT NULL,
  `Num_Factura_crm_sus` int(10) NOT NULL,
  `Rev_Nro_Factura_clay_crm_sus` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay_sus` varchar(100) NOT NULL,
  `Fecha_de_Factura_crm_sus` varchar(100) NOT NULL,
  `Rev_Fecha_Factura_clay_crm_sus` varchar(100) NOT NULL,
  `Rut_Cliente_clay_sus` varchar(100) NOT NULL,
  `Rut_Cliente_crm_sus` varchar(100) NOT NULL,
  `Rev_Rut_Cliente_clay_crm_sus` varchar(100) NOT NULL,
  `Nombre_sus` varchar(100) NOT NULL,
  `Email_sus` varchar(100) NOT NULL,
  `Telefono_1_sus` varchar(100) NOT NULL,
  `Telefono_2_sus` varchar(100) NOT NULL,
  `Comuna_sus` varchar(100) NOT NULL,
  `Monto_del_presupuesto_sus` int(10) NOT NULL,
  `Monto_clay_Sus` int(10) NOT NULL,
  `Valor_del_Plan_sus` int(10) NOT NULL,
  `Saldo_CLAY_sus` int(10) NOT NULL,
  `Saldo_CRM_Sus` int(10) NOT NULL,
  `Modulo_cobra` varchar(100) NOT NULL,
  `Nro_Caso_cobra` varchar(100) NOT NULL,
  `Estado_Siniestro_cobra` varchar(100) NOT NULL,
  `Estado_de_Cobranza_cobra` varchar(100) NOT NULL,
  `Num_Factura_clay_cobra` int(10) NOT NULL,
  `Num_Factura_crm_cobra` int(10) NOT NULL,
  `Rev_Nro_Factura_clay_crm_cobra` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay_cobra` varchar(100) NOT NULL,
  `Fecha_de_Factura_crm_cobra` varchar(100) NOT NULL,
  `Rev_Fecha_Factura_clay_crm_cobra` varchar(100) NOT NULL,
  `Rut_Cliente_clay_cobra` varchar(100) NOT NULL,
  `Rut_Cliente_crm_cobra` varchar(100) NOT NULL,
  `Rev_Rut_Cliente_clay_crm_cobra` varchar(100) NOT NULL,
  `Nombre_cobra` varchar(100) NOT NULL,
  `Email_cobra` varchar(100) NOT NULL,
  `Telefono_1_cobra` varchar(100) NOT NULL,
  `Telefono_2_cobra` varchar(100) NOT NULL,
  `Monto_clay_cobra` int(10) NOT NULL,
  `Valor_Factura_Pesos_cobra` int(10) NOT NULL,
  `Saldo_CLAY_cobra` int(10) NOT NULL,
  `Saldo_CRM_cobra` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=187 DEFAULT CHARSET=utf8;
CREATE TABLE `Claycons_sus_da` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  `Nro_Caso` varchar(100) NOT NULL,
  `Estado_Siniestro` varchar(100) NOT NULL,
  `Estado_Comercial_Demanda` varchar(100) NOT NULL,
  `Num_Factura_clay` int(10) NOT NULL,
  `Num_Factura_crm` int(10) NOT NULL,
  `Rev_Nro_Factura_clay_crm` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay` varchar(100) NOT NULL,
  `Fecha_de_Factura_crm` varchar(100) NOT NULL,
  `Rev_Fecha_Factura_clay_crm` varchar(100) NOT NULL,
  `Rut_Cliente_clay` varchar(100) NOT NULL,
  `Rut_Cliente_crm` varchar(100) NOT NULL,
  `Rev_Rut_Cliente_clay_crm` varchar(100) NOT NULL,
  `Nombre` varchar(100) NOT NULL,
  `Email` varchar(100) NOT NULL,
  `Telefono_1` varchar(100) NOT NULL,
  `Telefono_2` varchar(100) NOT NULL,
  `Monto_clay` int(10) NOT NULL,
  `Valor_del_Plan` int(10) NOT NULL,
  `Saldo_CLAY` int(10) NOT NULL,
  `Saldo_CRM` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=188 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `Claycons_sus_da_VISTA` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `Nro_Caso`,
 1 AS `Estado_Siniestro`,
 1 AS `Estado_Comercial_Demanda`,
 1 AS `Num_Factura_clay`,
 1 AS `Num_Factura_crm`,
 1 AS `Rev_Nro_Factura_clay_crm`,
 1 AS `Fecha_Emision_Factura_clay`,
 1 AS `Fecha_de_Factura_crm`,
 1 AS `Rev_Fecha_Factura_clay_crm`,
 1 AS `Rut_Cliente_clay`,
 1 AS `Rut_Cliente_crm`,
 1 AS `Rev_Rut_Cliente_clay_crm`,
 1 AS `Nombre`,
 1 AS `Email`,
 1 AS `Telefono_1`,
 1 AS `Telefono_2`,
 1 AS `Monto_clay`,
 1 AS `Valor_del_Plan`,
 1 AS `Saldo_CLAY`,
 1 AS `Saldo_CRM`,
 1 AS `ID_SUSCRIPCION_DEMANDA`,
 1 AS `CREACION_CASO_CRM`,
 1 AS `FECHA_VENCIMIENTO_CUOTA_1`,
 1 AS `FECHA_VENCIMIENTO_CUOTA_2`,
 1 AS `FECHA_VENCIMIENTO_CUOTA_3`,
 1 AS `nrocuotas`,
 1 AS `Id_demanda`*/;
CREATE TABLE `Claycons_sus_y_dda` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  `Nro_Caso` varchar(100) NOT NULL,
  `Estado_Siniestro` varchar(100) NOT NULL,
  `Rut` varchar(100) DEFAULT NULL,
  `Nombre` varchar(100) NOT NULL,
  `Email` varchar(100) NOT NULL,
  `Telefono_1` varchar(100) NOT NULL,
  `Telefono_2` varchar(100) NOT NULL,
  `Comuna` varchar(100) DEFAULT NULL,
  `Monto_del_presupuesto` int(10) DEFAULT NULL,
  `Num_Factura_crm_sus` int(10) NOT NULL,
  `Fecha_de_Factura_crm_sus` varchar(100) DEFAULT NULL,
  `Fecha_Emision_Factura_clay_sus` varchar(100) NOT NULL,
  `Monto_clay_sus` int(10) NOT NULL,
  `Valor_del_Plan_sus` int(10) NOT NULL,
  `Saldo_CLAY_sus` int(10) NOT NULL,
  `Saldo_CRM_sus` int(10) NOT NULL,
  `Num_Factura_crm_dda` int(10) DEFAULT NULL,
  `Fecha_de_Factura_crm_dda` varchar(100) NOT NULL,
  `Fecha_Emision_Factura_clay_dda` varchar(100) DEFAULT NULL,
  `Monto_clay_dda` int(10) DEFAULT NULL,
  `Valor_del_Plan_dda` int(10) DEFAULT NULL,
  `Saldo_CLAY_dda` int(10) DEFAULT NULL,
  `Saldo_CRM_dda` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `ContratofirmadosSinMandato` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`*/;
/*!50001 CREATE VIEW `Control_firmas_contratos` AS SELECT 
 1 AS `siniestro`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `cliente`,
 1 AS `serienrodocto`,
 1 AS `banco`,
 1 AS `estado`,
 1 AS `createdtime`*/;
/*!50001 CREATE VIEW `CuotasSus2` AS SELECT 
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Pagado`,
 1 AS `NrocuotasOriginal`,
 1 AS `nrocuotas`,
 1 AS `cuotasreales`,
 1 AS `abono`*/;
/*!50001 CREATE VIEW `DatosClinetes_SimpliRute` AS SELECT 
 1 AS `Movil`,
 1 AS `cliente`,
 1 AS `Nombre_de_contacto`,
 1 AS `Correo_electronico`,
 1 AS `createdtime`,
 1 AS `Agente_exclusivo`*/;
CREATE TABLE `Duplicados` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_Modulo` varchar(100) NOT NULL,
  `Nro_Siniestro` varchar(100) NOT NULL,
  `Nro_Factura_Duplicada` varchar(100) NOT NULL,
  `Modulo` varchar(100) NOT NULL,
  `Fecha_Factura_clay` varchar(100) NOT NULL,
  `Fecha_Factura_crm` varchar(100) NOT NULL,
  `Monto_clay` int(10) NOT NULL,
  `Saldo_clay` int(10) NOT NULL,
  `Monto_crm` int(10) NOT NULL,
  `Saldo_crm` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `Estado_PORTAL` (
  `Estado` varchar(255) NOT NULL,
  `edo_complete` varchar(255) DEFAULT NULL,
  `descripcion` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!50001 CREATE VIEW `FacturasEstadoesperando` AS SELECT 
 1 AS `id`,
 1 AS `Rut`,
 1 AS `Nombre_cliente`,
 1 AS `Siniestro`,
 1 AS `Estado`,
 1 AS `Valor_total`,
 1 AS `Creacion_sus`,
 1 AS `N_factura`,
 1 AS `Fecha_factura`,
 1 AS `Captador`,
 1 AS `Contrato_Firmado`,
 1 AS `id_relbase`,
 1 AS `estado_factura_sii`*/;
/*!50001 CREATE VIEW `FirmasProcesadas_TC` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`,
 1 AS `user_name`,
 1 AS `contratofirmado2`,
 1 AS `tomadeconocimiento`*/;
/*!50001 CREATE VIEW `FirmasSinProcesar` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`,
 1 AS `user_name`*/;
/*!50001 CREATE VIEW `FirmasSinProcesar_TC` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`,
 1 AS `user_name`,
 1 AS `contratofirmado2`,
 1 AS `tomadeconocimiento`*/;
/*!50001 CREATE VIEW `FirmasVenDemPorProc` AS SELECT 
 1 AS `id`,
 1 AS `idsiniestro`,
 1 AS `estadocobranza`,
 1 AS `estadocomercialdda`,
 1 AS `montorecuperarclp`,
 1 AS `porcentajeapagar`,
 1 AS `fono`,
 1 AS `correo`,
 1 AS `estadollamada`,
 1 AS `Nombre`,
 1 AS `actualizar`,
 1 AS `fechadenuncia`,
 1 AS `clienteid`,
 1 AS `siniestro`,
 1 AS `user_name`,
 1 AS `contratofirmado`*/;
/*!50001 CREATE VIEW `FirmasVenDemPorProcv2` AS SELECT 
 1 AS `id`,
 1 AS `idsiniestro`,
 1 AS `estadocobranza`,
 1 AS `estadocomercialdda`,
 1 AS `montorecuperarclp`,
 1 AS `porcentajeapagar`,
 1 AS `fono`,
 1 AS `correo`,
 1 AS `estadollamada`,
 1 AS `Nombre`,
 1 AS `actualizar`,
 1 AS `fechadenuncia`,
 1 AS `clienteid`,
 1 AS `siniestro`,
 1 AS `user_name`,
 1 AS `contratofirmado`,
 1 AS `creadaaslegal`,
 1 AS `planaslegal`,
 1 AS `FechaEmifact`*/;
CREATE TABLE `Gen_Cert_convenios` (
  `id_gen_cer_cov` int(11) NOT NULL AUTO_INCREMENT,
  `Rut_GCC` varchar(100) NOT NULL,
  `Nombre_GCC` varchar(100) NOT NULL,
  `N_Acuerdo_GCC` varchar(100) NOT NULL,
  `N_Factura_GCC` varchar(100) NOT NULL,
  `Monto_Cancelado_GCC` int(10) NOT NULL,
  `Fecha_Aclaracion_GCC` date NOT NULL,
  `Fecha _e_Emision_del_Certificado_GCC` date NOT NULL,
  `Correo_del_Cliente_para_enviar_Certificado_GCC` varchar(100) NOT NULL,
  `est_env_correo_GCC` int(1) NOT NULL,
  PRIMARY KEY (`id_gen_cer_cov`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `IngresoMesActual_x_vendedor` AS SELECT 
 1 AS `captador`,
 1 AS `Activos`,
 1 AS `Desistidos`,
 1 AS `Abiertos`*/;
/*!50001 CREATE VIEW `IngresoMesActual_x_vendedor2` AS SELECT 
 1 AS `captador`,
 1 AS `Ingresados`,
 1 AS `Desistidos`,
 1 AS `Abiertos`,
 1 AS `Abonados_1`,
 1 AS `Abonados_0`,
 1 AS `Total_Abono`,
 1 AS `Abono_Pagado`,
 1 AS `Deuda_Total`*/;
/*!50001 CREATE VIEW `IngresoMesAnterior_x_vendedor` AS SELECT 
 1 AS `captador`,
 1 AS `Activos`,
 1 AS `Desistidos`,
 1 AS `Abiertos`*/;
/*!50001 CREATE VIEW `IngresoMesAnterior_x_vendedor2` AS SELECT 
 1 AS `captador`,
 1 AS `Ingresados`,
 1 AS `Desistidos`,
 1 AS `Abiertos`,
 1 AS `Abonados_1`,
 1 AS `Abonados_0`,
 1 AS `Total_Abono`,
 1 AS `Abono_Pagado`,
 1 AS `Deuda_Total`*/;
CREATE TABLE `Ingreso_crm` (
  `id_auto` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id` varchar(20) NOT NULL DEFAULT '',
  `ingresado` bit(1) NOT NULL DEFAULT b'0',
  `fecha_contrato` varchar(45) NOT NULL DEFAULT '',
  `dia` varchar(45) NOT NULL DEFAULT '',
  `mes` varchar(45) NOT NULL DEFAULT '',
  `ano` varchar(45) NOT NULL DEFAULT '',
  `nombres` varchar(45) NOT NULL DEFAULT '',
  `apellidos` varchar(45) NOT NULL DEFAULT '',
  `rut_cliente1` double NOT NULL DEFAULT '0',
  `digito_verificador` varchar(45) NOT NULL DEFAULT '',
  `numero_de_serie` varchar(45) NOT NULL DEFAULT '',
  `estado_civil` varchar(45) NOT NULL DEFAULT '',
  `profesion` varchar(45) NOT NULL DEFAULT '',
  `nacionalidad` varchar(45) NOT NULL DEFAULT '',
  `email_contacto` varchar(45) NOT NULL DEFAULT '',
  `telefono_celular` varchar(45) NOT NULL DEFAULT '',
  `telefono_alternativo` varchar(45) NOT NULL DEFAULT '',
  `calle_cliente` varchar(45) NOT NULL DEFAULT '',
  `comuna_cliente` varchar(45) NOT NULL DEFAULT '',
  `provincia_cliente` varchar(45) NOT NULL DEFAULT '',
  `region_cliente` varchar(45) NOT NULL DEFAULT '',
  `calle_caso` varchar(200) NOT NULL,
  `comuna_caso` varchar(45) NOT NULL DEFAULT '',
  `provincia_caso` varchar(45) NOT NULL DEFAULT '',
  `region_caso` varchar(45) NOT NULL DEFAULT '',
  `tipo_siniestro` varchar(45) NOT NULL DEFAULT '',
  `tipo_propiedad` varchar(45) NOT NULL DEFAULT '',
  `banco` varchar(45) NOT NULL DEFAULT '',
  `compania_seguros` varchar(45) NOT NULL DEFAULT '',
  `m2_aproximados` double NOT NULL DEFAULT '0',
  `valor_uf_estimado` double NOT NULL DEFAULT '0',
  `ejecutivo` varchar(45) NOT NULL DEFAULT '',
  `email_del_ejecutivo` varchar(45) NOT NULL DEFAULT '',
  `celular_del_ejecutivo` varchar(45) NOT NULL DEFAULT '',
  `observaciones_para_coordinar_` varchar(45) NOT NULL DEFAULT '',
  `validado` varchar(45) NOT NULL DEFAULT '',
  `dias_de_pago1` varchar(45) NOT NULL DEFAULT '',
  `nro_de_cuotas` varchar(45) NOT NULL DEFAULT '',
  `valor_de_cuotas` varchar(45) NOT NULL DEFAULT '',
  `abono` varchar(45) NOT NULL DEFAULT '',
  `valor_total_del_servicio` varchar(45) NOT NULL DEFAULT '',
  `tipo_de_plan` varchar(45) NOT NULL DEFAULT '',
  `caso_con_gestion_previa` varchar(45) NOT NULL DEFAULT '',
  `asesorseguros` varchar(45) NOT NULL DEFAULT '',
  `Tipo_de_pago` varchar(100) NOT NULL,
  `Tiene_arrendatario` int(11) NOT NULL,
  `Nombre_arrendataario` varchar(100) NOT NULL,
  `Telefono_arrendatario` varchar(100) NOT NULL,
  `Coordenada_completa` varchar(100) NOT NULL,
  `Latitud` varchar(100) NOT NULL,
  `Longitud` varchar(100) NOT NULL,
  `proviene_de` varchar(200) NOT NULL,
  `Rango_Horario_PREINSPECCION` varchar(200) NOT NULL,
  `Dias_Disponibles_Preinspeccion` varchar(200) NOT NULL,
  `Bloquefecha1` varchar(250) NOT NULL,
  `Bloquefecha2` varchar(250) NOT NULL,
  `Lunes` varchar(1) NOT NULL DEFAULT '0',
  `Martes` varchar(1) NOT NULL DEFAULT '0',
  `Miercoles` varchar(1) NOT NULL DEFAULT '0',
  `Jueves` varchar(1) NOT NULL DEFAULT '0',
  `Viernes` varchar(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_auto`)
) ENGINE=InnoDB AUTO_INCREMENT=7331 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `LEADS_NO_CLIENTES` AS SELECT 
 1 AS `nombrecompleto`,
 1 AS `correo`,
 1 AS `telefono`,
 1 AS `comuna`,
 1 AS `fecha_de_creacion_Leads`,
 1 AS `motivorechazo`,
 1 AS `estadolead`,
 1 AS `estadollamada`,
 1 AS `gestionadopor`,
 1 AS `obsrechazo`,
 1 AS `obslead`*/;
/*!50001 CREATE VIEW `LEADS_PROCESADOS` AS SELECT 
 1 AS `Rut`,
 1 AS `Nombre`,
 1 AS `movil`,
 1 AS `email`,
 1 AS `comunacliente`*/;
CREATE TABLE `LeadsNuevos` (
  `id` int(8) NOT NULL AUTO_INCREMENT,
  `comuna` varchar(100) NOT NULL,
  `correo` varchar(100) NOT NULL,
  `telefono` varchar(100) NOT NULL,
  `nombre` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1027 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `Leads_asig_por_gest` AS SELECT 
 1 AS `Nro_Caso`,
 1 AS `Fecha_Creacion`,
 1 AS `Id_captador`,
 1 AS `Tipo_Siniestro`,
 1 AS `Comuna`,
 1 AS `Direccion`,
 1 AS `Banco`,
 1 AS `Liquidador`,
 1 AS `Cia_Seguros`,
 1 AS `Fecha_Crea_Caso`,
 1 AS `Fecha_Denuncio`,
 1 AS `Fecha_Visita`,
 1 AS `Fecha_Presupuesto`,
 1 AS `Fecha_informe`,
 1 AS `Fecha_impug`,
 1 AS `Fecha_Respuesta`,
 1 AS `Fecha_Preinspeccion`,
 1 AS `Rut_Cliente`,
 1 AS `Fono_Cliente`,
 1 AS `Email_Cliente`,
 1 AS `Plan`,
 1 AS `Contrato_frimado`,
 1 AS `Pedida_rec_UF`,
 1 AS `Perdida_det_UF`,
 1 AS `Desucible_UF`,
 1 AS `Perdida_indembizable_UF`,
 1 AS `Indemnizacion`,
 1 AS `Monto_Rec_PESOS`,
 1 AS `Estado_LLamda`,
 1 AS `Captador`,
 1 AS `Estado_Comercial_ASL`,
 1 AS `Porc_a_Pagar`,
 1 AS `Cliente`,
 1 AS `ventadedemandasid`,
 1 AS `Usuario`*/;
/*!50001 CREATE VIEW `Lost_Filtro1` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`*/;
/*!50001 CREATE VIEW `Lost_Filtro2` AS SELECT 
 1 AS `id`,
 1 AS `Num_factura`,
 1 AS `Nro_caso`*/;
/*!50001 CREATE VIEW `Lost_Filtro3` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`*/;
/*!50001 CREATE VIEW `Lost_Filtro4` AS SELECT 
 1 AS `id`,
 1 AS `Num_factura`,
 1 AS `Nro_caso`*/;
/*!50001 CREATE VIEW `Lost_Filtro5` AS SELECT 
 1 AS `Num_factura`,
 1 AS `Nro_caso`,
 1 AS `TableName`,
 1 AS `estado del modulo`,
 1 AS `Nro_cuotas`*/;
/*!50001 CREATE VIEW `Lost_Filtro6` AS SELECT 
 1 AS `Nro_caso`,
 1 AS `Num_factura`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `TableName`,
 1 AS `estado del modulo`,
 1 AS `Nro_cuotas`,
 1 AS `Saldo`,
 1 AS `dircliente`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`*/;
/*!50001 CREATE VIEW `Lost_solo_Cobranza` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`,
 1 AS `Saldo`,
 1 AS `COBRANZA_EX`,
 1 AS `paymentsin_status`*/;
/*!50001 CREATE VIEW `Lost_solo_Cobranza_Rep` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`,
 1 AS `Saldo`,
 1 AS `COBRANZA_EX`,
 1 AS `Estado_Cobranza`*/;
/*!50001 CREATE VIEW `Lost_solo_Cobranza_Sus_Rep` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`,
 1 AS `Saldo`,
 1 AS `COBRANZA_EX`,
 1 AS `Estado_Cobranza`,
 1 AS `Estado_Suscripcion`*/;
/*!50001 CREATE VIEW `Lost_solo_Sus_Dda_Rep` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`,
 1 AS `Saldo`,
 1 AS `SUSCRIPCION_DDA_EX`,
 1 AS `estadocomercialdda`,
 1 AS `estadocaso`*/;
/*!50001 CREATE VIEW `Lost_solo_Sus_Rep` AS SELECT 
 1 AS `id`,
 1 AS `Nro_caso`,
 1 AS `Num_Factura`,
 1 AS `Saldo`,
 1 AS `SUSCRIPCION_EX`,
 1 AS `estado`*/;
/*!50001 CREATE VIEW `Pac_suscripcion` AS SELECT 
 1 AS `Id_siniestro`,
 1 AS `Id_suscripcion`,
 1 AS `Rut_Cliente`,
 1 AS `Nro_Caso`,
 1 AS `Estado`,
 1 AS `Monto_del_Presupuesto`,
 1 AS `Valor_Cuota`,
 1 AS `Dias_de_Pago`,
 1 AS `Nro_Cuotas`,
 1 AS `Valor_Abono`,
 1 AS `Fecha_Ven_Abono`,
 1 AS `Fecha_Cargo_Pac_Abono`,
 1 AS `Fecha_Transfer_abono_Fintoc`,
 1 AS `Abono_pagado`,
 1 AS `Valor_Cuota_1`,
 1 AS `Fecha_Ven_Cuota_1`,
 1 AS `Fecha_Cargo_Pac_Cuota_1`,
 1 AS `Fecha_Transfer_Cuota_1_Fintoc`,
 1 AS `Cuota_1_Pagada`,
 1 AS `Valor_Cuota_2`,
 1 AS `Fecha_Ven_Cuota_2`,
 1 AS `Fecha_Cargo_Pac_Cuota_2`,
 1 AS `Fecha_Transfer_Cuota_2_Fintoc`,
 1 AS `Cuota_2_Pagada`,
 1 AS `Nro_Factura_Suscripcion`,
 1 AS `Fecha_Factura_Suscripcion`,
 1 AS `Nombre_Cliente`,
 1 AS `Valor_plan`,
 1 AS `Id_cliente`,
 1 AS `estadopac`*/;
/*!50001 CREATE VIEW `Plantilla_driving` AS SELECT 
 1 AS `Codigo_de_despacho`,
 1 AS `Direccion_1`,
 1 AS `Nombre_cliente`,
 1 AS `Comuna`,
 1 AS `Latitud`,
 1 AS `Longitud`,
 1 AS `Telefono_de_Contacto`,
 1 AS `Email_de_Contacto`,
 1 AS `Codigo_de_direccion`*/;
/*!50001 CREATE VIEW `Plantilla_simplirute` AS SELECT 
 1 AS `Titulo`,
 1 AS `direccionsiniestro`,
 1 AS `Latitud`,
 1 AS `Longitud`,
 1 AS `ID_De_Referencia`,
 1 AS `Persona_De_Contacto`,
 1 AS `Telefono_De_Contacto`,
 1 AS `SMS`,
 1 AS `Notas`,
 1 AS `createdtime`*/;
/*!50001 CREATE VIEW `PorFacturar_Honorarios` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `nombrecliente`,
 1 AS `estado_`,
 1 AS `facturarinforme`,
 1 AS `informefacturado`,
 1 AS `frecinfliq`,
 1 AS `nrofactura`,
 1 AS `perdidaindemnizable`,
 1 AS `valorfactura`,
 1 AS `createdtime`,
 1 AS `Nombre`,
 1 AS `id_relbase`,
 1 AS `Rut`*/;
/*!50001 CREATE VIEW `PorFacturar_HonorariosALL` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `nombrecliente`,
 1 AS `estado_`,
 1 AS `facturarinforme`,
 1 AS `informefacturado`,
 1 AS `frecinfliq`,
 1 AS `nrofactura`,
 1 AS `perdidaindemnizable`,
 1 AS `valorfactura`,
 1 AS `createdtime`,
 1 AS `Nombre`,
 1 AS `id_relbase`,
 1 AS `Rut`*/;
/*!50001 CREATE VIEW `PorFacturar_Honorarios_Adendum` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `nombrecliente`,
 1 AS `estado_`,
 1 AS `facturarinforme`,
 1 AS `informefacturado`,
 1 AS `frecinfliq`,
 1 AS `nrofactura`,
 1 AS `perdidaindemnizable`,
 1 AS `valorfactura`,
 1 AS `createdtime`,
 1 AS `Nombre`,
 1 AS `id_relbase`,
 1 AS `Rut`,
 1 AS `montoaddendum1`,
 1 AS `indemaddendum1`,
 1 AS `montofacturaaddendum1`,
 1 AS `facturaraddendum1`,
 1 AS `facturaraddendum2`*/;
/*!50001 CREATE VIEW `PorFacturar_VentaDemanda` AS SELECT 
 1 AS `id_Demanda`,
 1 AS `id_Suscripcion`,
 1 AS `N_Caso`,
 1 AS `Rut`,
 1 AS `Nombre`,
 1 AS `Estado_de_Demanda`,
 1 AS `Contrato_Firmado`,
 1 AS `Valor_Total`,
 1 AS `id_RelBase`,
 1 AS `Nro_cuotas`*/;
/*!50001 CREATE VIEW `PorFacturarv2` AS SELECT 
 1 AS `id`,
 1 AS `Rut`,
 1 AS `Nombre_cliente`,
 1 AS `Siniestro`,
 1 AS `Estado`,
 1 AS `Valor_total`,
 1 AS `Creacion_sus`,
 1 AS `N_factura`,
 1 AS `Fecha_factura`,
 1 AS `Captador`,
 1 AS `Contrato_Firmado`,
 1 AS `id_relbase`,
 1 AS `estado_factura_sii`,
 1 AS `siniestroid`,
 1 AS `montopresupuesto`,
 1 AS `Nrocuotas`*/;
/*!50001 CREATE VIEW `Reclamos_cliente` AS SELECT 
 1 AS `Rut`,
 1 AS `Nombre`,
 1 AS `Telefono`,
 1 AS `Email`*/;
/*!50001 CREATE VIEW `RepClientes_Deuda_mas_actual` AS SELECT 
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Nombres`,
 1 AS `Apellidos`,
 1 AS `Genero`,
 1 AS `Fecha_de_Nacimiento`,
 1 AS `Celular_1`,
 1 AS `Celular_2`,
 1 AS `Correo_1`,
 1 AS `Correo_2`,
 1 AS `ID_ext_cliente`,
 1 AS `Indicador_Dia`,
 1 AS `Prop_Pago`,
 1 AS `Canal_comunicacion_preferido`,
 1 AS `Canal_de_pago_Preferido`,
 1 AS `Estado`,
 1 AS `Variable_1`,
 1 AS `Variable_2`,
 1 AS `Variable_3`,
 1 AS `Variable_4`,
 1 AS `Variable_5`,
 1 AS `Variable_6`,
 1 AS `Variable_7`,
 1 AS `Variable_8`,
 1 AS `Variable_9`,
 1 AS `Variable_10`,
 1 AS `Asesor_Id`,
 1 AS `Referencia_1_nombre`,
 1 AS `Referencia_1_apellido`,
 1 AS `Referencia_1_telefono`,
 1 AS `Referencia_1_correo_electronico`,
 1 AS `Referencia_2_nombre`,
 1 AS `Referencia_2_apellido`,
 1 AS `Referencia_2_telefono`,
 1 AS `Referencia_2_correo_electronico`,
 1 AS `Garante_1_nombre`,
 1 AS `Garante_1_apellido`,
 1 AS `Garante_1_telefono`,
 1 AS `Garante_1_correo_electronico`,
 1 AS `Garante_2_nombre`,
 1 AS `Garante_2_apellido`,
 1 AS `Garante_2_telefono`,
 1 AS `Garante_2_correo_electronico`,
 1 AS `Deleted`,
 1 AS `Celular_1_codigo_pais`,
 1 AS `Celular_2_codigo_pais`,
 1 AS `Referencia_1_telefono_codigo_pais`,
 1 AS `Referencia_2_telefono_codigo_pais`,
 1 AS `Garante_1_telefono_codigo_pais`,
 1 AS `Garante_2_telefono_codigo_pais`,
 1 AS `Monto_OP`,
 1 AS `Dias_de_atraso`,
 1 AS `ID_ext_orden`,
 1 AS `Estado para Variable 8`*/;
/*!50001 CREATE VIEW `RepClientes_Suma_diasAtraso_sumaMonto` AS SELECT 
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Nombres`,
 1 AS `Apellidos`,
 1 AS `Genero`,
 1 AS `Fecha_de_Nacimiento`,
 1 AS `Celular_1`,
 1 AS `Celular_2`,
 1 AS `Correo_1`,
 1 AS `Correo_2`,
 1 AS `ID_ext_cliente`,
 1 AS `Indicador_Dia`,
 1 AS `Prop_Pago`,
 1 AS `Canal_comunicacion_preferido`,
 1 AS `Canal_de_pago_Preferido`,
 1 AS `Estado`,
 1 AS `Variable_1`,
 1 AS `Variable_2`,
 1 AS `Variable_3`,
 1 AS `Variable_4`,
 1 AS `Variable_5`,
 1 AS `Variable_6`,
 1 AS `Variable_7`,
 1 AS `Variable_8`,
 1 AS `Variable_9`,
 1 AS `Variable_10`,
 1 AS `Asesor_Id`,
 1 AS `Referencia_1_nombre`,
 1 AS `Referencia_1_apellido`,
 1 AS `Referencia_1_telefono`,
 1 AS `Referencia_1_correo_electronico`,
 1 AS `Referencia_2_nombre`,
 1 AS `Referencia_2_apellido`,
 1 AS `Referencia_2_telefono`,
 1 AS `Referencia_2_correo_electronico`,
 1 AS `Garante_1_nombre`,
 1 AS `Garante_1_apellido`,
 1 AS `Garante_1_telefono`,
 1 AS `Garante_1_correo_electronico`,
 1 AS `Garante_2_nombre`,
 1 AS `Garante_2_apellido`,
 1 AS `Garante_2_telefono`,
 1 AS `Garante_2_correo_electronico`,
 1 AS `Deleted`,
 1 AS `Celular_1_codigo_pais`,
 1 AS `Celular_2_codigo_pais`,
 1 AS `Referencia_1_telefono_codigo_pais`,
 1 AS `Referencia_2_telefono_codigo_pais`,
 1 AS `Garante_1_telefono_codigo_pais`,
 1 AS `Garante_2_telefono_codigo_pais`,
 1 AS `Total_Monto_OP`,
 1 AS `Total_Dias_de_atraso`,
 1 AS `ID_ext_orden`,
 1 AS `Estado para Variable 8`*/;
CREATE TABLE `Reporte_Clientes_monflow` (
  `Tipo_doc` int(11) DEFAULT NULL,
  `Num_documento` varchar(20) DEFAULT NULL,
  `Nombres` varchar(100) DEFAULT NULL,
  `Apellidos` varchar(100) DEFAULT NULL,
  `Genero` char(1) DEFAULT NULL,
  `Fecha_de_Nacimiento` date DEFAULT NULL,
  `Celular_1` varchar(20) DEFAULT NULL,
  `Celular_2` varchar(20) DEFAULT NULL,
  `Correo_1` varchar(100) DEFAULT NULL,
  `Correo_2` varchar(100) DEFAULT NULL,
  `ID_ext_cliente` varchar(20) DEFAULT NULL,
  `Indicador_Dia` int(11) DEFAULT NULL,
  `Prop_Pago` int(11) DEFAULT NULL,
  `Canal_comunicacion_preferido` int(11) DEFAULT NULL,
  `Canal_de_pago_Preferido` int(11) DEFAULT NULL,
  `Estado` varchar(50) DEFAULT NULL,
  `Variable_1` varchar(50) DEFAULT NULL,
  `Variable_2` varchar(50) DEFAULT NULL,
  `Variable_3` varchar(50) DEFAULT NULL,
  `Variable_4` varchar(50) DEFAULT NULL,
  `Variable_5` varchar(50) DEFAULT NULL,
  `Variable_6` varchar(50) DEFAULT NULL,
  `Variable_7` varchar(50) DEFAULT NULL,
  `Variable_8` varchar(50) DEFAULT NULL,
  `Variable_9` varchar(50) DEFAULT NULL,
  `Variable_10` varchar(50) DEFAULT NULL,
  `Asesor_Id` varchar(20) DEFAULT NULL,
  `Referencia_1_nombre` varchar(100) DEFAULT NULL,
  `Referencia_1_apellido` varchar(100) DEFAULT NULL,
  `Referencia_1_telefono` varchar(20) DEFAULT NULL,
  `Referencia_1_correo_electronico` varchar(100) DEFAULT NULL,
  `Referencia_2_nombre` varchar(100) DEFAULT NULL,
  `Referencia_2_apellido` varchar(100) DEFAULT NULL,
  `Referencia_2_telefono` varchar(20) DEFAULT NULL,
  `Referencia_2_correo_electronico` varchar(100) DEFAULT NULL,
  `Garante_1_nombre` varchar(100) DEFAULT NULL,
  `Garante_1_apellido` varchar(100) DEFAULT NULL,
  `Garante_1_telefono` varchar(20) DEFAULT NULL,
  `Garante_1_correo_electronico` varchar(100) DEFAULT NULL,
  `Garante_2_nombre` varchar(100) DEFAULT NULL,
  `Garante_2_apellido` varchar(100) DEFAULT NULL,
  `Garante_2_telefono` varchar(20) DEFAULT NULL,
  `Garante_2_correo_electronico` varchar(100) DEFAULT NULL,
  `Deleted` int(11) DEFAULT NULL,
  `Celular_1_codigo_pais` int(11) DEFAULT NULL,
  `Celular_2_codigo_pais` int(11) DEFAULT NULL,
  `Referencia_1_telefono_codigo_pais` int(11) DEFAULT NULL,
  `Referencia_2_telefono_codigo_pais` int(11) DEFAULT NULL,
  `Garante_1_telefono_codigo_pais` int(11) DEFAULT NULL,
  `Garante_2_telefono_codigo_pais` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `Reporte_Ordenes_Pago` (
  `Tipo_doc` int(11) DEFAULT NULL,
  `Num_documento` varchar(20) DEFAULT NULL,
  `Producto` varchar(100) DEFAULT NULL,
  `Codigo_de_pago` varchar(20) DEFAULT NULL,
  `Cuota` int(11) DEFAULT NULL,
  `ID_ext_cliente` varchar(20) DEFAULT NULL,
  `Moneda` varchar(10) DEFAULT NULL,
  `Monto_OP` int(10) DEFAULT NULL,
  `Cargos_Intereses_OP` decimal(10,2) DEFAULT NULL,
  `Monto_total` decimal(10,2) DEFAULT NULL,
  `Fecha_vencimiento` date DEFAULT NULL,
  `Dias_de_atraso` int(11) DEFAULT NULL,
  `Estado` varchar(50) DEFAULT NULL,
  `Fecha_de_emision` date DEFAULT NULL,
  `ID_ext_orden` varchar(20) DEFAULT NULL,
  `Estado_Caso` varchar(50) DEFAULT NULL,
  `Captador` varchar(100) DEFAULT NULL,
  `Nombre` varchar(100) DEFAULT NULL,
  `Email` varchar(100) DEFAULT NULL,
  `Telefono` varchar(20) DEFAULT NULL,
  `Comuna` varchar(50) DEFAULT NULL,
  `Contrato_Firmado` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `Reporte_clientes_garantia_v1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fecha_siniestro` varchar(50) DEFAULT NULL,
  `comuna_caso` varchar(255) DEFAULT NULL,
  `cont_plat` varchar(10) DEFAULT NULL,
  `estado_caso_siniestro` varchar(255) DEFAULT NULL,
  `nro_caso` varchar(50) DEFAULT NULL,
  `banco_caso_siniestro` varchar(255) DEFAULT NULL,
  `nombre_cliente_caso_siniestro` varchar(255) DEFAULT NULL,
  `rut_cliente` varchar(20) DEFAULT NULL,
  `fact_pag_sus` varchar(10) DEFAULT NULL,
  `direccion_siniestro` varchar(255) DEFAULT NULL,
  `comuna_siniestro` varchar(255) DEFAULT NULL,
  `monto_presupuesto` varchar(50) DEFAULT NULL,
  `tipo_siniestro` varchar(100) DEFAULT NULL,
  `nro_siniestro` varchar(50) DEFAULT NULL,
  `fecha_siniestro_original` varchar(50) DEFAULT NULL,
  `compania_seguros` varchar(255) DEFAULT NULL,
  `liquidadora` varchar(255) DEFAULT NULL,
  `perd_rec_uf` varchar(50) DEFAULT NULL,
  `perd_rec_pesos` varchar(50) DEFAULT NULL,
  `perd_det_uf` varchar(50) DEFAULT NULL,
  `perd_ind` varchar(50) DEFAULT NULL,
  `cobertura` varchar(50) DEFAULT NULL,
  `movil_cliente` varchar(20) DEFAULT NULL,
  `rut_cliente_contacto` varchar(20) DEFAULT NULL,
  `nombre_cliente_contacto` varchar(100) DEFAULT NULL,
  `apellido_cliente_contacto` varchar(100) DEFAULT NULL,
  `correo_cliente` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `Reporte_clientes_garantia_v11` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fecha_siniestro` varchar(50) DEFAULT NULL,
  `comuna_caso` varchar(255) DEFAULT NULL,
  `cont_plat` varchar(10) DEFAULT NULL,
  `estado_caso_siniestro` varchar(255) DEFAULT NULL,
  `nro_caso` varchar(50) DEFAULT NULL,
  `banco_caso_siniestro` varchar(255) DEFAULT NULL,
  `nombre_cliente_caso_siniestro` varchar(255) DEFAULT NULL,
  `rut_cliente` varchar(20) DEFAULT NULL,
  `fact_pag_sus` varchar(10) DEFAULT NULL,
  `direccion_siniestro` varchar(255) DEFAULT NULL,
  `comuna_siniestro` varchar(255) DEFAULT NULL,
  `monto_presupuesto` varchar(50) DEFAULT NULL,
  `tipo_siniestro` varchar(100) DEFAULT NULL,
  `nro_siniestro` varchar(50) DEFAULT NULL,
  `fecha_siniestro_original` varchar(50) DEFAULT NULL,
  `compania_seguros` varchar(255) DEFAULT NULL,
  `liquidadora` varchar(255) DEFAULT NULL,
  `perd_rec_uf1` varchar(50) DEFAULT NULL,
  `perd_rec_uf2` varchar(50) DEFAULT NULL,
  `perd_det_uf` varchar(50) DEFAULT NULL,
  `perd_rec_pesos` varchar(50) DEFAULT NULL,
  `perd_ind` varchar(50) DEFAULT NULL,
  `cobertura` varchar(50) DEFAULT NULL,
  `movil_cliente` varchar(20) DEFAULT NULL,
  `rut_cliente_contacto` varchar(20) DEFAULT NULL,
  `nombre_cliente_contacto` varchar(100) DEFAULT NULL,
  `apellido_cliente_contacto` varchar(100) DEFAULT NULL,
  `correo_cliente` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2427 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `SINFACTURAR` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`,
 1 AS `user_name`*/;
CREATE TABLE `Sheyet1` (
  `field_A` int(10) DEFAULT NULL,
  `field_B` date DEFAULT NULL,
  `field_C` varchar(255) DEFAULT NULL,
  `field_D` varchar(255) DEFAULT NULL,
  `field_E` varchar(255) DEFAULT NULL,
  `field_F` varchar(255) DEFAULT NULL,
  `field_G` varchar(255) DEFAULT NULL,
  `field_H` varchar(255) DEFAULT NULL,
  `field_I` varchar(255) DEFAULT NULL,
  `field_J` varchar(255) DEFAULT NULL,
  `field_K` varchar(255) DEFAULT NULL,
  `field_L` varchar(255) DEFAULT NULL,
  `field_M` varchar(255) DEFAULT NULL,
  `field_N` varchar(255) DEFAULT NULL,
  `field_O` int(10) DEFAULT NULL,
  `field_P` int(10) DEFAULT NULL,
  `field_Q` int(10) DEFAULT NULL,
  `field_R` int(10) DEFAULT NULL,
  `field_S` int(10) DEFAULT NULL,
  `field_T` int(10) DEFAULT NULL,
  `field_U` int(10) DEFAULT NULL,
  `field_V` varchar(255) DEFAULT NULL,
  `field_W` varchar(255) DEFAULT NULL,
  `field_X` varchar(255) DEFAULT NULL,
  `field_Y` int(10) DEFAULT NULL,
  `field_Z` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `Toku_sus_fil_0` AS SELECT 
 1 AS `siniestroid`,
 1 AS `siniestro`,
 1 AS `estado_`,
 1 AS `suscripcionid`,
 1 AS `valortotal`,
 1 AS `nrocuotas`,
 1 AS `nrofactura`,
 1 AS `cliente`,
 1 AS `NOMBRE_CLI`,
 1 AS `movil`,
 1 AS `email`,
 1 AS `createdtime`,
 1 AS `abonopagado`,
 1 AS `fechavenabo`,
 1 AS `1cuotapagada`,
 1 AS `fven1`,
 1 AS `2cuotapagada`,
 1 AS `fven2`*/;
/*!50001 CREATE VIEW `TotalHonorarios` AS SELECT 
 1 AS `id`,
 1 AS `paymentsin_status`,
 1 AS `nrofactura`,
 1 AS `cliente`,
 1 AS `indemnizacion`,
 1 AS `valorfactura`,
 1 AS `createdtime`,
 1 AS `banco`,
 1 AS `ffactura`,
 1 AS `fvencimientofactura`,
 1 AS `nrosiniestro`,
 1 AS `captador`,
 1 AS `assigned_user_id`*/;
/*!50001 CREATE VIEW `VentasDeDemandaPorProcesar` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `createdtime`,
 1 AS `assigned_user_id`,
 1 AS `idsiniestro`,
 1 AS `clienteid`,
 1 AS `fono`*/;
/*!50001 CREATE VIEW `Vista_Max_Dias_Atraso_Min_Fecha` AS SELECT 
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Codigo_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_Intereses_OP`,
 1 AS `Monto_total`,
 1 AS `Fecha_vencimiento`,
 1 AS `Dias_de_atraso`,
 1 AS `Estado`,
 1 AS `Fecha_de_emision`,
 1 AS `ID_ext_orden`,
 1 AS `Estado_Caso`,
 1 AS `Captador`,
 1 AS `Nombre`,
 1 AS `Email`,
 1 AS `Telefono`,
 1 AS `Comuna`,
 1 AS `Contrato_Firmado`*/;
/*!50001 CREATE VIEW `Vista_Max_Dias_Atraso_Pendiente` AS SELECT 
 1 AS `ID_ext_cliente`,
 1 AS `Num_documento`,
 1 AS `Tipo_doc`,
 1 AS `Producto`,
 1 AS `Codigo_de_pago`,
 1 AS `Cuota`,
 1 AS `Moneda`,
 1 AS `Total_Monto_OP`,
 1 AS `Total_Dias_de_atraso`,
 1 AS `Min_Fecha_vencimiento`,
 1 AS `Estado`,
 1 AS `Max_Fecha_de_emision`,
 1 AS `ID_ext_orden`,
 1 AS `Estado_Caso`,
 1 AS `Captador`,
 1 AS `Nombre`,
 1 AS `Email`,
 1 AS `Telefono`,
 1 AS `Comuna`,
 1 AS `Contrato_Firmado`*/;
CREATE TABLE `a_yf_adv_permission` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `status` tinyint(1) unsigned NOT NULL,
  `action` tinyint(1) unsigned NOT NULL,
  `conditions` text,
  `members` text NOT NULL,
  `priority` tinyint(1) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `tabid` (`tabid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_bruteforce` (
  `attempsnumber` tinyint(2) NOT NULL,
  `timelock` smallint(5) NOT NULL,
  `active` tinyint(1) DEFAULT '0',
  `sent` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_bruteforce_blocked` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `ip` varchar(50) NOT NULL,
  `time` timestamp NULL DEFAULT NULL,
  `attempts` tinyint(2) DEFAULT '0',
  `blocked` tinyint(1) DEFAULT '0',
  `userid` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `bf1_mixed` (`ip`,`time`,`blocked`)
) ENGINE=InnoDB AUTO_INCREMENT=1552 DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_bruteforce_users` (
  `id` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT `fk_1_vtiger_bruteforce_users` FOREIGN KEY (`id`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_discounts_config` (
  `param` varchar(30) NOT NULL,
  `value` varchar(255) NOT NULL,
  PRIMARY KEY (`param`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_discounts_global` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `value` decimal(5,2) unsigned NOT NULL DEFAULT '0.00',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_encryption` (
  `method` varchar(40) NOT NULL,
  `pass` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_inventory_limits` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(50) NOT NULL,
  `value` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_mapped_config` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) unsigned NOT NULL,
  `reltabid` smallint(5) unsigned NOT NULL,
  `status` tinyint(1) unsigned DEFAULT '0',
  `conditions` text,
  `permissions` varchar(255) DEFAULT NULL,
  `params` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tabid` (`tabid`),
  KEY `reltabid` (`reltabid`),
  KEY `tabid_2` (`tabid`,`status`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_mapped_fields` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `mappedid` int(10) DEFAULT NULL,
  `type` varchar(30) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `target` varchar(30) DEFAULT NULL,
  `default` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `a_yf_mapped_fields_ibfk_1` (`mappedid`),
  CONSTRAINT `a_yf_mapped_fields_ibfk_1` FOREIGN KEY (`mappedid`) REFERENCES `a_yf_mapped_config` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=158 DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_pdf` (
  `pdfid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id of record',
  `module_name` varchar(25) NOT NULL COMMENT 'name of the module',
  `header_content` text NOT NULL,
  `body_content` text NOT NULL,
  `footer_content` text NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `primary_name` varchar(255) NOT NULL,
  `secondary_name` varchar(255) NOT NULL,
  `meta_author` varchar(255) NOT NULL,
  `meta_creator` varchar(255) NOT NULL,
  `meta_keywords` varchar(255) NOT NULL,
  `metatags_status` tinyint(1) NOT NULL,
  `meta_subject` varchar(255) NOT NULL,
  `meta_title` varchar(255) NOT NULL,
  `page_format` varchar(255) NOT NULL,
  `margin_chkbox` tinyint(1) DEFAULT NULL,
  `margin_top` smallint(2) unsigned NOT NULL,
  `margin_bottom` smallint(2) unsigned NOT NULL,
  `margin_left` smallint(2) unsigned NOT NULL,
  `margin_right` smallint(2) unsigned NOT NULL,
  `header_height` smallint(2) unsigned NOT NULL,
  `footer_height` smallint(2) unsigned NOT NULL,
  `page_orientation` varchar(30) NOT NULL,
  `language` varchar(7) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `visibility` varchar(200) NOT NULL,
  `default` tinyint(1) DEFAULT NULL,
  `conditions` text NOT NULL,
  `watermark_type` tinyint(1) NOT NULL DEFAULT '0',
  `watermark_text` varchar(255) NOT NULL,
  `watermark_size` tinyint(2) unsigned NOT NULL,
  `watermark_angle` smallint(3) unsigned NOT NULL,
  `watermark_image` varchar(255) NOT NULL,
  `template_members` text NOT NULL,
  `one_pdf` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`pdfid`),
  KEY `module_name` (`module_name`,`status`),
  KEY `module_name_2` (`module_name`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_relatedlists_inv_fields` (
  `relation_id` int(10) DEFAULT NULL,
  `fieldname` varchar(30) DEFAULT NULL,
  `sequence` tinyint(1) DEFAULT NULL,
  KEY `relation_id` (`relation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_smsnotifier_servers` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `providertype` varchar(50) NOT NULL,
  `isactive` tinyint(1) DEFAULT '0',
  `api_key` varchar(255) NOT NULL,
  `parameters` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_taxes_config` (
  `param` varchar(30) NOT NULL,
  `value` varchar(255) NOT NULL,
  PRIMARY KEY (`param`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `a_yf_taxes_global` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `value` decimal(5,2) unsigned NOT NULL DEFAULT '0.00',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `abono` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `siniestro`,
 1 AS `nombrecliente`,
 1 AS `assigned_user_id`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `notacredito`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`*/;
/*!50001 CREATE VIEW `abono1cuota` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `Siniestro`,
 1 AS `Nombre Cliente`,
 1 AS `Asignado`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `notacredito`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`,
 1 AS `primeracuota`*/;
/*!50001 CREATE VIEW `abono2` AS SELECT 
 1 AS `id`,
 1 AS `number`,
 1 AS `siniestro`,
 1 AS `Cliente`,
 1 AS `Asignado`,
 1 AS `createdtime`,
 1 AS `abono`,
 1 AS `notacredito`,
 1 AS `fechavenabo`,
 1 AS `fven1`,
 1 AS `fven2`*/;
CREATE TABLE `actualiza_DDA_GARANTIA` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `SINI` varchar(100) NOT NULL,
  `CHEC` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=280 DEFAULT CHARSET=utf8;
CREATE TABLE `actualiza_error_asigna` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_reg` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=116 DEFAULT CHARSET=utf8;
CREATE TABLE `actualizar_fechasiniestro` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `NumeroDeCaso` varchar(255) DEFAULT NULL,
  `FechaCreacionCliente` datetime DEFAULT NULL,
  `FechaSiniestro` date DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2014 DEFAULT CHARSET=utf8;
CREATE TABLE `actualizar_vd1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idsiniestro` varchar(100) NOT NULL,
  `comisionpagada` tinyint(1) NOT NULL,
  `categoiacomision` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=114 DEFAULT CHARSET=utf8;
CREATE TABLE `actualizar_vd2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idc` int(12) NOT NULL,
  `siniestro` varchar(200) NOT NULL,
  `abogadoasignado` varchar(200) NOT NULL,
  `mesasignacion` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;
CREATE TABLE `actulaiza_sini_estados` (
  `ncaso` varchar(100) NOT NULL,
  `estado` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `asignacion_cli_user_PAC` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idcliente` int(10) NOT NULL,
  `user_crm` varchar(100) NOT NULL,
  `Rut` varchar(100) NOT NULL,
  `Nombre` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8198 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `audigen` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Codigo_SII`,
 1 AS `Tipo`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Nro_caso`,
 1 AS `1er_Item`,
 1 AS `Razon_Social_Emisor`,
 1 AS `RUT_Emisor`,
 1 AS `Direccion_Emisor`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Direccion_Receptor`,
 1 AS `Exento`,
 1 AS `Neto`,
 1 AS `Total_Neto`,
 1 AS `IVA`,
 1 AS `Otros_Impuestos`,
 1 AS `Total`,
 1 AS `Saldo`,
 1 AS `Pagado`,
 1 AS `Contabilizado`,
 1 AS `Rechazado`,
 1 AS `Monto_Incobrable`,
 1 AS `Vendedor`,
 1 AS `Email`,
 1 AS `Telefono`,
 1 AS `Telefono2`,
 1 AS `Suscripcion_SUS`,
 1 AS `Caso_Siniestro_SUS`,
 1 AS `Estado_Caso_Siniestro_SUS`,
 1 AS `Fecha_suscripcion_SUS`,
 1 AS `Captador_SUS`,
 1 AS `Monto_SUS`,
 1 AS `Saldo_CRM_SUS`,
 1 AS `Estado_Factura_SUS`,
 1 AS `Nro_Factura_SUS`,
 1 AS `Fecha_Factura_SUS`,
 1 AS `Nota_Credito_SUS`,
 1 AS `Pagada_NC_SUS`,
 1 AS `Nro_Nota_Credito_SUS`,
 1 AS `Rut_Cliente_SUS`,
 1 AS `Suscripcion_DDA`,
 1 AS `Caso_Siniestro_DDA`,
 1 AS `Estado_Caso_Siniestro_DDA`,
 1 AS `Estado_Demanda_DDA`,
 1 AS `Fecha_suscripcion_DDA`,
 1 AS `Captador_DDA`,
 1 AS `Monto_DDA`,
 1 AS `Saldo_CRM_DDA`,
 1 AS `Nro_Factura_DDA`,
 1 AS `Estado_Factura_DDA`,
 1 AS `Rut_Cliente_DDA`,
 1 AS `Cobranza_COB`,
 1 AS `Caso_Siniestro_COB`,
 1 AS `Estado_Caso_Siniestro_COB`,
 1 AS `Nro_Factura_COB`,
 1 AS `Monto_Factura_COB`,
 1 AS `Fecha_Factura_COB`,
 1 AS `Estado_Cobranza_COB`,
 1 AS `Rut_Cliente_COB`,
 1 AS `Valida_RUT_OK`,
 1 AS `Valida_Monto_OK`,
 1 AS `Valida_Fecha_OK`,
 1 AS `OK_SALDO_SUS`,
 1 AS `OK_SALDO_SUS_DDA`,
 1 AS `OK_SALDO_COBRA`,
 1 AS `Valida_Estado_OK`,
 1 AS `Valida_Existe_OK`,
 1 AS `SUSCRIPCION_EX`,
 1 AS `SUSCRIPCION_DDA_EX`,
 1 AS `COBRANZA_EX`*/;
CREATE TABLE `busquedaexcap` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sini` varchar(100) NOT NULL,
  `user` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1620 DEFAULT CHARSET=utf8;
CREATE TABLE `carro_pago_fintoc` (
  `id_cpf` int(11) NOT NULL AUTO_INCREMENT,
  `modulo_cpf` varchar(100) NOT NULL,
  `id_modulo_cpf` varchar(100) NOT NULL,
  `rut_cli_cpf` varchar(100) NOT NULL,
  `descrip_cpf` varchar(200) NOT NULL,
  `total_cpf` int(10) NOT NULL,
  `estado_cpf` int(11) NOT NULL,
  PRIMARY KEY (`id_cpf`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `caso_simplirut_estado_mod` AS SELECT 
 1 AS `estado_`,
 1 AS `siniestro`,
 1 AS `id_sr`*/;
CREATE TABLE `casosASL` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nro_caso` varchar(20) DEFAULT NULL,
  `nro_factura` varchar(20) DEFAULT NULL,
  `fecha_factura` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=86 DEFAULT CHARSET=utf8;
CREATE TABLE `ciu_relBase` (
  `id` int(11) NOT NULL,
  `cui` varchar(200) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `com_ciu_relbase` AS SELECT 
 1 AS `id`,
 1 AS `id_city`,
 1 AS `com`,
 1 AS `cui`*/;
CREATE TABLE `com_vtiger_workflow_activatedonce` (
  `workflow_id` int(10) NOT NULL,
  `entity_id` int(10) NOT NULL,
  PRIMARY KEY (`workflow_id`,`entity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflow_tasktypes` (
  `id` int(10) NOT NULL,
  `tasktypename` varchar(255) NOT NULL,
  `label` varchar(255) DEFAULT NULL,
  `classname` varchar(255) DEFAULT NULL,
  `classpath` varchar(255) DEFAULT NULL,
  `templatepath` varchar(255) DEFAULT NULL,
  `modules` varchar(500) DEFAULT NULL,
  `sourcemodule` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflow_tasktypes_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflows` (
  `workflow_id` int(10) NOT NULL AUTO_INCREMENT,
  `module_name` varchar(100) DEFAULT NULL,
  `summary` varchar(400) NOT NULL,
  `test` text,
  `execution_condition` int(10) NOT NULL,
  `defaultworkflow` int(1) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  `filtersavedinnew` int(1) DEFAULT NULL,
  `schtypeid` int(10) DEFAULT NULL,
  `schdayofmonth` varchar(100) DEFAULT NULL,
  `schdayofweek` varchar(100) DEFAULT NULL,
  `schannualdates` varchar(100) DEFAULT NULL,
  `schtime` varchar(50) DEFAULT NULL,
  `nexttrigger_time` datetime DEFAULT NULL,
  PRIMARY KEY (`workflow_id`),
  UNIQUE KEY `com_vtiger_workflows_idx` (`workflow_id`)
) ENGINE=InnoDB AUTO_INCREMENT=394 DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtask_queue` (
  `task_id` int(10) DEFAULT NULL,
  `entity_id` varchar(100) DEFAULT NULL,
  `do_after` int(10) DEFAULT NULL,
  `task_contents` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtasks` (
  `task_id` int(10) NOT NULL AUTO_INCREMENT,
  `workflow_id` int(10) DEFAULT NULL,
  `summary` varchar(400) NOT NULL,
  `task` text,
  PRIMARY KEY (`task_id`),
  KEY `workflow_id` (`workflow_id`),
  CONSTRAINT `com_vtiger_workflowtasks_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `com_vtiger_workflows` (`workflow_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=471 DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtasks_entitymethod` (
  `workflowtasks_entitymethod_id` int(10) NOT NULL,
  `module_name` varchar(100) DEFAULT NULL,
  `method_name` varchar(100) DEFAULT NULL,
  `function_path` varchar(400) DEFAULT NULL,
  `function_name` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`workflowtasks_entitymethod_id`),
  UNIQUE KEY `com_vtiger_workflowtasks_entitymethod_idx` (`workflowtasks_entitymethod_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtasks_entitymethod_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtasks_seq` (
  `id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `com_vtiger_workflowtemplates` (
  `template_id` int(10) NOT NULL AUTO_INCREMENT,
  `module_name` varchar(100) DEFAULT NULL,
  `title` varchar(400) DEFAULT NULL,
  `template` text,
  PRIMARY KEY (`template_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `comu_relBase` (
  `id` int(11) NOT NULL,
  `id_city` int(11) NOT NULL,
  `com` varchar(200) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `config_sus_pac` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Desde` date NOT NULL,
  `Hasta` date NOT NULL,
  `Estado` int(11) NOT NULL DEFAULT '0',
  `Nombre` varchar(100) NOT NULL,
  `id_mod` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
CREATE TABLE `config_sus_pac_mod` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Modulo` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
CREATE TABLE `contra_plantilla` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cuerpo` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `contratos_firmados_DC` AS SELECT 
 1 AS `id`,
 1 AS `Nombre`,
 1 AS `Telefono`,
 1 AS `Email`,
 1 AS `Contrato_firmado`*/;
/*!50001 CREATE VIEW `contratosfirmados` AS SELECT 
 1 AS `id`,
 1 AS `siniestro`,
 1 AS `Rut`,
 1 AS `Cliente`,
 1 AS `nombrecliente`,
 1 AS `createdtime`,
 1 AS `captador`,
 1 AS `estado`,
 1 AS `user_name`*/;
/*!50001 CREATE VIEW `contratosfirmados_vd` AS SELECT 
 1 AS `id`,
 1 AS `idsiniestro`,
 1 AS `estadocobranza`,
 1 AS `estadocomercialdda`,
 1 AS `montorecuperarclp`,
 1 AS `porcentajeapagar`,
 1 AS `fono`,
 1 AS `correo`,
 1 AS `estadollamada`,
 1 AS `Nombre`,
 1 AS `actualizar`,
 1 AS `fechadenuncia`,
 1 AS `clienteid`,
 1 AS `siniestro`,
 1 AS `user_name`,
 1 AS `contratofirmado`,
 1 AS `Rut`*/;
/*!50001 CREATE VIEW `count_sus` AS SELECT 
 1 AS `clienteid`,
 1 AS `Count_sus`,
 1 AS `cliente`*/;
CREATE TABLE `crm_actualizar_estados` (
  `actualizaestadoid` int(11) NOT NULL AUTO_INCREMENT,
  `idsiniestro` int(11) NOT NULL,
  `estado_` varchar(60) NOT NULL,
  `ingcrm` tinyint(4) NOT NULL,
  `preinsp_prg` tinyint(4) NOT NULL,
  `preinsp_reprg` tinyint(4) NOT NULL,
  `preinsp_rel` tinyint(4) NOT NULL,
  `preinsp_rev` tinyint(4) NOT NULL,
  `noapl` tinyint(4) NOT NULL,
  `preprog` tinyint(4) NOT NULL,
  `preliqasg` tinyint(4) NOT NULL,
  `enprog` tinyint(4) NOT NULL,
  `liqasg` tinyint(4) NOT NULL,
  `visreprg` tinyint(4) NOT NULL,
  `visprg` tinyint(4) NOT NULL,
  `visrel` tinyint(4) NOT NULL,
  `esp` tinyint(4) NOT NULL,
  `espprg` tinyint(4) NOT NULL,
  `infliqimpgpr` tinyint(4) NOT NULL,
  `infliqimpg2pr` tinyint(4) NOT NULL,
  `revresimpgpr` tinyint(4) NOT NULL,
  `infliqimpgcob` tinyint(4) NOT NULL,
  `infliqimpg2cob` tinyint(4) NOT NULL,
  `revresimpgcob` tinyint(4) NOT NULL,
  PRIMARY KEY (`actualizaestadoid`)
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
CREATE TABLE `crm_tipo_docs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `crm_tipo_estados` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(60) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
CREATE TABLE `crm_val_docs` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `idsiniestro` int(11) NOT NULL,
  `m_ingcrm` tinyint(4) NOT NULL,
  `m_preinsp_prg` tinyint(4) NOT NULL,
  `m_preinsp_rev` tinyint(4) NOT NULL,
  `m_noapl` tinyint(4) NOT NULL,
  `m_enprog` tinyint(4) NOT NULL,
  `m_liqasg` tinyint(4) NOT NULL,
  `m_visprg` tinyint(4) NOT NULL,
  `m_esp` tinyint(4) NOT NULL,
  `m_espprg` tinyint(4) NOT NULL,
  `m_infliqimpgpr` tinyint(4) NOT NULL,
  `m_infliqimpgcob` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `crmclay_rep20_0-0-0` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_1_co` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Cobranza`,
 1 AS `RUT_Cobranza`,
 1 AS `Nro_factura_Cobranza`,
 1 AS `Exento_Cobranza`,
 1 AS `Saldo_Cobranza`,
 1 AS `Abonado_Cobranza`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_1_dda` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Suscripcion_DDA`,
 1 AS `RUT_Suscripcion_DDA`,
 1 AS `Nro_factura_suscripcion_DDA`,
 1 AS `Exento_suscripcion_DDA`,
 1 AS `Saldo_suscripcion_DDA`,
 1 AS `Abonado_suscripcion_DDA`,
 1 AS `contrato_firmado_SDDA`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_1_sus` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Suscripcion`,
 1 AS `RUT_Suscripcion`,
 1 AS `Nro_factura_suscripcion`,
 1 AS `Exento_suscripcion`,
 1 AS `Saldo_suscripcion`,
 1 AS `Abonado_suscripcion`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_1_sus_co` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Suscripcion`,
 1 AS `RUT_Suscripcion`,
 1 AS `Nro_factura_suscripcion`,
 1 AS `Exento_suscripcion`,
 1 AS `Saldo_suscripcion`,
 1 AS `Abonado_suscripcion`,
 1 AS `Razon_Social_Cobranza`,
 1 AS `RUT_Cobranza`,
 1 AS `Nro_factura_cobranza`,
 1 AS `Exento_cobranza`,
 1 AS `Saldo_cobranza`,
 1 AS `Abonado_cobranza`,
 1 AS `Comparación_de_RUTs`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_1_sus_dda` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Suscripcion_DDA`,
 1 AS `RUT_Suscripcion_DDA`,
 1 AS `Nro_factura_suscripcion_DDA`,
 1 AS `Exento_suscripcion_DDA`,
 1 AS `Saldo_suscripcion_DDA`,
 1 AS `Abonado_suscripcion_DDA`,
 1 AS `Razon_Social_Suscripción`,
 1 AS `RUT_Suscripción`,
 1 AS `Nro_factura_Suscripción`,
 1 AS `Exento_Suscripción`,
 1 AS `Saldo_Suscripción`,
 1 AS `Abonado_Suscripción`,
 1 AS `Comparación_de_RUTs`,
 1 AS `contrato_firmado_SDDA`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_Clientes_perdidos_monflow` AS SELECT 
 1 AS `RUT_Receptor`,
 1 AS `Num_Factura`,
 1 AS `Nro_caso`*/;
/*!50001 CREATE VIEW `crmclay_rep20_Clientes_perdidos_monflow_2` AS SELECT 
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Nombres`,
 1 AS `Apellidos`,
 1 AS `Género`,
 1 AS `Fecha_de_Nacimiento`,
 1 AS `Celular_1`,
 1 AS `Celular_2`,
 1 AS `Correo_1`,
 1 AS `Correo_2`,
 1 AS `ID_ext_cliente`,
 1 AS `Indicador_al_día`,
 1 AS `Propensión_al_pago`,
 1 AS `Canal_comunicación_preferido`,
 1 AS `Canal_de_pago_Preferido`,
 1 AS `Estado`,
 1 AS `Variable_1`,
 1 AS `Variable_2`,
 1 AS `Variable_3`,
 1 AS `Variable_4`,
 1 AS `Variable_5`,
 1 AS `Variable_6`,
 1 AS `Variable_7`,
 1 AS `Variable_8`,
 1 AS `Variable_9`,
 1 AS `Variable_10`,
 1 AS `Asesor_ID`,
 1 AS `Referencia_1_nombre`,
 1 AS `Referencia_1_teléfono`,
 1 AS `Referencia_1_correo_electrónico`,
 1 AS `Referencia_2_nombre`,
 1 AS `Referencia_2_apellido`,
 1 AS `Referencia_2_teléfono`,
 1 AS `Referencia_2_correo_electrónico`,
 1 AS `Garante_1_nombre`,
 1 AS `Garante_1_apellido`,
 1 AS `Garante_1_teléfono`,
 1 AS `Garante_1_correo_electrónico`,
 1 AS `Garante_2_nombre`,
 1 AS `Garante_2_apellido`,
 1 AS `Garante_2_teléfono`,
 1 AS `Garante_2_correo_electrónico`,
 1 AS `Eliminación`*/;
/*!50001 CREATE VIEW `crmclay_rep20_Clientes_perdidos_monflow_3` AS SELECT 
 1 AS `sus`,
 1 AS `co`,
 1 AS `dda`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Nombres`,
 1 AS `Apellidos`,
 1 AS `Género`,
 1 AS `Fecha_de_Nacimiento`,
 1 AS `Celular_1`,
 1 AS `Celular_2`,
 1 AS `Correo_1`,
 1 AS `Correo_2`,
 1 AS `ID_ext_cliente`,
 1 AS `Indicador_al_día`,
 1 AS `Propensión_al_pago`,
 1 AS `Canal_comunicación_preferido`,
 1 AS `Canal_de_pago_Preferido`,
 1 AS `Estado`,
 1 AS `Variable_1`,
 1 AS `Variable_2`,
 1 AS `Variable_3`,
 1 AS `Variable_4`,
 1 AS `Variable_5`,
 1 AS `Variable_6`,
 1 AS `Variable_7`,
 1 AS `Variable_8`,
 1 AS `Variable_9`,
 1 AS `Variable_10`,
 1 AS `Asesor_ID`,
 1 AS `Referencia_1_nombre`,
 1 AS `Referencia_1_teléfono`,
 1 AS `Referencia_1_correo_electrónico`,
 1 AS `Referencia_2_nombre`,
 1 AS `Referencia_2_apellido`,
 1 AS `Referencia_2_teléfono`,
 1 AS `Referencia_2_correo_electrónico`,
 1 AS `Garante_1_nombre`,
 1 AS `Garante_1_apellido`,
 1 AS `Garante_1_teléfono`,
 1 AS `Garante_1_correo_electrónico`,
 1 AS `Garante_2_nombre`,
 1 AS `Garante_2_apellido`,
 1 AS `Garante_2_teléfono`,
 1 AS `Garante_2_correo_electrónico`,
 1 AS `Eliminación`,
 1 AS `Modulo`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Num_Factura`,
 1 AS `Nro_caso`,
 1 AS `Total`,
 1 AS `Saldo`,
 1 AS `Pagado`*/;
/*!50001 CREATE VIEW `crmclay_rep20_NewRonin` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `Nro_caso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_Todos_lo_clientes` AS SELECT 
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Nombres`,
 1 AS `Apellidos`,
 1 AS `Género`,
 1 AS `Fecha_de_Nacimiento`,
 1 AS `Celular_1`,
 1 AS `Celular_2`,
 1 AS `Correo_1`,
 1 AS `Correo_2`,
 1 AS `ID_ext_cliente`,
 1 AS `Indicador_al_día`,
 1 AS `Propensión_al_pago`,
 1 AS `Canal_comunicación_preferido`,
 1 AS `Canal_de_pago_Preferido`,
 1 AS `Estado`,
 1 AS `Variable_1`,
 1 AS `Variable_2`,
 1 AS `Variable_3`,
 1 AS `Variable_4`,
 1 AS `Variable_5`,
 1 AS `Variable_6`,
 1 AS `Variable_7`,
 1 AS `Variable_8`,
 1 AS `Variable_9`,
 1 AS `Variable_10`,
 1 AS `Asesor_ID`,
 1 AS `Referencia_1_nombre`,
 1 AS `Referencia_1_teléfono`,
 1 AS `Referencia_1_correo_electrónico`,
 1 AS `Referencia_2_nombre`,
 1 AS `Referencia_2_apellido`,
 1 AS `Referencia_2_teléfono`,
 1 AS `Referencia_2_correo_electrónico`,
 1 AS `Garante_1_nombre`,
 1 AS `Garante_1_apellido`,
 1 AS `Garante_1_teléfono`,
 1 AS `Garante_1_correo_electrónico`,
 1 AS `Garante_2_nombre`,
 1 AS `Garante_2_apellido`,
 1 AS `Garante_2_teléfono`,
 1 AS `Garante_2_correo_electrónico`,
 1 AS `Eliminación`*/;
/*!50001 CREATE VIEW `crmclay_rep20_co` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`*/;
/*!50001 CREATE VIEW `crmclay_rep20_co-dda` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_co-dda-sus` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_co-dda_Monflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_co_Monflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_dda` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`*/;
/*!50001 CREATE VIEW `crmclay_rep20_dda_Monflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus-co` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus-co-dda` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus-co_Monflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus-dda` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus-dda_Monflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
/*!50001 CREATE VIEW `crmclay_rep20_sus_Mmonflow` AS SELECT 
 1 AS `id`,
 1 AS `Modulo`,
 1 AS `ncaso`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `Num_Factura`,
 1 AS `Razon_Social_Receptor`,
 1 AS `RUT_Receptor`,
 1 AS `Exento`,
 1 AS `Saldo`,
 1 AS `Tipo_doc`,
 1 AS `Num_documento`,
 1 AS `Producto`,
 1 AS `Código_de_pago`,
 1 AS `Cuota`,
 1 AS `ID_ext_cliente`,
 1 AS `Moneda`,
 1 AS `Monto_OP`,
 1 AS `Cargos_e_Intereses_OP`,
 1 AS `Fecha_de_vencimiento_DD_MM_YYYY`,
 1 AS `Anulada`,
 1 AS `URL_Adjunto_1`,
 1 AS `URL_Adjunto_2`,
 1 AS `Fecha_de_emisión_DD_MM_YYYY`,
 1 AS `Descripción`,
 1 AS `Descuento`,
 1 AS `ID_ext_orden`*/;
CREATE TABLE `crmclay_router` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ncaso` varchar(100) NOT NULL,
  `sus` int(1) NOT NULL,
  `co` int(1) NOT NULL,
  `dda` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1815 DEFAULT CHARSET=utf8;
CREATE TABLE `cruze_evaluador_preevaluador` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ncaso` varchar(100) NOT NULL,
  `fecha` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=121 DEFAULT CHARSET=utf8;
CREATE TABLE `css_Gen_Cert_Convenios` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Nombre APP` varchar(100) NOT NULL,
  `CSS` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `datosclientes` AS SELECT 
 1 AS `Movil`,
 1 AS `cliente`,
 1 AS `Nombre_de_contacto`,
 1 AS `Correo_electronico`,
 1 AS `createdtime`*/;
CREATE TABLE `dav_addressbookchanges` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varbinary(200) NOT NULL,
  `synctoken` int(10) unsigned NOT NULL,
  `addressbookid` int(10) unsigned NOT NULL,
  `operation` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `addressbookid_synctoken` (`addressbookid`,`synctoken`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_addressbooks` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `principaluri` varbinary(255) DEFAULT NULL,
  `displayname` varchar(255) DEFAULT NULL,
  `uri` varbinary(200) DEFAULT NULL,
  `description` text,
  `synctoken` int(10) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `principaluri` (`principaluri`(100),`uri`(100)),
  KEY `dav_addressbooks_idx` (`principaluri`),
  CONSTRAINT `dav_addressbooks_ibfk_1` FOREIGN KEY (`principaluri`) REFERENCES `dav_principals` (`uri`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_calendarchanges` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varbinary(200) NOT NULL,
  `synctoken` int(10) unsigned NOT NULL,
  `calendarid` int(10) unsigned NOT NULL,
  `operation` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `calendarid_synctoken` (`calendarid`,`synctoken`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_calendarobjects` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `calendardata` mediumblob,
  `uri` varbinary(200) DEFAULT NULL,
  `calendarid` int(10) unsigned NOT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  `etag` varbinary(32) DEFAULT NULL,
  `size` int(10) unsigned NOT NULL,
  `componenttype` varbinary(8) DEFAULT NULL,
  `firstoccurence` int(10) unsigned DEFAULT NULL,
  `lastoccurence` int(10) unsigned DEFAULT NULL,
  `uid` varbinary(200) DEFAULT NULL,
  `crmid` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `calendarid` (`calendarid`,`uri`),
  CONSTRAINT `dav_calendarobjects_ibfk_1` FOREIGN KEY (`calendarid`) REFERENCES `dav_calendars` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_calendars` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `principaluri` varbinary(100) DEFAULT NULL,
  `displayname` varchar(100) DEFAULT NULL,
  `uri` varbinary(200) DEFAULT NULL,
  `synctoken` int(10) unsigned NOT NULL DEFAULT '1',
  `description` text,
  `calendarorder` int(10) unsigned NOT NULL DEFAULT '0',
  `calendarcolor` varbinary(10) DEFAULT NULL,
  `timezone` text,
  `components` varbinary(21) DEFAULT NULL,
  `transparent` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `principaluri` (`principaluri`,`uri`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_calendarsubscriptions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varbinary(200) NOT NULL,
  `principaluri` varbinary(100) NOT NULL,
  `source` text,
  `displayname` varchar(100) DEFAULT NULL,
  `refreshrate` varchar(10) DEFAULT NULL,
  `calendarorder` int(10) unsigned NOT NULL DEFAULT '0',
  `calendarcolor` varbinary(10) DEFAULT NULL,
  `striptodos` tinyint(1) DEFAULT NULL,
  `stripalarms` tinyint(1) DEFAULT NULL,
  `stripattachments` tinyint(1) DEFAULT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `principaluri` (`principaluri`,`uri`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_cards` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `addressbookid` int(10) unsigned NOT NULL,
  `carddata` mediumblob,
  `uri` varbinary(200) DEFAULT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  `etag` varbinary(32) DEFAULT NULL,
  `size` int(10) unsigned NOT NULL,
  `crmid` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `addressbookid` (`addressbookid`,`crmid`),
  CONSTRAINT `dav_cards_ibfk_1` FOREIGN KEY (`addressbookid`) REFERENCES `dav_addressbooks` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_groupmembers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `principal_id` int(10) unsigned NOT NULL,
  `member_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `principal_id` (`principal_id`,`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_principals` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varbinary(200) NOT NULL,
  `email` varbinary(80) DEFAULT NULL,
  `displayname` varchar(80) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uri` (`uri`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_propertystorage` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `path` varbinary(1024) NOT NULL,
  `name` varbinary(100) NOT NULL,
  `valuetype` int(10) unsigned DEFAULT NULL,
  `value` mediumblob,
  PRIMARY KEY (`id`),
  UNIQUE KEY `path_property` (`path`(600),`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_schedulingobjects` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `principaluri` varbinary(255) DEFAULT NULL,
  `calendardata` mediumblob,
  `uri` varbinary(200) DEFAULT NULL,
  `lastmodified` int(10) unsigned DEFAULT NULL,
  `etag` varbinary(32) DEFAULT NULL,
  `size` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `dav_users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varbinary(50) DEFAULT NULL,
  `digesta1` varbinary(32) DEFAULT NULL,
  `userid` int(10) unsigned DEFAULT NULL,
  `key` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `delcasoVD` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `caso` varchar(100) NOT NULL,
  `est` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=255 DEFAULT CHARSET=utf8;
CREATE TABLE `desactivar_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `users` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=138 DEFAULT CHARSET=utf8;
CREATE TABLE `det_maestro_Simplirute` (
  `id_det_msr` int(11) NOT NULL AUTO_INCREMENT,
  `id_msr` int(11) NOT NULL,
  `id_sr` int(11) NOT NULL,
  `status` varchar(200) NOT NULL,
  `Nombre_plan_dms` varchar(200) NOT NULL,
  `Id_ruta_dms` varchar(200) NOT NULL,
  `start_date_dms` varchar(200) NOT NULL,
  `sw` int(11) NOT NULL,
  PRIMARY KEY (`id_det_msr`)
) ENGINE=MyISAM AUTO_INCREMENT=522 DEFAULT CHARSET=utf8;
CREATE TABLE `estado_casos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `siniestros` varchar(20) NOT NULL,
  `estado` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=237 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `eventos_calendario_agendados` AS SELECT 
 1 AS `activityid`,
 1 AS `subject`,
 1 AS `activitytype`,
 1 AS `date_start`,
 1 AS `due_date`,
 1 AS `status`,
 1 AS `siniestro`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `latitud_sini`,
 1 AS `longitud_sini`,
 1 AS `nombrecliente`,
 1 AS `nrocaso`,
 1 AS `cliente`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `smcreatorid`,
 1 AS `smownerid`,
 1 AS `modifiedby`,
 1 AS `createdtime`,
 1 AS `modifiedtime`,
 1 AS `Creado_por`,
 1 AS `Asignado_a`,
 1 AS `Ultima_mod_por`,
 1 AS `Estado_caso`,
 1 AS `time_start`,
 1 AS `time_end`,
 1 AS `movil`,
 1 AS `email`,
 1 AS `captador`*/;
/*!50001 CREATE VIEW `facturados_suscripcion` AS SELECT 
 1 AS `id`,
 1 AS `Rut`,
 1 AS `Nombre_cliente`,
 1 AS `Siniestro`,
 1 AS `Estado`,
 1 AS `Valor_total`,
 1 AS `Creacion_sus`,
 1 AS `N_factura`,
 1 AS `Fecha_factura`,
 1 AS `Captador`,
 1 AS `Contrato_Firmado`,
 1 AS `id_relbase`,
 1 AS `estado_factura_sii`*/;
/*!50001 CREATE VIEW `facturas_report_clay_all` AS SELECT 
 1 AS `Modulo`,
 1 AS `Factura`*/;
CREATE TABLE `filtro` (
  `filtro_id` int(11) NOT NULL AUTO_INCREMENT,
  `filtro_arr` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`filtro_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `fintoc_conf` (
  `id_fc` int(11) NOT NULL AUTO_INCREMENT,
  `ap_Public_Key_fc` varchar(200) NOT NULL,
  `ap_Secret_Key_fc` varchar(200) NOT NULL,
  `Webhook_Endpoints_fc` varchar(200) NOT NULL,
  `modo_fc` int(11) NOT NULL,
  PRIMARY KEY (`id_fc`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `geo_all` AS SELECT 
 1 AS `id`,
 1 AS `latitude`,
 1 AS `longitude`,
 1 AS `Direccion`,
 1 AS `Ciudad`*/;
/*!50001 CREATE VIEW `grid_crmclay_rep20_1_co_dda` AS SELECT 
 1 AS `ncaso`,
 1 AS `Razon_Social_Suscripcion_DDA`,
 1 AS `RUT_Suscripcion_DDA`,
 1 AS `Nro_factura_suscripcion_DDA`,
 1 AS `Exento_suscripcion_DDA`,
 1 AS `Saldo_suscripcion_DDA`,
 1 AS `Abonado_suscripcion_DDA`,
 1 AS `Razon_Social_Cobranza`,
 1 AS `RUT_Cobranza`,
 1 AS `Nro_factura_cobranza`,
 1 AS `Exento_cobranza`,
 1 AS `Saldo_cobranza`,
 1 AS `Abonado_cobranza`,
 1 AS `Comparación_de_RUTs`,
 1 AS `contrato_firmado_SDDA`,
 1 AS `Fecha_Emision`,
 1 AS `Mes_Año`,
 1 AS `Emitida_Recibida`,
 1 AS `movil`,
 1 AS `movil_extra`,
 1 AS `email`,
 1 AS `dircliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `estado_`,
 1 AS `banco`,
 1 AS `ciaseguros`,
 1 AS `montopresupuesto`,
 1 AS `fsismo`,
 1 AS `tiposiniestro`,
 1 AS `tipopropiedad`,
 1 AS `ciudadcaso`,
 1 AS `comunacaso`,
 1 AS `direccionsiniestro`,
 1 AS `mts2`,
 1 AS `ContratoFirmadoTexto`,
 1 AS `MandatoFirmadoTexto`,
 1 AS `Total_Saldo`*/;
/*!50001 CREATE VIEW `grillacontratos` AS SELECT 
 1 AS `siniestro`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `cliente`,
 1 AS `calle_cliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `tlfparticular`,
 1 AS `movil`,
 1 AS `dia`,
 1 AS `mes`,
 1 AS `ano`,
 1 AS `email`,
 1 AS `tipo_propiedad`,
 1 AS `calle_caso`,
 1 AS `comuna_caso`,
 1 AS `provincia_caso`,
 1 AS `banco`,
 1 AS `tipo_siniestro`,
 1 AS `valor_total_del_servicio`,
 1 AS `abono`,
 1 AS `nro_de_cuotas`,
 1 AS `valor_de_cuotas`,
 1 AS `dias_pago`,
 1 AS `Estado_sms_mati`,
 1 AS `Estado_mati`,
 1 AS `Estado_sms_firma`,
 1 AS `Estado_Firma`,
 1 AS `fecha_contrato`,
 1 AS `captador`,
 1 AS `fcontratofirmado`*/;
/*!50001 CREATE VIEW `inf_suscripcionDDA` AS SELECT 
 1 AS `suscripciondemandaid`,
 1 AS `cliente`,
 1 AS `Nombre`,
 1 AS `estadocomercialdda`,
 1 AS `siniestro`,
 1 AS `valorplan`,
 1 AS `nrofactura`,
 1 AS `fechaemifact`,
 1 AS `facturasusddapagada`,
 1 AS `nrocuotas`,
 1 AS `valorcuotas`,
 1 AS `valorcuota1dda`,
 1 AS `cuotaunoddapagada`,
 1 AS `valorcuotadosdda`,
 1 AS `cuotadospagada`,
 1 AS `valorcuotatresdda`,
 1 AS `cuotatrespagada`*/;
/*!50001 CREATE VIEW `info_demandacomercial` AS SELECT 
 1 AS `Demandante`,
 1 AS `Rut`,
 1 AS `ddo`,
 1 AS `caratula`,
 1 AS `rol`,
 1 AS `estadodda`,
 1 AS `tribunal`,
 1 AS `abogadoasignado`,
 1 AS `mesasignacion`,
 1 AS `siniestro`,
 1 AS `suscripcionddaid`,
 1 AS `ventadedemandasid`*/;
CREATE TABLE `ingresos1_2019_grupo_santiago` (
  `id` varchar(50) NOT NULL,
  `ingresado` bit(1) NOT NULL DEFAULT b'0',
  `fecha_contrato` varchar(255) DEFAULT NULL,
  `dia` varchar(255) DEFAULT NULL,
  `mes` varchar(255) DEFAULT NULL,
  `ano` varchar(255) DEFAULT NULL,
  `nombres` varchar(255) DEFAULT NULL,
  `apellidos` varchar(255) DEFAULT NULL,
  `rut_cliente1` double DEFAULT NULL,
  `digito_verificador` varchar(255) DEFAULT NULL,
  `numero_de_serie` varchar(255) DEFAULT NULL,
  `estado_civil` varchar(255) DEFAULT NULL,
  `profesion` varchar(255) DEFAULT NULL,
  `nacionalidad` varchar(255) DEFAULT NULL,
  `email_contacto` varchar(255) DEFAULT NULL,
  `telefono_celular` varchar(255) DEFAULT NULL,
  `telefono_alternativo` varchar(255) DEFAULT NULL,
  `calle_cliente` varchar(255) DEFAULT NULL,
  `comuna_cliente` varchar(255) DEFAULT NULL,
  `provincia_cliente` varchar(255) DEFAULT NULL,
  `region_cliente` varchar(255) DEFAULT NULL,
  `calle_caso` varchar(255) DEFAULT NULL,
  `comuna_caso` varchar(255) DEFAULT NULL,
  `provincia_caso` varchar(255) DEFAULT NULL,
  `region_caso` varchar(255) DEFAULT NULL,
  `tipo_siniestro` varchar(255) DEFAULT NULL,
  `tipo_propiedad` varchar(255) DEFAULT NULL,
  `banco` varchar(255) DEFAULT NULL,
  `compania_seguros` varchar(255) DEFAULT NULL,
  `m2_aproximados` double DEFAULT NULL,
  `valor_uf_estimado` double DEFAULT NULL,
  `tipo_plan` varchar(255) DEFAULT NULL,
  `valor_total` varchar(255) DEFAULT NULL,
  `valor_cuota` varchar(255) DEFAULT NULL,
  `pago_total` varchar(255) DEFAULT NULL,
  `banco_cargo` varchar(255) DEFAULT NULL,
  `nro_de_cuenta` double DEFAULT NULL,
  `tipo_cuenta1` varchar(255) DEFAULT NULL,
  `sucursal` varchar(255) DEFAULT NULL,
  `dias_pago` varchar(255) DEFAULT NULL,
  `obs_de_operaciones` varchar(255) DEFAULT NULL,
  `ejecutivo` varchar(255) DEFAULT NULL,
  `email_del_ejecutivo` varchar(255) DEFAULT NULL,
  `celular_del_ejecutivo` varchar(255) DEFAULT NULL,
  `desde_donde_se_envio` varchar(255) DEFAULT NULL,
  `observaciones_para_coordinar_` varchar(255) DEFAULT NULL,
  `validado` varchar(255) DEFAULT NULL,
  `foto` varchar(255) DEFAULT NULL,
  `dias_de_pago1` varchar(255) DEFAULT NULL,
  `nro_de_cuotas` varchar(255) DEFAULT NULL,
  `valor_de_cuotas` varchar(255) DEFAULT NULL,
  `abono` varchar(255) DEFAULT NULL,
  `valor_total_del_servicio` varchar(255) DEFAULT NULL,
  `tipo_de_plan` varchar(255) DEFAULT NULL,
  `caso_con_gestion_previa` varchar(255) DEFAULT NULL,
  `asesorseguros` varchar(255) DEFAULT NULL,
  `Estado_sms_mati` int(11) NOT NULL DEFAULT '0',
  `Estado_mati` int(11) NOT NULL DEFAULT '0',
  `Estado_sms_firma` int(11) NOT NULL DEFAULT '0',
  `Estado_Firma` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `l_yf_profile` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `category` varchar(255) NOT NULL,
  `info` text,
  `log_time` varchar(20) NOT NULL,
  `trace` text,
  `level` varchar(255) DEFAULT NULL,
  `duration` decimal(3,3) NOT NULL,
  KEY `id` (`id`),
  KEY `category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_settings_tracker_basic` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `type` tinyint(1) NOT NULL,
  `action` varchar(50) NOT NULL,
  `record_id` int(10) DEFAULT NULL,
  `module_name` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33168 DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_settings_tracker_detail` (
  `id` int(10) unsigned NOT NULL,
  `prev_value` varchar(255) NOT NULL DEFAULT '',
  `post_value` varchar(255) NOT NULL DEFAULT '',
  `field` varchar(255) NOT NULL,
  KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_sqltime` (
  `id` int(10) NOT NULL,
  `type` varchar(20) DEFAULT NULL,
  `content` text,
  `date` datetime DEFAULT NULL,
  `qtime` decimal(20,3) DEFAULT NULL,
  `group` int(10) DEFAULT NULL,
  KEY `id` (`id`),
  KEY `type` (`type`),
  KEY `group` (`group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_switch_users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL,
  `status` varchar(10) NOT NULL,
  `baseid` int(10) NOT NULL,
  `destid` int(10) NOT NULL,
  `busername` varchar(50) NOT NULL,
  `dusername` varchar(50) NOT NULL,
  `ip` varchar(100) NOT NULL,
  `agent` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `baseid` (`baseid`),
  KEY `destid` (`destid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_username_history` (
  `user_name` varchar(32) DEFAULT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  KEY `user_id` (`user_id`),
  KEY `user_name` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `l_yf_userpass_history` (
  `pass` varchar(200) NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `date` datetime NOT NULL,
  KEY `user_id` (`user_id`,`pass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `leads_disponibles_2` (
  `id` varchar(30) NOT NULL,
  `created_time` varchar(30) NOT NULL,
  `ad_id` varchar(30) NOT NULL,
  `ad_name` varchar(30) NOT NULL,
  `adset_id` varchar(30) NOT NULL,
  `adset_name` varchar(30) NOT NULL,
  `campaign_id` varchar(80) NOT NULL,
  `campaign_name` varchar(90) NOT NULL,
  `form_id` varchar(30) NOT NULL,
  `form_name` varchar(30) NOT NULL,
  `platform` varchar(5) NOT NULL,
  `dividendo` varchar(5) NOT NULL,
  `comuna` varchar(30) NOT NULL,
  `full_name` varchar(80) NOT NULL,
  `telefono` varchar(30) NOT NULL,
  `email` varchar(100) NOT NULL,
  `dirtn` int(8) NOT NULL,
  `ID2` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`ID2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!50001 CREATE VIEW `lista_validados_mati` AS SELECT 
 1 AS `siniestro`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `cliente`,
 1 AS `calle_cliente`,
 1 AS `comunacliente`,
 1 AS `ciudadcliente`,
 1 AS `tlfparticular`,
 1 AS `movil`,
 1 AS `dia`,
 1 AS `mes`,
 1 AS `ano`,
 1 AS `email`,
 1 AS `tipo_propiedad`,
 1 AS `calle_caso`,
 1 AS `comuna_caso`,
 1 AS `provincia_caso`,
 1 AS `banco`,
 1 AS `tipo_siniestro`,
 1 AS `valor_total_del_servicio`,
 1 AS `abono`,
 1 AS `nro_de_cuotas`,
 1 AS `valor_de_cuotas`,
 1 AS `dias_pago`,
 1 AS `Estado_sms_mati`,
 1 AS `Estado_mati`,
 1 AS `Estado_sms_firma`,
 1 AS `Estado_Firma`,
 1 AS `fecha_contrato`,
 1 AS `captador`,
 1 AS `fcontratofirmado`,
 1 AS `estatus`*/;
CREATE TABLE `maestro_SimpliRute` (
  `id_m_sr` int(11) NOT NULL AUTO_INCREMENT,
  `Titulo` varchar(200) NOT NULL,
  `Direccion_completa` varchar(200) NOT NULL,
  `Carga` int(8) NOT NULL,
  `Hora_inicial` varchar(100) NOT NULL,
  `Hora_final` varchar(100) NOT NULL,
  `Tiempo_de_servicio` varchar(8) NOT NULL,
  `Notas` varchar(200) NOT NULL,
  `Latitud` varchar(200) NOT NULL,
  `Longitud` varchar(200) NOT NULL,
  `ID_de_referencia` varchar(200) NOT NULL,
  `Habilidades_requeridas` varchar(200) NOT NULL,
  `Habilidades_opcionales` varchar(200) NOT NULL,
  `Persona_de_contacto` varchar(200) NOT NULL,
  `Telefono_de_contacto` varchar(200) NOT NULL,
  `Hora_inicial_2` varchar(100) NOT NULL,
  `Hora_final_2` varchar(100) NOT NULL,
  `Carga_2` int(8) NOT NULL,
  `Carga_3` int(8) NOT NULL,
  `Prioridad` int(8) NOT NULL,
  `SMS` varchar(200) NOT NULL,
  `Correo_electronico_de_contacto` varchar(200) NOT NULL,
  `Carga_pick` int(8) NOT NULL,
  `Carga_pick_2` int(8) NOT NULL,
  `Carga_pick_3` int(8) NOT NULL,
  `Fecha_programada` varchar(200) NOT NULL,
  `Tipo_de_visita` varchar(200) NOT NULL,
  `Estado` int(8) NOT NULL DEFAULT '1',
  `Tipo_actividad` varchar(200) NOT NULL,
  PRIMARY KEY (`id_m_sr`)
) ENGINE=MyISAM AUTO_INCREMENT=522 DEFAULT CHARSET=utf8;
CREATE TABLE `maestro_realizado_fallido` (
  `id_mrf` int(11) NOT NULL,
  `id_sr` varchar(200) NOT NULL,
  `id_reference` varchar(200) NOT NULL,
  `estado` varchar(200) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `mai2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `resourse` varchar(200) NOT NULL,
  `estatus` varchar(50) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `actual` int(1) NOT NULL DEFAULT '0',
  `rut` varchar(11) NOT NULL,
  `qury` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
CREATE TABLE `mai2_clave_firma_contrato` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_mai` varchar(20) NOT NULL,
  `clave` varchar(7) NOT NULL,
  `fechahora` varchar(50) NOT NULL,
  `firma` varchar(1000) NOT NULL,
  `url` varchar(300) NOT NULL,
  `ip` varchar(15) NOT NULL,
  `CVU` varchar(100) NOT NULL,
  `urlPDF` varchar(100) NOT NULL,
  `firmaMandato` int(11) NOT NULL,
  `qr` varchar(1000) NOT NULL,
  `TIPO_CS` int(11) NOT NULL,
  `TIPO_VD` int(11) NOT NULL,
  `TIPO_TC` int(11) NOT NULL,
  `TIPO_DC` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13315 DEFAULT CHARSET=utf8;
CREATE TABLE `mai2_cont_sms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_mai2` varchar(20) NOT NULL,
  `cont` int(11) NOT NULL,
  `fechahora` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
CREATE TABLE `mai2_cont_sms_firma` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_mai2` varchar(20) NOT NULL,
  `fechahora` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cont` int(11) NOT NULL DEFAULT '1',
  `TIPO_CS` int(11) NOT NULL,
  `TIPO_VD` int(11) NOT NULL,
  `TIPO_TC` int(11) NOT NULL,
  `TIPO_DC` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13252 DEFAULT CHARSET=utf8;
CREATE TABLE `numeros_no_verificados` (
  `Contacto` varchar(100) NOT NULL,
  `Mail` varchar(200) NOT NULL,
  `Celular` varchar(100) NOT NULL,
  `Comuna` varchar(80) NOT NULL,
  `Verificar` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `numeros_verificados` (
  `Contacto` varchar(100) NOT NULL,
  `Mail` varchar(200) NOT NULL,
  `Celular` varchar(100) NOT NULL,
  `Comuna` varchar(80) NOT NULL,
  `Verificar` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `o_yf_access_for_admin` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  `ip` varchar(100) NOT NULL,
  `module` varchar(30) NOT NULL,
  `url` varchar(300) NOT NULL,
  `agent` varchar(255) NOT NULL,
  `request` varchar(300) NOT NULL,
  `referer` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
CREATE TABLE `o_yf_access_for_api` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  `ip` varchar(100) NOT NULL,
  `url` varchar(300) NOT NULL,
  `agent` varchar(255) NOT NULL,
  `request` varchar(300) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
CREATE TABLE `o_yf_access_for_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  `ip` varchar(100) DEFAULT NULL,
  `module` varchar(30) NOT NULL,
  `url` varchar(300) NOT NULL,
  `agent` varchar(255) DEFAULT NULL,
  `request` varchar(300) NOT NULL,
  `referer` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=724368 DEFAULT CHARSET=utf8;
CREATE TABLE `o_yf_access_to_record` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  `ip` varchar(100) NOT NULL,
  `record` int(10) NOT NULL,
  `module` varchar(30) NOT NULL,
  `url` varchar(300) NOT NULL,
  `agent` varchar(255) NOT NULL,
  `request` varchar(300) NOT NULL,
  `referer` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25913 DEFAULT CHARSET=utf8;
CREATE TABLE `o_yf_csrf` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `date` datetime NOT NULL,
  `ip` varchar(100) NOT NULL,
  `referer` varchar(300) NOT NULL,
  `url` varchar(300) NOT NULL,
  `agent` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `pagos_ASL` AS SELECT 
 1 AS `id`,
 1 AS `idsiniestro`,
 1 AS `estadocobranza`,
 1 AS `estadocomercialdda`,
 1 AS `montorecuperarclp`,
 1 AS `porcentajeapagar`,
 1 AS `fono`,
 1 AS `correo`,
 1 AS `estadollamada`,
 1 AS `Nombre`,
 1 AS `actualizar`,
 1 AS `fechadenuncia`,
 1 AS `clienteid`,
 1 AS `siniestro`,
 1 AS `user_name`,
 1 AS `contratofirmado`,
 1 AS `creadaaslegal`,
 1 AS `planaslegal`,
 1 AS `nrofactura`,
 1 AS `nrocuotas`,
 1 AS `cuotaunoddapagada`,
 1 AS `fechacuotaunopagada`,
 1 AS `fechavencimientocuotauno`,
 1 AS `cuotadospagada`,
 1 AS `fechacuotadospagada`,
 1 AS `fechavencimientocuotados`,
 1 AS `cuotatrespagada`,
 1 AS `fechacuotatrespagada`,
 1 AS `fechavencimientocuotatres`,
 1 AS `valorcuota1dda`,
 1 AS `valorcuotadosdda`,
 1 AS `valorcuotatresdda`,
 1 AS `cliente`,
 1 AS `fechaemifact`*/;
CREATE TABLE `pagos_archivos` (
  `id_pagos` int(11) NOT NULL AUTO_INCREMENT,
  `id_suscripcion` int(11) NOT NULL,
  `rut_dep` varchar(13) DEFAULT NULL,
  `nombre_dep` varchar(100) DEFAULT NULL,
  `id_medio_dep` int(11) NOT NULL DEFAULT '0',
  `ruta_archiv` varchar(300) NOT NULL,
  `carga` int(11) NOT NULL,
  `revisado` int(11) NOT NULL DEFAULT '0',
  `abono` int(15) NOT NULL DEFAULT '0',
  `fech_abono` date DEFAULT NULL,
  `abonopagado` int(11) NOT NULL,
  `clay_abono` int(11) NOT NULL,
  `vcuota1` int(15) NOT NULL DEFAULT '0',
  `vcuota2` int(15) NOT NULL DEFAULT '0',
  `1cuota` int(11) NOT NULL DEFAULT '0',
  `2cuota` int(11) NOT NULL DEFAULT '0',
  `clay1` int(11) NOT NULL,
  `clay2` int(11) NOT NULL,
  `fech_cuota1` date DEFAULT NULL,
  `fech_cuota2` date DEFAULT NULL,
  `fecha_pago` date DEFAULT NULL,
  `bancopago` int(11) DEFAULT '0',
  `n_cuota` int(11) NOT NULL,
  `estado` int(11) NOT NULL DEFAULT '0',
  `estado_wf` int(11) NOT NULL DEFAULT '0',
  `estado_rev` int(11) NOT NULL DEFAULT '0',
  `Observacion` varchar(1000) NOT NULL,
  PRIMARY KEY (`id_pagos`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
CREATE TABLE `pagos_archivos_conf` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `conf` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
CREATE TABLE `pagos_archivos_demadas` (
  `id_pagos` int(11) NOT NULL AUTO_INCREMENT,
  `id_demanda` int(11) NOT NULL,
  `rut_dep` varchar(13) DEFAULT NULL,
  `nombre_dep` varchar(100) DEFAULT NULL,
  `id_medio_dep` int(11) NOT NULL DEFAULT '0',
  `ruta_archiv` varchar(300) NOT NULL,
  `carga` int(11) NOT NULL,
  `revisado` int(11) NOT NULL DEFAULT '0',
  `abono` int(15) NOT NULL DEFAULT '0',
  `fech_abono` date DEFAULT NULL,
  `abonopagado` int(11) NOT NULL,
  `clay_abono` int(11) NOT NULL,
  `vcuota1` int(15) NOT NULL DEFAULT '0',
  `vcuota2` int(15) NOT NULL DEFAULT '0',
  `vcuota3` int(11) NOT NULL,
  `1cuota` int(11) NOT NULL DEFAULT '0',
  `2cuota` int(11) NOT NULL DEFAULT '0',
  `3cuota` int(11) NOT NULL,
  `clay1` int(11) NOT NULL,
  `clay2` int(11) NOT NULL,
  `clay3` int(11) NOT NULL,
  `fech_cuota1` date DEFAULT NULL,
  `fech_cuota2` date DEFAULT NULL,
  `fech_cuota3` int(11) NOT NULL,
  `fecha_pago` date DEFAULT NULL,
  `bancopago` int(11) DEFAULT '0',
  `n_cuota` int(11) NOT NULL,
  `estado` int(11) NOT NULL DEFAULT '0',
  `estado_wf` int(11) NOT NULL DEFAULT '0',
  `estado_rev` int(11) NOT NULL DEFAULT '0',
  `Observacion` varchar(1000) NOT NULL,
  PRIMARY KEY (`id_pagos`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
CREATE TABLE `par_plan_crm_rbase` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_plan_relBase` int(11) NOT NULL,
  `id_plan_CRM` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `por_prcesar_dc` AS SELECT 
 1 AS `ID_CASO`,
 1 AS `ID_CLIENTE`,
 1 AS `NRO_CASO`,
 1 AS `NOMBRE`,
 1 AS `RUT`,
 1 AS `EMAIL`,
 1 AS `ENT_LIQUIDADORA`,
 1 AS `CIA_DE_SEGUROS`,
 1 AS `MOVIL`,
 1 AS `ID_DC`,
 1 AS `DC_FIRMADO`,
 1 AS `deleted`*/;
/*!50001 CREATE VIEW `porsuscribir_all` AS SELECT 
 1 AS `Clinete`,
 1 AS `Rut`,
 1 AS `Captador`,
 1 AS `Suscripcion_sini_VGTE`,
 1 AS `Clinete_id`,
 1 AS `Fecha_Factura`,
 1 AS `telefono`,
 1 AS `email`,
 1 AS `usercrm`,
 1 AS `status_sus`*/;
/*!50001 CREATE VIEW `porsuscrinir_all_2` AS SELECT 
 1 AS `Clinete`,
 1 AS `Rut`,
 1 AS `Captador`,
 1 AS `Suscripcion_sini_VGTE`,
 1 AS `Clinete_id`,
 1 AS `Fecha_Factura`,
 1 AS `telefono`,
 1 AS `email`,
 1 AS `usercrm`,
 1 AS `status_sus`,
 1 AS `Ncaso`,
 1 AS `estado_caso`*/;
CREATE TABLE `pruebareg` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ok` varchar(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `reasignar_masivo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ncaso` varchar(100) NOT NULL,
  `user` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=119 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `rep_audi` AS SELECT 
 1 AS `siniestro`,
 1 AS `nrofactura`,
 1 AS `direccionsiniestro`,
 1 AS `comunacaso`,
 1 AS `valortotal`,
 1 AS `clienteid`,
 1 AS `fpagoabono`,
 1 AS `valorcuota`,
 1 AS `abono`,
 1 AS `primeracuota`,
 1 AS `segundacuota`,
 1 AS `1cuotapagada`,
 1 AS `2cuotapagada`,
 1 AS `nrocuotas`,
 1 AS `suscripcionid`,
 1 AS `number`,
 1 AS `captador`,
 1 AS `nombre`,
 1 AS `apellido`,
 1 AS `diaspago`,
 1 AS `facturapagada`,
 1 AS `ven1cuota`,
 1 AS `ffactura`,
 1 AS `ffacturapagada`,
 1 AS `abonopagado`,
 1 AS `matclayabo`,
 1 AS `codwebpayabono`,
 1 AS `fechadelabono`,
 1 AS `tpagoabono`,
 1 AS `banco`,
 1 AS `nrocuenta`,
 1 AS `tipocuenta`,
 1 AS `sucursal`,
 1 AS `tpago1cuota`,
 1 AS `fven1`,
 1 AS `f1cuotapagada`,
 1 AS `bdpago1cuota`,
 1 AS `tpago2cuota`,
 1 AS `fven2`,
 1 AS `f2cuotapagada`,
 1 AS `bdpago2cuota`,
 1 AS `bdpago`,
 1 AS `codwebpaycuota1`,
 1 AS `codwebpaycuota2`,
 1 AS `tarjpagoabono`,
 1 AS `tarjpagocuota1`,
 1 AS `tarjpagocuota2`,
 1 AS `matclayuno`,
 1 AS `matchclaydos`*/;
CREATE TABLE `rep_fecha_fact_masivo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nro_factura` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `rep_vista_1_asl` AS SELECT 
 1 AS `Nro_caso`,
 1 AS `Fecha_caso`,
 1 AS `Fecha_visita_caso`,
 1 AS `Fecha_denuncio_caso`,
 1 AS `Monto_Indemnizacion_caso`,
 1 AS `Estado_caso`,
 1 AS `Fecha_creasion_caso`,
 1 AS `Nro_factura_cobranza`,
 1 AS `Valor_factura_cobranza`,
 1 AS `Fecha_factura_cobranza`,
 1 AS `Factura_pagada_cobranza`,
 1 AS `Fecha_pago_factura_cobranza`,
 1 AS `Banco_pago_cobranza`,
 1 AS `Tipo_pago_cobranza`,
 1 AS `Estado_cobranza`,
 1 AS `Estado_suscripcion_siniestro`,
 1 AS `Valor_total_suscripcion`,
 1 AS `Nro_cuotas_suscripcion`,
 1 AS `Nro_factura_suscripcion`,
 1 AS `Fecha_factura_suscripcion`,
 1 AS `Abono_pagado_suscripcion`,
 1 AS `Cuota1_pagada_suscripcion`,
 1 AS `Cuota2_pagada_suscripcion`,
 1 AS `Rut_cliente`,
 1 AS `Nombre_cliente`,
 1 AS `Apellido_cliente`,
 1 AS `Movil_cliente`,
 1 AS `Movil_extra_cliente`,
 1 AS `Email_cliente`,
 1 AS `Comuna_cliente`,
 1 AS `idsini`*/;
/*!50001 CREATE VIEW `rep_vista_2_asl` AS SELECT 
 1 AS `Nro_caso`,
 1 AS `Fecha_caso`,
 1 AS `Fecha_visita_caso`,
 1 AS `Fecha_denuncio_caso`,
 1 AS `Monto_Indemnizacion_caso`,
 1 AS `Estado_caso`,
 1 AS `Fecha_creasion_caso`,
 1 AS `Nro_factura_cobranza`,
 1 AS `Valor_factura_cobranza`,
 1 AS `Fecha_factura_cobranza`,
 1 AS `Factura_pagada_cobranza`,
 1 AS `Fecha_pago_factura_cobranza`,
 1 AS `Banco_pago_cobranza`,
 1 AS `Tipo_pago_cobranza`,
 1 AS `Estado_cobranza`,
 1 AS `Estado_suscripcion_siniestro`,
 1 AS `Valor_total_suscripcion`,
 1 AS `Nro_cuotas_suscripcion`,
 1 AS `Nro_factura_suscripcion`,
 1 AS `Fecha_factura_suscripcion`,
 1 AS `Abono_pagado_suscripcion`,
 1 AS `Cuota1_pagada_suscripcion`,
 1 AS `Cuota2_pagada_suscripcion`,
 1 AS `Rut_cliente`,
 1 AS `Nombre_cliente`,
 1 AS `Apellido_cliente`,
 1 AS `Movil_cliente`,
 1 AS `Movil_extra_cliente`,
 1 AS `Email_cliente`,
 1 AS `Comuna_cliente`,
 1 AS `idsini`*/;
/*!50001 CREATE VIEW `rep_vista_3_asl` AS SELECT 
 1 AS `Nro_caso`,
 1 AS `Fecha_caso`,
 1 AS `Fecha_visita_caso`,
 1 AS `Fecha_denuncio_caso`,
 1 AS `Monto_Indemnizacion_caso`,
 1 AS `Estado_caso`,
 1 AS `Fecha_creasion_caso`,
 1 AS `Nro_factura_cobranza`,
 1 AS `Valor_factura_cobranza`,
 1 AS `Fecha_factura_cobranza`,
 1 AS `Factura_pagada_cobranza`,
 1 AS `Fecha_pago_factura_cobranza`,
 1 AS `Banco_pago_cobranza`,
 1 AS `Tipo_pago_cobranza`,
 1 AS `Estado_cobranza`,
 1 AS `Estado_suscripcion_siniestro`,
 1 AS `Valor_total_suscripcion`,
 1 AS `Nro_cuotas_suscripcion`,
 1 AS `Nro_factura_suscripcion`,
 1 AS `Fecha_factura_suscripcion`,
 1 AS `Abono_pagado_suscripcion`,
 1 AS `Cuota1_pagada_suscripcion`,
 1 AS `Cuota2_pagada_suscripcion`,
 1 AS `Rut_cliente`,
 1 AS `Nombre_cliente`,
 1 AS `Apellido_cliente`,
 1 AS `Movil_cliente`,
 1 AS `Movil_extra_cliente`,
 1 AS `Email_cliente`,
 1 AS `Comuna_cliente`,
 1 AS `idsini`,
 1 AS `Pérdida_Reclamada_UF`,
 1 AS `Pérdida_Determinada_UF`,
 1 AS `Deducible_Afecto`,
 1 AS `Pérdida_Indemnizable`,
 1 AS `Indemnización_Pesos`,
 1 AS `Valor_UF`,
 1 AS `Perdida_Recuperable_UF`,
 1 AS `Perdida_Recuperable_Pesos`,
 1 AS `Informe_Facturado`,
 1 AS `Observaciones`,
 1 AS `Fecha_Probable_de_pago`,
 1 AS `Gestión`,
 1 AS `Tipo`*/;
/*!50001 CREATE VIEW `rep_vista_4_150000_asl` AS SELECT 
 1 AS `planaslegal`,
 1 AS `Nro_Caso`,
 1 AS `Fecha_Creasion_Caso`,
 1 AS `Estado_Caso`,
 1 AS `Pérdida_Reclamada_UF`,
 1 AS `Pérdida_Determinada_UF`,
 1 AS `Deducible_Afecto`,
 1 AS `Pérdida_Indemnizable`,
 1 AS `Indemnización_Pesos`,
 1 AS `Valor_UF`,
 1 AS `Perdida_Recuperable_UF`,
 1 AS `Perdida_Recuperable_Pesos`,
 1 AS `Informe_Facturado`,
 1 AS `Observaciones`,
 1 AS `Fecha_Probable_de_pago`,
 1 AS `Rut_Cliente`,
 1 AS `Nombre_Clinete`,
 1 AS `Apellido_cliente`,
 1 AS `Movil_Cliente`,
 1 AS `Movil_Extra_Cliente`,
 1 AS `email`,
 1 AS `Comuna_Cliente`,
 1 AS `Tipo`,
 1 AS `Gestion`*/;
/*!50001 CREATE VIEW `report` AS SELECT 
 1 AS `siniestro`,
 1 AS `nrofactura`,
 1 AS `direccionsiniestro`,
 1 AS `comunacaso`,
 1 AS `valortotal`,
 1 AS `clienteid`,
 1 AS `fpagoabono`,
 1 AS `valorcuota`,
 1 AS `abono`,
 1 AS `primeracuota`,
 1 AS `segundacuota`,
 1 AS `1cuotapagada`,
 1 AS `2cuotapagada`,
 1 AS `nrocuotas`,
 1 AS `suscripcionid`*/;
CREATE TABLE `reporte_moonflow_client_endpoint` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `documentTypeId` int(6) NOT NULL,
  `documentNumber` varchar(20) NOT NULL,
  `name` varchar(50) NOT NULL,
  `lastName` varchar(50) NOT NULL,
  `genero` varchar(4) NOT NULL,
  `cellphone1` int(16) NOT NULL,
  `cellphone2` int(16) NOT NULL,
  `email1` varchar(80) NOT NULL,
  `email2` varchar(80) NOT NULL,
  `externalClientId` varchar(20) NOT NULL,
  `indicador_dia` tinyint(4) NOT NULL,
  `prop_pago` tinyint(4) NOT NULL,
  `lastPaymentStatus` varchar(8) NOT NULL,
  `registerDate` datetime NOT NULL,
  `field1` varchar(25) NOT NULL,
  `field2` varchar(25) NOT NULL,
  `field3` varchar(25) NOT NULL,
  `field4` varchar(25) NOT NULL,
  `field5` varchar(25) NOT NULL,
  `field6` varchar(25) NOT NULL,
  `field7` varchar(25) NOT NULL,
  `field8` varchar(25) NOT NULL,
  `field9` varchar(25) NOT NULL,
  `field10` varchar(25) NOT NULL,
  `asesor_id` int(8) NOT NULL,
  `deleted` int(8) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2129 DEFAULT CHARSET=utf8;
CREATE TABLE `rev_casos_simplerute` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_referencia` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `rev_clay_pagos_comision` AS SELECT 
 1 AS `Nro_de_Caso_Caso_de_Siniestro`,
 1 AS `Nombre_del_Cliente_Caso_de_Siniestro`,
 1 AS `Valor_del_Plan_Suscripción`,
 1 AS `Captador_Caso_de_Siniestro`,
 1 AS `Fecha_de_creación_Caso_de_Siniestro`,
 1 AS `Tipo_de_Siniestro_Caso_de_Siniestro`,
 1 AS `Contrato_Firmado_Caso_de_Siniestro`,
 1 AS `Abono_Pagado_Suscripción`,
 1 AS `Fecha_de_Pago_Abono_Suscripción`,
 1 AS `Nro_de_Factura_Suscripción`,
 1 AS `Valor_del_Plan_Caso_de_Siniestro`,
 1 AS `Comisión_Pagada_Caso_de_Siniestro`,
 1 AS `Fecha_Pago_Comisión_Caso_de_Siniestro`,
 1 AS `Ciudad_(Siniestro)_Caso_de_Siniestro`,
 1 AS `Total`,
 1 AS `Saldo`,
 1 AS `fcontratofirmado`,
 1 AS `contratofirmado2`,
 1 AS `fpagoabono`,
 1 AS `abonopagado`*/;
CREATE TABLE `rev_ugr` (
  `id` int(11) NOT NULL,
  `rut` varchar(100) NOT NULL,
  `nombre` varchar(100) NOT NULL,
  `movil` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `descrip` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `revcasos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `caso` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `revision_visitas_simpirute` AS SELECT 
 1 AS `siniestro`,
 1 AS `estado_`,
 1 AS `confirmapreinspeccion`,
 1 AS `confirmainspeccion`,
 1 AS `id_sr`,
 1 AS `Nombre_plan_dms`,
 1 AS `start_date_dms`*/;
CREATE TABLE `roundcube_cache` (
  `user_id` int(10) unsigned NOT NULL,
  `cache_key` varchar(128) CHARACTER SET ascii NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  KEY `expires_index` (`expires`),
  KEY `user_cache_index` (`user_id`,`cache_key`),
  CONSTRAINT `roundcube_user_id_fk_cache` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_cache_index` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `valid` tinyint(1) NOT NULL DEFAULT '0',
  `data` longtext NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_index` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_cache_messages` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `uid` int(10) unsigned NOT NULL DEFAULT '0',
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  `flags` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`mailbox`,`uid`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_messages` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_cache_shared` (
  `cache_key` varchar(255) CHARACTER SET ascii NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  KEY `expires_index` (`expires`),
  KEY `cache_key_index` (`cache_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_cache_thread` (
  `user_id` int(10) unsigned NOT NULL,
  `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `expires` datetime DEFAULT NULL,
  `data` longtext NOT NULL,
  PRIMARY KEY (`user_id`,`mailbox`),
  KEY `expires_index` (`expires`),
  CONSTRAINT `roundcube_user_id_fk_cache_thread` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_contactgroupmembers` (
  `contactgroup_id` int(10) unsigned NOT NULL,
  `contact_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  PRIMARY KEY (`contactgroup_id`,`contact_id`),
  KEY `roundcube_contactgroupmembers_contact_index` (`contact_id`),
  CONSTRAINT `roundcube_contact_id_fk_contacts` FOREIGN KEY (`contact_id`) REFERENCES `roundcube_contacts` (`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `roundcube_contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`) REFERENCES `roundcube_contactgroups` (`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_contactgroups` (
  `contactgroup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`contactgroup_id`),
  KEY `roundcube_contactgroups_user_index` (`user_id`,`del`),
  CONSTRAINT `roundcube_user_id_fk_contactgroups` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_contacts` (
  `contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL DEFAULT '',
  `email` text NOT NULL,
  `firstname` varchar(128) NOT NULL DEFAULT '',
  `surname` varchar(128) NOT NULL DEFAULT '',
  `vcard` longtext,
  `words` text,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`contact_id`),
  KEY `roundcube_user_contacts_index` (`user_id`,`del`),
  CONSTRAINT `roundcube_user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_dictionary` (
  `user_id` int(10) unsigned DEFAULT NULL,
  `language` varchar(5) NOT NULL,
  `data` longtext NOT NULL,
  UNIQUE KEY `uniqueness` (`user_id`,`language`),
  CONSTRAINT `roundcube_user_id_fk_dictionary` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_identities` (
  `identity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `del` tinyint(1) NOT NULL DEFAULT '0',
  `standard` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `organization` varchar(128) NOT NULL DEFAULT '',
  `email` varchar(128) NOT NULL,
  `reply-to` varchar(128) NOT NULL DEFAULT '',
  `bcc` varchar(128) NOT NULL DEFAULT '',
  `signature` longtext,
  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`identity_id`),
  KEY `user_identities_index` (`user_id`,`del`),
  KEY `email_identities_index` (`email`,`del`),
  CONSTRAINT `roundcube_user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_searches` (
  `search_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `type` int(3) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `data` text,
  PRIMARY KEY (`search_id`),
  UNIQUE KEY `uniqueness` (`user_id`,`type`,`name`),
  CONSTRAINT `roundcube_user_id_fk_searches` FOREIGN KEY (`user_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_session` (
  `sess_id` varchar(128) NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `ip` varchar(40) NOT NULL,
  `vars` mediumtext NOT NULL,
  PRIMARY KEY (`sess_id`),
  KEY `changed_index` (`changed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_system` (
  `name` varchar(64) NOT NULL,
  `value` mediumtext,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_users` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `mail_host` varchar(128) NOT NULL,
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  `last_login` datetime DEFAULT NULL,
  `failed_login` datetime DEFAULT NULL,
  `failed_login_counter` int(10) unsigned DEFAULT NULL,
  `language` varchar(5) DEFAULT NULL,
  `preferences` longtext,
  `actions` text,
  `password` varchar(200) DEFAULT NULL,
  `crm_user_id` int(10) DEFAULT '0',
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `username` (`username`,`mail_host`),
  KEY `crm_user_id` (`crm_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roundcube_users_autologin` (
  `rcuser_id` int(10) unsigned NOT NULL,
  `crmuser_id` int(10) NOT NULL,
  KEY `rcuser_id` (`rcuser_id`),
  CONSTRAINT `roundcube_users_autologin_ibfk_1` FOREIGN KEY (`rcuser_id`) REFERENCES `roundcube_users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_automatic_assignment` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) unsigned NOT NULL,
  `field` varchar(30) NOT NULL,
  `value` varchar(255) DEFAULT NULL,
  `roles` text,
  `smowners` text,
  `assign` smallint(5) DEFAULT NULL,
  `active` tinyint(1) DEFAULT '1',
  `conditions` text,
  `user_limit` tinyint(1) DEFAULT NULL,
  `roleid` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_companies` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `short_name` varchar(100) DEFAULT NULL,
  `default` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `industry` varchar(50) DEFAULT NULL,
  `street` varchar(150) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `code` varchar(30) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `fax` varchar(30) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `vatid` varchar(50) DEFAULT NULL,
  `id1` varchar(50) DEFAULT NULL,
  `id2` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `logo_login` varchar(50) DEFAULT NULL,
  `logo_login_height` tinyint(3) unsigned DEFAULT NULL,
  `logo_main` varchar(50) DEFAULT NULL,
  `logo_main_height` tinyint(3) unsigned DEFAULT NULL,
  `logo_mail` varchar(50) DEFAULT NULL,
  `logo_mail_height` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_handler_updater` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `tabid` smallint(5) unsigned NOT NULL,
  `crmid` int(10) unsigned NOT NULL,
  `userid` int(10) unsigned NOT NULL,
  `handler_name` varchar(50) NOT NULL,
  `class` varchar(50) NOT NULL,
  `params` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_mail_queue` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `smtp_id` int(10) unsigned NOT NULL DEFAULT '1',
  `date` datetime NOT NULL,
  `owner` int(10) NOT NULL,
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `from` text,
  `subject` text,
  `to` text,
  `content` mediumtext,
  `cc` text,
  `bcc` text,
  `attachments` text,
  `priority` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `smtp_id` (`smtp_id`),
  CONSTRAINT `s_yf_mail_queue_ibfk_1` FOREIGN KEY (`smtp_id`) REFERENCES `s_yf_mail_smtp` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=11910 DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_mail_relation_updater` (
  `tabid` smallint(5) unsigned NOT NULL,
  `crmid` int(10) unsigned NOT NULL,
  KEY `tabid` (`tabid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_mail_smtp` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mailer_type` varchar(10) DEFAULT 'smtp',
  `default` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL,
  `host` varchar(255) NOT NULL,
  `port` smallint(5) unsigned DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `authentication` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `secure` varchar(10) DEFAULT NULL,
  `options` text,
  `from_email` varchar(255) DEFAULT NULL,
  `from_name` varchar(255) DEFAULT NULL,
  `reply_to` varchar(255) DEFAULT NULL,
  `individual_delivery` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `params` text,
  `save_send_mail` tinyint(1) DEFAULT '0',
  `smtp_host` varchar(255) DEFAULT NULL,
  `smtp_port` smallint(5) DEFAULT NULL,
  `smtp_username` varchar(255) DEFAULT NULL,
  `smtp_password` varchar(255) DEFAULT NULL,
  `smtp_folder` varchar(50) DEFAULT NULL,
  `smtp_validate_cert` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_multireference` (
  `source_module` varchar(50) NOT NULL,
  `dest_module` varchar(50) NOT NULL,
  `lastid` int(10) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(1) NOT NULL DEFAULT '0',
  KEY `source_module` (`source_module`,`dest_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_pbx` (
  `pbxid` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `default` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `name` varchar(50) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `param` text,
  PRIMARY KEY (`pbxid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_privileges_updater` (
  `module` varchar(30) NOT NULL DEFAULT '',
  `crmid` int(10) NOT NULL DEFAULT '0',
  `priority` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(1) NOT NULL DEFAULT '0',
  UNIQUE KEY `module` (`module`,`crmid`,`type`),
  KEY `crmid` (`crmid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s_yf_smsnotifier_queue` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `message` varchar(255) NOT NULL,
  `tonumbers` text NOT NULL,
  `records` text NOT NULL,
  `module` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `sc_log` (
  `id` int(8) NOT NULL AUTO_INCREMENT,
  `inserted_date` datetime DEFAULT NULL,
  `username` varchar(90) NOT NULL,
  `application` varchar(255) NOT NULL,
  `creator` varchar(30) NOT NULL,
  `ip_user` varchar(255) NOT NULL,
  `action` varchar(30) NOT NULL,
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4421 DEFAULT CHARSET=utf8;
CREATE TABLE `sec_apps` (
  `app_name` varchar(128) NOT NULL,
  `app_type` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`app_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `sec_groups` (
  `group_id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`group_id`),
  UNIQUE KEY `description` (`description`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `sec_groups_apps` (
  `group_id` int(11) NOT NULL,
  `app_name` varchar(128) NOT NULL,
  `priv_access` varchar(1) DEFAULT NULL,
  `priv_insert` varchar(1) DEFAULT NULL,
  `priv_delete` varchar(1) DEFAULT NULL,
  `priv_update` varchar(1) DEFAULT NULL,
  `priv_export` varchar(1) DEFAULT NULL,
  `priv_print` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`group_id`,`app_name`),
  KEY `sec_groups_apps_ibfk_2` (`app_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `sec_settings` (
  `set_name` varchar(255) NOT NULL,
  `set_value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`set_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `sec_users` (
  `login` varchar(255) NOT NULL,
  `pswd` varchar(255) NOT NULL,
  `name` varchar(64) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `active` varchar(1) DEFAULT NULL,
  `activation_code` varchar(32) DEFAULT NULL,
  `priv_admin` varchar(1) DEFAULT NULL,
  `mfa` varchar(255) DEFAULT NULL,
  `picture` longblob,
  PRIMARY KEY (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `sec_users_groups` (
  `login` varchar(255) NOT NULL,
  `group_id` int(11) NOT NULL,
  PRIMARY KEY (`login`,`group_id`),
  KEY `sec_users_groups_ibfk_2` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `siniestro_cd` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sini` varchar(20) NOT NULL,
  `dedu` varchar(20) NOT NULL,
  `cober` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=226 DEFAULT CHARSET=utf8;
CREATE TABLE `subir_dda` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `caratula` varchar(100) NOT NULL,
  `siniestro` varchar(100) NOT NULL,
  `rutcomp` varchar(100) NOT NULL,
  `ddo` varchar(100) NOT NULL,
  `estadodda` varchar(100) NOT NULL,
  `tribunalradica` varchar(100) NOT NULL,
  `rol` varchar(100) NOT NULL,
  `rut` varchar(100) NOT NULL,
  `demandadoid` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=51 DEFAULT CHARSET=utf8;
CREATE TABLE `subir_dda_up_estado` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `siniestro` varchar(100) NOT NULL,
  `estadodda` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=51 DEFAULT CHARSET=utf8;
CREATE TABLE `subircasosVD` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sini` varchar(100) NOT NULL,
  `id_user` varchar(100) NOT NULL,
  `est` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=177 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `sus_pac2` AS SELECT 
 1 AS `Id_siniestro`,
 1 AS `Id_suscripcion`,
 1 AS `Rut_Cliente`,
 1 AS `Nro_Caso`,
 1 AS `Estado`,
 1 AS `Monto_del_Presupuesto`,
 1 AS `Valor_Cuota`,
 1 AS `Dias_de_Pago`,
 1 AS `Nro_Cuotas`,
 1 AS `Valor_Abono`,
 1 AS `Fecha_Ven_Abono`,
 1 AS `Fecha_Cargo_Pac_Abono`,
 1 AS `Fecha_Transfer_abono_Fintoc`,
 1 AS `Abono_pagado`,
 1 AS `Valor_Cuota_1`,
 1 AS `Fecha_Ven_Cuota_1`,
 1 AS `Fecha_Cargo_Pac_Cuota_1`,
 1 AS `Fecha_Transfer_Cuota_1_Fintoc`,
 1 AS `Cuota_1_Pagada`,
 1 AS `Valor_Cuota_2`,
 1 AS `Fecha_Ven_Cuota_2`,
 1 AS `Fecha_Cargo_Pac_Cuota_2`,
 1 AS `Fecha_Transfer_Cuota_2_Fintoc`,
 1 AS `Cuota_2_Pagada`,
 1 AS `Nro_Factura_Suscripcion`,
 1 AS `Fecha_Factura_Suscripcion`,
 1 AS `Nombre_Cliente`,
 1 AS `Valor_plan`,
 1 AS `Id_cliente`,
 1 AS `estado_sus`,
 1 AS `estadopac`*/;
/*!50001 CREATE VIEW `suscripcionPac_ventademanda` AS SELECT 
 1 AS `Cliente`,
 1 AS `Rut`,
 1 AS `Telefono`,
 1 AS `Email`,
 1 AS `Captador`,
 1 AS `user_ame`,
 1 AS `fechaemifact`,
 1 AS `status_sus`*/;
CREATE TABLE `tabla_comunas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `comunas` varchar(255) DEFAULT NULL,
  `provincias` varchar(255) DEFAULT NULL,
  `regiones` varchar(255) DEFAULT NULL,
  `CIUDAD` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=347 DEFAULT CHARSET=latin1;
CREATE TABLE `table_numeros_porverificar` (
  `Contacto` varchar(100) NOT NULL,
  `Mail` varchar(200) NOT NULL,
  `Celular` varchar(100) NOT NULL,
  `Comuna` varchar(80) NOT NULL,
  `Verificar` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `telefonos_noexistentes` (
  `id` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `numero_telefono` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=742 DEFAULT CHARSET=utf8;
CREATE TABLE `tipo_contrato` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `TIPO` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!50001 CREATE VIEW `toku_monflow_multiselect` AS SELECT 
 1 AS `id`,
 1 AS `user_name`,
 1 AS `Vendedor`,
 1 AS `Rut`,
 1 AS `Nombre`,
 1 AS `nro_caso`,
 1 AS `nro_cuotas`,
 1 AS `movil`,
 1 AS `email`,
 1 AS `plan`*/;
CREATE TABLE `transfer_geo_crm` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ncaso` varchar(100) NOT NULL,
  `latit` varchar(100) NOT NULL,
  `longi` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=226 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_activity_invitation` (
  `inviteesid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `activityid` int(10) NOT NULL,
  `crmid` int(10) NOT NULL DEFAULT '0',
  `email` varchar(100) NOT NULL DEFAULT '',
  `status` tinyint(1) DEFAULT '0',
  `time` datetime DEFAULT NULL,
  PRIMARY KEY (`inviteesid`),
  KEY `activityid` (`activityid`),
  CONSTRAINT `u_yf_activity_invitation_ibfk_1` FOREIGN KEY (`activityid`) REFERENCES `vtiger_activity` (`activityid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_announcement` (
  `announcementid` int(10) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `announcement_no` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `announcementstatus` varchar(255) NOT NULL DEFAULT '',
  `interval` smallint(5) DEFAULT NULL,
  `is_mandatory` smallint(5) DEFAULT NULL,
  PRIMARY KEY (`announcementid`),
  KEY `announcementstatus` (`announcementstatus`),
  CONSTRAINT `fk_1_u_yf_announcement` FOREIGN KEY (`announcementid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_announcement_mark` (
  `announcementid` int(10) NOT NULL,
  `userid` int(10) NOT NULL,
  `date` datetime NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`announcementid`,`userid`),
  KEY `userid` (`userid`,`status`),
  KEY `announcementid` (`announcementid`,`userid`,`date`,`status`),
  CONSTRAINT `u_yf_announcement_mark_ibfk_1` FOREIGN KEY (`announcementid`) REFERENCES `u_yf_announcement` (`announcementid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_announcementcf` (
  `announcementid` int(10) NOT NULL,
  PRIMARY KEY (`announcementid`),
  CONSTRAINT `fk_1_u_yf_announcementcf` FOREIGN KEY (`announcementid`) REFERENCES `u_yf_announcement` (`announcementid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_attachments` (
  `attachmentid` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `type` varchar(100) DEFAULT NULL,
  `path` text NOT NULL,
  `status` smallint(1) DEFAULT '0',
  `fieldid` int(10) DEFAULT NULL,
  `crmid` int(10) DEFAULT NULL,
  `createdtime` datetime DEFAULT NULL,
  PRIMARY KEY (`attachmentid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_browsinghistory` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `userid` int(10) NOT NULL,
  `date` datetime DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `url` text,
  PRIMARY KEY (`id`),
  KEY `browsinghistory_user_idx` (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=2159114 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cfixedassets` (
  `cfixedassetsid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `fixed_assets_type` varchar(255) DEFAULT NULL,
  `fixed_assets_status` varchar(255) DEFAULT NULL,
  `producent_designation` varchar(255) DEFAULT NULL,
  `additional_designation` varchar(255) DEFAULT NULL,
  `internal_designation` varchar(255) DEFAULT NULL,
  `date_production` date DEFAULT NULL,
  `date_acquisition` date DEFAULT NULL,
  `purchase_price` decimal(25,8) DEFAULT NULL,
  `actual_price` decimal(25,8) DEFAULT NULL,
  `reservation` smallint(1) DEFAULT NULL,
  `pscategory` varchar(255) DEFAULT NULL,
  `fixed_assets_fuel_type` varchar(255) DEFAULT NULL,
  `timing_change` int(10) DEFAULT '0',
  `oil_change` int(10) DEFAULT NULL,
  `fuel_consumption` int(10) DEFAULT NULL,
  `current_odometer_reading` int(10) DEFAULT NULL,
  `number_repair` smallint(5) DEFAULT NULL,
  `date_last_repair` date DEFAULT NULL,
  PRIMARY KEY (`cfixedassetsid`),
  CONSTRAINT `fk_1_vtiger_cfixedassetscfixedassetsid` FOREIGN KEY (`cfixedassetsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cfixedassetscf` (
  `cfixedassetsid` int(10) NOT NULL,
  PRIMARY KEY (`cfixedassetsid`),
  CONSTRAINT `fk_1_vtiger_cfixedassetscfcfixedassetsid` FOREIGN KEY (`cfixedassetsid`) REFERENCES `u_yf_cfixedassets` (`cfixedassetsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_chat_messages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userid` smallint(5) unsigned NOT NULL,
  `user_name` varchar(50) NOT NULL,
  `created` int(10) unsigned DEFAULT NULL,
  `messages` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cinternaltickets` (
  `cinternalticketsid` int(10) NOT NULL,
  `subject` varchar(100) DEFAULT NULL,
  `cinternaltickets_no` varchar(32) DEFAULT NULL,
  `internal_tickets_status` varchar(150) DEFAULT NULL,
  `resolution` text,
  `modulo` int(11) unsigned DEFAULT '0',
  `ente` varchar(255) DEFAULT '',
  `actividadcmf` varchar(255) DEFAULT '',
  `actividadliquidador` varchar(255) DEFAULT '',
  `actividadcorredor` varchar(255) DEFAULT '',
  `actividadcia` varchar(255) DEFAULT '',
  `actividadasegurado` varchar(255) DEFAULT '',
  `fechaactpendiente` date DEFAULT NULL,
  `fechaactrealizada` date DEFAULT NULL,
  `fechaactconcluida` date DEFAULT NULL,
  `descripcionact` text,
  `comentariosact` text,
  `solucionact` text,
  PRIMARY KEY (`cinternalticketsid`),
  KEY `u_yf_cinternaltickets_modulo_idx` (`modulo`),
  CONSTRAINT `fk_1_vtiger_cinternalticketscinternalticketsid` FOREIGN KEY (`cinternalticketsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cinternalticketscf` (
  `cinternalticketsid` int(10) NOT NULL,
  PRIMARY KEY (`cinternalticketsid`),
  CONSTRAINT `fk_1_vtiger_cinternalticketscfcinternalticketsid` FOREIGN KEY (`cinternalticketsid`) REFERENCES `u_yf_cinternaltickets` (`cinternalticketsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cliente_demanda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_cliente_demanda_crmid_idx` (`crmid`),
  KEY `u_yf_cliente_demanda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_cliente_demanda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_cliente_demanda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cmileagelogbook` (
  `cmileagelogbookid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `cmileage_logbook_status` varchar(150) DEFAULT NULL,
  `number_kilometers` decimal(13,2) DEFAULT NULL,
  PRIMARY KEY (`cmileagelogbookid`),
  CONSTRAINT `fk_1_vtiger_cmileagelogbookcmileagelogbookid` FOREIGN KEY (`cmileagelogbookid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_cmileagelogbookcf` (
  `cmileagelogbookid` int(10) NOT NULL,
  PRIMARY KEY (`cmileagelogbookid`),
  CONSTRAINT `fk_1_vtiger_cmileagelogbookcfcmileagelogbookid` FOREIGN KEY (`cmileagelogbookid`) REFERENCES `u_yf_cmileagelogbook` (`cmileagelogbookid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_competition` (
  `competitionid` int(10) NOT NULL DEFAULT '0',
  `competition_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `vat_id` varchar(30) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `email` varchar(100) DEFAULT '',
  `active` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`competitionid`),
  CONSTRAINT `fk_1_u_yf_competition` FOREIGN KEY (`competitionid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_competition_address` (
  `competitionaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`competitionaddressid`),
  CONSTRAINT `u_yf_competition_address_ibfk_1` FOREIGN KEY (`competitionaddressid`) REFERENCES `u_yf_competition` (`competitionid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_competitioncf` (
  `competitionid` int(10) NOT NULL,
  PRIMARY KEY (`competitionid`),
  CONSTRAINT `fk_1_u_yf_competitioncf` FOREIGN KEY (`competitionid`) REFERENCES `u_yf_competition` (`competitionid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_countries` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `code` char(2) NOT NULL,
  `status` tinyint(1) unsigned DEFAULT '0',
  `sortorderid` smallint(5) unsigned NOT NULL,
  `phone` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `uitype` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `code` (`code`),
  KEY `phone` (`status`,`phone`),
  KEY `uitype` (`status`,`uitype`)
) ENGINE=InnoDB AUTO_INCREMENT=242 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_crmentity_label` (
  `crmid` int(10) unsigned NOT NULL,
  `label` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`crmid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_crmentity_last_changes` (
  `crmid` int(10) NOT NULL,
  `fieldname` varchar(50) NOT NULL,
  `user_id` int(10) NOT NULL,
  `date_updated` datetime NOT NULL,
  KEY `crmid` (`crmid`,`fieldname`),
  CONSTRAINT `u_yf_crmentity_last_changes_ibfk_1` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_crmentity_rel_tree` (
  `crmid` int(10) NOT NULL,
  `module` int(10) NOT NULL,
  `tree` varchar(50) NOT NULL,
  `relmodule` int(10) NOT NULL,
  `rel_created_user` int(10) NOT NULL,
  `rel_created_time` datetime NOT NULL,
  `rel_comment` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_crmentity_search_label` (
  `crmid` int(10) unsigned NOT NULL,
  `searchlabel` varchar(255) NOT NULL,
  `setype` varchar(30) NOT NULL,
  `userid` text,
  PRIMARY KEY (`crmid`),
  KEY `searchlabel` (`searchlabel`),
  KEY `searchlabel_2` (`searchlabel`,`setype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_crmentity_showners` (
  `crmid` int(10) DEFAULT NULL,
  `userid` smallint(5) unsigned NOT NULL,
  UNIQUE KEY `mix` (`crmid`,`userid`),
  KEY `crmid` (`crmid`),
  KEY `userid` (`userid`),
  CONSTRAINT `fk_u_yf_crmentity_showners` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_dashboard_type` (
  `dashboard_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `system` smallint(1) DEFAULT '0',
  PRIMARY KEY (`dashboard_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_demandacomercial_gestcomdda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_demandacomercial_gestcomdda_crmid_idx` (`crmid`),
  KEY `u_yf_demandacomercial_gestcomdda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_demandacomercial_gestcomdda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_demandacomercial_gestcomdda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_demandapagoretenido_gestcomdda` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_demandapagoretenido_gestcomdda_crmid_idx` (`crmid`),
  KEY `u_yf_demandapagoretenido_gestcomdda_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_demandapagoretenido_gestcomdda` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_demandapagoretenido_gestcomdda` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_documents_emailtemplates` (
  `crmid` int(10) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  KEY `u_yf_documents_emailtemplates_crmid_idx` (`crmid`),
  KEY `u_yf_documents_emailtemplates_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_documents_emailtemplates` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_documents_emailtemplates` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_emailtemplates` (
  `emailtemplatesid` int(10) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `email_template_type` varchar(50) DEFAULT NULL,
  `module` varchar(50) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `content` text,
  `sys_name` varchar(50) DEFAULT NULL,
  `email_template_priority` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`emailtemplatesid`),
  KEY `sys_name` (`sys_name`),
  CONSTRAINT `fk_1_vtiger_emailtemplatesemailtemplatesid` FOREIGN KEY (`emailtemplatesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_favorites` (
  `crmid` int(10) DEFAULT NULL,
  `module` varchar(30) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  `relmodule` varchar(30) DEFAULT NULL,
  `userid` int(10) DEFAULT NULL,
  `data` timestamp NULL DEFAULT NULL,
  KEY `crmid` (`crmid`),
  KEY `relcrmid` (`relcrmid`),
  KEY `mix` (`crmid`,`module`,`relcrmid`,`relmodule`,`userid`),
  CONSTRAINT `fk_1_u_yf_favorites` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_u_yf_favorites` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fbookkeeping` (
  `fbookkeepingid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `related_to` int(10) DEFAULT NULL,
  PRIMARY KEY (`fbookkeepingid`),
  KEY `related_to` (`related_to`),
  CONSTRAINT `u_yf_fbookkeeping_ibfk_1` FOREIGN KEY (`fbookkeepingid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fbookkeepingcf` (
  `fbookkeepingid` int(10) NOT NULL,
  PRIMARY KEY (`fbookkeepingid`),
  CONSTRAINT `u_yf_fbookkeepingcf_ibfk_1` FOREIGN KEY (`fbookkeepingid`) REFERENCES `u_yf_fbookkeeping` (`fbookkeepingid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoice` (
  `fcorectinginvoiceid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `fcorectinginvoice_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `fcorectinginvoice_status` varchar(255) DEFAULT '',
  `finvoiceid` int(10) DEFAULT NULL,
  PRIMARY KEY (`fcorectinginvoiceid`),
  KEY `accountid` (`accountid`),
  KEY `finvoiceid` (`finvoiceid`),
  CONSTRAINT `fk_1_vtiger_fcorectinginvoice` FOREIGN KEY (`fcorectinginvoiceid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoice_address` (
  `fcorectinginvoiceaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`fcorectinginvoiceaddressid`),
  CONSTRAINT `u_yf_fcorectinginvoice_address_ibfk_1` FOREIGN KEY (`fcorectinginvoiceaddressid`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoice_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `comment1` text,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_fcorectinginvoice_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoice_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoice_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_fcorectinginvoicecf` (
  `fcorectinginvoiceid` int(10) NOT NULL,
  PRIMARY KEY (`fcorectinginvoiceid`),
  CONSTRAINT `fk_1_u_yf_fcorectinginvoicecf` FOREIGN KEY (`fcorectinginvoiceid`) REFERENCES `u_yf_fcorectinginvoice` (`fcorectinginvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_featured_filter` (
  `user` varchar(30) NOT NULL,
  `cvid` int(10) NOT NULL,
  PRIMARY KEY (`user`,`cvid`),
  KEY `cvid` (`cvid`),
  KEY `user` (`user`),
  CONSTRAINT `u_yf_featured_filter_ibfk_1` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoice` (
  `finvoiceid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `finvoice_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `finvoice_status` varchar(255) DEFAULT '',
  `finvoice_paymentstatus` varchar(255) DEFAULT NULL,
  `finvoice_type` varchar(255) DEFAULT NULL,
  `pscategory` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`finvoiceid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_vtiger_finvoice` FOREIGN KEY (`finvoiceid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoice_address` (
  `finvoiceaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoiceaddressid`),
  CONSTRAINT `u_yf_finvoice_address_ibfk_1` FOREIGN KEY (`finvoiceaddressid`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoice_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `discountparam` varchar(255) DEFAULT NULL,
  `comment1` text,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_finvoice_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoice_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoice_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecf` (
  `finvoiceid` int(10) NOT NULL,
  PRIMARY KEY (`finvoiceid`),
  CONSTRAINT `fk_1_u_yf_finvoicecf` FOREIGN KEY (`finvoiceid`) REFERENCES `u_yf_finvoice` (`finvoiceid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecost` (
  `finvoicecostid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `finvoicecost_formpayment` varchar(255) DEFAULT '',
  `sum_total` decimal(16,5) DEFAULT NULL,
  `sum_gross` decimal(16,5) DEFAULT NULL,
  `finvoicecost_status` varchar(255) DEFAULT '',
  `finvoicecost_paymentstatus` varchar(255) DEFAULT NULL,
  `pscategory` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoicecostid`),
  CONSTRAINT `fk_1_vtiger_finvoicecost` FOREIGN KEY (`finvoicecostid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecost_address` (
  `finvoicecostaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`finvoicecostaddressid`),
  CONSTRAINT `u_yf_finvoicecost_address_ibfk_1` FOREIGN KEY (`finvoicecostaddressid`) REFERENCES `u_yf_finvoicecost` (`finvoicecostid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecost_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) DEFAULT '0',
  `qty` decimal(25,3) DEFAULT '0.000',
  `qtyparam` smallint(1) DEFAULT '0',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `comment1` text,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `discountmode` smallint(1) DEFAULT '0',
  `taxmode` smallint(1) DEFAULT '0',
  `price` decimal(28,8) DEFAULT '0.00000000',
  `gross` decimal(28,8) DEFAULT '0.00000000',
  `net` decimal(28,8) DEFAULT '0.00000000',
  `tax` decimal(28,8) DEFAULT '0.00000000',
  `taxparam` varchar(255) DEFAULT NULL,
  `total` decimal(28,8) DEFAULT '0.00000000',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `finvoicecost_inventory_idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecost_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` smallint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` smallint(1) unsigned NOT NULL,
  `displaytype` smallint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` smallint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecost_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoicecostcf` (
  `finvoicecostid` int(10) NOT NULL,
  PRIMARY KEY (`finvoicecostid`),
  CONSTRAINT `fk_1_u_yf_finvoicecostcf` FOREIGN KEY (`finvoicecostid`) REFERENCES `u_yf_finvoicecost` (`finvoicecostid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproforma` (
  `finvoiceproformaid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `paymentdate` date DEFAULT NULL,
  `saledate` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `finvoiceproforma_formpayment` varchar(255) DEFAULT NULL,
  `sum_total` decimal(15,2) DEFAULT NULL,
  `sum_gross` decimal(13,2) DEFAULT NULL,
  `finvoiceproforma_status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`finvoiceproformaid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_vtiger_finvoiceproforma` FOREIGN KEY (`finvoiceproformaid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproforma_address` (
  `finvoiceproformaaddressid` int(10) NOT NULL,
  `addresslevel1c` varchar(255) DEFAULT NULL,
  `addresslevel2c` varchar(255) DEFAULT NULL,
  `addresslevel3c` varchar(255) DEFAULT NULL,
  `addresslevel4c` varchar(255) DEFAULT NULL,
  `addresslevel5c` varchar(255) DEFAULT NULL,
  `addresslevel6c` varchar(255) DEFAULT NULL,
  `addresslevel7c` varchar(255) DEFAULT NULL,
  `addresslevel8c` varchar(255) DEFAULT NULL,
  `buildingnumberc` varchar(255) DEFAULT NULL,
  `localnumberc` varchar(255) DEFAULT NULL,
  `poboxc` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`finvoiceproformaaddressid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproforma_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `currency` int(10) DEFAULT NULL,
  `currencyparam` varchar(1024) DEFAULT NULL,
  `discountmode` tinyint(1) NOT NULL DEFAULT '0',
  `taxmode` tinyint(1) NOT NULL DEFAULT '0',
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `discount` decimal(28,8) DEFAULT '0.00000000',
  `discountparam` varchar(255) DEFAULT NULL,
  `net` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `tax` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `taxparam` varchar(255) NOT NULL,
  `gross` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_finvoiceproforma_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_finvoiceproforma` (`finvoiceproformaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproforma_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproforma_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_finvoiceproformacf` (
  `finvoiceproformaid` int(10) NOT NULL,
  PRIMARY KEY (`finvoiceproformaid`),
  CONSTRAINT `fk_1_vtiger_finvoiceproformacf` FOREIGN KEY (`finvoiceproformaid`) REFERENCES `u_yf_finvoiceproforma` (`finvoiceproformaid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_github` (
  `github_id` int(10) NOT NULL AUTO_INCREMENT,
  `client_id` varchar(20) DEFAULT NULL,
  `token` varchar(100) DEFAULT NULL,
  `username` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`github_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdn` (
  `igdnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igdn_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `ssingleordersid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igdnid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `ssingleordersid` (`ssingleordersid`),
  CONSTRAINT `u_yf_igdn_ibfk_1` FOREIGN KEY (`igdnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igdn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igdn` (`igdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdn_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdn_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdnc` (
  `igdncid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igdnc_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `igdnid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igdncid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `igdnid` (`igdnid`),
  CONSTRAINT `u_yf_igdnc_ibfk_1` FOREIGN KEY (`igdncid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdnc_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igdnc_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igdnc` (`igdncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdnc_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdnc_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdnccf` (
  `igdncid` int(10) NOT NULL,
  PRIMARY KEY (`igdncid`),
  CONSTRAINT `u_yf_igdnccf_ibfk_1` FOREIGN KEY (`igdncid`) REFERENCES `u_yf_igdnc` (`igdncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igdncf` (
  `igdnid` int(10) NOT NULL,
  PRIMARY KEY (`igdnid`),
  CONSTRAINT `u_yf_igdncf_ibfk_1` FOREIGN KEY (`igdnid`) REFERENCES `u_yf_igdn` (`igdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igin` (
  `iginid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igin_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`iginid`),
  KEY `storageid` (`storageid`),
  CONSTRAINT `u_yf_igin_ibfk_1` FOREIGN KEY (`iginid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igin_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igin_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igin` (`iginid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igin_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igin_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igincf` (
  `iginid` int(10) NOT NULL,
  PRIMARY KEY (`iginid`),
  CONSTRAINT `u_yf_igincf_ibfk_1` FOREIGN KEY (`iginid`) REFERENCES `u_yf_igin` (`iginid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrn` (
  `igrnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igrn_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  PRIMARY KEY (`igrnid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  CONSTRAINT `u_yf_igrn_ibfk_1` FOREIGN KEY (`igrnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igrn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igrn` (`igrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrn_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrn_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrnc` (
  `igrncid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `igrnc_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `igrnid` int(10) DEFAULT NULL,
  PRIMARY KEY (`igrncid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  KEY `igrnid` (`igrnid`),
  CONSTRAINT `u_yf_igrnc_ibfk_1` FOREIGN KEY (`igrncid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrnc_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_igrnc_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_igrnc` (`igrncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrnc_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrnc_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrnccf` (
  `igrncid` int(10) NOT NULL,
  PRIMARY KEY (`igrncid`),
  CONSTRAINT `u_yf_igrnccf_ibfk_1` FOREIGN KEY (`igrncid`) REFERENCES `u_yf_igrnc` (`igrncid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_igrncf` (
  `igrnid` int(10) NOT NULL,
  PRIMARY KEY (`igrnid`),
  CONSTRAINT `u_yf_igrncf_ibfk_1` FOREIGN KEY (`igrnid`) REFERENCES `u_yf_igrn` (`igrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_iidn` (
  `iidnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `iidn_status` varchar(255) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`iidnid`),
  KEY `storageid` (`storageid`),
  CONSTRAINT `u_yf_iidn_ibfk_1` FOREIGN KEY (`iidnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_iidn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `unit` varchar(200) DEFAULT NULL,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_iidn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_iidn` (`iidnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_iidn_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_iidn_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_iidncf` (
  `iidnid` int(10) NOT NULL,
  PRIMARY KEY (`iidnid`),
  CONSTRAINT `u_yf_iidncf_ibfk_1` FOREIGN KEY (`iidnid`) REFERENCES `u_yf_iidn` (`iidnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_ipreorder` (
  `ipreorderid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `ipreorder_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  PRIMARY KEY (`ipreorderid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `u_yf_ipreorder_ibfk_1` FOREIGN KEY (`ipreorderid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_ipreorder_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_ipreorder_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_ipreorder` (`ipreorderid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_ipreorder_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_ipreorder_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_ipreordercf` (
  `ipreorderid` int(10) NOT NULL,
  PRIMARY KEY (`ipreorderid`),
  CONSTRAINT `u_yf_ipreordercf_ibfk_1` FOREIGN KEY (`ipreorderid`) REFERENCES `u_yf_ipreorder` (`ipreorderid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istdn` (
  `istdnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `istdn_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  PRIMARY KEY (`istdnid`),
  KEY `storageid` (`storageid`),
  KEY `accountid` (`accountid`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  CONSTRAINT `u_yf_istdn_ibfk_1` FOREIGN KEY (`istdnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istdn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_istdn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_istdn` (`istdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istdn_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istdn_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istdncf` (
  `istdnid` int(10) NOT NULL,
  PRIMARY KEY (`istdnid`),
  CONSTRAINT `u_yf_istdncf_ibfk_1` FOREIGN KEY (`istdnid`) REFERENCES `u_yf_istdn` (`istdnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istn` (
  `istnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `istn_status` varchar(255) DEFAULT NULL,
  `estimated_date` date DEFAULT NULL,
  `istn_type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`istnid`),
  CONSTRAINT `u_yf_istn_ibfk_1` FOREIGN KEY (`istnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istncf` (
  `istnid` int(10) NOT NULL,
  PRIMARY KEY (`istnid`),
  CONSTRAINT `u_yf_istncf_ibfk_1` FOREIGN KEY (`istnid`) REFERENCES `u_yf_istn` (`istnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istorages` (
  `istorageid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `storage_status` varchar(255) DEFAULT '',
  `storage_type` varchar(255) DEFAULT '',
  `parentid` int(10) DEFAULT NULL,
  PRIMARY KEY (`istorageid`),
  KEY `parentid` (`parentid`),
  CONSTRAINT `u_yf_istorages_ibfk_1` FOREIGN KEY (`istorageid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istorages_address` (
  `istorageaddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`istorageaddressid`),
  CONSTRAINT `u_yf_istorages_address_ibfk_1` FOREIGN KEY (`istorageaddressid`) REFERENCES `u_yf_istorages` (`istorageid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istorages_products` (
  `crmid` int(10) DEFAULT NULL,
  `relcrmid` int(10) DEFAULT NULL,
  `qtyinstock` decimal(25,3) DEFAULT NULL,
  KEY `crmid` (`crmid`),
  KEY `relcrmid` (`relcrmid`),
  CONSTRAINT `u_yf_istorages_products_ibfk_1` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `u_yf_istorages_products_ibfk_2` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istoragescf` (
  `istorageid` int(10) NOT NULL,
  PRIMARY KEY (`istorageid`),
  CONSTRAINT `u_yf_istoragescf_ibfk_1` FOREIGN KEY (`istorageid`) REFERENCES `u_yf_istorages` (`istorageid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istrn` (
  `istrnid` int(10) NOT NULL,
  `number` varchar(32) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `storageid` int(10) DEFAULT NULL,
  `istrn_status` varchar(255) DEFAULT NULL,
  `vendorid` int(10) DEFAULT NULL,
  `acceptance_date` date DEFAULT NULL,
  `sum_total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  PRIMARY KEY (`istrnid`),
  KEY `storageid` (`storageid`),
  KEY `vendorid` (`vendorid`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  CONSTRAINT `u_yf_istrn_ibfk_1` FOREIGN KEY (`istrnid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istrn_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `comment1` text,
  `unit` varchar(255) DEFAULT NULL,
  `ean` varchar(255) DEFAULT NULL,
  `qtyparam` tinyint(1) DEFAULT '0',
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_istrn_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_istrn` (`istrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istrn_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istrn_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_istrncf` (
  `istrnid` int(10) NOT NULL,
  PRIMARY KEY (`istrnid`),
  CONSTRAINT `u_yf_istrncf_ibfk_1` FOREIGN KEY (`istrnid`) REFERENCES `u_yf_istrn` (`istrnid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_knowledgebase` (
  `knowledgebaseid` int(10) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `content` text,
  `category` varchar(200) DEFAULT NULL,
  `knowledgebase_view` varchar(255) DEFAULT NULL,
  `knowledgebase_status` varchar(255) DEFAULT '',
  PRIMARY KEY (`knowledgebaseid`),
  CONSTRAINT `fk_1_vtiger_knowledgebase` FOREIGN KEY (`knowledgebaseid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_knowledgebasecf` (
  `knowledgebaseid` int(10) NOT NULL,
  PRIMARY KEY (`knowledgebaseid`),
  CONSTRAINT `fk_1_vtiger_knowledgebasecf` FOREIGN KEY (`knowledgebaseid`) REFERENCES `u_yf_knowledgebase` (`knowledgebaseid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_mail_address_book` (
  `id` int(10) NOT NULL,
  `email` varchar(100) NOT NULL,
  `name` varchar(255) NOT NULL,
  `users` text NOT NULL,
  KEY `email` (`email`,`name`),
  KEY `id` (`id`),
  CONSTRAINT `u_yf_mail_address_book_ibfk_1` FOREIGN KEY (`id`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_mail_autologin` (
  `ruid` smallint(5) unsigned NOT NULL,
  `key` varchar(50) NOT NULL,
  `cuid` smallint(5) unsigned NOT NULL,
  `params` text NOT NULL,
  KEY `ruid` (`ruid`),
  KEY `cuid` (`cuid`),
  KEY `key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_mail_compose_data` (
  `userid` smallint(5) unsigned NOT NULL,
  `key` varchar(32) NOT NULL,
  `data` text NOT NULL,
  UNIQUE KEY `userid` (`userid`,`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_multicompany` (
  `multicompanyid` int(11) NOT NULL,
  `company_name` varchar(255) DEFAULT NULL,
  `parent_id` int(10) DEFAULT NULL,
  `number` varchar(32) DEFAULT NULL,
  `mulcomp_status` varchar(255) DEFAULT NULL,
  `email1` varchar(100) DEFAULT NULL,
  `email2` varchar(100) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `phone_extra` varchar(100) DEFAULT NULL,
  `mobile` varchar(30) DEFAULT NULL,
  `mobile_extra` varchar(100) DEFAULT NULL,
  `fax` varchar(30) DEFAULT NULL,
  `fax_extra` varchar(100) DEFAULT NULL,
  `vat` varchar(255) DEFAULT NULL,
  `companyid1` varchar(255) DEFAULT NULL,
  `companyid2` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(50) DEFAULT NULL,
  `localnumbera` varchar(50) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`multicompanyid`),
  KEY `multicompany_parent_id_idx` (`parent_id`),
  CONSTRAINT `fk_1_u_yf_multicompanymulticompanyid` FOREIGN KEY (`multicompanyid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_multicompanycf` (
  `multicompanyid` int(11) NOT NULL,
  `public_notes` text,
  `internal_notes` text,
  PRIMARY KEY (`multicompanyid`),
  CONSTRAINT `fk_1_u_yf_multicompanycfmulticompanyid` FOREIGN KEY (`multicompanyid`) REFERENCES `u_yf_multicompany` (`multicompanyid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_notification` (
  `notificationid` int(10) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `number` varchar(50) DEFAULT NULL,
  `notification_status` varchar(255) DEFAULT NULL,
  `notification_type` varchar(255) DEFAULT '',
  `link` int(10) DEFAULT NULL,
  `process` int(10) DEFAULT NULL,
  `subprocess` int(10) DEFAULT NULL,
  `linkextend` int(10) DEFAULT NULL,
  `notificacioncliente` int(11) unsigned DEFAULT '0',
  `gestcomdda` int(11) unsigned DEFAULT '0',
  PRIMARY KEY (`notificationid`),
  KEY `link` (`link`),
  KEY `process` (`process`),
  KEY `subprocess` (`subprocess`),
  KEY `linkextend` (`linkextend`),
  KEY `u_yf_notification_notificacioncliente_idx` (`notificacioncliente`),
  KEY `u_yf_notification_gestcomdda_idx` (`gestcomdda`),
  CONSTRAINT `fk_1_notification` FOREIGN KEY (`notificationid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_openstreetmap` (
  `crmid` int(10) unsigned NOT NULL,
  `type` char(1) NOT NULL,
  `lat` decimal(10,7) DEFAULT NULL,
  `lon` decimal(10,7) DEFAULT NULL,
  KEY `u_yf_openstreetmap_lat_lon` (`lat`,`lon`),
  KEY `crmid_type` (`crmid`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_openstreetmap_address_updater` (
  `crmid` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_openstreetmap_cache` (
  `user_id` int(10) unsigned NOT NULL,
  `module_name` varchar(50) NOT NULL,
  `crmids` int(10) unsigned NOT NULL,
  KEY `u_yf_openstreetmap_cache_user_id_module_name_idx` (`user_id`,`module_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_openstreetmap_record_updater` (
  `crmid` int(10) NOT NULL,
  `type` char(1) NOT NULL,
  `address` text NOT NULL,
  KEY `crmid` (`crmid`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_partners` (
  `partnersid` int(10) NOT NULL DEFAULT '0',
  `partners_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `vat_id` varchar(30) DEFAULT NULL,
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `email` varchar(100) DEFAULT '',
  `active` tinyint(1) DEFAULT '0',
  `category` varchar(255) DEFAULT '',
  PRIMARY KEY (`partnersid`),
  CONSTRAINT `fk_1_u_yf_partners` FOREIGN KEY (`partnersid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_partners_address` (
  `partneraddressid` int(10) NOT NULL,
  `addresslevel1a` varchar(255) DEFAULT NULL,
  `addresslevel2a` varchar(255) DEFAULT NULL,
  `addresslevel3a` varchar(255) DEFAULT NULL,
  `addresslevel4a` varchar(255) DEFAULT NULL,
  `addresslevel5a` varchar(255) DEFAULT NULL,
  `addresslevel6a` varchar(255) DEFAULT NULL,
  `addresslevel7a` varchar(255) DEFAULT NULL,
  `addresslevel8a` varchar(255) DEFAULT NULL,
  `buildingnumbera` varchar(100) DEFAULT NULL,
  `localnumbera` varchar(100) DEFAULT NULL,
  `poboxa` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`partneraddressid`),
  CONSTRAINT `u_yf_partners_address_ibfk_1` FOREIGN KEY (`partneraddressid`) REFERENCES `u_yf_partners` (`partnersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_partnerscf` (
  `partnersid` int(10) NOT NULL,
  PRIMARY KEY (`partnersid`),
  CONSTRAINT `fk_1_u_yf_partnerscf` FOREIGN KEY (`partnersid`) REFERENCES `u_yf_partners` (`partnersid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_prueba_suscripcion` (
  `crmid` int(11) DEFAULT NULL,
  `relcrmid` int(11) DEFAULT NULL,
  KEY `u_yf_prueba_suscripcion_crmid_idx` (`crmid`),
  KEY `u_yf_prueba_suscripcion_relcrmid_idx` (`relcrmid`),
  CONSTRAINT `fk_1_u_yf_prueba_suscripcion` FOREIGN KEY (`crmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE,
  CONSTRAINT `fk_2_u_yf_prueba_suscripcion` FOREIGN KEY (`relcrmid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_recurring_info` (
  `srecurringordersid` int(10) NOT NULL DEFAULT '0',
  `target_module` varchar(25) DEFAULT NULL,
  `recurring_frequency` varchar(100) DEFAULT NULL,
  `start_period` date DEFAULT NULL,
  `end_period` date DEFAULT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `last_recurring_date` date DEFAULT NULL,
  PRIMARY KEY (`srecurringordersid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_reviewed_queue` (
  `id` int(10) NOT NULL,
  `userid` int(10) NOT NULL,
  `tabid` smallint(5) DEFAULT NULL,
  `data` text,
  `time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `userid` (`userid`),
  CONSTRAINT `fk_1_u_yf_reviewed_queue` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_scalculations` (
  `scalculationsid` int(10) NOT NULL DEFAULT '0',
  `scalculations_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `srequirementscardsid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `scalculations_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  `sum_total` decimal(28,8) DEFAULT NULL,
  `sum_marginp` decimal(10,2) DEFAULT NULL,
  `sum_margin` decimal(28,8) DEFAULT NULL,
  PRIMARY KEY (`scalculationsid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `accountid` (`accountid`),
  KEY `srequirementscardsid` (`srequirementscardsid`),
  CONSTRAINT `fk_1_u_yf_scalculations` FOREIGN KEY (`scalculationsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_scalculations_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `price` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `total` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `purchase` decimal(28,8) NOT NULL DEFAULT '0.00000000',
  `marginp` decimal(28,8) DEFAULT '0.00000000',
  `margin` decimal(28,8) DEFAULT '0.00000000',
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_scalculations_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_scalculations` (`scalculationsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_scalculations_invfield` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(30) NOT NULL,
  `label` varchar(50) NOT NULL,
  `invtype` varchar(30) NOT NULL,
  `presence` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `defaultvalue` varchar(255) DEFAULT NULL,
  `sequence` int(10) unsigned NOT NULL,
  `block` tinyint(1) unsigned NOT NULL,
  `displaytype` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `params` text,
  `colspan` tinyint(1) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_scalculations_invmap` (
  `module` varchar(50) NOT NULL,
  `field` varchar(50) NOT NULL,
  `tofield` varchar(50) NOT NULL,
  PRIMARY KEY (`module`,`field`,`tofield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_scalculationscf` (
  `scalculationsid` int(10) NOT NULL,
  PRIMARY KEY (`scalculationsid`),
  CONSTRAINT `fk_1_u_yf_scalculationscf` FOREIGN KEY (`scalculationsid`) REFERENCES `u_yf_scalculations` (`scalculationsid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_squoteenquiries` (
  `squoteenquiriesid` int(10) NOT NULL DEFAULT '0',
  `squoteenquiries_no` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT NULL,
  `salesprocessid` int(10) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `squoteenquiries_status` varchar(255) DEFAULT NULL,
  `accountid` int(10) DEFAULT NULL,
  `response_time` decimal(10,2) DEFAULT '0.00',
  `sum_time` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`squoteenquiriesid`),
  KEY `salesprocessid` (`salesprocessid`),
  KEY `accountid` (`accountid`),
  CONSTRAINT `fk_1_u_yf_squoteenquiries` FOREIGN KEY (`squoteenquiriesid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `u_yf_squoteenquiries_inventory` (
  `id` int(10) DEFAULT NULL,
  `seq` int(10) DEFAULT NULL,
  `name` int(10) NOT NULL DEFAULT '0',
  `qty` decimal(25,3) NOT NULL DEFAULT '0.000',
  `comment1` text,
  `qtyparam` tinyint(1) DEFAULT '0',
  `unit` varchar(255) DEFAULT NULL,
  `subunit` varchar(255) DEFAULT NULL,
  KEY `id` (`id`),
  CONSTRAINT `fk_1_u_yf_squoteenquiries_inventory` FOREIGN KEY (`id`) REFERENCES `u_yf_squoteenquiries` (`squoteenquiriesid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
