CREATE TABLE tm_ccCupones ( 
tmEst CHAR(2) DEFAULT ('01') NOT NULL,
tmItem INT DEFAULT (0) NOT NULL,
tmTipoReg INT DEFAULT (1) NOT NULL,
tmTipDoc VARCHAR(3) NOT NULL,
tmDocumento INT DEFAULT (0) NOT NULL,
tmIdCia CHAR(2) DEFAULT ('01') NOT NULL,
tmItemDoc INT DEFAULT (0) NOT NULL,
tmFecEmision SMALLDATETIME NOT NULL,
tmFecVence SMALLDATETIME NOT NULL,
tmValorFactura MONEY DEFAULT (0) NOT NULL,
tmValorAbono MONEY DEFAULT (0) NOT NULL,
tmIdPropietario VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdVehiculo VARCHAR(10) DEFAULT ('0') NOT NULL,
tmIdConductor VARCHAR(16) NOT NULL,
tmIdCargo VARCHAR(4) DEFAULT ('0') NOT NULL,
tmIdClase VARCHAR(4) DEFAULT ('0') NOT NULL,
tmFactura VARCHAR(15),
tmReferencia VARCHAR(50),
tmDetalle VARCHAR(100),
tmDescuento MONEY DEFAULT (0) NOT NULL
 CONSTRAINT PK_tm_ccCupones PRIMARY KEY CLUSTERED (tmEst,tmItem),
 CONSTRAINT CK_tm_ccCuponestmEst CHECK ((len([tmEst]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdCargo CHECK ((len([tmIdCargo]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdCia CHECK ((len([tmIdCia]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdClase CHECK ((len([tmIdClase]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdConductor CHECK ((len([tmIdConductor]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdPropietario CHECK ((len([tmIdPropietario]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmIdVehiculo CHECK ((len([tmIdVehiculo]) > 0)),
 CONSTRAINT CK_tm_ccCuponestmTipDoc CHECK ((len([tmTipDoc]) > 0)))
GO
CREATE NONCLUSTERED INDEX IX_tm_ccCuponestmIdVehiculo ON tm_ccCupones(tmIdVehiculo)
 CREATE NONCLUSTERED INDEX IX_tm_ccCuponestmDocumento ON tm_ccCupones(tmTipDoc,tmDocumento,tmIdCia)
 CREATE NONCLUSTERED INDEX IX_tm_ccCuponestmIdPropietario ON tm_ccCupones(tmIdPropietario)

INSERT INTO Sys_Report (TipoRep,IdRep,Descripcion,Formato,TipoPapel,Orientacion,VistaPrevia,VerSetup,NumCopias,sp_Nombre,Ind_Location,NomRep)
 VALUES ('LCU','01','Predeterminado','CrCupon.rpt',1,1,1,0,1,'paQrytm_ccCupones','','Cupones de pago')
GO
INSERT INTO Sys_ObjetosApp (IdObj,IdGrupo,SubModulo,IndObj,Nombre,Formulario,Permisos,NivelMinimo,NomArchivo)
 VALUES ('FRMLCPB','BUSINF','GEN',20,'Cupones de pago','FRMLCPB','S',0,'')
GO