display vendor on detail

This commit is contained in:
Rizki
2026-03-06 10:33:27 +07:00
parent f6670321fc
commit 541b423c03

View File

@ -899,23 +899,71 @@ class ProcJustificationAdapter extends Adapter {
}; };
// result[key]['ttd'] = JSON.parse(JSON.stringify(result3)); // result[key]['ttd'] = JSON.parse(JSON.stringify(result3));
} }
if (0 === --dataRows) {
let resultJson = JSON.stringify(result); /* =========================
resultJson = JSON.parse(resultJson); SHOW VENDORS
apires.success = true; ========================= */
apires.data = resultJson; qry =
callback(null, apires); "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);
apires.success = true;
apires.data = resultJson;
callback(null, apires);
}
}
});
});
} else {
result[key]["vendor"] = [];
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);
// }
} }
}); });
// if(0 === --dataRows){
// let resultJson = JSON.stringify(result);
// resultJson = JSON.parse(resultJson);
// apires.success = true;
// apires.data = resultJson;
// callback(null,apires);
// }
} }
}); });
}); });