CREATE TABLE [dbo].[acc_invoices_risks_variables_commission_taxes_cies]
(
[invrisvctc_invoice_id] [int] NOT NULL,
[invrisvctc_risk_situation_id] [int] NOT NULL,
[invrisvctc_variable_id] [int] NOT NULL,
[invrisvctc_tax_id] [int] NOT NULL,
[invrisvctc_company_id] [int] NOT NULL,
[invrisvctc_tax_value] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_commission_taxes_cies] ADD CONSTRAINT [PK_acc_invoices_risks_variables_commission_taxes_cies] PRIMARY KEY CLUSTERED  ([invrisvctc_invoice_id], [invrisvctc_risk_situation_id], [invrisvctc_variable_id], [invrisvctc_tax_id], [invrisvctc_company_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_commission_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_risks_variables_commission_taxes_cies_acc_invoices_risks_variables_commission_taxes] FOREIGN KEY ([invrisvctc_invoice_id], [invrisvctc_risk_situation_id], [invrisvctc_variable_id], [invrisvctc_tax_id]) REFERENCES [dbo].[acc_invoices_risks_variables_commission_taxes] ([invrisvct_invoice_id], [invrisvct_risk_situation_id], [invrisvct_variable_id], [invrisvct_tax_id])
GO
ALTER TABLE [dbo].[acc_invoices_risks_variables_commission_taxes_cies] ADD CONSTRAINT [FK_acc_invoices_risks_variables_commission_taxes_cies_act_cies] FOREIGN KEY ([invrisvctc_company_id]) REFERENCES [dbo].[act_cies] ([cie_actor_id])
GO
