
var pType=Runner.pages.constants.PAGE_ADD;Runner.pages.PageSettings.addPageEvent("inf_gastos",pType,"afterPageReady",function(pageObj,proxy,pageid,inlineRow,inlineObject){var limpiar=function(v){if(!v)return 0;return parseInt(v.toString().replace(/\./g,"").replace(/\D/g,""))||0;};var fMil=function(n){return n.toString().replace(/\D/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,".");};setInterval(function(){var totalGasto=0;$("[id^='value_importe_']").each(function(){totalGasto+=limpiar($(this).val());});var $totalField=$("#value_total_1");if($totalField.length&&$totalField.val()!==fMil(totalGasto)){$totalField.val(fMil(totalGasto));}},500);$(document).on('keyup',"[id^='value_importe_']",function(){var val=$(this).val();$(this).val(fMil(limpiar(val)));});$(document).off('click','a[{$savebutton_attrs}]').on('click','a[{$savebutton_attrs}]',function(e){var totalActual=limpiar($("#value_total_1").val());if(totalActual<=0){alert("⚠️ ¡RESTRICCIÓN!\n\nDebe indicar el detalle del Gasto!");e.preventDefault();e.stopImmediatePropagation();return false;}
return true;});;});var pType=Runner.pages.constants.PAGE_LIST;Runner.pages.PageSettings.addPageEvent("inf_gastos",pType,"afterPageReady",function(pageObj,proxy,pageid){pageObj.buttonNames[pageObj.buttonNames.length]='New_Button153';if(!pageObj.buttonEventBefore['New_Button153']){pageObj.buttonEventBefore['New_Button153']=function(params,ctrl,pageObj,proxy,pageid,rowData){params["txt"]="Hello";ctrl.setMessage("Sending request to server...");}}
if(!pageObj.buttonEventAfter['New_Button153']){pageObj.buttonEventAfter['New_Button153']=function(result,ctrl,pageObj,proxy,pageid,rowData){var where=result["where"];var order=result["order"];var tabla=result["tabla"];window.open('generar_portrait.php?tabla='+tabla+'&where='+where+'&order='+order,'_blank');}}
$('a[id=New_Button153]').each(function(){if(!$(this).closest('tr.gridRowAdd').length){var newId="New_Button153"+"_"+Runner.genId();this.id=newId;var button_New_Button153=new Runner.form.Button({id:newId,btnName:"New_Button153"});button_New_Button153.init({args:[pageObj,proxy,pageid]});}});});