This commit is contained in:
alexmorenograu 2021-03-15 09:42:05 +01:00
parent 587cb72cab
commit 6e9f7f7e38
2 changed files with 19 additions and 23 deletions

View File

@ -9,13 +9,14 @@ var collectionFk = '254';
function ticketCollection(collectionFk){//parametro collectionFk
let consultaSql = select.select(collectionFk)
if(filter.filterShelving(shelving)){
// insert.insertTicket(consultaSql, shelving)
}
else{
console.log("¡MATRICULA INCORRECTA!")
}
select.select(collectionFk, function(err,data){
if(filter.filterShelving(shelving)){
insert.insertTicket(data, shelving)
}
else{
console.log("¡MATRICULA INCORRECTA!")
}
});
}
ticketCollection(collectionFk, shelving);

View File

@ -4,22 +4,17 @@ const con = require('./connect')
//cliente
//agencia
var x;
function select(collectionFk){
con.con.connect(function(err) {
let consSql = `SELECT t.id, t.clientFk, am.name
FROM ticketCollection tc
JOIN ticket t ON t.id = tc.ticketFk
JOIN agencyMode am ON am.id = t.agencyModeFk
WHERE tc.collectionFk = ${collectionFk}`;
if (err) throw err;
con.con.query(consSql, function (err, result, fields) {
if (err) throw err;
console.log(result);
x = result;
});
});
console.log("RESULT FUERA "+x);
}
function select(collectionFk, callback){
let consSql = `SELECT t.id, t.clientFk, am.name
FROM ticketCollection tc
JOIN ticket t ON t.id = tc.ticketFk
JOIN agencyMode am ON am.id = t.agencyModeFk
WHERE tc.collectionFk = ${collectionFk}`;
con.con.query(consSql, function (err, result, fields) {
console.log(result);
callback(null,result);
});
}
exports.select = select;