CREATE TABLE
[ERP2011].[Accounts].[AcSubType] (
[AcSubTypeID] int IDENTITY (1, 1) NOT NULL,
[SubTypeNAme] varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AcType] int NOT NULL,
[Sys] bit NULL,
[Locked] bit NULL,
CONSTRAINT [PK_AcSubTypeID] PRIMARY KEY CLUSTERED ([AcSubTypeID]) ,
CONSTRAINT [FK_AcTypeID] FOREIGN KEY ([AcType]) REFERENCES
[ERP2011].[Accounts].[AcType] ([AcTypeID]) ) ;
CREATE TABLE
[ERP2011].[Accounts].[AcTransRules] (
[TransRuleID] int IDENTITY (1, 1) NOT NULL,
[RuleNmae] varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TransType] varchar (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DebtTo] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreditTo] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SysRule] bit NULL,
[IsPrivate_Rule] bit CONSTRAINT [DF_AcTransRules_IsPrivate_Rule] DEFAULT(((0) ) ) NULL,
[Private_Rule_Owner] varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Locked] bit NULL,
CONSTRAINT [PK_AcTransRule_ID] PRIMARY KEY CLUSTERED ([TransRuleID]) ,
CONSTRAINT [FK_AcTransRules_TransType] FOREIGN KEY ([TransType]) REFERENCES
[ERP2011].[Accounts].[TransType] ([TransType]) ) ;
CREATE TABLE
[ERP2011].[Accounts].[AcTransSub] (
[TransID] bigint IDENTITY (1, 1) NOT NULL,
[TransDesc] varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TransDate] datetime NOT NULL,
[Childof] int NULL,
[Debit] money NOT NULL,
[Credit] money NOT NULL,
[AcID] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Ref] varchar (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AcTRansRule] int NULL,
[Project_ID] int NULL,
[Bank_TransSub_ID] bigint NULL,
[Invoice_ID] bigint NULL,
CONSTRAINT [PK_AcTrans_ID] PRIMARY KEY CLUSTERED ([TransID]) ,
CONSTRAINT [FK_ACID] FOREIGN KEY ([AcID]) REFERENCES
[ERP2011].[Accounts].[Accounts] ([AcID]) ,
CONSTRAINT [FK_AcTransSub_AcTransRules] FOREIGN KEY ([AcTRansRule]) REFERENCES
[ERP2011].[Accounts].[AcTransRules] ([TransRuleID]) ,
CONSTRAINT [FK_AcTransSub_BankTransSub] FOREIGN KEY ([Bank_TransSub_ID]) REFERENCES
[ERP2011].[Accounts].[BankTransSub] ([Bank_TransSub_ID]) ,
CONSTRAINT [FK_AcTransSub_Projects] FOREIGN KEY ([Project_ID]) REFERENCES
[ERP2011].[Projects].[Projects] ([ProjectID]) ) ;
CREATE TABLE
[ERP2011].[Accounts].[AcTransSubDetail] (
[Trans_SubDetail_ID] bigint IDENTITY (1, 1) NOT NULL,
[DetailDesc] varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Qty] int NULL,
[Rate] money NULL,
[Unit] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AcTransSub_ID] bigint NOT NULL,
CONSTRAINT [PK_Trans_SubDetail_ID] PRIMARY KEY CLUSTERED ([Trans_SubDetail_ID]) ,
CONSTRAINT [FK_AcTransSubDetail_TransID] FOREIGN KEY ([AcTransSub_ID]) REFERENCES
[ERP2011].[Accounts].[AcTransSub] ([TransID]) ) ;
CREATE TABLE
[ERP2011].[Accounts].[AcType] (
[AcTypeID] int IDENTITY (1, 1) NOT NULL,
[AcTypeName] varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_AcTypeID] PRIMARY KEY CLUSTERED ([AcTypeID]) ) ;
CREATE TABLE
[ERP2011].[Accounts].[Accounts] (
[AcID] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AutoCount] int IDENTITY (1, 1) NOT NULL,
[AcName] varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AcSubType] int NOT NULL,
[SysAc] bit NULL,
[Disabled] bit NULL,
[DateCre] datetime NULL,
[DateClosing] datetime NULL,
[DateReOpen] datetime NULL,
[Childof] varchar (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Vendor_ID] int NULL,
[Client_ID] int NULL,
[Employee_ID] int NULL,
CONSTRAINT [PK_AcID_1] PRIMARY KEY CLUSTERED ([AcID]) ,
CONSTRAINT [FK_AcSubType] FOREIGN KEY ([AcSubType]) REFERENCES
[ERP2011].[Accounts].[AcSubType] ([AcSubTypeID]) ,
CONSTRAINT [FK_ParentAcID] FOREIGN KEY ([AcID]) REFERENCES
[ERP2011].[Accounts].[Accounts] ([AcID]) ) ;
No comments:
Post a Comment