CREATE TABLE [dbo].[acc_invoices_policies_variables_cies]
(
[invpolvc_invoice_id] [int] NOT NULL,
[invpolvc_policy_situation_id] [int] NOT NULL,
[invpolvc_variable_id] [int] NOT NULL,
[invpolvc_company_id] [int] NOT NULL,
[invpolvc_tf] [dbo].[ais_decimal2] NULL,
[invpolvc_taxes] [dbo].[ais_decimal2] NULL,
[invpolvc_ti] [dbo].[ais_decimal2] NULL,
[invpolvc_commission_tf] [dbo].[ais_decimal2] NULL,
[invpolvc_commission_taxes] [dbo].[ais_decimal2] NULL,
[invpolvc_commission_ti] [dbo].[ais_decimal2] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_cies] ADD CONSTRAINT [PK_acc_invoices_policies_variables_cies] PRIMARY KEY CLUSTERED  ([invpolvc_invoice_id], [invpolvc_policy_situation_id], [invpolvc_variable_id], [invpolvc_company_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_invoices_policies_variables_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_cies_acc_invoices_policies_variables] FOREIGN KEY ([invpolvc_invoice_id], [invpolvc_policy_situation_id], [invpolvc_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_cies] ADD CONSTRAINT [FK_acc_invoices_policies_variables_cies_act_cies] FOREIGN KEY ([invpolvc_company_id]) REFERENCES [dbo].[act_cies] ([cie_actor_id])
GO
