--delete System_Auth where auth_code like 'Phone_%'
if (select count(1) from System_Auth where auth_code='Phone_Customer')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Diary','经营日报-查看'
	union all
	select 'Phone_Ranking','排行榜-查看'
	union all
	select 'Phone_Approve','单据查询-查看'
	union all
	select 'Phone_Report','报表中心-查看'
	union all
	select 'Phone_Customer','客户查询-查看'
	union all
	select 'Phone_Inventory','商品查询-查看'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_MakeOrder')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_MakeOrder','销售下单-查看'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Ranking_EmployeeRank')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Ranking_EmployeeRank','业务员销售排行'
	union all
	select 'Phone_Ranking_InventoryRank','商品销售排行'
	union all
	select 'Phone_Ranking_CustomerRank','客户贡献排行'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Approve_SalesOrderList')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_SalesOrderList','销售订单查询'
	union all
	select 'Phone_Approve_PurchaseOrderList','采购订单查询'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Approve_DeliveryOrderList')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_DeliveryOrderList','发货单查询'
	union all
	select 'Phone_Approve_DeliveryOrderVerify','发货单审核'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Approve_SalesOrderVerify')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_SalesOrderVerify','销售订单审核'
	union all
	select 'Phone_Approve_PurchaseOrderVerify','采购订单审核'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Phone_Approve_SalesOrderCancelVerify')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_SalesOrderCancelVerify','销售订单弃审'
	union all
	select 'Phone_Approve_DeliveryOrderCancelVerify','发货单弃审'
	union all
	select 'Phone_Approve_PurchaseOrderCancelVerify','采购订单弃审'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Approve_PurchaseInList')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_PurchaseInList','采购入库单查询'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Approve_PurchaseInVerify')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Approve_PurchaseInVerify','采购入库单审核'
	union all
	select 'Phone_Approve_PurchaseInCancelVerify','采购入库单弃审'
end
/**/GO

if (select count(1) from System_Auth where auth_code='Phone_Report_EmployeeSale')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Report_EmployeeSale','业务员业绩统计'
	union all
	select 'Phone_Report_SaleTrend','销售趋势'
	union all
	select 'Phone_Report_YearSale','年度销售统计'
end
/**/GO
if (select count(1) from System_Auth where auth_code='Phone_Report_EmployeeSale')=0
begin
	insert System_Auth(auth_code,auth_name)
	select 'Phone_Report_EmployeeSale','业务员业绩统计'
	union all
	select 'Phone_Report_SaleTrend','销售趋势'
	union all
	select 'Phone_Report_YearSale','年度销售统计'
end
/**/GO
