upd
This commit is contained in:
@ -1993,26 +1993,27 @@ class PoAdapter extends Adapter {
|
||||
let resultJson = JSON.stringify(result);
|
||||
resultJson = JSON.parse(resultJson);
|
||||
|
||||
// PO BOQ
|
||||
let qry = "select * from vw_poboq where idxpo='" + resultJson[0]._idx + "'";
|
||||
// PO BOQ — use vw_poheaderdetail (vw_poboq filters PR status and may return no rows)
|
||||
let qry =
|
||||
"select idxpo, idxpoboq, description, qty as qtypoboq, units, poamount, " +
|
||||
"unitprice, total, vendorname, startdate, enddate, ponumber, status, statusdescription " +
|
||||
"from vw_poheaderdetail where idxpo='" +
|
||||
resultJson[0]._idx +
|
||||
"' and isdeleted=0";
|
||||
db.query(qry, [], function (err, result, fields) {
|
||||
if (err) {
|
||||
apires.meta["message"] = err.toString();
|
||||
apires.meta["code"] = 500;
|
||||
callback("err", apires);
|
||||
} else {
|
||||
if (result.length <= 0) {
|
||||
apires.meta.message = "Record not found";
|
||||
callback("", apires);
|
||||
} else {
|
||||
let resultJsonBoq = JSON.stringify(result);
|
||||
resultJsonBoq = JSON.parse(resultJsonBoq);
|
||||
resultJson[0]["boq"] = resultJsonBoq;
|
||||
resultJson[0]["boq"] =
|
||||
result.length > 0
|
||||
? JSON.parse(JSON.stringify(result))
|
||||
: [];
|
||||
|
||||
apires.success = true;
|
||||
apires.data = resultJson;
|
||||
callback(null, apires);
|
||||
}
|
||||
apires.success = true;
|
||||
apires.data = resultJson;
|
||||
callback(null, apires);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user