[dbo].[BillingMinorReduction]
CREATE TABLE [dbo].[BillingMinorReduction]
(
[BillingMinorReductionID] [int] NOT NULL IDENTITY(1, 1),
[BillingMinorItemFID] [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_BillingMinorReduction_ReductionAmount] DEFAULT ((0)),
[ReductionTemplateFID] [int] NULL,
[BranchFID] [int] NULL,
[ARBranchFID] [int] NULL,
[ARDivisionFID] [int] NULL,
[IsAddbackBasedOnAgentPercentage] [bit] NOT NULL CONSTRAINT [DF_BillingMinorReduction_IsAddbackBasedOnAgentPercentage] DEFAULT ((0)),
[AgentPercentage] [float] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [PK_BillingMinorReduction] PRIMARY KEY NONCLUSTERED ([BillingMinorReductionID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BillingMinorReduction_BillingMinorItemAddBack] ON [dbo].[BillingMinorReduction] ([BillingMinorItemAddBackFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_BillingMinorReduction_BillingMinorItem_BillingMinorItemAddBack] ON [dbo].[BillingMinorReduction] ([BillingMinorItemFID], [BillingMinorItemAddBackFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ARBranchFID] FOREIGN KEY ([ARBranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ARDivision] FOREIGN KEY ([ARDivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_BillingMinorItemAddBack] FOREIGN KEY ([BillingMinorItemAddBackFID]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_BillingMinorItem] FOREIGN KEY ([BillingMinorItemFID]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_BranchFID] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_Division] FOREIGN KEY ([DivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ItemCode] FOREIGN KEY ([ItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ReductionBasis] FOREIGN KEY ([ReductionBasisFID]) REFERENCES [dbo].[ReductionBasis] ([ReductionBasisID])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ReductionTemplateHeader] FOREIGN KEY ([ReductionTemplateFID]) REFERENCES [dbo].[ReductionTemplateHeader] ([ReductionTemplateID])
GO
ALTER TABLE [dbo].[BillingMinorReduction] ADD CONSTRAINT [FK_BillingMinorReduction_ReductionType] FOREIGN KEY ([ReductionTypeFID]) REFERENCES [dbo].[ReductionType] ([ReductionTypeID])
GO
GRANT SELECT ON [dbo].[BillingMinorReduction] TO [MssExec]
GRANT INSERT ON [dbo].[BillingMinorReduction] TO [MssExec]
GRANT DELETE ON [dbo].[BillingMinorReduction] TO [MssExec]
GRANT UPDATE ON [dbo].[BillingMinorReduction] TO [MssExec]
GO