dst.defineClass("com.dst.slms.contractmange.paymentreq.paymentReqEdit", dst.framework.coreBillBaseEdit, {
	initalizeDOM:function(){
		com.dst.slms.contractmange.paymentreq.paymentReqEdit.superClass.initalizeDOM.call(this);
		
		$('#taxReqAmt').numberbox({    
		    onChange:function(newValue,oldValue){
		    	var rateId = $('#taxRate').textbox('getBizValue').id;
				var taxReqAmt = newValue;      // 预算金额
				dst.remoteCall({
					method : "getAmt",
					async:false,  
					url: "paymentReqController",
					param : {rateId:rateId,taxReqAmt:taxReqAmt},
					success : function(data, textStatus) {
						if(!jQuery.isEmptyObject(data)){
							$("#noTaxReqAmt").numberspinner("setValue",data.noTaxReqAmt);
							$("#taxAmt").numberspinner("setValue",data.taxAmt);
						}else{
							$("#noTaxReqAmt").numberspinner("setValue","");
							$("#taxAmt").numberspinner("setValue","");
						}
					}
				});
		    } 
		});  
	},
	
	contract_Change:function(newValue,oldValue){
		var contractId = $('#contract').textbox('getBizValue').id;
		dst.remoteCall({
			method : "getOrg",
			async:false,  
			url: this.uipk,
			param : {contractId:contractId},
			success : function(data, textStatus) {
				if(!jQuery.isEmptyObject(data)){
					$("#orgunit").textbox("setBizValue",data.admin);
					$("#project").textbox("setBizValue",data.project);
				}else{
					$("#orgunit").textbox("setBizValue","");
					$("#project").textbox("setBizValue","");
				}
			}
		});
	},
	
	rate_Change:function(newValue,oldValue){
		var rateId = $('#taxRate').textbox('getBizValue').id;
		var taxReqAmt = $('#taxReqAmt').numberspinner('getValue');      // 预算金额
		dst.remoteCall({
			method : "getAmt",
			async:false,  
			url: "paymentReqController",
			param : {rateId:rateId,taxReqAmt:taxReqAmt},
			success : function(data, textStatus) {
				if(!jQuery.isEmptyObject(data)){
					$("#noTaxReqAmt").numberspinner("setValue",data.noTaxReqAmt);
					$("#taxAmt").numberspinner("setValue",data.taxAmt);
				}else{
					$("#noTaxReqAmt").numberspinner("setValue","");
					$("#taxAmt").numberspinner("setValue","");
				}
			}
		});
	},
	
	entry_change:function(datagridTarget,target,index,field,newValue,oldValue){
		//获取编辑行数据
		var v = {};
		if(field=='noTaxConAmt'||field=='taxRate'){
			var rows = datagridTarget.datagrid('getRows');
			var dxrow = rows[index];
			dxrow[field]=newValue;
			debugger;
			var dxtnoTaxConAmt =dxrow["noTaxConAmt"]==undefined?0:dxrow["noTaxConAmt"];
			var dxtax = dxrow["taxRate"]==undefined?0:dxrow["taxRate"].taxRate;
			var taxConAmt= Number(dxtnoTaxConAmt)*(Number(1)+(Number(dxtax)/Number(100)));
			v["taxConAmt"]= taxConAmt;
			v["taxAmt"]=Number(taxConAmt)-Number(dxtnoTaxConAmt);
			//更新行数据
			datagridTarget.datagrid("updateRow",{index:index,row:v});
			
		}

	},
});