CREATE TABLE [dbo].[ICMfgBins]
(
[MfgID] [int] NOT NULL,
[WarehouseID] [int] NOT NULL,
[BinID] [int] NOT NULL,
[Quantity] [decimal] (18, 6) NOT NULL,
[CreatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_ICMfgBins_CreateDate] DEFAULT (getdate()),
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_ICMfgBins_LastUpdate] DEFAULT (getdate()),
[timestamp] [timestamp] NULL,
[Cost] [money] NOT NULL CONSTRAINT [DF_ICMfgBins_Cost] DEFAULT ((0)),
[InventoryAmount] [money] NOT NULL CONSTRAINT [DF_ICMfgBins_InventoryAmount] DEFAULT ((0)),
[AdjAmount] [money] NOT NULL CONSTRAINT [DF_ICMfgBins_AdjAmount] DEFAULT ((0)),
[MfgBinID] [int] NOT NULL IDENTITY(1, 1),
[BranchID] [int] NOT NULL,
[DivisionID] [int] NOT NULL,
[BalanceSheetGroupID] [int] NOT NULL,
[IntercompanyGLID] [int] NULL,
[AssetCostOrBasisAmount] [money] NOT NULL CONSTRAINT [DF_ICMfgBins_AssetCostOrBasisAmount] DEFAULT ((0)),
[AssetAccumDeprAmount] [money] NOT NULL CONSTRAINT [DF_ICMfgBins_AssetAccumDeprAmount] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [PK_ICMfgBins] PRIMARY KEY CLUSTERED ([MfgID], [WarehouseID], [BinID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_BalanceSheetGroupID_GLBalanceSheetGroups] FOREIGN KEY ([BalanceSheetGroupID]) REFERENCES [dbo].[GLBalanceSheetGroups] ([BalanceSheetGroupID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_BinID_ICBins] FOREIGN KEY ([BinID]) REFERENCES [dbo].[ICBins] ([BinID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_BranchID_GLBranches] FOREIGN KEY ([BranchID]) REFERENCES [dbo].[GLBranches] ([BranchID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_DivisionID_GLDivisions] FOREIGN KEY ([DivisionID]) REFERENCES [dbo].[GLDivisions] ([DivisionID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_IntercompanyGLID_GLAccounts] FOREIGN KEY ([IntercompanyGLID]) REFERENCES [dbo].[GLAccounts] ([AccountID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_MfgID_ICMfgs] FOREIGN KEY ([MfgID]) REFERENCES [dbo].[ICMfgs] ([MfgID])
GO
ALTER TABLE [dbo].[ICMfgBins] ADD CONSTRAINT [FK_ICMfgBins_WarehouseID_ICWarehouses] FOREIGN KEY ([WarehouseID]) REFERENCES [dbo].[ICWarehouses] ([WarehouseID])
GO