CREATE TABLE [dbo].[acc_invoices_policies_variables_taxes]
(
[invpolvt_invoice_id] [int] NOT NULL,
[invpolvt_policy_situation_id] [int] NOT NULL,
[invpolvt_variable_id] [int] NOT NULL,
[invpolvt_tax_id] [int] NOT NULL,
[invpolvt_tax_value] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes] ADD CONSTRAINT [PK_acc_invoices_policies_variables_taxes] PRIMARY KEY CLUSTERED  ([invpolvt_invoice_id], [invpolvt_policy_situation_id], [invpolvt_variable_id], [invpolvt_tax_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes] ADD CONSTRAINT [FK_acc_invoices_policies_variables_taxes_acc_invoices_policies_variables] FOREIGN KEY ([invpolvt_invoice_id], [invpolvt_policy_situation_id], [invpolvt_variable_id]) REFERENCES [dbo].[acc_invoices_policies_variables] ([invpolv_invoice_id], [invpolv_policy_situation_id], [invpolv_variable_id])
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes] ADD CONSTRAINT [FK_acc_invoices_policies_variables_taxes_pol_variables_taxes] FOREIGN KEY ([invpolvt_policy_situation_id], [invpolvt_variable_id], [invpolvt_tax_id]) REFERENCES [dbo].[pol_variables_taxes] ([polvt_policy_situation_id], [polvt_variable_id], [polvt_tax_id])
GO
