Creacion de Consulta Cloud en APP
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -0,0 +1,2 @@
|
||||
test/
|
||||
node_modules/
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# APP-SIGMA-WEB
|
||||
|
||||
ejs
|
||||
mysql
|
||||
express-myconnection
|
||||
express
|
||||
morgan
|
||||
telegraf
|
||||
nodemon
|
||||
|
||||
1823
package-lock.json
generated
1823
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@
|
||||
"nodemon": "^2.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.26.0",
|
||||
"ejs": "^3.0.2",
|
||||
"express": "^4.17.1",
|
||||
"express-myconnection": "^1.0.4",
|
||||
|
||||
@@ -3,6 +3,7 @@ const path = require('path');
|
||||
const morgan = require('morgan');
|
||||
const mysql = require('mysql');
|
||||
const myConecction = require('express-myconnection');
|
||||
|
||||
var puerto = 3001
|
||||
|
||||
const app = express();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const controlador = {};
|
||||
const axios = require('axios').default;
|
||||
|
||||
controlador.verClientesJsonApp = (req, res) => {
|
||||
req.getConnection((err, conn) => {
|
||||
@@ -87,11 +88,12 @@ controlador.guardaCliente = (req, res) => {
|
||||
req.getConnection((err,conn)=>{
|
||||
conn.query('INSERT INTO clientes set ?',[data],(err,rows)=>{
|
||||
if(err){
|
||||
res.json(err);
|
||||
}
|
||||
next(res.json(err));
|
||||
}else{
|
||||
console.log(rows);
|
||||
//res.send('working...');
|
||||
res.redirect('/');//redireciona a la ruta inical de la app
|
||||
res.redirect('/clientes');//redireciona a la ruta inical de la app
|
||||
}
|
||||
});//set ? => data
|
||||
});
|
||||
};
|
||||
@@ -152,4 +154,71 @@ controlador.app_pedidos_clientes = (req,res) => {
|
||||
});
|
||||
};
|
||||
|
||||
//CONSULTA CLIENTE CLOUD C.I-RUC => ruta:/busquedaSRI
|
||||
var data_url0 = 'http://www.ecuadorlegalonline.com/modulo/sri/consulta-ruc/ruc.api.php';
|
||||
var data_url1 = "https://xsystem.ddns.net/app/consulta_clientes.php";
|
||||
var data_url2 = "http://sheyla2.dyndns.info/SRI/SRI.php";
|
||||
var data_url3 = "http://192.168.10.100:8000/test_post";
|
||||
var arrayUrl = [
|
||||
"http://www.ecuadorlegalonline.com/modulo/sri/consulta-ruc/ruc.api.php",
|
||||
"https://xsystem.ddns.net/app/consulta_clientes.php",
|
||||
"http://sheyla2.dyndns.info/SRI/SRI.php",
|
||||
"http://192.168.10.100:8000/test_post",
|
||||
"solo testing"
|
||||
];
|
||||
controlador.buscarCli_sri = (req, res) => {
|
||||
var idCli = req.query.ruc;
|
||||
console.log(`Peticion => Consulta RUC: ${idCli}`);
|
||||
let selc = 2;
|
||||
|
||||
switch (selc) {
|
||||
case 0:
|
||||
axios.post(arrayUrl[selc]+"?ruc="+idCli)
|
||||
.then(function(resp_sri){
|
||||
//console.log(resp_sri.data);
|
||||
//var consulta = {"resp_consulta":resp_sri};
|
||||
var json = {nombre:"NOMBRE",empresa:"empresa",direccion:"Santo Domingo"};
|
||||
var consulta = {"resp_consulta":json};
|
||||
res.json(json);
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
axios.post(arrayUrl[selc]+"?ruc="+idCli)
|
||||
.then(function(resp_sri){
|
||||
console.log(resp_sri.data);
|
||||
var consulta = {"resp_consulta":resp_sri};
|
||||
res.json(consulta);
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
axios.post(arrayUrl[selc]+"?ruc="+idCli)
|
||||
.then(function(resp_sri){
|
||||
console.log(resp_sri.data);
|
||||
var data_toArray = resp_sri.data;
|
||||
let arr = data_toArray.split('***');
|
||||
console.log(arr);
|
||||
var obj_json = {nombre:arr[1],empresa:arr[2],direccion:arr[9]};
|
||||
//var consulta = {"resp_consulta":json};
|
||||
res.json(obj_json);
|
||||
});
|
||||
break;
|
||||
|
||||
case 4:
|
||||
var json = {nombre:"NOMBRE",empresa:"empresa",direccion:"Santo Domingo"};
|
||||
var consulta = {"resp_consulta":json};
|
||||
res.json(json);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
// conectarme a SRI FALSO
|
||||
/*axios.post(data_url,{
|
||||
data: {
|
||||
func:'GETDATA',
|
||||
ruc:numeroruc
|
||||
}
|
||||
}).then(function(res) {
|
||||
console.log(res.data);
|
||||
});*/
|
||||
}
|
||||
|
||||
module.exports = controlador;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const controlador = {};
|
||||
const axios = require('axios').default;
|
||||
|
||||
controlador.verVentasJson = (req, res) => {
|
||||
req.getConnection((err, conn) => {
|
||||
@@ -80,4 +81,9 @@ controlador.verVentasJson = (req, res) => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = controlador;
|
||||
|
||||
10
src/public/css/tipografias.css
Normal file
10
src/public/css/tipografias.css
Normal file
@@ -0,0 +1,10 @@
|
||||
@font-face {
|
||||
font-family: sigma_font;
|
||||
src: url(../tipografias/sigma_font.otf);
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: sigma_tipografia;
|
||||
src: url(../tipografias/sigma_font.ttf);
|
||||
font-style: normal;
|
||||
}
|
||||
26
src/public/js/consulta_sri.js
Normal file
26
src/public/js/consulta_sri.js
Normal file
@@ -0,0 +1,26 @@
|
||||
function ConsultaContribuyente(numeroruc){
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: 'http://www.ecuadorlegalonline.com/modulo/sri/consulta-ruc/ruc.api.php',
|
||||
data: {
|
||||
func:'GETDATA',
|
||||
ruc:numeroruc
|
||||
},
|
||||
success: function(data){
|
||||
LoadingData(0);
|
||||
if(data!=null){
|
||||
var dataJson = data;
|
||||
if (dataJson.consolidado==null){
|
||||
ShowError('La búsqueda no generó resultados.');
|
||||
}else{
|
||||
console.log(dataJson.consolidado);
|
||||
}
|
||||
}
|
||||
},
|
||||
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
var xdata='';
|
||||
LoadingData(0);
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
@@ -11,4 +11,5 @@ rutas.get('/origen_pedidos', controlador_init.app_ORIGENES);//consulta grupo pre
|
||||
rutas.get('/panel_control', controlador_init.panel_control);//consulta grupo precios
|
||||
|
||||
|
||||
|
||||
module.exports = rutas;
|
||||
|
||||
@@ -23,4 +23,5 @@ rutas.get('/addClienteForm', controladorClientes.verFormNclientes);//muesta form
|
||||
|
||||
//APP_SIGMA consultas
|
||||
rutas.get('/consultaClientesJson', controladorClientes.app_pedidos_clientes);//consulta clientes app-sigma
|
||||
rutas.get('/busquedaSRI/', controladorClientes.buscarCli_sri);//consulta grupo precios
|
||||
module.exports = rutas;
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"/>
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/5.4.55/css/materialdesignicons.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"type="text/css">
|
||||
<link href="http://xsystem.ddns.net/app/css/app_sigma_stilos.css" rel="stylesheet" type="text/css">
|
||||
<link href="http://xsystem.ddns.net/app/css/app_sigmaDetallePedidos.css" rel="stylesheet" type="text/css">
|
||||
<link href="http://xsystem.ddns.net/app/css/app_sigma_pedidosStilos.css" rel="stylesheet" type="text/css">
|
||||
<link href="http://xsystem.ddns.net/app/css/app_sigma_pedidosDetalle.css" rel="stylesheet" type="text/css">
|
||||
<link href="./css/tipografias.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="http://xsystem.ddns.net/app/css/animate.css" rel="stylesheet" />
|
||||
|
||||
</head>
|
||||
@@ -111,7 +112,7 @@
|
||||
<input id="txt_busq" placeholder="Escribe aqui tu busqueda" type="text" class="validate" onkeyup="busqueda(event)">
|
||||
</div>
|
||||
<div class="col s4 m3 l2" id="bt_busq" onclick="consulta()">
|
||||
<a class="waves-effect waves-light btn right">
|
||||
<a class="waves-effect waves-light bt_busq btn right">
|
||||
<i class="material-icons left">youtube_searched_for</i>Buscar
|
||||
</a>
|
||||
</div>
|
||||
@@ -133,19 +134,20 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="txtCedula">Cedula</label>
|
||||
<input type="number" class="form-control" id="txtCedula">
|
||||
<label for="txtTelefono">Telefono</label>
|
||||
<input type="number" class="form-control" id="txtTelefono">
|
||||
<label for="txtDireccion">Direccion</label>
|
||||
<input type="text" class="form-control" id="txtDireccion">
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="txtDireccion">Direccion</label>
|
||||
<input type="text" class="form-control" id="txtDireccion">
|
||||
<label for="txtTelefono">Telefono</label>
|
||||
<input type="text" class="form-control" id="txtTelefono">
|
||||
<label for="txtEmail">Email</label>
|
||||
<input type="email" class="form-control" id="txtEmail">
|
||||
</div>
|
||||
<br>
|
||||
<button class="btn" id="bt_guardaCliente"> <i class="material-icons left">save</i>Guardar</button>
|
||||
<button class="btn" id="bt_cancelaCliente"> <i class="material-icons left">cancel</i>Cancelar</button>
|
||||
<button class="btn btn-cli" id="bt_guardaCliente"> <i class="material-icons left">save</i>Guardar</button>
|
||||
<button class="btn btn-cli" id="bt_cancelaCliente"> <i class="material-icons left">cancel</i>Cancelar</button>
|
||||
<button class="btn btn-cli right" id="bt_cosulta_cloud"> <i class="material-icons left">cloud</i>Consultar</button>
|
||||
</div><div class="row" id="panel_origen_pedidos"></div><div id="detalles_pedidos"><ul class="collapsible" data-collapsible="accordion">
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
@@ -180,7 +182,7 @@
|
||||
<strong>Detalle Pedido:</strong>
|
||||
<span id="carrito_detallePedido" class="detPed_subtitulos">10</span>
|
||||
</div>
|
||||
<div class="collapsible-body"> <div id="contenido_detellePedidClient"></div> </div>
|
||||
<div class="collapsible-body"><div id="contenido_detellePedidClient"></div></div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
@@ -226,7 +228,7 @@
|
||||
|
||||
<div class="blue lighten-5" id="footerPrecios"> <div id="clinteBox">
|
||||
<div id="clinteTitulo"><strong>Selecione Cliente</strong></div>
|
||||
<div id="clinteNom"></div> </div>
|
||||
<div id="clinteNom"></div></div>
|
||||
<div id="ValorTotal"><strong>Total</strong> $0.00</div>
|
||||
</div>
|
||||
<!--footer class="page-footer">
|
||||
@@ -242,8 +244,8 @@
|
||||
<!-- Compiled and minified JavaScript -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||
|
||||
<script src="https://xsystem.ddns.net/app/js/app_sigma_controlPC.js"></script>
|
||||
<script src="https://xsystem.ddns.net/app/js/app_sigma_modal.js"></script>
|
||||
<script src="https://xsystem.ddns.net/app/js/app_sigma_pedidosMain.js"></script>
|
||||
<script src="https://xsystem.ddns.net/app/js/app_sigma_pedidosModal.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Clientes</title>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./img/favicon_sigma/favicon-32x32.png">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.26.0/axios.min.js"></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
|
||||
<script type="text/javascript">
|
||||
window.onload = fechaActual;
|
||||
var txt_ruc;
|
||||
function fechaActual(){
|
||||
var fecha = new Date(); //Fecha actual
|
||||
var mes = fecha.getMonth()+1; //obteniendo mes
|
||||
@@ -17,23 +21,35 @@
|
||||
mes='0'+mes //agrega cero si el menor de 10
|
||||
}
|
||||
document.getElementById('reg').value=ano+"-"+mes+"-"+dia;
|
||||
txt_ruc = document.getElementById('txt_idRuc');
|
||||
}
|
||||
window.onload = function(){
|
||||
var fecha = new Date(); //Fecha actual
|
||||
var mes = fecha.getMonth()+1; //obteniendo mes
|
||||
var dia = fecha.getDate(); //obteniendo dia
|
||||
var ano = fecha.getFullYear(); //obteniendo año
|
||||
if(dia<10)
|
||||
dia='0'+dia; //agrega cero si el menor de 10
|
||||
if(mes<10)
|
||||
mes='0'+mes //agrega cero si el menor de 10
|
||||
document.getElementById('reg').value=ano+"-"+mes+"-"+dia;
|
||||
|
||||
function consulta_cliente(){
|
||||
var txt_id = txt_ruc.value;
|
||||
console.log(txt_id);
|
||||
if(txt_ruc.value!=""){
|
||||
consulta_ruc(txt_id);
|
||||
}else{
|
||||
console.log("Ingrese Cdula o RUC");
|
||||
}
|
||||
}
|
||||
|
||||
function consulta_ruc(numeroruc){
|
||||
axios.get("/busquedaSRI?ruc="+numeroruc)
|
||||
.then(function(res) {
|
||||
var json = res.data;
|
||||
txt_nom = document.getElementById('txt_nombre').value = json.nombre;
|
||||
txt_dir = document.getElementById('txt_direc').value = json.direccion;
|
||||
//txt_tel = document.getElementById('txt_telf').value = arr[1];
|
||||
//txt_mai = document.getElementById('txt_mail').value = arr[1];
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="fechaActual()">
|
||||
<!--body-->
|
||||
<body>
|
||||
<nav class="navbar navbar-dark bg-dark">
|
||||
<a href="" class="navbar-brand mx-auto">Clientes</a>
|
||||
</nav>
|
||||
@@ -42,20 +58,28 @@
|
||||
<form class="card-body" action="/addCliente" method="post">
|
||||
<h3 class="card-title">Nuevo Cliente</h3>
|
||||
<div class="form-group">
|
||||
<input name="client_nombre" type="text" class="form-control" placeholder="Nombre Cliente">
|
||||
<input name="client_nombre" type="text" class="form-control" placeholder="Nombre Cliente" id="txt_nombre">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="client_rucCed" type="text" class="form-control" placeholder="Cedula/RUC">
|
||||
<input name="client_rucCed" type="text" class="form-control" placeholder="Cedula/RUC" id="txt_idRuc">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="client_direccion" type="text" class="form-control" placeholder="Direccion">
|
||||
<input name="client_direccion" type="text" class="form-control" placeholder="Direccion" id="txt_direc">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="client_telefono" type="text" class="form-control" placeholder="Numero Telefonico" id="txt_telf">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="client_email" type="text" class="form-control" placeholder="Correo E." id="txt_mail">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="client_fechaReg" type="datetime" class="form-control" id="reg">
|
||||
</div>
|
||||
<input name="client_estado" type="hidden" value="1">
|
||||
<input type="submit" class="btn btn-primary" value="Guardar">
|
||||
<a href="/" class="btn btn-primary">Cancelar</a>
|
||||
<a href="/clientes" class="btn btn-primary">Cancelar</a>
|
||||
</form>
|
||||
<button class="btn btn-primary" id="consultas_ruc" onclick="consulta_cliente()">Consultar Cliente</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user