CREATE TABLE [dbo].[acc_bordereaux_variables_taxes]
(
[bdrvtx_bordereau_id] [int] NOT NULL,
[bdrvtx_invoice_id] [int] NOT NULL,
[bdrvtx_variable_id] [int] NOT NULL,
[bdrvtx_tax_id] [int] NOT NULL,
[bdrvtx_tax_value] [dbo].[ais_decimal2] NULL,
[bdrvtx_payable_company] [bit] NOT NULL CONSTRAINT [DF__acc_bordereaux_variables_taxes__bdrvtx_payable_company] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_taxes] ADD CONSTRAINT [PK_acc_bordereaux_variables_taxes] PRIMARY KEY CLUSTERED  ([bdrvtx_bordereau_id], [bdrvtx_invoice_id], [bdrvtx_variable_id], [bdrvtx_tax_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_taxes] ADD CONSTRAINT [FK_acc_bordereaux_variables_taxes_acc_bordereaux_variables] FOREIGN KEY ([bdrvtx_bordereau_id], [bdrvtx_invoice_id], [bdrvtx_variable_id]) REFERENCES [dbo].[acc_bordereaux_variables] ([bdrv_bordereau_id], [bdrv_invoice_id], [bdrv_variable_id])
GO
ALTER TABLE [dbo].[acc_bordereaux_variables_taxes] ADD CONSTRAINT [FK_acc_bordereaux_variables_taxes_acc_taxes] FOREIGN KEY ([bdrvtx_tax_id]) REFERENCES [dbo].[acc_taxes] ([acctax_tax_id])
GO
