-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSupervisorTableDisplay.js
More file actions
31 lines (26 loc) · 1.2 KB
/
SupervisorTableDisplay.js
File metadata and controls
31 lines (26 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Table = require('cli-table');
var displayTableSuper = function () {
this.table = new Table({
head: ['Department Id', 'Department Name', 'Overhead Costs', 'Product Sales', 'Total Profit'],
});
this.displayDepartmentTable = function (response) {
this.response = response;
for (var index = 0; index < this.response.length; index++) {
if (!this.response[index].product_sales) {
this.response[index].product_sales = parseFloat(0);
this.response[index].total_profit = parseFloat(this.response[index].product_sales - this.response[index].over_head_costs).toFixed(2);
};
this.response[index].product_sales = parseFloat(response[index].product_sales).toFixed(2);
this.response[index].total_profit = parseFloat(response[index].total_profit).toFixed(2);
this.table.push(
[this.response[index].department_id,
this.response[index].department_name,
// this.response[index].department_name,
'$' + this.response[index].over_head_costs,
'$' + this.response[index].product_sales,
'$' + this.response[index].total_profit]);
}
console.log('\n' + this.table);
};
}
module.exports = displayTableSuper;