CREATE TABLE [dbo].[acc_invoices_policies_variables_commission_taxes_cies]
(
[invpolvctc_invoice_id] [int] NOT NULL,
[invpolvctc_policy_situation_id] [int] NOT NULL,
[invpolvctc_variable_id] [int] NOT NULL,
[invpolvctc_tax_id] [int] NOT NULL,
[invpolvctc_company_id] [int] NOT NULL,
[invpolvctc_tax_value] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_commission_taxes_cies] ADD CONSTRAINT [PK_acc_invoices_policies_variables_commission_taxes_cies] PRIMARY KEY CLUSTERED  ([invpolvctc_invoice_id], [invpolvctc_policy_situation_id], [invpolvctc_variable_id], [invpolvctc_tax_id], [invpolvctc_company_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_commission_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_commission_taxes_cies_acc_invoices_policies_variables_commission_taxes] FOREIGN KEY ([invpolvctc_invoice_id], [invpolvctc_policy_situation_id], [invpolvctc_variable_id], [invpolvctc_tax_id]) REFERENCES [dbo].[acc_invoices_policies_variables_commission_taxes] ([invpolvct_invoice_id], [invpolvct_policy_situation_id], [invpolvct_variable_id], [invpolvct_tax_id])
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_commission_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_commission_taxes_cies_act_cies] FOREIGN KEY ([invpolvctc_company_id]) REFERENCES [dbo].[act_cies] ([cie_actor_id])
GO
