CREATE TABLE [dbo].[acc_invoices_policies_variables_taxes_cies]
(
[invpolvtc_invoice_id] [int] NOT NULL,
[invpolvtc_policy_situation_id] [int] NOT NULL,
[invpolvtc_variable_id] [int] NOT NULL,
[invpolvtc_tax_id] [int] NOT NULL,
[invpolvtc_company_id] [int] NOT NULL,
[invpolvtc_tax_value] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes_cies] ADD CONSTRAINT [PK_acc_invoices_policies_variables_taxes_cies] PRIMARY KEY CLUSTERED  ([invpolvtc_invoice_id], [invpolvtc_policy_situation_id], [invpolvtc_variable_id], [invpolvtc_tax_id], [invpolvtc_company_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_taxes_cies_acc_invoices_policies_variables_taxes] FOREIGN KEY ([invpolvtc_invoice_id], [invpolvtc_policy_situation_id], [invpolvtc_variable_id], [invpolvtc_tax_id]) REFERENCES [dbo].[acc_invoices_policies_variables_taxes] ([invpolvt_invoice_id], [invpolvt_policy_situation_id], [invpolvt_variable_id], [invpolvt_tax_id])
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_taxes_cies_act_cies] FOREIGN KEY ([invpolvtc_company_id]) REFERENCES [dbo].[act_cies] ([cie_actor_id])
GO
