upd
This commit is contained in:
@ -1067,6 +1067,48 @@ class ProcJustificationAdapter extends Adapter {
|
||||
}
|
||||
}
|
||||
|
||||
async queryUpdateProcJustificationBoq(req, callback) {
|
||||
var apires = this.getApiResultDefined();
|
||||
try {
|
||||
let nik = req.body.nik;
|
||||
let vendors = JSON.parse(req.body.vendors);
|
||||
|
||||
let boqList = [];
|
||||
vendors.forEach(function (vendor) {
|
||||
if (vendor.boq && vendor.boq.length > 0) {
|
||||
vendor.boq.forEach(function (boq) {
|
||||
boqList.push(boq);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (boqList.length === 0) {
|
||||
apires.success = true;
|
||||
apires.meta.message = "No BOQ to update";
|
||||
callback(null, apires);
|
||||
return;
|
||||
}
|
||||
|
||||
let pending = boqList.length;
|
||||
boqList.forEach(function (boq) {
|
||||
let qry = "update tbl_procjustificationvendorboq ";
|
||||
qry += "set items='" + boq.items + "',qty='" + boq.qty + "',unitprice='" + boq.unitprice + "',units='" + boq.units + "',total='" + boq.total + "',uby='" + nik + "',udt=now() ";
|
||||
qry += "where _idx='" + boq._idx + "'";
|
||||
db.query(qry, [], function (err) {
|
||||
if (--pending === 0) {
|
||||
apires.success = true;
|
||||
apires.meta.message = "BOQ Updated";
|
||||
callback(null, apires);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
apires.meta.code = 500;
|
||||
apires.meta.message = err.toString();
|
||||
callback("error", apires);
|
||||
}
|
||||
}
|
||||
|
||||
async queryUpdateStatusProcJustification(req, callback) {
|
||||
try {
|
||||
var apires = this.getApiResultDefined();
|
||||
|
||||
Reference in New Issue
Block a user