/****** Object:  Table [dbo].[CY_SYS_DepartmentPX]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_DepartmentPX](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[DepartmentCode] [varchar](50) NULL,
	[TypeBianMa] [varchar](50) NULL,
	[KeYongBiaoJi] [bit] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_Leibie]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Leibie](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[BigCode] [varchar](10) NOT NULL,
	[BigName] [varchar](30) NOT NULL,
	[SmallCode] [varchar](10) NULL,
	[SmallName] [varchar](30) NULL,
	[Remark] [varchar](50) NULL,
	[ReturnPrint] [varchar](30) NULL,
	[StockCode] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_SYS_Department]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_Department](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[ParentId] [int] NOT NULL,
	[Powers] [varchar](4000) NOT NULL,
	[DepartmentCode] [varchar](50) NULL,
	[DepartmentProptery] [varchar](50) NULL,
	[WarehouseName] [varchar](50) NULL,
	[Remark] [varchar](200) NULL,
 CONSTRAINT [PK_SystemDepartment] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'Name'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父类ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'ParentId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'DepartmentCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门属性' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'DepartmentProptery'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'WarehouseName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_Department', @level2type=N'COLUMN',@level2name=N'Remark'
GO
SET IDENTITY_INSERT [dbo].[CY_SYS_Department] ON
INSERT [dbo].[CY_SYS_Department] ([Id], [Name], [ParentId], [Powers], [DepartmentCode], [DepartmentProptery], [WarehouseName], [Remark]) VALUES (1, N'管理部', 0, N'001000,001001,001002,001004,002000,002001,002004,011000,011001,011002,012000,012001,012002,012003,012004,013000,013002,013003,013004,013005,013006,013007,013008,013009,013010,013014,013015,013018,014000,014001,014004,015000,015001,015002,015003,015004,015005,016000,016001,016002,016003,016004,016005,016006,016007,016009,016011,017000,017001,017002,017003,017004,017006,017007,017008,017009,017010,017011,017012,017013,018000,018001,018004,018005,018019,018020,019000,019001,081000,081001,081002,081003,082000,082001,083000,083001,083002,083003,083004,083005,083006,083007,083008,084000,084001,084002,084003,084004,085000,085001,085002,085003,085004,085005,086000,086001,086002', N'01', N'', N'', N'')
SET IDENTITY_INSERT [dbo].[CY_SYS_Department] OFF
/****** Object:  Table [dbo].[CY_StandMeal]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_StandMeal](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[TCBH] [varchar](10) NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](40) NULL,
	[Norms] [varchar](10) NULL,
	[Units] [varchar](10) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[DiscFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'TCBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'Norms'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'HYPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'能否折扣标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal', @level2type=N'COLUMN',@level2name=N'DiscFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐信息表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_StandMeal'
GO
/****** Object:  Table [dbo].[CY_Shift]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Shift](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[EmpNo] [varchar](20) NULL,
	[EmpName] [varchar](20) NULL,
	[POS] [varchar](50) NULL,
	[LogTime] [datetime] NULL,
	[ShifFlag] [bit] NOT NULL,
	[Imprest] [decimal](9, 2) NULL,
	[InvoiceMoney] [decimal](9, 2) NULL,
	[BillMoney] [decimal](9, 2) NULL,
	[Remark] [varchar](1024) NULL,
	[OverTime] [datetime] NULL,
	[OverRmark] [varchar](1024) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'交班时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Shift', @level2type=N'COLUMN',@level2name=N'OverTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'交班备注。如:现金:100 刷卡：300' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Shift', @level2type=N'COLUMN',@level2name=N'OverRmark'
GO
/****** Object:  UserDefinedFunction [dbo].[func_Split]    Script Date: 07/03/2015 09:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[func_Split]    
(      
    @Separator nvarchar(10),        -- 分隔符  
    @StringToSplit nvarchar(max)    -- 字串集
)   
RETURNS @tTable table ([Row_Index] int, [String] nvarchar(max))   
BEGIN  
  
    DECLARE @Count int  
    --DECLARE @tTable table(ROW_INDEX int, String nvarchar(max))   
    DECLARE @NextString nvarchar(max)   
    DECLARE @SplitPosition int  
    DECLARE @NextPosition int  
    DECLARE @SplitCheck nvarchar(1)   
    Set @Count = 0;   
    Set @NextString = ''  
    Set @SplitCheck = Right(@StringToSplit,Len(@Separator))    
  
    -- 如果字串最後不是分隔符號，則一直執行迴圈   
    IF (@SplitCheck <> @Separator )   
        Begin  
            Set @StringToSplit = @StringToSplit + @Separator   
        End  
  
    -- 取得第一個分隔符號位置   
    Set @SplitPosition = CharIndex(@Separator,@StringToSplit)   
    Set @NextPosition = 1   
  
    -- 取得其他分隔符號位置，並Insert到Table中   
    WHILE (@SplitPosition <>  0)     
        Begin  
            Set @Count = @Count + 1   
            Set @NextString = SubString(@StringToSplit,1,@SplitPosition-1)   
            Insert Into @tTable ([ROW_INDEX],[String]) Values (@Count,@NextString)
  
            Set @StringToSplit = SubString(@StringToSplit,@SplitPosition + Len(@Separator),Len(@StringToSplit))   
            Set @NextPosition = @SplitPosition   
            Set @SplitPosition  = CharIndex(@Separator,@StringToSplit)   
        End  
  
    RETURN  
END
GO
/****** Object:  Table [dbo].[CY_QDMX]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_QDMX](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[QDUCode] [varchar](10) NULL,
	[QDUName] [varchar](20) NULL,
	[QDJE] [decimal](9, 2) NULL,
	[QDRemark] [varchar](200) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_PosInfo]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_PosInfo](
	[Pos] [varchar](10) NULL,
	[XM] [varchar](10) NULL,
	[BH] [varchar](10) NULL,
	[BM] [varchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_Product_Property]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Product_Property](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Code] [varchar](10) NULL,
	[Norms] [varchar](10) NULL,
	[Units] [varchar](10) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[ChengBenJia] [decimal](9, 2) NULL,
	[JiaGongTiCheng] [decimal](9, 2) NULL,
	[FuWuTiCheng] [decimal](9, 2) NULL,
	[ShiFouShiJia] [int] NULL,
	[ShiJiaMoney] [decimal](9, 2) NULL,
	[CuXiaoKaiShi] [datetime] NULL,
	[CuXiaoJieShu] [datetime] NULL,
	[CuXiaoMoney] [decimal](9, 2) NULL,
	[goodsattid] [bigint] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品动态属性表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product_Property'
GO
/****** Object:  Table [dbo].[CY_Ting]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Ting](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[TingBH] [varchar](10) NULL,
	[TingMC] [varchar](20) NULL,
	[ZeroType] [int] NULL,
	[AutoZero] [int] NULL,
	[CreditLimit] [int] NULL,
	[TingPrint] [varchar](50) NULL,
	[ReturPrint] [varchar](50) NULL,
	[Remark] [varchar](100) NULL,
	[UpFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'TingMC'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抹零方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'ZeroType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'自动抹零标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'AutoZero'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'赊帐限定' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'CreditLimit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅打印机' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'TingPrint'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅回单打印机' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'ReturPrint'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Ting', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[CY_Product]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Product](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LBCode] [varchar](10) NULL,
	[Code] [varchar](10) NOT NULL,
	[CodeName] [varchar](50) NULL,
	[PYM] [varchar](20) NULL,
	[Num] [decimal](9, 2) NULL,
	[DiscountFlag] [int] NULL,
	[MaxDiscount] [decimal](9, 2) NULL,
	[TBFlag] [int] NULL,
	[CaclType] [int] NULL,
	[MarkType] [varchar](50) NULL,
	[CFPrint1] [varchar](50) NULL,
	[CFPrint2] [varchar](50) NULL,
	[CFprint3] [varchar](50) NULL,
	[CFPrint4] [varchar](50) NULL,
	[CFZDPrint] [varchar](50) NULL,
	[ZCPrint] [varchar](50) NULL,
	[PCPrint] [varchar](50) NULL,
	[LimiTime] [int] NULL,
	[Marker] [varchar](10) NULL,
	[Pic] [varchar](50) NULL,
	[Remark] [varchar](100) NULL,
	[Memo] [varchar](250) NULL,
	[goodsid] [bigint] NULL,
	[PersonCount] [int] NULL,
	[UPFlag] [int] NULL,
	[UpPicFlag] [int] NULL,
	[RecommendDishesFlag] [int] NULL,
	[TakeawayFlag] [int] NULL,
	[AutoSubtract] [int] NULL,
	[SubType] [int] NULL,
 CONSTRAINT [PK_CY_Product] PRIMARY KEY CLUSTERED 
(
	[Code] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品类别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'LBCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'拼音码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'PYM'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Num'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣标记 0-打折,非0不打折' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'DiscountFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'MaxDiscount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'TBFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计费方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CaclType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制作方法' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'MarkType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨打1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CFPrint1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨打2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CFPrint2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨打3' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CFprint3'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨打4' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CFPrint4'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨师总单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'CFZDPrint'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'传菜总单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'ZCPrint'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'配菜单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'PCPrint'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制作时限' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'LimiTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制作人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Marker'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'图片' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Pic'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'详细说明' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Product', @level2type=N'COLUMN',@level2name=N'Memo'
GO
/****** Object:  Table [dbo].[CY_Pos]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Pos](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[POS] [varchar](10) NULL,
	[DepartID] [int] NULL,
	[Prefix] [varchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_Phone]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Phone](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Phone] [varchar](20) NULL,
	[CreaTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[VoiceFile] [varchar](50) NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_NetPay]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_NetPay](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[YDLSH] [varchar](20) NULL,
	[JE] [decimal](9, 2) NULL,
	[OperTime] [datetime] NULL,
	[UploadFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_MealType]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_MealType](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BH] [varchar](10) NULL,
	[MC] [varchar](20) NULL,
	[StartTime] [varchar](5) NULL,
	[EndTime] [varchar](5) NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType', @level2type=N'COLUMN',@level2name=N'BH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType', @level2type=N'COLUMN',@level2name=N'MC'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType', @level2type=N'COLUMN',@level2name=N'StartTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType', @level2type=N'COLUMN',@level2name=N'EndTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_MealType'
GO
SET IDENTITY_INSERT [dbo].[CY_MealType] ON
INSERT [dbo].[CY_MealType] ([ID], [BH], [MC], [StartTime], [EndTime], [Remark]) VALUES (6, N'1', N'午餐', N'10:00', N'15:00', NULL)
INSERT [dbo].[CY_MealType] ([ID], [BH], [MC], [StartTime], [EndTime], [Remark]) VALUES (7, N'2', N'晚餐', N'17:00', N'23:00', NULL)
SET IDENTITY_INSERT [dbo].[CY_MealType] OFF
/****** Object:  Table [dbo].[CY_LiuShui]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_LiuShui](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[TingBH] [varchar](10) NULL,
	[TaiBH] [varchar](10) NULL,
	[LSH] [varchar](20) NULL,
	[JZFlag] [int] NULL,
	[StartTime] [datetime] NULL,
	[EnTime] [datetime] NULL,
	[ShiBie] [varchar](10) NULL,
	[PersonCnt] [int] NULL,
	[JDcnt] [int] NULL,
	[PerKnot] [decimal](9, 2) NULL,
	[TeamFlag] [int] NULL,
	[LockFlag] [varchar](10) NULL,
	[Waiter] [varchar](10) NULL,
	[PantHelper] [varchar](10) NULL,
	[MarkManger] [varchar](10) NULL,
	[CostMoney] [decimal](9, 2) NULL,
	[FeesMoney] [decimal](9, 2) NULL,
	[DepUnit] [varchar](20) NULL,
	[HYKH] [varchar](10) NULL,
	[POS] [varchar](10) NULL,
	[TeamLSH] [varchar](20) NULL,
	[YDLSH] [varchar](20) NULL,
	[JZLSH] [varchar](20) NULL,
	[UploadFlag] [int] NULL,
	[TasteRemark] [varchar](100) NULL,
	[Remark] [nvarchar](100) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结帐标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'JZFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'StartTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'EnTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'ShiBie'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'人数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'PersonCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'JDcnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预结金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'PerKnot'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宴会标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'TeamFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'锁定标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'LockFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'Waiter'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'传菜员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'PantHelper'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'营销经理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'MarkManger'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'消费金额 ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'CostMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'FeesMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'协议单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'DepUnit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结帐会员卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'HYKH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'pos终端' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'POS'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宴会流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'TeamLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'YDLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结帐流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'JZLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上传标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'整单口味备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'TasteRemark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'相关信息备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_LiuShui', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[CY_KdSale]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_KdSale](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[XSTime] [datetime] NULL,
	[LSH] [varchar](20) NULL,
	[TCBH] [varchar](10) NULL,
	[TCName] [varchar](50) NULL,
	[BZRS] [int] NULL,
	[TCPrice] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'XSTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'TCBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'TCName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标准人数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'BZRS'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'TCPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'HYPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_KdSale', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[CY_Jbmx]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Jbmx](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [nvarchar](20) NULL,
	[OperCode] [varchar](10) NULL,
	[OperName] [nvarchar](20) NULL,
	[pos] [nvarchar](4) NULL,
	[OperTime] [datetime] NULL,
	[JBFlag] [int] NULL,
	[Remark] [nvarchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_FJHisMx]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_FJHisMx](
	[id] [bigint] NOT NULL,
	[TingBH] [varchar](50) NULL,
	[TaiBH] [varchar](50) NULL,
	[LSH] [varchar](50) NULL,
	[AddPerson] [varchar](50) NULL,
	[AddTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[Code] [varchar](50) NULL,
	[CodeName] [varchar](50) NULL,
	[Units] [varchar](50) NULL,
	[Price] [varchar](50) NULL,
	[HYPrice] [varchar](50) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Discount] [decimal](9, 2) NULL,
	[SJPrice] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[AddDept] [varchar](50) NULL,
	[Waiter] [varchar](50) NULL,
	[Bonus1] [decimal](9, 2) NULL,
	[ServiceBonus] [decimal](9, 2) NULL,
	[Processing] [varchar](50) NULL,
	[Bonus2] [decimal](9, 2) NULL,
	[ProcessingBonus] [decimal](9, 2) NULL,
	[Status] [varchar](10) NULL,
	[TPFlag] [varchar](10) NULL,
	[TaiFlag] [varchar](10) NULL,
	[BillType] [varchar](50) NULL,
	[MaxFlag] [varchar](50) NULL,
	[ZDFlag] [varchar](50) NULL,
	[IsDiscount] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[FirstType] [varchar](50) NULL,
	[SecondType] [varchar](50) NULL,
	[HYCardNo] [varchar](50) NULL,
	[MealType] [varchar](50) NULL,
	[CostMoney] [decimal](9, 2) NULL,
	[AddLSH] [varchar](50) NULL,
	[DiscountPermissions] [varchar](50) NULL,
	[KDInfo] [varchar](50) NULL,
	[UploadFlag] [int] NULL,
	[FJSJ] [datetime] NULL,
	[FJCnt] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_HTMX]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_HTMX](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[OldTingBH] [varchar](10) NULL,
	[OldTingName] [varchar](20) NULL,
	[OldTaiBH] [varchar](10) NULL,
	[OldTaiName] [varchar](20) NULL,
	[NewTingBH] [varchar](10) NULL,
	[NewTingName] [varchar](20) NULL,
	[NewTaiBH] [varchar](10) NULL,
	[NewTaiName] [varchar](20) NULL,
	[OperName] [varchar](20) NULL,
	[OperTime] [datetime] NULL,
	[CheckPerson] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_ZengDan]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_ZengDan](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[TingBH] [varchar](20) NULL,
	[TingName] [varchar](20) NULL,
	[TaiBH] [varchar](20) NULL,
	[TaiName] [varchar](20) NULL,
	[JDSJ] [datetime] NULL,
	[JDPerson] [varchar](20) NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](20) NULL,
	[Units] [varchar](20) NULL,
	[OldCnt] [decimal](9, 2) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[Remark] [varchar](20) NULL,
	[OperPerson] [varchar](20) NULL,
	[CheckPerson] [varchar](20) NULL,
	[ZDSJ] [datetime] NULL,
	[ReID] [bigint] NULL,
	[Remark1] [varchar](40) NULL,
	[Remark2] [varchar](20) NULL,
	[Remark3] [varchar](20) NULL,
	[Remark4] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_FrontConfig]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_FrontConfig](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Pos] [varchar](20) NOT NULL,
	[FCJDPrintCnt] [int] NULL,
	[FCTDPrintCnt] [int] NULL,
	[FCCCPrintCnt] [int] NULL,
	[FCTCPrintCnt] [int] NULL,
	[FCJQPrintCnt] [int] NULL,
	[TingBH] [varchar](150) NULL,
	[FCPrintFMat] [varchar](50) NULL,
	[DefPrinter] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'餐饮——打印连接' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_FrontConfig'
GO
/****** Object:  Table [dbo].[CY_GZMX]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_GZMX](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DWBH] [varchar](20) NULL,
	[DWMC] [varchar](50) NULL,
	[DJBH] [varchar](20) NULL,
	[UpBalance] [decimal](9, 2) NULL,
	[PayMoney] [decimal](9, 2) NULL,
	[CostMoney] [decimal](9, 2) NULL,
	[AcountType] [int] NULL,
	[Balance] [decimal](9, 2) NULL,
	[OperCode] [varchar](10) NULL,
	[OperName] [varchar](10) NULL,
	[OperTime] [datetime] NULL,
	[Remark1] [varchar](10) NULL,
	[Remark2] [varchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_TuiDan]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_TuiDan](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[TingBH] [varchar](20) NULL,
	[TingName] [varchar](20) NULL,
	[TaiBH] [varchar](20) NULL,
	[TaiName] [varchar](20) NULL,
	[JDSJ] [datetime] NULL,
	[JDPerson] [varchar](20) NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](20) NULL,
	[Units] [varchar](20) NULL,
	[OldCnt] [decimal](9, 2) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[Remark] [varchar](20) NULL,
	[OperPerson] [varchar](20) NULL,
	[CheckPerson] [varchar](20) NULL,
	[TDSJ] [datetime] NULL,
	[ReID] [bigint] NULL,
	[Remark1] [varchar](20) NULL,
	[Remark2] [varchar](20) NULL,
	[Remark3] [varchar](20) NULL,
	[Remark4] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_DSDF]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CY_DSDF](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[操作人] [nvarchar](50) NULL,
	[代付金额] [money] NULL,
	[代收金额] [money] NULL,
	[备注] [nvarchar](500) NULL,
	[操作时间] [nvarchar](50) NULL,
	[YL1] [nvarchar](50) NULL,
	[YL2] [nvarchar](50) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CY_Custer]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Custer](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[GuestCode] [varchar](50) NULL,
	[GuestName] [varchar](100) NULL,
	[GuestPhone] [varchar](50) NULL,
	[GuestTel] [varchar](50) NULL,
	[GuestFax] [varchar](50) NULL,
	[GuestSex] [varchar](20) NULL,
	[GuestLevel] [varchar](20) NULL,
	[GuestNation] [varchar](20) NULL,
	[GuestDate] [datetime] NULL,
	[GuestType] [varchar](20) NULL,
	[GuestAddress] [varchar](200) NULL,
	[UnitName] [varchar](100) NULL,
	[UnitAddress] [varchar](200) NULL,
	[GuestSource] [varchar](20) NULL,
	[CardID] [varchar](20) NULL,
	[Hobby] [varchar](200) NULL,
	[Taboo] [varchar](200) NULL,
	[YL1] [varchar](50) NULL,
	[YL2] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestPhone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户性别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestSex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户出生日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'GuestAddress'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'UnitName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'UnitAddress'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预留1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'YL1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预留2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Custer', @level2type=N'COLUMN',@level2name=N'YL2'
GO
/****** Object:  Table [dbo].[CY_Touch_Temp]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Touch_Temp](
	[LSH] [varchar](20) NULL,
	[PCode] [varchar](20) NULL,
	[PCount] [int] NULL,
	[TasteCode] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_CardPay]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_CardPay](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[HYKH] [varchar](20) NULL,
	[FKJE] [decimal](9, 2) NULL,
	[YE] [decimal](9, 2) NULL,
	[ZFSJ] [datetime] NULL,
	[UploadFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[HY_DWDis]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_DWDis](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DWBH] [varchar](10) NULL,
	[XLBH] [varchar](2) NULL,
	[Dis] [decimal](4, 2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_BusinessUser]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_BusinessUser](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[BusinessCode] [varchar](50) NULL,
	[BusinessName] [varchar](50) NULL,
	[Phone] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Adress] [varchar](50) NULL,
	[Remark] [varchar](200) NULL,
	[PrintName] [varchar](50) NULL,
	[Datakey] [varchar](50) NULL,
	[LicenseNo] [varchar](50) NULL,
	[GenKey] [varchar](50) NULL,
 CONSTRAINT [PK_CY_BusinessUser] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'公司编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'BusinessCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'公司名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'BusinessName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'Phone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'传真' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'Fax'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'Adress'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印字样' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BusinessUser', @level2type=N'COLUMN',@level2name=N'PrintName'
GO
SET IDENTITY_INSERT [dbo].[CY_BusinessUser] ON
INSERT [dbo].[CY_BusinessUser] ([id], [BusinessCode], [BusinessName], [Phone], [Fax], [Adress], [Remark], [PrintName], [Datakey], [LicenseNo], [GenKey]) VALUES (4, N'1234567890123', N'吃货宝餐厅试用版', N'13664073581', N'13664073581', N'吃货宝运营中心', NULL, N'欢迎使用吃货宝餐饮管理系统', N'ffde0d9cce0f8f44e3fb7291d550890d', NULL, N'C49302F2321469ABB4F52F2B36DA9C0C')
SET IDENTITY_INSERT [dbo].[CY_BusinessUser] OFF
/****** Object:  Table [dbo].[SCM_Bill]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Bill](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[OrderType] [varchar](10) NULL,
	[MaxBH] [varchar](10) NULL,
	[KJYear] [int] NULL,
	[Period] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_Bing]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Bing](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[JZLSH] [varchar](50) NULL,
	[LSH] [varchar](50) NULL,
	[TingBH] [varchar](20) NULL,
	[TaiBH] [varchar](20) NULL,
	[Remark] [varchar](200) NULL,
 CONSTRAINT [PK_CY_Bing] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结账流水号、主台位流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'JZLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'原流水表流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'台编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Bing', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[SCM_Goods]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Goods](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[GoodsCode] [varchar](20) NOT NULL,
	[GoodsName] [varchar](40) NULL,
	[Units] [varchar](10) NULL,
	[TypeCode] [varchar](10) NULL,
	[Brand] [varchar](10) NULL,
	[Packaging] [varchar](10) NULL,
	[MaxInventory] [decimal](9, 2) NULL,
	[MinInventory] [decimal](9, 2) NULL,
	[Shelflife] [int] NULL,
	[ShelfUnits] [varchar](10) NULL,
	[MethodAcc] [int] NULL,
	[State] [int] NULL,
	[PinYin] [varchar](50) NULL,
	[BarNo] [varchar](15) NULL,
 CONSTRAINT [PK_SCM_GOODS] PRIMARY KEY CLUSTERED 
(
	[GoodsCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'GoodsName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'TypeCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品牌' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'Brand'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'包装方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'Packaging'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大库存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'MaxInventory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最小库存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'MinInventory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保期期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'Shelflife'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保质期单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'ShelfUnits'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'成本核算方试' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'MethodAcc'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods'
GO
/****** Object:  Table [dbo].[CY_BackReason]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_BackReason](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[BH] [varchar](50) NULL,
	[ReasonDescription] [varchar](200) NULL,
	[Cost] [decimal](9, 2) NULL,
	[Remark] [varchar](50) NULL,
 CONSTRAINT [PrimaryKey] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BackReason', @level2type=N'COLUMN',@level2name=N'ID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BackReason', @level2type=N'COLUMN',@level2name=N'BH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'说明' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BackReason', @level2type=N'COLUMN',@level2name=N'ReasonDescription'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'费用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BackReason', @level2type=N'COLUMN',@level2name=N'Cost'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_BackReason', @level2type=N'COLUMN',@level2name=N'Remark'
GO
SET IDENTITY_INSERT [dbo].[CY_BackReason] ON
INSERT [dbo].[CY_BackReason] ([ID], [BH], [ReasonDescription], [Cost], [Remark]) VALUES (1, N'1', N'上错菜', CAST(1.00 AS Decimal(9, 2)), N'1')
SET IDENTITY_INSERT [dbo].[CY_BackReason] OFF
/****** Object:  Table [dbo].[SCM_Goods_TAcc]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Goods_TAcc](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[StoreCode] [varchar](20) NULL,
	[GoodsCode] [varchar](20) NULL,
	[GoodsCnt] [decimal](9, 2) NULL,
	[GoodsMoney] [decimal](9, 2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_TAcc', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_TAcc', @level2type=N'COLUMN',@level2name=N'GoodsCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_TAcc', @level2type=N'COLUMN',@level2name=N'GoodsMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'库存商品台帐总汇' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_TAcc'
GO
/****** Object:  Table [dbo].[SCM_Goods_Type]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Goods_Type](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[TypeCode] [varchar](10) NOT NULL,
	[TypeName] [varchar](20) NULL,
	[ParentType] [varchar](10) NULL,
	[MethodAcc] [varchar](10) NULL,
 CONSTRAINT [PK_SCM_Goods_Type] PRIMARY KEY CLUSTERED 
(
	[TypeCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料分类代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_Type', @level2type=N'COLUMN',@level2name=N'TypeCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'料分类名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_Type', @level2type=N'COLUMN',@level2name=N'TypeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上级代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_Type', @level2type=N'COLUMN',@level2name=N'ParentType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'核算方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_Type', @level2type=N'COLUMN',@level2name=N'MethodAcc'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料分类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Goods_Type'
GO
SET IDENTITY_INSERT [dbo].[SCM_Goods_Type] ON
INSERT [dbo].[SCM_Goods_Type] ([ID], [TypeCode], [TypeName], [ParentType], [MethodAcc]) VALUES (1, N'0', N'全部分类', N'-1', NULL)
SET IDENTITY_INSERT [dbo].[SCM_Goods_Type] OFF
/****** Object:  Table [dbo].[HY_ZheKou]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_ZheKou](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[CardType] [varchar](50) NULL,
	[DLBid] [char](10) NULL,
	[XLBid] [char](10) NULL,
	[ZheKou] [decimal](10, 3) NULL,
	[ShiFouYouXiao] [bit] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'卡类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_ZheKou', @level2type=N'COLUMN',@level2name=N'CardType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'大类编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_ZheKou', @level2type=N'COLUMN',@level2name=N'DLBid'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小类编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_ZheKou', @level2type=N'COLUMN',@level2name=N'XLBid'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_ZheKou', @level2type=N'COLUMN',@level2name=N'ZheKou'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否有效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_ZheKou', @level2type=N'COLUMN',@level2name=N'ShiFouYouXiao'
GO
/****** Object:  Table [dbo].[HY_LeiXing]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_LeiXing](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TypeId] [varchar](5) NOT NULL,
	[TypeName] [nvarchar](50) NOT NULL,
	[YouHuiType] [int] NOT NULL,
	[XiaoFeiType] [int] NOT NULL,
	[ShiFouChuZhi] [bit] NOT NULL,
	[ShiFouJiFen] [bit] NOT NULL,
	[ShiFouQiYong] [bit] NOT NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'TypeId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'TypeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员类型-0会员价-1会员折扣价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'YouHuiType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'消费类型-0金额消费-1限用次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'XiaoFeiType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否储值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'ShiFouChuZhi'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否积分' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'ShiFouJiFen'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否启用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_LeiXing', @level2type=N'COLUMN',@level2name=N'ShiFouQiYong'
GO
/****** Object:  Table [dbo].[SCM_InOutMain]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_InOutMain](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillCode] [varchar](20) NOT NULL,
	[BillDate] [datetime] NULL,
	[StoreCode] [varchar](10) NULL,
	[InoutFlag] [int] NULL,
	[PurCode] [varchar](10) NULL,
	[OperCode] [int] NULL,
	[OperBillCode] [varchar](20) NULL,
	[ChargeFlag] [int] NULL,
	[InoutClassCode] [int] NULL,
	[DeptCode] [varchar](10) NULL,
	[PersonCode] [varchar](10) NULL,
	[CusCode] [varchar](10) NULL,
	[SuppCode] [varchar](10) NULL,
	[PurOrderCode] [varchar](20) NULL,
	[Marker] [varchar](10) NULL,
	[CheckMan] [varchar](10) NULL,
	[KeepMan] [varchar](10) NULL,
	[KjYear] [int] NULL,
	[Period] [int] NULL,
	[Remark] [varchar](50) NULL,
 CONSTRAINT [PK_SCM_INOUTMAIN] PRIMARY KEY CLUSTERED 
(
	[BillCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'BillCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'BillDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收发标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'InoutFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'PurCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'业务类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'OperCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'对应业务单据号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'OperBillCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'费用类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'ChargeFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'出入类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'InoutClassCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'DeptCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'PersonCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'CusCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供应商编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'SuppCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购单编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'PurOrderCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'Marker'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'审核人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'CheckMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保管人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'KeepMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计年度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'KjYear'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计期间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'Period'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收发记录主表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutMain'
GO
/****** Object:  Table [dbo].[HY_DealLog]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_DealLog](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[CardID] [varchar](30) NOT NULL,
	[OldMoney] [decimal](9, 2) NOT NULL,
	[OldJF] [decimal](9, 2) NOT NULL,
	[DealMoney] [decimal](9, 2) NOT NULL,
	[FreeMoney] [decimal](9, 2) NOT NULL,
	[DealJF] [decimal](9, 2) NOT NULL,
	[CurMoney] [decimal](9, 2) NOT NULL,
	[CurJF] [decimal](9, 2) NOT NULL,
	[OperType] [int] NOT NULL,
	[OperTime] [datetime] NOT NULL,
	[OperCode] [varchar](4) NOT NULL,
	[OperName] [varchar](20) NOT NULL,
	[Pos] [varchar](4) NOT NULL,
	[DJBH] [varchar](20) NULL,
	[Remark1] [varchar](50) NULL,
	[Remark2] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[HY_DangWeiDA]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_DangWeiDA](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[DanWeiId] [varchar](20) NULL,
	[DanWeiName] [nvarchar](50) NULL,
	[QianDanRen] [nvarchar](50) NULL,
	[ShiFouHuiYuan] [int] NULL,
	[YouHuiZheKou] [decimal](4, 2) NULL,
	[JiZhangQuan] [int] NULL,
	[JiZhangShengFen] [varchar](50) NULL,
	[DanWeiXingZhi] [nvarchar](50) NULL,
	[XiHao] [nvarchar](150) NULL,
	[JiHui] [nvarchar](150) NULL,
	[GuoJia] [nvarchar](50) NULL,
	[ShengShi] [nvarchar](50) NULL,
	[Address] [nvarchar](100) NULL,
	[Tel] [varchar](11) NULL,
	[BeiZhu] [int] NULL,
	[DisType] [int] NULL,
	[Remark] [varchar](50) NULL,
	[Remark1] [varchar](50) NULL,
	[GZJE] [decimal](9, 2) NULL,
	[MaxMoeny] [decimal](9, 2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'DanWeiId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'DanWeiName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'签单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'QianDanRen'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否会员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'ShiFouHuiYuan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'优惠折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'YouHuiZheKou'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'记账权' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'JiZhangQuan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'记账身份' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'JiZhangShengFen'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位性质' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'DanWeiXingZhi'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'喜好' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'XiHao'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'忌讳' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'JiHui'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'国家' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'GuoJia'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'省市' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'ShengShi'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'Tel'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangWeiDA', @level2type=N'COLUMN',@level2name=N'BeiZhu'
GO
/****** Object:  StoredProcedure [dbo].[P_crosstable]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[P_crosstable]
@TableName nvarchar(256),--表名
@zz nvarchar(256),--交叉表最左面的列
@hz nvarchar(256),--交叉表最上面的列
@Content nvarchar(256),--交叉表的数数据字段
@sWhere varchar(1000),--查询的处理条件
@strSum as varchar(10) = 'Sum'   ,
@HSum int,--为1时在交叉表横向最右边加横向合计
@VSum int--为1时在交叉表纵向最下边加纵向合计
as
declare @s nvarchar(4000),@sql varchar(8000),@sql1 varchar(8000),@sql2 varchar(8000);
--规范条件
set @sWhere=case when @sWhere<>'' then ' where ('+@sWhere+')' else '' end
--判断横向字段是否大于纵向字段数目,如果是,则交换纵横字段
--生成交叉表处理语句
set @s='
set @s=''''
select @s=@s+'',[''+cast('+@hz+' as varchar)+'']='+@strSum+'(case '+@hz
+' when ''''''+cast('+@hz+' as varchar)+'''''' then '+@Content+' else 0  end)''
from '+@TableName+'
'+@sWhere+'
group by '+@hz+' '
exec sp_executesql @s
,N'@s varchar(8000) out'
,@sql out
--print(@s)
--print(@sql)
--是否生成合计字段的处理
declare @sum1 varchar(200),@sum2 varchar(200),@sum3 varchar(200)
select @sum1=case @HSum 
when 1 then ',合计='+@strSum+'('+@Content+')'
else '' end
,@sum2=case @VSum 
when 1 then ''+@zz+'=case grouping('
+@zz+') when 1 then ''合计'' 
else cast('+@zz+' as varchar) end'
else ''+@zz+'' end
 ,@sum3=case @VSum
  when 1 then ' with rollup'
  else '' end
--生成交叉表
--print(@zz)
set @sql1='select '+@sum2+@sql+@sum1+'   from '+@TableName +'  '+@sWhere+'  group by '+@zz+''+@sum3 --+'  order by 合计'
exec (@sql1)
GO
/****** Object:  Table [dbo].[SCM_Ledger]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Ledger](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[StoreCode] [varchar](10) NULL,
	[AreaCode] [varchar](10) NULL,
	[GoodsCode] [varchar](10) NULL,
	[BatchNo] [varchar](10) NULL,
	[KJYear] [int] NULL,
	[Period] [int] NULL,
	[StartCnt] [decimal](9, 2) NULL,
	[StartMoney] [decimal](9, 2) NULL,
	[ReciveCnt] [decimal](9, 2) NULL,
	[RecivePrice] [decimal](9, 2) NULL,
	[ReciveMoney] [decimal](9, 2) NULL,
	[SendCnt] [decimal](9, 2) NULL,
	[SendPrice] [decimal](9, 2) NULL,
	[SendMoeny] [decimal](9, 2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'批次' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'BatchNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计年度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'KJYear'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计期间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'Period'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'期初数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'StartCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'期初金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'StartMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期接收数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'ReciveCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期接收单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'RecivePrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期接金额收' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'ReciveMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期发出数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'SendCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期发出单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'SendPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本期发出金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger', @level2type=N'COLUMN',@level2name=N'SendMoeny'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'库存总帐' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Ledger'
GO
/****** Object:  StoredProcedure [dbo].[EmployeeDelete]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加职工信息
CREATE PROCEDURE [dbo].[EmployeeDelete]
@Msg varchar(500) output, 
@EmpNo varchar(50)
AS
BEGIN 
	declare @Count int;
	declare @String Varchar; 
-------------------------------------
	declare @EmpID int;
-------------------------------------
	--判断账号是否存在 
	select @Count = Count(1) from [Employee_BaseInfo]  where  EmpNo =@EmpNo
	if @Count = 0 
	begin
		set @Msg = @EmpNo + ' 该账号不存在 '
		return 0;
	end 
	select @EmpID = EmpID from Employee_BaseInfo where EmpNo =@EmpNo
	
	delete from Employee_Power where EmpID =@EmpID 
    ---删除员工
	delete from Employee where EmpNo =@EmpNo
	return 1;
END
GO
/****** Object:  Table [dbo].[SCM_NowAcc]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_NowAcc](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[GoodsCode] [varchar](10) NULL,
	[StoreCode] [varchar](10) NULL,
	[AreaCode] [varchar](10) NULL,
	[BatchNo] [varchar](10) NULL,
	[CurCnt] [decimal](9, 2) NULL,
	[CurPrice] [decimal](9, 2) NULL,
	[CurTotalMoney] [decimal](9, 2) NULL,
	[SafeCnt] [decimal](9, 2) NULL,
	[MaxCnt] [decimal](9, 2) NULL,
	[MinCnt] [decimal](9, 2) NULL,
	[InventState] [int] NULL,
	[TypeCode] [varchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'批号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'BatchNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'现存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'CurCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'现单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'CurPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'现总价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'CurTotalMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'安全库存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'SafeCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大库存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'MaxCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最小库存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'MinCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc', @level2type=N'COLUMN',@level2name=N'InventState'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'库存现存量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_NowAcc'
GO
/****** Object:  Table [dbo].[Print_PrintTask]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Print_PrintTask](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ModelType] [int] NULL,
	[TaskTime] [datetime] NULL,
	[TaskStatus] [int] NULL,
	[TaskCount] [int] NULL,
	[PrintData] [image] NULL,
	[PrintCode] [varchar](10) NULL,
	[FinishTime] [datetime] NULL,
 CONSTRAINT [PK_Print_PrintTask] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小票类型 模版类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintTask', @level2type=N'COLUMN',@level2name=N'ModelType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务生成时间（）' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintTask', @level2type=N'COLUMN',@level2name=N'TaskTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务状态（打印状态 打印 未打印 打印中）' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintTask', @level2type=N'COLUMN',@level2name=N'TaskStatus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务次数（打印次数）' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintTask', @level2type=N'COLUMN',@level2name=N'TaskCount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印机Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintTask', @level2type=N'COLUMN',@level2name=N'PrintCode'
GO
/****** Object:  Table [dbo].[SCM_OtherChild]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_OtherChild](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NULL,
	[GoodsCode] [varchar](10) NULL,
	[RealSendCnt] [decimal](9, 2) NULL,
	[RealReciveCnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[SendMoney] [decimal](9, 2) NULL,
	[ReciveMoney] [decimal](9, 2) NULL,
	[Remak] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单击编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实际发送数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'RealSendCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实际接收数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'RealReciveCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'出库金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'SendMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'入库金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'ReciveMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherChild', @level2type=N'COLUMN',@level2name=N'Remak'
GO
/****** Object:  Table [dbo].[SCM_OtherMain]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_OtherMain](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[BillDate] [datetime] NULL,
	[ComName] [varchar](50) NULL,
	[BillType] [int] NULL,
	[StoreCode] [varchar](10) NULL,
	[InoutFlag] [int] NULL,
	[Marker] [varchar](10) NULL,
	[Checker] [varchar](10) NULL,
	[Accer] [varchar](10) NULL,
	[KjYear] [int] NULL,
	[Period] [int] NULL,
	[Remark] [varchar](50) NULL,
 CONSTRAINT [PK_SCM_OtherMain] PRIMARY KEY CLUSTERED 
(
	[BillNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'BillDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'往来单位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'ComName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'BillType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'出入库标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'InoutFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'制单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'Marker'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'审核人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'Checker'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计年' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'KjYear'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计月' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'Period'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_OtherMain', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[Print_PrintInfo]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Print_PrintInfo](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[PrintCode] [varchar](50) NOT NULL,
	[PrintName] [varchar](50) NOT NULL,
	[PaperWidth] [int] NOT NULL,
	[interfaceType] [int] NOT NULL,
	[DriveName] [varchar](100) NULL,
	[PortName] [varchar](50) NULL,
	[Remark] [varchar](50) NULL,
	[Remark1] [varchar](50) NULL,
	[Remark2] [varchar](50) NULL,
	[Remark3] [varchar](50) NULL,
	[Remark4] [varchar](50) NULL,
 CONSTRAINT [PK_Print_PrintInfo] PRIMARY KEY CLUSTERED 
(
	[PrintCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'ID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印机编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'PrintCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印机名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'PrintName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'纸张宽度 单位mm' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'PaperWidth'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'接口类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'interfaceType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'驱动名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'DriveName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'端口名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'PortName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintInfo', @level2type=N'COLUMN',@level2name=N'Remark'
GO
/****** Object:  Table [dbo].[SCM_ParaCode]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_ParaCode](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](50) NULL,
	[Para] [varchar](10) NULL,
	[Remark] [varchar](100) NULL,
	[Module] [varchar](10) NULL,
	[ParentID] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编码名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参数值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'Para'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'所模属块' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'Module'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode', @level2type=N'COLUMN',@level2name=N'ParentID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参数表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_ParaCode'
GO
/****** Object:  Table [dbo].[Print_PrintAssociated]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Print_PrintAssociated](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[PrintCode] [int] NULL,
	[ProductCode] [varchar](10) NULL,
	[PrintOrderType] [int] NULL,
 CONSTRAINT [PK_Print_PrintAssociated] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印机Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintAssociated', @level2type=N'COLUMN',@level2name=N'PrintCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Print_PrintAssociated', @level2type=N'COLUMN',@level2name=N'ProductCode'
GO
/****** Object:  Table [dbo].[SCM_ProMaterial]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_ProMaterial](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ProCode] [varchar](50) NULL,
	[GoodsCode] [varchar](20) NULL,
	[Units] [varchar](10) NULL,
	[Quantity] [decimal](9, 2) NULL,
	[CurPrice] [decimal](9, 2) NULL,
 CONSTRAINT [PK_SCM_ProMaterial] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[SCM_MatterType]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SCM_MatterType](
	[ID] [nchar](10) NULL,
	[MatterTypeCode] [nchar](10) NULL,
	[MatterTypename] [nchar](10) NULL,
	[ParentCode] [nchar](10) NULL,
	[KindType] [nchar](10) NULL,
	[TypeRemark] [nchar](10) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SCM_Purchase_Main]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Purchase_Main](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[PurchaseCode] [varchar](20) NOT NULL,
	[PurchaseDate] [datetime] NULL,
	[PurchaseName] [varchar](50) NULL,
	[StartPerson] [varchar](20) NULL,
	[StartDate] [datetime] NULL,
	[PurchaseStatus] [int] NULL,
	[CheckPerson] [varchar](20) NULL,
	[CheckDate] [datetime] NULL,
	[DropMan] [varchar](20) NULL,
	[DropDate] [datetime] NULL,
	[FinishDate] [datetime] NULL,
	[Remark] [varchar](50) NULL,
	[ClearType] [char](10) NULL,
	[DeliveryType] [char](10) NULL,
	[SuppLierCode] [varchar](10) NULL,
	[PlanTime] [datetime] NULL,
 CONSTRAINT [PK_SCM_PURCHASE_MAIN] PRIMARY KEY CLUSTERED 
(
	[PurchaseCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'PurchaseCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'PurchaseDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'PurchaseName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发起人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'StartPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发起时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'StartDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购单状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'PurchaseStatus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'审核 人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'CheckPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'审核时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'CheckDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'DropMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'DropDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'完成日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'FinishDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结算方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'ClearType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'交货方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'DeliveryType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'SuppLierCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计划完成时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main', @level2type=N'COLUMN',@level2name=N'PlanTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购主表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_Main'
GO
/****** Object:  Table [dbo].[Scm_Matter]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Scm_Matter](
	[ID] [nchar](10) NULL,
	[MatterCode] [nchar](10) NULL,
	[MatterName] [nchar](10) NULL,
	[Units] [nchar](10) NULL,
	[Norms] [nchar](10) NULL,
	[MaxNum] [nchar](10) NULL,
	[MinNum] [nchar](10) NULL,
	[StoreCnt] [nchar](10) NULL,
	[StoreNum] [nchar](10) NULL,
	[Remark] [nchar](10) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SCM_Area]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SCM_Area](
	[ID] [nchar](10) NULL,
	[AreaDM] [nchar](10) NULL,
	[AreaMC] [nchar](10) NULL,
	[Area] [nchar](10) NULL,
	[Areartype] [nchar](10) NULL,
	[StoreDM] [nchar](10) NULL,
	[AreaRemark] [nchar](10) NULL
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[PrintSettingUpdate]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[PrintSettingUpdate]
@Msg varchar(200) output,
@IsPrintConsumption smallint,
@PrintConsumptionCount smallint,
@IsPrintCheckOut smallint,
@PrintCheckOutCount smallint,
@IsPrintPre smallint,
@PrintPreCount smallint,
@IsPrintRecharge smallint,
@PrintRechargeCount smallint,
@IsPrintKitchenSum smallint,
@PrintKitchenSumType smallint,
@IsPrintKitchenSeparate smallint,
@PrintKitchenSeparateType smallint
as
begin
UPDATE Print_PrintSetting
   SET 
      [IsPrintConsumption] = @IsPrintConsumption
      ,[PrintConsumptionCount] = @PrintConsumptionCount
      ,[IsPrintCheckOut] = IsPrintCheckOut
      ,[PrintCheckOutCount] = @PrintCheckOutCount
      ,[IsPrintPre] = @IsPrintPre
      ,[PrintPreCount] = @PrintPreCount
      ,[IsPrintRecharge] = @IsPrintRecharge
      ,[PrintRechargeCount] = @PrintRechargeCount
      ,[IsPrintKitchenSum] = @IsPrintKitchenSum
      ,[PrintKitchenSumType] = @PrintKitchenSumType
      ,[IsPrintKitchenSeparate] = @IsPrintKitchenSeparate
      ,[PrintKitchenSeparateType] = @PrintKitchenSeparateType
 WHERE ID=0
return 1;
end
GO
/****** Object:  Table [dbo].[SCM_RunAcc]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_RunAcc](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[OrderDate] [datetime] NULL,
	[BillNo] [varchar](20) NULL,
	[OrderType] [int] NULL,
	[StoreCode] [varchar](10) NULL,
	[AreaCode] [varchar](10) NULL,
	[GoodsCode] [varchar](10) NULL,
	[RecieveCnt] [decimal](9, 2) NULL,
	[SendCnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[CustCode] [varchar](10) NULL,
	[SupplierCode] [varchar](10) NULL,
	[Executor] [varchar](10) NULL,
	[State] [int] NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'OrderDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'OrderType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收入数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'RecieveCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发送数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'SendCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'CustCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供应商代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'SupplierCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'执行人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'Executor'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'库存流水台帐' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_RunAcc'
GO
/****** Object:  Table [dbo].[CY_HSysPay]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CY_HSysPay](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Code] [nvarchar](4) NULL,
	[CodeName] [nvarchar](20) NULL,
	[SystemFlag] [int] NULL,
	[UseFlag] [bit] NULL,
	[ScoreFlag] [int] NULL
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPay', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPay', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否是预置数据' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPay', @level2type=N'COLUMN',@level2name=N'SystemFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否启用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPay', @level2type=N'COLUMN',@level2name=N'UseFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'积分标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPay', @level2type=N'COLUMN',@level2name=N'ScoreFlag'
GO
SET IDENTITY_INSERT [dbo].[CY_HSysPay] ON
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (11, N'XJ', N'现金', 1, 1, 1)
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (12, N'YHK', N'银行卡', 1, 1, 1)
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (13, N'HYK', N'会员卡', 1, 1, 1)
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (14, N'GZ', N'挂帐', 1, 1, 0)
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (15, N'QD', N'签单', 1, 1, 0)
INSERT [dbo].[CY_HSysPay] ([ID], [Code], [CodeName], [SystemFlag], [UseFlag], [ScoreFlag]) VALUES (16, N'XJQ', N'现金券', 1, 1, 0)
SET IDENTITY_INSERT [dbo].[CY_HSysPay] OFF
/****** Object:  Table [dbo].[SCM_Store]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Store](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[DM] [varchar](10) NOT NULL,
	[MC] [varchar](20) NULL,
	[PersonCode] [varchar](10) NULL,
	[PersonHeader] [varchar](10) NULL,
	[Phone] [varchar](11) NULL,
	[Tel] [varchar](20) NULL,
	[MethodAcc] [varchar](10) NULL,
	[TypeCode] [varchar](10) NULL,
	[CycleCnt] [int] NULL,
	[Remark] [varchar](50) NULL,
	[WarnFlag] [int] NULL,
 CONSTRAINT [PK_SCM_STORE] PRIMARY KEY CLUSTERED 
(
	[DM] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'DM'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'MC'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'负责人编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'PersonCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'负责人名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'PersonHeader'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'移动电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'Phone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'固定电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'Tel'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'核算方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'MethodAcc'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'TypeCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点周期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'CycleCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store'
GO
/****** Object:  Table [dbo].[CY_HSysPara]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_HSysPara](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[Module] [nvarchar](50) NOT NULL,
	[KeyWords] [nvarchar](50) NOT NULL,
	[KeyName] [nvarchar](50) NOT NULL,
	[Para] [nvarchar](200) NOT NULL,
	[remark] [nvarchar](200) NULL,
	[DataTYpe] [varchar](10) NULL,
	[visiableFlag] [bit] NULL,
	[ReadonlyFlag] [bit] NULL,
 CONSTRAINT [PK_CY_HSysPara] PRIMARY KEY CLUSTERED 
(
	[KeyWords] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'模块' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'Module'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'关键字' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'KeyWords'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'中文名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'KeyName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参数值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'Para'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'DataTYpe'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可见性' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'visiableFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'只读' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HSysPara', @level2type=N'COLUMN',@level2name=N'ReadonlyFlag'
GO
SET IDENTITY_INSERT [dbo].[CY_HSysPara] ON
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (30, N'餐饮', N'A/Baccount', N'AB帐', N'A', N'A-A帐，B-B帐', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (11, N'会员', N'Addjifen', N'每消费金额,增加1分', N'1', N'每消费金额,增加1分', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (34, N'系统', N'AutoCardNO', N'是否允许手工输入卡号', N'0', N'0-允许，1不允许', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (39, N'餐饮伺服', N'AutoClear', N'自动清理打印任务', N'0', N'0表示不自动清理,1表示自动清理', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (41, N'餐饮伺服', N'AutoPrint', N'系统启动时自动开始打印任务', N'0', N'0表示不自动开始,1表示自动开始', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (4, N'会员', N'BirthRemind', N'前台自动运行会员生日提醒', N'0', N'0-是,1-否', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (28, N'系统', N'BranchCode', N'分店编号', N'0003', N'分店编号', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (65, N'餐饮库存', N'BsdNeedSh', N'报损单是否需要审核', N'0', N'0-否，1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (59, N'系统', N'CardType', N'会员卡使用类型', N'1', N'1-磁条卡,2-Ic卡,3-Rf卡,其他-磁条卡', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (21, N'餐饮', N'CfPrtEng', N'厨房打印打印英文', N'0', N'1为打印，0为不打印', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (62, N'餐饮库存', N'CgdNeedSh', N'采购单是否需要审核', N'0', N'0-否，1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (38, N'餐饮伺服', N'Cleardata', N'清理打印任务有效期', N'7', N'默认值为7天', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (72, N'餐饮库存', N'ClewCheck', N'入库生效时是否提示结算', N'0', N'0-不提示，1-提示', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (12, N'系统', N'CompanyID', N'商户编号', N'279953bf489398f9c461021735', N'商户编号', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (58, N'餐饮库存', N'CostingMethod', N'成本核算方式', N'0', N'0-月加权平均法 1-移动加权平均法', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (17, N'系统', N'CSDPrintType', N'厨师单打印方式', N'1', N'0-按打印机设置打印,1-按小类和打印机设置打印,2-一菜一单,3-整桌', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (14, N'系统', N'Datakey', N'连接密钥', N'123456', N'连接密钥', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (79, N'系统', N'DataVer', N'数据库版本', N'1.1', NULL, N'N', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (63, N'餐饮库存', N'DbsqNeedSh', N'调拨单是否需要审核', N'0', N'0-否，1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (40, N'餐饮伺服', N'delUprint', N'清理打印任务包含未打印', N'0', N'0表示不包含未打印任务,1表示包含', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (9, N'会员', N'DXQPort', N'读写器连接端口', N'0', N'读写器连接端口', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (74, N'餐饮', N'FwfFangFa', N'服务费收取方法', N'1', N'0-抹去小于一元的零头,取整到一元;1-抹去小于十元的零头,取整到十元;2-对于小于一元的零头,补整到一元;
           3-对于小于十元的零头补整到十元;4-四舍五入到元;5-按照实际金额收取', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (75, N'餐饮', N'FwfRemove', N'允许任意抹去服务费', N'0', N'0-不允许;1-允许', N'B', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (82, N'餐饮库存', N'GoodsInitial', N'商品库存期初初始化完毕', N'0', N'0，未完成初始化，1,已完成', N'N', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (22, N'餐饮', N'GuQing', N'品项达到估清设置值后，是否允许加单。', N'1', N'1表示不允许，0或者没有此记录为允许', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (31, N'系统', N'gzfk', N'挂账付款后是否允许其他付款方式', N'1', N'1-允许，0-不允许', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (71, N'餐饮', N'HdPrtCs', N'回单打印次数', N'0', N'参数值表示打印的次数', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (1, N'系统', N'HKYType', N'会员卡类别', N'1', N'0-磁条卡,1-IC卡,2-本机频设卡', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (48, N'餐饮库存', N'HOConnstrDb', N'总店数据库名称', N'', N'总店数据库名称', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (47, N'餐饮库存', N'HOConnstrIp', N'总店数据库连接地址', N'', N'总店服务器IP', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (50, N'餐饮库存', N'HOConnstrPss', N'总店数据库连接用户密码', N'', N'默认为空', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (49, N'餐饮库存', N'HOConnstrUser', N'总店数据库连接用户', N'sa', N'默认为sa', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (68, N'系统', N'HyCardNeedPss', N'会员卡使用时是否需要输入密码', N'1', N'0-不需要,1-需要', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (18, N'系统', N'HyChangeCard', N'根据会员积分和会员卡类型积分要求自动升级卡类型', N'0', N'0-不自动升级,1-自动升级', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (19, N'系统', N'HyCzkIntegral', N'储值卡付款是否参与积分', N'0', N'0-不参与,1-参与', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (10, N'系统', N'HyIntegralMethod', N'会员积分方法', N'1', N'0-不积分,1-按消费,2-按付款,3-按次数', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (32, N'系统', N'InvoiceCheck', N'发票管理', N'1', N'1-启用,0-不启用', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (26, N'系统', N'ISXYDW', N'是否使用系统协议单位', N'1', N'0-不使用，1-使用', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (6, N'会员', N'JCKID', N'计次卡关联编号', N'0', N'计次卡关联编号', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (64, N'餐饮库存', N'JslNotChange', N'净数量允许手工修改', N'0', N'0-否，1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (66, N'餐饮库存', N'JyrkNeedSh', N'结余入库是否需要审核', N'0', N'0-否，1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (36, N'餐饮', N'JzdPrtCs', N'结帐自动打印结帐单份数', N'0', N'打印结帐单份数', N'N', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (25, N'餐饮', N'KeWei_Price', N'按客位设置品项价格', N'0', N'1为按照客位设置的价格取数据，0为不按照', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (80, N'系统', N'KJYear', N'会计年度', N'2015', NULL, N'N', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (29, N'系统', N'LinkPass', N'连接密码', N'123', N'连接密码', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (3, N'会员', N'ManEnter', N'使用磁条卡时,禁止手工输入卡号', N'0', N'0-是,1-否', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (7, N'会员', N'MPKID', N'门票卡关联编号', N'0', N'门票卡关联编号', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (46, N'餐饮库存', N'MulShopId', N'当前连锁店编号', N'', N'当前连锁店编号', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (81, N'系统', N'Period', N'会计月份', N'6', NULL, N'N', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (44, N'餐饮伺服', N'PrintPrice', N'厨房是否打印品项价格', N'0', N'默认值为不打印', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (42, N'餐饮伺服', N'PrintUnit', N'是否打印品项单位', N'1', N'默认值为打印', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (51, N'餐饮库存', N'ProAppliAudit', N'是否需要审核配送申请单', N'1', N'0-不审核 1-审核', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (55, N'餐饮库存', N'ProAudit', N'是否需要审核配送单', N'1', N'0-不审核 1-审核', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (54, N'餐饮库存', N'ProChangePrice', N'配送单是否可以更改配送单价', N'0', N'0-不允许 1-允许', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (53, N'餐饮库存', N'ProGetPriceMethod', N'配送单取价方式', N'0', N'0-成本价 1-最新进价 2-上次配送价 3-系统配送价', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (52, N'餐饮库存', N'ProMustFromAppli', N'是否配送单必需由配送申请单转入', N'1', N'0-不是 1-是', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (56, N'餐饮库存', N'ProPriceCountMethod', N'配送单价格计算方式', N'0', N'0-金额=单价*数量
	 1-金额=单价*数量 金额可更改 2-单价=金额/数量', N'S', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (2, N'会员', N'PwdOrIs', N'使用储值卡结算时，需要密码验证', N'0', N'0-是,1-否', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (27, N'系统', N'RemoteConnection', N'service/本地', N'0', N'0-本地，1-网络', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (69, N'餐饮库存', N'RjCrkTimeUse', N'出入库单据引起库存数量变化使用时间标准', N'0', N'0-生效时间，1-出入库时间', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (70, N'餐饮库存', N'RjNeedDisClient', N'断开其它客户端才能日结', N'1', N'0-不断开，1-断开 警告：不选择此项时，日结过程中如果有其它客户端操作日结时间段内数据，会造成日结数据错误以及后续库存数据错误 ', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (15, N'系统', N'Serurl', N'同城卡付款地址', N'http://110.18.243.5:8888/PayService.asmx', N'同城卡付款地址', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (16, N'系统', N'SMSTempLete', N'挂机短信模版', N'', N'挂机短信模版', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (37, N'餐饮', N'SysBcTd', N'设置厨房制作的菜品制作完成之后，是否允许退单', N'0', N'0-否；1-是', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (8, N'系统', N'SysHyCardJf', N'会员积分设置', N'10', N'参数值n：按消费次数积分时,n表示消费一次积n分；否则,n表示每n元人民币积一分', N'N', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (35, N'餐饮', N'SysPrtHtmx', N'换台是否打印菜品明细', N'0', N'0-否；1-是', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (57, N'餐饮库存', N'UseLongDistanceDb', N'是否使用远程数据库连接', N'1', N'0-不使用 1-使用', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (45, N'餐饮库存', N'UseMulShop', N'使用连锁店管理', N'0', N'0-不使用，1-使用', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (13, N'系统', N'Weburl', N'WebService地址', N'http://b.chb365.cn/Syndata/index', N'数据同步地址', N'S', 0, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (5, N'会员', N'WriteToKard', N'使用IC/RF卡时,将数据写入卡中', N'0', N'0-是,1-否', N'B', 0, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (33, N'系统', N'xjqdz', N'现金券参与打折', N'0', N'0-不参与,1-参与', N's', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (73, N'餐饮', N'ZcPrtCs', N'总厨打印次数', N'1', N'参数值表示打印的次数', N'S', 1, 0)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (23, N'餐饮', N'赠券管理方式', N'是否按照编号、价格、有效期等管理赠券。', N'0', N'1表示要求，0或者没有此记录为不要求', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (24, N'餐饮', N'赠券默认有效期', N'赠券默认有效期。', N'0', N'默认值为180天', N'S', 1, 1)
INSERT [dbo].[CY_HSysPara] ([id], [Module], [KeyWords], [KeyName], [Para], [remark], [DataTYpe], [visiableFlag], [ReadonlyFlag]) VALUES (20, N'餐饮', N'总厨打印是否一菜一切', N'总厨打印是否一菜一切。', N'0', N'1表示一菜一切,0或者没有此记录为不要求', N'S', 1, 1)
SET IDENTITY_INSERT [dbo].[CY_HSysPara] OFF
/****** Object:  Table [dbo].[SCM_Store_Area]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Store_Area](
	[AreaCode] [varchar](2) NOT NULL,
	[AreaName] [varchar](20) NOT NULL,
	[StoreCode] [varchar](10) NOT NULL,
 CONSTRAINT [PK_SCM_GOODS_AREA] PRIMARY KEY CLUSTERED 
(
	[AreaCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Area', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Area', @level2type=N'COLUMN',@level2name=N'AreaName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Area', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Area'
GO
/****** Object:  Table [dbo].[CY_HisMx]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_HisMx](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[TingBH] [varchar](50) NULL,
	[TaiBH] [varchar](50) NULL,
	[LSH] [varchar](50) NULL,
	[AddPerson] [varchar](50) NULL,
	[AddTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[Code] [varchar](50) NULL,
	[CodeName] [varchar](50) NULL,
	[Units] [varchar](50) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Discount] [decimal](9, 2) NULL,
	[SJPrice] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[AddDept] [varchar](50) NULL,
	[Waiter] [varchar](50) NULL,
	[Bonus1] [decimal](9, 2) NULL,
	[ServiceBonus] [decimal](9, 2) NULL,
	[Processing] [varchar](50) NULL,
	[Bonus2] [decimal](9, 2) NULL,
	[ProcessingBonus] [decimal](9, 2) NULL,
	[Status] [varchar](10) NULL,
	[TPFlag] [varchar](10) NULL,
	[TaiFlag] [varchar](10) NULL,
	[BillType] [varchar](50) NULL,
	[MaxFlag] [varchar](50) NULL,
	[ZDFlag] [varchar](50) NULL,
	[IsDiscount] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[FirstType] [varchar](50) NULL,
	[SecondType] [varchar](50) NULL,
	[HYCardNo] [varchar](50) NULL,
	[MealType] [varchar](50) NULL,
	[CostMoney] [decimal](9, 2) NULL,
	[AddLSH] [varchar](50) NULL,
	[DiscountPermissions] [varchar](50) NULL,
	[KDInfo] [varchar](50) NULL,
	[UploadFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'台编号 客位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号 单据编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单人 ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'AddPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单事件' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'AddTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束事件' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'EndTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'正常售价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员售价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'HYPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'优惠折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Discount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实际价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'SJPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'PriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单部门' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'AddDept'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Waiter'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位提成金额1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Bonus1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务提成' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'ServiceBonus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加工' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Processing'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位提成2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Bonus2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加工提成金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'ProcessingBonus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套票标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'TPFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'台标记 房间标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'TaiFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计费标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'BillType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上线标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'MaxFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'转单标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'ZDFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否可以打折' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'IsDiscount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'大类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'FirstType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'SecondType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'HYCardNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'MealType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'成本金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'CostMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'AddLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣权限人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'DiscountPermissions'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开单信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'KDInfo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否更新。 0 未更新  1 已更新' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisMx', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
/****** Object:  Table [dbo].[CY_FJLog]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_FJLog](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[OldYSJE] [decimal](9, 2) NULL,
	[OldSSJE] [decimal](9, 2) NULL,
	[OperName] [varchar](20) NULL,
	[OperTime] [varchar](20) NULL,
	[OldCnt] [int] NULL,
	[NewYSJE] [decimal](9, 2) NULL,
	[NewSSJE] [decimal](9, 2) NULL,
	[JZName] [varchar](20) NULL,
	[JZSJ] [datetime] NULL,
	[NewCnt] [int] NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[SCM_Store_Type]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Store_Type](
	[DM] [varchar](10) NOT NULL,
	[MC] [varchar](20) NULL,
	[Remark] [varchar](50) NULL,
 CONSTRAINT [PK_SCM_STORE_TYPE] PRIMARY KEY CLUSTERED 
(
	[DM] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库类型代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Type', @level2type=N'COLUMN',@level2name=N'DM'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库类型名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Type', @level2type=N'COLUMN',@level2name=N'MC'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Type', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Store_Type'
GO
/****** Object:  Table [dbo].[CY_HisDjMx]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_HisDjMx](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](50) NULL,
	[PayCode] [varchar](50) NULL,
	[PayName] [varchar](50) NULL,
	[PayMoney] [decimal](18, 2) NULL,
	[Remark] [varchar](50) NULL,
	[UploadFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'付款代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'PayCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'付款名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'PayName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'PayMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否更新。 0 未更新  1 已更新' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDjMx', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
/****** Object:  Table [dbo].[SCM_supplier]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_supplier](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[SupplierCode] [varchar](10) NOT NULL,
	[SupplierName] [varchar](40) NULL,
	[LinkMan] [varchar](20) NULL,
	[Tel] [varchar](20) NULL,
	[Phone] [varchar](20) NULL,
	[QQ] [varchar](20) NULL,
	[Email] [varchar](50) NULL,
	[Address] [varchar](50) NULL,
	[Remark] [varchar](100) NULL,
	[LegalPerson] [varchar](20) NULL,
	[LegalPhone] [varchar](20) NULL,
	[LicNo] [varchar](20) NULL,
	[TaxNo] [varchar](20) NULL,
	[BankName] [varchar](20) NULL,
	[BankNo] [varchar](25) NULL,
	[BankAcc] [varchar](20) NULL,
	[ClearType] [int] NULL,
	[TypeCode] [varchar](10) NULL,
	[LevelCode] [varchar](10) NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_SCM_SUPPLIER] PRIMARY KEY CLUSTERED 
(
	[SupplierCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'SupplierCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'SupplierName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'LinkMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'固定电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'Tel'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'移动电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'Phone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'QQ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'QQ'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'邮箱' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'Email'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'法人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'LegalPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'法人电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'LegalPhone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'营业证号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'LicNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'税号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'TaxNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开户银行' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'BankName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'银行帐号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'BankNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开户名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'BankAcc'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结算方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'ClearType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商分类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'TypeCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商级别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'LevelCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供货商' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_supplier'
GO
/****** Object:  Table [dbo].[CY_ZDCZ]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CY_ZDCZ](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[OldLSH] [nvarchar](20) NULL,
	[OldTingBH] [nvarchar](20) NULL,
	[OldTaiBH] [nvarchar](20) NULL,
	[NewLSH] [nvarchar](20) NULL,
	[NewTingBH] [nvarchar](20) NULL,
	[NewTaiBH] [nvarchar](20) NULL,
	[AddLSH] [nvarchar](50) NULL,
	[AddPer] [nvarchar](20) NULL,
	[Code] [nvarchar](10) NULL,
	[CodeName] [nvarchar](50) NULL,
	[Units] [nvarchar](10) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[ZDper] [nvarchar](20) NULL,
	[CheckPerson] [nvarchar](20) NULL,
	[Time] [datetime] NULL,
	[Mark] [nvarchar](30) NULL
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'原流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'OldLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'原厅位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'OldTingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'原客位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'OldTaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'新流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'NewLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'新厅位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'NewTingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'新客位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'NewTaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单流水' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'AddLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'AddPer'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'转单人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'ZDper'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'操作时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Time'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ', @level2type=N'COLUMN',@level2name=N'Mark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'餐饮——转单明细' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_ZDCZ'
GO
/****** Object:  Table [dbo].[CY_YingYe]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_YingYe](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[LSH] [varchar](20) NULL,
	[TingBH] [varchar](10) NULL,
	[TaiBH] [varchar](10) NULL,
	[AddPerson] [varchar](10) NULL,
	[StartTime] [datetime] NULL,
	[EnTime] [datetime] NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](40) NULL,
	[Norms] [varchar](10) NULL,
	[Units] [varchar](10) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[HYPriceTotal] [decimal](9, 2) NULL,
	[AddDept] [varchar](20) NULL,
	[Macher] [varchar](10) NULL,
	[MachMoney] [decimal](9, 2) NULL,
	[Waiter] [varchar](10) NULL,
	[WaitMoney] [decimal](9, 2) NULL,
	[DiscountFlag] [int] NULL,
	[TCBH] [varchar](10) NULL,
	[TopLiCnt] [decimal](9, 2) NULL,
	[TopLiMoney] [decimal](9, 2) NULL,
	[CaclType] [int] NULL,
	[TurnFlag] [int] NULL,
	[Status] [varchar](20) NULL,
	[MarkStatus] [varchar](20) NULL,
	[PYM] [varchar](20) NULL,
	[Remark] [varchar](50) NULL,
	[BigLB] [varchar](2) NULL,
	[SmalLB] [varchar](2) NULL,
	[MinCostFlag] [int] NULL,
	[AddLS] [varchar](50) NULL,
	[MarkMethod] [varchar](100) NULL,
	[Flag] [int] NULL,
	[DisCount] [decimal](4, 2) NOT NULL,
	[PrintFlag] [int] NULL,
	[UploadFlag] [money] NULL,
	[RelationId] [varchar](50) NULL,
	[TCMC] [varchar](50) NULL,
	[WaitStatus] [varchar](50) NULL,
	[TCMXId] [varchar](50) NULL,
	[CostPrice] [decimal](9, 2) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'AddPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'StartTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结帐时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'EnTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Norms'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'正常价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'HYPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'正常价合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'PriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员价合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'HYPriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单部门' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'AddDept'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨师' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Macher'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厨提成师' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'MachMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单服务员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Waiter'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单服务员提成' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'WaitMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'能否折扣标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'DiscountFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TCBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上限数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TopLiCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上限金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TopLiMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'计费方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'CaclType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'转单标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'TurnFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'菜品状态。 0 未制作 ， 1 制作中 ， 2 已完成，3 已上菜' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'MarkStatus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'拼音码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'PYM'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'大类编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'BigLB'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小类编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'SmalLB'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参与最低消费标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'MinCostFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'AddLS'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品味说明' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'MarkMethod'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加单类型标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'Flag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'DisCount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'PrintFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上传标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'退菜关联id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YingYe', @level2type=N'COLUMN',@level2name=N'RelationId'
GO
/****** Object:  Table [dbo].[SCM_supplier_Type]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_supplier_Type](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[TypeCode] [varchar](10) NOT NULL,
	[TypeName] [varchar](20) NULL,
 CONSTRAINT [PK_SCM_supplier_Type] PRIMARY KEY CLUSTERED 
(
	[TypeCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_YDMX]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_YDMX](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[YDLSH] [varchar](20) NULL,
	[TingBH] [varchar](10) NULL,
	[TaiBH] [varchar](10) NULL,
	[Code] [varchar](10) NULL,
	[CodeName] [varchar](50) NULL,
	[Norms] [varchar](20) NULL,
	[Units] [varchar](20) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[ShiBie] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[remark1] [varchar](100) NULL,
	[InternetId] [varchar](50) NULL,
	[UploadFlag] [int] NULL,
	[DeleteFlag] [int] NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[ProdAttID] [bigint] NULL,
	[DisCount] [decimal](4, 2) NULL,
	[DisFlag] [int] NULL,
	[F1] [varchar](50) NULL,
	[F2] [varchar](50) NULL,
	[F3] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'YDLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'Code'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'CodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'Norms'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'ShiBie'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口味' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N' 备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'remark1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网络id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'InternetId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上传标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDMX', @level2type=N'COLUMN',@level2name=N'DeleteFlag'
GO
/****** Object:  Table [dbo].[CY_YDKWInfo]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_YDKWInfo](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[YDLSH] [nvarchar](20) NULL,
	[TingBH] [varchar](10) NULL,
	[TaiBH] [varchar](10) NULL,
	[InternetId] [varchar](50) NULL,
	[UploadFlag] [int] NULL,
	[DeleteFlag] [int] NULL,
	[ktlsh] [varchar](20) NULL,
	[FinishedFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网络ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDKWInfo', @level2type=N'COLUMN',@level2name=N'InternetId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上传标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDKWInfo', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YDKWInfo', @level2type=N'COLUMN',@level2name=N'DeleteFlag'
GO
/****** Object:  Table [dbo].[SCM_transfersMain]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_transfersMain](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[BillDate] [datetime] NULL,
	[SendStoreCode] [varchar](10) NULL,
	[SendArearCode] [varchar](10) NULL,
	[SendMan] [varchar](10) NULL,
	[ReciveStoreCode] [varchar](10) NULL,
	[ReciveArearCode] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_SCM_TRANSFERSMAIN] PRIMARY KEY CLUSTERED 
(
	[BillNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调拔单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'BillDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调出仓库' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'SendStoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调出货区' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'SendArearCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'经手人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'SendMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调入仓库' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'ReciveStoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调入货区' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'ReciveArearCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调拔单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersMain'
GO
/****** Object:  Table [dbo].[CY_YdInfo]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_YdInfo](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[YDLSH] [varchar](20) NOT NULL,
	[YDTime] [datetime] NULL,
	[ShiBie] [varchar](10) NULL,
	[YDYJ] [decimal](9, 2) NULL,
	[YJDTime] [datetime] NULL,
	[ReteTime] [int] NULL,
	[YDPerson] [varchar](20) NULL,
	[YDComp] [varchar](50) NULL,
	[CompType] [varchar](50) NULL,
	[LXDH] [varchar](50) NULL,
	[YDKWCnt] [int] NULL,
	[PersonCnt] [int] NULL,
	[Stand] [varchar](20) NULL,
	[ForntMan] [varchar](20) NULL,
	[Status] [int] NULL,
	[Remark] [varchar](50) NULL,
	[MarkManger] [varchar](20) NULL,
	[DropMan] [varchar](20) NULL,
	[DropRemark] [varchar](50) NULL,
	[DropTime] [datetime] NULL,
	[TeamFlag] [int] NULL,
	[UploadFlag] [int] NULL,
	[SrcFlag] [int] NULL,
	[InternetId] [varchar](50) NULL,
	[InternetOrderNo] [varchar](50) NULL,
	[DeleteFlag] [int] NULL,
	[IsNew] [int] NULL,
	[spare1] [varchar](50) NULL,
	[spare2] [varchar](50) NULL,
	[KTLSH] [varchar](50) NULL,
	[OrderType] [int] NULL,
	[FnishedFlag] [int] NULL,
	[KTCnt] [int] NULL,
 CONSTRAINT [PK_CY_YdInfo] PRIMARY KEY CLUSTERED 
(
	[YDLSH] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDLSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'ShiBie'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定押金' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDYJ'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预计到店时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YJDTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保留时长' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'ReteTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDComp'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'CompType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'LXDH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定客位数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'YDKWCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'人数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'PersonCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'定餐标准' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'Stand'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'接待人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'ForntMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单状态 0 预定 ,1 消费 2 作废， 3 消费完毕' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'营销经理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'MarkManger'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作废人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'DropMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作废原因' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'DropRemark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作废时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'DropTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宴会标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'TeamFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上传标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据来源标志  0 本地 1 网络' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'SrcFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网络ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'InternetId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网络订单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'InternetOrderNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'删除标记' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'DeleteFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否新订单  0 否 1 是' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'IsNew'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'整单口味备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'spare1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'spare2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预定流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_YdInfo', @level2type=N'COLUMN',@level2name=N'KTLSH'
GO
/****** Object:  Table [dbo].[HY_DangAn]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_DangAn](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[Cardid] [varchar](50) NOT NULL,
	[HyPassWord] [varchar](50) NOT NULL,
	[TypeId] [varchar](50) NOT NULL,
	[State] [int] NOT NULL,
	[XianYongCiShu] [int] NULL,
	[HyName] [nvarchar](20) NULL,
	[Sex] [char](2) NULL,
	[Address] [nvarchar](100) NULL,
	[Tel] [varchar](15) NULL,
	[FakaDate] [datetime] NOT NULL,
	[JieZhiDate] [datetime] NOT NULL,
	[Birthday] [datetime] NULL,
	[IDNumber] [varchar](18) NULL,
	[Hobby] [nvarchar](100) NULL,
	[DangQianScore] [int] NULL,
	[LeiJiScore] [int] NULL,
	[DangQianMoney] [decimal](10, 2) NULL,
	[LeiJiXiaoFei] [decimal](18, 2) NULL,
 CONSTRAINT [PK_HY_DangAn] PRIMARY KEY CLUSTERED 
(
	[Cardid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Cardid'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员密码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'HyPassWord'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'TypeId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态-0正常-1停用-2代售' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'限用次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'XianYongCiShu'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'HyName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Sex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Tel'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发卡时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'FakaDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'截止时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'JieZhiDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'生日' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Birthday'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'身份证号码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'IDNumber'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'爱好' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'Hobby'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'当前积分' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'DangQianScore'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'累计积分' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'LeiJiScore'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'当前金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'DangQianMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'累计消费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_DangAn', @level2type=N'COLUMN',@level2name=N'LeiJiXiaoFei'
GO
/****** Object:  Table [dbo].[SCM_InvocMain]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_InvocMain](
	[ID] [bigint] NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[BillDate] [datetime] NULL,
	[SendStoreCode] [varchar](10) NULL,
	[SendArearCode] [varchar](10) NULL,
	[SendMan] [varchar](10) NULL,
	[ReciveDeptCode] [varchar](10) NULL,
	[ReciveType] [varchar](10) NULL,
	[ReciveMan] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_SCM_INVOCMAIN] PRIMARY KEY CLUSTERED 
(
	[BillNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'BillDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发出仓库' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'SendStoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'发出货区' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'SendArearCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'经手人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'SendMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料部门' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'ReciveDeptCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'ReciveType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'ReciveMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料单主表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvocMain'
GO
/****** Object:  Table [dbo].[HY_CardManage]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HY_CardManage](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[OldCard] [varchar](50) NULL,
	[NewCard] [varchar](50) NULL,
	[CaoZuoYuan] [nvarchar](50) NULL,
	[CaoZuoDate] [datetime] NULL,
	[CaoZuoXingZhi] [nvarchar](50) NULL,
	[BeiZhu] [nvarchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'旧卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'OldCard'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'新卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'NewCard'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'操作员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'CaoZuoYuan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'操作时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'CaoZuoDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'操作性质' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'CaoZuoXingZhi'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HY_CardManage', @level2type=N'COLUMN',@level2name=N'BeiZhu'
GO
/****** Object:  Table [dbo].[CY_TCMX]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_TCMX](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TCBH] [varchar](50) NULL,
	[MXBH] [varchar](50) NULL,
	[MXName] [varchar](50) NULL,
	[Unit] [varchar](50) NULL,
	[Price] [decimal](9, 2) NULL,
	[HYPrice] [decimal](9, 2) NULL,
	[Count] [decimal](9, 2) NULL,
	[IsDiscount] [int] NULL,
	[ProcessPrice] [decimal](9, 2) NULL,
	[ServicePrice] [decimal](9, 2) NULL,
	[IsMin] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套餐主项编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'TCBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'明细编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'MXBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'明细名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'MXName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'正常售价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会员售价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'HYPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'Count'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否参与折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'IsDiscount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'加工提成' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'ProcessPrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务提成' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'ServicePrice'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否最低消费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_TCMX', @level2type=N'COLUMN',@level2name=N'IsMin'
GO
/****** Object:  Table [dbo].[SCM_TrukMain]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_TrukMain](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[BillDate] [datetime] NULL,
	[StoreCode] [varchar](10) NULL,
	[AreaCode] [varchar](10) NULL,
	[keepman] [varchar](10) NULL,
	[turkPerson1] [varchar](10) NULL,
	[turkPerson2] [varchar](10) NULL,
	[responsible] [varchar](10) NULL,
	[Marker] [varchar](10) NULL,
	[MarkDate] [datetime] NULL,
	[KJYear] [int] NULL,
	[period] [int] NULL,
	[CaclFlag] [int] NULL,
 CONSTRAINT [PK_SCM_TRUKMAIN] PRIMARY KEY CLUSTERED 
(
	[BillNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'BillDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保管人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'keepman'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点人1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'turkPerson1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点人2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'turkPerson2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'负责人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'responsible'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计年度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'KJYear'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'会计期间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain', @level2type=N'COLUMN',@level2name=N'period'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点表主表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukMain'
GO
/****** Object:  Table [dbo].[CY_Taste]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Taste](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BigCode] [varchar](10) NULL,
	[BigName] [varchar](20) NULL,
	[SmallCode] [varchar](10) NULL,
	[SmallName] [varchar](20) NULL,
	[Remark] [varchar](50) NULL,
	[YL1] [nchar](10) NULL,
	[YL2] [nchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口味类别编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste', @level2type=N'COLUMN',@level2name=N'BigCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类别名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste', @level2type=N'COLUMN',@level2name=N'BigName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口味编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste', @level2type=N'COLUMN',@level2name=N'SmallCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口味名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste', @level2type=N'COLUMN',@level2name=N'SmallName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'口味表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Taste'
GO
SET IDENTITY_INSERT [dbo].[CY_Taste] ON
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (1, N'', N'', N'001', N'微辣', N's', N'          ', N'          ')
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (2, NULL, NULL, N'002', N'不放辣椒', N'', NULL, NULL)
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (3, NULL, NULL, N'003', N'不放葱花', N'', NULL, NULL)
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (4, NULL, NULL, N'004', N'不放蒜', N'', NULL, NULL)
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (5, NULL, NULL, N'005', N'蒜蓉', N'', NULL, NULL)
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (6, NULL, NULL, N'006', N'清蒸', N'', NULL, NULL)
INSERT [dbo].[CY_Taste] ([ID], [BigCode], [BigName], [SmallCode], [SmallName], [Remark], [YL1], [YL2]) VALUES (7, NULL, NULL, N'007', N'刺身', N'', NULL, NULL)
SET IDENTITY_INSERT [dbo].[CY_Taste] OFF
/****** Object:  Table [dbo].[CY_Tai]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_Tai](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[TingBH] [varchar](10) NULL,
	[TaiBH] [varchar](10) NULL,
	[TaiName] [varchar](20) NULL,
	[MaxPerson] [int] NULL,
	[Status] [varchar](10) NULL,
	[StartTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[FeesType] [int] NULL,
	[HourFees] [decimal](9, 2) NULL,
	[FeesPercent] [decimal](9, 2) NULL,
	[PersonFees] [decimal](9, 2) NULL,
	[FeesMoney] [decimal](9, 2) NULL,
	[MaxMoney] [decimal](9, 2) NULL,
	[MinCostMoney] [decimal](9, 2) NULL,
	[PerKnot] [decimal](9, 2) NULL,
	[TeamFlag] [varchar](20) NULL,
	[LockFlag] [varchar](10) NULL,
	[Waiter] [varchar](10) NULL,
	[Remark] [varchar](50) NULL,
	[LSH] [varchar](20) NULL,
	[RoomFees] [decimal](9, 2) NULL,
	[floorid] [bigint] NULL,
	[taiid] [bigint] NULL,
	[UpdateTime] [timestamp] NULL,
	[TaiProptery] [varchar](50) NULL,
	[BookFlag] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'TaiName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可容人数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'MaxPerson'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'StartTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'EndTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务费收取方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'FeesType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小时费率' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'HourFees'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'消费比例' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'FeesPercent'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'按人收取' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'PersonFees'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'固定收费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'FeesMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务费上限' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'MaxMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最低消费金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'MinCostMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预结' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'PerKnot'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宴会流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'TeamFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'锁定标志' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'LockFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务员' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'Waiter'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'包房费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'RoomFees'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'台属性(散台、包房、雅间、卡座等)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_Tai', @level2type=N'COLUMN',@level2name=N'TaiProptery'
GO
/****** Object:  Table [dbo].[Sys_OperLog]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Sys_OperLog](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Module] [varchar](10) NULL,
	[BillCode] [varchar](20) NULL,
	[OperCode] [varchar](10) NULL,
	[OperName] [varchar](20) NULL,
	[OperType] [varchar](50) NULL,
	[OperDate] [datetime] NULL,
	[OperText] [varchar](1024) NULL,
	[machine_name] [varchar](50) NULL,
	[IP] [varchar](50) NULL,
	[Pos] [varchar](50) NULL,
	[Remark1] [varchar](50) NULL,
	[Remark2] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_FJHisDj]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_FJHisDj](
	[id] [bigint] NOT NULL,
	[TingBH] [varchar](50) NULL,
	[TaiBH] [varchar](50) NULL,
	[LSH] [varchar](20) NULL,
	[PosBH] [varchar](50) NULL,
	[HisTime] [datetime] NULL,
	[Cashier] [varchar](50) NULL,
	[JZMoney] [decimal](9, 2) NULL,
	[ServiceMoney] [decimal](9, 2) NULL,
	[CashMoney] [decimal](9, 2) NULL,
	[CardMoney] [decimal](9, 2) NULL,
	[XJQMoney] [decimal](9, 2) NULL,
	[QDMoney] [decimal](9, 2) NULL,
	[AccountMoney] [decimal](9, 2) NULL,
	[CreditMoney] [decimal](9, 2) NULL,
	[PDMoney] [decimal](9, 2) NULL,
	[OtherMoney] [decimal](9, 2) NULL,
	[MLMoney] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[PrintCount] [int] NULL,
	[MealType] [varchar](50) NULL,
	[JZKW] [varchar](50) NULL,
	[XSJL] [varchar](50) NULL,
	[MLPermissions] [varchar](50) NULL,
	[DisMoney] [decimal](9, 2) NULL,
	[DisPerson] [varchar](10) NULL,
	[UploadFlag] [int] NULL,
	[SDMLMoney] [decimal](9, 2) NULL,
	[PersonCnt] [int] NULL,
	[FJSJ] [datetime] NULL,
	[FJPerson] [varchar](20) NULL,
	[FJCnt] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_HisDj]    Script Date: 07/03/2015 09:20:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_HisDj](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[TingBH] [varchar](50) NULL,
	[TaiBH] [varchar](50) NULL,
	[LSH] [varchar](20) NULL,
	[PosBH] [varchar](50) NULL,
	[HisTime] [datetime] NULL,
	[Cashier] [varchar](50) NULL,
	[JZMoney] [decimal](9, 2) NULL,
	[ServiceMoney] [decimal](9, 2) NULL,
	[CashMoney] [decimal](9, 2) NULL,
	[CardMoney] [decimal](9, 2) NULL,
	[XJQMoney] [decimal](9, 2) NULL,
	[QDMoney] [decimal](9, 2) NULL,
	[AccountMoney] [decimal](9, 2) NULL,
	[CreditMoney] [decimal](9, 2) NULL,
	[PDMoney] [decimal](9, 2) NULL,
	[OtherMoney] [decimal](9, 2) NULL,
	[MLMoney] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[PrintCount] [int] NULL,
	[MealType] [varchar](50) NULL,
	[JZKW] [varchar](50) NULL,
	[XSJL] [varchar](50) NULL,
	[MLPermissions] [varchar](50) NULL,
	[DisMoney] [decimal](9, 2) NULL,
	[DisPerson] [varchar](10) NULL,
	[UploadFlag] [int] NULL,
	[SDMLMoney] [decimal](9, 2) NULL,
	[PersonCnt] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'厅编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'TingBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客位编号 台编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'TaiBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'流水号 单据编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'LSH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'POS编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'PosBH'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结账时间 ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'HisTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收银员 ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'Cashier'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'总金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'JZMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'服务费' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'ServiceMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'现金金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'CashMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'卡交款金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'CardMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'现金券交款金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'XJQMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'签单金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'QDMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'记账金额  挂账金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'AccountMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'信用卡 交款金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'CreditMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'跑单金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'PDMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'其他付款金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'OtherMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抹零金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'MLMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'原价合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'PriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'打印次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'PrintCount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'市别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'MealType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结账客位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'JZKW'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'营销经理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'XSJL'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抹零权限人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'MLPermissions'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否更新。0 未更新  1 已更新' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'UploadFlag'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'手动抹零' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_HisDj', @level2type=N'COLUMN',@level2name=N'SDMLMoney'
GO
/****** Object:  UserDefinedFunction [dbo].[FunOrderName]    Script Date: 07/03/2015 09:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create FUNCTION [dbo].[FunOrderName]
(
@BillNo nvarchar(20),
@OrderType int


)
returns nvarchar(20)
as
begin
  declare @str nvarchar(20)
  declare @result nvarchar(20)
  select @str=substring(@BillNo,1,len(@BillNo)-10)
  select @result=case @str 
  when 'QTR' then '其它入库单'
  when 'QTC' then '其它出库单'
  when 'LL' then '领料单'
  when 'TL' then '退料单'
  when 'LY' then '领用单'
  when 'CG' then '采购单'
  when 'JH' then '进货单'
  when 'TH' then '退货单'
  when 'PD' then '盘点单'
  when 'TB'  then (case @OrderType when 1 then '调入单' else '调出单' end)                            --'调拨单'
  else '其它单据' end
  return @result
end
GO
/****** Object:  Table [dbo].[CY_SYS_User]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_User](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[No] [varchar](50) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Password] [varchar](200) NOT NULL,
	[DepId] [int] NOT NULL,
	[State] [int] NOT NULL,
	[Img] [image] NULL,
	[Powers] [varchar](4000) NOT NULL,
	[Gender] [varchar](20) NULL,
	[HouseAddress] [varchar](100) NULL,
	[HousePhone] [varchar](50) NULL,
	[BirthDay] [varchar](50) NULL,
	[IdCardNo] [varchar](50) NULL,
	[DepartmentName] [varchar](50) NULL,
	[Position] [varchar](50) NULL,
	[Discount] [decimal](9, 2) NULL,
	[Proportion] [decimal](9, 2) NULL,
	[DiscountLimit] [decimal](9, 2) NULL,
	[MoLingLimit] [decimal](9, 2) NULL,
	[DiscountSum] [decimal](9, 2) NULL,
	[MoLingSum] [decimal](9, 2) NULL,
	[AuthorizationNo] [varchar](50) NULL,
	[Remark] [varchar](200) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'Gender'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'家庭住址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'HouseAddress'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'HousePhone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'生日' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'BirthDay'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'身份证号码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'IdCardNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'DepartmentName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'职务' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'Position'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'Discount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣限制' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'DiscountLimit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抹零限制' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'MoLingLimit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'折扣总额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'DiscountSum'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抹零总额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'MoLingSum'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'授权卡号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'AuthorizationNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CY_SYS_User', @level2type=N'COLUMN',@level2name=N'Remark'
GO
SET IDENTITY_INSERT [dbo].[CY_SYS_User] ON
INSERT [dbo].[CY_SYS_User] ([Id], [No], [Name], [Password], [DepId], [State], [Img], [Powers], [Gender], [HouseAddress], [HousePhone], [BirthDay], [IdCardNo], [DepartmentName], [Position], [Discount], [Proportion], [DiscountLimit], [MoLingLimit], [DiscountSum], [MoLingSum], [AuthorizationNo], [Remark]) VALUES (7, N'0000', N'管理员', N'+X6tL/VALPu65T266102Vt6p46+agqssjw41j5Ror4g=', 1, 0, NULL, N'', N'男', N'', N'', N'2015-01-21', N'', N'管理部', N'', CAST(0.00 AS Decimal(9, 2)), CAST(0.00 AS Decimal(9, 2)), CAST(0.00 AS Decimal(9, 2)), CAST(0.00 AS Decimal(9, 2)), CAST(0.00 AS Decimal(9, 2)), CAST(0.00 AS Decimal(9, 2)), NULL, N'')
SET IDENTITY_INSERT [dbo].[CY_SYS_User] OFF
/****** Object:  Table [dbo].[CY_SYS_Power]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_Power](
	[Id] [varchar](6) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[ParentId] [varchar](6) NOT NULL,
	[ShowInMenu] [bit] NOT NULL,
	[ClassName] [varchar](50) NULL,
	[icon] [varchar](50) NULL,
	[Ord] [int] NULL,
	[Module] [int] NULL,
 CONSTRAINT [PK_CY_SYS_Power] PRIMARY KEY NONCLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'001000', N'财务处理', N'000000', 1, N'', N'财务处理.png', 1, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'001001', N'反结账', N'001000', 1, N'CYManagerUI.FrontPos.FrmFJZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'001002', N'交班', N'001000', 1, N'CYManagerUI.FrontPos.FrmJBG', N'aaa.ico', 1, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'001004', N'已结账查询', N'001000', 1, N'CYManagerUI.FrontPos.FrmYJZCX', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085006', N'库存预警', N'085000', 1, NULL, NULL, 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'002000', N'前台营业', N'000000', 1, N'', N'前台营业小.png', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'002001', N'前台设置', N'002000', 1, N'CYManagerUI.FrontPos.FrmqtSite', N'', 1, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'002004', N'前台营业', N'002000', 1, N'CYManagerUI.FrontPos.TaiFT', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'011000', N'每日管理', N'000000', 1, N'', N'每日管理.png', 4, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'011001', N'品/项停用设定', N'011000', 1, N'CYManagerUI.Daily.FrmPXTingYong', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'011002', N'品/项时价设定', N'011000', 1, N'CYManagerUI.Daily.FrmPXShiJia', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'012000', N'会员报表', N'000000', 1, N'', N'会员报表.png', 8, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'012001', N'会员存款统计', N'012000', 1, N'CYManagerUI.HyReport.Frm_HYCK', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'012002', N'会员取款统计', N'012000', 1, N'CYManagerUI.HyReport.Frm_HYQK', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'012003', N'会员卡对账单', N'012000', 1, N'CYManagerUI.HyReport.Frm_HYAcc', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'012004', N'会员消费明细', N'012000', 1, N'CYManagerUI.HyReport.Frm_HYXF', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013000', N'营业统计', N'000000', 0, N'', N'营业统计.png', 5, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013002', N'时段营业统计', N'013000', 1, N'CYManagerUI.Query.Frm_YYTJ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013003', N'营业流水账', N'013000', 1, N'CYManagerUI.Query.Frm_YYLSZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013004', N'退单统计报表', N'013000', 1, N'CYManagerUI.Query.Frm_Tuidan', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013005', N'赠单统计报表', N'013000', 1, N'CYManagerUI.Query.Frm_ZDTJ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013006', N'签单/宴请报表', N'013000', 1, N'CYManagerUI.Query.Frm_QD', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013007', N'加单统计报表', N'013000', 1, N'CYManagerUI.Query.Frm_JDTJ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013008', N'转单情况统计', N'013000', 1, N'CYManagerUI.Query.Frm_RepZD', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013009', N'反结账情况统计', N'013000', 1, N'CYManagerUI.Query.Frm_RepFJZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013010', N'交班报表统计', N'013000', 1, N'CYManagerUI.Query.Frm_JB', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013015', N'挂账明细报表', N'013000', 1, N'CYManagerUI.Query.Frm_GZMX', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'013018', N'换台统计', N'013000', 1, N'CYManagerUI.Query.Frm_RepHT', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'014000', N'提成统计', N'000000', 1, N'', N'提成统计.png', 6, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'014001', N'厨师提成统计', N'014000', 1, N'CYManagerUI.Query.Frm_CSTC', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'014004', N'加单员提成统计', N'014000', 1, N'CYManagerUI.Query.Frm_JDYTC', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'015000', N'销售统计', N'000000', 1, N'', N'销售统计.png', 7, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'015001', N'按品项汇总', N'015000', 1, N'CYManagerUI.Query.Frm_ANPXTJ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'015002', N'按类别汇总', N'015000', 1, N'CYManagerUI.Query.Frm_ANLBHZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'015003', N'按厅位汇总', N'015000', 1, N'CYManagerUI.Query.Frm_ANTWHZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'015005', N'实际销售统计', N'015000', 1, N'CYManagerUI.Query.Frm_SJXXTJ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016000', N'会员管理', N'000000', 1, N'', N'会员管理.png', 3, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016001', N'查询密码', N'016000', 1, N'CYManagerUI.HyManage.FrmHYPwdQuery', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016002', N'会员存款', N'016000', 1, N'CYManagerUI.HyManage.FrmHyCunKuan', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016003', N'会员档案', N'016000', 1, N'CYManagerUI.HyManage.FrmHyFile', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016004', N'会员改密码', N'016000', 1, N'CYManagerUI.HyManage.FrmHyPwdAlter', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016005', N'会员换卡/补卡', N'016000', 1, N'CYManagerUI.HyManage.FrmHyBHCard', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016006', N'会员类型设置', N'016000', 1, N'CYManagerUI.HyManage.FrmHyTypeSZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016007', N'会员取款', N'016000', 1, N'CYManagerUI.HyManage.FrmHyQK', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016009', N'会员折扣设置', N'016000', 1, N'CYManagerUI.HyManage.FrmHyZheKouSZ', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016011', N'单位档案', N'016000', 1, N'CYManagerUI.HyManage.FrmDwFile', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'016012', N'挂账单位收款', N'016000', 1, N'CYManagerUI.HyManage.Frm_GZFK', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017000', N'基本资料', N'000000', 1, N'', N'基本资料.png', 9, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017001', N'企业管理', N'017000', 1, N'CYManagerUI.Base.FrmBaseBusinessUser', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017002', N'部门设置', N'017000', 1, N'CYManagerUI.Base.FrmBaseDepartmentList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017003', N'POS档案', N'017000', 1, N'CYManagerUI.Base.FrmBasePOSList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017004', N'人员管理', N'017000', 1, N'CYManagerUI.Base.FrmBaseStaffList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017006', N'类别/品项档案', N'017000', 1, N'CYManagerUI.Base.FrmBaseProductList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017007', N'市别管理', N'017000', 1, N'CYManagerUI.Base.FrmBaseMealTypeList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017008', N'付款方式', N'017000', 1, N'CYManagerUI.Base.FrmBasePayList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017009', N'厅/客位设置', N'017000', 1, N'CYManagerUI.Base.FrmBaseTableList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017010', N'退单说明', N'017000', 1, N'CYManagerUI.Base.FrmBaseBackReasonList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017011', N'标准客单', N'017000', 1, N'CYManagerUI.Base.FrmBaseTCList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017012', N'客人要求', N'017000', 1, N'CYManagerUI.Base.FrmBaseTasteList', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'017013', N'同步基础数据', N'017000', 0, N'CYManagerUI.Form2', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018000', N'管理设置', N'000000', 1, N'', N'管理设置.png', 10, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018001', N'系统设置', N'018000', 1, N'CYManagerUI.ManageFit.FrmMSysFit', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018004', N'品项折扣', N'018000', 1, N'CYManagerUI.ManageFit.FrmMPXZheKouFit', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018005', N'品项提成', N'018000', 1, N'CYManagerUI.ManageFit.FrmMPXTiCheng', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018019', N'菜单权限管理', N'018000', 1, N'CYManagerUI.Sys.FrmPowerManage', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'018020', N'日志管理', N'018000', 1, N'CYManagerUI.Query.Frm_OperLog', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'019000', N'预订管理', N'000000', 1, N'', N'预订小.png', 2, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'019001', N'预订记录', N'019000', 1, N'CYManagerUI.Order.OrderIndex', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'019002', N'餐台预订', N'019000', 1, N'CYManagerUI.Order.OrderCell', N'', 0, 1)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'081000', N'基本信息', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'081001', N'物料信息', N'081000', 1, N'CYManagerUI.SCM.Frm_Goods', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'081002', N'仓库信息', N'081000', 1, N'CYManagerUI.SCM.Frm_Store', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'081003', N'供应商信息', N'081000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'082000', N'初始值设定', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'082001', N'期初值设定', N'082000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083000', N'出入库', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083001', N'采购单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083002', N'进货单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083003', N'退货单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083004', N'其它入库单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083005', N'其它出库单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083006', N'调拨单', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083007', N'采购入库', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083008', N'单据查询', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'084000', N'盘点月结', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'084001', N'盘点单', N'084000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'084002', N'盘点处理', N'084000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'084003', N'月末核算', N'084000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'084004', N'月结', N'084000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085000', N'报表查询', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085001', N'进货统计', N'085000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085002', N'出货统计', N'085000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085003', N'往来分析', N'085000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085004', N'库存状况', N'085000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'085005', N'其它出入库统计', N'085000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'086000', N'其它', N'000000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'086001', N'帮助', N'086000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'086002', N'关于', N'086000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'083009', N'库存台账', N'083000', 1, N'', N'', 0, 2)
INSERT [dbo].[CY_SYS_Power] ([Id], [Name], [ParentId], [ShowInMenu], [ClassName], [icon], [Ord], [Module]) VALUES (N'019003', N'餐桌预订查询', N'019000', 1, N'CYManagerUI.Order.OrderTableDetail', NULL, 0, 1)
/****** Object:  Table [dbo].[CY_SYS_NetTableMap]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_NetTableMap](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[NetFileName] [varchar](20) NULL,
	[NetFiledType] [varchar](20) NULL,
	[LocalTableName] [varchar](20) NULL,
	[LocalFiled] [varchar](20) NULL,
	[LocalFileType] [varchar](20) NULL,
	[Remark] [varchar](50) NULL,
	[TableName] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CY_SYS_Log]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CY_SYS_Log](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[流水号] [varchar](50) NOT NULL,
	[操作用户] [varchar](50) NOT NULL,
	[操作模块] [varchar](50) NOT NULL,
	[操作内容] [varchar](500) NOT NULL,
	[操作日期] [datetime] NOT NULL,
	[进入时间] [datetime] NOT NULL,
	[操作机器] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Cy_Sys_Log] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[SCM_InOutChild]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_InOutChild](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillCode] [varchar](20) NULL,
	[StoreCode] [varchar](10) NULL,
	[AreaCode] [varchar](10) NULL,
	[GoodsCode] [varchar](10) NULL,
	[ShouldSendCnt] [decimal](9, 2) NULL,
	[RealSendCnt] [decimal](9, 2) NULL,
	[ShouleReciveCnt] [decimal](9, 2) NULL,
	[RealReciveCnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[SendMoney] [decimal](9, 2) NULL,
	[ReciveMoney] [decimal](9, 2) NULL,
	[BatchNo] [varchar](10) NULL,
	[InvalidDate] [datetime] NULL,
	[Remak] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单据号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'BillCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仓库代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'StoreCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'货区代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'AreaCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'应发数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'ShouldSendCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实发数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'RealSendCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'应收数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'ShouleReciveCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'应收数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'RealReciveCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实发金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'SendMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'实收金额' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'ReciveMoney'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'批号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'BatchNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'失效日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild', @level2type=N'COLUMN',@level2name=N'InvalidDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收发记录子表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InOutChild'
GO
/****** Object:  Table [dbo].[SCM_InvoChild]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_InvoChild](
	[ID] [bigint] NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[GoodsCode] [varchar](10) NULL,
	[GoodsName] [varchar](20) NULL,
	[GoodsCnt] [decimal](9, 2) NULL,
	[GoodsUnits] [varchar](10) NULL,
	[GoodsNorms] [varchar](10) NULL,
	[Price] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'GoodsName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'GoodsCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'GoodsUnits'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'GoodsNorms'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'PriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'领料单子表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_InvoChild'
GO
/****** Object:  Table [dbo].[SCM_Purchase_detial]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_Purchase_detial](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[RowNo] [int] NULL,
	[PurchaseCode] [varchar](20) NULL,
	[GoodsCode] [varchar](10) NULL,
	[GoodeName] [varchar](40) NULL,
	[GoodsRemark] [varchar](50) NULL,
	[Units] [varchar](10) NULL,
	[Cnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[ReceiptCnt] [decimal](9, 2) NULL,
	[MaxReceDate] [datetime] NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'行号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'RowNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'PurchaseCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'GoodeName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'GoodsRemark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'Units'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'Cnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'己接收数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'ReceiptCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大收货日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'MaxReceDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采购明细单' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_Purchase_detial'
GO
/****** Object:  Table [dbo].[SCM_transfersChild]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_transfersChild](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[GoodsCode] [varchar](10) NULL,
	[GoodsName] [varchar](20) NULL,
	[GoodsCnt] [decimal](9, 2) NULL,
	[GoodsUnits] [varchar](10) NULL,
	[GoodsNorms] [varchar](10) NULL,
	[Price] [decimal](9, 2) NULL,
	[PriceTotal] [decimal](9, 2) NULL,
	[Remark] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调拔单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'物料名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'GoodsName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'GoodsCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'GoodsUnits'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'GoodsNorms'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'合计' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'PriceTotal'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'调拔单子表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_transfersChild'
GO
/****** Object:  Table [dbo].[SCM_TrukChild]    Script Date: 07/03/2015 09:20:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SCM_TrukChild](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[BillNo] [varchar](20) NOT NULL,
	[GoodsCode] [varchar](10) NULL,
	[AccCnt] [decimal](9, 2) NULL,
	[TrukCnt] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[OverageCnt] [decimal](9, 2) NULL,
	[LossCnt] [decimal](9, 2) NULL,
	[Remark] [varchar](50) NULL,
	[CaclDate] [datetime] NULL,
	[CaclBillNo] [varchar](20) NULL,
	[CaclType] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'BillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'GoodsCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'帐面数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'AccCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'TrukCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'Price'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘盈数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'OverageCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘亏数量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'LossCnt'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'处理日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'CaclDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'处理单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild', @level2type=N'COLUMN',@level2name=N'CaclBillNo'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'盘点明细表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SCM_TrukChild'
GO
/****** Object:  Trigger [tr_DepartmentPX_BM_Delete]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE trigger [dbo].[tr_DepartmentPX_BM_Delete]
on [dbo].[CY_SYS_Department]
    for delete --插入触发
as
    --定义变量
    declare  @DCode varchar(20)
    --在inserted表中查询已经插入记录信息
    select  @DCode = DepartmentCode from deleted;
    delete CY_SYS_DepartmentPX WHERE DepartmentCode=@DCode
GO
/****** Object:  Trigger [tr_DepartmentPX_BM]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE trigger [dbo].[tr_DepartmentPX_BM]
on [dbo].[CY_SYS_Department]
    for insert --插入触发
as
    --定义变量
    declare  @DCode varchar(20)
    --在inserted表中查询已经插入记录信息
    select  @DCode = DepartmentCode from inserted;
    insert CY_SYS_DepartmentPX(DepartmentCode,TypeBianMa,KeYongBiaoJi) select @Dcode,bigcode+smallcode,1 from CY_Leibie
    where SmallCode <>''
GO
/****** Object:  Trigger [tr_DepartmentPX_PX_Delete]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create trigger [dbo].[tr_DepartmentPX_PX_Delete]
on [dbo].[CY_Leibie]
    for delete --插入触发
as
    
    --定义变量
    declare  @LCode varchar(20),@SLCode varchar(20)
    select @SLCode=smallcode from deleted
    if(@SLCode<>'')--判断增加小类的时候再进行添加记录
    begin
    --在inserted表中查询已经插入记录信息
    select  @LCode = BigCode+SmallCode from deleted;
    delete CY_SYS_DepartmentPX WHERE TypeBianMa=@LCode 
    end
GO
/****** Object:  View [dbo].[V_CY_SYS_DepartmentPX]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_CY_SYS_DepartmentPX]
AS
SELECT     dbo.CY_SYS_DepartmentPX.id, dbo.CY_SYS_DepartmentPX.DepartmentCode, LEFT(dbo.CY_SYS_DepartmentPX.TypeBianMa, 2) AS dl, 
                      RIGHT(dbo.CY_SYS_DepartmentPX.TypeBianMa, 2) AS xl, dbo.CY_SYS_DepartmentPX.KeYongBiaoJi, dbo.CY_SYS_Department.Name, dbo.CY_Leibie.BigName, 
                      dbo.CY_Leibie.SmallName
FROM         dbo.CY_SYS_DepartmentPX INNER JOIN
                      dbo.CY_SYS_Department ON dbo.CY_SYS_DepartmentPX.DepartmentCode = dbo.CY_SYS_Department.DepartmentCode INNER JOIN
                      dbo.CY_Leibie ON LEFT(dbo.CY_SYS_DepartmentPX.TypeBianMa, 2) = dbo.CY_Leibie.BigCode AND RIGHT(dbo.CY_SYS_DepartmentPX.TypeBianMa, 2) 
                      = dbo.CY_Leibie.SmallCode
GO
/****** Object:  Trigger [tr_DepartmentPX_PX]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create trigger [dbo].[tr_DepartmentPX_PX]
on [dbo].[CY_Leibie]
    for insert --插入触发
as
    
    --定义变量
    declare  @LCode varchar(20),@SLCode varchar(20)
    select @SLCode=smallcode from inserted
    if(@SLCode<>'')--判断增加小类的时候再进行添加记录
    begin
    --在inserted表中查询已经插入记录信息
    select  @LCode = BigCode+SmallCode from inserted;
    insert CY_SYS_DepartmentPX(DepartmentCode,TypeBianMa,KeYongBiaoJi) select DepartmentCode,@LCode,1 from CY_sys_Department 
    end
GO
/****** Object:  UserDefinedFunction [dbo].[fun_getSmallName]    Script Date: 07/03/2015 09:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create function [dbo].[fun_getSmallName](
@ProductCode varchar(4000)
) 
RETURNS varchar(200)
--返回类型为varchar长度为4000
AS 
BEGIN 
	declare @returnValue varchar(200)
	declare @BigCode varchar(50),@SmallCode varchar(50)
	select @BigCode = LEFT(LBCODE,2),@SmallCode = RIGHT(LBCode,2) FROM CY_Product where Code  =@ProductCode
	select top  1 @returnValue = SmallName from CY_Leibie where BigCode =@BigCode and SmallCode = @SmallCode
	return @returnValue
END
GO
/****** Object:  UserDefinedFunction [dbo].[fun_getBigName]    Script Date: 07/03/2015 09:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create function [dbo].[fun_getBigName](
@ProductCode varchar(4000)
) 
RETURNS varchar(200)
--返回类型为varchar长度为4000
AS 
BEGIN 
declare @returnValue varchar(200)
declare @BigCode varchar(50),@SmallCode varchar(50)
select @BigCode = LEFT(LBCODE,2),@SmallCode = RIGHT(LBCode,2) FROM CY_Product where Code  =@ProductCode
select top  1 @returnValue = Bigname from CY_Leibie where BigCode =@BigCode 
return @returnValue
END
GO
/****** Object:  View [dbo].[V_JZJC]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_JZJC]
AS
SELECT     HisMx.LSH AS 单据流水号, Leibie.SmallName AS 类别, SUM(HisMx.SJPrice * HisMx.Cnt) AS 价格, HisMx.EndTime AS 结账时间, HisMx.CodeName AS 品项名, 
                      HisDj.ServiceMoney AS 服务费, HisDj.SDMLMoney AS 抹零, HisDj.MLMoney AS 自动抹零, HisDj.DisMoney AS 优惠
FROM         dbo.CY_HisMx AS HisMx INNER JOIN
                      dbo.CY_Leibie AS Leibie ON Leibie.BigCode = HisMx.FirstType AND Leibie.SmallCode = HisMx.SecondType INNER JOIN
                      dbo.CY_HisDj AS HisDj ON HisMx.LSH = HisDj.LSH
GROUP BY HisMx.LSH, Leibie.SmallName, HisMx.SJPrice, HisMx.EndTime, HisMx.Cnt, HisMx.CodeName, HisDj.ServiceMoney, HisDj.SDMLMoney, HisDj.MLMoney, 
                      HisDj.CashMoney, HisDj.DisMoney
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "HisMx"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 239
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Leibie"
            Begin Extent = 
               Top = 6
               Left = 277
               Bottom = 125
               Right = 437
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "HisDj"
            Begin Extent = 
               Top = 6
               Left = 475
               Bottom = 125
               Right = 651
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'V_JZJC'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'V_JZJC'
GO
/****** Object:  StoredProcedure [dbo].[EmployeeUpdate]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 修改职工信息
CREATE PROCEDURE [dbo].[EmployeeUpdate]
@Msg varchar(500) output, 
@EmpNo varchar(50), 
@EmpName varchar(50), 
@EmpPwd varchar(200),  
@DepartmentID int, 
@PowerValue varchar(1000),
@EmpState int 
AS
BEGIN 
	declare @Count int;
	declare @String Varchar;  
----------------------------------
	declare @EmpID int;
----------------------------------
	--判断账号是否存在 
	select @Count = Count(1) from [System_Employee]  where  EmpNo =@EmpNo
	if @Count = 0 
	begin
		set @Msg = @EmpNo + ' 该账号已存在 '
		return 0;
	end 
	--更新用户信息。
	if len(@EmpPwd) = 0 
	begin
		update Employee set EmpName=@EmpName,DepartmentID=@DepartmentID,EmpState=@EmpState where EmpNo =@EmpNo
	end
	else
	begin
		update Employee set EmpName=@EmpName,EmpPwd=@EmpPwd,DepartmentID=@DepartmentID,EmpState=@EmpState where EmpNo =@EmpNo
	end
	---更新权限
	delete from dbo.Employee_Power where EmpID = @EmpID
	if @PowerValue != ''
	begin	
		DECLARE Power_cursor CURSOR FOR select string from dbo.func_split(',',@PowerValue)
        open Power_cursor
        FETCH NEXT FROM Power_cursor INTO @String
        WHILE @@FETCH_STATUS = 0
            begin
                insert into dbo.Employee_Power(EmpID,PowerID)values(@EmpID,@String)
            
                FETCH NEXT FROM Power_cursor INTO @String
            end
        close Power_cursor
		DEALLOCATE Power_cursor
	end
	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[EmployeeAdd]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加职工信息
CREATE PROCEDURE [dbo].[EmployeeAdd]
@Msg varchar(500) output, 
@EmpNo varchar(50), 
@EmpName varchar(50), 
@EmpPwd varchar(200),  
@DepartmentID int, 
@PowerValue varchar(1000),
@EmpState int 
AS
BEGIN 
	declare @Count int;
	declare @String Varchar;
------------------------------------
	declare @EmpID int; 
	--判断账号是否存在 
	select @Count = Count(1) from [Employee_BaseInfo]  where  EmpNo =@EmpNo
	if @Count != 0 
	begin
		set @Msg = @EmpNo + ' 该账号已存在 '
		return 0;
	end 
    -- 添加员工信息
  	INSERT INTO [Employee_BaseInfo](
		[EmpNo],[EmpName],[EmpPwd],[DepartmentID],[EmpState]
	)VALUES(
		@EmpNo,@EmpName,@EmpPwd,@DepartmentID,@EmpState
	)
	--更新用户权限
	select @EmpID = EmpID from [Employee_BaseInfo]  where  EmpNo =@EmpNo
	delete from dbo.Employee_Power where EmpID = @EmpID
	if @PowerValue != ''
	begin	
		DECLARE Power_cursor CURSOR FOR select string from dbo.func_split(',',@PowerValue)
        open Power_cursor
        FETCH NEXT FROM Power_cursor INTO @String
        WHILE @@FETCH_STATUS = 0
            begin
                insert into dbo.Employee_Power(EmpID,PowerID)values(@EmpID,@String)
            
                FETCH NEXT FROM Power_cursor INTO @String
            end
        close Power_cursor
		DEALLOCATE Power_cursor
	end
	return 1;
END
GO
/****** Object:  View [dbo].[V_CY_ProductEx]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_CY_ProductEx]
AS
SELECT     dbo.CY_Product.ID, dbo.CY_Product.LBCode, dbo.CY_Product.Code, dbo.CY_Product.CodeName, dbo.CY_Product.PYM, dbo.CY_Product.Num, 
                      dbo.CY_Product.DiscountFlag, dbo.CY_Product.MaxDiscount, dbo.CY_Product.TBFlag, dbo.CY_Product.CaclType, dbo.CY_Product.MarkType, 
                      dbo.CY_Product.CFPrint1, dbo.CY_Product.CFPrint2, dbo.CY_Product.CFprint3, dbo.CY_Product.CFPrint4, dbo.CY_Product.CFZDPrint, dbo.CY_Product.ZCPrint, 
                      dbo.CY_Product.PCPrint, dbo.CY_Product.LimiTime, dbo.CY_Product.Marker, dbo.CY_Product.Pic, dbo.CY_Product.Remark, dbo.CY_Product.Memo, 
                      dbo.CY_Product.goodsid, dbo.CY_Product.PersonCount, dbo.CY_Product.UPFlag, dbo.CY_Product.UpPicFlag, dbo.CY_Product.TakeawayFlag, 
                      dbo.CY_Product.RecommendDishesFlag, dbo.CY_Product.AutoSubtract, dbo.CY_Product.SubType, dbo.CY_Product_Property.Norms, dbo.CY_Product_Property.Units, 
                      dbo.CY_Product_Property.Price, dbo.CY_Product_Property.HYPrice, dbo.CY_Product_Property.ChengBenJia, dbo.CY_Product_Property.JiaGongTiCheng, 
                      dbo.CY_Product_Property.FuWuTiCheng, dbo.CY_Product_Property.ShiFouShiJia, dbo.CY_Product_Property.ShiJiaMoney, dbo.CY_Product_Property.CuXiaoKaiShi, 
                      dbo.CY_Product_Property.CuXiaoJieShu, dbo.CY_Product_Property.CuXiaoMoney
FROM         dbo.CY_Product INNER JOIN
                      dbo.CY_Product_Property ON dbo.CY_Product.Code = dbo.CY_Product_Property.Code
GO
/****** Object:  View [dbo].[V_YQQD]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_YQQD]
AS
SELECT     HisDj.LSH AS 单据编号, Ting.TingMC AS 厅名称, Tai.TaiName AS 客位名称, HisDj.HisTime AS 结账时间, HisDj.JZMoney AS 总金额, HisDjMx.PayName AS 付款方式, 
                      HisDjMx.PayMoney AS 付款金额, HisDj.Cashier AS 收银员
FROM         dbo.CY_HisDj AS HisDj INNER JOIN
                      dbo.CY_HisDjMx AS HisDjMx ON HisDj.LSH = HisDjMx.LSH INNER JOIN
                      dbo.CY_Ting AS Ting ON HisDj.TingBH = Ting.TingBH INNER JOIN
                      dbo.CY_Tai AS Tai ON HisDj.TaiBH = Tai.TaiBH AND Tai.TingBH = Ting.TingBH
GROUP BY HisDj.LSH, Ting.TingMC, Tai.TaiName, HisDj.HisTime, HisDj.JZMoney, HisDjMx.PayName, HisDj.Cashier, HisDjMx.PayMoney
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "HisDj"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 198
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "HisDjMx"
            Begin Extent = 
               Top = 6
               Left = 236
               Bottom = 125
               Right = 378
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Ting"
            Begin Extent = 
               Top = 6
               Left = 416
               Bottom = 125
               Right = 558
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Tai"
            Begin Extent = 
               Top = 6
               Left = 596
               Bottom = 125
               Right = 755
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'V_YQQD'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'V_YQQD'
GO
/****** Object:  View [dbo].[View_YDTableDetail]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[View_YDTableDetail]
AS
SELECT     dbo.CY_YdInfo.YDLSH, dbo.CY_YdInfo.YJDTime, dbo.CY_YdInfo.ShiBie, dbo.CY_Ting.TingMC, dbo.CY_Tai.TaiName, dbo.CY_YdInfo.YDPerson, 
                      dbo.CY_YdInfo.YDTime, CASE dbo.CY_YDKWInfo.FinishedFlag WHEN 0 THEN CASE WHEN CONVERT(varchar(10), getdate(), 120) > CONVERT(varchar(10), 
                      dbo.CY_YdInfo.YJDTime, 120) 
                      THEN '已过期' ELSE '预订中' END WHEN 1 THEN '消费中' WHEN 2 THEN '消费完毕' WHEN 3 THEN '预订取消' ELSE '已删除' END AS FinishedFlag, 
                      dbo.CY_YDKWInfo.TingBH, dbo.CY_YDKWInfo.TaiBH, dbo.CY_YDKWInfo.FinishedFlag AS FinishedFlagNum, dbo.CY_YdInfo.LXDH
FROM         dbo.CY_YdInfo INNER JOIN
                      dbo.CY_YDKWInfo ON dbo.CY_YdInfo.YDLSH = dbo.CY_YDKWInfo.YDLSH INNER JOIN
                      dbo.CY_Ting ON dbo.CY_YDKWInfo.TingBH = dbo.CY_Ting.TingBH INNER JOIN
                      dbo.CY_Tai ON dbo.CY_YDKWInfo.TaiBH = dbo.CY_Tai.TaiBH AND dbo.CY_YDKWInfo.TingBH = dbo.CY_Tai.TingBH
WHERE     (dbo.CY_YDKWInfo.DeleteFlag <> 1) AND (dbo.CY_YdInfo.DeleteFlag <> 1)
GO
/****** Object:  StoredProcedure [dbo].[OrderEatFoot]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--预约就餐
CREATE PROCEDURE [dbo].[OrderEatFoot]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10),
@AddPerSon varchar(50),
@LSH	VARCHAR(20)
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查 订单是否存在
	select @Num =COUNT(1) from CY_YdInfo where YDLSH = @YDLSH;
	if @Num = 0 
	begin
		set @Msg =  ' 订单不存在 '
		return 0;
	end 
	
	select @Num =status from CY_YdInfo where YDLSH =@YDLSH;
	if @Num <> 0 
	begin
		set @Msg =  ' 非预定状态订单不能开台 '
		return 0; 
	end
	
	--检查 是否 存在桌位的订单
	select @Num = Count(1) from CY_YDKWInfo  where YDLSH=@YDLSH; 
	if @Num > 0
	begin
		set @Msg =  ' 该订单存在桌位,请到就餐界面开台 '
		return 0;
	end
	----检查桌位状态
	--select @Num = status from CY_Tai where TingBH = @TingBH and TaiBH = @TaiBH;
	--if @Num <> 0 
	--begin
	--	set @Msg = '该桌位非置闲状态不能开台'
	--	return 0;
	--end
	
	declare @ShiBie varchar(50);    --就餐时段
	declare @YDPerson varchar(50);  -- 预订人
	declare @LXDH varchar(50);		--联系电话
	declare @Code varchar(50);
	declare @CodeName varchar(50);
	declare @Norms varchar(10);
	declare @Units varchar(10);
	declare @Cnt decimal(9,2);
	declare @Price decimal(9,2);
	declare @HYPrice decimal(9,2);
	declare @BigLB varchar(2);
	declare @SmallLB varchar(2);
	declare @PYM varchar(20);
	select  @ShiBie = ShiBie,@YDPerson = YDPerson,@LXDH=LXDH from CY_YdInfo where YDLSH =@YDLSH; 
	--添加桌位
	--INSERT INTO CY_LiuShui(TingBH,TaiBH,LSH,StartTime,ShiBie,YDLSH)values(@TingBH,@TaiBH,@LSH,GETDATE(),@ShiBie,@YDLSH);
	update CY_LiuShui set TingBH =@TingBH,TaiBH =@TaiBH,StartTime =GETDATE(),ShiBie =@ShiBie,YDLSH=@YDLSH where LSH = @LSH
	--添加菜品
	DECLARE product_cursor CURSOR FOR     
		select a.Code,a.CodeName,a.Norms,a.Units,a.Cnt,a.HYPrice,a.Price,
		(select LEFT(LBCODE,2) FROM CY_Product WHERE Code  = a.code) bigCode, 
		(select right(LBCODE,2) FROM CY_Product WHERE Code  = a.code) smallCode , 
		(select PYM FROM CY_Product WHERE Code  = a.code) PYM 
		from CY_YDMX a WHERE YDLSH = @YDLSH
		open product_cursor
		FETCH NEXT FROM product_cursor INTO @Code,@CodeName,@Norms,@Units,@Cnt,@HYPrice,@Price,@BigLB,@SmallLB,@PYM 
		WHILE @@FETCH_STATUS = 0
			begin
				
					insert into CY_YingYe(LSH,TingBH,TaiBH,AddPerson,StartTime,
											Code,CodeName,Norms,Units,Price,
											HYPrice,Cnt,PriceTotal,HYPriceTotal,[Status],
											PYM,BigLB,SmalLB)values
										  (@LSH,@TingBH,@TaiBH,@AddPerSon,GETDATE(),
										  @Code,@CodeName,@Norms,@Units,@Price, 
										  @HYPrice,@Cnt,(@Cnt * @Price),(@Cnt * @HYPrice),'下单',
										  @PYM,@BigLB,@SmallLB)
            
					FETCH NEXT FROM product_cursor INTO @Code,@CodeName,@Norms,@Units,@Cnt,@HYPrice,@Price,@BigLB,@SmallLB,@PYM 
			end
		close product_cursor
	DEALLOCATE product_cursor 
	-- 更改预定信息状态
	update CY_YdInfo set Status = 1,KTLSH = @LSH where YDLSH = @YDLSH;
	--更新桌位状态
	--update CY_Tai set Status = 1 where TingBH = @TingBH and TaiBH =@TaiBH;
   	return 1;
END
GO
/****** Object:  View [dbo].[V_CY_YDMX]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_CY_YDMX]
AS
SELECT     dbo.CY_YdInfo.InternetId AS OrderId, dbo.CY_Product.goodsid, dbo.CY_YDMX.ID, dbo.CY_YDMX.YDLSH, dbo.CY_YDMX.TingBH, dbo.CY_YDMX.TaiBH, 
                      dbo.CY_YDMX.Code, dbo.CY_YDMX.CodeName, dbo.CY_YDMX.Norms, dbo.CY_YDMX.Units, dbo.CY_YDMX.Cnt, dbo.CY_YDMX.Price, dbo.CY_YDMX.HYPrice, 
                      dbo.CY_YDMX.ShiBie, dbo.CY_YDMX.Remark, dbo.CY_YDMX.remark1, dbo.CY_YDMX.InternetId, dbo.CY_YDMX.UploadFlag, dbo.CY_YDMX.DeleteFlag, 
                      dbo.CY_YDMX.ProdAttID, dbo.CY_Tai.taiid
FROM         dbo.CY_YDMX INNER JOIN
                      dbo.CY_YdInfo ON dbo.CY_YDMX.YDLSH = dbo.CY_YdInfo.YDLSH INNER JOIN
                      dbo.CY_Product ON dbo.CY_YDMX.Code = dbo.CY_Product.Code LEFT OUTER JOIN
                      dbo.CY_Tai ON dbo.CY_YDMX.TingBH = dbo.CY_Tai.TingBH AND dbo.CY_YDMX.TaiBH = dbo.CY_Tai.TaiBH
GO
/****** Object:  StoredProcedure [dbo].[OrderProductAdd]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加订单菜品信息。
CREATE PROCEDURE [dbo].[OrderProductAdd]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10),
@Code varchar(10),
@Cnt decimal(9,2),
@Remark varchar(50),
@Norms varchar(10),
@Units varchar(10),
@IsOther int,
@ZCJ decimal(9,2),
@HYJ decimal(9,2),
@InternetId varchar(50)
AS
BEGIN 
	declare @Num int;
	declare @String Varchar(50); 
	--------------------------------
	declare @CodeName varchar(50);
	declare @ShiBie varchar(10);
	declare @ProductNum decimal(9,2);
	
	
	select @Num = COUNT(1) from CY_YdInfo where YDLSH=@YDLSH;
	if @Num = 0
	begin
		set @Msg =  '订单不存在 '
		return 0;
	end 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from CY_YDKWInfo  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
	if @Num = 0
	begin
		set @Msg =  ' 桌位不存在 '
		return 0;
	end 
	select @Num = COUNT(1) from CY_Product where Code =@Code;
	if @Num = 0 
	begin
		set @Msg =  ' 菜品不存在 '
		return 0;
	end
	select @CodeName = CodeName from CY_Product where Code = @Code;
	select @ShiBie = ShiBie from CY_YdInfo  where YDLSH =@YDLSH;
	select @Num = COUNT(1) from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code and Norms=@Norms
	if @Num = 0 
	begin
		insert into CY_YDMX(YDLSH,TingBH,TaiBH,Code,CodeName,Cnt,ShiBie,Remark,Norms,Units,UploadFlag,DeleteFlag,Price,HYPrice,InternetId)
				values
					(@YDLSH,@TingBH,@TaiBH,@Code,@CodeName,@Cnt,@ShiBie,@Remark,@Norms,@Units,0,0,@ZCJ,@HYJ,@InternetId);
	end 
	else 
	begin
		update CY_YDMX set Cnt = (Cnt+@Cnt),[Remark] = @Remark,[Units] = @Units,UploadFlag=0,DeleteFlag=0,Price=@ZCJ,HYPrice=@HYJ,InternetId=@InternetId     
		where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code and Norms=@Norms
	end
	
	if @IsOther = 1 
	begin 
		declare @TingBH2 varchar(10);
		declare @TaiBH2 varchar(10);
		DECLARE table_cursor CURSOR FOR     
			select a.TingBH,a.TaiBH from CY_YDKWinfo a  where isnull(a.DeleteFlag,0)  = 0 and a.YDLSH = @YDLSH and FinishedFlag=0   and ID not in(select ID from CY_YDKWInfo  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH)
			open table_cursor
			FETCH NEXT FROM table_cursor INTO @TingBH2,@TaiBH2
			WHILE @@FETCH_STATUS = 0
				begin
					--更新桌位信息。桌位状态 
						select @Num = COUNT(1) from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH2 and TaiBH =@TaiBH2 and Code =@Code and Norms=@Norms
						if @Num = 0 
						begin
							insert into CY_YDMX(YDLSH,TingBH,TaiBH,Code,CodeName,Cnt,ShiBie,Remark,Norms,Units,UploadFlag,DeleteFlag,Price,HYPrice,InternetId)
									values
										(@YDLSH,@TingBH2,@TaiBH2,@Code,@CodeName,@Cnt,@ShiBie,@Remark,@Norms,@Units,0,0,@ZCJ,@HYJ,@InternetId);
						end 
						else 
						begin
							update CY_YDMX set Cnt = (Cnt+@Cnt),[Remark] = @Remark,[Units] = @Units,UploadFlag=0,DeleteFlag=0,Price=@ZCJ,HYPrice=@HYJ,InternetId=@InternetId      
							where YDLSH =@YDLSH and TingBH =@TingBH2 and TaiBH =@TaiBH2 and Code =@Code and Norms=@Norms;
						end
					----------------------------
	            
					FETCH NEXT FROM table_cursor INTO @TingBH2,@TaiBH2
				end
			close table_cursor
		DEALLOCATE table_cursor 
	end
   	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[proc_KT]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[proc_KT]
	
(
  @ting varchar(2),
  @tai varchar(3),
  @pos varchar(3),
  @OutLiuShui varchar(14) OUTPUT
)
AS
DECLARE @timenow varchar(5);
DECLARE @ShiBie varchar(10);
DECLARE @LiuShui varchar(14);
declare @zt varchar(10);
declare @lowxf decimal(9,2)
select @zt=status,@lowxf=isnull(MinCostMoney,0) from cy_tai where TingBH=@ting and TaiBH=@tai
if(@zt='1')
begin 
set @OutLiuShui='';
return 
end
select @timenow = substring( Convert(varchar(18),GetDate(),120),12,5)  
SELECT  top 1  @ShiBie= MC FROM CY_MealType where starttime<@timenow and endtime>@timenow order by starttime desc
if(isnull(@ShiBie,'')='')
 BEGIN
   SELECT top 1  @ShiBie=MC FROM CY_MealType WHERE StartTime>@timenow   ORDER BY starttime asc
 END
if(isnull(@ShiBie,'')='')
 BEGIN
   SELECT top 1  @ShiBie=MC FROM CY_MealType WHERE endTime<@timenow   ORDER BY endtime desc
 END
SELECT top 1 @LiuShui = lsh FROM cy_liushui WHERE  left(right(lsh,12),8) = replace(Substring(Convert(varchar(20),getdate(),120),1,10),'-','')   ORDER BY id desc;
	
if(isnull(@LiuShui,'')='')
 BEGIN
	SET @LiuShui = Convert(varchar(8),GetDate(),112)+'0001'
	insert into cy_liushui(TingBH,TaiBH,LSH,StartTime,ShiBie,POS) values(@ting, @tai,@LiuShui, Convert(VarChar(19), getdate(), 120), @ShiBie,@pos)
	SET @OutLiuShui=@LiuShui;
	update cy_tai set LSH=@OutLiuShui,[status]='1', StartTime=getdate() where  TingBH=@ting and TaiBH=@tai
	--insert into CY_LiuShui_Low values(@LiuShui,@lowxf)
 END
ELSE
 BEGIN
  DECLARE @weihao int;
  DECLARE @k int
  select @k=len(@LiuShui)
  declare @s varchar(10)
  select @s=substring(@liushui,@k-3,4)
  SET @weihao=Convert(int,@s);
  SET @weihao=@weihao+1;
  SET @LiuShui = Convert(varchar(8),GetDate(),112)+right('0000'+cast(@weihao as varchar),4)
  	insert into cy_liushui(TingBH,TaiBH,LSH,StartTime,ShiBie,POS) values(@ting, @tai,@LiuShui, Convert(VarChar(19), getdate(), 120), @ShiBie,@pos)
	
	update cy_tai set LSH=@LiuShui,[status]='1', StartTime=getdate() where  TingBH=@ting and TaiBH=@tai
	SET @OutLiuShui=@LiuShui;
 END
GO
/****** Object:  StoredProcedure [dbo].[P_GetShiBie]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[P_GetShiBie] 
	-- Add the parameters for the stored procedure here
	@sj datetime,
@sb varchar(20) out
AS
DECLARE @timenow varchar(5)
DECLARE @ShiBie varchar(10);
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
    -- Insert statements for procedure here
	select @timenow = substring( Convert(varchar(18),@sj,120),12,5)  
SELECT  top 1  @ShiBie= MC FROM CY_MealType where starttime<@timenow and endtime>@timenow order by starttime desc
if(isnull(@ShiBie,'')='')
 BEGIN
   SELECT top 1  @ShiBie=MC FROM CY_MealType WHERE StartTime>@timenow   ORDER BY starttime asc
 END
if(isnull(@ShiBie,'')='')
 BEGIN
   SELECT top 1  @ShiBie=MC FROM CY_MealType WHERE endTime<@timenow   ORDER BY endtime desc
 END
set @sb=@ShiBie
END
GO
/****** Object:  StoredProcedure [dbo].[PaytheBILL]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE  [dbo].[PaytheBILL] 
	@Msg varchar(500) output, 
	@LSH varchar(20),
	@MLR VARCHAR(50),--抹零人
	@ML decimal(9,2), --抹零
	@YFJE decimal(9)--应付金额
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from CY_LiuShuI  where LSH=@LSH
	if @Num != 0
	begin
		set @Msg =  ' 该订单已存在 '
		return 0;
	end 
	 
   	return 1;
END
GO
/****** Object:  View [dbo].[v_scm_nowacc]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[v_scm_nowacc]
AS
SELECT     dbo.SCM_NowAcc.GoodsCode, dbo.SCM_NowAcc.StoreCode, dbo.SCM_NowAcc.CurCnt, dbo.SCM_NowAcc.CurPrice, dbo.SCM_Goods.GoodsName, 
                      dbo.SCM_Goods.Units, dbo.SCM_Goods.TypeCode, dbo.SCM_Store.MC, dbo.SCM_Goods.PinYin, dbo.SCM_Goods.BarNo
FROM         dbo.SCM_NowAcc INNER JOIN
                      dbo.SCM_Goods ON dbo.SCM_NowAcc.GoodsCode = dbo.SCM_Goods.GoodsCode INNER JOIN
                      dbo.SCM_Store ON dbo.SCM_NowAcc.StoreCode = dbo.SCM_Store.DM
GO
/****** Object:  View [dbo].[V_Scm_TrukChild]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_Scm_TrukChild]
AS
SELECT     dbo.SCM_TrukChild.ID, dbo.SCM_TrukChild.BillNo, dbo.SCM_TrukChild.GoodsCode, dbo.SCM_TrukChild.AccCnt, dbo.SCM_TrukChild.TrukCnt, 
                      dbo.SCM_TrukChild.Price, dbo.SCM_TrukChild.OverageCnt, dbo.SCM_TrukChild.LossCnt, dbo.SCM_TrukChild.Remark, dbo.SCM_TrukChild.CaclDate, 
                      dbo.SCM_TrukChild.CaclBillNo, dbo.SCM_TrukChild.CaclType, dbo.SCM_TrukMain.keepman, dbo.SCM_TrukMain.turkPerson1, dbo.SCM_TrukMain.Marker, 
                      dbo.SCM_TrukMain.MarkDate, dbo.SCM_TrukMain.KJYear, dbo.SCM_TrukMain.period, dbo.SCM_Store.MC, dbo.SCM_Store.PersonCode, 
                      dbo.SCM_Store.PersonHeader, dbo.SCM_Goods.GoodsName, dbo.SCM_Goods.Units, dbo.SCM_TrukMain.StoreCode, 
                      (CASE WHEN dbo.scm_trukchild.losscnt > 0 THEN Losscnt ELSE OverageCnt END) AS cnt
FROM         dbo.SCM_TrukMain INNER JOIN
                      dbo.SCM_TrukChild ON dbo.SCM_TrukMain.BillNo = dbo.SCM_TrukChild.BillNo INNER JOIN
                      dbo.SCM_Goods ON dbo.SCM_TrukChild.GoodsCode = dbo.SCM_Goods.GoodsCode INNER JOIN
                      dbo.SCM_Store ON dbo.SCM_TrukMain.StoreCode = dbo.SCM_Store.DM
GO
/****** Object:  View [dbo].[V_Scm_Ledger]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_Scm_Ledger]
AS
SELECT     dbo.SCM_Ledger.*, dbo.SCM_Goods.GoodsName, dbo.SCM_Goods.Units, dbo.SCM_Store.MC
FROM         dbo.SCM_Ledger INNER JOIN
                      dbo.SCM_Goods ON dbo.SCM_Ledger.GoodsCode = dbo.SCM_Goods.GoodsCode INNER JOIN
                      dbo.SCM_Store ON dbo.SCM_Ledger.StoreCode = dbo.SCM_Store.DM
GO
/****** Object:  View [dbo].[V_SCM_InOutChild]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_SCM_InOutChild]
AS
SELECT     dbo.SCM_InOutMain.BillCode, dbo.SCM_InOutMain.BillDate, dbo.SCM_InOutMain.StoreCode, dbo.SCM_InOutMain.InoutFlag, dbo.SCM_InOutMain.Marker, 
                      dbo.SCM_InOutMain.KjYear, dbo.SCM_InOutMain.Period, dbo.SCM_InOutChild.GoodsCode, dbo.SCM_InOutChild.ShouldSendCnt, dbo.SCM_InOutChild.RealSendCnt, 
                      dbo.SCM_InOutChild.ShouleReciveCnt, dbo.SCM_InOutChild.RealReciveCnt, dbo.SCM_InOutChild.Price, dbo.SCM_InOutChild.SendMoney, 
                      dbo.SCM_InOutChild.ReciveMoney, dbo.SCM_InOutChild.BatchNo, dbo.SCM_InOutChild.InvalidDate
FROM         dbo.SCM_InOutMain INNER JOIN
                      dbo.SCM_InOutChild ON dbo.SCM_InOutMain.BillCode = dbo.SCM_InOutChild.BillCode
GO
/****** Object:  StoredProcedure [dbo].[PrintInfoDelete]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[PrintInfoDelete]
@Msg varchar(50) output,
@PrintCode varchar(50)
as
Begin
  declare @count int;
  --判断是否存在要删除的打印机
    select @count=count(1) from Print_PrintInfo where PrintCode=@PrintCode
  
  if(@count=0)
  begin
  set @Msg='不存在编码为 '+@Msg+' 的打印机'
   return 0;
   end
   --删除
   delete from Print_PrintInfo where PrintCode=@PrintCode
   return 1;
   
end
GO
/****** Object:  StoredProcedure [dbo].[OrderBaseDel]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加订单信息。
CREATE PROCEDURE [dbo].[OrderBaseDel]
@Msg varchar(500) output, 
@YDLSH varchar(20) 
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from [CY_YdInfo]  where YDLSH=@YDLSH
	if @Num = 0
	begin
		set @Msg =  ' 订单不存在 '
		return 0;
	end 
	
	select @Num = [Status] from [CY_YdInfo]  where YDLSH=@YDLSH
	if @Num != 0
	begin
		set @Msg =  ' 非预约状态不可删除 '
		return 0;
	end 
	--delete from CY_Ydinfo where YDLSH =@YDLSH;
	--delete from CY_YDKWinfo where YDLSH =@YDLSH;
	--delete from CY_YDMX	 where YDLSH =@YDLSH;
	update CY_Ydinfo set UploadFlag = 0 ,DeleteFlag =1 where YDLSH =@YDLSH;
	update CY_YDKWinfo set UploadFlag = 0 ,DeleteFlag =1 where YDLSH =@YDLSH;
	update CY_YDMX set UploadFlag = 0 ,DeleteFlag =1 where YDLSH =@YDLSH;
	
   	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[OrderProductSubtract]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 减少订单菜品信息。
CREATE PROCEDURE [dbo].[OrderProductSubtract]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10),
@Code varchar(10),
@Cnt  decimal(9,2) 
AS
BEGIN 
	declare @Num int;
	declare @String Varchar(50); 
	
	select @Num = COUNT(1) from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code;
	if @Num = 0 
	begin
		set @Msg =  ' 商品不存在 '
		return 0;
	end
	
	select @Num = Cnt from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code; 
	if @Num > @Cnt
	begin
		update CY_YDMX set Cnt = Cnt -@Cnt where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code;
	end
	else
	begin
		delete from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code ;
	end 
   	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[OrderProductDel]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 删除订单菜品信息。
CREATE PROCEDURE [dbo].[OrderProductDel]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10),
@Code varchar(10),
@Norms varchar(10) 
AS
BEGIN 
	declare @Num int;
	declare @String Varchar(50);  
	select @Num = COUNT(1) from CY_YDMX where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code and Norms=@Norms;
	if @Num = 0 
	begin
		set @Msg =  ' 商品不存在 '
		return 0;
	end 
	update CY_YDMX set UploadFlag=0,DeleteFlag=1 where YDLSH =@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and Code =@Code and Norms=@Norms;
   	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[OrderTableDel]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 删除订单桌位信息。
CREATE PROCEDURE [dbo].[OrderTableDel]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10)
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from CY_YDKWInfo  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
	if @Num = 0
	begin
		set @Msg =  ' 桌位不存在 '
		return 0;
	end 
	--delete from CY_YDMX	 where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
	--delete from  CY_YDKWInfo where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
	
	update CY_YDKWinfo set UploadFlag = 0 ,DeleteFlag =1  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
	update CY_YDMX set UploadFlag = 0 ,DeleteFlag =1  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH;
   	return 1;
END
GO
/****** Object:  StoredProcedure [dbo].[OrderTableAdd]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加订单桌位信息。
CREATE PROCEDURE [dbo].[OrderTableAdd]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@TingBH varchar(10), 
@TaiBH varchar(10)
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from CY_YDKWInfo  where YDLSH=@YDLSH and TingBH =@TingBH and TaiBH =@TaiBH and deleteFlag = 0
	if @Num > 0
	begin
		set @Msg =  ' 桌位不能重复添加 '
		return 0;
	end 
	insert into CY_YDKWInfo (YDLSH,TingBH,TaiBH,UploadFlag,DeleteFlag)VALUES(@YDLSH,@TingBH,@TaiBH,0,0); 
   	return 1;
END
GO
/****** Object:  View [dbo].[V_CY_YDKWInfo]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_CY_YDKWInfo]
AS
SELECT     dbo.CY_YdInfo.InternetId AS orderid, dbo.CY_Tai.taiid, dbo.CY_YDKWInfo.ID, dbo.CY_YDKWInfo.YDLSH, dbo.CY_YDKWInfo.TingBH, dbo.CY_YDKWInfo.TaiBH, 
                      dbo.CY_YDKWInfo.InternetId, dbo.CY_YDKWInfo.UploadFlag, dbo.CY_YDKWInfo.DeleteFlag
FROM         dbo.CY_YDKWInfo INNER JOIN
                      dbo.CY_YdInfo ON dbo.CY_YDKWInfo.YDLSH = dbo.CY_YdInfo.YDLSH INNER JOIN
                      dbo.CY_Tai ON dbo.CY_YDKWInfo.TingBH = dbo.CY_Tai.TingBH AND dbo.CY_YDKWInfo.TaiBH = dbo.CY_Tai.TaiBH
GO
/****** Object:  View [dbo].[v_ydkwinfo]    Script Date: 07/03/2015 09:20:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[v_ydkwinfo]
AS
SELECT     dbo.CY_YDKWInfo.ID, dbo.CY_YDKWInfo.YDLSH, dbo.CY_YDKWInfo.TingBH, dbo.CY_YDKWInfo.TaiBH, dbo.CY_YDKWInfo.InternetId, 
                      dbo.CY_YDKWInfo.UploadFlag, dbo.CY_YDKWInfo.DeleteFlag, dbo.CY_YDKWInfo.ktlsh, dbo.CY_YdInfo.ShiBie, dbo.CY_YdInfo.YDTime, dbo.CY_YdInfo.YDYJ, 
                      dbo.CY_YdInfo.YJDTime, dbo.CY_YdInfo.ReteTime, dbo.CY_YdInfo.DeleteFlag AS yddelflag, dbo.CY_YdInfo.PersonCnt, dbo.CY_YDKWInfo.FinishedFlag
FROM         dbo.CY_YdInfo RIGHT OUTER JOIN
                      dbo.CY_YDKWInfo ON dbo.CY_YdInfo.YDLSH = dbo.CY_YDKWInfo.YDLSH
GO
/****** Object:  StoredProcedure [dbo].[OrderBaseAdd]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加订单信息。
CREATE PROCEDURE [dbo].[OrderBaseAdd]
	@Msg varchar(500) output, 
	@YDLSH varchar(20), 
	@YDTime datetime,
	@ShiBie varchar(10),
	@YDYJ decimal(9,2),
	@YJDTime datetime, 
	@ReteTime  int,
	@YDPerson varchar(10),
	@YDComp varchar(50),
	@LXDH  varchar(50),
	@YDKWCnt int,
	@PersonCnt int,
	@Stand varchar(20),
	@ForntMan varchar(10),
	@Remark  varchar(50),
	@MarkManger varchar(10),
	@IsNew int,
	@SrcFlag int,
	@UploadFlag int,
	@OrderType int
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from [CY_YdInfo]  where YDLSH=@YDLSH
	if @Num != 0
	begin
		set @Msg =  ' 该订单已存在 '
		return 0;
	end 
	insert into [cy_ydinfo]
	(
		YDLSH, 
		YDTime,
		ShiBie,
		YDYJ,
		YJDTime, 
		ReteTime,
		YDPerson,
		YDComp,
		LXDH,
		YDKWCnt,
		PersonCnt,
		Stand,
		ForntMan,
		Remark,
		MarkManger,
		IsNew,SrcFlag,UploadFlag,[Status],DeleteFlag,OrderType
	)
	values
	(
		@YDLSH, 
		@YDTime,
		@ShiBie,
		@YDYJ,
		@YJDTime, 
		@ReteTime,
		@YDPerson,
		@YDComp,
		@LXDH,
		@YDKWCnt,
		@PersonCnt,
		@Stand,
		@ForntMan,
		@Remark,
		@MarkManger,
		@IsNew,@SrcFlag,@UploadFlag,0,0,@OrderType
	);
declare @cng bigint
   	 select  @cng=@@IDENTITY;
return @cng
END
GO
/****** Object:  StoredProcedure [dbo].[OrderBaseEdit]    Script Date: 07/03/2015 09:19:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- 添加订单信息。
CREATE PROCEDURE [dbo].[OrderBaseEdit]
@Msg varchar(500) output, 
@YDLSH varchar(20), 
@YDTime datetime,
@ShiBie varchar(10),
@YDYJ decimal(9,2),
@YJDTime datetime, 
@ReteTime  int,
@YDPerson varchar(10),
@YDComp varchar(50),
@LXDH  varchar(50),
@YDKWCnt int,
@PersonCnt int,
@Stand varchar(20),
@ForntMan varchar(10),
@Remark  varchar(50),
@MarkManger varchar(10),
@spare1 varchar(50)
AS
BEGIN 
	declare @Num int;
	declare @String Varchar; 
	--检查该时段是否存在订单记录 
	select @Num = Count(1) from [CY_YdInfo]  where YDLSH=@YDLSH
	if @Num = 0
	begin
		set @Msg =  ' 该订单不存在 '
		return 0;
	end 
	update [cy_ydinfo] set  
		ShiBie=@ShiBie,
		YDYJ=@YDYJ,
		YJDTime=@YJDTime, 
		ReteTime=@ReteTime,
		YDPerson=@YDPerson,
		YDComp=@YDComp,
		LXDH=@LXDH,
		YDKWCnt=@YDKWCnt,
		PersonCnt=@PersonCnt,
		Stand=@Stand,
		ForntMan=@ForntMan,
		Remark=@Remark,
		MarkManger=@MarkManger,
		spare1=@spare1,
		UploadFlag = 0 ,DeleteFlag = 0  
	where YDLSH = @YDLSH;
	
   	return 1;
END
GO
/****** Object:  Default [DF_CY_CardPay_FKJE]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_CardPay] ADD  CONSTRAINT [DF_CY_CardPay_FKJE]  DEFAULT ((0)) FOR [FKJE]
GO
/****** Object:  Default [DF_CY_CardPay_YE]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_CardPay] ADD  CONSTRAINT [DF_CY_CardPay_YE]  DEFAULT ((0)) FOR [YE]
GO
/****** Object:  Default [DF_CY_CardPay_ZFSJ]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_CardPay] ADD  CONSTRAINT [DF_CY_CardPay_ZFSJ]  DEFAULT (getdate()) FOR [ZFSJ]
GO
/****** Object:  Default [DF_CY_FJHisDj_FJSJ]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_FJHisDj] ADD  CONSTRAINT [DF_CY_FJHisDj_FJSJ]  DEFAULT (getdate()) FOR [FJSJ]
GO
/****** Object:  Default [DF_CY_GZMX_OperTime]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_GZMX] ADD  CONSTRAINT [DF_CY_GZMX_OperTime]  DEFAULT (getdate()) FOR [OperTime]
GO
/****** Object:  Default [DF_CY_HisDj_DisPerson]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HisDj] ADD  CONSTRAINT [DF_CY_HisDj_DisPerson]  DEFAULT ((1)) FOR [DisPerson]
GO
/****** Object:  Default [DF_CY_HisDj_IsUpdate]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HisDj] ADD  CONSTRAINT [DF_CY_HisDj_IsUpdate]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_HisDj_PersonCnt]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HisDj] ADD  CONSTRAINT [DF_CY_HisDj_PersonCnt]  DEFAULT ((0)) FOR [PersonCnt]
GO
/****** Object:  Default [DF_CY_HisDjMx_IsUpdate]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HisDjMx] ADD  CONSTRAINT [DF_CY_HisDjMx_IsUpdate]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_HisMx_IsUpdate]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HisMx] ADD  CONSTRAINT [DF_CY_HisMx_IsUpdate]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_HSysPara_visiableFlag]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HSysPara] ADD  CONSTRAINT [DF_CY_HSysPara_visiableFlag]  DEFAULT ((1)) FOR [visiableFlag]
GO
/****** Object:  Default [DF_CY_HSysPara_ReadonlyFlag]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_HSysPara] ADD  CONSTRAINT [DF_CY_HSysPara_ReadonlyFlag]  DEFAULT ((0)) FOR [ReadonlyFlag]
GO
/****** Object:  Default [DF_CY_LiuShui_JZFlag]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_JZFlag]  DEFAULT ((0)) FOR [JZFlag]
GO
/****** Object:  Default [DF_CY_LiuShui_PersonCnt]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_PersonCnt]  DEFAULT ((0)) FOR [PersonCnt]
GO
/****** Object:  Default [DF_CY_LiuShui_JDcnt]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_JDcnt]  DEFAULT ((0)) FOR [JDcnt]
GO
/****** Object:  Default [DF_CY_LiuShui_PerKnot]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_PerKnot]  DEFAULT ((0)) FOR [PerKnot]
GO
/****** Object:  Default [DF_CY_LiuShui_TermFlag]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_TermFlag]  DEFAULT ((0)) FOR [TeamFlag]
GO
/****** Object:  Default [DF_CY_LiuShui_CostMoney]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_CostMoney]  DEFAULT ((0)) FOR [CostMoney]
GO
/****** Object:  Default [DF_CY_LiuShui_FeesMoney]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_FeesMoney]  DEFAULT ((0)) FOR [FeesMoney]
GO
/****** Object:  Default [DF_CY_LiuShui_UploadFlag]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_LiuShui] ADD  CONSTRAINT [DF_CY_LiuShui_UploadFlag]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_NetPay_OperTime]    Script Date: 07/03/2015 09:20:00 ******/
ALTER TABLE [dbo].[CY_NetPay] ADD  CONSTRAINT [DF_CY_NetPay_OperTime]  DEFAULT (getdate()) FOR [OperTime]
GO
/****** Object:  Default [DF_CY_Product_TBFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Product] ADD  CONSTRAINT [DF_CY_Product_TBFlag]  DEFAULT ((0)) FOR [TBFlag]
GO
/****** Object:  Default [DF_CY_Product_CaclType]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Product] ADD  CONSTRAINT [DF_CY_Product_CaclType]  DEFAULT ((0)) FOR [CaclType]
GO
/****** Object:  Default [DF__CY_Shift__LogTim__2180FB33]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Shift] ADD  CONSTRAINT [DF__CY_Shift__LogTim__2180FB33]  DEFAULT (getdate()) FOR [LogTime]
GO
/****** Object:  Default [DF__CY_Shift__ShifFl__22751F6C]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Shift] ADD  CONSTRAINT [DF__CY_Shift__ShifFl__22751F6C]  DEFAULT ((0)) FOR [ShifFlag]
GO
/****** Object:  Default [DF_System_Department_FatherID]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_SYS_Department] ADD  CONSTRAINT [DF_System_Department_FatherID]  DEFAULT ((0)) FOR [ParentId]
GO
/****** Object:  Default [DF_CY_Tai_MaxPerson]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_MaxPerson]  DEFAULT ((0)) FOR [MaxPerson]
GO
/****** Object:  Default [DF_CY_Tai_Status]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_Status]  DEFAULT ((0)) FOR [Status]
GO
/****** Object:  Default [DF_CY_Tai_FeesType]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_FeesType]  DEFAULT ((0)) FOR [FeesType]
GO
/****** Object:  Default [DF_CY_Tai_HourFees]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_HourFees]  DEFAULT ((0)) FOR [HourFees]
GO
/****** Object:  Default [DF_CY_Tai_FeesPercent]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_FeesPercent]  DEFAULT ((0)) FOR [FeesPercent]
GO
/****** Object:  Default [DF_CY_Tai_PersonFees]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_PersonFees]  DEFAULT ((0)) FOR [PersonFees]
GO
/****** Object:  Default [DF_CY_Tai_FeesMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_FeesMoney]  DEFAULT ((0)) FOR [FeesMoney]
GO
/****** Object:  Default [DF_CY_Tai_MaxMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_MaxMoney]  DEFAULT ((0)) FOR [MaxMoney]
GO
/****** Object:  Default [DF_CY_Tai_MinCostMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_MinCostMoney]  DEFAULT ((0)) FOR [MinCostMoney]
GO
/****** Object:  Default [DF_CY_Tai_PerKnot]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_PerKnot]  DEFAULT ((0)) FOR [PerKnot]
GO
/****** Object:  Default [DF_CY_Tai_RoomFees]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_RoomFees]  DEFAULT ((0)) FOR [RoomFees]
GO
/****** Object:  Default [DF_CY_Tai_BookFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_Tai] ADD  CONSTRAINT [DF_CY_Tai_BookFlag]  DEFAULT ((0)) FOR [BookFlag]
GO
/****** Object:  Default [DF_CY_YdInfo_ReteTime]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_ReteTime]  DEFAULT ((10)) FOR [ReteTime]
GO
/****** Object:  Default [DF_CY_YdInfo_YDKWCnt]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_YDKWCnt]  DEFAULT ((0)) FOR [YDKWCnt]
GO
/****** Object:  Default [DF_CY_YdInfo_PersonCnt]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_PersonCnt]  DEFAULT ((1)) FOR [PersonCnt]
GO
/****** Object:  Default [DF_CY_YdInfo_Status]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_Status]  DEFAULT ((0)) FOR [Status]
GO
/****** Object:  Default [DF_CY_YdInfo_TermFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_TermFlag]  DEFAULT ((0)) FOR [TeamFlag]
GO
/****** Object:  Default [DF_CY_YdInfo_UploadFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_UploadFlag]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_YdInfo_SrcFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_SrcFlag]  DEFAULT ((0)) FOR [SrcFlag]
GO
/****** Object:  Default [DF_CY_YdInfo_DeleteFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_DeleteFlag]  DEFAULT ((0)) FOR [DeleteFlag]
GO
/****** Object:  Default [DF_CY_YdInfo_IsNew]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YdInfo] ADD  CONSTRAINT [DF_CY_YdInfo_IsNew]  DEFAULT ((1)) FOR [IsNew]
GO
/****** Object:  Default [DF_CY_YDKWInfo_UploadFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDKWInfo] ADD  CONSTRAINT [DF_CY_YDKWInfo_UploadFlag]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_YDKWInfo_DeleteFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDKWInfo] ADD  CONSTRAINT [DF_CY_YDKWInfo_DeleteFlag]  DEFAULT ((0)) FOR [DeleteFlag]
GO
/****** Object:  Default [DF_CY_YDKWInfo_FinishedFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDKWInfo] ADD  CONSTRAINT [DF_CY_YDKWInfo_FinishedFlag]  DEFAULT ((0)) FOR [FinishedFlag]
GO
/****** Object:  Default [DF_CY_YDMX_UploadFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDMX] ADD  CONSTRAINT [DF_CY_YDMX_UploadFlag]  DEFAULT ((0)) FOR [UploadFlag]
GO
/****** Object:  Default [DF_CY_YDMX_DeleteFlag]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDMX] ADD  CONSTRAINT [DF_CY_YDMX_DeleteFlag]  DEFAULT ((0)) FOR [DeleteFlag]
GO
/****** Object:  Default [DF_CY_YDMX_HYPrice]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDMX] ADD  CONSTRAINT [DF_CY_YDMX_HYPrice]  DEFAULT ((0)) FOR [HYPrice]
GO
/****** Object:  Default [DF_CY_YDMX_Price]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YDMX] ADD  CONSTRAINT [DF_CY_YDMX_Price]  DEFAULT ((0)) FOR [Price]
GO
/****** Object:  Default [DF_CY_YingYe_DisCount]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[CY_YingYe] ADD  CONSTRAINT [DF_CY_YingYe_DisCount]  DEFAULT ((1)) FOR [DisCount]
GO
/****** Object:  Default [DF_HY_DangAn_DangQianScore]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DangAn] ADD  CONSTRAINT [DF_HY_DangAn_DangQianScore]  DEFAULT ((0)) FOR [DangQianScore]
GO
/****** Object:  Default [DF_HY_DangAn_LeiJiScore]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DangAn] ADD  CONSTRAINT [DF_HY_DangAn_LeiJiScore]  DEFAULT ((0)) FOR [LeiJiScore]
GO
/****** Object:  Default [DF_HY_DangAn_DangQianMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DangAn] ADD  CONSTRAINT [DF_HY_DangAn_DangQianMoney]  DEFAULT ((0)) FOR [DangQianMoney]
GO
/****** Object:  Default [DF_HY_DangAn_LeiJiXiaoFei]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DangAn] ADD  CONSTRAINT [DF_HY_DangAn_LeiJiXiaoFei]  DEFAULT ((0)) FOR [LeiJiXiaoFei]
GO
/****** Object:  Default [DF_HY_DealLog_OldMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_OldMoney]  DEFAULT ((0)) FOR [OldMoney]
GO
/****** Object:  Default [DF_HY_DealLog_OldJF]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_OldJF]  DEFAULT ((0)) FOR [OldJF]
GO
/****** Object:  Default [DF_HY_DealLog_DealMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_DealMoney]  DEFAULT ((0)) FOR [DealMoney]
GO
/****** Object:  Default [DF_HY_DealLog_FreeMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_FreeMoney]  DEFAULT ((0)) FOR [FreeMoney]
GO
/****** Object:  Default [DF_HY_DealLog_DealJF]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_DealJF]  DEFAULT ((0)) FOR [DealJF]
GO
/****** Object:  Default [DF_HY_DealLog_CurMoney]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_CurMoney]  DEFAULT ((0)) FOR [CurMoney]
GO
/****** Object:  Default [DF_HY_DealLog_CurJF]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DealLog] ADD  CONSTRAINT [DF_HY_DealLog_CurJF]  DEFAULT ((0)) FOR [CurJF]
GO
/****** Object:  Default [DF_HY_DWDis_Dis]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[HY_DWDis] ADD  CONSTRAINT [DF_HY_DWDis_Dis]  DEFAULT ((1.0)) FOR [Dis]
GO
/****** Object:  Default [DF_Sys_OperLog_OperDate]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[Sys_OperLog] ADD  CONSTRAINT [DF_Sys_OperLog_OperDate]  DEFAULT (getdate()) FOR [OperDate]
GO
/****** Object:  ForeignKey [FK_SCM_INOU_REFERENCE_SCM_INOU]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[SCM_InOutChild]  WITH CHECK ADD  CONSTRAINT [FK_SCM_INOU_REFERENCE_SCM_INOU] FOREIGN KEY([BillCode])
REFERENCES [dbo].[SCM_InOutMain] ([BillCode])
GO
ALTER TABLE [dbo].[SCM_InOutChild] CHECK CONSTRAINT [FK_SCM_INOU_REFERENCE_SCM_INOU]
GO
/****** Object:  ForeignKey [FK_SCM_INVO_REFERENCE_SCM_INVO]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[SCM_InvoChild]  WITH CHECK ADD  CONSTRAINT [FK_SCM_INVO_REFERENCE_SCM_INVO] FOREIGN KEY([BillNo])
REFERENCES [dbo].[SCM_InvocMain] ([BillNo])
GO
ALTER TABLE [dbo].[SCM_InvoChild] CHECK CONSTRAINT [FK_SCM_INVO_REFERENCE_SCM_INVO]
GO
/****** Object:  ForeignKey [FK_SCM_PURC_REFERENCE_SCM_PURC]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[SCM_Purchase_detial]  WITH CHECK ADD  CONSTRAINT [FK_SCM_PURC_REFERENCE_SCM_PURC] FOREIGN KEY([PurchaseCode])
REFERENCES [dbo].[SCM_Purchase_Main] ([PurchaseCode])
GO
ALTER TABLE [dbo].[SCM_Purchase_detial] CHECK CONSTRAINT [FK_SCM_PURC_REFERENCE_SCM_PURC]
GO
/****** Object:  ForeignKey [FK_SCM_TRAN_REFERENCE_SCM_TRAN]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[SCM_transfersChild]  WITH CHECK ADD  CONSTRAINT [FK_SCM_TRAN_REFERENCE_SCM_TRAN] FOREIGN KEY([BillNo])
REFERENCES [dbo].[SCM_transfersMain] ([BillNo])
GO
ALTER TABLE [dbo].[SCM_transfersChild] CHECK CONSTRAINT [FK_SCM_TRAN_REFERENCE_SCM_TRAN]
GO
/****** Object:  ForeignKey [FK_SCM_TRUK_REFERENCE_SCM_TRUK]    Script Date: 07/03/2015 09:20:01 ******/
ALTER TABLE [dbo].[SCM_TrukChild]  WITH CHECK ADD  CONSTRAINT [FK_SCM_TRUK_REFERENCE_SCM_TRUK] FOREIGN KEY([BillNo])
REFERENCES [dbo].[SCM_TrukMain] ([BillNo])
GO
ALTER TABLE [dbo].[SCM_TrukChild] CHECK CONSTRAINT [FK_SCM_TRUK_REFERENCE_SCM_TRUK]
GO
