CREATE TABLE [dbo].[SCQBillingEquipmentMiscCharges]
(
[BillingEquipmentMiscChargeID] [int] NOT NULL IDENTITY(1, 1),
[BillingID] [int] NOT NULL,
[ContractDetailID] [int] NOT NULL,
[EquipmentDetailID] [int] NOT NULL,
[BillingEquipmentID] [int] NOT NULL,
[BaseFromDate] [datetime] NULL,
[BaseToDate] [datetime] NULL,
[OverageFromDate] [datetime] NULL,
[OverageToDate] [datetime] NULL,
[ContractDetailMiscChargeID] [int] NOT NULL,
[MiscChargeCodeID] [int] NULL,
[Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Quantity] [decimal] (18, 6) NOT NULL,
[Rate] [decimal] (18, 6) NOT NULL,
[GLID] [int] NOT NULL,
[DeptID] [int] NULL,
[TaxFlag] [int] NOT NULL,
[BranchID] [int] NOT NULL,
[DivisionID] [int] NOT NULL,
[BalanceSheetGroupID] [int] NOT NULL,
[TaxCodeID] [int] NULL,
[BillWithID] [int] NOT NULL,
[BillFrequencyID] [int] NOT NULL,
[Amount] [money] NOT NULL,
[CreatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_CreateDate] DEFAULT (getdate()),
[UpdatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_LastUpdate] DEFAULT (getdate()),
[EquipmentMiscChargeDetailID] [int] NOT NULL,
[TaxExemptCodeID] [int] NULL,
[Taxable] [bit] NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_Taxable] DEFAULT ((0)),
[Method] [int] NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_Method] DEFAULT ((0)),
[PercentMinimumAmount] [money] NULL,
[PercentMaximumAmount] [money] NULL,
[TaxFlagID] [int] NOT NULL,
[LocationID] [int] NULL,
[Address] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_Address] DEFAULT (''),
[City] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_City] DEFAULT (''),
[State] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_State] DEFAULT (''),
[Zip] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_Zip] DEFAULT (''),
[County] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_County] DEFAULT (''),
[Country] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SCQBillingEquipmentMiscCharges_Country] DEFAULT ('')
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [PK__SCQBilli__F208A00A886EA24E] PRIMARY KEY CLUSTERED ([BillingEquipmentMiscChargeID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_BalanceSheetGroupID_GLBalanceSheetGroups] FOREIGN KEY ([BalanceSheetGroupID]) REFERENCES [dbo].[GLBalanceSheetGroups] ([BalanceSheetGroupID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_BillingEquipmentID_SCQBillingEquipments] FOREIGN KEY ([BillingEquipmentID]) REFERENCES [dbo].[SCQBillingEquipments] ([BillingEquipmentID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_BranchID_GLBranches] FOREIGN KEY ([BranchID]) REFERENCES [dbo].[GLBranches] ([BranchID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_ContractDetailMiscChargeID_SCContractDetailMiscCharges] FOREIGN KEY ([ContractDetailMiscChargeID]) REFERENCES [dbo].[SCContractDetailMiscCharges] ([MiscChargeID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_DeptID_GLDepts] FOREIGN KEY ([DeptID]) REFERENCES [dbo].[GLDepts] ([DeptID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_DivisionID_GLDivisions] FOREIGN KEY ([DivisionID]) REFERENCES [dbo].[GLDivisions] ([DivisionID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_GLID_GLAccounts] FOREIGN KEY ([GLID]) REFERENCES [dbo].[GLAccounts] ([AccountID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_LocationID_ARCustomers] FOREIGN KEY ([LocationID]) REFERENCES [dbo].[ARCustomers] ([CustomerID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_MiscChargeCodeID_SCContractMiscChargeCodes] FOREIGN KEY ([MiscChargeCodeID]) REFERENCES [dbo].[SCContractMiscChargeCodes] ([MiscChargeCodeID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_TaxcodeID_ShTaxCodes] FOREIGN KEY ([TaxCodeID]) REFERENCES [dbo].[ShTaxCodes] ([TaxCodeID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_TaxExemptCodeID_SHTaxExemptCodes] FOREIGN KEY ([TaxExemptCodeID]) REFERENCES [dbo].[SHTaxExemptCodes] ([TaxExemptCodeID])
GO
ALTER TABLE [dbo].[SCQBillingEquipmentMiscCharges] ADD CONSTRAINT [FK_SCQBillingEquipmentMiscCharges_TaxFlagID_ShTaxFlags] FOREIGN KEY ([TaxFlagID]) REFERENCES [dbo].[ShTaxFlags] ([TaxFlagID])
GO