--delete System_Auth
--select * from System_Module where auth_code not in (select auth_code from System_Auth)

if (select count(1) from System_Auth where auth_code='System_Config')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_Config','参数配置'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_CommonModule_FormatView')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_CommonModule_SetPrint','设置打印模板'
	union all
	select 'System_CommonModule_FormatView','设置栏目格式'
  union all
	select 'System_CommonModule_HomeAmountPanel','首页资金面板'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_XReport')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_XReport','自定义报表'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_ModuleScript')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_ModuleScript','模块脚本'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_UserLog')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_UserLog','操作日志'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_BusinessEnd')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_BusinessEnd','月末结账'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_Member')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_Member','用户-查看'
	union all
	select 'System_Member_Edit','用户-编辑'
	union all
	select 'System_Member_Delete','用户-删除'
	union all
	select 'System_Member_Auth','用户-授权'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_Member_WhAuth')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_Member_WhAuth','仓库授限'
	union all
	select 'System_Member_DepAuth','部门授限'
end
/**/GO
if (select count(1) from System_Auth where auth_code='System_Role')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'System_Role','角色-查看'
	union all
	select 'System_Role_Edit','角色-编辑'
	union all
	select 'System_Role_Delete','角色-删除'
	union all
	select 'System_Role_Auth','角色-授权'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_Inventory_List_ViewPrice')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Inventory_List_ViewPrice','查看价格';
	insert System_Auth(auth_code,auth_name)
	select 'Base_Inventory_List_EditPrice','修改价格'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Department')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Department','部门-查看'
	union all
	select 'Base_Department_Edit','部门-编辑'
	union all
	select 'Base_Department_Delete','部门-删除'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_Employee')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Employee','员工-查看'
	union all
	select 'Base_Employee_Edit','员工-编辑'
	union all
	select 'Base_Employee_Delete','员工-删除'
	union all
	select 'Base_Employee_Import','员工-导入'
	union all
	select 'Base_Employee_GiveChild','员工-分配下级'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_Warehouse')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Warehouse','仓库-查看'
	union all
	select 'Base_Warehouse_Edit','仓库-编辑'
	union all
	select 'Base_Warehouse_Delete','仓库-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_InventoryClass')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_InventoryClass','存货分类-查看'
	union all
	select 'Base_InventoryClass_Edit','存货分类-编辑'
	union all
	select 'Base_InventoryClass_Delete','存货分类-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Inventory')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Inventory','存货-查看'
	union all
	select 'Base_Inventory_Edit','存货-编辑'
	union all
	select 'Base_Inventory_Delete','存货-删除'
	union all
	select 'Base_Inventory_Import','存货-导入'
	union all
	select 'Base_Inventory_UpLoadPhoto','存货-上传图片'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_CustomerClass')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_CustomerClass','客户分类-查看'
	union all
	select 'Base_CustomerClass_Edit','客户分类-编辑'
	union all
	select 'Base_CustomerClass_Delete','客户分类-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Customer')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Customer','客户-查看'
	union all
	select 'Base_Customer_Edit','客户-编辑'
	union all
	select 'Base_Customer_Delete','客户-删除'
	union all
	select 'Base_Customer_Import','客户-导入'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_VendorClass')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_VendorClass','供应商分类-查看'
	union all
	select 'Base_VendorClass_Edit','供应商分类_编辑'
	union all
	select 'Base_VendorClass_Delete','供应商分类_删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Vendor')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Vendor','供应商-查看'
	union all
	select 'Base_Vendor_Edit','供应商-编辑'
	union all
	select 'Base_Vendor_Delete','供应商-删除'
	union all
	select 'Base_Vendor_Import','供应商-导入'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Currency')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Currency','币种-查看'
	union all
	select 'Base_Currency_Edit','币种-编辑'
	union all
	select 'Base_Currency_Delete','币种-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_Digit')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Digit','小数位数-查看'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_SaleType')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_SaleType','销售类型-查看'
	union all
	select 'Base_SaleType_Edit','销售类型-编辑'
	union all
	select 'Base_SaleType_Delete','销售类型-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_PurchaseType')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_PurchaseType','采购类型-查看'
	union all
	select 'Base_PurchaseType_Edit','采购类型-编辑'
	union all
	select 'Base_PurchaseType_Delete','采购类型-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_IOType')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_IOType','收发类型-查看'
	union all
	select 'Base_IOType_Edit','收发类型-编辑'
	union all
	select 'Base_IOType_Delete','收发类型-删除'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_SettleStyle')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_SettleStyle','结算方式-查看'
	union all
	select 'Base_SettleStyle_Edit','结算方式-编辑'
	union all
	select 'Base_SettleStyle_Delete','结算方式-删除'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_Account')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_Account','结算账户-查看'
	union all
	select 'Base_Account_Edit','结算账户-编辑'
	union all
	select 'Base_Account_Delete','结算账户-删除'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_ShipWay')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_ShipWay','运输方式-查看'
	union all
	select 'Base_ShipWay_Edit','运输方式-编辑'
	union all
	select 'Base_ShipWay_Delete','运输方式-删除'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Base_RunningNumberRule')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_RunningNumberRule','流水号规则-查看'
end
/**/GO

/*
if (select count(1) from System_Auth where auth_code='Base_BOM')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_BOM','BOM-查看'
	union all
	select 'Base_BOM_Edit','BOM-编辑'
	union all
	select 'Base_BOM_Verify','BOM-审核'
	union all
	select 'Base_BOM_CancelVerify','BOM-弃审'
	union all
	select 'Base_BOM_Delete','BOM-删除'
	union all
	select 'Base_BOM_Print','BOM-打印'
end
*/
/**/GO
--其它入库单权限
if (select count(1) from System_Auth where auth_code='Stock_OtherIn')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_OtherIn','其它入库单-查看'
	union all
	select 'Stock_OtherIn_Edit','其它入库单-编辑'
	union all
	select 'Stock_OtherIn_Verify','其它入库单-审核'
	union all
	select 'Stock_OtherIn_CancelVerify','其它入库单-弃审'
	union all
	select 'Stock_OtherIn_Delete','其它入库单-删除'
	union all
	select 'Stock_OtherIn_Print','其它入库单-打印'
	union all
	select 'Stock_OtherIn_ViewPrice','其它入库单-查看价格'
end
/**/GO

--修改权限
if (select count(1) from System_Auth where auth_code='Stock_OtherIn_EditPrice')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_OtherIn_EditPrice','其它入库单-修改价格'
	union all
	select 'Stock_OtherOut_EditPrice','其它出库单-修改价格'
	--union all
	--select 'Stock_ProductIn_EditPrice','产成品入库单-修改价格'
	--union all
	--select 'Stock_MaterialOut_EditPrice','材料出库单-修改价格'
end
/**/GO
	

--其它入库单明细表权限
if (select count(1) from System_Auth where auth_code='Stock_Report_OtherIn_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_OtherIn_Details','其它入库单明细表-查看'
	union all
	select 'Stock_Report_OtherIn_Details_ViewPrice','其它入库单明细表-查看价格'
end
/**/GO

--其它出库单权限
if (select count(1) from System_Auth where auth_code='Stock_OtherOut')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_OtherOut','其它出库单-查看'
	union all
	select 'Stock_OtherOut_Edit','其它出库单-编辑'
	union all
	select 'Stock_OtherOut_Verify','其它出库单-审核'
	union all
	select 'Stock_OtherOut_CancelVerify','其它出库单-弃审'
	union all
	select 'Stock_OtherOut_Delete','其它出库单-删除'
	union all
	select 'Stock_OtherOut_Print','其它出库单-打印'
	union all
	select 'Stock_OtherOut_ViewPrice','其它出库单-查看价格'
end
/**/GO
--其它出库单明细表权限
if (select count(1) from System_Auth where auth_code='Stock_Report_OtherOut_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_OtherOut_Details','其它出库单明细表-查看'
	union all
	select 'Stock_Report_OtherOut_Details_ViewPrice','其它出库单明细表-查看价格'
end
/**/GO

--材料出库单权限
/*
if (select count(1) from System_Auth where auth_code='Stock_MaterialOut')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_MaterialOut','材料出库单-查看'
	union all
	select 'Stock_MaterialOut_Edit','材料出库单-编辑'
	union all
	select 'Stock_MaterialOut_Verify','材料出库单-审核'
	union all
	select 'Stock_MaterialOut_CancelVerify','材料出库单-弃审'
	union all
	select 'Stock_MaterialOut_Delete','材料出库单-删除'
	union all
	select 'Stock_MaterialOut_Print','材料出库单-打印'
	union all
	select 'Stock_MaterialOut_ViewPrice','材料出库单-查看价格'
end*/
/**/GO
--材料出库单明细表权限
/*
if (select count(1) from System_Auth where auth_code='Stock_Report_MaterialOut_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_MaterialOut_Details','材料出库单-查看'
	union all
	select 'Stock_Report_MaterialOut_Details_ViewPrice','材料出库单-查看价格'
end*/
/**/GO

--产成品入库单权限
/*
if (select count(1) from System_Auth where auth_code='Stock_ProductIn')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_ProductIn','产成品入库单-查看'
	union all
	select 'Stock_ProductIn_Edit','产成品入库单-编辑'
	union all
	select 'Stock_ProductIn_Verify','产成品入库单-审核'
	union all
	select 'Stock_ProductIn_CancelVerify','产成品入库单-弃审'
	union all
	select 'Stock_ProductIn_Delete','产成品入库单-删除'
	union all
	select 'Stock_ProductIn_Print','产成品入库单-打印'
	union all
	select 'Stock_ProductIn_ViewPrice','产成品入库单-查看价格'
end*/
/**/GO
--产成品入库单明细表权限
/*
if (select count(1) from System_Auth where auth_code='Stock_Report_ProductIn_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_ProductIn_Details','产成品入库单明细表-查看'
	union all
	select 'Stock_Report_ProductIn_Details_ViewPrice','产成品入库单明细表-查看价格'
end*/
/**/GO


--调拨单权限
if (select count(1) from System_Auth where auth_code='Stock_Transfer')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Transfer','调拨单-查看'
	union all
	select 'Stock_Transfer_Edit','调拨单-编辑'
	union all
	select 'Stock_Transfer_Verify','调拨单-审核'
	union all
	select 'Stock_Transfer_CancelVerify','调拨单-弃审'
	union all
	select 'Stock_Transfer_Delete','调拨单-删除'
	union all
	select 'Stock_Transfer_Print','调拨单-打印'
end
/**/GO
--调拨单明细表权限
if (select count(1) from System_Auth where auth_code='Stock_Report_Transfer_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_Transfer_Details','调拨单明细表-查看'
end
/**/GO

--盘点单权限
if (select count(1) from System_Auth where auth_code='Stock_StockCount')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_StockCount','盘点单-查看'
	union all
	select 'Stock_StockCount_Edit','盘点单-编辑'
	union all
	select 'Stock_StockCount_Verify','盘点单-审核'
	union all
	select 'Stock_StockCount_CancelVerify','盘点单-弃审'
	union all
	select 'Stock_StockCount_Delete','盘点单-删除'
	union all
	select 'Stock_StockCount_Print','盘点单-打印'
end
/**/GO
--盘点单明细表权限
if (select count(1) from System_Auth where auth_code='Stock_Report_StockCount_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_StockCount_Details','盘点单明细表-查看'
end
/**/GO

--采购订单权限
if (select count(1) from System_Auth where auth_code='Purchase_PurchaseOrder')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_PurchaseOrder','采购订单-查看'
	union all
	select 'Purchase_PurchaseOrder_Edit','采购订单-编辑'
	union all
	select 'Purchase_PurchaseOrder_Verify','采购订单-审核'
	union all
	select 'Purchase_PurchaseOrder_CancelVerify','采购订单-弃审'
	union all
	select 'Purchase_PurchaseOrder_Delete','采购订单-删除'
	union all
	select 'Purchase_PurchaseOrder_Print','采购订单-打印'
	union all
	select 'Purchase_PurchaseOrder_EditPrice','采购订单-修改价格'
	union all
	select 'Purchase_PurchaseOrder_ViewPrice','采购订单-查看价格'
end
/**/GO
--采购订单明细表权限
if (select count(1) from System_Auth where auth_code='Purchase_Report_PurchaseOrder_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_Report_PurchaseOrder_Details','采购订单明细表-查看'
	union all
	select 'Purchase_Report_PurchaseOrder_Details_ViewPrice','采购订单明细表-查看价格'
end
/**/GO

--采购入库单权限
if (select count(1) from System_Auth where auth_code='Purchase_PurchaseIn')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_PurchaseIn','采购入库单-查看'
	union all
	select 'Purchase_PurchaseIn_Edit','采购入库单-编辑'
	union all
	select 'Purchase_PurchaseIn_Verify','采购入库单-审核'
	union all
	select 'Purchase_PurchaseIn_CancelVerify','采购入库单-弃审'
	union all
	select 'Purchase_PurchaseIn_Delete','采购入库单-删除'
	union all
	select 'Purchase_PurchaseIn_Print','采购入库单-打印'
	union all
	select 'Purchase_PurchaseIn_EditPrice','采购入库单-修改价格'
	union all
	select 'Purchase_PurchaseIn_ViewPrice','采购入库单-查看价格'
end
/**/GO
--采购入库单明细表权限
if (select count(1) from System_Auth where auth_code='Purchase_Report_PurchaseIn_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_Report_PurchaseIn_Details','采购入库单明细表-查看'
	union all
	select 'Purchase_Report_PurchaseIn_Details_ViewPrice','采购入库单明细表-查看价格'
end
/**/GO


--销售订单权限
if (select count(1) from System_Auth where auth_code='Sale_SalesOrder')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_SalesOrder','销售订单-查看'
	union all
	select 'Sale_SalesOrder_Edit','销售订单-编辑'
	union all
	select 'Sale_SalesOrder_Verify','销售订单-审核'
	union all
	select 'Sale_SalesOrder_CancelVerify','销售订单-弃审'
	union all
	select 'Sale_SalesOrder_Delete','销售订单-删除'
	union all
	select 'Sale_SalesOrder_Print','销售订单-打印'
	union all
	select 'Sale_SalesOrder_EditPrice','销售订单-修改价格'
	union all
	select 'Sale_SalesOrder_ViewPrice','销售订单-查看价格'
end
/**/GO
--销售订单明细表权限
if (select count(1) from System_Auth where auth_code='Sale_Report_SalesOrder_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_Report_SalesOrder_Details','销售订单明细表-查看'
	union all
	select 'Sale_Report_SalesOrder_Details_ViewPrice','销售订单明细表-查看价格'
end
/**/GO


--发货单权限
if (select count(1) from System_Auth where auth_code='Sale_DeliveryOrder')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_DeliveryOrder','发货单-查看'
	union all
	select 'Sale_DeliveryOrder_Edit','发货单-编辑'
	union all
	select 'Sale_DeliveryOrder_Verify','发货单-审核'
	union all
	select 'Sale_DeliveryOrder_CancelVerify','发货单-弃审'
	union all
	select 'Sale_DeliveryOrder_Delete','发货单-删除'
	union all
	select 'Sale_DeliveryOrder_Print','发货单-打印'
	union all
	select 'Sale_DeliveryOrder_EditPrice','发货单-修改价格'
	union all
	select 'Sale_DeliveryOrder_ViewPrice','发货单-查看价格'
end
/**/GO
--发货单明细表权限
if (select count(1) from System_Auth where auth_code='Sale_Report_DeliveryOrder_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_Report_DeliveryOrder_Details','发货单明细表-查看'
	union all
	select 'Sale_Report_DeliveryOrder_Details_ViewPrice','发货单明细表-查看价格'
end
/**/GO


--销售出库单权限
if (select count(1) from System_Auth where auth_code='Sale_SalesOut')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_SalesOut','销售出库单-查看'
	union all
	select 'Sale_SalesOut_Edit','销售出库单-编辑'
	union all
	select 'Sale_SalesOut_Verify','销售出库单-审核'
	union all
	select 'Sale_SalesOut_CancelVerify','销售出库单-弃审'
	union all
	select 'Sale_SalesOut_Delete','销售出库单-删除'
	union all
	select 'Sale_SalesOut_Print','销售出库单-打印'
	union all
	select 'Sale_SalesOut_EditPrice','销售出库单-修改价格'
	union all
	select 'Sale_SalesOut_ViewPrice','销售出库单-查看价格'
end
/**/GO
--销售出库单明细表权限
if (select count(1) from System_Auth where auth_code='Sale_Report_SalesOut_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_Report_SalesOut_Details','销售出库单明细表-查看'
	union all
	select 'Sale_Report_SalesOut_Details_ViewPrice','销售出库单明细表-查看价格'
end
/**/GO

--销售对账单权限
if (select count(1) from System_Auth where auth_code='Sale_CheckAccount')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_CheckAccount','销售对账单-查看'
	union all
	select 'Sale_CheckAccount_Edit','销售对账单-编辑'
	union all
	select 'Sale_CheckAccount_Verify','销售对账单-审核'
	union all
	select 'Sale_CheckAccount_CancelVerify','销售对账单-弃审'
	union all
	select 'Sale_CheckAccount_Delete','销售对账单-删除'
	union all
	select 'Sale_CheckAccount_Print','销售对账单-打印'
	union all
	select 'Sale_CheckAccount_EditPrice','销售对账单-修改价格'
	union all
	select 'Sale_CheckAccount_ViewPrice','销售对账单-查看价格'
end
/**/GO
--销售对账单明细表权限
if (select count(1) from System_Auth where auth_code='Sale_Report_CheckAccount_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_Report_CheckAccount_Details','销售对账单明细表-查看'
	union all
	select 'Sale_Report_CheckAccount_Details_ViewPrice','销售对账单明细表-查看价格'
end
/**/GO
--采购对账单权限
if (select count(1) from System_Auth where auth_code='Purchase_CheckAccount')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_CheckAccount','采购对账单-查看'
	union all
	select 'Purchase_CheckAccount_Edit','采购对账单-编辑'
	union all
	select 'Purchase_CheckAccount_Verify','采购对账单-审核'
	union all
	select 'Purchase_CheckAccount_CancelVerify','采购对账单-弃审'
	union all
	select 'Purchase_CheckAccount_Delete','采购对账单-删除'
	union all
	select 'Purchase_CheckAccount_Print','采购对账单-打印'
	union all
	select 'Purchase_CheckAccount_EditPrice','采购对账单-修改价格'
	union all
	select 'Purchase_CheckAccount_ViewPrice','采购对账单-查看价格'
end
/**/GO
--采购对账单明细表权限
if (select count(1) from System_Auth where auth_code='Purchase_Report_CheckAccount_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Purchase_Report_CheckAccount_Details','采购对账单明细表-查看'
	union all
	select 'Purchase_Report_CheckAccount_Details_ViewPrice','采购对账单明细表-查看价格'
end
/**/GO

--收款单权限
if (select count(1) from System_Auth where auth_code='ARAP_ShouKuan')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_ShouKuan','收款单-查看'
	union all
	select 'ARAP_ShouKuan_Edit','收款单-编辑'
	union all
	select 'ARAP_ShouKuan_Verify','收款单-审核'
	union all
	select 'ARAP_ShouKuan_CancelVerify','收款单-弃审'
	union all
	select 'ARAP_ShouKuan_Delete','收款单-删除'
	union all
	select 'ARAP_ShouKuan_Print','收款单-打印'
end
/**/GO
--收款单列表权限
if (select count(1) from System_Auth where auth_code='ARAP_Report_SFKuan_List_AR')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_Report_SFKuan_List_AR','收款单列表-查看'
end
/**/GO
--付款单权限
if (select count(1) from System_Auth where auth_code='ARAP_FuKuan')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_FuKuan','付款单-查看'
	union all
	select 'ARAP_FuKuan_Edit','付款单-编辑'
	union all
	select 'ARAP_FuKuan_Verify','付款单-审核'
	union all
	select 'ARAP_FuKuan_CancelVerify','付款单-弃审'
	union all
	select 'ARAP_FuKuan_Delete','付款单-删除'
	union all
	select 'ARAP_FuKuan_Print','付款单-打印'
end
/**/GO
--付款单列表权限
if (select count(1) from System_Auth where auth_code='ARAP_Report_SFKuan_List_AP')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_Report_SFKuan_List_AP','付款单列表-查看'
end
/**/GO
--应收明细账权限
if (select count(1) from System_Auth where auth_code='ARAP_Report_APDetail_AR')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_Report_APDetail_AR','应收明细账-查看'
	union all
	select 'ARAP_Report_APDetail_AP','应付明细账-查看'
	union all
	select 'ARAP_Report_CustomerBalance','客户应收余额表-查看'
	union all
	select 'ARAP_Report_VendorBalance','供应商应付余额表-查看'
end
/**/GO

--其它其它应收单权限
if (select count(1) from System_Auth where auth_code='ARAP_OtherRP_AR')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_OtherRP_AR','其它应收单-查看'
	union all
	select 'ARAP_OtherRP_AR_Edit','其它应收单-编辑'
	union all
	select 'ARAP_OtherRP_AR_Verify','其它应收单-审核'
	union all
	select 'ARAP_OtherRP_AR_CancelVerify','其它应收单-弃审'
	union all
	select 'ARAP_OtherRP_AR_Delete','其它应收单-删除'
	union all
	select 'ARAP_OtherRP_AR_Print','其它应收单-打印'
end
/**/GO

--其它其它应付单权限
if (select count(1) from System_Auth where auth_code='ARAP_OtherRP_AP')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_OtherRP_AP','其它应付单-查看'
	union all
	select 'ARAP_OtherRP_AP_Edit','其它应付单-编辑'
	union all
	select 'ARAP_OtherRP_AP_Verify','其它应付单-审核'
	union all
	select 'ARAP_OtherRP_AP_CancelVerify','其它应付单-弃审'
	union all
	select 'ARAP_OtherRP_AP_Delete','其它应付单-删除'
	union all
	select 'ARAP_OtherRP_AP_Print','其它应付单-打印'
end
/**/GO

--其它其它应收单列表权限
if (select count(1) from System_Auth where auth_code='ARAP_Report_OtherRP_AR_List')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_Report_OtherRP_AR_List','其它应收单列表-查看'
	union all
	select 'ARAP_Report_OtherRP_AP_List','其它应付单列表-查看'
end
/**/GO

--核销单权限
if (select count(1) from System_Auth where auth_code='ARAP_CancelOrder')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_CancelOrder','核销单-查看'
	union all
	select 'ARAP_CancelOrder_Edit','核销单-编辑'
	union all
	select 'ARAP_CancelOrder_Verify','核销单-审核'
	union all
	select 'ARAP_CancelOrder_CancelVerify','核销单-弃审'
	union all
	select 'ARAP_CancelOrder_Delete','核销单-删除'
end
/**/GO
--核销单列表权限
if (select count(1) from System_Auth where auth_code='ARAP_Report_CancelOrder_List')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'ARAP_Report_CancelOrder_List','核销单列表-查看'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Stock_Report_OnHand')=0
begin
	--现存量
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_OnHand','现存量-查看';
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_OnHand_FixOnHand','整理现存量';
	--出入库流水账
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_InOut_Details','出入库流水账-查看';
	--库存台账
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_InventoryBook','库存台账-查看';
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_InventoryBook_ViewPrice','库存台账-查看价格';
	--进出单据汇总表
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_OrderTypeSummary','进出单据汇总表-查看';
	--收发类型汇总表
	insert System_Auth(auth_code,auth_name)
	select 'Stock_Report_IOTypeSummary','收发类型汇总表-查看';
end
/**/GO
if (select count(1) from System_Auth where auth_code='Base_CusInv')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Base_CusInv','客户产品表-查看'
	union all
	select 'Base_CusInv_Edit','客户产品表-编辑'
	union all
	select 'Base_CusInv_Delete','客户产品表-删除'
	union all
	select 'Base_CusInv_Import','客户产品表-导入'
	union all
	select 'Base_CusInv_ViewPrice','客户产品表-查看价格'
	union all
	select 'Base_CusInv_EditPrice','客户产品表-修改价格'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Sale_More')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_More','更多功能'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Sale_More_GoodsCombo')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_More_GoodsCombo','促销套餐-查看'
	union all
	select 'Sale_More_GoodsCombo_Edit','促销套餐-编辑'
	union all
	select 'Sale_More_GoodsCombo_Verify','促销套餐-审核'
	union all
	select 'Sale_More_GoodsCombo_CancelVerify','促销套餐-弃审'
	union all
	select 'Sale_More_GoodsCombo_Delete','促销套餐-删除'
	union all
	select 'Sale_More_GoodsCombo_Print','促销套餐-打印'
end
/**/GO
--促销套餐明细表权限
if (select count(1) from System_Auth where auth_code='Sale_Report_GoodsCombo_Details')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Sale_Report_GoodsCombo_Details','促销套餐明细表-查看'
end
/**/GO
