/**
* @author : qianming
* @date   : 2015/7/1
* @desc   : 北京国资租赁-财务系统接口-凭证数据接口
* */
function transfer_to_u8() {
	var need_transfer_datas = $ctx.get('/model/need_transfer_datas').getChildren();
	for(var i=0;i<need_transfer_datas.length;i++){
		$bm('inf.INF103.journal_generate_and_lock').execute( {
			journal_header_id:need_transfer_datas[i].journal_header_id
		});
		var result = $bm('inf.INF103.journals_interface_need_transfer').queryAsMap({
			journal_num: need_transfer_datas[i].journal_num
	    }).getChildren();
		for(var j=0;j<result.length;j++){
			$bm('inf.INF103.journal_transfer').insert({
				csign:	    result[j].csign,
				cbill: 		result[j].cbill, 
				ccode: 		result[j].ccode, 
				ccus_id: 	result[j].ccus_id, 
				cdept_id: 	result[j].cdept_id, 
				cdigest: 	result[j].cdigest, 
				cexch_name: result[j].cexch_name, 
				cperson_id: result[j].cperson_id, 
				csup_id: 	result[j].csup_id, 
				dbill_date: result[j].dbill_date, 
				inid: 		result[j].inid, 
				ino_id: 	result[j].ino_id, 
				iperiod: 	result[j].iperiod, 
				mc: 		result[j].mc, 
				mc_f: 		result[j].mc_f, 
				md: 		result[j].md, 
				md_f: 		result[j].md_f,
				nc_s: 		result[j].nc_s, 
				nd_s: 		result[j].nd_s, 
				nfrat: 		result[j].nfrat, 
				dt_date:	result[j].dt_date, 
				cn_id:		result[j].cn_id, 
				csettle:	result[j].csettle, 
				cname:		result[j].cname, 
				cdefine10: 	result[j].cdefine10, 
				cdefine11: 	result[j].cdefine11,
				cdefine12: 	result[j].cdefine12, 
				cdefine13: 	result[j].cdefine13,
				cdefine14: 	result[j].cdefine14,
				status:		result[j].status,
				ref_ino_id:	result[j].ref_ino_id
			});
		}
	}
}
function refresh_from_u8(){
	var need_refresh_datas = $ctx.get('/model/need_refresh_datas').getChildren();
	for(var i=0;i<need_refresh_datas.length;i++){
		var result = $bm('inf.INF103.get_u8_interface_datas').queryAsMap({
			journal_num: need_refresh_datas[i].journal_num
	    }).getChildren();
		for(var j=0;j<result.length;j++){
			$bm('inf.INF103.bgfl_yongyou_journals_refresh').execute({
				ino_id:	   	   result[j].ino_id,
				inid:		   result[j].inid,
				import_flag:   result[j].import_flag,
				error_message: result[j].error_message
			});
		}
		$bm('inf.INF103.post_journal_header').execute({
			journal_num: need_refresh_datas[i].journal_num,
			u8ino_id:    result[0].u8ino_id
		});
	}
}
function refresh_basic_data_u8(){
	var need_refresh_datas = $ctx.get('/model/need_refresh_datas').getChildren();
	for(var i=0;i<need_refresh_datas.length;i++){
		var result = $bm('inf.INF102.bgfl_yongyou_basic_data_for_refresh').queryAsMap({
			data_id: need_refresh_datas[i].data_id
	    }).getChildren();
		for(var j=0;j<result.length;j++){
			$bm('inf.INF102.bgfl_yongyou_basic_data_refresh').execute({
				data_id	   :   result[j].data_id,
				import_flag:   result[j].import_flag,
				error_message: result[j].error_message
			});
		}
	}
}