Custom Codes Jqueries / CSS

Steps

External JS file to custom data

This file allows users to select individuals #itemsforms to apply functionalities.

All # for tables inside Items Forms

PurchaseOrderTable
PurchaseQuotationTable
PurchaseRequestTable
PurchaseInvoiceTable
SalesOrderTable
SalesQuotationTable
SalesInvoiceTable

Donwload External JS

External CSS file to custom data

This file allows users to select individuals objects to apply functionalities.
Donwload External CSS

Examples Code

Triger Code

          Ejecuta el codigo al cargar la pagina
          $(document).ready(function () {
            /// Code here
          });
          
Ejecuto en modo Update
if (formMode == "Update") {
$("#TableItemsForm :input[type=hidden]").each(function () {
var input = $(this);
// Valores
});
});
Ejecuto en modo Add
$("#ItemsSelect").change(function () {
$("#TableItemsForm :input[type=hidden]").each(function () {
var input = $(this);
// Valores
});
});

Add CSS with Jquery

$(document).ready(function () {
$(".udf_boxes select, .udf_boxes input").css('margin-bottom', '5px');
$("#SearchItemUDF_U_WH_Brand").css('display','none');
});

Disable Fields

		
Disable inputs Simple
$("#HEADUDF_U_AutCredito").attr('disabled','disabled'); 
		
Remove inputs Simple
$("#HEADUDF_U_AutCredito").removeAttr('disabled')
Disable inputs + ID value
var desabilitoinput1 = $("input[id^=LINEUDF_U_SQARS");
for (i = 0; i <  desabilitoinput1.length; i++) {
$("#"+ desabilitoinput1[i].id).attr('disabled','disabled');
}
            
Disable select + ID value
var desabilitoinput1 = $("select[id^=LINEUDF_U_SQARS");
for (i = 0; i <  desabilitoinput1.length; i++) {
$("#"+ desabilitoinput1[i].id).attr('disabled','disabled');

Hide Elements

Hide elment with specific value in UDF
if ($("#HEADUDF_U_COT_AUT").val() == 'NO') {
$('#btnCopyFrom').hide();
}
Hide Selects depending SELECT value/ Wha Hung Example
$(document).ready(function () {
$('#ItemGroup').on('change', function () {
$("#SearchItemUDF_U_WH_Brand").css('display', (this.value == '102') ? 'block' : 'none');
// Clear de valores dentro de los campos.
$(".udf_boxes select").each(function() { this.selectedIndex = 0 });
});
});
ESCONDE BOTON DE CREAR ORDEN SI NO ESTA COMPLETO LA REGLA DE DISTRIBUCION.
$(document).ready(function(){  
$("#ItemsSelect").change(function () {
$("#TableItemsForm :input[type=hidden]").each(function () {
var input = $(this);
if ($("#AutoCompleteDR" + input.attr('id')).val() == '') {
$('#btnOk').hide();
alert("Completar Normas de reparto. ");
$("#AutoCompleteDR" + input.attr('id')).css('border', '2px solid red');
} else {
$('#btnOk').show();
$("#AutoCompleteDR" + input.attr('id')).css('border', '1px solid #ccc');
}
});
});
});

Replaces values in Inputs/Selects/Dropdowns

Replace defined text.
$(document).ready(function(){ 
$(".ico_new_sales").text(function () {    
 return $(this).text().replace("My Documents", "Nuevo Texto");  
});  
}); 
	
Replace defined text in TD.
$('#ItemsSelect table tr th:nth-child(15):contains("Wh")').text("Depósito");  
           
 Replace all content inside box
$(document).ready(function(){
$('.page-header:contains("My Documents")').text("My Orders");
});              
 
Replace inside / li a
$(document).ready(function(){
$('.nav > li a:contains("My Documents")').text("My Orders");
});
Replace "placeholder" value 
$(document).ready(function(){
$('#UDF_Code').attr("placeholder", "SEARCH PART NUMBER");
});
 Add value to input or Select
$(document).ready(function(){
$('#NumAtCard').val('Online Order');
$("._statusDDL").val(2); 
});
 Remplace a specific Letter
$("#LINEUDF").val( function(i,oldtext){
return oldtext.replace("E","U")
});

Take a negative or positive value to show a special TEXT.

        
Cambia valor de stock por VENDIDO.
var patForReqdFld = /^\-\d{1}(\.(\d)*)?$/g; 
var value = $('#qty_total').text(); 
if(patForReqdFld.test(value)) {
alert('Valid Number: ' + value);
$('#qty_total').text("SOLD");
 }
else
{
//alert('Invalid Number: ' + value);
}

Show message depending the value

 
Si contiene el Valor "." muestra mensaje.
if (this.value.indexOf(".") == 1) {
alert('Ingresar números enteros para la orden');
}

Change value imput to value placeholder

 
Change val for placeholder
$('#HEADUDF_U_FecVenCred').attr("placeholder", $('#HEADUDF_U_FecVenCred').val());
$("#HEADUDF_U_FecVenCred").val("");