[dbo].[StorageInvoiceHistorical]
CREATE TABLE [dbo].[StorageInvoiceHistorical]
(
[StorageInvoiceHistoricalID] [int] NOT NULL IDENTITY(1, 1),
[SessionID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[StorageTypeFID] [int] NULL,
[BranchFID] [int] NULL,
[BillStartDate] [datetime] NOT NULL,
[BillEndDate] [datetime] NOT NULL,
[GeneratedDate] [datetime] NOT NULL,
[InvoiceCount] [int] NOT NULL,
[PaymentCount] [int] NOT NULL CONSTRAINT [DF_StorageInvoiceHistorical_PaymentCount] DEFAULT ((0)),
[OnlinePaymentCount] [int] NOT NULL CONSTRAINT [DF_StorageInvoiceHistorical_OnlinePaymentCount] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageInvoiceHistorical] ADD CONSTRAINT [PK_StorageInvoiceHistorical] PRIMARY KEY NONCLUSTERED ([StorageInvoiceHistoricalID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageInvoiceHistorical_SessionID] ON [dbo].[StorageInvoiceHistorical] ([SessionID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageInvoiceHistorical] ADD CONSTRAINT [FK_StorageInvoiceHistorical_Branch] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[StorageInvoiceHistorical] ADD CONSTRAINT [FK_StorageInvoiceHistorical_StorageType] FOREIGN KEY ([StorageTypeFID]) REFERENCES [dbo].[StorageType] ([StorageTypePriKey])
GO
GRANT SELECT ON [dbo].[StorageInvoiceHistorical] TO [MssExec]
GRANT INSERT ON [dbo].[StorageInvoiceHistorical] TO [MssExec]
GRANT DELETE ON [dbo].[StorageInvoiceHistorical] TO [MssExec]
GRANT UPDATE ON [dbo].[StorageInvoiceHistorical] TO [MssExec]
GO