CREATE TABLE [dbo].[pol_variables_taxes]
(
[polvt_policy_situation_id] [int] NOT NULL,
[polvt_variable_id] [int] NOT NULL,
[polvt_tax_id] [int] NOT NULL,
[polvt_tax_value] [dbo].[ais_decimal2] NULL,
[polvt_tax_percent] [dbo].[ais_decimal4] NULL,
[polvt_tax_net_included] [bit] NOT NULL CONSTRAINT [DF__pol_variables_taxes__polvt_tax_net_included] DEFAULT ((0)),
[polvt_tax_calculated_in_excel] [bit] NOT NULL CONSTRAINT [DF__pol_variables_taxes__polvt_tax_calculated_in_excel] DEFAULT ((0))
) ON [PRIMARY]
ALTER TABLE [dbo].[pol_variables_taxes] ADD
CONSTRAINT [FK_pol_variables_taxes_acc_taxes] FOREIGN KEY ([polvt_tax_id]) REFERENCES [dbo].[acc_taxes] ([acctax_tax_id])
GO
ALTER TABLE [dbo].[pol_variables_taxes] ADD CONSTRAINT [PK_pol_variables_taxes] PRIMARY KEY CLUSTERED  ([polvt_policy_situation_id], [polvt_variable_id], [polvt_tax_id]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_pol_variables_taxes] ON [dbo].[pol_variables_taxes] ([polvt_policy_situation_id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pol_variables_taxes] ADD CONSTRAINT [FK_pol_variables_taxes_pol_variables] FOREIGN KEY ([polvt_policy_situation_id], [polvt_variable_id]) REFERENCES [dbo].[pol_variables] ([polv_policy_situation_id], [polv_variable_id])
GO
