CREATE TABLE LogFinanc ( 
IdFmto INT DEFAULT ((0)) NOT NULL,
DescFormato VARCHAR(100)
 CONSTRAINT PK_LogFinanc PRIMARY KEY CLUSTERED (IdFmto))
CREATE TABLE LogFinancConc ( 
IdFmto INT DEFAULT ((0)) NOT NULL,
IdConc INT DEFAULT ((0)) NOT NULL,
Concepto VARCHAR(250) NOT NULL,
IdGrupo INT DEFAULT ((0)) NOT NULL,
TipoConc INT DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_LogFinancConc PRIMARY KEY CLUSTERED (IdFmto,IdConc),
 CONSTRAINT CK_LogFinancConcConcepto CHECK ((len([Concepto])>(0))))
CREATE TABLE LogFinancCue ( 
IdFmto INT DEFAULT ((0)) NOT NULL,
IdConc INT DEFAULT ((0)) NOT NULL,
Item INT DEFAULT ((0)) NOT NULL,
TipoOper VARCHAR(10) NOT NULL,
SimbOper CHAR(1) NOT NULL,
CueInicial VARCHAR(250),
CueFinal VARCHAR(250),
TipoCol VARCHAR(50)
 CONSTRAINT PK_LogFinancCue PRIMARY KEY CLUSTERED (IdFmto,IdConc,Item),
 CONSTRAINT CK_LogFinancCueSimbOper CHECK ((len([SimbOper])>(0))),
 CONSTRAINT CK_LogFinancCueTipoOper CHECK ((len([TipoOper])>(0))))
CREATE TABLE LogFinancGrupos ( 
IdFmto INT DEFAULT ((0)) NOT NULL,
IdGrupo INT DEFAULT ((0)) NOT NULL,
DescGrupo VARCHAR(100) NOT NULL
 CONSTRAINT PK_LogFinancGrupos PRIMARY KEY CLUSTERED (IdFmto,IdGrupo),
 CONSTRAINT CK_LogFinancGruposDescGrupo CHECK ((len([DescGrupo])>(0))))
CREATE TABLE LogFinancRep ( 
IdTnal CHAR(2) NOT NULL,
IdFmto INT DEFAULT ((0)) NOT NULL,
Item INT DEFAULT ((0)) NOT NULL,
IdConc INT DEFAULT ((0)) NOT NULL,
IdCuenta VARCHAR(16) NOT NULL,
NomCuenta VARCHAR(150),
Descripcion VARCHAR(250) NOT NULL,
SaldoAntEne DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosEne DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosEne DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntFeb DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosFeb DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosFeb DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntMar DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosMar DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosMar DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntAbr DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosAbr DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosAbr DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntMay DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosMay DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosMay DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntJun DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosJun DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosJun DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntJul DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosJul DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosJul DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntAgo DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosAgo DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosAgo DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntSep DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosSep DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosSep DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntOct DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosOct DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosOct DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntNov DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosNov DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosNov DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntDic DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosDic DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosDic DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
SaldoAntM13 DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
DebitosM13 DECIMAL(16,4) DEFAULT ((0)) NOT NULL,
CreditosM13 DECIMAL(16,4) DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_LogFinancRep PRIMARY KEY NONCLUSTERED (IdTnal,IdFmto,Item),
 CONSTRAINT CK_LogFinancRepDescripcion CHECK ((len([Descripcion])>(0))),
 CONSTRAINT CK_LogFinancRepIdCuenta CHECK ((len([IdCuenta])>(0))),
 CONSTRAINT CK_LogFinancRepIdTnal CHECK ((len([IdTnal])>(0))))
GO
 CREATE CLUSTERED INDEX IX_LogFinancRepIdCuenta ON LogFinancRep(IdTnal,IdFmto,IdConc,IdCuenta)

