
--插入[销售订单明细表]报表界面格式
if(select count(1) from System_ModuleFormat where module='Sale_Report_SalesOrder_Details' and field='sos_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sos_id' as field,
	'订单子表ID' as field_name,'订单子表ID' as title,
	60 as width,1 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'so_id' as field,
	'订单主表ID' as field_name,'订单主表ID' as title,
	60 as width,2 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'order_number' as field,
	'订单号' as field_name,'订单号' as title,
	120 as width,110 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'new_date' as field,
	'订单日期' as field_name,'订单日期' as title,
	70 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'cus_name' as field,
	'客户名称' as field_name,'客户名称' as title,
	98 as width,130 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'i_code' as field,
	'存货编码' as field_name,'存货编码' as title,
	98 as width,170 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'i_name' as field,
	'存货名称' as field_name,'存货名称' as title,
	120 as width,180 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'standard' as field,
	'规格型号' as field_name,'规格型号' as title,
	120 as width,190 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'munit' as field,
	'单位' as field_name,'单位' as title,
	40 as width,200 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'aunit' as field,
	'辅计单位' as field_name,'辅计量单位' as title,
	60 as width,210 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'free1' as field,
	'自由项1' as field_name,'自由项1' as title,
	80 as width,220 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'free2' as field,
	'自由项2' as field_name,'自由项2' as title,
	80 as width,230 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'unit_price' as field,
	'无税单价' as field_name,'无税单价' as title,
	60 as width,240 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'tax_unit_price' as field,
	'含税单价' as field_name,'含税单价' as title,
	60 as width,250 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'quantity' as field,
	'数量' as field_name,'数量' as title,
	60 as width,260 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'num' as field,
	'件数' as field_name,'件数' as title,
	60 as width,270 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'acc_fh_quantity' as field,
	'累发数量' as field_name,'累发数量' as title,
	60 as width,280 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'wait_fh_quantity' as field,
	'待发数量' as field_name,'待发数量' as title,
	60 as width,290 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'acc_fh_num' as field,
	'累发件数' as field_name,'累发件数' as title,
	60 as width,300 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'wait_fh_num' as field,
	'待发件数' as field_name,'待发件数' as title,
	60 as width,310 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'convert_rate' as field,
	'换算率' as field_name,'换算率' as title,
	60 as width,320 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'total_price' as field,
	'无税金额' as field_name,'无税金额' as title,
	60 as width,330as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'tax_total_price' as field,
	'含税金额' as field_name,'含税金额' as title,
	60 as width,340 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'tax' as field,
	'税额' as field_name,'税额' as title,
	60 as width,350 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'nat_unit_price' as field,
	'本币单价' as field_name,'本币单价' as title,
	60 as width,360 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'nat_total_price' as field,
	'本币金额' as field_name,'本币金额' as title,
	60 as width,370 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'nat_tax_unit_price' as field,
	'本币含税单价' as field_name,'本币含税单价' as title,
	60 as width,380 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'nat_tax_total_price' as field,
	'本币含税金额' as field_name,'本币含税金额' as title,
	60 as width,390 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOrder_Details' as module,'nat_tax' as field,
	'本币税额' as field_name,'本币税额' as title,
	60 as width,400 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_tax_rate' as field,
	'税率' as field_name,'税率' as title,
	60 as width,410 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'delivery_date' as field,
	'预发货日期' as field_name,'预发货日期' as title,
	70 as width,420 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_remark' as field,
	'表体备注' as field_name,'表体备注' as title,
	100 as width,430 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'st_name' as field,
	'销售类型' as field_name,'销售类型' as title,
	60 as width,440 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'dep_name' as field,
	'销售部门' as field_name,'销售部门' as title,
	60 as width,450 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,color)
	select 'Sale_Report_SalesOrder_Details' as module,'ele_name' as field,
	'业务员' as field_name,'业务员' as title,
	60 as width,455 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,'' as color;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'crc_name' as field,
	'币种' as field_name,'币种' as title,
	40 as width,460 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'exchange_rate' as field,
	'汇率' as field_name,'汇率' as title,
	40 as width,470 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'new_user' as field,
	'新增人' as field_name,'新增人' as title,
	50 as width,480 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'verify_user' as field,
	'审核人' as field_name,'审核人' as title,
	50 as width,490 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'remark' as field,
	'表头备注' as field_name,'表头备注' as title,
	100 as width,500 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_sdefine1' as field,
	'子表字符自定义项1' as field_name,'子表字符自定义项1' as title,
	120 as width,1010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_sdefine2' as field,
	'子表字符自定义项2' as field_name,'子表字符自定义项2' as title,
	60 as width,1020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_sdefine3' as field,
	'子表字符自定义项3' as field_name,'子表字符自定义项3' as title,
	60 as width,1030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_sdefine4' as field,
	'子表字符自定义项4' as field_name,'子表字符自定义项4' as title,
	60 as width,1040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_sdefine5' as field,
	'子表字符自定义项5' as field_name,'子表字符自定义项5' as title,
	60 as width,1050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_ndefine1' as field,
	'子表数值自定义项1' as field_name,'子表数值自定义项1' as title,
	60 as width,1110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_ndefine2' as field,
	'子表数值自定义项2' as field_name,'子表数值自定义项2' as title,
	60 as width,1120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_ndefine3' as field,
	'子表数值自定义项3' as field_name,'子表数值自定义项3' as title,
	60 as width,1130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_ndefine4' as field,
	'子表数值自定义项4' as field_name,'子表数值自定义项4' as title,
	60 as width,1140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_ndefine5' as field,
	'子表数值自定义项5' as field_name,'子表数值自定义项5' as title,
	60 as width,1150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sdefine1' as field,
	'主表字符自定义项1' as field_name,'主表字符自定义项1' as title,
	120 as width,2010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sdefine2' as field,
	'主表字符自定义项2' as field_name,'主表字符自定义项2' as title,
	60 as width,2020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sdefine3' as field,
	'主表字符自定义项3' as field_name,'主表字符自定义项3' as title,
	60 as width,2030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sdefine4' as field,
	'主表字符自定义项4' as field_name,'主表字符自定义项4' as title,
	60 as width,2040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'sdefine5' as field,
	'主表字符自定义项5' as field_name,'主表字符自定义项5' as title,
	60 as width,2050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ndefine1' as field,
	'主表数值自定义项1' as field_name,'主表数值自定义项1' as title,
	60 as width,2110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ndefine2' as field,
	'主表数值自定义项2' as field_name,'主表数值自定义项2' as title,
	60 as width,2120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ndefine3' as field,
	'主表数值自定义项3' as field_name,'主表数值自定义项3' as title,
	60 as width,2130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ndefine4' as field,
	'主表数值自定义项4' as field_name,'主表数值自定义项4' as title,
	60 as width,2140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ndefine5' as field,
	'主表数值自定义项5' as field_name,'主表数值自定义项5' as title,
	60 as width,2150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_sdefine1' as field,
	'存货字符自定义项1' as field_name,'存货字符自定义项1' as title,
	80 as width,3010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_sdefine2' as field,
	'存货字符自定义项2' as field_name,'存货字符自定义项2' as title,
	80 as width,3020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_sdefine3' as field,
	'存货字符自定义项3' as field_name,'存货字符自定义项3' as title,
	80 as width,3030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_sdefine4' as field,
	'存货字符自定义项4' as field_name,'存货字符自定义项4' as title,
	80 as width,3040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_sdefine5' as field,
	'存货字符自定义项5' as field_name,'存货字符自定义项5' as title,
	80 as width,3050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_ndefine1' as field,
	'存货数值自定义项1' as field_name,'存货数值自定义项1' as title,
	80 as width,3110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_ndefine2' as field,
	'存货数值自定义项2' as field_name,'存货数值自定义项2' as title,
	80 as width,3120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_ndefine3' as field,
	'存货数值自定义项3' as field_name,'存货数值自定义项3' as title,
	80 as width,3130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_ndefine4' as field,
	'存货数值自定义项4' as field_name,'存货数值自定义项4' as title,
	80 as width,3140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'d_inv_ndefine5' as field,
	'存货数值自定义项5' as field_name,'存货数值自定义项5' as title,
	80 as width,3150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

end
/**/GO

--插入[销售发货单明细表]报表界面格式
if(select count(1) from System_ModuleFormat where module='Sale_Report_DeliveryOrder_Details' and field='dos_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'dos_id' as field,
	'发货单子表ID' as field_name,'发货单子表ID' as title,
	60 as width,1 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'do_id' as field,
	'发货单主表ID' as field_name,'发货单主表ID' as title,
	60 as width,2 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'order_number' as field,
	'发货单号' as field_name,'发货单号' as title,
	120 as width,110 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'so_order_number' as field,
	'订单号' as field_name,'订单号' as title,
	100 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'new_date' as field,
	'发货日期' as field_name,'发货日期' as title,
	70 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'cus_name' as field,
	'客户名称' as field_name,'客户名称' as title,
	80 as width,130 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'wh_code' as field,
	'仓库编码' as field_name,'仓库编码' as title,
	84 as width,140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'wh_name' as field,
	'仓库名称' as field_name,'仓库名称' as title,
	85 as width,150 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'i_code' as field,
	'存货编码' as field_name,'存货编码' as title,
	98 as width,140 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'i_name' as field,
	'存货名称' as field_name,'存货名称' as title,
	120 as width,150 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'standard' as field,
	'规格型号' as field_name,'规格型号' as title,
	120 as width,160 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'munit' as field,
	'单位' as field_name,'单位' as title,
	40 as width,161 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'aunit' as field,
	'辅计单位' as field_name,'辅计量单位' as title,
	60 as width,162 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'free1' as field,
	'自由项1' as field_name,'自由项1' as title,
	80 as width,170 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'free2' as field,
	'自由项2' as field_name,'自由项2' as title,
	80 as width,180 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'unit_price' as field,
	'无税单价' as field_name,'无税单价' as title,
	60 as width,190 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'tax_unit_price' as field,
	'含税单价' as field_name,'含税单价' as title,
	60 as width,200 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'quantity' as field,
	'数量' as field_name,'数量' as title,
	60 as width,210 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'acc_out_quantity' as field,
	'累出数量' as field_name,'累出数量' as title,
	60 as width,211 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'wait_out_quantity' as field,
	'待出数量' as field_name,'待出数量' as title,
	60 as width,212 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'num' as field,
	'件数' as field_name,'件数' as title,
	60 as width,214 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'acc_out_num' as field,
	'累出件数' as field_name,'累出件数' as title,
	60 as width,215 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'wait_out_num' as field,
	'待出件数' as field_name,'待出件数' as title,
	60 as width,216 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'convert_rate' as field,
	'换算率' as field_name,'换算率' as title,
	60 as width,230 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'total_price' as field,
	'无税金额' as field_name,'无税金额' as title,
	60 as width,240 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'tax_total_price' as field,
	'含税金额' as field_name,'含税金额' as title,
	60 as width,250 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'tax' as field,
	'税额' as field_name,'税额' as title,
	60 as width,280 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_tax_rate' as field,
	'税率' as field_name,'税率' as title,
	60 as width,340 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'nat_unit_price' as field,
	'本币单价' as field_name,'本币单价' as title,
	60 as width,360 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'nat_total_price' as field,
	'本币金额' as field_name,'本币金额' as title,
	60 as width,370 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'nat_tax_unit_price' as field,
	'本币含税单价' as field_name,'本币含税单价' as title,
	80 as width,380 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'nat_tax_total_price' as field,
	'本币含税金额' as field_name,'本币含税金额' as title,
	80 as width,390 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_DeliveryOrder_Details' as module,'nat_tax' as field,
	'本币税额' as field_name,'本币税额' as title,
	60 as width,400 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'delivery_date' as field,
	'预发货日期' as field_name,'预发货日期' as title,
	70 as width,500 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_remark' as field,
	'表体备注' as field_name,'表体备注' as title,
	100 as width,510 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'st_name' as field,
	'销售类型' as field_name,'销售类型' as title,
	60 as width,520 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'dep_name' as field,
	'销售部门' as field_name,'销售部门' as title,
	60 as width,530 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,color)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ele_name' as field,
	'业务员' as field_name,'业务员' as title,
	60 as width,535 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,'' as color;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'crc_name' as field,
	'币种' as field_name,'币种' as title,
	40 as width,540 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'exchange_rate' as field,
	'汇率' as field_name,'汇率' as title,
	40 as width,550 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'new_user' as field,
	'新增人' as field_name,'新增人' as title,
	50 as width,560 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'verify_user' as field,
	'审核人' as field_name,'审核人' as title,
	50 as width,570 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'remark' as field,
	'表头备注' as field_name,'表头备注' as title,
	100 as width,580 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_sdefine1' as field,
	'子表字符自定义项1' as field_name,'子表字符自定义项1' as title,
	120 as width,1010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_sdefine2' as field,
	'子表字符自定义项2' as field_name,'子表字符自定义项2' as title,
	60 as width,1020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_sdefine3' as field,
	'子表字符自定义项3' as field_name,'子表字符自定义项3' as title,
	60 as width,1030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_sdefine4' as field,
	'子表字符自定义项4' as field_name,'子表字符自定义项4' as title,
	60 as width,1040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_sdefine5' as field,
	'子表字符自定义项5' as field_name,'子表字符自定义项5' as title,
	60 as width,1050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_ndefine1' as field,
	'子表数值自定义项1' as field_name,'子表数值自定义项1' as title,
	60 as width,1110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_ndefine2' as field,
	'子表数值自定义项2' as field_name,'子表数值自定义项2' as title,
	60 as width,1120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_ndefine3' as field,
	'子表数值自定义项3' as field_name,'子表数值自定义项3' as title,
	60 as width,1130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_ndefine4' as field,
	'子表数值自定义项4' as field_name,'子表数值自定义项4' as title,
	60 as width,1140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_ndefine5' as field,
	'子表数值自定义项5' as field_name,'子表数值自定义项5' as title,
	60 as width,1150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'sdefine1' as field,
	'主表字符自定义项1' as field_name,'主表字符自定义项1' as title,
	120 as width,2010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'sdefine2' as field,
	'主表字符自定义项2' as field_name,'主表字符自定义项2' as title,
	60 as width,2020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'sdefine3' as field,
	'主表字符自定义项3' as field_name,'主表字符自定义项3' as title,
	60 as width,2030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'sdefine4' as field,
	'主表字符自定义项4' as field_name,'主表字符自定义项4' as title,
	60 as width,2040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'sdefine5' as field,
	'主表字符自定义项5' as field_name,'主表字符自定义项5' as title,
	60 as width,2050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ndefine1' as field,
	'主表数值自定义项1' as field_name,'主表数值自定义项1' as title,
	60 as width,2110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ndefine2' as field,
	'主表数值自定义项2' as field_name,'主表数值自定义项2' as title,
	60 as width,2120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ndefine3' as field,
	'主表数值自定义项3' as field_name,'主表数值自定义项3' as title,
	60 as width,2130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ndefine4' as field,
	'主表数值自定义项4' as field_name,'主表数值自定义项4' as title,
	60 as width,2140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ndefine5' as field,
	'主表数值自定义项5' as field_name,'主表数值自定义项5' as title,
	60 as width,2150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_sdefine1' as field,
	'存货字符自定义项1' as field_name,'存货字符自定义项1' as title,
	80 as width,3010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_sdefine2' as field,
	'存货字符自定义项2' as field_name,'存货字符自定义项2' as title,
	80 as width,3020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_sdefine3' as field,
	'存货字符自定义项3' as field_name,'存货字符自定义项3' as title,
	80 as width,3030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_sdefine4' as field,
	'存货字符自定义项4' as field_name,'存货字符自定义项4' as title,
	80 as width,3040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_sdefine5' as field,
	'存货字符自定义项5' as field_name,'存货字符自定义项5' as title,
	80 as width,3050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_ndefine1' as field,
	'存货数值自定义项1' as field_name,'存货数值自定义项1' as title,
	80 as width,3110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_ndefine2' as field,
	'存货数值自定义项2' as field_name,'存货数值自定义项2' as title,
	80 as width,3120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_ndefine3' as field,
	'存货数值自定义项3' as field_name,'存货数值自定义项3' as title,
	80 as width,3130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_ndefine4' as field,
	'存货数值自定义项4' as field_name,'存货数值自定义项4' as title,
	80 as width,3140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'d_inv_ndefine5' as field,
	'存货数值自定义项5' as field_name,'存货数值自定义项5' as title,
	80 as width,3150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;


end
/**/GO

--发货单明细表增加折扣相关列
if(select count(*) from System_ModuleFormat where module='Sale_Report_DeliveryOrder_Details' and field='quoted_price')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view,auth_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'quoted_price' as field,
	'报价' as field_name,'报价' as title,
	60 as width,410 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view,
	'' as auth_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view,auth_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'kl' as field,
	'折扣率%' as field_name,'折扣率%' as title,
	60 as width,412 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view,
	'' as auth_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view,auth_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'zk' as field,
	'折扣金额' as field_name,'折扣金额' as title,
	60 as width,414 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_DeliveryOrder_Details_ViewPrice' as auth_view,
	'' as auth_edit;
end
/**/GO

--delete System_ModuleFormat where module='Sale_Report_SalesOut_Details'
--插入[销售出库单明细表]报表界面格式
if(select count(1) from System_ModuleFormat where module='Sale_Report_SalesOut_Details' and field='ios_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ios_id' as field,
	'出库单子表ID' as field_name,'出库单子表ID' as title,
	60 as width,1 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'io_id' as field,
	'出库单主表ID' as field_name,'出库单主表ID' as title,
	60 as width,2 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'order_number' as field,
	'出库单号' as field_name,'出库单号' as title,
	120 as width,110 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'do_order_number' as field,
	'发货单号' as field_name,'发货单号' as title,
	100 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'so_order_number' as field,
	'订单号' as field_name,'订单号' as title,
	101 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'new_date' as field,
	'出库日期' as field_name,'出库日期' as title,
	70 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'cus_name' as field,
	'客户名称' as field_name,'客户名称' as title,
	98 as width,130 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'wh_id' as field,
	'仓库id' as field_name,'仓库id' as title,
	120 as width,140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'wh_code' as field,
	'仓库编码' as field_name,'仓库编码' as title,
	120 as width,150 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'wh_name' as field,
	'仓库名称' as field_name,'仓库名称' as title,
	120 as width,160 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'i_code' as field,
	'存货编码' as field_name,'存货编码' as title,
	98 as width,160 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'i_name' as field,
	'存货名称' as field_name,'存货名称' as title,
	120 as width,170 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'standard' as field,
	'规格型号' as field_name,'规格型号' as title,
	120 as width,180 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'munit' as field,
	'单位' as field_name,'单位' as title,
	40 as width,190 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'aunit' as field,
	'辅计单位' as field_name,'辅计量单位' as title,
	60 as width,200 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'free1' as field,
	'自由项1' as field_name,'自由项1' as title,
	80 as width,210 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'free2' as field,
	'自由项2' as field_name,'自由项2' as title,
	80 as width,220 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOut_Details' as module,'unit_price' as field,
	'本币无税单价' as field_name,'无税单价' as title,
	60 as width,230 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOut_Details_ViewPrice' as auth_view;
	/*
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOut_Details' as module,'tax_unit_price' as field,
	'本币含税单价' as field_name,'含税单价' as title,
	60 as width,240 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOut_Details_ViewPrice' as auth_view;
	*/
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'quantity' as field,
	'数量' as field_name,'数量' as title,
	60 as width,250 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'num' as field,
	'件数' as field_name,'件数' as title,
	60 as width,260 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'convert_rate' as field,
	'换算率' as field_name,'换算率' as title,
	60 as width,270 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOut_Details' as module,'total_price' as field,
	'本币无税金额' as field_name,'无税金额' as title,
	60 as width,280 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOut_Details_ViewPrice' as auth_view;
	/*
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOut_Details' as module,'tax_total_price' as field,
	'本币含税金额' as field_name,'含税金额' as title,
	60 as width,290 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOut_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_SalesOut_Details' as module,'tax' as field,
	'本币税额' as field_name,'税额' as title,
	60 as width,300 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_SalesOut_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_tax_rate' as field,
	'税率' as field_name,'税率' as title,
	60 as width,310 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	*/
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_remark' as field,
	'表体备注' as field_name,'表体备注' as title,
	100 as width,320 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'st_name' as field,
	'发货类型' as field_name,'发货类型' as title,
	60 as width,330 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'iot_name' as field,
	'收发类型' as field_name,'收发类型' as title,
	60 as width,340 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'dep_name' as field,
	'发货部门' as field_name,'发货部门' as title,
	60 as width,350 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,color)
	select 'Sale_Report_SalesOut_Details' as module,'ele_name' as field,
	'业务员' as field_name,'业务员' as title,
	60 as width,360 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,'' as color;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'new_user' as field,
	'新增人' as field_name,'新增人' as title,
	50 as width,410 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'verify_user' as field,
	'审核人' as field_name,'审核人' as title,
	50 as width,420 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'remark' as field,
	'表头备注' as field_name,'表头备注' as title,
	100 as width,430 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_sdefine1' as field,
	'子表字符自定义项1' as field_name,'子表字符自定义项1' as title,
	120 as width,1010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_sdefine2' as field,
	'子表字符自定义项2' as field_name,'子表字符自定义项2' as title,
	60 as width,1020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_sdefine3' as field,
	'子表字符自定义项3' as field_name,'子表字符自定义项3' as title,
	60 as width,1030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_sdefine4' as field,
	'子表字符自定义项4' as field_name,'子表字符自定义项4' as title,
	60 as width,1040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_sdefine5' as field,
	'子表字符自定义项5' as field_name,'子表字符自定义项5' as title,
	60 as width,1050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_ndefine1' as field,
	'子表数值自定义项1' as field_name,'子表数值自定义项1' as title,
	60 as width,1110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_ndefine2' as field,
	'子表数值自定义项2' as field_name,'子表数值自定义项2' as title,
	60 as width,1120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_ndefine3' as field,
	'子表数值自定义项3' as field_name,'子表数值自定义项3' as title,
	60 as width,1130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_ndefine4' as field,
	'子表数值自定义项4' as field_name,'子表数值自定义项4' as title,
	60 as width,1140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_ndefine5' as field,
	'子表数值自定义项5' as field_name,'子表数值自定义项5' as title,
	60 as width,1150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'sdefine1' as field,
	'主表字符自定义项1' as field_name,'主表字符自定义项1' as title,
	120 as width,2010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'sdefine2' as field,
	'主表字符自定义项2' as field_name,'主表字符自定义项2' as title,
	60 as width,2020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'sdefine3' as field,
	'主表字符自定义项3' as field_name,'主表字符自定义项3' as title,
	60 as width,2030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'sdefine4' as field,
	'主表字符自定义项4' as field_name,'主表字符自定义项4' as title,
	60 as width,2040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'sdefine5' as field,
	'主表字符自定义项5' as field_name,'主表字符自定义项5' as title,
	60 as width,2050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ndefine1' as field,
	'主表数值自定义项1' as field_name,'主表数值自定义项1' as title,
	60 as width,2110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ndefine2' as field,
	'主表数值自定义项2' as field_name,'主表数值自定义项2' as title,
	60 as width,2120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ndefine3' as field,
	'主表数值自定义项3' as field_name,'主表数值自定义项3' as title,
	60 as width,2130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ndefine4' as field,
	'主表数值自定义项4' as field_name,'主表数值自定义项4' as title,
	60 as width,2140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'ndefine5' as field,
	'主表数值自定义项5' as field_name,'主表数值自定义项5' as title,
	60 as width,2150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_sdefine1' as field,
	'存货字符自定义项1' as field_name,'存货字符自定义项1' as title,
	80 as width,3010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_sdefine2' as field,
	'存货字符自定义项2' as field_name,'存货字符自定义项2' as title,
	80 as width,3020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_sdefine3' as field,
	'存货字符自定义项3' as field_name,'存货字符自定义项3' as title,
	80 as width,3030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_sdefine4' as field,
	'存货字符自定义项4' as field_name,'存货字符自定义项4' as title,
	80 as width,3040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_sdefine5' as field,
	'存货字符自定义项5' as field_name,'存货字符自定义项5' as title,
	80 as width,3050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_ndefine1' as field,
	'存货数值自定义项1' as field_name,'存货数值自定义项1' as title,
	80 as width,3110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_ndefine2' as field,
	'存货数值自定义项2' as field_name,'存货数值自定义项2' as title,
	80 as width,3120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_ndefine3' as field,
	'存货数值自定义项3' as field_name,'存货数值自定义项3' as title,
	80 as width,3130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_ndefine4' as field,
	'存货数值自定义项4' as field_name,'存货数值自定义项4' as title,
	80 as width,3140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOut_Details' as module,'d_inv_ndefine5' as field,
	'存货数值自定义项5' as field_name,'存货数值自定义项5' as title,
	80 as width,3150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

end
/**/GO


--delete System_ModuleFormat where module='Sale_Report_CheckAccount_Details'
--插入[销售对账单明细表]报表界面格式
if(select count(1) from System_ModuleFormat where module='Sale_Report_CheckAccount_Details' and field='cas_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'cas_id' as field,
	'对账单子表ID' as field_name,'对账单子表ID' as title,
	60 as width,1 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ca_id' as field,
	'对账单主表ID' as field_name,'对账单主表ID' as title,
	60 as width,2 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'order_number' as field,
	'对账单号' as field_name,'对账单号' as title,
	120 as width,110 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'so_order_number' as field,
	'订单号' as field_name,'订单号' as title,
	100 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'new_date' as field,
	'对账日期' as field_name,'对账日期' as title,
	70 as width,120 as sort,1 as show,0 as hidden,0 as sum_field,'date' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'cus_name' as field,
	'客户名称' as field_name,'客户名称' as title,
	80 as width,130 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'i_code' as field,
	'存货编码' as field_name,'存货编码' as title,
	98 as width,140 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'i_name' as field,
	'存货名称' as field_name,'存货名称' as title,
	120 as width,150 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'standard' as field,
	'规格型号' as field_name,'规格型号' as title,
	120 as width,160 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'munit' as field,
	'单位' as field_name,'单位' as title,
	40 as width,161 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'aunit' as field,
	'辅计单位' as field_name,'辅计量单位' as title,
	60 as width,162 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'free1' as field,
	'自由项1' as field_name,'自由项1' as title,
	80 as width,170 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'free2' as field,
	'自由项2' as field_name,'自由项2' as title,
	80 as width,180 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'unit_price' as field,
	'无税单价' as field_name,'无税单价' as title,
	60 as width,190 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'tax_unit_price' as field,
	'含税单价' as field_name,'含税单价' as title,
	60 as width,200 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'quantity' as field,
	'数量' as field_name,'数量' as title,
	60 as width,210 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'num' as field,
	'件数' as field_name,'件数' as title,
	60 as width,214 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'convert_rate' as field,
	'换算率' as field_name,'换算率' as title,
	60 as width,230 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'total_price' as field,
	'无税金额' as field_name,'无税金额' as title,
	60 as width,240 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'tax_total_price' as field,
	'含税金额' as field_name,'含税金额' as title,
	60 as width,250 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'tax' as field,
	'税额' as field_name,'税额' as title,
	60 as width,280 as sort,1 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'nat_unit_price' as field,
	'本币单价' as field_name,'本币单价' as title,
	60 as width,360 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'nat_total_price' as field,
	'本币金额' as field_name,'本币金额' as title,
	60 as width,370 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'nat_tax_unit_price' as field,
	'本币含税单价' as field_name,'本币含税单价' as title,
	60 as width,380 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'nat_tax_total_price' as field,
	'本币含税金额' as field_name,'本币含税金额' as title,
	60 as width,390 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit,auth_view)
	select 'Sale_Report_CheckAccount_Details' as module,'nat_tax' as field,
	'本币税额' as field_name,'本币税额' as title,
	60 as width,400 as sort,0 as show,0 as hidden,1 as sum_field,'text' as type,1 as can_edit,
	'Sale_Report_CheckAccount_Details_ViewPrice' as auth_view;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_tax_rate' as field,
	'税率' as field_name,'税率' as title,
	60 as width,340 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_remark' as field,
	'表体备注' as field_name,'表体备注' as title,
	100 as width,360 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'dep_name' as field,
	'部门' as field_name,'部门' as title,
	60 as width,380 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
		
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'crc_name' as field,
	'币种' as field_name,'币种' as title,
	40 as width,390 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'exchange_rate' as field,
	'汇率' as field_name,'汇率' as title,
	40 as width,400 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;


	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'do_order_number' as field,
	'发货单号' as field_name,'发货单号' as title,
	100 as width,410 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'io_order_number' as field,
	'出库单号' as field_name,'出库单号' as title,
	100 as width,420 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'wh_name' as field,
	'仓库名称' as field_name,'仓库名称' as title,
	85 as width,460 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'new_user' as field,
	'新增人' as field_name,'新增人' as title,
	50 as width,450 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'verify_user' as field,
	'审核人' as field_name,'审核人' as title,
	50 as width,460 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'remark' as field,
	'表头备注' as field_name,'表头备注' as title,
	100 as width,470 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_sdefine1' as field,
	'子表字符自定义项1' as field_name,'子表字符自定义项1' as title,
	120 as width,1010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_sdefine2' as field,
	'子表字符自定义项2' as field_name,'子表字符自定义项2' as title,
	60 as width,1020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_sdefine3' as field,
	'子表字符自定义项3' as field_name,'子表字符自定义项3' as title,
	60 as width,1030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_sdefine4' as field,
	'子表字符自定义项4' as field_name,'子表字符自定义项4' as title,
	60 as width,1040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_sdefine5' as field,
	'子表字符自定义项5' as field_name,'子表字符自定义项5' as title,
	60 as width,1050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_ndefine1' as field,
	'子表数值自定义项1' as field_name,'子表数值自定义项1' as title,
	60 as width,1110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_ndefine2' as field,
	'子表数值自定义项2' as field_name,'子表数值自定义项2' as title,
	60 as width,1120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_ndefine3' as field,
	'子表数值自定义项3' as field_name,'子表数值自定义项3' as title,
	60 as width,1130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_ndefine4' as field,
	'子表数值自定义项4' as field_name,'子表数值自定义项4' as title,
	60 as width,1140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_ndefine5' as field,
	'子表数值自定义项5' as field_name,'子表数值自定义项5' as title,
	60 as width,1150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'sdefine1' as field,
	'主表字符自定义项1' as field_name,'主表字符自定义项1' as title,
	120 as width,2010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'sdefine2' as field,
	'主表字符自定义项2' as field_name,'主表字符自定义项2' as title,
	60 as width,2020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'sdefine3' as field,
	'主表字符自定义项3' as field_name,'主表字符自定义项3' as title,
	60 as width,2030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'sdefine4' as field,
	'主表字符自定义项4' as field_name,'主表字符自定义项4' as title,
	60 as width,2040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'sdefine5' as field,
	'主表字符自定义项5' as field_name,'主表字符自定义项5' as title,
	60 as width,2050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ndefine1' as field,
	'主表数值自定义项1' as field_name,'主表数值自定义项1' as title,
	60 as width,2110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ndefine2' as field,
	'主表数值自定义项2' as field_name,'主表数值自定义项2' as title,
	60 as width,2120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ndefine3' as field,
	'主表数值自定义项3' as field_name,'主表数值自定义项3' as title,
	60 as width,2130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ndefine4' as field,
	'主表数值自定义项4' as field_name,'主表数值自定义项4' as title,
	60 as width,2140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'ndefine5' as field,
	'主表数值自定义项5' as field_name,'主表数值自定义项5' as title,
	60 as width,2150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_sdefine1' as field,
	'存货字符自定义项1' as field_name,'存货字符自定义项1' as title,
	80 as width,3010 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_sdefine2' as field,
	'存货字符自定义项2' as field_name,'存货字符自定义项2' as title,
	80 as width,3020 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_sdefine3' as field,
	'存货字符自定义项3' as field_name,'存货字符自定义项3' as title,
	80 as width,3030 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_sdefine4' as field,
	'存货字符自定义项4' as field_name,'存货字符自定义项4' as title,
	80 as width,3040 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_sdefine5' as field,
	'存货字符自定义项5' as field_name,'存货字符自定义项5' as title,
	80 as width,3050 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_ndefine1' as field,
	'存货数值自定义项1' as field_name,'存货数值自定义项1' as title,
	80 as width,3110 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_ndefine2' as field,
	'存货数值自定义项2' as field_name,'存货数值自定义项2' as title,
	80 as width,3120 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_ndefine3' as field,
	'存货数值自定义项3' as field_name,'存货数值自定义项3' as title,
	80 as width,3130 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_ndefine4' as field,
	'存货数值自定义项4' as field_name,'存货数值自定义项4' as title,
	80 as width,3140 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_CheckAccount_Details' as module,'d_inv_ndefine5' as field,
	'存货数值自定义项5' as field_name,'存货数值自定义项5' as title,
	80 as width,3150 as sort,0 as show,0 as hidden,0 as sum_field,'text' as type,0 as can_edit;
end
/**/GO

--插入[销售订单明细表]增加客户信息字段
if(select count(1) from System_ModuleFormat where module='Sale_Report_SalesOrder_Details' and field='contact')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'contact' as field,
	'联系人' as field_name,'联系人' as title,
	40 as width,510 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'phone' as field,
	'电话' as field_name,'电话' as title,
	90 as width,520 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_SalesOrder_Details' as module,'ship_address' as field,
	'发货地址' as field_name,'发货地址' as title,
	150 as width,530 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
end
/**/GO

--插入[发货单明细表]增加客户信息字段
if(select count(1) from System_ModuleFormat where module='Sale_Report_DeliveryOrder_Details' and field='contact')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'contact' as field,
	'联系人' as field_name,'联系人' as title,
	40 as width,600 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'phone' as field,
	'电话' as field_name,'电话' as title,
	90 as width,610 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field,type,can_edit)
	select 'Sale_Report_DeliveryOrder_Details' as module,'ship_address' as field,
	'发货地址' as field_name,'发货地址' as title,
	150 as width,620 as sort,1 as show,0 as hidden,0 as sum_field,'text' as type,1 as can_edit;
end
/**/GO
