

/*-- ------ #PFinancing ------ --*/
function PFinancing(){}
//-- #Parameters --
//#Name
PFinancing.prototype.sAjax_0=new netsSingleAjax();
PFinancing.prototype.sNavigationIndex=0;
PFinancing.prototype.sNavigationCount=6;

PFinancing.prototype.sRunningAccount_Mainbox="RunningAccount_Mainbox";

PFinancing.prototype.sRowTemplateURL="Plus/Common/PFinancing/Data_Funds_RowTemplate.php";
PFinancing.prototype.sOptionsURL="Plus/Common/PFinancing/Data_Funds_Options.php";


PFinancing.prototype.sRunningAccount_DefaultTitleSTR="在这里输入标题";
PFinancing.prototype.sRunningAccount_DefaultOutAmountSTR="收入金额";
PFinancing.prototype.sRunningAccount_DefaultInAmountSTR="支出金额";

//-- #Methods --
//#RunningAccount

PFinancing.prototype.RunningAccount_NewRow=function(pIndex){
	var tmpCount=document.getElementById(this.sRunningAccount_Mainbox).rows.length;
	
	tmpURL=tmpCommon.sysRoot+this.sRowTemplateURL+"?ActionType=DRowTemplate&DRowTemplate="+tmpCount;
	this.sAjax_0.sFlag="Data";
	this.sAjax_0.sPanel="Data";
	this.sAjax_0.sURL=tmpURL;
	this.sAjax_0.sendRequestSp(tmpURL,"RunningAccount_NewRow_Callback();");
	//window.open(tmpURL,"_blank");

	return 0;
}
function RunningAccount_NewRow_Callback(){
	var tmpFlag=tmpPFinancing.sAjax_0.sFlag;
	var tmpPanel=document.getElementById(tmpPFinancing.sAjax_0.sPanel);
	var tmpURL=tmpPFinancing.sAjax_0.sURL;
	var tmpHttpRequests=tmpPFinancing.sAjax_0.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpAR0=tmpData.split(tmpCommon.sysSPLIT7);
			if(tmpAR0.length!=10){
				tmpFrames.showMessage("系统消息","加载新行出错，请稍后再试...","",0);
				return 1;
			}
			tmpElement=document.getElementById(tmpPFinancing.sRunningAccount_Mainbox);

			tmpElement.insertRow(3);
			tmpElement.rows[0].id="RunningAccountRow_"+tmpAR0[8];
			tmpElement.rows[0].className="pfina_RA_1_10";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[0].innerHTML=tmpAR0[0];
			tmpElement.rows[0].cells[0].className="pfina_RA_1_11";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[1].innerHTML=tmpAR0[1];
			tmpElement.rows[0].cells[1].className="pfina_RA_1_12";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[2].innerHTML=tmpAR0[2];
			tmpElement.rows[0].cells[2].className="pfina_RA_1_13";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[3].innerHTML=tmpAR0[3];
			tmpElement.rows[0].cells[3].className="pfina_RA_1_5";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[4].innerHTML=tmpAR0[4];
			tmpElement.rows[0].cells[4].className="pfina_RA_1_6";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[5].innerHTML=tmpAR0[5];
			tmpElement.rows[0].cells[5].className="pfina_RA_1_7";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[6].innerHTML=tmpAR0[6];
			tmpElement.rows[0].cells[6].className="pfina_RA_1_8";
			tmpElement.rows[0].insertCell();
			tmpElement.rows[0].cells[7].innerHTML=tmpAR0[7];
			tmpElement.rows[0].cells[7].className="pfina_RA_1_9";


	    	tmpFrames.showLoading(1);
	    }else{
	    	tmpFrames.showLoading(1);
	    }
	}else{
		tmpFrames.showLoading(0);
	}
}

PFinancing.prototype.RunningAccount_NewRowSave=function(pIndex){
	
	var tmpURL=tmpCommon.sysPage+"?ActionType=DAdd_Get&DAdd_Get="+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_TitleTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_ParidTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_ZoneTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_ZoneTxt_Zoneid").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_ZoneTxt_Sortunitid").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_ZoneTxt_Unitname").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_InProjectTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_InAmountTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_OutProjectTxt").value)+tmpCommon.sysSPLIT1+
		tmpCommon.encodeURL(document.getElementById("RunningAccountRow_"+pIndex+"_OutAmountTxt").value)+tmpCommon.sysSPLIT1+
		pIndex;
	this.sAjax_0.sFlag="Message";
	this.sAjax_0.sPanel="Message";
	this.sAjax_0.sURL=tmpURL;
	this.sAjax_0.sendRequestSp(tmpURL,"RunningAccount_NewRowSave_Callback();");
	//window.open(tmpURL,"_blank");
	tmpFrames.showMessage("系统消息","正在为您保存数据，请稍等...","",0);
	
	return 0;
}
function RunningAccount_NewRowSave_Callback(){
	var tmpFlag=tmpPFinancing.sAjax_0.sFlag;
	var tmpPanel=document.getElementById(tmpPFinancing.sAjax_0.sPanel);
	var tmpURL=tmpPFinancing.sAjax_0.sURL;
	var tmpHttpRequests=tmpPFinancing.sAjax_0.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			var tmpAR0=tmpData.replace(/\<!--sendRequest-->/g,"").split(tmpCommon.sysSPLIT1);
			if(tmpAR0.length==3){
				tmpFrames.showMessage("系统消息",tmpAR0[0],"",0);
				document.getElementById(tmpPFinancing.sRunningAccount_Mainbox).deleteRow(1);
				
			}
	    	tmpFrames.showLoading(1);
	    }else{
	    	tmpFrames.showLoading(1);
	    }
	}else{
		tmpFrames.showLoading(0);
	}
}
PFinancing.prototype.RunningAccount_AddShowDetail=function(pIndex){

	return 0;
}

PFinancing.prototype.RunningAccount_GetRow=function(pIndex){

	return 0;
}

PFinancing.prototype.RunningAccount_EditRow=function(pIndex){

	return 0;
}
PFinancing.prototype.RunningAccount_ModifyRow=function(pIndex){

	return 0;
}
PFinancing.prototype.RunningAccount_DeleteRow=function(pIndex){

	return 0;
}
PFinancing.prototype.RunningAccount_EditShowDetail=function(pIndex){

	return 0;
}


PFinancing.prototype.RunningAccount_TitileFocus=function(pControl){
	pControl.className="pfina_RA_Title_Light";
	if(this.sRunningAccount_DefaultTitleSTR==pControl.value){
		pControl.value="";
	}
	
	return 0;
}
PFinancing.prototype.RunningAccount_TitileBlur=function(pControl){
	pControl.className="pfina_RA_Title";
	if(pControl.value==""){
		pControl.value=this.sRunningAccount_DefaultTitleSTR;
	}
	
	return 0;
}
PFinancing.prototype.RunningAccount_AmountFocus=function(pControl,pType){
	var tmpDetaultSTR="";
	if(pType==0){
		tmpDetaultSTR=this.sRunningAccount_DefaultOutAmountSTR;
	}else{
		tmpDetaultSTR=this.sRunningAccount_DefaultInAmountSTR;
	}
	pControl.className="pfina_RA_Amount_Light";
	if(tmpDetaultSTR==pControl.value){
		pControl.value="";
	}
	
	return 0;
}
PFinancing.prototype.RunningAccount_AmountBlur=function(pControl,pType){
	if(pType==0){
		tmpDetaultSTR=this.sRunningAccount_DefaultOutAmountSTR;
	}else{
		tmpDetaultSTR=this.sRunningAccount_DefaultInAmountSTR;
	}
	pControl.className="pfina_RA_Amount";
	if(pControl.value==""){
		pControl.value=tmpDetaultSTR;
	}
	
	return 0;
}
PFinancing.prototype.RunningAccount_BoxShow=function(pIndex,pName,pType){
	document.getElementById("RunningAccountRow_"+pIndex+"_ParidTitleBox").className="pfina_RA_Choose";
	document.getElementById("RunningAccountRow_"+pIndex+"_ParidBox").className=tmpCommon.sysHidden;
	document.getElementById("RunningAccountRow_"+pIndex+"_ParidBox").innerHTML="";
	
	document.getElementById("RunningAccountRow_"+pIndex+"_ZoneTitleBox").className="pfina_RA_Choose";
	document.getElementById("RunningAccountRow_"+pIndex+"_ZoneBox").className=tmpCommon.sysHidden;
	document.getElementById("RunningAccountRow_"+pIndex+"_ZoneBox").innerHTML="";
	
	document.getElementById("RunningAccountRow_"+pIndex+"_InProjectTitleBox").className="pfina_RA_Choose";
	document.getElementById("RunningAccountRow_"+pIndex+"_InProjectBox").className=tmpCommon.sysHidden;
	document.getElementById("RunningAccountRow_"+pIndex+"_InProjectBox").innerHTML="";
	
	document.getElementById("RunningAccountRow_"+pIndex+"_OutProjectTitleBox").className="pfina_RA_Choose";
	document.getElementById("RunningAccountRow_"+pIndex+"_OutProjectBox").className=tmpCommon.sysHidden;
	document.getElementById("RunningAccountRow_"+pIndex+"_OutProjectBox").innerHTML="";

	if(pType==1){
		return 0;
	}
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"TitleBox").className="pfina_RA_Choose_Light";
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Box").className="pfina_RA_Choose_Box";
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Box").innerHTML="";
	
	
	tmpURL=tmpCommon.sysRoot+this.sOptionsURL+"?ActionType=D"+pName+
		"&D"+pName+"="+pName+tmpCommon.sysSPLIT1+pIndex;
	this.sAjax_0.sFlag="Data";
	this.sAjax_0.sPanel="RunningAccountRow_"+pIndex+"_"+pName+"Box";
	this.sAjax_0.sURL=tmpURL;
	this.sAjax_0.sendRequestSp(tmpURL,"RunningAccount_BoxShow_Callback();");
	//window.open(tmpURL,"_blank");
	
	
	return 0;
}
function RunningAccount_BoxShow_Callback(){
	var tmpFlag=tmpPFinancing.sAjax_0.sFlag;
	var tmpPanel=document.getElementById(tmpPFinancing.sAjax_0.sPanel);
	var tmpURL=tmpPFinancing.sAjax_0.sURL;
	var tmpHttpRequests=tmpPFinancing.sAjax_0.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpPanel.innerHTML=tmpData;
	    	tmpFrames.showLoading(1);
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    	tmpFrames.showLoading(1);
	    }
	}else{
		tmpFrames.showLoading(0);
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}
PFinancing.prototype.RunningAccount_OptionChoose=function(pIndex,pName,pText,pValue){
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Title").innerHTML=pText;
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Txt").value=pValue;
	
}
PFinancing.prototype.RunningAccount_ZoneChoose=function(pIndex,pName,pText,pValue){
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Title").innerHTML=pText;
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Txt_Zoneid").value=pValue;
	
}
PFinancing.prototype.RunningAccount_SortunitChoose=function(pIndex,pName,pText,pValue){
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Title").innerHTML=pText;
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Txt_Sortunitid").value=pValue;
	
}
PFinancing.prototype.RunningAccount_SortunitSubmit=function(pIndex,pName,pText){
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Title").innerHTML=pText;
	document.getElementById("RunningAccountRow_"+pIndex+"_"+pName+"Txt_Unitname").value=pText;
	
}

/*-- ------ #Left menu ------ --*/
function showMenu(pIndex){
	var tmpElement=document.getElementById("childMenu_"+pIndex);
	if(tmpElement.className=="DHidden"){
		tmpElement.className="";
	}else if(tmpElement.className==""){
		tmpElement.className="DHidden";
	}
}
