--清空系统模块表
--delete System_Module
/**/GO
--清空模块格式定义表
--delete System_ModuleFormat;
/**/GO

if (select count(1) from System_Module where module_code='Sale')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'Sale' as module_code,'销售' as module_name,
	20 as sort,'Sale' as auth_code,'Sale.png' as node_img,null as url,'../../UI/Flow/Sale_Flow.aspx' as flow_url;
end
/**/GO

if (select count(1) from System_Module where module_code='Purchase')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'Purchase' as module_code,'采购' as module_name,
	30 as sort,'Purchase' as auth_code,'Purchase.png' as node_img,null as url,'../../UI/Flow/Purchase_Flow.aspx' as flow_url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'Stock' as module_code,'库存' as module_name,
	40 as sort,'Stock' as auth_code,'Stock.png' as node_img,null as url,'../../UI/Flow/Stock_Flow.aspx' as flow_url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'ARAP' as module_code,'资金' as module_name,
	50 as sort,'ARAP' as auth_code,'ARAP.png' as node_img,null as url,'../../UI/Flow/ARAP_Flow.aspx' as flow_url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Plan')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select null category,'Plan' as module_code,'生产' as module_name,
	50 as sort,'Plan' as auth_code,'Plan.png' as node_img,null as url;
end
*/
/**/GO
--select * from System_Module order by module_code,sort

if (select count(1) from System_Module where module_code='Base')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'Base' as module_code,'基础' as module_name,
	200 as sort,'Base' as auth_code,'Base.png' as node_img,null as url,'../../UI/Flow/Base_Flow.aspx' as flow_url;
end
/**/GO

if (select count(1) from System_Module where module_code='Phone')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'Phone' as module_code,'手机' as module_name,
	250 as sort,'Phone' as auth_code,'Phone.png' as node_img,null as url,'../../M/Home/Portal.aspx' as flow_url;
end
/**/GO

if (select count(1) from System_Module where module_code='System')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select null category,'System' as module_code,'系统' as module_name,
	270 as sort,'System' as auth_code,'System.png' as node_img,null as url,'../../UI/Flow/System_Flow.aspx' as flow_url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_Department')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Department' as module_code,'部门' as module_name,
	10 as sort,'Base_Department' as auth_code,'default.png' as node_img,
  '../../Base/Department/Department_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_Employee')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Employee' as module_code,'员工' as module_name,
	20 as sort,'Base_Employee' as auth_code,'default.png' as node_img,
  '../../Base/Employee/Employee_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_Customer')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Customer' as module_code,'客户' as module_name,
	30 as sort,'Base_Customer' as auth_code,'default.png' as node_img,
  '../../Base/Customer/Customer_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_Vendor')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Vendor' as module_code,'供应商' as module_name,
	40 as sort,'Base_Vendor' as auth_code,'default.png' as node_img,
  '../../Base/Vendor/Vendor_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_Warehouse')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Warehouse' as module_code,'仓库' as module_name,
	50 as sort,'Base_Warehouse' as auth_code,'default.png' as node_img,
  '../../Base/Warehouse/Warehouse_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_Inventory')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Inventory' as module_code,'存货' as module_name,
	60 as sort,'Base_Inventory' as auth_code,'default.png' as node_img,
  '../../Base/Inventory/Inventory_List.aspx' as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Base_BOM')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_BOM' as module_code,'物料清单' as module_name,
	45 as sort,'Base_BOM' as auth_code,'default.png' as node_img,
  '../../Base/BOM/BOM_List.aspx' as url;
end
*/
/**/GO

if (select count(1) from System_Module where module_code='Base_Currency')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Currency' as module_code,'币种' as module_name,
	200 as sort,'Base_Currency' as auth_code,'default.png' as node_img,
  '../../Base/Currency/Currency_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_Digit')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Digit' as module_code,'小数位数' as module_name,
	210 as sort,'Base_Digit' as auth_code,'default.png' as node_img,
  '../../Base/Digit/Digit_Edit.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_SaleType')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_SaleType' as module_code,'销售类型' as module_name,
	220 as sort,'Base_SaleType' as auth_code,'default.png' as node_img,
  '../../Base/SaleType/SaleType_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_PurchaseType')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_PurchaseType' as module_code,'采购类型' as module_name,
	230 as sort,'Base_PurchaseType' as auth_code,'default.png' as node_img,
  '../../Base/PurchaseType/PurchaseType_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_IOType')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_IOType' as module_code,'收发类型' as module_name,
	240 as sort,'Base_IOType' as auth_code,'default.png' as node_img,
  '../../Base/IOType/IOType_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Base_SettleStyle')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_SettleStyle' as module_code,'结算方式' as module_name,
	250 as sort,'Base_SettleStyle' as auth_code,'default.png' as node_img,
  '../../Base/SettleStyle/SettleStyle_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_Account')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Account' as module_code,'结算账户' as module_name,
	260 as sort,'Base_Account' as auth_code,'default.png' as node_img,
  '../../Base/Account/Account_List.aspx' as url;
end
/**/GO

/*
if (select count(1) from System_Module where module_code='Base_Cost')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_Cost' as module_code,'费用类型' as module_name,
	290 as sort,'Base_Cost' as auth_code,'default.png' as node_img,
  '../../Base/Cost/Cost_List.aspx' as url;
end*/
/**/GO

if (select count(1) from System_Module where module_code='Base_RunningNumberRule')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_RunningNumberRule' as module_code,'流水号规则' as module_name,
	280 as sort,'Base_RunningNumberRule' as auth_code,'default.png' as node_img,
  '../../Base/RunningNumberRule/RunningNumberRule.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_ShipWay')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_ShipWay' as module_code,'运输方式' as module_name,
	290 as sort,'Base_ShipWay' as auth_code,'default.png' as node_img,
  '../../Base/ShipWay/ShipWay_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Base_CusInv')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Base' as category,'Base_CusInv' as module_code,'客户产品表' as module_name,
	300 as sort,'Base_CusInv' as auth_code,'default.png' as node_img,
  '../../Base/CusInv/CusInv_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='System_Config')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_Config' as module_code,'参数配置' as module_name,
	40 as sort,'System_Config' as auth_code,'Config.png' as node_img,'../../System/Config/Config.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='System_XReport')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_XReport' as module_code,'自定义报表' as module_name,
	50 as sort,'System_XReport' as auth_code,'XReport.png' as node_img,'../../System/XReport/XReport.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='System_ModuleScript')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_ModuleScript' as module_code,'模块脚本' as module_name,
	60 as sort,'System_ModuleScript' as auth_code,'ModuleScript.png' as node_img,'../../System/ModuleScript/ModuleScript.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='System_UserLog')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_UserLog' as module_code,'操作日志' as module_name,
	70 as sort,'System_UserLog' as auth_code,'UserLog.png' as node_img,'../../System/UserLog/UserLog.aspx' as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='System_InitBegin')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select 'System' as category,'System_InitBegin' as module_code,'期初导入' as module_name,
	5 as sort,'System_InitBegin' as auth_code,'InitBegin.png' as node_img,'../../UI/Flow/InitBegin_Flow.aspx' as url,'' as flow_url;
end
*/
/**/GO
/*
if (select count(1) from System_Module where module_code='System_InitBegin_ImportAR')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System_InitBegin' as category,'System_InitBegin_ImportAR' as module_code,'应收期初' as module_name,
	20 as sort,'System_InitBegin_ImportAR' as auth_code,'BusinessEnd.png' as node_img,'../../System/ImportAR/ImportAR.aspx' as url;
end*/
/**/GO
/*
if (select count(1) from System_Module where module_code='System_InitBegin_ImportAP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System_InitBegin' as category,'System_InitBegin_ImportAP' as module_code,'应付期初' as module_name,
	30 as sort,'System_InitBegin_ImportAP' as auth_code,'BusinessEnd.png' as node_img,'../../System/ImportAR/ImportAP.aspx' as url;
end*/
/**/GO
if (select count(1) from System_Module where module_code='System_CommonModule')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_CommonModule' as module_code,'通用功能' as module_name,
	5 as sort,'System_CommonModule' as auth_code,'CommonModule.png' as node_img,'' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='System_BusinessEnd')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_BusinessEnd' as module_code,'业务结账' as module_name,
	10 as sort,'System_BusinessEnd' as auth_code,'BusinessEnd.png' as node_img,'../../System/BusinessEnd/BusinessEnd.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='System_Member')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_Member' as module_code,'用户' as module_name,
	10 as sort,'System_Member' as auth_code,'Member.png' as node_img,
  '../../System/Member/Member_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='System_Role')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'System' as category,'System_Role' as module_code,'角色' as module_name,
	20 as sort,'System_Role' as auth_code,'Role.png' as node_img,
  '../../System/Role/Role_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_Report')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale' as category,'Sale_Report' as module_code,'报表' as module_name,
	10 as sort,'Sale_Report' as auth_code,'ModuleReport.png' as node_img,null as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_SalesOrder')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale' as category,'Sale_SalesOrder' as module_code,'销售订单' as module_name,
	30 as sort,'Sale_SalesOrder' as auth_code,'SalesOrder.png' as node_img,
	'../../Sale/SalesOrder/SalesOrder_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_DeliveryOrder')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale' as category,'Sale_DeliveryOrder' as module_code,'发货单' as module_name,
	40 as sort,'Sale_DeliveryOrder' as auth_code,'Delivery.png' as node_img,
	'../../Sale/DeliveryOrder/DeliveryOrder_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_SalesOut')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale' as category,'Sale_SalesOut' as module_code,'销售出库单' as module_name,
	50 as sort,'Sale_SalesOut' as auth_code,'SalesOut.png' as node_img,
	'../../Sale/SalesOut/SalesOut_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_CheckAccount')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale' as category,'Sale_CheckAccount' as module_code,'销售对账单' as module_name,
	50 as sort,'Sale_CheckAccount' as auth_code,'CheckAccount.png' as node_img,
	'../../ARAP/CheckAccount/CheckAccount_Document.aspx?rp_flag=AR' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_Report_SalesOrder_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_Report' as category,'Sale_Report_SalesOrder_Details' as module_code,'销售订单明细表' as module_name,
	10 as sort,'Sale_Report_SalesOrder_Details' as auth_code,'Report.png' as node_img,
	'../../Sale/Report/SalesOrder_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_Report_DeliveryOrder_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_Report' as category,'Sale_Report_DeliveryOrder_Details' as module_code,'发货单明细表' as module_name,
	20 as sort,'Sale_Report_DeliveryOrder_Details' as auth_code,'Report.png' as node_img,
	'../../Sale/Report/DeliveryOrder_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_Report_SalesOut_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_Report' as category,'Sale_Report_SalesOut_Details' as module_code,'销售出库单明细表' as module_name,
	30 as sort,'Sale_Report_SalesOut_Details' as auth_code,'Report.png' as node_img,
	'../../Sale/Report/SalesOut_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_Report_CheckAccount_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_Report' as category,'Sale_Report_CheckAccount_Details' as module_code,'销售对账单明细表' as module_name,
	40 as sort,'Sale_Report_CheckAccount_Details' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/CheckAccount_Details.aspx?rp_flag=AR' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Purchase_Report')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase' as category,'Purchase_Report' as module_code,'报表' as module_name,
	10 as sort,'Purchase_Report' as auth_code,'ModuleReport.png' as node_img,null as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Purchase_PurchaseOrder')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase' as category,'Purchase_PurchaseOrder' as module_code,'采购订单' as module_name,
	40 as sort,'Purchase_PurchaseOrder' as auth_code,'PurchaseOrder.png' as node_img,
	'../../Purchase/PurchaseOrder/PurchaseOrder_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Purchase_PurchaseIn')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase' as category,'Purchase_PurchaseIn' as module_code,'采购入库单' as module_name,
	50 as sort,'Purchase_PurchaseIn' as auth_code,'PurchaseIn.png' as node_img,
	'../../Purchase/PurchaseIn/PurchaseIn_Document.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Purchase_CheckAccount')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase' as category,'Purchase_CheckAccount' as module_code,'采购对账单' as module_name,
	70 as sort,'Purchase_CheckAccount' as auth_code,'CheckAccount.png' as node_img,
	'../../ARAP/CheckAccount/CheckAccount_Document.aspx?rp_flag=AP' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Purchase_Report_PurchaseOrder_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase_Report' as category,'Purchase_Report_PurchaseOrder_Details' as module_code,'采购订单明细表' as module_name,
	40 as sort,'Purchase_Report_PurchaseOrder_Details' as auth_code,'Report.png' as node_img,
	'../../Purchase/Report/PurchaseOrder_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Purchase_Report_PurchaseIn_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase_Report' as category,'Purchase_Report_PurchaseIn_Details' as module_code,'采购入库单明细表' as module_name,
	50 as sort,'Purchase_Report_PurchaseIn_Details' as auth_code,'Report.png' as node_img,
	'../../Purchase/Report/PurchaseIn_Details.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Purchase_Report_CheckAccount_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Purchase_Report' as category,'Purchase_Report_CheckAccount_Details' as module_code,'采购对账单明细表' as module_name,
	70 as sort,'Purchase_Report_CheckAccount_Details' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/CheckAccount_Details.aspx?rp_flag=AP' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Stock_Report')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_Report' as module_code,'报表' as module_name,
	10 as sort,'Stock_Report' as auth_code,'ModuleReport.png' as node_img,null as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Stock_ProductIn')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_ProductIn' as module_code,'产成品入库单' as module_name,
	40 as sort,'Stock_ProductIn' as auth_code,'default.png' as node_img,
	'../../Stock/ProductIn/ProductIn_Document.aspx' as url;
end*/
/**/GO

if (select count(1) from System_Module where module_code='Stock_OtherIn')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_OtherIn' as module_code,'其它入库单' as module_name,
	50 as sort,'Stock_OtherIn' as auth_code,'default.png' as node_img,
	'../../Stock/OtherIn/OtherIn_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_OtherOut')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_OtherOut' as module_code,'其它出库单' as module_name,
	60 as sort,'Stock_OtherOut' as auth_code,'default.png' as node_img,
	'../../Stock/OtherOut/OtherOut_Document.aspx' as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Stock_MaterialOut')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_MaterialOut' as module_code,'材料出库单' as module_name,
	70 as sort,'Stock_MaterialOut' as auth_code,'default.png' as node_img,
	'../../Stock/MaterialOut/MaterialOut_Document.aspx' as url;
end*/
/**/GO

if (select count(1) from System_Module where module_code='Stock_Transfer')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_Transfer' as module_code,'调拨单' as module_name,
	80 as sort,'Stock_Transfer' as auth_code,'default.png' as node_img,
	'../../Stock/Transfer/Transfer_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_StockCount')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock' as category,'Stock_StockCount' as module_code,'盘点单' as module_name,
	90 as sort,'Stock_StockCount' as auth_code,'default.png' as node_img,
	'../../Stock/StockCount/StockCount_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_OnHand')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_OnHand' as module_code,'现存量查询' as module_name,
	50 as sort,'Stock_Report_OnHand' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/OnHand.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_InOut_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_InOut_Details' as module_code,'出入库流水账' as module_name,
	60 as sort,'Stock_Report_InOut_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/InOut_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_InventoryBook')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_InventoryBook' as module_code,'库存台账' as module_name,
	70 as sort,'Stock_Report_InventoryBook' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/InventoryBook.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_OrderTypeSummary')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_OrderTypeSummary' as module_code,'进出单据汇总表' as module_name,
	80 as sort,'Stock_Report_OrderTypeSummary' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/OrderTypeSummary.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_IOTypeSummary')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_IOTypeSummary' as module_code,'收发类型汇总表' as module_name,
	90 as sort,'Stock_Report_IOTypeSummary' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/IOTypeSummary.aspx' as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Stock_Report_ProductIn_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_ProductIn_Details' as module_code,'产成品入库单明细表' as module_name,
	100 as sort,'Stock_Report_ProductIn_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/ProductIn_Details.aspx' as url;
end*/
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_OtherIn_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_OtherIn_Details' as module_code,'其它入库单明细表' as module_name,
	110 as sort,'Stock_Report_OtherIn_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/OtherIn_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_OtherOut_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_OtherOut_Details' as module_code,'其它出库单明细表' as module_name,
	120 as sort,'Stock_Report_OtherOut_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/OtherOut_Details.aspx' as url;
end
/**/GO
/*
if (select count(1) from System_Module where module_code='Stock_Report_MaterialOut_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_MaterialOut_Details' as module_code,'材料出库单明细表' as module_name,
	130 as sort,'Stock_Report_MaterialOut_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/MaterialOut_Details.aspx' as url;
end*/
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_Transfer_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_Transfer_Details' as module_code,'调拨单明细表' as module_name,
	140 as sort,'Stock_Report_Transfer_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/Transfer_Details.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Stock_Report_StockCount_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Stock_Report_StockCount_Details' as module_code,'盘点单明细表' as module_name,
	150 as sort,'Stock_Report_StockCount_Details' as auth_code,'Report.png' as node_img,
	'../../Stock/Report/StockCount_Details.aspx' as url;
end
/**/GO

/*
if (select count(1) from System_Module where module_code='Plan_PMC')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Plan' as category,'Plan_PMC' as module_code,'生产加工单' as module_name,
	10 as sort,'Plan_PMC' as auth_code,'default.png' as node_img,
	'../../Plan/PMC/PMC_Document.aspx' as url;
end
if (select count(1) from System_Module where module_code='Plan_Report_PMC_List')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Stock_Report' as category,'Plan_Report_PMC_List' as module_code,'生产加工单产品明细表' as module_name,
	40 as sort,'Plan_Report_PMC_List' as auth_code,'Report.png' as node_img,
	'../../Plan/Report/PMC_List.aspx' as url;
end
*/

if (select count(1) from System_Module where module_code='ARAP_ShouKuan')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_ShouKuan' as module_code,'收款单' as module_name,
	10 as sort,'ARAP_ShouKuan' as auth_code,'ShouKuan.png' as node_img,
	'../../ARAP/SFKuan/SFKuan_Document.aspx?rp_flag=AR' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_FuKuan')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_FuKuan' as module_code,'付款单' as module_name,
	20 as sort,'ARAP_FuKuan' as auth_code,'FuKuan.png' as node_img,
	'../../ARAP/SFKuan/SFKuan_Document.aspx?rp_flag=AP' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_Report' as module_code,'报表' as module_name,
	10 as sort,'ARAP_Report' as auth_code,'ModuleReport.png' as node_img,null as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_OtherRP_AR')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_OtherRP_AR' as module_code,'其它应收单' as module_name,
	30 as sort,'ARAP_OtherRP_AR' as auth_code,'OtherRP_AR.png' as node_img,
	'../../ARAP/OtherRP/OtherRP_Document.aspx?rp_flag=AR' as url;
end
/**/GO
/**/GO
if (select count(1) from System_Module where module_code='ARAP_OtherRP_AP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_OtherRP_AP' as module_code,'其它应付单' as module_name,
	40 as sort,'ARAP_OtherRP_AP' as auth_code,'OtherRP_AP.png' as node_img,
	'../../ARAP/OtherRP/OtherRP_Document.aspx?rp_flag=AP' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_CancelOrder')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP' as category,'ARAP_CancelOrder' as module_code,'核销单' as module_name,
	50 as sort,'ARAP_CancelOrder' as auth_code,'CancelOrder.png' as node_img,
	'../../ARAP/CancelOrder/CancelOrder_Document.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_SFKuan_List_AR')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_SFKuan_List_AR' as module_code,'收款单列表' as module_name,
	100 as sort,'ARAP_Report_SFKuan_List_AR' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/SFKuan_List.aspx?rp_flag=AR' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_SFKuan_List_AP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_SFKuan_List_AP' as module_code,'付款单列表' as module_name,
	110 as sort,'ARAP_Report_SFKuan_List_AP' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/SFKuan_List.aspx?rp_flag=AP' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='ARAP_Report_OtherRP_AR_List')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_OtherRP_AR_List' as module_code,'其它应收单列表' as module_name,
	120 as sort,'ARAP_Report_OtherRP_AR_List' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/OtherRP_List.aspx?rp_flag=AR' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_CancelOrder_List')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_CancelOrder_List' as module_code,'核销单列表' as module_name,
	130 as sort,'ARAP_Report_CancelOrder_List' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/CancelOrder_List.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='ARAP_Report_SFKuan_List_AP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_SFKuan_List_AP' as module_code,'付款单列表' as module_name,
	140 as sort,'ARAP_Report_SFKuan_List_AP' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/SFKuan_List.aspx?rp_flag=AP' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='ARAP_Report_APDetail_AR')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_APDetail_AR' as module_code,'应收明细账' as module_name,
	150 as sort,'ARAP_Report_APDetail_AR' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/APDetail.aspx?rp_flag=AR' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_APDetail_AP')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_APDetail_AP' as module_code,'应付明细账' as module_name,
	160 as sort,'ARAP_Report_APDetail_AP' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/APDetail.aspx?rp_flag=AP' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_CustomerBalance')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_CustomerBalance' as module_code,'客户应收余额表' as module_name,
	170 as sort,'ARAP_Report_CustomerBalance' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/CustomerBalance.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='ARAP_Report_VendorBalance')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'ARAP_Report' as category,'ARAP_Report_VendorBalance' as module_code,'供应商应付余额表' as module_name,
	180 as sort,'ARAP_Report_VendorBalance' as auth_code,'Report.png' as node_img,
	'../../ARAP/Report/VendorBalance.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Phone_MakeOrder')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_MakeOrder' as module_code,'移动下单' as module_name,
	10 as sort,'Phone_MakeOrder' as auth_code,'MakeOrder.png' as node_img,'../../M/Order/ProductCategory_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Approve')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Approve' as module_code,'单据查询' as module_name,
	20 as sort,'Phone_Approve' as auth_code,'Approve.png' as node_img,'../../M/Verify/Menu.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Inventory')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Inventory' as module_code,'商品查询' as module_name,
	30 as sort,'Phone_Diary' as auth_code,'Inventory.png' as node_img,'../../M/Report/Menu.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Customer')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Customer' as module_code,'客户查询' as module_name,
	40 as sort,'Phone_Customer' as auth_code,'Customer.png' as node_img,'../../M/Sale/Customer_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Diary')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Diary' as module_code,'经营日报' as module_name,
	50 as sort,'Phone_Diary' as auth_code,'Diary.png' as node_img,'../../M/Daily/ManagementDaily_List.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Ranking')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Ranking' as module_code,'排行榜' as module_name,
	60 as sort,'Phone_Ranking' as auth_code,'Ranking.png' as node_img,'../../M/Ranking/Menu.aspx' as url;
end
/**/GO
if (select count(1) from System_Module where module_code='Phone_Report')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Phone' as category,'Phone_Report' as module_code,'报表中心' as module_name,
	70 as sort,'Phone_Diary' as auth_code,'Report.png' as node_img,'../../M/Report/Menu.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_More')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url,flow_url)
	select 'Sale' category,'Sale_More' as module_code,'更多功能' as module_name,
	250 as sort,'Sale_More' as auth_code,'Sale_More.png' as node_img,null as url,'../../UI/Flow/Sale_More.aspx' as flow_url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_More_GoodsCombo')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_More' as category,'Sale_More_GoodsCombo' as module_code,'促销套餐' as module_name,
	30 as sort,'Sale_More_GoodsCombo' as auth_code,'GoodsCombo.png' as node_img,
	'../../Sale/GoodsCombo/GoodsCombo_Document.aspx' as url;
end
/**/GO

if (select count(1) from System_Module where module_code='Sale_More_Report_GoodsCombo_Details')=0
begin
	insert System_Module(category,module_code,module_name,sort,auth_code,node_img,url)
	select 'Sale_More_Report' as category,'Sale_More_Report_GoodsCombo_Details' as module_code,'促销套餐明细表' as module_name,
	20 as sort,'Sale_More_Report_GoodsCombo_Details' as auth_code,'Report.png' as node_img,
	'../../Sale/Report/GoodsCombo_Details.aspx' as url;
end
/**/GO
