Merge release & add time ticket calculations.
This commit is contained in:
@@ -976,7 +976,7 @@ async function GenerateTransWips(socket) {
|
||||
const allocations = await CalcualteAllocations(socket, socket.JobData.id);
|
||||
const wips = [];
|
||||
allocations.forEach((alloc) => {
|
||||
//Add the sale item
|
||||
//Add the sale item from each allocation.
|
||||
if (alloc.sale.getAmount() > 0 && !alloc.tax) {
|
||||
const item = {
|
||||
acct: alloc.profitCenter.dms_acctnumber,
|
||||
@@ -993,6 +993,7 @@ async function GenerateTransWips(socket) {
|
||||
wips.push(item);
|
||||
}
|
||||
|
||||
//Add the cost Item.
|
||||
if (alloc.cost.getAmount() > 0 && !alloc.tax) {
|
||||
const item = {
|
||||
acct: alloc.costCenter.dms_acctnumber,
|
||||
@@ -1025,33 +1026,38 @@ async function GenerateTransWips(socket) {
|
||||
}
|
||||
|
||||
if (alloc.tax) {
|
||||
const item = {
|
||||
acct: alloc.costCenter.dms_acctnumber,
|
||||
cntl: socket.JobData.ro_number,
|
||||
cntl2: null,
|
||||
credtMemoNo: null,
|
||||
postAmt: alloc.cost.getAmount(),
|
||||
postDesc: null,
|
||||
prod: null,
|
||||
statCnt: 1,
|
||||
transID: socket.DMSTransHeader.transID,
|
||||
trgtCoID: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
};
|
||||
// if (alloc.cost.getAmount() > 0) {
|
||||
// const item = {
|
||||
// acct: alloc.costCenter.dms_acctnumber,
|
||||
// cntl: socket.JobData.ro_number,
|
||||
// cntl2: null,
|
||||
// credtMemoNo: null,
|
||||
// postAmt: alloc.cost.getAmount(),
|
||||
// postDesc: null,
|
||||
// prod: null,
|
||||
// statCnt: 1,
|
||||
// transID: socket.DMSTransHeader.transID,
|
||||
// trgtCoID: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
// };
|
||||
|
||||
wips.push(item);
|
||||
const item2 = {
|
||||
acct: alloc.profitCenter.dms_acctnumber,
|
||||
cntl: socket.JobData.ro_number,
|
||||
cntl2: null,
|
||||
credtMemoNo: null,
|
||||
postAmt: alloc.sale.multiply(-1).getAmount(),
|
||||
postDesc: null,
|
||||
prod: null,
|
||||
statCnt: 1,
|
||||
transID: socket.DMSTransHeader.transID,
|
||||
trgtCoID: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
};
|
||||
wips.push(item2);
|
||||
// wips.push(item);
|
||||
// }
|
||||
|
||||
if (alloc.sale.getAmount() > 0) {
|
||||
const item2 = {
|
||||
acct: alloc.profitCenter.dms_acctnumber,
|
||||
cntl: socket.JobData.ro_number,
|
||||
cntl2: null,
|
||||
credtMemoNo: null,
|
||||
postAmt: alloc.sale.multiply(-1).getAmount(),
|
||||
postDesc: null,
|
||||
prod: null,
|
||||
statCnt: 1,
|
||||
transID: socket.DMSTransHeader.transID,
|
||||
trgtCoID: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
};
|
||||
wips.push(item2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1076,7 +1082,11 @@ async function GenerateTransWips(socket) {
|
||||
|
||||
console.log(
|
||||
"WIPS TOTAL",
|
||||
wips.reduce((acc, val) => acc + val.postAmt, 0)
|
||||
wips.reduce((acc, val) => {
|
||||
console.log(val);
|
||||
console.log(acc + val.postAmt);
|
||||
return acc + val.postAmt;
|
||||
}, 0)
|
||||
);
|
||||
|
||||
return wips;
|
||||
|
||||
Reference in New Issue
Block a user