CREATE TABLE [dbo].[SalesTaxSetup]
(
[SalesTaxSetupID] [int] NOT NULL CONSTRAINT [DF_SalesTaxSetup_SalesTaxSetupID] DEFAULT ((1)),
[ServiceAccountNumber] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ServiceLicenseKey] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ServiceUrl] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SalesTaxItemCodeFID] [int] NOT NULL,
[DefaultSalesTaxCodeFID] [int] NULL,
[IsActivated] [bit] NOT NULL CONSTRAINT [DF_SalesTaxSetup_IsActivated] DEFAULT ((1)),
[AutoCalculate] [bit] NULL CONSTRAINT [DF_SalesTaxSetup_AutoCalculate] DEFAULT ((0)),
[SendInvForExemptCust] [bit] NULL CONSTRAINT [DF_SalesTaxSetup_SendInvForExemptCust] DEFAULT ((0)),
[AutoAddressValidation] [bit] NULL CONSTRAINT [DF_SalesTaxSetup_AutoAddressValidation] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SalesTaxSetup] ADD CONSTRAINT [CK_SalesTaxSetup_TableSize_To_1] CHECK (([SalesTaxSetupID]<(2) AND [SalesTaxSetupID]>(0)))
GO
ALTER TABLE [dbo].[SalesTaxSetup] ADD CONSTRAINT [PK_SalesTaxSetup] PRIMARY KEY NONCLUSTERED ([SalesTaxSetupID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SalesTaxSetup] ADD CONSTRAINT [FK_SalesTaxSetup_SalesTaxCode] FOREIGN KEY ([DefaultSalesTaxCodeFID]) REFERENCES [dbo].[SalesTaxCode] ([SalesTaxCodeID])
GO
ALTER TABLE [dbo].[SalesTaxSetup] ADD CONSTRAINT [FK_SalesTaxSetup_ItemCode] FOREIGN KEY ([SalesTaxItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
GRANT SELECT ON [dbo].[SalesTaxSetup] TO [MssExec]
GRANT INSERT ON [dbo].[SalesTaxSetup] TO [MssExec]
GRANT DELETE ON [dbo].[SalesTaxSetup] TO [MssExec]
GRANT UPDATE ON [dbo].[SalesTaxSetup] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Flag that indicates whether addresses associated to revenue items should be validated by Avalara''s address service prior to constructing invoices (1) or not (0). Users can switch the feature on and off through this setting.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'AutoAddressValidation'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Flag that indicates if sales tax should be automatically calculated while constructing an invoice (1) or not (0). Users can switch the feature on and off through this setting.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'AutoCalculate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The foreign key to the default Sales Tax Code that is used for any Item Codes that are not directly mapped to a Sales Tax Code.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'DefaultSalesTaxCodeFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Flag that indicates if the sales tax feature is activated (1) or not (0). Users can switch the feature on and off through this setting.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'IsActivated'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The foreign key to an Item Code that is used for recording sales tax revenue transactions.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'SalesTaxItemCodeFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'SalesTaxSetupID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Flag that indicates whether invoices for tax-exempt customers are sent to the service (1) or not (0). Users can switch the feature on and off through this setting.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'SendInvForExemptCust'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The account number assigned to the user by the sales tax service provider.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'ServiceAccountNumber'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The license key assigned to the user by the sales tax service provider.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'ServiceLicenseKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The url that points to the sales tax web service.', 'SCHEMA', N'dbo', 'TABLE', N'SalesTaxSetup', 'COLUMN', N'ServiceUrl'
GO