##Remote tables
CREATE TABLE `datoscupones_logtabla` (
  `LOGTablaID` INT(10) NOT NULL,
  `tabla` CHAR(100) NOT NULL COMMENT 'Nombre de la Tabla',
  `tipoLogID` INT(10) DEFAULT NULL COMMENT 'Valores: 0=Info, 1=Alta, 2=Modificacion, 3=Baja, 4=SQLScript (ejecuta condicionSQL)',
  `condicionSQL` CHAR(244) DEFAULT NULL COMMENT 'Script SQL o Condicion para devolver el registro a actualizar. Ejemplo: Serie=''XXX'' and folio=12345',
  `fecha` DATE NOT NULL,
  `hora` CHAR(12) NOT NULL,
  `info` CHAR(244) DEFAULT NULL COMMENT 'Texto Informativo',
  `procesado` SMALLINT(5) NOT NULL COMMENT 'Valores:0=Pendiente, 1=Procesado',
  PRIMARY KEY (`LOGTablaID`) USING BTREE,
  KEY `idxProcesado` (`procesado`,`fecha`,`hora`,`tabla`)
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=DBISAM_translamex_cupones' `table_type`=ODBC `tabname`='LOGTabla'


CREATE TABLE `datoscupones_cupones` (
  `Serie` VARCHAR(2) NOT NULL,
  `Folio` INT(11) NOT NULL,
  `Locacion` INT(11) DEFAULT NULL,
  `Vendedor` VARCHAR(5) DEFAULT NULL,
  `Fecha` DATE DEFAULT NULL,
  `Tour` INT(11) DEFAULT NULL,
  `Adultos` INT(11) DEFAULT NULL,
  `Ninos` INT(11) DEFAULT NULL,
  `PrecioAdulto` DOUBLE(15,3) DEFAULT NULL,
  `PrecioNino` DOUBLE(15,3) DEFAULT NULL,
  `VentaAdulto` DOUBLE(15,3) DEFAULT NULL,
  `VentaNino` DOUBLE(15,3) DEFAULT NULL,
  `NumeroCosto` INT(11) DEFAULT NULL,
  `Status` VARCHAR(1) DEFAULT NULL,
  `Nombre` VARCHAR(50) DEFAULT NULL,
  `Hotel` VARCHAR(30) DEFAULT NULL,
  `Habitacion` VARCHAR(10) DEFAULT NULL,
  `Hora` VARCHAR(8) DEFAULT NULL,
  `NumTarjeta` VARCHAR(4) DEFAULT NULL,
  `Cliente` VARCHAR(10) DEFAULT NULL,
  `RegaloUSD` DOUBLE(15,3) DEFAULT NULL,
  `RegaloPesos` DOUBLE(15,3) DEFAULT NULL,
  `TCDolar` DOUBLE(15,3) DEFAULT NULL,
  `TasaComVend` DOUBLE(15,3) DEFAULT NULL,
  `TasaComLoc` DOUBLE(15,3) DEFAULT NULL,
  `ComisVend` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup` DOUBLE(15,3) DEFAULT NULL,
  `ComisLoc` DOUBLE(15,3) DEFAULT NULL,
  `Reembolso` DOUBLE(15,3) DEFAULT NULL,
  `TipoTour` VARCHAR(1) DEFAULT NULL,
  `Proveedor` INT(11) DEFAULT NULL,
  `TipoPago` SMALLINT(6) DEFAULT NULL,
  `TasaComision` DOUBLE(15,3) DEFAULT NULL,
  `Confirmacion` VARCHAR(30) DEFAULT NULL,
  `TarjetaPesos2` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos3` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares2` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares3` DOUBLE(15,3) DEFAULT NULL,
  `NumTarjeta2` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta3` VARCHAR(4) DEFAULT NULL,
  `FolioRegalo` VARCHAR(8) DEFAULT NULL,
  `TarjetaPesos` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares` DOUBLE(15,3) DEFAULT NULL,
  `Facturado` TINYINT(2) DEFAULT NULL,
  `Factura` CHAR(20) DEFAULT NULL,
  `FechaFact` DATE DEFAULT NULL,
  `CostoAdulto` DOUBLE(15,3) DEFAULT NULL,
  `CostoNino` DOUBLE(15,3) DEFAULT NULL,
  `ComisBanco` DOUBLE(15,3) DEFAULT NULL,
  `TCFactura` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos4` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos5` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos6` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos7` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos8` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos9` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos10` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares4` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares5` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares6` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares7` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares8` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares9` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares10` DOUBLE(15,3) DEFAULT NULL,
  `NumTarjeta4` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta5` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta6` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta7` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta8` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta9` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta10` VARCHAR(4) DEFAULT NULL,
  `AdultosR` INT(11) DEFAULT NULL,
  `NinosR` INT(11) DEFAULT NULL,
  `Destino` INT(11) DEFAULT NULL,
  `ID` SMALLINT(6) NOT NULL,
  `RefID` INT(11) DEFAULT NULL,
  `Comentarios` VARCHAR(100) DEFAULT NULL,
  `Descuento` DOUBLE(15,3) DEFAULT NULL,
  `MesesCredito` INT(11) DEFAULT NULL,
  `Salida` DATE DEFAULT NULL,
  `ComisSup2` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup3` DOUBLE(15,3) DEFAULT NULL,
  `ComisTranslamex` DOUBLE(15,3) DEFAULT NULL,
  `Manual` TINYINT(1) DEFAULT NULL,
  `FechaCaptura` DATE DEFAULT NULL,
  `Dolares` DOUBLE(15,3) DEFAULT NULL,
  `Pesos` DOUBLE(15,3) DEFAULT NULL,
  `Boletinado` TINYINT(1) DEFAULT NULL,
  `BoletinadoPor` VARCHAR(100) DEFAULT NULL,
  `SerieReemp` VARCHAR(2) DEFAULT NULL,
  `FolioReemp` INT(11) DEFAULT NULL,
  `FechaReemp` DATE DEFAULT NULL,
  `ObservReemp` VARCHAR(100) DEFAULT NULL,
  `Convertidor` TINYINT(1) DEFAULT NULL,
  `ComisSup4` DOUBLE(15,3) DEFAULT NULL,
  `EMail` VARCHAR(50) DEFAULT NULL,
  `Telefono` VARCHAR(20) DEFAULT NULL,
  `ComisSup5` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup6` DOUBLE(15,3) DEFAULT NULL,
  `IDReemp` SMALLINT(6) DEFAULT NULL,
  `Cliente2` VARCHAR(10) DEFAULT NULL,
  `RegaloPesos2` DOUBLE(15,3) DEFAULT NULL,
  `RegaloUSD2` DOUBLE(15,3) DEFAULT NULL,
  `FolioRegalo2` VARCHAR(8) DEFAULT NULL,
  `Ingreso` INT(11) DEFAULT NULL,
  `GrupoTour` INT(11) DEFAULT NULL,
  `Cerrado` TINYINT(1) DEFAULT NULL,
  `TipoPago2` SMALLINT(6) DEFAULT NULL,
  `TipoPago3` SMALLINT(6) DEFAULT NULL,
  `TipoPago4` SMALLINT(6) DEFAULT NULL,
  `TipoPago5` SMALLINT(6) DEFAULT NULL,
  `TipoPago6` SMALLINT(6) DEFAULT NULL,
  `TipoPago7` SMALLINT(6) DEFAULT NULL,
  `TipoPago8` SMALLINT(6) DEFAULT NULL,
  `TipoPago9` SMALLINT(6) DEFAULT NULL,
  `TipoPago10` SMALLINT(6) DEFAULT NULL,
  `CostoAdulto2` DOUBLE(15,3) DEFAULT NULL,
  `CostoNino2` DOUBLE(15,3) DEFAULT NULL,
  `Infantes` INT(11) DEFAULT NULL,
  `TipoCliente` INT(11) DEFAULT NULL,
  `Observaciones` VARCHAR(1024) DEFAULT NULL,
  `ToursPQT` VARCHAR(5) DEFAULT NULL,
  `Tours` INT(11) DEFAULT NULL,
  `TarjetaEstVida` VARCHAR(14) DEFAULT NULL,
  `CostoDif` DOUBLE(15,3) DEFAULT NULL,
  `TourPqt1` INT(11) DEFAULT NULL,
  `TourPqt2` INT(11) DEFAULT NULL,
  `TourPqt3` INT(11) DEFAULT NULL,
  `TourPqt4` INT(11) DEFAULT NULL,
  `TourPqt5` INT(11) DEFAULT NULL,
  `CostoTourPqt1` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt2` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt3` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt4` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt5` DOUBLE(15,3) DEFAULT NULL,
  `CostearPQT` TINYINT(1) DEFAULT NULL,
  `PickUp` VARCHAR(40) DEFAULT NULL,
  `LocacionOriginal` INT(11) DEFAULT NULL,
  `CostoServicio` DOUBLE(15,3) DEFAULT NULL,
  `VentaServicio` DOUBLE(15,3) DEFAULT NULL,
  `Consecutivo` INT(11) NOT NULL,
  `Costeado` TINYINT(1) DEFAULT NULL,
  `TP` VARCHAR(1) NOT NULL,
  `ImportePagado` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaHabiente1` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente2` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente3` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente4` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente5` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente6` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente7` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente8` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente9` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente10` VARCHAR(30) DEFAULT NULL,
  `FormaDePago` INT(11) DEFAULT NULL,
  `BancoPago` INT(11) DEFAULT NULL,
  `TourRegalo` INT(11) DEFAULT NULL,
  `FacturaRA` VARCHAR(10) DEFAULT NULL,
  `FechaFactRA` DATE DEFAULT NULL,
  `TCFactRA` DOUBLE(15,3) DEFAULT NULL,
  `Domicilio` VARCHAR(100) DEFAULT NULL,
  `Ciudad` VARCHAR(30) DEFAULT NULL,
  `Estado` VARCHAR(30) DEFAULT NULL,
  `Pais` VARCHAR(30) DEFAULT NULL,
  `ComisRepPagada` DOUBLE(15,2) DEFAULT 0.00,
  `FacturaSerie` CHAR(3) DEFAULT NULL,
  `FacturaFolio` INT(11) DEFAULT NULL,
  `Validado` TINYINT(2) DEFAULT NULL,
  `facturaID` INT(11) DEFAULT 0,
  PRIMARY KEY (`Serie`,`Folio`,`ID`,`TP`) USING BTREE,
  KEY `Consecutivo` (`Consecutivo`) USING BTREE
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=DBISAM_translamex_cupones' `table_type`=ODBC `tabname`='cupones'

##Local tables
CREATE TABLE `cupones` (
  `Serie` VARCHAR(2) NOT NULL,
  `Folio` INT(11) NOT NULL,
  `Locacion` INT(11) DEFAULT NULL,
  `Vendedor` VARCHAR(5) DEFAULT NULL,
  `Fecha` DATE DEFAULT NULL,
  `Tour` INT(11) DEFAULT NULL,
  `Adultos` INT(11) DEFAULT NULL,
  `Ninos` INT(11) DEFAULT NULL,
  `PrecioAdulto` DOUBLE(15,3) DEFAULT NULL,
  `PrecioNino` DOUBLE(15,3) DEFAULT NULL,
  `VentaAdulto` DOUBLE(15,3) DEFAULT NULL,
  `VentaNino` DOUBLE(15,3) DEFAULT NULL,
  `NumeroCosto` INT(11) DEFAULT NULL,
  `Status` VARCHAR(1) DEFAULT NULL,
  `Nombre` VARCHAR(50) DEFAULT NULL,
  `Hotel` VARCHAR(30) DEFAULT NULL,
  `Habitacion` VARCHAR(10) DEFAULT NULL,
  `Hora` VARCHAR(8) DEFAULT NULL,
  `NumTarjeta` VARCHAR(4) DEFAULT NULL,
  `Cliente` VARCHAR(10) DEFAULT NULL,
  `RegaloUSD` DOUBLE(15,3) DEFAULT NULL,
  `RegaloPesos` DOUBLE(15,3) DEFAULT NULL,
  `TCDolar` DOUBLE(15,3) DEFAULT NULL,
  `TasaComVend` DOUBLE(15,3) DEFAULT NULL,
  `TasaComLoc` DOUBLE(15,3) DEFAULT NULL,
  `ComisVend` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup` DOUBLE(15,3) DEFAULT NULL,
  `ComisLoc` DOUBLE(15,3) DEFAULT NULL,
  `Reembolso` DOUBLE(15,3) DEFAULT NULL,
  `TipoTour` VARCHAR(1) DEFAULT NULL,
  `Proveedor` INT(11) DEFAULT NULL,
  `TipoPago` SMALLINT(6) DEFAULT NULL,
  `TasaComision` DOUBLE(15,3) DEFAULT NULL,
  `Confirmacion` VARCHAR(30) DEFAULT NULL,
  `TarjetaPesos2` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos3` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares2` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares3` DOUBLE(15,3) DEFAULT NULL,
  `NumTarjeta2` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta3` VARCHAR(4) DEFAULT NULL,
  `FolioRegalo` VARCHAR(8) DEFAULT NULL,
  `TarjetaPesos` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares` DOUBLE(15,3) DEFAULT NULL,
  `Facturado` TINYINT(2) DEFAULT NULL,
  `Factura` CHAR(20) DEFAULT NULL,
  `FechaFact` DATE DEFAULT NULL,
  `CostoAdulto` DOUBLE(15,3) DEFAULT NULL,
  `CostoNino` DOUBLE(15,3) DEFAULT NULL,
  `ComisBanco` DOUBLE(15,3) DEFAULT NULL,
  `TCFactura` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos4` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos5` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos6` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos7` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos8` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos9` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaPesos10` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares4` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares5` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares6` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares7` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares8` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares9` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaDolares10` DOUBLE(15,3) DEFAULT NULL,
  `NumTarjeta4` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta5` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta6` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta7` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta8` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta9` VARCHAR(4) DEFAULT NULL,
  `NumTarjeta10` VARCHAR(4) DEFAULT NULL,
  `AdultosR` INT(11) DEFAULT NULL,
  `NinosR` INT(11) DEFAULT NULL,
  `Destino` INT(11) DEFAULT NULL,
  `ID` SMALLINT(6) NOT NULL,
  `RefID` INT(11) DEFAULT NULL,
  `Comentarios` VARCHAR(100) DEFAULT NULL,
  `Descuento` DOUBLE(15,3) DEFAULT NULL,
  `MesesCredito` INT(11) DEFAULT NULL,
  `Salida` DATE DEFAULT NULL,
  `ComisSup2` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup3` DOUBLE(15,3) DEFAULT NULL,
  `ComisTranslamex` DOUBLE(15,3) DEFAULT NULL,
  `Manual` TINYINT(1) DEFAULT NULL,
  `FechaCaptura` DATE DEFAULT NULL,
  `Dolares` DOUBLE(15,3) DEFAULT NULL,
  `Pesos` DOUBLE(15,3) DEFAULT NULL,
  `Boletinado` TINYINT(1) DEFAULT NULL,
  `BoletinadoPor` VARCHAR(100) DEFAULT NULL,
  `SerieReemp` VARCHAR(2) DEFAULT NULL,
  `FolioReemp` INT(11) DEFAULT NULL,
  `FechaReemp` DATE DEFAULT NULL,
  `ObservReemp` VARCHAR(100) DEFAULT NULL,
  `Convertidor` TINYINT(1) DEFAULT NULL,
  `ComisSup4` DOUBLE(15,3) DEFAULT NULL,
  `EMail` VARCHAR(50) DEFAULT NULL,
  `Telefono` VARCHAR(20) DEFAULT NULL,
  `ComisSup5` DOUBLE(15,3) DEFAULT NULL,
  `ComisSup6` DOUBLE(15,3) DEFAULT NULL,
  `IDReemp` SMALLINT(6) DEFAULT NULL,
  `Cliente2` VARCHAR(10) DEFAULT NULL,
  `RegaloPesos2` DOUBLE(15,3) DEFAULT NULL,
  `RegaloUSD2` DOUBLE(15,3) DEFAULT NULL,
  `FolioRegalo2` VARCHAR(8) DEFAULT NULL,
  `Ingreso` INT(11) DEFAULT NULL,
  `GrupoTour` INT(11) DEFAULT NULL,
  `Cerrado` TINYINT(1) DEFAULT NULL,
  `TipoPago2` SMALLINT(6) DEFAULT NULL,
  `TipoPago3` SMALLINT(6) DEFAULT NULL,
  `TipoPago4` SMALLINT(6) DEFAULT NULL,
  `TipoPago5` SMALLINT(6) DEFAULT NULL,
  `TipoPago6` SMALLINT(6) DEFAULT NULL,
  `TipoPago7` SMALLINT(6) DEFAULT NULL,
  `TipoPago8` SMALLINT(6) DEFAULT NULL,
  `TipoPago9` SMALLINT(6) DEFAULT NULL,
  `TipoPago10` SMALLINT(6) DEFAULT NULL,
  `CostoAdulto2` DOUBLE(15,3) DEFAULT NULL,
  `CostoNino2` DOUBLE(15,3) DEFAULT NULL,
  `Infantes` INT(11) DEFAULT NULL,
  `TipoCliente` INT(11) DEFAULT NULL,
  `Observaciones` LONGTEXT DEFAULT NULL,
  `ToursPQT` VARCHAR(5) DEFAULT NULL,
  `Tours` INT(11) DEFAULT NULL,
  `TarjetaEstVida` VARCHAR(14) DEFAULT NULL,
  `CostoDif` DOUBLE(15,3) DEFAULT NULL,
  `TourPqt1` INT(11) DEFAULT NULL,
  `TourPqt2` INT(11) DEFAULT NULL,
  `TourPqt3` INT(11) DEFAULT NULL,
  `TourPqt4` INT(11) DEFAULT NULL,
  `TourPqt5` INT(11) DEFAULT NULL,
  `CostoTourPqt1` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt2` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt3` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt4` DOUBLE(15,3) DEFAULT NULL,
  `CostoTourPqt5` DOUBLE(15,3) DEFAULT NULL,
  `CostearPQT` TINYINT(1) DEFAULT NULL,
  `PickUp` VARCHAR(40) DEFAULT NULL,
  `LocacionOriginal` INT(11) DEFAULT NULL,
  `CostoServicio` DOUBLE(15,3) DEFAULT NULL,
  `VentaServicio` DOUBLE(15,3) DEFAULT NULL,
  `Consecutivo` INT(11) NOT NULL AUTO_INCREMENT,
  `Costeado` TINYINT(1) DEFAULT NULL,
  `TP` VARCHAR(1) NOT NULL,
  `ImportePagado` DOUBLE(15,3) DEFAULT NULL,
  `TarjetaHabiente1` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente2` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente3` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente4` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente5` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente6` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente7` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente8` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente9` VARCHAR(30) DEFAULT NULL,
  `TarjetaHabiente10` VARCHAR(30) DEFAULT NULL,
  `FormaDePago` INT(11) DEFAULT NULL,
  `BancoPago` INT(11) DEFAULT NULL,
  `TourRegalo` INT(11) DEFAULT NULL,
  `FacturaRA` VARCHAR(10) DEFAULT NULL,
  `FechaFactRA` DATE DEFAULT NULL,
  `TCFactRA` DOUBLE(15,3) DEFAULT NULL,
  `Domicilio` VARCHAR(100) DEFAULT NULL,
  `Ciudad` VARCHAR(30) DEFAULT NULL,
  `Estado` VARCHAR(30) DEFAULT NULL,
  `Pais` VARCHAR(30) DEFAULT NULL,
  `ComisRepPagada` DOUBLE(15,2) DEFAULT 0.00,
  `FacturaSerie` CHAR(3) DEFAULT NULL,
  `FacturaFolio` INT(11) DEFAULT NULL,
  `Validado` TINYINT(2) DEFAULT NULL,
  `FacturaID` INT(11) DEFAULT 0,
  PRIMARY KEY (`Serie`,`Folio`,`ID`,`TP`),
  UNIQUE KEY `idxConsecutivo` (`Consecutivo`),
  KEY `idxFacturaRA` (`FacturaRA`),
  KEY `idxFecha` (`Fecha`,`Locacion`),
  KEY `idxLocacion` (`Locacion`),
  KEY `idxProveedor` (`Proveedor`,`Factura`),
  KEY `idxProveedorFacturaID` (`Proveedor`,`FacturaID`),
  KEY `idxProveedorFecha` (`Proveedor`,`Fecha`),
  KEY `idxProveedorSerieFolio` (`Proveedor`,`Serie`,`Folio`),
  KEY `idxReemplazo` (`SerieReemp`,`FolioReemp`),
  KEY `idxRefID` (`RefID`),
  KEY `idxVendedor` (`Vendedor`)
) ENGINE=INNODB AUTO_INCREMENT=576163 DEFAULT CHARSET=utf8

