CREATE TABLE [dbo].[acc_bordereaux_variables_commission_taxes]
(
[bdrvctx_bordereau_id] [int] NOT NULL,
[bdrvctx_invoice_id] [int] NOT NULL,
[bdrvctx_variable_id] [int] NOT NULL,
[bdrvctx_tax_id] [int] NOT NULL,
[bdrvctx_tax_value] [dbo].[ais_decimal2] NULL,
[bdrvctx_payable_company] [bit] NOT NULL CONSTRAINT [DF__acc_bordereaux_variables_commission_taxes__bdrvctx_payable_company] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_commission_taxes] ADD CONSTRAINT [PK_acc_bordereaux_variables_commission_taxes] PRIMARY KEY CLUSTERED  ([bdrvctx_bordereau_id], [bdrvctx_invoice_id], [bdrvctx_variable_id], [bdrvctx_tax_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_commission_taxes] ADD CONSTRAINT [FK_acc_bordereaux_variables_commission_taxes_acc_bordereaux_variables] FOREIGN KEY ([bdrvctx_bordereau_id], [bdrvctx_invoice_id], [bdrvctx_variable_id]) REFERENCES [dbo].[acc_bordereaux_variables] ([bdrv_bordereau_id], [bdrv_invoice_id], [bdrv_variable_id])
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_commission_taxes] ADD CONSTRAINT [FK_acc_bordereaux_variables_commission_taxes_acc_taxes] FOREIGN KEY ([bdrvctx_tax_id]) REFERENCES [dbo].[acc_taxes] ([acctax_tax_id])
GO
