|
|
@@ -31,17 +31,30 @@ class MutationService extends CurrencyFormatService
|
|
31
|
31
|
|
|
32
|
32
|
public function totalIncomeAsString(EloquentCollection $collections)
|
|
33
|
33
|
{
|
|
34
|
|
- return $this->setRupiahFormat($this->totalIncome($collections), true);
|
|
|
34
|
+ if ($collections->count()) {
|
|
|
35
|
+ return $this->setRupiahFormat($this->totalIncome($collections), true);
|
|
|
36
|
+ } else {
|
|
|
37
|
+ return $this->setRupiahFormat(0, true);
|
|
|
38
|
+ }
|
|
35
|
39
|
}
|
|
36
|
40
|
|
|
37
|
41
|
public function totalExpenseAsString(EloquentCollection $collections)
|
|
38
|
42
|
{
|
|
39
|
|
- return $this->setRupiahFormat($this->totalExpense($collections), true);
|
|
|
43
|
+ if ($collections->count()) {
|
|
|
44
|
+ return $this->setRupiahFormat($this->totalExpense($collections), true);
|
|
|
45
|
+ } else {
|
|
|
46
|
+ return $this->setRupiahFormat(0, true);
|
|
|
47
|
+ }
|
|
40
|
48
|
}
|
|
41
|
49
|
|
|
42
|
50
|
public function totalAmountAsString(EloquentCollection $collections)
|
|
43
|
51
|
{
|
|
44
|
|
- $amount = $this->totalIncome($collections) - $this->totalExpense($collections);
|
|
|
52
|
+ if ($collections->count()) {
|
|
|
53
|
+ $amount = $this->totalIncome($collections) - $this->totalExpense($collections);
|
|
|
54
|
+ } else {
|
|
|
55
|
+ $amount = 0;
|
|
|
56
|
+ }
|
|
|
57
|
+
|
|
45
|
58
|
return $this->setRupiahFormat($amount, true);
|
|
46
|
59
|
}
|
|
47
|
60
|
|