diff --git a/index.html b/index.html index f96c663..6af2d20 100755 --- a/index.html +++ b/index.html @@ -184,4 +184,4 @@ - \ No newline at end of file + diff --git a/js/main.js.210811 b/js/main.js.210811 new file mode 100755 index 0000000..a1caa21 --- /dev/null +++ b/js/main.js.210811 @@ -0,0 +1,211 @@ + + +var path_pedidos = "../prgdmug/pedidos_vta.php"; +var path_alta = "../prgdmug/alta_ped.php"; +var path_detalles = "../prgdmug/detalles_pedesp.php"; + + +/* VARIABLES GLOBALES PARA FUNCIONAMIENTO DE SCRIPT*************************************************************************/ +var lista_de_pedidos = []; +var ped; + +function menuTogle(){ + $("#myMenuIcon").toggleClass("menuIcon"); + $("#myMenuIcon").toggleClass("cancelIcon"); + $("#myNavy").toggle(); + $("#myMenuDiv").toggleClass("backBlack"); +} + + $("#myMenuDiv").click(function(){ + menuTogle(); + }); + + $(".nav-item").click(function(){ + menuTogle(); + }); + +/* FORMATO PARA NUMEROS*************************************************************************/ +function number_format(amount, decimals) { +amount += ''; // por si pasan un numero en vez de un string +amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto +decimals = decimals || 0; // por si la variable no fue fue pasada +// si no es un numero o es igual a cero retorno el mismo cero +if (isNaN(amount) || amount === 0) + return parseFloat(0).toFixed(decimals); +// si es mayor o menor que cero retorno el valor formateado como numero +amount = '' + amount.toFixed(decimals); +var amount_parts = amount.split('.'), + regexp = /(\d+)(\d{3})/; +while (regexp.test(amount_parts[0])) + amount_parts[0] = amount_parts[0].replace(regexp, '$1' + '.' + '$2'); +return amount_parts.join('.'); +} +function crear_detalles_pedido(nro,ido){ + console.log(nro); + $.ajax({url: path_detalles, + type: 'POST', + data: nro, + dataType: 'json', + success: function(response) + { + + console.log(response); + var nodos = document.getElementsByClassName("salir"); + if(nodos.length>0){ + for(var i = 0 ; i < nodos.length ; i++){ + nodos[i].remove(); + } + } + /*ARMO PANTALLA*/ + + //var detallesList = '
'; + var detallesList ='
'; + for (var i = 0; i < response.document.pedido.detped.length ; i++) + { + detallesList +=''; + /* + ---VERSION ANTIGUA--- + detallesList += '
'; + detallesList += '
'; + detallesList += 'cod art: '+response.document.pedido.detped[i].dep_art+ ' Descripcion: '+response.document.pedido.detped[i].dep_des+'   
'; + detallesList += '
'; + detallesList += 'cant pedido: '+response.document.pedido.detped[i].dep_cant+' UxB: '+response.document.pedido.detped[i].dep_udad+' Precio: $'+response.document.pedido.detped[i].dep_prec+'    
'; + detallesList += '
'; + detallesList += 'Stock:'+response.document.pedido.detped[i].totitem+' Renta:'+response.document.pedido.detped[i].rentaitem+' 
'; + detallesList += '

';*/ + } + detallesList+='
cod artDescripcionCantUxBPrecioTotal ItemRentaP.Lista
'+response.document.pedido.detped[i].dep_art+''+response.document.pedido.detped[i].dep_des+''+response.document.pedido.detped[i].dep_cant+''+response.document.pedido.detped[i].dep_udad+'$'+response.document.pedido.detped[i].dep_prec+''+response.document.pedido.detped[i].totitem+''+response.document.pedido.detped[i].rentaitem+''+response.document.pedido.detped[i].dep_plista+'
'; + detallesList += '
'; + + ido.after(detallesList); + + $('#tplista').text("total precio lista :"+response.document.pedido.tplista); + $('#trenta').text(" Total renta obtenida :"+response.document.pedido.trenta); + $('#difpre').text("Diferencia de total precio lista :"+response.document.pedido.difpre); + $( ".alta" ).click(function() { + //var suc = document.getElementById("sucursal").value; + var ped = $(this).attr("id"); + var parametros={"n_ped":ped}; + if (confirm('Seguro desea confirmar el pedido :'+ped)) { + $.ajax({url: path_alta, + type: 'POST', + data: parametros, + dataType: 'json', + success: function(response){ + alert("Grabado correctamente!"); + location.reload(); + } + }); + console.log('confirmo pedido'); + } + else { + console.log('No confirmo pedido'); + } + }); + + } + }); + +} +function llenar_lista_pedido() +{ + $('#pedido').text(" "); + $('#cliente').text(" "); + $('#total').text(" "); + var suc = document.getElementById("sucursal").value; + var parametros = {"suc": suc}; + $('.list-group').empty(); + $.ajax({url: path_pedidos, + type: 'POST', + data: parametros, + dataType: 'json', + success: function(response){ + console.log(response); + for (var i = 0; i < response.CLIENTE.length ; i++){ + var math=parseInt(response.CLIENTE[i].total)/100; + //console.log(response); + $('.lista-pedido').append("
  • Pedido nÂȘ :

    "+response.CLIENTE[i].pedido+"

    CLIENTE :

    "+response.CLIENTE[i].cliente+" "+response.CLIENTE[i].nomcli+"

    Total:$

    "+parseInt(response.CLIENTE[i].total)/100+"


    ver mas

  • "); + } + $(".oculto").click(function() { + + var suc = document.getElementById("sucursal").value; + var oID = $(this).attr("id"); + var res = oID.split("_"); + $(".oculto").show(); + $(this).hide(); + var parametros = { + "suc" : suc, + "ped" : res[1] + }; + crear_detalles_pedido(parametros, $(this)); + + }); + + $(".consulta").click(function() { + var oID = $(this).attr("id"); + $(".consulta").removeClass("border-success"); + $( '#'+oID+'' ).addClass( "border-success" ); + + v_ped="ped_"+oID; + v_numcli="numcli_"+oID; + v_nomcli="nomcli_"+oID; + v_total="total_"+oID; + //v_tplista="tplista_"+oID; + //v_trenta="trenta_"+oID; + //v_difpre="difpre_"+oID; + ped=$('#'+v_ped+'').text(); + var n_cli = $('#'+v_numcli+'').text(); + var nom_cli = $('#'+v_nomcli+'').text(); + var total = $('#'+v_total+'').text(); + //var tplista = $('#'+v_tplista+'').text(); + //var trenta = $('#'+v_trenta+'').text(); + //var difpre = $('#'+v_difpre+'').text(); + $('#pedido').text("Pedido: "+ped); + $('#cliente').text("Cliente: "+n_cli); + $('#total').text("Total $ :"+total); + $('#tplista').text("total precio lista :"+tplista); + $('#trenta').text(" Total renta obtenida :"+trenta); + $('#difpre').text("Diferencia de total precio lista :"+difpre); + // "PVE_" + "Suc" + <"+suc+"> + "_" + + + "_" + + ".pdf" + //var _href = $('#descarga').attr("href"); + $('#descarga').attr("href",'../pdf/PVE_Suc'+suc+'_PE40_'+ped+'.pdf'); + $('#descarga').attr("download", 'PVE_Suc'+suc+'_PE40_'+ped+'.pdf'); + }); + $( "#pedido_i" ).click(function() { + alert("ped"); + }); + + } + + }); +} + +$(document).ready(function() { + $("#myNavy").removeClass("invisible"); + $("#myNavy").hide(); + llenar_lista_pedido(); + $("#sucursal").change(function() { + llenar_lista_pedido(); + + }); + + $( "button" ).click(function() { + var parametros={"n_ped":ped}; + if (confirm('Seguro desea confirmar el pedido :'+ped)) { + $.ajax({url: path_alta, + type: 'POST', + data: parametros, + dataType: 'json', + success: function(response){ + alert("Grabado correctamente!"); + location.reload(); + } + }); + console.log('confirmo pedido'); + } else { + + console.log('No confirmo pedido'); + } + }); + +}); \ No newline at end of file diff --git a/prgdmug/detalles_pedesp.php.210811 b/prgdmug/detalles_pedesp.php.210811 new file mode 100644 index 0000000..0d2c88a --- /dev/null +++ b/prgdmug/detalles_pedesp.php.210811 @@ -0,0 +1,53 @@ + $valor) + { + if($campo=="suc") + $v_suc=$valor; + if($campo=="ped") + $v_ped=$valor; + + error_log("campo :".$campo); + } + //error_log("---sucursal---: " . $v_suc ."---ped---:" . $v_ped); + $server= "localhost"; + $port = 1030; + $hs = "DEMIURGO10-MCANET"; + $user = "general"; + $pass = "123456789"; + error_log("Buscando productos por medio de filtros"); + $pid = getmypid(); + $limit = 100; + $veces_error_server = 0; + + /* Crea un objeto para el manejo postgres */ + $ConDMUG = new ConexDMUG( $server , $port , $hs ,$user , $pass ); + + $ConDMUG->SetProgram( "Detalle_pedesp" ); + + $ConDMUG->SetParameter( "sucursal" , $v_suc ); + $ConDMUG->SetParameter( "pedido" , $v_ped); + + if ( $ConDMUG->Execute_DMUG() < 0) + { + error_log("$veces_error_server".$veces_error_server); + $veces_error_server++; + if ( $veces_error_server > 2 ) + { + error_log("exit();"); + exit(); + } + sleep(5); + continue; + } + error_log("XML: " . $ConDMUG->xmlraw); + $RESULTADO = $ConDMUG->GetChild( "STRERROR" ); + echo json_encode($ConDMUG->xmlrequest); + $ConDMUG->CloseConex(); + exit(); + + +?> \ No newline at end of file diff --git a/users/index.php.210811 b/users/index.php.210811 new file mode 100755 index 0000000..d83d163 --- /dev/null +++ b/users/index.php.210811 @@ -0,0 +1,163 @@ + + + + Pedidos de Ventas Especiales + + + + + + + + + + + + + + + + + + + + + + + + + + + + +xmlrequest->{'STATUS'}=="OK") { + $_SESSION['loggedin'] = true; + $_SESSION['username'] = $v_user; + $_SESSION['start'] = time(); + $_SESSION['expire'] = $_SESSION['start'] + (5 * 60); + } else { + session_destroy(); + header("Location: ../index.html"); + die(); + } +?> + + + +
    + +
    +
    + + +
    + + +
    + + + + +
    + +

    Pedidos de venta abiertos

    +
    +
      + + +
    +
    + +

    Pedido Seleccionado

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + +
    + +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +