Skip to content

Commit

Permalink
asset userid added on summary report
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Oct 5, 2016
1 parent 9b3ffb4 commit 145f15f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
if (Object.keys(job.Assets) && Object.keys(job.Assets).length !== 0) {
// FIXME: more than one asset can be assigned to a job
var assetKey = Object.keys(job.Assets)[0];
key = job.Assets[assetKey].UserName;
key = job.Assets[assetKey].UserName;
} else {
key = "Not Assigned";
}
Expand All @@ -19,6 +19,9 @@ module.exports = {
}
if (report[key] === undefined) {
report[key] = {};
if (params.query.usertype === "BIKE_MESSENGER") {
report[key].UserId = Object.keys(job.Assets)[0];
}
report[key].TotalDelivery = 0;
report[key].TotalProductPrice = 0;
report[key].TotalDeliveryCharge = 0;
Expand All @@ -28,7 +31,7 @@ module.exports = {
report[key].TotalCancelled = 0;
}

if (report[key] !== undefined) {
if (report[key] !== undefined) {
report[key].TotalDelivery += 1;
report[key].TotalProductPrice += parseInt(job.Order.OrderCart.SubTotal);
report[key].TotalDeliveryCharge += parseInt(job.Order.OrderCart.ServiceCharge);
Expand Down
4 changes: 3 additions & 1 deletion excelCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ module.exports = {
sheet1.set(6, 1, 'Cancelled');
sheet1.set(7, 1, 'ProductPrice');
sheet1.set(8, 1, 'DeliveryCharge');
for (var row = 2; row <= Object.keys(report).length; row++) {
console.log(Object.keys(report).length);
for (var row = 2; row <= Object.keys(report).length + 1; row++) {
var reportBaseIndex = row - 2;
console.log(reportBaseIndex)
var key = Object.keys(report)[reportBaseIndex];
sheet1.set(1, row, key);
if (report[key].TotalDelivery === undefined) {
Expand Down

0 comments on commit 145f15f

Please sign in to comment.