
Runner.pages.PageSettings.addPageEvent('details',Runner.pages.constants.PAGE_LIST,"afterPageReady",function(pageObj,proxy,pageid,inlineRow,inlineObject,row){$strWhereClause=whereAdd($strWhereClause,"branch_code ='".$_SESSION["CUSTOM_BRANCH"]."'");;});Runner.pages.fieldsEvents["quntity_event"]=function(pageObj,pageid,row){if(row){row=new Runner.AjaxRow(pageObj,row);}
var ret,reqParams,ctrl=this,fieldsData={},params={},ajax=new Runner.form.Button({id:'quntity_event',btnName:'quntity_event'}),before=function(){var ctrlquantity=ctrl.getPeer('quntity');var ctrlprice=ctrl.getPeer('price');var ctrlsub_total=ctrl.getPeer('sub_total');ctrlsub_total.setValue((+ctrlquantity.getValue())*((+ctrlprice.getValue())));var tt=0;$("tr[id*=gridRow]").each(function(){var id=$(this).attr('id');id=id.substring(7);t=+($("#value_sub_total_"+id).val());if(t>0)tt+=t;});$("#value_tt_1").val(tt);return false;},after=function(result){},submit=function(){params["table"]="details";params["field"]=ctrl.fieldName;(Runner.controls.ControlStorage.byId(pageid)||[]).forEach(function(ctrl){if(!(ctrl instanceof Runner.controls.MultiUploadField)&&!(ctrl instanceof Runner.controls.FileControl)){fieldsData[ctrl.fieldName]=ctrl.getStringValue();}});reqParams={params:JSON.stringify(params),event:"quntity_event",pageType:pageObj.pageType,keys:JSON.stringify(pageObj.keys?pageObj.keys:(row&&row.getKeys())),masterTable:pageObj.masterTable,fieldsData:JSON.stringify(fieldsData)};$.post(Runner.getPageUrl("buttonhandler"),reqParams,function(result){var _result;try{_result=JSON.parse(result);}catch(e){Runner.displayGenericAjaxError(result);}
after.call(ctrl,_result);}).fail(function(jqXHR,textStatus,errorThrown){Runner.displayGenericAjaxError(jqXHR.responseText||textStatus+' '+errorThrown);});submit=function(){};};ajax.submitHandler=submit;ajax.submit=submit;ret=before.call(this);if(ret===false){return;}
submit();};