display vendor on detail
This commit is contained in:
@ -899,6 +899,38 @@ class ProcJustificationAdapter extends Adapter {
|
||||
};
|
||||
// result[key]['ttd'] = JSON.parse(JSON.stringify(result3));
|
||||
}
|
||||
|
||||
/* =========================
|
||||
SHOW VENDORS
|
||||
========================= */
|
||||
qry =
|
||||
"select * from tbl_procjustificationvendor where idxprocjustification='" +
|
||||
_idx +
|
||||
"' and isdeleted=0 order by numberoffile asc";
|
||||
|
||||
db.query(qry, [], function (err, vendors, fields) {
|
||||
if (err) {
|
||||
apires.meta["message"] = err.toString();
|
||||
apires.meta["code"] = 500;
|
||||
callback("error", apires);
|
||||
} else {
|
||||
if (vendors.length > 0) {
|
||||
let vendorRows = vendors.length;
|
||||
|
||||
vendors.forEach(function (vendor, vkey) {
|
||||
let qryBoq =
|
||||
"select * from tbl_procjustificationvendorboq where idxprocjustificationvendor='" +
|
||||
vendor._idx +
|
||||
"' and isdeleted=0 order by _idx asc";
|
||||
|
||||
db.query(qryBoq, [], function (err, boq, fields) {
|
||||
if (!err) {
|
||||
vendors[vkey]["boq"] = JSON.parse(JSON.stringify(boq));
|
||||
}
|
||||
|
||||
if (0 === --vendorRows) {
|
||||
result[key]["vendor"] = JSON.parse(JSON.stringify(vendors));
|
||||
|
||||
if (0 === --dataRows) {
|
||||
let resultJson = JSON.stringify(result);
|
||||
resultJson = JSON.parse(resultJson);
|
||||
@ -908,16 +940,32 @@ class ProcJustificationAdapter extends Adapter {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
result[key]["vendor"] = [];
|
||||
|
||||
// if(0 === --dataRows){
|
||||
if (0 === --dataRows) {
|
||||
let resultJson = JSON.stringify(result);
|
||||
resultJson = JSON.parse(resultJson);
|
||||
apires.success = true;
|
||||
apires.data = resultJson;
|
||||
callback(null, apires);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if (0 === --dataRows) {
|
||||
// let resultJson = JSON.stringify(result);
|
||||
// resultJson = JSON.parse(resultJson);
|
||||
// apires.success = true;
|
||||
// apires.data = resultJson;
|
||||
// callback(null,apires);
|
||||
// callback(null, apires);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user