Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- $("#xfechaIni").datepicker({dateFormat: 'yy/mm/dd'});
- $("#xfechaFin").datepicker({dateFormat: 'yy/mm/dd'});
- $('#xfechaIni').val(moment().format('YYYY/MM/DD'));
- $('#xfechaFin').val(moment().format('YYYY/MM/DD'));
- console.log($("[id='frm_upl_file']").length);
- var options = {
- beforeSend: function () {
- $("#progressbox").show();
- // clear everything
- $("#progressbar").width('0%');
- $("#message").empty();
- $("#percent").html("0%");
- },
- uploadProgress: function (event, position, total, percentComplete) {
- $("#progressbar").width(percentComplete + '%');
- $("#percent").html(percentComplete + '%');
- // change message text to red after 50%
- if (percentComplete > 50) {
- $("#message").html("<font color='red'>Archivo Subiendo....</font>");
- }
- },
- success: function () {
- $("#progressbar").width('100%');
- $("#percent").html('100%');
- },
- complete: function (response) {
- $("#message").html("<font color='blue'>Su Archivo se Subio con Exito!!</font>");
- },
- error: function () {
- $("#message").html("<font color='red'> ERROR: Su Archivo no se pudo subir...Intente de Nuevo</font>");
- }
- };
- $("#frm_upl_file").ajaxForm(options);
- var dialogSubirFoto;
- dialogSubirFoto = $("#div_upl_file").dialog({
- autoOpen: false,
- height: 250,
- width: 300,
- modal: true,
- buttons: {
- "Subir Archivo": subirArchivo,
- Cancel: function () {
- dialogSubirFoto.dialog("close");
- }
- },
- close: function () {
- }
- });
- function subirArchivo() {
- $("#frm_upl_file").submit();
- }
- $("#btnConsultar").on('click', function () {
- var xfechaIni = $("#xfechaIni").val();
- var xfechaFin = $("#xfechaFin").val();
- $.ajax({
- method: "post",
- url: "../ajax/embarques/a_embembconslinea.jsp",
- data: {
- "xAccion": "consultaLineasCarga",
- "xfechaIni": xfechaIni,
- "xfechaFin": xfechaFin
- },
- dataType: 'json',
- async: false
- }).done(function (json) {
- if (json.xmsg === '') {
- $("#divTablaLineas").html(json.xhtml);
- $("#divTablaLineas2").html(json.xhtml2);
- } else {
- alert(json.xmsg);
- $("#divCargas").html("");
- }
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- alert("error " + textStatus);
- var werror = "Error Catalogo de Clientes.. ";
- if (jqXHR.status === 0) {
- werror = 'Not connected.\nPlease verify your network connection.';
- } else if (jqXHR.status == 404) {
- werror = 'The requested page not found. [404]';
- } else if (jqXHR.status == 500) {
- werror = 'Internal Server Error [500].';
- } else if (errorThrown === 'parsererror') {
- werror = 'Requested JSON parse failed.';
- } else if (errorThrown === 'timeout') {
- werror = 'Time out error.';
- } else if (errorThrown === 'abort') {
- werror = 'Ajax request aborted.';
- } else {
- werror = 'Uncaught Error.\n' + jqXHR.responseText;
- }
- alert(werror);
- });
- });
- $(document).on("click", ".btnSubirFactura", function () {
- var wRenglon = $(this).closest("tr");
- var myId = wRenglon.find(".myRowId").text();
- $("#divNoFactura").html(myId);
- $("#txtNoFactura").val(myId);
- dialogSubirFoto.dialog("open");
- });
- $(document).on("click", ".btnFeLlegada", function () {
- var self = this;
- var wRenglon = $(this).closest("tr");
- var myId = wRenglon.find(".myRowId").text();
- $.ajax({
- method: "post",
- url: "../ajax/embarques/a_embembconslinea.jsp",
- data: {
- "xAccion": "grabaFechaLleagada",
- "myId": myId
- },
- dataType: 'json',
- async: false
- }).done(function (json) {
- $(self).hide();
- var myDate = moment().format('YYYY/MM/DD');
- $(self).closest('td').text(myDate);
- wRenglon.find(".btnFeLibera").prop('disabled', false);
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- alert("error " + textStatus);
- var werror = "Error Catalogo de Clientes.. ";
- if (jqXHR.status === 0) {
- werror = 'Not connected.\nPlease verify your network connection.';
- } else if (jqXHR.status == 404) {
- werror = 'The requested page not found. [404]';
- } else if (jqXHR.status == 500) {
- werror = 'Internal Server Error [500].';
- } else if (errorThrown === 'parsererror') {
- werror = 'Requested JSON parse failed.';
- } else if (errorThrown === 'timeout') {
- werror = 'Time out error.';
- } else if (errorThrown === 'abort') {
- werror = 'Ajax request aborted.';
- } else {
- werror = 'Uncaught Error.\n' + jqXHR.responseText;
- }
- alert(werror);
- });
- });
- $(document).on("click", ".btnFeLibera", function () {
- var self = this;
- var wRenglon = $(this).closest("tr");
- var myId = wRenglon.find(".myRowId").text();
- $.ajax({
- method: "post",
- url: "../ajax/embarques/a_embembconslinea.jsp",
- data: {
- "xAccion": "grabaFechaLiberacion",
- "myId": myId
- },
- dataType: 'json',
- async: false
- }).done(function (json) {
- $(self).hide();
- var myDate = moment().format('YYYY/MM/DD HH:mm');
- $(self).closest('td').text(myDate);
- wRenglon.find(".btnSaldado").prop('disabled', false);
- window.open("../servletSendEmail?xNoEmb=" + json.xNoEmb + "&xCliente=" + json.xCliente + "&xFechaLiberacion=" + json.xFechaLiberacion + "&xNoFactura=" +
- json.xNoFactura + "&xTelCliente" + json.xTelCliente + "&xNomLinea=" + json.xNomLinea + "&xTelLinea=" + json.xTelLinea + "&xNomChofer=" + json.xNomChofer +
- "&xTelChofer=" + json.xTelChofer + "&xPlaTracChofer=" + json.xPlaTracChofer + "&xMarcaTracChofer=" + json.xMarcaTracChofer, "_blank");
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- alert("error " + textStatus);
- var werror = "Error Catalogo de Clientes.. ";
- if (jqXHR.status === 0) {
- werror = 'Not connected.\nPlease verify your network connection.';
- } else if (jqXHR.status == 404) {
- werror = 'The requested page not found. [404]';
- } else if (jqXHR.status == 500) {
- werror = 'Internal Server Error [500].';
- } else if (errorThrown === 'parsererror') {
- werror = 'Requested JSON parse failed.';
- } else if (errorThrown === 'timeout') {
- werror = 'Time out error.';
- } else if (errorThrown === 'abort') {
- werror = 'Ajax request aborted.';
- } else {
- werror = 'Uncaught Error.\n' + jqXHR.responseText;
- }
- alert(werror);
- });
- });
- $(document).on("click", ".btnGrabarFolioFactura", function () {
- alert("aaaa");
- var wRenglon = $(this).closest("tr");
- var wId = wRenglon.find(".myRowId").text();
- var wFolioFactura = $("#idFolio" + wId).val();
- alert(wId + " " + wFolioFactura);
- $.ajax({
- method: "post",
- url: "../ajax/embarques/a_embembconslinea.jsp",
- data: {
- "xAccion": "grabaFolioFactura",
- "myId": wId,
- "wFolioFactura": wFolioFactura
- },
- dataType: 'json',
- async: false
- }).done(function (json) {
- $(self).hide();
- $(self).closest('td').text('OK');
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- console.log("error " + textStatus);
- });
- });
- $(document).on("click", ".btnSaldado", function () {
- var self = this;
- var wRenglon = $(this).closest("tr");
- var myId = wRenglon.find(".myRowId").text();
- $.ajax({
- method: "post",
- url: "../ajax/embarques/a_embembconslinea.jsp",
- data: {
- "xAccion": "grabaSaldado",
- "myId": myId
- },
- dataType: 'json',
- async: false
- }).done(function (json) {
- $(self).hide();
- $(self).closest('td').text('OK');
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- console.log("error " + textStatus);
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement