Skip to content

Instantly share code, notes, and snippets.

@kaioken
Last active December 21, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaioken/6288517 to your computer and use it in GitHub Desktop.
Save kaioken/6288517 to your computer and use it in GitHub Desktop.
<script>
/**
* Inicio de JS
*/
jQuery(function(){
/**
* cuando hagan click en el input de envasadora
*/
jQuery('#envasadora').blur(function(){
/**
* si es el usuario
*/
if('{!CURRENTUSER.username!}' == 'ps_config3')
{
jQuery('#rbi_L_envasadoraP').hide();
jQuery('#envasadoraP').hide();
}
/**
* llamada al webservice
*/
var location = jQuery('#envasadora').val();
//alert(surl);
/**
* la informacion que me devuelve entonces la trabajo y se la agrego a estos inputs
*/
jQuery.getJSON(surl, function(data) {
jQuery('#inv__inicial').val(data.inv_final);
jQuery('#m1').val(data.fm1);
jQuery('#m2').val(data.fm2);
jQuery('#m3').val(data.fm3);
jQuery('#m4').val(data.fm4);
jQuery('#m5').val(data.fm5);
jQuery('#m6').val(data.fm6);
});
/**
* colocan informacion
*/
jQuery('#RLOCATIONENTITY').val('{!CURRENTENTITY#id!}');
jQuery('#RUSERINFO').val('{!CURRENTUSER.id!}');
jQuery('#Rcontrol_de_precio').val('10962');
/**
* Escondemos inputs
*/
//jQuery('#Rcontrol_de_precio').hide();
jQuery('#rbi_L_RUSERINFO').hide();
jQuery('#RUSERINFO').hide();
//jQuery('#rbi_F_Rcontrol_de_precio').hide();
//jQuery('#rbi_L_Rcontrol_de_precio').hide();
//jQuery('#rbi_L_fichas').hide();
//jQuery('#rbi_L_fichas2').hide();
jQuery('#rbi_L_Galonaje2').hide();
jQuery('#rbi_L_galonaje1').hide();
/**
* Codigo para agregar los + y - en el pop up de compras
*/
var spTimer = null;
jQuery('#rbi_F_Rintro').click(function(){
spTimer = setInterval(function(){
if(jQuery('#_yuiResizeMonitor').length == 1)
{
clearInterval(spTimer);
jQuery('#_yuiResizeMonitor').ready(function(){
spTimer = setInterval(function(){
if(jQuery('#rbe_dialogIframe').length == 1)
{
clearInterval(spTimer);
jQuery('#rbe_dialogIframe').ready(function(){
spTimer = setInterval(function(){
if(jQuery('#rbe_dialogIframe').contents().find('#factura1').length == 1)
{
clearInterval(spTimer);
jQuery('#rbe_dialogIframe').contents().find('#factura1').parents('table').first().find('tr').each(function(k){
if(k == 0){
jQuery(this).find('td').last().empty().append(jQuery('<a id="spShowNext" href="#">[+]</span>').click(function(){
if(jQuery(this).parents('tr').first().next().length == 1){
jQuery(this).parents('tr').first().next().show().find('td').last().empty().append(jQuery(this).detach());
if(jQuery(this).parents('tr').first().next().length == 0){
jQuery(this).remove()};
};
return false;
})
)
}else{
jQuery(this).hide()
}
});
}
}, 100);
});
}
}, 100);
});
}
}, 100);
});
});
/**
* Quitamos la palabra luego del : en el titulo
*/
jQuery('.listTitle').html(jQuery('.listTitle').html().split(':')[0]);
/**
* Cuando seleccionen el valor del dropdown de conecpto de ventas , seleccionamos el mismo valor en el dropdown de control de precio
*/
jQuery('#concepto_de_venta').change(function(){
var txt = jQuery(this).children().eq(jQuery(this).prop('selectedIndex')).html();
var found = false;
jQuery('#Rcontrol_de_precio').children().each(function(){
if(!found && jQuery(this).html() == txt)
{
jQuery(this).attr('selected', 'selected');
found = true;
}
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment