CREATE TABLE [dbo].[acc_taxes]
(
[acctax_tax_id] [int] NOT NULL,
[acctax_tax_code] [dbo].[ais_code_short] NOT NULL,
[acctax_tax_date_setup] [date] NOT NULL,
[acctax_tax_value] [dbo].[ais_decimal4] NOT NULL,
[acctax_fixed_value] [bit] NOT NULL CONSTRAINT [DF__acc_taxes__acctax_fixed_value] DEFAULT ((0)),
[acctax_net_included] [bit] NOT NULL CONSTRAINT [DF__acc_taxes__acctax_net_included] DEFAULT ((0)),
[acctax_payout_currency_code] [dbo].[ais_code_short] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[acc_taxes] ADD
CONSTRAINT [FK_acc_taxes_acc_currencies] FOREIGN KEY ([acctax_payout_currency_code]) REFERENCES [dbo].[acc_currencies] ([cur_currency_code])
ALTER TABLE [dbo].[acc_taxes] ADD 
CONSTRAINT [PK_acc_taxes] PRIMARY KEY CLUSTERED  ([acctax_tax_id]) ON [PRIMARY]
CREATE UNIQUE NONCLUSTERED INDEX [IX_pk_acc_taxes] ON [dbo].[acc_taxes] ([acctax_tax_code], [acctax_tax_date_setup]) ON [PRIMARY]






GO

ALTER TABLE [dbo].[acc_taxes] ADD CONSTRAINT [FK_acc_taxes_nm_taxes] FOREIGN KEY ([acctax_tax_code]) REFERENCES [dbo].[nm_taxes] ([nmtax_tax_code])
GO
