USE [UFDATA_002_2004]
GO
/****** Object: Table [dbo].[JustInVouchs] Script Date: 06/12/2014 14:09:57 ******/
drop table JustInVouchs
drop table IA_Subsidiary
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[JustInVouchs](
[AutoID] [int] NOT NULL,
[cJVCode] [varchar](30) NOT NULL,
[CorID] [int] NULL,
[cCorCode] [varchar](30) NULL,
[cInvCode] [varchar](20) NOT NULL,
[iJVPrice] [money] NULL,
[cJVBatch] [varchar](20) NULL,
[cObjCode] [varchar](12) NULL,
[cFree1] [varchar](20) NULL,
[cFree2] [varchar](20) NULL,
[cDefine22] [nvarchar](60) NULL,
[cDefine23] [nvarchar](60) NULL,
[cDefine24] [nvarchar](60) NULL,
[cDefine25] [nvarchar](60) NULL,
[cDefine26] [float] NULL,
[cDefine27] [float] NULL,
[cItemCode] [varchar](20) NULL,
[cItem_class] [varchar](10) NULL,
[cName] [varchar](60) NULL,
[cItemCName] [varchar](20) NULL,
[iJustInsId] [int] NULL,
[cBVencode] [varchar](20) NULL,
[cFree3] [varchar](20) NULL,
[iMassDate] [int] NULL,
[dMadeDate] [datetime] NULL,
[cInVouchCode] [varchar](30) NULL,
[cFree4] [varchar](20) NULL,
[cFree5] [varchar](20) NULL,
[cFree6] [varchar](20) NULL,
[cFree7] [varchar](20) NULL,
[cFree8] [varchar](20) NULL,
[cFree9] [varchar](20) NULL,
[cFree10] [varchar](20) NULL,
[cDefine28] [varchar](120) NULL,
[cDefine29] [varchar](120) NULL,
[cDefine30] [varchar](120) NULL,
[cDefine31] [varchar](120) NULL,
[cDefine32] [varchar](120) NULL,
[cDefine33] [varchar](120) NULL,
[cDefine34] [int] NULL,
[cDefine35] [int] NULL,
[cDefine36] [datetime] NULL,
[cDefine37] [datetime] NULL,
CONSTRAINT [aaaaaJustInVouchs_PK] PRIMARY KEY NONCLUSTERED
(
[AutoID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[IA_Subsidiary] Script Date: 06/12/2014 14:09:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[IA_Subsidiary](
[AutoID] [int] IDENTITY(1,1) NOT NULL,
[bRdFlag] [bit] NOT NULL,
[cBusType] [varchar](8) NULL,
[cBusCode] [varchar](30) NULL,
[cVouCode] [varchar](30) NULL,
[ID] [int] NULL,
[ValueID] [int] NULL,
[JustID] [int] NULL,
[dVouDate] [datetime] NULL,
[dKeepDate] [datetime] NULL,
[iMonth] [tinyint] NOT NULL,
[iPZID] [int] NULL,
[iPZDate] [datetime] NULL,
[cPZtype] [varchar](8) NULL,
[cPZdigest] [varchar](60) NULL,
[cInvHead] [varchar](15) NULL,
[cDifHead] [varchar](15) NULL,
[cOppHead] [varchar](15) NULL,
[cVouType] [varchar](4) NULL,
[cPTCode] [varchar](2) NULL,
[cSTCode] [varchar](2) NULL,
[cWhCode] [varchar](10) NULL,
[cAccDep] [varchar](12) NULL,
[cInvCode] [varchar](20) NOT NULL,
[cRdCode] [varchar](5) NULL,
[cVenCode] [varchar](20) NULL,
[cCusCode] [varchar](20) NULL,
[cOrderCode] [varchar](30) NULL,
[cARVCode] [varchar](30) NULL,
[cBillCode] [int] NULL,
[cDLCode] [int] NULL,
[cPSPCode] [varchar](12) NULL,
[cProCode] [varchar](50) NULL,
[cDepCode] [varchar](12) NULL,
[cPersonCode] [varchar](8) NULL,
[cHandler] [varchar](20) NULL,
[iAInQuantity] [float] NULL,
[iAOutQuantity] [float] NULL,
[iInCost] [float] NULL,
[iOutCost] [float] NULL,
[iAInPrice] [money] NULL,
[iAOutPrice] [money] NULL,
[cBatchCode] [varchar](20) NULL,
[iDebitDifCost] [money] NULL,
[iCreditDifCost] [money] NULL,
[cAccounter] [varchar](20) NULL,
[cMaker] [varchar](20) NULL,
[bFlag] [tinyint] NULL,
[bMoneyFlag] [bit] NOT NULL,
[bSale] [bit] NOT NULL,
[cMemo] [varchar](60) NULL,
[cDefine1] [varchar](20) NULL,
[cDefine2] [varchar](20) NULL,
[cDefine3] [varchar](20) NULL,
[cDefine4] [datetime] NULL,
[cDefine5] [int] NULL,
[cDefine6] [datetime] NULL,
[cDefine7] [float] NULL,
[cDefine8] [varchar](4) NULL,
[cDefine9] [varchar](8) NULL,
[cDefine10] [varchar](60) NULL,
[cFree1] [varchar](20) NULL,
[cFree2] [varchar](20) NULL,
[cPZID] [varchar](30) NULL,
[cDefine22] [nvarchar](60) NULL,
[cDefine23] [nvarchar](60) NULL,
[cDefine24] [nvarchar](60) NULL,
[cDefine25] [nvarchar](60) NULL,
[cDefine26] [float] NULL,
[cDefine27] [float] NULL,
[cItem_class] [varchar](10) NULL,
[cItemCode] [varchar](20) NULL,
[cName] [varchar](60) NULL,
[cItemCName] [varchar](20) NULL,
[noJustQuantity] [userdecimal] NULL,
[cFree3] [varchar](20) NULL,
[cFree4] [varchar](20) NULL,
[cFree5] [varchar](20) NULL,
[cFree6] [varchar](20) NULL,
[cFree7] [varchar](20) NULL,
[cFree8] [varchar](20) NULL,
[cFree9] [varchar](20) NULL,
[cFree10] [varchar](20) NULL,
[cDefine11] [varchar](120) NULL,
[cDefine12] [varchar](120) NULL,
[cDefine13] [varchar](120) NULL,
[cDefine14] [varchar](120) NULL,
[cDefine15] [int] NULL,
[cDefine16] [float] NULL,
[cDefine28] [varchar](120) NULL,
[cDefine29] [varchar](120) NULL,
[cDefine30] [varchar](120) NULL,
[cDefine31] [varchar](120) NULL,
[cDefine32] [varchar](120) NULL,
[cDefine33] [varchar](120) NULL,
[cDefine34] [int] NULL,
[cDefine35] [int] NULL,
[cDefine36] [datetime] NULL,
[cDefine37] [datetime] NULL,
[psvsid] [int] NULL,
[cCXHDcode] [varchar](30) NULL,
[cCXFScode] [varchar](20) NULL,
CONSTRAINT [aaaaaIA_Subsidiary_PK] PRIMARY KEY NONCLUSTERED
(
[AutoID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Default [DF__ia_subsid__cDefi__11165497] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__11165497] DEFAULT (NULL) FOR [cDefine22]
GO
/****** Object: Default [DF__ia_subsid__cDefi__120A78D0] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__120A78D0] DEFAULT (NULL) FOR [cDefine23]
GO
/****** Object: Default [DF__ia_subsid__cDefi__12FE9D09] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__12FE9D09] DEFAULT (NULL) FOR [cDefine24]
GO
/****** Object: Default [DF__ia_subsid__cDefi__13F2C142] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__13F2C142] DEFAULT (NULL) FOR [cDefine25]
GO
/****** Object: Default [DF__ia_subsid__cDefi__14E6E57B] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__14E6E57B] DEFAULT (NULL) FOR [cDefine26]
GO
/****** Object: Default [DF__ia_subsid__cDefi__15DB09B4] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] ADD CONSTRAINT [DF__ia_subsid__cDefi__15DB09B4] DEFAULT (NULL) FOR [cDefine27]
GO
/****** Object: Default [DF__JustInVou__cDefi__16CF2DED] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__16CF2DED] DEFAULT (NULL) FOR [cDefine22]
GO
/****** Object: Default [DF__JustInVou__cDefi__17C35226] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__17C35226] DEFAULT (NULL) FOR [cDefine23]
GO
/****** Object: Default [DF__JustInVou__cDefi__18B7765F] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__18B7765F] DEFAULT (NULL) FOR [cDefine24]
GO
/****** Object: Default [DF__JustInVou__cDefi__19AB9A98] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__19AB9A98] DEFAULT (NULL) FOR [cDefine25]
GO
/****** Object: Default [DF__JustInVou__cDefi__1A9FBED1] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__1A9FBED1] DEFAULT (NULL) FOR [cDefine26]
GO
/****** Object: Default [DF__JustInVou__cDefi__1B93E30A] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] ADD CONSTRAINT [DF__JustInVou__cDefi__1B93E30A] DEFAULT (NULL) FOR [cDefine27]
GO
/****** Object: ForeignKey [FK__IA_Subsid__cDepC__4F7F3212] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cDepCode])
REFERENCES [dbo].[Department] ([cDepCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cDepC__5073564B] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cDepCode])
REFERENCES [dbo].[Department] ([cDepCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cDepC__51677A84] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cDepCode])
REFERENCES [dbo].[Department] ([cDepCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cInvC__525B9EBD] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cInvCode])
REFERENCES [dbo].[Inventory] ([cInvCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cInvC__534FC2F6] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cInvCode])
REFERENCES [dbo].[Inventory] ([cInvCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cInvC__5443E72F] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cInvCode])
REFERENCES [dbo].[Inventory] ([cInvCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cWhCo__55380B68] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cWhCode])
REFERENCES [dbo].[Warehouse] ([cWhCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cWhCo__562C2FA1] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cWhCode])
REFERENCES [dbo].[Warehouse] ([cWhCode])
GO
/****** Object: ForeignKey [FK__IA_Subsid__cWhCo__572053DA] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[IA_Subsidiary] WITH CHECK ADD FOREIGN KEY([cWhCode])
REFERENCES [dbo].[Warehouse] ([cWhCode])
GO
/****** Object: ForeignKey [FK__JustInVou__cInvC__58147813] Script Date: 06/12/2014 14:09:57 ******/
ALTER TABLE [dbo].[JustInVouchs] WITH CHECK ADD FOREIGN KEY([cInvCode])
REFERENCES [dbo].[Inventory] ([cInvCode])
GO