display vendor on detail
This commit is contained in:
@ -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);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user