INSERT [Sys_Menu] ([MenuId],[MenuName],[SortIndex],[SuperMenu],[MenuType],[IsOffice],[IsEnd],[IsUsed])
VALUES ( N'1FF4F8D5-C9AA-4C59-B392-1F025AEB8DEE',N'发票管理',90,N'0',N'Menu_PHTGL',0,0,1)
Go
	 INSERT [Sys_Menu] ([MenuId],[MenuName],[Url],[SortIndex],[SuperMenu],[MenuType],[IsOffice],[IsEnd],[IsUsed])
						VALUES ( N'B451C8DE-71B9-433E-ACB9-4465FB7E3C5C',N'发票台账',N'PHTGL/InvoiceManage/InvoiceStandingBook.aspx',10,'1FF4F8D5-C9AA-4C59-B392-1F025AEB8DEE',N'Menu_PHTGL',0,1,1)
						GO
							INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
							VALUES ( N'336716CC-3A16-4197-BB05-68ED19A47A5D',N'B451C8DE-71B9-433E-ACB9-4465FB7E3C5C',N'修改',2)
							INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
							VALUES ( N'E7AC7D13-71AE-493D-B623-57B4D4CFFA79',N'B451C8DE-71B9-433E-ACB9-4465FB7E3C5C',N'删除',3)
							INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
							VALUES ( N'C3B7470A-979D-46FC-863A-7C8AAE63AAF6',N'B451C8DE-71B9-433E-ACB9-4465FB7E3C5C',N'保存',4)
							INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
							VALUES ( N'6EF9861A-89B6-4D2A-93A9-DF2F8FD3BA86',N'B451C8DE-71B9-433E-ACB9-4465FB7E3C5C',N'增加',1)
						GO
        INSERT [Sys_Menu] ([MenuId],[MenuName],[Url],[SortIndex],[SuperMenu],[MenuType],[IsOffice],[IsEnd],[IsUsed])
                    VALUES ( N'DD38AD86-513B-4BBC-AF64-0F52F56784BE',N'出入库单',N'PHTGL/InvoiceManage/InvoiceOrder.aspx',20,'1FF4F8D5-C9AA-4C59-B392-1F025AEB8DEE',N'Menu_PHTGL',0,1,1)
                    GO
                        INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
                        VALUES ( N'8912C056-7B82-4C37-B992-D9F5FA2F6435',N'DD38AD86-513B-4BBC-AF64-0F52F56784BE',N'修改',2)
                        INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
                        VALUES ( N'529076FA-3109-4E14-8F2B-CBFD308E1B51',N'DD38AD86-513B-4BBC-AF64-0F52F56784BE',N'删除',3)
                        INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
                        VALUES ( N'D7E5E87D-52F1-4B83-BE9E-80B4E4AB9A7C',N'DD38AD86-513B-4BBC-AF64-0F52F56784BE',N'保存',4)
                        CREATE TABLE PHTGL_Invoice
                        (
                            InvoiceId NVARCHAR(50) PRIMARY KEY,
                            ProjectId NVARCHAR(50),
                            ContractId NVARCHAR(50),
                            OrderCode NVARCHAR(50),
                            OrderInDate DATE,
                            OrderOutDate DATE,
                            MaterialRequisitionUnit NVARCHAR(100),
                            State int,
                            InvoiceCode NVARCHAR(50),
                            InvoiceNumber NVARCHAR(50),
                            SellerName NVARCHAR(100),
                            InvoiceDate NVARCHAR(50),
                            AmountExcludingTax DECIMAL(18,2),
                            TotalTax DECIMAL(18,2),
                            Remark NVARCHAR(500),
                            ImagePath NVARCHAR(500),
                            SellerTaxNumber NVARCHAR(50),
                            InvoiceAmount DECIMAL(18,2),
                            ApproveManJson NVARCHAR(2000),
                            CreateDate DATETIME,
                            CreateUser NVARCHAR(50),

                        )
GO
                        INSERT [Sys_ButtonToMenu] ([ButtonToMenuId],[MenuId],[ButtonName],[SortIndex])
                        VALUES ( N'D6736D81-62AC-4695-9A84-19120E4AC9ED',N'DD38AD86-513B-4BBC-AF64-0F52F56784BE',N'增加',1)
exec sp_addextendedproperty 'MS_Description', N'主键id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'InvoiceId'
go

exec sp_addextendedproperty 'MS_Description', N'项目id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'ProjectId'
go

exec sp_addextendedproperty 'MS_Description', N'状态', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN', 'State'
go

exec sp_addextendedproperty 'MS_Description', N'发票代码', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'InvoiceCode'
go

exec sp_addextendedproperty 'MS_Description', N'发票号码', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'InvoiceNumber'
go

exec sp_addextendedproperty 'MS_Description', N'销方名称', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'SellerName'
go

exec sp_addextendedproperty 'MS_Description', N'开票日期', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'InvoiceDate'
go

exec sp_addextendedproperty 'MS_Description', N'不含税金额', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'AmountExcludingTax'
go

exec sp_addextendedproperty 'MS_Description', N'合计税额', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'TotalTax'
go

exec sp_addextendedproperty 'MS_Description', N'备注', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN', 'Remark'
go

exec sp_addextendedproperty 'MS_Description', N'图片存储路径', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'ImagePath'
go

exec sp_addextendedproperty 'MS_Description', N'销方税号', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'SellerTaxNumber'
go

exec sp_addextendedproperty 'MS_Description', N'票面金额', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'InvoiceAmount'
go

exec sp_addextendedproperty 'MS_Description', N'审批人信息json', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'ApproveManJson'
go

exec sp_addextendedproperty 'MS_Description', N'创建日期', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'CreateDate'
go

exec sp_addextendedproperty 'MS_Description', N'创建人id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'CreateUser'
go
exec sp_addextendedproperty 'MS_Description', N'合同主键id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'ContractId'
go

exec sp_addextendedproperty 'MS_Description', N'入库日期', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'OrderInDate'
go

exec sp_addextendedproperty 'MS_Description', N'订单编号', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'OrderCode'
go

exec sp_addextendedproperty 'MS_Description', N'出库日期', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'OrderOutDate'
go

exec sp_addextendedproperty 'MS_Description', N'领料单位', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_Invoice', 'COLUMN',
     'MaterialRequisitionUnit'
go



CREATE TABLE PHTGL_InvoiceDetail
(
    InvoiceDetailId NVARCHAR(50) PRIMARY KEY,
    InvoiceId NVARCHAR(50),
    GoodsOrServicesName NVARCHAR(100),
    SpecificationModel NVARCHAR(100),
    Unit NVARCHAR(50),
    Quantity DECIMAL(18,2),
    UnitPrice DECIMAL(18,2),
    Amount DECIMAL(18,2),
    TaxRate NVARCHAR(50),
    Tax DECIMAL(18,2),
)exec sp_addextendedproperty 'MS_Description', N'明细id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'InvoiceDetailId'
go

exec sp_addextendedproperty 'MS_Description', N'合同发票id', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'InvoiceId'
go

exec sp_addextendedproperty 'MS_Description', N'货物或应税劳务名称', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail',
     'COLUMN', 'GoodsOrServicesName'
go

exec sp_addextendedproperty 'MS_Description', N'规格型号', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'SpecificationModel'
go

exec sp_addextendedproperty 'MS_Description', N'单位', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN', 'Unit'
go

exec sp_addextendedproperty 'MS_Description', N'数量', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'Quantity'
go

exec sp_addextendedproperty 'MS_Description', N'单价', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'UnitPrice'
go

exec sp_addextendedproperty 'MS_Description', N'金额', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'Amount'
go

exec sp_addextendedproperty 'MS_Description', N'税率', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN',
     'TaxRate'
go

exec sp_addextendedproperty 'MS_Description', N'税额', 'SCHEMA', 'dbo', 'TABLE', 'PHTGL_InvoiceDetail', 'COLUMN', 'Tax'
go

