
var pType=Runner.pages.constants.PAGE_ADD;Runner.pages.PageSettings.addPageEvent("det_venta",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(){$("[id^='value_cantidad_']").each(function(){var id=this.id.split('_').pop();var $fImp=$("#value_importe_"+id);if($fImp.length&&$fImp.val()!==""){var impLimpio=limpiar($fImp.val());if($fImp.val()!==fMil(impLimpio)){$fImp.val(fMil(impLimpio));}}
var c=limpiar($("#value_cantidad_"+id).val());var p=limpiar($("#value_precio_"+id).val());var i=limpiar($("#value_importe_"+id).val());var sub=c*(i>0?i:p);var $fSub=$("#value_subtotal_"+id);var subFormateado=fMil(sub);if($fSub.length&&$fSub.val()!==subFormateado){$fSub.val(subFormateado);}
var cost=limpiar($("#value_costo_"+id).val());var gan=sub-(cost*c);var $fGan=$("#value_ganancia_"+id);if($fGan.length&&$fGan.val()!==fMil(gan)){$fGan.val(fMil(gan));}});},400);});var pType=Runner.pages.constants.PAGE_EDIT;Runner.pages.PageSettings.addPageEvent("det_venta",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(){$("[id^='value_cantidad_']").each(function(){var id=this.id.split('_').pop();var $fImp=$("#value_importe_"+id);if($fImp.length&&$fImp.val()!==""){var impLimpio=limpiar($fImp.val());if($fImp.val()!==fMil(impLimpio)){$fImp.val(fMil(impLimpio));}}
var c=limpiar($("#value_cantidad_"+id).val());var p=limpiar($("#value_precio_"+id).val());var i=limpiar($("#value_importe_"+id).val());var sub=c*(i>0?i:p);var $fSub=$("#value_subtotal_"+id);var subFormateado=fMil(sub);if($fSub.length&&$fSub.val()!==subFormateado){$fSub.val(subFormateado);}
var cost=limpiar($("#value_costo_"+id).val());var gan=sub-(cost*c);var $fGan=$("#value_ganancia_"+id);if($fGan.length&&$fGan.val()!==fMil(gan)){$fGan.val(fMil(gan));}});},400);});