WIP PBS AP.

This commit is contained in:
Patrick Fic
2022-10-31 10:42:42 -07:00
parent 7d81898a45
commit 8d5202f46d
16 changed files with 690 additions and 12 deletions

View File

@@ -22,6 +22,9 @@ const {
PbsSelectedCustomer,
} = require("../accounting/pbs/pbs-job-export");
const PbsCalculateAllocationsAp =
require("../accounting/pbs/pbs-ap-allocations").default;
io.use(function (socket, next) {
try {
if (socket.handshake.auth.token) {
@@ -101,7 +104,7 @@ io.on("connection", (socket) => {
});
//END CDK
//PBS
//PBS AR
socket.on("pbs-calculate-allocations", async (jobid, callback) => {
const allocations = await CdkCalculateAllocations(socket, jobid);
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
@@ -125,7 +128,21 @@ io.on("connection", (socket) => {
socket.selectedCustomerId = selectedCustomerId;
PbsSelectedCustomer(socket, selectedCustomerId);
});
//End PBS
//End PBS AR
//PBS AP
socket.on("pbs-calculate-allocations-ap", async (billids, callback) => {
const allocations = await PbsCalculateAllocationsAp(socket, billids);
createLogEvent(socket, "DEBUG", `AP Allocations calculated.`);
createLogEvent(
socket,
"TRACE",
`Allocations calculated. ${JSON.stringify(allocations, null, 2)}`
);
callback(allocations);
});
//END PBS AP
socket.on("disconnect", () => {
createLogEvent(socket, "DEBUG", `User disconnected.`);