[dbo].[BillingMajorReduction]
CREATE TABLE [dbo].[BillingMajorReduction]
(
[BillingMajorReductionID] [int] NOT NULL IDENTITY(1, 1),
[BillingMajorItemFID] [int] NOT NULL,
[ReductionTypeFID] [int] NOT NULL,
[ReductionBasisFID] [int] NULL,
[BillingMinorItemAddBackFID] [int] NULL,
[ItemCodeFID] [int] NULL,
[DivisionFID] [int] NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Percentage] [decimal] (10, 3) NULL,
[ReductionAmount] [money] NOT NULL CONSTRAINT [DF_BillingMajorReduction_ReductionAmount] DEFAULT ((0)),
[ReductionTemplateFID] [int] NULL,
[BranchFID] [int] NULL,
[ARBranchFID] [int] NULL,
[ARDivisionFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [PK_BillingMajorReduction] PRIMARY KEY NONCLUSTERED ([BillingMajorReductionID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BillingMajorReduction_BillingMajorItemFID] ON [dbo].[BillingMajorReduction] ([BillingMajorItemFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BillingMajorReduction_BillingMinorItemAddBack] ON [dbo].[BillingMajorReduction] ([BillingMinorItemAddBackFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ARBranchFID] FOREIGN KEY ([ARBranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ARDivision] FOREIGN KEY ([ARDivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_BillingMajorItem] FOREIGN KEY ([BillingMajorItemFID]) REFERENCES [dbo].[BillingMajorItem] ([BMajPriKey])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_BillingMinorItemAddBack] FOREIGN KEY ([BillingMinorItemAddBackFID]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_BranchFID] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_Division] FOREIGN KEY ([DivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ItemCode] FOREIGN KEY ([ItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ReductionBasis] FOREIGN KEY ([ReductionBasisFID]) REFERENCES [dbo].[ReductionBasis] ([ReductionBasisID])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ReductionTemplateHeader] FOREIGN KEY ([ReductionTemplateFID]) REFERENCES [dbo].[ReductionTemplateHeader] ([ReductionTemplateID])
GO
ALTER TABLE [dbo].[BillingMajorReduction] ADD CONSTRAINT [FK_BillingMajorReduction_ReductionType] FOREIGN KEY ([ReductionTypeFID]) REFERENCES [dbo].[ReductionType] ([ReductionTypeID])
GO
GRANT SELECT ON [dbo].[BillingMajorReduction] TO [MssExec]
GRANT INSERT ON [dbo].[BillingMajorReduction] TO [MssExec]
GRANT DELETE ON [dbo].[BillingMajorReduction] TO [MssExec]
GRANT UPDATE ON [dbo].[BillingMajorReduction] TO [MssExec]
GO