[dbo].[RevenueRatingImportedDetail]
CREATE TABLE [dbo].[RevenueRatingImportedDetail]
(
[RevenueRatingImportedDetailID] [int] NOT NULL IDENTITY(1, 1),
[AgentFID] [int] NULL,
[CartonCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Discount] [decimal] (12, 4) NULL,
[DistributionAmount] [decimal] (12, 4) NULL,
[DistributionCode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GrossAmount] [decimal] (12, 4) NULL,
[ImportDateTime] [datetime] NULL,
[InvoiceAmount] [decimal] (12, 4) NULL,
[Quantity] [decimal] (12, 4) NULL,
[Rate] [decimal] (12, 4) NULL,
[RevenueRatingImportedHeaderFID] [int] NOT NULL,
[RevenueType] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BillingMinorFID] [int] NULL,
[BillingMajorFID] [int] NULL,
[OrdersFID] [int] NULL,
[AgentPercentage] [decimal] (12, 4) NULL,
[RevenueRatingImportDetailFID] [int] NULL,
[InvoiceFlag] [bit] NULL,
[CarrierBillingMinorFID] [int] NULL,
[CarrierBillingMajorFID] [int] NULL,
[AddBackFlag] [bit] NULL CONSTRAINT [DF_RevenueRatingImportedDetail_AddBackFlag] DEFAULT ((0)),
[PointOfServiceFID] [int] NULL,
[RateTypeFID] [int] NULL,
[Quantity2] [decimal] (12, 4) NULL,
[MilitaryItemCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MilitaryItemCodeQualifier] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [PK_RevenueRatingImportedDetail] PRIMARY KEY NONCLUSTERED ([RevenueRatingImportedDetailID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedDetail_BillingMinorItem] ON [dbo].[RevenueRatingImportedDetail] ([BillingMinorFID]) INCLUDE ([RevenueRatingImportedHeaderFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedDetail_CarrierBillingMinor] ON [dbo].[RevenueRatingImportedDetail] ([CarrierBillingMinorFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedDetail_RevenueRatingImportDetailFID] ON [dbo].[RevenueRatingImportedDetail] ([RevenueRatingImportDetailFID]) INCLUDE ([RevenueRatingImportedDetailID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_RevenueRatingImportedHeaderFID] ON [dbo].[RevenueRatingImportedDetail] ([RevenueRatingImportedHeaderFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [FK_RevenueRatingImportedDetail_Agent] FOREIGN KEY ([AgentFID]) REFERENCES [dbo].[Agent] ([AgentPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [FK_RevenueRatingImportedDetail_PointOfService] FOREIGN KEY ([PointOfServiceFID]) REFERENCES [dbo].[PointOfService] ([PointOfServiceID]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [FK_RevenueRatingImportedDetail_RateType] FOREIGN KEY ([RateTypeFID]) REFERENCES [dbo].[RateTypes] ([RTypePriKey]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [FK_RevenueRatingImportedDetail_RevenueRatingImportDetail] FOREIGN KEY ([RevenueRatingImportDetailFID]) REFERENCES [dbo].[RevenueRatingImportDetail] ([RevenueRatingImportDetailID]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportedDetail] ADD CONSTRAINT [FK_RevenueRatingImportedDetail_RevenueRatingImportedHeader] FOREIGN KEY ([RevenueRatingImportedHeaderFID]) REFERENCES [dbo].[RevenueRatingImportedHeader] ([RevenueRatingImportedHeaderID])
GO
GRANT SELECT ON [dbo].[RevenueRatingImportedDetail] TO [MssExec]
GRANT INSERT ON [dbo].[RevenueRatingImportedDetail] TO [MssExec]
GRANT DELETE ON [dbo].[RevenueRatingImportedDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[RevenueRatingImportedDetail] TO [MssExec]
GO