Browse Source

Merge con cambios que vinieron de la agencia Desarrolladora

master
Nicolas Soreian 3 years ago
parent
commit
164218b084
  1. 211
      js/main.js.210811
  2. 53
      prgdmug/detalles_pedesp.php.210811
  3. 163
      users/index.php.210811

211
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 = '<div class="col-12 salir"> ';
var detallesList ='<div class="col-12 salir"> <table class="table table-sm col-sm-12 col-md-12 col-mb-12 col-lg-12 text-center "><thead class="thead-dark"><tr><th scope="col">cod art</th><th scope="col">Descripcion</th><th scope="col">Cant</th><th scope="col">UxB</th><th scope="col">Precio</th><th scope="col">Total Item</th><th scope="col">Renta</th><th scope="col">P.Lista</th></th></thead>';
for (var i = 0; i < response.document.pedido.detped.length ; i++)
{
detallesList +='<tbody><tr><th scope="row"><small style="color: #6c757d;">'+response.document.pedido.detped[i].dep_art+'</small></th><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].dep_des+'</small></td><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].dep_cant+'</small></td><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].dep_udad+'</small></td><td><small style="color: #6c757d;">$'+response.document.pedido.detped[i].dep_prec+'</small></td><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].totitem+'</small></td><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].rentaitem+'</small></td><td><small style="color: #6c757d;">'+response.document.pedido.detped[i].dep_plista+'</small></td></tr>';
/*
---VERSION ANTIGUA---
detallesList += '<div class="row ">';
detallesList += '<div class="col-12 col-sm-12">';
detallesList += '<small style="color: #6c757d;">cod art: '+response.document.pedido.detped[i].dep_art+ ' Descripcion: '+response.document.pedido.detped[i].dep_des+'&nbsp;&nbsp;&nbsp;</small></div>';
detallesList += '<div class="col-12 col-sm-12">';
detallesList += '<small style="color: #6c757d;">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+' &nbsp;&nbsp;&nbsp;</small></div>';
detallesList += '<div class="col-12 col-sm-12">';
detallesList += '<small style="color: #6c757d;">Stock:'+response.document.pedido.detped[i].totitem+' Renta:'+response.document.pedido.detped[i].rentaitem+'&nbsp;</small></div>';
detallesList += '</div><hr>';*/
}
detallesList+='</tbody></table >';
detallesList += '<button type="button" id='+response.document.pedido.cap_ped+' class="btn btn-primary btn-lg btn-block alta">Confirmar Pedido</button></div>';
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("<li class='col-sm-12 col-md-12 col-mb-12 col-lg-12 text-center list-group-item list-group-item-secondary consulta' style='border: 3px solid ;' id="+response.CLIENTE[i].pedido+" ><div> Pedido nª : <p style='display: inline;' id='ped_"+response.CLIENTE[i].pedido+"'>"+response.CLIENTE[i].pedido+"</p> CLIENTE : <p style='display: inline;'id='numcli_"+response.CLIENTE[i].pedido+"'>"+response.CLIENTE[i].cliente+" "+response.CLIENTE[i].nomcli+"</p > Total:$ <p style='display: inline;' id='total_"+response.CLIENTE[i].pedido+"'>"+parseInt(response.CLIENTE[i].total)/100+"</p></div><br><div id=hide_"+response.CLIENTE[i].pedido+" class='oculto'><u>ver mas</u></div></li><br>");
}
$(".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+"> + "_" + <Tipo Comp> + <Operacion> + "_" + <Nro.Comprobante> + ".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');
}
});
});

53
prgdmug/detalles_pedesp.php.210811

@ -0,0 +1,53 @@
<?php
require_once "/var/www/html/pedvenesp/prgdmug/F_DMUG.php";
$v_suc = "";
$v_ped = "";
foreach($_POST as $campo => $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();
?>

163
users/index.php.210811

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>Pedidos de Ventas Especiales</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<!--<link rel="icon" type="image/png" href="../images/icons/favicon.ico"/>-->
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../fonts/iconic/css/material-design-iconic-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/animsition/css/animsition.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../vendor/daterangepicker/daterangepicker.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="../css/util.css">
<link rel="stylesheet" type="text/css" href="../css/main.css">
<!--===============================================================================================-->
</head>
<?php
require_once '../prgdmug/login.php';
if ($ConDMUG->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();
}
?>
<body style="width:100%; height:100%;">
<div id="mybackground" style="background:blue!important;">
<!--<div id="myPreContent"><div class="loader">Loading...</div></div>-->
</div>
<div class="limiter " style="margin-top:50px;width:100%; height:100%;">
<div class="container-login100">
<nav class="navbar navbar-expand bg-dark navbar-dark fixed-top ">
<div class="navbar-brand" style="margin-right: 1em;" >Pedidos de Ventas</div>
<div id="myMenuDiv" class="" style="position: fixed; right:3%; " >
<div id="myMenuIcon" class="menuIcon" style=" width: 24px; height: 24px;"></div>
</div>
</nav>
<div class="form-group">
<label for="exampleFormControlSelect1"><h4>Seleccione Sucursal</h4></label>
<select class="form-control sucursal" id="sucursal">
<option value="1">Banfield</option>
<option value="4">Monte Grande</option>
</select>
<br>
<h3 class="text-center">Pedidos de venta abiertos</h3>
<br>
<ul class="list-group lista-pedido ">
</ul>
<br>
<div class="col-sm-12 col-md-12 col-mb-12 col-lg-12 text-center"><h4>Pedido Seleccionado</h4></div>
<div class="data-pedido">
<br>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="pedido"></div>
</div>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="cliente"> </div>
</div>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="total"></div>
</div>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="tplista"></div>
</div>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="trenta"></div>
</div>
<div class="row col-sm-12 col-md-12 col-lg-12 text-center">
<div class="col-12" id="difpre"></div>
</div>
<br>
<br>
</div>
<!--<br>
<a class="text-center " id="descarga" download='' href=''>Descargar pdf</a>
<br>-->
<br>
<button type="button" class="btn btn-primary btn-lg btn-block">Confirmar Todos</button>
</div>
<div id="myNavy" class="myNav12 invisible" style="width:200px;height:65px; ">
<ul class="navbar-nav justify-content-end">
<li class="nav-item">
<a class="nav-link" style="text-align: center;" href="logout.php"><img src="../images/icons/salir.png" class="rounded" style=" width: 20px; height: 20px;" alt=""> &nbsp; Salir</a>
</li>
</ul>
</div>
<button onclick="topFunction()" id="boton-top" title="Go to top">
<img src="../images/top.png" alt="Top" style="height: 26px; width: 26px;">
</button>
</div>
<!--===============================================================================================<-->
<script src="../vendor/jquery/jquery-3.2.1.min.js"></script>
<!--===============================================================================================-->
<script src="../vendor/animsition/js/animsition.min.js"></script>
<!--===============================================================================================-->
<script src="../vendor/bootstrap/js/popper.js"></script>
<script src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<!--===============================================================================================-->
<script src="../vendor/select2/select2.min.js"></script>
<!--===============================================================================================-->
<script src="../vendor/daterangepicker/moment.min.js"></script>
<script src="../vendor/daterangepicker/daterangepicker.js"></script>
<!--===============================================================================================-->
<script src="../vendor/countdowntime/countdowntime.js"></script>
<!--===============================================================================================-->
<script src="../js/main.js"></script>
<!--===============================================================================================-->
</body>
</html>
Loading…
Cancel
Save