Skip to content

Commit

Permalink
Area wise report generation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
abrarShariar committed Jun 3, 2017
1 parent b9fba7b commit 4256e80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class LocationDueReportComponent implements OnInit {
report.current_due = res['current_due'];
report.previous_due = res['previous_due'];
report.total_due = res['total_due'];
this.reportList.push(report);
if (res['total_due'] != 0) {
this.reportList.push(report);
}
},
(err) => {
console.log("Error in getReport");
Expand Down
26 changes: 2 additions & 24 deletions node-api/app/controllers/report.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,21 @@ export class ReportController {
$and: [
{
customer_id: id
},
{
$or: [
{
status: "Due"
},
{
status: "Partially Paid"
}
]

}
]

}, function (err, recentInvoice) {
if (recentInvoice) {
if (!err) {
result['current_due'] = recentInvoice['amount_due'];
}
AllInvoiceModel.find({
$and: [
{
customer_id: id
},
{
$or: [
{
status: "Due"
},
{
status: "Partially Paid"
}
]

}
]
}, function (err, allInvoice) {
if (allInvoice) {
if (!err) {
_.each(allInvoice, (item) => {
result['previous_due'] += item['amount_due'];
});
Expand Down

0 comments on commit 4256e80

Please sign in to comment.