[dbo].[CustomerStatementInvoiceGroup]
CREATE TABLE [dbo].[CustomerStatementInvoiceGroup]
(
[CustomerStatementInvoiceGroupID] [int] NOT NULL IDENTITY(1, 1),
[CustomerStatementOrderGroupFID] [int] NOT NULL,
[CustomerStatementDocumentTypeFID] [int] NOT NULL,
[InvoiceNumber] [varchar] (31) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[InvoiceDate] [datetime] NULL,
[Amount] [money] NOT NULL,
[Status] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementInvoiceGroup_Status] DEFAULT (''),
[Visible] [bit] NOT NULL CONSTRAINT [DF_CustomerStatementInvoiceGroup_Visible] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementInvoiceGroup] ADD CONSTRAINT [PK_CustomerStatementInvoiceGroup] PRIMARY KEY NONCLUSTERED ([CustomerStatementInvoiceGroupID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_CustomerStatementInvoiceGroup_OrderGroupFID] ON [dbo].[CustomerStatementInvoiceGroup] ([CustomerStatementOrderGroupFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CustomerStatementInvoiceGroup_InvoiceNumber] ON [dbo].[CustomerStatementInvoiceGroup] ([InvoiceNumber]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementInvoiceGroup] ADD CONSTRAINT [FK_CustomerStatementInvoiceGroup_CustomerStatementDocumentType] FOREIGN KEY ([CustomerStatementDocumentTypeFID]) REFERENCES [dbo].[CustomerStatementDocumentType] ([CustomerStatementDocumentTypeID])
GO
ALTER TABLE [dbo].[CustomerStatementInvoiceGroup] ADD CONSTRAINT [FK_CustomerStatementInvoiceGroup_CustomerStatementOrderGroup] FOREIGN KEY ([CustomerStatementOrderGroupFID]) REFERENCES [dbo].[CustomerStatementOrderGroup] ([CustomerStatementOrderGroupID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[CustomerStatementInvoiceGroup] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerStatementInvoiceGroup] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerStatementInvoiceGroup] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerStatementInvoiceGroup] TO [MssExec]
GO