[dbo].[RevenueRatingImportedHeader]
CREATE TABLE [dbo].[RevenueRatingImportedHeader]
(
[RevenueRatingImportedHeaderID] [int] NOT NULL IDENTITY(1, 1),
[BookingAgentPercentage] [decimal] (12, 4) NULL,
[DestinationAgentPercentage] [decimal] (12, 4) NULL,
[DiscountLineHaul] [decimal] (12, 4) NULL,
[DiscountPercentage] [decimal] (12, 4) NULL,
[HaulingAgentPercentage] [decimal] (12, 4) NULL,
[LineHaul] [decimal] (12, 4) NULL,
[OrderSeg] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PSeg] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OSeg] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SSeg] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OriginAgentPercentage] [decimal] (12, 4) NULL,
[RevenueImportTypeFID] [int] NOT NULL,
[BookingBillingMinorFID] [int] NULL,
[OriginBillingMinorFID] [int] NULL,
[DestinationBillingMinorFID] [int] NULL,
[HaulingBillingMinorFID] [int] NULL,
[OrdersFID] [int] NULL,
[DownloadDateTime] [datetime] NULL,
[ImportDateTime] [datetime] NULL,
[BookingImportDateTime] [datetime] NULL,
[OriginImportDateTime] [datetime] NULL,
[DestinationImportDateTime] [datetime] NULL,
[HaulingImportDateTime] [datetime] NULL,
[XMLInterfaceFID] [int] NOT NULL,
[XmlExternalInterfaceVanlineCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GrossTransportationAmount] [decimal] (12, 4) NULL,
[TotalWeight] [int] NULL,
[CarrierBookingBillingMinorFID] [int] NULL,
[CarrierOriginBillingMinorFID] [int] NULL,
[CarrierDestinationBillingMinorFID] [int] NULL,
[CarrierHaulingBillingMinorFID] [int] NULL,
[IsOwnAuthorityFlag] [bit] NULL CONSTRAINT [DF_RevenueRatingImportedHeader_IsOwnAuthorityFlag] DEFAULT ((0)),
[HaulingItemCodeFID] [int] NULL,
[BookingItemCodeFID] [int] NULL,
[OriginItemCodeFID] [int] NULL,
[DestinationItemCodeFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [PK_REVENUERATINGIMPORTEDHEADER] PRIMARY KEY NONCLUSTERED ([RevenueRatingImportedHeaderID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_CarrierBookingBillingMinor] ON [dbo].[RevenueRatingImportedHeader] ([CarrierBookingBillingMinorFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_CarrierDestinationBillingMinor] ON [dbo].[RevenueRatingImportedHeader] ([CarrierDestinationBillingMinorFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_CarrierHaulingBillingMinor] ON [dbo].[RevenueRatingImportedHeader] ([CarrierHaulingBillingMinorFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_CarrierOriginBillingMinor] ON [dbo].[RevenueRatingImportedHeader] ([CarrierOriginBillingMinorFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_OrderSeg] ON [dbo].[RevenueRatingImportedHeader] ([OrderSeg]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_RevenueRatingImportedHeader_Type_Order] ON [dbo].[RevenueRatingImportedHeader] ([OrdersFID], [RevenueImportTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_RevenueRatingImportedHeader_ItemCode2] FOREIGN KEY ([BookingItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_RevenueRatingImportedHeader_ItemCode4] FOREIGN KEY ([DestinationItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_RevenueRatingImportedHeader_ItemCode1] FOREIGN KEY ([HaulingItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_RevenueRatingImportedHeader_Orders] FOREIGN KEY ([OrdersFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_RevenueRatingImportedHeader_ItemCode3] FOREIGN KEY ([OriginItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_REVENUERATINGIMPORTEDHEADER_REVENUEIMPORTTYPE] FOREIGN KEY ([RevenueImportTypeFID]) REFERENCES [dbo].[RevenueImportType] ([PriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportedHeader] ADD CONSTRAINT [FK_REVENUERATINGIMPORTEDHEADER_XMLINTERFACEFID] FOREIGN KEY ([XMLInterfaceFID]) REFERENCES [dbo].[XmlInterface] ([XmlInterfaceID])
GO
GRANT SELECT ON [dbo].[RevenueRatingImportedHeader] TO [MssExec]
GRANT INSERT ON [dbo].[RevenueRatingImportedHeader] TO [MssExec]
GRANT DELETE ON [dbo].[RevenueRatingImportedHeader] TO [MssExec]
GRANT UPDATE ON [dbo].[RevenueRatingImportedHeader] TO [MssExec]
GO