ALTER TABLE Trn_TraCumplido ADD MvoAnulaCump VARCHAR(5),ObservAnulado VARCHAR(250)
GO
ALTER TABLE Trn_AfPartes ADD CantCuoIni INT DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_AfAmtDetalle ADD CantCuotasIni INT DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_AfDetalle ADD CantMeses INT DEFAULT(0) NOT NULL
GO
CREATE TABLE tm_NiifGyp ( 
tmEst CHAR(2) DEFAULT ('01') NOT NULL,
tmIdCuenta VARCHAR(16) NOT NULL,
tmItem INT DEFAULT ((0)) NOT NULL,
tmIdCia CHAR(2) DEFAULT ('00') NOT NULL,
tmIdTercero VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdVehiculo VARCHAR(10) DEFAULT ('0') NOT NULL,
tmIdCCosto VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdSubCos VARCHAR(16) DEFAULT ('0') NOT NULL,
tmCodAgncia VARCHAR(16) DEFAULT ('0') NOT NULL,
tmTipo VARCHAR(4) DEFAULT ('0') NOT NULL,
tmTipoAfi INT DEFAULT ((0)) NOT NULL,
tmSaldoAnterior MONEY DEFAULT ((0)) NOT NULL,
tmTotalDebitos MONEY DEFAULT ((0)) NOT NULL,
tmTotalCreditos MONEY DEFAULT ((0)) NOT NULL,
tmNuevoSaldo MONEY DEFAULT ((0)) NOT NULL,
tmSalAnt2 MONEY DEFAULT ((0)) NOT NULL,
tmDebitos2 MONEY DEFAULT ((0)) NOT NULL,
tmCreditos2 MONEY DEFAULT ((0)) NOT NULL,
tmSaldo2 MONEY DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_tm_NiifGyp PRIMARY KEY CLUSTERED (tmEst,tmIdCuenta,tmItem),
 CONSTRAINT CK_tm_NiifGyptmCodAgncia CHECK ((len([tmCodAgncia])>(0))),
 CONSTRAINT CK_tm_NiifGyptmEst CHECK ((len([tmEst])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdCCosto CHECK ((len([tmIdCCosto])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdCia CHECK ((len([tmIdCia])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdCuenta CHECK ((len([tmIdCuenta])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdSubCos CHECK ((len([tmIdSubCos])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdTercero CHECK ((len([tmIdTercero])>(0))),
 CONSTRAINT CK_tm_NiifGyptmIdVehiculo CHECK ((len([tmIdVehiculo])>(0))),
 CONSTRAINT CK_tm_NiifGyptmTipo CHECK ((len([tmTipo])>(0))))
GO
 CREATE NONCLUSTERED INDEX IX_tm_NiifGyptmIdTercero ON tm_NiifGyp(tmIdTercero,tmCodAgncia)
 CREATE NONCLUSTERED INDEX IX_tm_NiifGyptmIdCCosto ON tm_NiifGyp(tmIdCCosto)
 CREATE NONCLUSTERED INDEX IX_tm_NiifGyptmIdSubCos ON tm_NiifGyp(tmIdSubCos)
