Skip to content

Commit

Permalink
excel report for basic reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Oct 2, 2016
1 parent bafef7e commit a72e134
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 3 deletions.
Binary file added excel/1475401060273sample.xlsx
Binary file not shown.
Binary file added excel/1475401432134sample.xlsx
Binary file not shown.
Binary file added excel/1475401859874sample.xlsx
Binary file not shown.
Binary file added excel/1475401918275sample.xlsx
Binary file not shown.
Binary file added excel/1475401918486sample.xlsx
Binary file not shown.
Binary file added excel/1475401922410sample.xlsx
Binary file not shown.
Binary file added excel/1475402024644sample.xlsx
Binary file not shown.
Binary file added excel/1475402132649sample.xlsx
Binary file not shown.
Binary file added excel/1475402341864sample.xlsx
Binary file not shown.
25 changes: 22 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,28 @@ router.get('/report', function (req, res) {

var workbook = excelbuilder.createWorkbook(directoryName, workbookName);
var sheet1 = workbook.createSheet('sheet1', 10, 12);
sheet1.set(1, 1, 'I am title');
for (var i = 2; i < 5; i++)
sheet1.set(i, 1, 'test'+i);
//sheet1.set(column, row, value)
//Object.keys(report.Assets)[0]
sheet1.set(1, 1, 'Name');
sheet1.set(2, 1, 'Delivery');
sheet1.set(3, 1, 'Pending');
sheet1.set(4, 1, 'InProgress');
sheet1.set(5, 1, 'Completed');
sheet1.set(6, 1, 'Cancelled');
sheet1.set(7, 1, 'ProductPrice');
sheet1.set(8, 1, 'DeliveryCharge');
for (var row = 2; row <= 10; row++) {
var reportBaseIndex = row - 2;
var key = Object.keys(report)[reportBaseIndex];
sheet1.set(1, row, key);
sheet1.set(2, row, report[key].TotalDelivery);
sheet1.set(3, row, report[key].TotalPending);
sheet1.set(4, row, report[key].TotalInProgress);
sheet1.set(5, row, report[key].TotalCompleted);
sheet1.set(6, row, report[key].TotalCancelled);
sheet1.set(7, row, report[key].TotalProductPrice);
sheet1.set(8, row, report[key].TotalDeliveryCharge);
}

// Save it
workbook.save(function(ok){
Expand Down

0 comments on commit a72e134

Please sign in to comment.