Browse Source

fix: master

Muhammad Iqbal Afandi 3 years ago
parent
commit
9672d036d1

+ 2
- 0
app/Exports/TransactionExport.php View File

@@ -55,6 +55,8 @@ class TransactionExport implements ShouldAutoSize, Responsable, FromView, WithSt
55 55
             4 => [
56 56
                 'font' => ['bold' => true],
57 57
             ],
58
+            'C' => ['alignment' => ['horizontal' => 'left']],
59
+            'D' => ['alignment' => ['horizontal' => 'left']],
58 60
             $lastRow => [
59 61
                 'font' => ['bold' => true, 'size' => 12],
60 62
                 'alignment' => ['horizontal' => 'left'],

+ 1
- 1
app/Http/Controllers/DiscountController.php View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace App\Http\Controllers;
4 4
 
5
-use App\Http\Requests\StoreDiscountRequest;
5
+use App\Http\Requests\Discount\StoreDiscountRequest;
6 6
 use App\Models\Discount;
7 7
 use Illuminate\Http\Request;
8 8
 

+ 3
- 1
app/Http/Controllers/ReportTransactionController.php View File

@@ -30,9 +30,11 @@ class ReportTransactionController extends Controller
30 30
             ->flatten(1)
31 31
             ->toArray();
32 32
 
33
+        $transaction = (new TransactionService)->getPaginator($transactions);
34
+
33 35
         return inertia('transaction/Report', [
34 36
             'filters' => request()->all('startDate', 'endDate', 'outlet'),
35
-            'transactions' => (new TransactionService)->getPaginator($transactions),
37
+            'transactions' => $transaction,
36 38
             'outlets' => Outlet::all()
37 39
                 ->transform(fn($outlet) => [
38 40
                     'label' => $outlet->name,

+ 0
- 4
app/Http/Controllers/ThermalPrintingController.php View File

@@ -3,7 +3,6 @@
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\Http\Controllers\Controller;
6
-// use App\Models\Transaction;
7 6
 use App\Models\Transaction;
8 7
 use Exception;
9 8
 use Hoa\Socket\Client as SocketClient;
@@ -13,9 +12,6 @@ class ThermalPrintingController extends Controller
13 12
 {
14 13
     public function __invoke(Transaction $transaction)
15 14
     {
16
-        // $thermalPrinting = new ThermalPrinting($transaction);
17
-        // $thermalPrinting->startPrinting(1);
18
-
19 15
         $transaction->load(['outlet', 'customer', 'transactionDetails.laundry']);
20 16
         $discount = $transaction->discount;
21 17
         $subTotalAsString = $transaction->subTotalAsString();

+ 19
- 8
app/Http/Controllers/TransactionController.php View File

@@ -158,16 +158,27 @@ class TransactionController extends Controller
158 158
                 }
159 159
             }
160 160
 
161
-            $transaction->mutation()->create([
162
-                'type' => 1,
163
-                'amount' => $transaction->totalPrice(),
164
-                'outlet_id' => $request->user()->outlet_id,
165
-            ]);
161
+            if ($request->discount) {
162
+                $transaction->mutation()->create([
163
+                    'type' => 1,
164
+                    'amount' => $transaction->totalPrice() < 0 ? $transaction->subTotal() : $transaction->totalPrice(),
165
+                    'outlet_id' => $request->user()->outlet_id,
166
+                ]);
166 167
 
167
-            DB::commit();
168
+                $transaction->mutation()->create([
169
+                    'type' => 2,
170
+                    'amount' => $transaction->totalPrice() < 0 ? $transaction->subTotal() : $transaction->totalPrice(),
171
+                    'outlet_id' => $request->user()->outlet_id,
172
+                ]);
173
+            } else {
174
+                $transaction->mutation()->create([
175
+                    'type' => 1,
176
+                    'amount' => $transaction->totalPrice(),
177
+                    'outlet_id' => $request->user()->outlet_id,
178
+                ]);
179
+            }
168 180
 
169
-            // $thermalPrinting = new ThermalPrinting($transaction);
170
-            // $thermalPrinting->startPrinting(2);
181
+            DB::commit();
171 182
 
172 183
             // $transaction = Transaction::with(['outlet', 'customer', 'transactionDetails.laundry'])->latest()->first();
173 184
 

app/Http/Requests/StoreDiscountRequest.php → app/Http/Requests/Discount/StoreDiscountRequest.php View File

@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 
3
-namespace App\Http\Requests;
3
+namespace App\Http\Requests\Discount;
4 4
 
5 5
 use Illuminate\Foundation\Http\FormRequest;
6 6
 

+ 5
- 5
app/Models/Expense.php View File

@@ -2,10 +2,10 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Helpers\CurrencyFormat;
6 5
 use App\Models\Mutation;
7 6
 use App\Models\Outlet;
8 7
 use App\Models\User;
8
+use App\Services\CurrencyFormatService;
9 9
 use Carbon\Carbon;
10 10
 use Illuminate\Database\Eloquent\Casts\Attribute;
11 11
 use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Model;
13 13
 
14 14
 class Expense extends Model
15 15
 {
16
-    use HasFactory, CurrencyFormat;
16
+    use HasFactory;
17 17
 
18 18
     protected $fillable = [
19 19
         'description',
@@ -22,17 +22,17 @@ class Expense extends Model
22 22
         'outlet_id',
23 23
     ];
24 24
 
25
-    public function createdAt(): Attribute
25
+    protected function createdAt(): Attribute
26 26
     {
27 27
         return Attribute::make(
28 28
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
29 29
         );
30 30
     }
31 31
 
32
-    public function amount(): Attribute
32
+    protected function amount(): Attribute
33 33
     {
34 34
         return Attribute::make(
35
-            get:fn($value) => '- ' . $this->setRupiahFormat($value, 0, true)
35
+            get:fn($value) => (new CurrencyFormatService)->setRupiahFormat(-$value, true)
36 36
         );
37 37
     }
38 38
 

+ 0
- 16
app/Models/Helpers/CurrencyFormat.php View File

@@ -1,16 +0,0 @@
1
-<?php
2
-
3
-namespace App\Models\Helpers;
4
-
5
-trait CurrencyFormat
6
-{
7
-    protected function setRupiahFormat(int $number, int $decimal = 0, bool $sign = false)
8
-    {
9
-        if ($sign) {
10
-            return 'Rp' . number_format($number, $decimal, ',', '.');
11
-
12
-        } else {
13
-            return number_format($number, $decimal, ',', '.');
14
-        }
15
-    }
16
-}

+ 0
- 53
app/Models/Helpers/HasMutation.php View File

@@ -1,53 +0,0 @@
1
-<?php
2
-
3
-namespace App\Models\Helpers;
4
-
5
-use Illuminate\Database\Eloquent\Collection;
6
-
7
-trait HasMutation
8
-{
9
-    use CurrencyFormat;
10
-
11
-    protected static function totalIncome(Collection $collections)
12
-    {
13
-        foreach ($collections->chunk(100) as $chunk) {
14
-            return $chunk->sum(function ($collect) {
15
-                if ($collect->getRawOriginal('type') == 1) {
16
-                    return $collect->getRawOriginal('amount');
17
-                }
18
-            });
19
-        }
20
-    }
21
-
22
-    protected static function totalExpense(Collection $collections)
23
-    {
24
-        foreach ($collections->chunk(100) as $chunk) {
25
-            return $chunk->sum(function ($collect) {
26
-                if ($collect->getRawOriginal('type') == 2) {
27
-                    return $collect->getRawOriginal('amount');
28
-                }
29
-            });
30
-        }
31
-    }
32
-
33
-    protected static function totalIncomeAsString(Collection $collections)
34
-    {
35
-        return parent::setRupiahFormat(self::totalIncome($collections), 0, true);
36
-
37
-    }
38
-
39
-    protected static function totalExpenseAsString(Collection $collections)
40
-    {
41
-        return '- ' . parent::setRupiahFormat(self::totalExpense($collections), 0, true);
42
-    }
43
-
44
-    protected static function totalAmount(Collection $collections)
45
-    {
46
-        $amount = self::totalIncome($collections) - self::totalExpense($collections);
47
-        if ($amount < 0) {
48
-            return '- ' . parent::setRupiahFormat(abs($amount), 0, true);
49
-        } else {
50
-            return parent::setRupiahFormat($amount, 0, true);
51
-        }
52
-    }
53
-}

+ 3
- 3
app/Models/Laundry.php View File

@@ -2,14 +2,14 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Helpers\CurrencyFormat;
5
+use App\Services\CurrencyFormatService;
6 6
 use Illuminate\Database\Eloquent\Casts\Attribute;
7 7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8 8
 use Illuminate\Database\Eloquent\Model;
9 9
 
10 10
 class Laundry extends Model
11 11
 {
12
-    use HasFactory, CurrencyFormat;
12
+    use HasFactory;
13 13
 
14 14
     protected $fillable = [
15 15
         'name',
@@ -34,7 +34,7 @@ class Laundry extends Model
34 34
     protected function price(): Attribute
35 35
     {
36 36
         return Attribute::make(
37
-            get:fn($value) => $this->setRupiahFormat($value, 0, true)
37
+            get:fn($value) => (new CurrencyFormatService)->setRupiahFormat($value, true)
38 38
         );
39 39
     }
40 40
 

+ 12
- 8
app/Models/Mutation.php View File

@@ -2,8 +2,7 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Helpers\CurrencyFormat;
6
-use App\Models\Helpers\HasMutation;
5
+use App\Services\CurrencyFormatService;
7 6
 use Carbon\Carbon;
8 7
 use Illuminate\Database\Eloquent\Casts\Attribute;
9 8
 use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -11,7 +10,7 @@ use Illuminate\Database\Eloquent\Model;
11 10
 
12 11
 class Mutation extends Model
13 12
 {
14
-    use HasFactory, CurrencyFormat, HasMutation;
13
+    use HasFactory;
15 14
 
16 15
     protected $fillable = [
17 16
         'type',
@@ -21,22 +20,27 @@ class Mutation extends Model
21 20
         'expense_id',
22 21
     ];
23 22
 
24
-    public function createdAt(): Attribute
23
+    protected function createdAt(): Attribute
25 24
     {
26 25
         return Attribute::make(
27 26
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
28 27
         );
29 28
     }
30 29
 
31
-    public function amount(): Attribute
30
+    protected function amount(): Attribute
32 31
     {
33 32
         return Attribute::make(
34
-            get:fn($value) => $this->transaction_id ? $this->setRupiahFormat($value, 0, true)
35
-            : '- ' . $this->setRupiahFormat($value, 0, true)
33
+            get:function ($value) {
34
+                if ($this->getRawOriginal('type') == 1) {
35
+                    return (new CurrencyFormatService)->setRupiahFormat($value, true);
36
+                } else {
37
+                    return (new CurrencyFormatService)->setRupiahFormat(-$value, true);
38
+                }
39
+            },
36 40
         );
37 41
     }
38 42
 
39
-    public function type(): Attribute
43
+    protected function type(): Attribute
40 44
     {
41 45
         return Attribute::make(
42 46
             get:fn($value) => $value == 1 ? __('words.income') : __('words.expense')

+ 3
- 3
app/Models/Product.php View File

@@ -2,14 +2,14 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Helpers\CurrencyFormat;
5
+use App\Services\CurrencyFormatService;
6 6
 use Illuminate\Database\Eloquent\Casts\Attribute;
7 7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8 8
 use Illuminate\Database\Eloquent\Model;
9 9
 
10 10
 class Product extends Model
11 11
 {
12
-    use HasFactory, CurrencyFormat;
12
+    use HasFactory;
13 13
 
14 14
     protected $fillable = [
15 15
         'name',
@@ -34,7 +34,7 @@ class Product extends Model
34 34
     protected function price(): Attribute
35 35
     {
36 36
         return Attribute::make(
37
-            get:fn($value) => $this->setRupiahFormat($value, 0, true)
37
+            get:fn($value) => (new CurrencyFormatService)->setRupiahFormat($value, true)
38 38
         );
39 39
     }
40 40
 

+ 21
- 21
app/Models/Transaction.php View File

@@ -3,12 +3,12 @@
3 3
 namespace App\Models;
4 4
 
5 5
 use App\Models\Customer;
6
-use App\Models\Helpers\CurrencyFormat;
7 6
 use App\Models\Mutation;
8 7
 use App\Models\Outlet;
9 8
 use App\Models\TransactionDetail;
10 9
 use App\Models\TransactionStatus;
11 10
 use App\Models\User;
11
+use App\Services\CurrencyFormatService;
12 12
 use Carbon\Carbon;
13 13
 use Illuminate\Database\Eloquent\Casts\Attribute;
14 14
 use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
16 16
 
17 17
 class Transaction extends Model
18 18
 {
19
-    use HasFactory, CurrencyFormat;
19
+    use HasFactory;
20 20
 
21 21
     protected $fillable = [
22 22
         'transaction_number',
@@ -27,17 +27,17 @@ class Transaction extends Model
27 27
         'outlet_id',
28 28
     ];
29 29
 
30
-    public function createdAt(): Attribute
30
+    protected function createdAt(): Attribute
31 31
     {
32 32
         return Attribute::make(
33 33
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
34 34
         );
35 35
     }
36 36
 
37
-    public function discount(): Attribute
37
+    protected function discount(): Attribute
38 38
     {
39 39
         return Attribute::make(
40
-            get:fn($value) => $this->setRupiahFormat($value, 0, true)
40
+            get:fn($value) => (new CurrencyFormatService)->setRupiahFormat($value, true)
41 41
         );
42 42
     }
43 43
 
@@ -90,38 +90,38 @@ class Transaction extends Model
90 90
         });
91 91
     }
92 92
 
93
-    public function totalPrice()
93
+    public function subTotal()
94 94
     {
95
-        $price = $this->transactionDetails->sum(function ($transactionDetail) {
95
+        $subTotal = $this->transactionDetails->sum(function ($transactionDetail) {
96 96
             $price = $transactionDetail->getRawOriginal('price') * $transactionDetail->quantity;
97 97
             return $price - $price * ($transactionDetail->getRawOriginal('discount') / 100);
98 98
         });
99 99
 
100
-        return $price - $this->getRawOriginal('discount');
100
+        return $subTotal;
101 101
     }
102 102
 
103
-    public function totalPriceAsString()
103
+    public function subTotalAsString()
104 104
     {
105
-        return $this->setRupiahFormat($this->totalPrice());
105
+        return (new CurrencyFormatService)->setRupiahFormat($this->subTotal());
106 106
     }
107 107
 
108
-    public function totalPriceAsFullString()
108
+    public function totalPrice()
109 109
     {
110
-        return $this->setRupiahFormat($this->totalPrice(), 0, true);
110
+        $totalPrice = $this->subTotal() - $this->getRawOriginal('discount');
111
+        if ($totalPrice < 0) {
112
+            return 0;
113
+        } else {
114
+            return $totalPrice;
115
+        }
111 116
     }
112 117
 
113
-    public function subTotal()
118
+    public function totalPriceAsString()
114 119
     {
115
-        $subTotal = $this->transactionDetails->sum(function ($transactionDetail) {
116
-            $price = $transactionDetail->getRawOriginal('price') * $transactionDetail->quantity;
117
-            return $price - $price * ($transactionDetail->getRawOriginal('discount') / 100);
118
-        });
119
-
120
-        return $subTotal;
120
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice());
121 121
     }
122 122
 
123
-    public function subTotalAsString()
123
+    public function totalPriceAsFullString()
124 124
     {
125
-        return $this->setRupiahFormat($this->subTotal());
125
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice(), true);
126 126
     }
127 127
 }

+ 5
- 5
app/Models/TransactionDetail.php View File

@@ -2,17 +2,17 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use App\Models\Helpers\CurrencyFormat;
6 5
 use App\Models\Laundry;
7 6
 use App\Models\Product;
8 7
 use App\Models\Transaction;
8
+use App\Services\CurrencyFormatService;
9 9
 use Illuminate\Database\Eloquent\Casts\Attribute;
10 10
 use Illuminate\Database\Eloquent\Factories\HasFactory;
11 11
 use Illuminate\Database\Eloquent\Model;
12 12
 
13 13
 class TransactionDetail extends Model
14 14
 {
15
-    use HasFactory, CurrencyFormat;
15
+    use HasFactory;
16 16
 
17 17
     protected $fillable = [
18 18
         'price',
@@ -26,7 +26,7 @@ class TransactionDetail extends Model
26 26
     protected function price(): Attribute
27 27
     {
28 28
         return Attribute::make(
29
-            get:fn($value) => $this->setRupiahFormat($value, 0, true)
29
+            get:fn($value) => (new CurrencyFormatService)->setRupiahFormat($value, true)
30 30
         );
31 31
     }
32 32
 
@@ -62,11 +62,11 @@ class TransactionDetail extends Model
62 62
 
63 63
     public function totalPriceAsString()
64 64
     {
65
-        return $this->setRupiahFormat($this->totalPrice());
65
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice());
66 66
     }
67 67
 
68 68
     public function totalPriceAsFullString()
69 69
     {
70
-        return $this->setRupiahFormat($this->totalPrice(), 0, true);
70
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice(), true);
71 71
     }
72 72
 }

+ 11
- 3
app/Services/CurrencyFormatService.php View File

@@ -4,12 +4,20 @@ namespace App\Services;
4 4
 
5 5
 class CurrencyFormatService
6 6
 {
7
-    public function setRupiahFormat(int $number, int $decimal = 0, bool $sign = false)
7
+    public function setRupiahFormat(int $number, bool $sign = false)
8 8
     {
9 9
         if ($sign) {
10
-            return 'Rp' . number_format($number, $decimal, ',', '.');
10
+            if ($number < 0) {
11
+                return '-Rp' . number_format(abs($number), 0, ',', '.');
12
+            } else {
13
+                return 'Rp' . number_format($number, 0, ',', '.');
14
+            }
11 15
         } else {
12
-            return number_format($number, $decimal, ',', '.');
16
+            if ($number < 0) {
17
+                return '-' . number_format(abs($number), 0, ',', '.');
18
+            } else {
19
+                return number_format($number, 0, ',', '.');
20
+            }
13 21
         }
14 22
     }
15 23
 }

+ 46
- 0
app/Services/MutationService.php View File

@@ -0,0 +1,46 @@
1
+<?php
2
+
3
+namespace App\Services;
4
+
5
+use Illuminate\Database\Eloquent\Collection;
6
+
7
+class MutationService extends CurrencyFormatService
8
+{
9
+    public function totalIncome(Collection $collections)
10
+    {
11
+        foreach ($collections->chunk(100) as $chunk) {
12
+            return $chunk->sum(function ($collect) {
13
+                if ($collect->getRawOriginal('type') == 1) {
14
+                    return $collect->getRawOriginal('amount');
15
+                }
16
+            });
17
+        }
18
+    }
19
+
20
+    public function totalExpense(Collection $collections)
21
+    {
22
+        foreach ($collections->chunk(100) as $chunk) {
23
+            return $chunk->sum(function ($collect) {
24
+                if ($collect->getRawOriginal('type') == 2) {
25
+                    return $collect->getRawOriginal('amount');
26
+                }
27
+            });
28
+        }
29
+    }
30
+
31
+    public function totalIncomeAsString(Collection $collections)
32
+    {
33
+        return $this->setRupiahFormat($this->totalIncome($collections), true);
34
+    }
35
+
36
+    public function totalExpenseAsString(Collection $collections)
37
+    {
38
+        return $this->setRupiahFormat($this->totalExpense($collections), true);
39
+    }
40
+
41
+    public function totalAmount(Collection $collections)
42
+    {
43
+        $amount = $this->totalIncome($collections) - $this->totalExpense($collections);
44
+        return $this->setRupiahFormat($amount, true);
45
+    }
46
+}

app/Http/Controllers/Helpers/ThermalPrinting.php → app/Services/ThermalPrintingService.php View File

@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 
3
-namespace App\Http\Controllers\Helpers;
3
+namespace App\Services;
4 4
 
5 5
 use App\Models\Transaction;
6 6
 use Mike42\Escpos\PrintConnectors\FilePrintConnector;

+ 2
- 3
app/Services/TransactionService.php View File

@@ -24,8 +24,7 @@ class TransactionService
24 24
 
25 25
     public function totalPrice(Collection $collections)
26 26
     {
27
-        $collections->transform(fn($transactions) => $transactions->totalPrice());
28
-        return $collections;
27
+        return $collections->transform(fn($transactions) => $transactions->totalPrice());
29 28
     }
30 29
 
31 30
     public function totalPriceGroup(Collection $collections)
@@ -35,6 +34,6 @@ class TransactionService
35 34
 
36 35
     public function totalPriceGroupAsString(Collection $collections)
37 36
     {
38
-        return (new CurrencyFormatService)->setRupiahFormat($this->totalPriceGroup($collections), 0, true);
37
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPriceGroup($collections), true);
39 38
     }
40 39
 }

+ 68
- 66
composer.lock View File

@@ -1719,16 +1719,16 @@
1719 1719
         },
1720 1720
         {
1721 1721
             "name": "laravel/framework",
1722
-            "version": "v9.6.0",
1722
+            "version": "v9.7.0",
1723 1723
             "source": {
1724 1724
                 "type": "git",
1725 1725
                 "url": "https://github.com/laravel/framework.git",
1726
-                "reference": "47940a1a8774b96696ed57e6736ccea4a880c057"
1726
+                "reference": "54c9696ee3e558ab29317ed6e0cb16bb9db5aad4"
1727 1727
             },
1728 1728
             "dist": {
1729 1729
                 "type": "zip",
1730
-                "url": "https://api.github.com/repos/laravel/framework/zipball/47940a1a8774b96696ed57e6736ccea4a880c057",
1731
-                "reference": "47940a1a8774b96696ed57e6736ccea4a880c057",
1730
+                "url": "https://api.github.com/repos/laravel/framework/zipball/54c9696ee3e558ab29317ed6e0cb16bb9db5aad4",
1731
+                "reference": "54c9696ee3e558ab29317ed6e0cb16bb9db5aad4",
1732 1732
                 "shasum": ""
1733 1733
             },
1734 1734
             "require": {
@@ -1894,7 +1894,7 @@
1894 1894
                 "issues": "https://github.com/laravel/framework/issues",
1895 1895
                 "source": "https://github.com/laravel/framework"
1896 1896
             },
1897
-            "time": "2022-03-29T14:41:26+00:00"
1897
+            "time": "2022-04-05T15:07:51+00:00"
1898 1898
         },
1899 1899
         {
1900 1900
             "name": "laravel/sanctum",
@@ -2090,16 +2090,16 @@
2090 2090
         },
2091 2091
         {
2092 2092
             "name": "league/commonmark",
2093
-            "version": "2.2.3",
2093
+            "version": "2.3.0",
2094 2094
             "source": {
2095 2095
                 "type": "git",
2096 2096
                 "url": "https://github.com/thephpleague/commonmark.git",
2097
-                "reference": "47b015bc4e50fd4438c1ffef6139a1fb65d2ab71"
2097
+                "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955"
2098 2098
             },
2099 2099
             "dist": {
2100 2100
                 "type": "zip",
2101
-                "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/47b015bc4e50fd4438c1ffef6139a1fb65d2ab71",
2102
-                "reference": "47b015bc4e50fd4438c1ffef6139a1fb65d2ab71",
2101
+                "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/32a49eb2b38fe5e5c417ab748a45d0beaab97955",
2102
+                "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955",
2103 2103
                 "shasum": ""
2104 2104
             },
2105 2105
             "require": {
@@ -2108,17 +2108,19 @@
2108 2108
                 "php": "^7.4 || ^8.0",
2109 2109
                 "psr/event-dispatcher": "^1.0",
2110 2110
                 "symfony/deprecation-contracts": "^2.1 || ^3.0",
2111
-                "symfony/polyfill-php80": "^1.15"
2111
+                "symfony/polyfill-php80": "^1.16"
2112 2112
             },
2113 2113
             "require-dev": {
2114 2114
                 "cebe/markdown": "^1.0",
2115 2115
                 "commonmark/cmark": "0.30.0",
2116 2116
                 "commonmark/commonmark.js": "0.30.0",
2117 2117
                 "composer/package-versions-deprecated": "^1.8",
2118
+                "embed/embed": "^4.4",
2118 2119
                 "erusev/parsedown": "^1.0",
2119 2120
                 "ext-json": "*",
2120 2121
                 "github/gfm": "0.29.0",
2121 2122
                 "michelf/php-markdown": "^1.4",
2123
+                "nyholm/psr7": "^1.5",
2122 2124
                 "phpstan/phpstan": "^0.12.88 || ^1.0.0",
2123 2125
                 "phpunit/phpunit": "^9.5.5",
2124 2126
                 "scrutinizer/ocular": "^1.8.1",
@@ -2133,7 +2135,7 @@
2133 2135
             "type": "library",
2134 2136
             "extra": {
2135 2137
                 "branch-alias": {
2136
-                    "dev-main": "2.3-dev"
2138
+                    "dev-main": "2.4-dev"
2137 2139
                 }
2138 2140
             },
2139 2141
             "autoload": {
@@ -2190,7 +2192,7 @@
2190 2192
                     "type": "tidelift"
2191 2193
                 }
2192 2194
             ],
2193
-            "time": "2022-02-26T21:24:45+00:00"
2195
+            "time": "2022-04-07T22:37:05+00:00"
2194 2196
         },
2195 2197
         {
2196 2198
             "name": "league/config",
@@ -2276,16 +2278,16 @@
2276 2278
         },
2277 2279
         {
2278 2280
             "name": "league/flysystem",
2279
-            "version": "3.0.13",
2281
+            "version": "3.0.15",
2280 2282
             "source": {
2281 2283
                 "type": "git",
2282 2284
                 "url": "https://github.com/thephpleague/flysystem.git",
2283
-                "reference": "15dc1ccb2db8daef507c4d3e501565bae42a9f0e"
2285
+                "reference": "3b71cd136dc0331ee87b636b25f4ee339368c718"
2284 2286
             },
2285 2287
             "dist": {
2286 2288
                 "type": "zip",
2287
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/15dc1ccb2db8daef507c4d3e501565bae42a9f0e",
2288
-                "reference": "15dc1ccb2db8daef507c4d3e501565bae42a9f0e",
2289
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3b71cd136dc0331ee87b636b25f4ee339368c718",
2290
+                "reference": "3b71cd136dc0331ee87b636b25f4ee339368c718",
2289 2291
                 "shasum": ""
2290 2292
             },
2291 2293
             "require": {
@@ -2346,7 +2348,7 @@
2346 2348
             ],
2347 2349
             "support": {
2348 2350
                 "issues": "https://github.com/thephpleague/flysystem/issues",
2349
-                "source": "https://github.com/thephpleague/flysystem/tree/3.0.13"
2351
+                "source": "https://github.com/thephpleague/flysystem/tree/3.0.15"
2350 2352
             },
2351 2353
             "funding": [
2352 2354
                 {
@@ -2362,7 +2364,7 @@
2362 2364
                     "type": "tidelift"
2363 2365
                 }
2364 2366
             ],
2365
-            "time": "2022-04-02T08:55:13+00:00"
2367
+            "time": "2022-04-08T18:36:06+00:00"
2366 2368
         },
2367 2369
         {
2368 2370
             "name": "league/mime-type-detection",
@@ -2784,16 +2786,16 @@
2784 2786
         },
2785 2787
         {
2786 2788
             "name": "monolog/monolog",
2787
-            "version": "2.4.0",
2789
+            "version": "2.5.0",
2788 2790
             "source": {
2789 2791
                 "type": "git",
2790 2792
                 "url": "https://github.com/Seldaek/monolog.git",
2791
-                "reference": "d7fd7450628561ba697b7097d86db72662f54aef"
2793
+                "reference": "4192345e260f1d51b365536199744b987e160edc"
2792 2794
             },
2793 2795
             "dist": {
2794 2796
                 "type": "zip",
2795
-                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef",
2796
-                "reference": "d7fd7450628561ba697b7097d86db72662f54aef",
2797
+                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4192345e260f1d51b365536199744b987e160edc",
2798
+                "reference": "4192345e260f1d51b365536199744b987e160edc",
2797 2799
                 "shasum": ""
2798 2800
             },
2799 2801
             "require": {
@@ -2867,7 +2869,7 @@
2867 2869
             ],
2868 2870
             "support": {
2869 2871
                 "issues": "https://github.com/Seldaek/monolog/issues",
2870
-                "source": "https://github.com/Seldaek/monolog/tree/2.4.0"
2872
+                "source": "https://github.com/Seldaek/monolog/tree/2.5.0"
2871 2873
             },
2872 2874
             "funding": [
2873 2875
                 {
@@ -2879,7 +2881,7 @@
2879 2881
                     "type": "tidelift"
2880 2882
                 }
2881 2883
             ],
2882
-            "time": "2022-03-14T12:44:37+00:00"
2884
+            "time": "2022-04-08T15:43:54+00:00"
2883 2885
         },
2884 2886
         {
2885 2887
             "name": "myclabs/php-enum",
@@ -4236,16 +4238,16 @@
4236 4238
         },
4237 4239
         {
4238 4240
             "name": "symfony/deprecation-contracts",
4239
-            "version": "v3.0.0",
4241
+            "version": "v3.0.1",
4240 4242
             "source": {
4241 4243
                 "type": "git",
4242 4244
                 "url": "https://github.com/symfony/deprecation-contracts.git",
4243
-                "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced"
4245
+                "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c"
4244 4246
             },
4245 4247
             "dist": {
4246 4248
                 "type": "zip",
4247
-                "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
4248
-                "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
4249
+                "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
4250
+                "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
4249 4251
                 "shasum": ""
4250 4252
             },
4251 4253
             "require": {
@@ -4283,7 +4285,7 @@
4283 4285
             "description": "A generic function and convention to trigger deprecation notices",
4284 4286
             "homepage": "https://symfony.com",
4285 4287
             "support": {
4286
-                "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0"
4288
+                "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1"
4287 4289
             },
4288 4290
             "funding": [
4289 4291
                 {
@@ -4299,7 +4301,7 @@
4299 4301
                     "type": "tidelift"
4300 4302
                 }
4301 4303
             ],
4302
-            "time": "2021-11-01T23:48:49+00:00"
4304
+            "time": "2022-01-02T09:55:41+00:00"
4303 4305
         },
4304 4306
         {
4305 4307
             "name": "symfony/error-handler",
@@ -4457,16 +4459,16 @@
4457 4459
         },
4458 4460
         {
4459 4461
             "name": "symfony/event-dispatcher-contracts",
4460
-            "version": "v3.0.0",
4462
+            "version": "v3.0.1",
4461 4463
             "source": {
4462 4464
                 "type": "git",
4463 4465
                 "url": "https://github.com/symfony/event-dispatcher-contracts.git",
4464
-                "reference": "aa5422287b75594b90ee9cd807caf8f0df491385"
4466
+                "reference": "7bc61cc2db649b4637d331240c5346dcc7708051"
4465 4467
             },
4466 4468
             "dist": {
4467 4469
                 "type": "zip",
4468
-                "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/aa5422287b75594b90ee9cd807caf8f0df491385",
4469
-                "reference": "aa5422287b75594b90ee9cd807caf8f0df491385",
4470
+                "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051",
4471
+                "reference": "7bc61cc2db649b4637d331240c5346dcc7708051",
4470 4472
                 "shasum": ""
4471 4473
             },
4472 4474
             "require": {
@@ -4516,7 +4518,7 @@
4516 4518
                 "standards"
4517 4519
             ],
4518 4520
             "support": {
4519
-                "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.0"
4521
+                "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1"
4520 4522
             },
4521 4523
             "funding": [
4522 4524
                 {
@@ -4532,7 +4534,7 @@
4532 4534
                     "type": "tidelift"
4533 4535
                 }
4534 4536
             ],
4535
-            "time": "2021-07-15T12:33:35+00:00"
4537
+            "time": "2022-01-02T09:55:41+00:00"
4536 4538
         },
4537 4539
         {
4538 4540
             "name": "symfony/finder",
@@ -5737,16 +5739,16 @@
5737 5739
         },
5738 5740
         {
5739 5741
             "name": "symfony/service-contracts",
5740
-            "version": "v3.0.0",
5742
+            "version": "v3.0.1",
5741 5743
             "source": {
5742 5744
                 "type": "git",
5743 5745
                 "url": "https://github.com/symfony/service-contracts.git",
5744
-                "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603"
5746
+                "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c"
5745 5747
             },
5746 5748
             "dist": {
5747 5749
                 "type": "zip",
5748
-                "url": "https://api.github.com/repos/symfony/service-contracts/zipball/36715ebf9fb9db73db0cb24263c79077c6fe8603",
5749
-                "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603",
5750
+                "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c",
5751
+                "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c",
5750 5752
                 "shasum": ""
5751 5753
             },
5752 5754
             "require": {
@@ -5799,7 +5801,7 @@
5799 5801
                 "standards"
5800 5802
             ],
5801 5803
             "support": {
5802
-                "source": "https://github.com/symfony/service-contracts/tree/v3.0.0"
5804
+                "source": "https://github.com/symfony/service-contracts/tree/v3.0.1"
5803 5805
             },
5804 5806
             "funding": [
5805 5807
                 {
@@ -5815,7 +5817,7 @@
5815 5817
                     "type": "tidelift"
5816 5818
                 }
5817 5819
             ],
5818
-            "time": "2021-11-04T17:53:12+00:00"
5820
+            "time": "2022-03-13T20:10:05+00:00"
5819 5821
         },
5820 5822
         {
5821 5823
             "name": "symfony/string",
@@ -5999,16 +6001,16 @@
5999 6001
         },
6000 6002
         {
6001 6003
             "name": "symfony/translation-contracts",
6002
-            "version": "v3.0.0",
6004
+            "version": "v3.0.1",
6003 6005
             "source": {
6004 6006
                 "type": "git",
6005 6007
                 "url": "https://github.com/symfony/translation-contracts.git",
6006
-                "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77"
6008
+                "reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9"
6007 6009
             },
6008 6010
             "dist": {
6009 6011
                 "type": "zip",
6010
-                "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77",
6011
-                "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77",
6012
+                "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9",
6013
+                "reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9",
6012 6014
                 "shasum": ""
6013 6015
             },
6014 6016
             "require": {
@@ -6057,7 +6059,7 @@
6057 6059
                 "standards"
6058 6060
             ],
6059 6061
             "support": {
6060
-                "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0"
6062
+                "source": "https://github.com/symfony/translation-contracts/tree/v3.0.1"
6061 6063
             },
6062 6064
             "funding": [
6063 6065
                 {
@@ -6073,7 +6075,7 @@
6073 6075
                     "type": "tidelift"
6074 6076
                 }
6075 6077
             ],
6076
-            "time": "2021-09-07T12:43:40+00:00"
6078
+            "time": "2022-01-02T09:55:41+00:00"
6077 6079
         },
6078 6080
         {
6079 6081
             "name": "symfony/var-dumper",
@@ -6165,16 +6167,16 @@
6165 6167
         },
6166 6168
         {
6167 6169
             "name": "tightenco/ziggy",
6168
-            "version": "v1.4.5",
6170
+            "version": "v1.4.6",
6169 6171
             "source": {
6170 6172
                 "type": "git",
6171 6173
                 "url": "https://github.com/tighten/ziggy.git",
6172
-                "reference": "d3c74474f624ab80b7fb4e3e264e62bb4043eee2"
6174
+                "reference": "a9e0e078ae6f0768836bc640a80f4cf99fa3d08f"
6173 6175
             },
6174 6176
             "dist": {
6175 6177
                 "type": "zip",
6176
-                "url": "https://api.github.com/repos/tighten/ziggy/zipball/d3c74474f624ab80b7fb4e3e264e62bb4043eee2",
6177
-                "reference": "d3c74474f624ab80b7fb4e3e264e62bb4043eee2",
6178
+                "url": "https://api.github.com/repos/tighten/ziggy/zipball/a9e0e078ae6f0768836bc640a80f4cf99fa3d08f",
6179
+                "reference": "a9e0e078ae6f0768836bc640a80f4cf99fa3d08f",
6178 6180
                 "shasum": ""
6179 6181
             },
6180 6182
             "require": {
@@ -6226,9 +6228,9 @@
6226 6228
             ],
6227 6229
             "support": {
6228 6230
                 "issues": "https://github.com/tighten/ziggy/issues",
6229
-                "source": "https://github.com/tighten/ziggy/tree/v1.4.5"
6231
+                "source": "https://github.com/tighten/ziggy/tree/v1.4.6"
6230 6232
             },
6231
-            "time": "2022-03-25T22:36:59+00:00"
6233
+            "time": "2022-04-08T15:12:23+00:00"
6232 6234
         },
6233 6235
         {
6234 6236
             "name": "tijsverkoyen/css-to-inline-styles",
@@ -6811,16 +6813,16 @@
6811 6813
         },
6812 6814
         {
6813 6815
             "name": "laravel/sail",
6814
-            "version": "v1.13.8",
6816
+            "version": "v1.13.9",
6815 6817
             "source": {
6816 6818
                 "type": "git",
6817 6819
                 "url": "https://github.com/laravel/sail.git",
6818
-                "reference": "b00f1b64afff9c16355d23bb1e0f83a7ea9bbb7e"
6820
+                "reference": "7bb294fe99fc42c3b1bee83fb667cd7698b3c385"
6819 6821
             },
6820 6822
             "dist": {
6821 6823
                 "type": "zip",
6822
-                "url": "https://api.github.com/repos/laravel/sail/zipball/b00f1b64afff9c16355d23bb1e0f83a7ea9bbb7e",
6823
-                "reference": "b00f1b64afff9c16355d23bb1e0f83a7ea9bbb7e",
6824
+                "url": "https://api.github.com/repos/laravel/sail/zipball/7bb294fe99fc42c3b1bee83fb667cd7698b3c385",
6825
+                "reference": "7bb294fe99fc42c3b1bee83fb667cd7698b3c385",
6824 6826
                 "shasum": ""
6825 6827
             },
6826 6828
             "require": {
@@ -6867,7 +6869,7 @@
6867 6869
                 "issues": "https://github.com/laravel/sail/issues",
6868 6870
                 "source": "https://github.com/laravel/sail"
6869 6871
             },
6870
-            "time": "2022-03-23T12:35:34+00:00"
6872
+            "time": "2022-04-04T15:21:51+00:00"
6871 6873
         },
6872 6874
         {
6873 6875
             "name": "mockery/mockery",
@@ -7002,16 +7004,16 @@
7002 7004
         },
7003 7005
         {
7004 7006
             "name": "nunomaduro/collision",
7005
-            "version": "v6.1.0",
7007
+            "version": "v6.2.0",
7006 7008
             "source": {
7007 7009
                 "type": "git",
7008 7010
                 "url": "https://github.com/nunomaduro/collision.git",
7009
-                "reference": "df09e21a5e5d5a7d51a8b9ecd44d3dd150d97fec"
7011
+                "reference": "c379636dc50e829edb3a8bcb944a01aa1aed8f25"
7010 7012
             },
7011 7013
             "dist": {
7012 7014
                 "type": "zip",
7013
-                "url": "https://api.github.com/repos/nunomaduro/collision/zipball/df09e21a5e5d5a7d51a8b9ecd44d3dd150d97fec",
7014
-                "reference": "df09e21a5e5d5a7d51a8b9ecd44d3dd150d97fec",
7015
+                "url": "https://api.github.com/repos/nunomaduro/collision/zipball/c379636dc50e829edb3a8bcb944a01aa1aed8f25",
7016
+                "reference": "c379636dc50e829edb3a8bcb944a01aa1aed8f25",
7015 7017
                 "shasum": ""
7016 7018
             },
7017 7019
             "require": {
@@ -7022,10 +7024,10 @@
7022 7024
             },
7023 7025
             "require-dev": {
7024 7026
                 "brianium/paratest": "^6.4.1",
7025
-                "laravel/framework": "^9.0",
7027
+                "laravel/framework": "^9.7",
7026 7028
                 "nunomaduro/larastan": "^1.0.2",
7027 7029
                 "nunomaduro/mock-final-classes": "^1.1.0",
7028
-                "orchestra/testbench": "^7.0.0",
7030
+                "orchestra/testbench": "^7.3.0",
7029 7031
                 "phpunit/phpunit": "^9.5.11"
7030 7032
             },
7031 7033
             "type": "library",
@@ -7085,7 +7087,7 @@
7085 7087
                     "type": "patreon"
7086 7088
                 }
7087 7089
             ],
7088
-            "time": "2022-01-18T17:49:08+00:00"
7090
+            "time": "2022-04-05T15:31:38+00:00"
7089 7091
         },
7090 7092
         {
7091 7093
             "name": "phar-io/manifest",

+ 3
- 3
resources/views/excel/mutation-report.blade.php View File

@@ -33,15 +33,15 @@
33 33
         </tr>
34 34
         <tr>
35 35
             <td colspan="3">Pendapatan</td>
36
-            <td>{{ App\Models\Mutation::totalIncomeAsString($mutations) }}</td>
36
+            <td>{{ (new App\Services\MutationService)->totalIncomeAsString($mutations) }}</td>
37 37
         </tr>
38 38
         <tr>
39 39
             <td colspan="3">Pengeluran</td>
40
-            <td>{{ App\Models\Mutation::totalExpenseAsString($mutations) }}</td>
40
+            <td>{{ (new App\Services\MutationService)->totalExpenseAsString($mutations) }}</td>
41 41
         </tr>
42 42
         <tr>
43 43
             <td colspan="3">Jumlah</td>
44
-            <td>{{ App\Models\Mutation::totalAmount($mutations) }}</td>
44
+            <td>{{ (new App\Services\MutationService)->totalAmount($mutations) }}</td>
45 45
         </tr>
46 46
     </tbody>
47 47
 </table>

+ 2
- 2
resources/views/excel/transaction-report.blade.php View File

@@ -22,7 +22,7 @@
22 22
                     <td>{{ ++$index }}</td>
23 23
                     <td>{{ $transaction['createdAt'] }}</td>
24 24
                     <td>{{ $transaction['totalTransaction'] }}</td>
25
-                    <td>{{ (new App\Services\CurrencyFormatService)->setRupiahFormat($transaction['totalPrice'], 0, true) }}</td>
25
+                    <td>{{ (new App\Services\CurrencyFormatService)->setRupiahFormat($transaction['totalPrice'], true) }}</td>
26 26
                 </tr>
27 27
             @endforeach
28 28
         @endforeach
@@ -32,7 +32,7 @@
32 32
         <tr>
33 33
             <td colspan="2">Transaksi / Nilai</td>
34 34
             <td>{{ $transactions->sum('totalTransaction') }}</td>
35
-            <td>{{ (new App\Services\CurrencyFormatService)->setRupiahFormat($transactions->sum('totalPrice'), 0, true)  }}</td>
35
+            <td>{{ (new App\Services\CurrencyFormatService)->setRupiahFormat($transactions->sum('totalPrice'), true) }}</td>
36 36
         </tr>
37 37
     </tbody>
38 38
 </table>