Muhammad Iqbal Afandi il y a 4 ans
Parent
révision
9672d036d1

+ 2
- 0
app/Exports/TransactionExport.php Voir le fichier

55
             4 => [
55
             4 => [
56
                 'font' => ['bold' => true],
56
                 'font' => ['bold' => true],
57
             ],
57
             ],
58
+            'C' => ['alignment' => ['horizontal' => 'left']],
59
+            'D' => ['alignment' => ['horizontal' => 'left']],
58
             $lastRow => [
60
             $lastRow => [
59
                 'font' => ['bold' => true, 'size' => 12],
61
                 'font' => ['bold' => true, 'size' => 12],
60
                 'alignment' => ['horizontal' => 'left'],
62
                 'alignment' => ['horizontal' => 'left'],

+ 1
- 1
app/Http/Controllers/DiscountController.php Voir le fichier

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

+ 3
- 1
app/Http/Controllers/ReportTransactionController.php Voir le fichier

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

+ 0
- 4
app/Http/Controllers/ThermalPrintingController.php Voir le fichier

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

+ 19
- 8
app/Http/Controllers/TransactionController.php Voir le fichier

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
             // $transaction = Transaction::with(['outlet', 'customer', 'transactionDetails.laundry'])->latest()->first();
183
             // $transaction = Transaction::with(['outlet', 'customer', 'transactionDetails.laundry'])->latest()->first();
173
 
184
 

app/Http/Requests/StoreDiscountRequest.php → app/Http/Requests/Discount/StoreDiscountRequest.php Voir le fichier

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

+ 5
- 5
app/Models/Expense.php Voir le fichier

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
-use App\Models\Helpers\CurrencyFormat;
6
 use App\Models\Mutation;
5
 use App\Models\Mutation;
7
 use App\Models\Outlet;
6
 use App\Models\Outlet;
8
 use App\Models\User;
7
 use App\Models\User;
8
+use App\Services\CurrencyFormatService;
9
 use Carbon\Carbon;
9
 use Carbon\Carbon;
10
 use Illuminate\Database\Eloquent\Casts\Attribute;
10
 use Illuminate\Database\Eloquent\Casts\Attribute;
11
 use Illuminate\Database\Eloquent\Factories\HasFactory;
11
 use Illuminate\Database\Eloquent\Factories\HasFactory;
13
 
13
 
14
 class Expense extends Model
14
 class Expense extends Model
15
 {
15
 {
16
-    use HasFactory, CurrencyFormat;
16
+    use HasFactory;
17
 
17
 
18
     protected $fillable = [
18
     protected $fillable = [
19
         'description',
19
         'description',
22
         'outlet_id',
22
         'outlet_id',
23
     ];
23
     ];
24
 
24
 
25
-    public function createdAt(): Attribute
25
+    protected function createdAt(): Attribute
26
     {
26
     {
27
         return Attribute::make(
27
         return Attribute::make(
28
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
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
         return Attribute::make(
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 Voir le fichier

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 Voir le fichier

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 Voir le fichier

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
-use App\Models\Helpers\CurrencyFormat;
5
+use App\Services\CurrencyFormatService;
6
 use Illuminate\Database\Eloquent\Casts\Attribute;
6
 use Illuminate\Database\Eloquent\Casts\Attribute;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8
 use Illuminate\Database\Eloquent\Model;
8
 use Illuminate\Database\Eloquent\Model;
9
 
9
 
10
 class Laundry extends Model
10
 class Laundry extends Model
11
 {
11
 {
12
-    use HasFactory, CurrencyFormat;
12
+    use HasFactory;
13
 
13
 
14
     protected $fillable = [
14
     protected $fillable = [
15
         'name',
15
         'name',
34
     protected function price(): Attribute
34
     protected function price(): Attribute
35
     {
35
     {
36
         return Attribute::make(
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 Voir le fichier

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
-use App\Models\Helpers\CurrencyFormat;
6
-use App\Models\Helpers\HasMutation;
5
+use App\Services\CurrencyFormatService;
7
 use Carbon\Carbon;
6
 use Carbon\Carbon;
8
 use Illuminate\Database\Eloquent\Casts\Attribute;
7
 use Illuminate\Database\Eloquent\Casts\Attribute;
9
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8
 use Illuminate\Database\Eloquent\Factories\HasFactory;
11
 
10
 
12
 class Mutation extends Model
11
 class Mutation extends Model
13
 {
12
 {
14
-    use HasFactory, CurrencyFormat, HasMutation;
13
+    use HasFactory;
15
 
14
 
16
     protected $fillable = [
15
     protected $fillable = [
17
         'type',
16
         'type',
21
         'expense_id',
20
         'expense_id',
22
     ];
21
     ];
23
 
22
 
24
-    public function createdAt(): Attribute
23
+    protected function createdAt(): Attribute
25
     {
24
     {
26
         return Attribute::make(
25
         return Attribute::make(
27
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
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
         return Attribute::make(
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
         return Attribute::make(
45
         return Attribute::make(
42
             get:fn($value) => $value == 1 ? __('words.income') : __('words.expense')
46
             get:fn($value) => $value == 1 ? __('words.income') : __('words.expense')

+ 3
- 3
app/Models/Product.php Voir le fichier

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
-use App\Models\Helpers\CurrencyFormat;
5
+use App\Services\CurrencyFormatService;
6
 use Illuminate\Database\Eloquent\Casts\Attribute;
6
 use Illuminate\Database\Eloquent\Casts\Attribute;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8
 use Illuminate\Database\Eloquent\Model;
8
 use Illuminate\Database\Eloquent\Model;
9
 
9
 
10
 class Product extends Model
10
 class Product extends Model
11
 {
11
 {
12
-    use HasFactory, CurrencyFormat;
12
+    use HasFactory;
13
 
13
 
14
     protected $fillable = [
14
     protected $fillable = [
15
         'name',
15
         'name',
34
     protected function price(): Attribute
34
     protected function price(): Attribute
35
     {
35
     {
36
         return Attribute::make(
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 Voir le fichier

3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
 use App\Models\Customer;
5
 use App\Models\Customer;
6
-use App\Models\Helpers\CurrencyFormat;
7
 use App\Models\Mutation;
6
 use App\Models\Mutation;
8
 use App\Models\Outlet;
7
 use App\Models\Outlet;
9
 use App\Models\TransactionDetail;
8
 use App\Models\TransactionDetail;
10
 use App\Models\TransactionStatus;
9
 use App\Models\TransactionStatus;
11
 use App\Models\User;
10
 use App\Models\User;
11
+use App\Services\CurrencyFormatService;
12
 use Carbon\Carbon;
12
 use Carbon\Carbon;
13
 use Illuminate\Database\Eloquent\Casts\Attribute;
13
 use Illuminate\Database\Eloquent\Casts\Attribute;
14
 use Illuminate\Database\Eloquent\Factories\HasFactory;
14
 use Illuminate\Database\Eloquent\Factories\HasFactory;
16
 
16
 
17
 class Transaction extends Model
17
 class Transaction extends Model
18
 {
18
 {
19
-    use HasFactory, CurrencyFormat;
19
+    use HasFactory;
20
 
20
 
21
     protected $fillable = [
21
     protected $fillable = [
22
         'transaction_number',
22
         'transaction_number',
27
         'outlet_id',
27
         'outlet_id',
28
     ];
28
     ];
29
 
29
 
30
-    public function createdAt(): Attribute
30
+    protected function createdAt(): Attribute
31
     {
31
     {
32
         return Attribute::make(
32
         return Attribute::make(
33
             get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
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
         return Attribute::make(
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
         });
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
             $price = $transactionDetail->getRawOriginal('price') * $transactionDetail->quantity;
96
             $price = $transactionDetail->getRawOriginal('price') * $transactionDetail->quantity;
97
             return $price - $price * ($transactionDetail->getRawOriginal('discount') / 100);
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 Voir le fichier

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
-use App\Models\Helpers\CurrencyFormat;
6
 use App\Models\Laundry;
5
 use App\Models\Laundry;
7
 use App\Models\Product;
6
 use App\Models\Product;
8
 use App\Models\Transaction;
7
 use App\Models\Transaction;
8
+use App\Services\CurrencyFormatService;
9
 use Illuminate\Database\Eloquent\Casts\Attribute;
9
 use Illuminate\Database\Eloquent\Casts\Attribute;
10
 use Illuminate\Database\Eloquent\Factories\HasFactory;
10
 use Illuminate\Database\Eloquent\Factories\HasFactory;
11
 use Illuminate\Database\Eloquent\Model;
11
 use Illuminate\Database\Eloquent\Model;
12
 
12
 
13
 class TransactionDetail extends Model
13
 class TransactionDetail extends Model
14
 {
14
 {
15
-    use HasFactory, CurrencyFormat;
15
+    use HasFactory;
16
 
16
 
17
     protected $fillable = [
17
     protected $fillable = [
18
         'price',
18
         'price',
26
     protected function price(): Attribute
26
     protected function price(): Attribute
27
     {
27
     {
28
         return Attribute::make(
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
 
62
 
63
     public function totalPriceAsString()
63
     public function totalPriceAsString()
64
     {
64
     {
65
-        return $this->setRupiahFormat($this->totalPrice());
65
+        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice());
66
     }
66
     }
67
 
67
 
68
     public function totalPriceAsFullString()
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 Voir le fichier

4
 
4
 
5
 class CurrencyFormatService
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
         if ($sign) {
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
         } else {
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 Voir le fichier

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 Voir le fichier

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

+ 2
- 3
app/Services/TransactionService.php Voir le fichier

24
 
24
 
25
     public function totalPrice(Collection $collections)
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
     public function totalPriceGroup(Collection $collections)
30
     public function totalPriceGroup(Collection $collections)
35
 
34
 
36
     public function totalPriceGroupAsString(Collection $collections)
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 Voir le fichier

1719
         },
1719
         },
1720
         {
1720
         {
1721
             "name": "laravel/framework",
1721
             "name": "laravel/framework",
1722
-            "version": "v9.6.0",
1722
+            "version": "v9.7.0",
1723
             "source": {
1723
             "source": {
1724
                 "type": "git",
1724
                 "type": "git",
1725
                 "url": "https://github.com/laravel/framework.git",
1725
                 "url": "https://github.com/laravel/framework.git",
1726
-                "reference": "47940a1a8774b96696ed57e6736ccea4a880c057"
1726
+                "reference": "54c9696ee3e558ab29317ed6e0cb16bb9db5aad4"
1727
             },
1727
             },
1728
             "dist": {
1728
             "dist": {
1729
                 "type": "zip",
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
                 "shasum": ""
1732
                 "shasum": ""
1733
             },
1733
             },
1734
             "require": {
1734
             "require": {
1894
                 "issues": "https://github.com/laravel/framework/issues",
1894
                 "issues": "https://github.com/laravel/framework/issues",
1895
                 "source": "https://github.com/laravel/framework"
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
             "name": "laravel/sanctum",
1900
             "name": "laravel/sanctum",
2090
         },
2090
         },
2091
         {
2091
         {
2092
             "name": "league/commonmark",
2092
             "name": "league/commonmark",
2093
-            "version": "2.2.3",
2093
+            "version": "2.3.0",
2094
             "source": {
2094
             "source": {
2095
                 "type": "git",
2095
                 "type": "git",
2096
                 "url": "https://github.com/thephpleague/commonmark.git",
2096
                 "url": "https://github.com/thephpleague/commonmark.git",
2097
-                "reference": "47b015bc4e50fd4438c1ffef6139a1fb65d2ab71"
2097
+                "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955"
2098
             },
2098
             },
2099
             "dist": {
2099
             "dist": {
2100
                 "type": "zip",
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
                 "shasum": ""
2103
                 "shasum": ""
2104
             },
2104
             },
2105
             "require": {
2105
             "require": {
2108
                 "php": "^7.4 || ^8.0",
2108
                 "php": "^7.4 || ^8.0",
2109
                 "psr/event-dispatcher": "^1.0",
2109
                 "psr/event-dispatcher": "^1.0",
2110
                 "symfony/deprecation-contracts": "^2.1 || ^3.0",
2110
                 "symfony/deprecation-contracts": "^2.1 || ^3.0",
2111
-                "symfony/polyfill-php80": "^1.15"
2111
+                "symfony/polyfill-php80": "^1.16"
2112
             },
2112
             },
2113
             "require-dev": {
2113
             "require-dev": {
2114
                 "cebe/markdown": "^1.0",
2114
                 "cebe/markdown": "^1.0",
2115
                 "commonmark/cmark": "0.30.0",
2115
                 "commonmark/cmark": "0.30.0",
2116
                 "commonmark/commonmark.js": "0.30.0",
2116
                 "commonmark/commonmark.js": "0.30.0",
2117
                 "composer/package-versions-deprecated": "^1.8",
2117
                 "composer/package-versions-deprecated": "^1.8",
2118
+                "embed/embed": "^4.4",
2118
                 "erusev/parsedown": "^1.0",
2119
                 "erusev/parsedown": "^1.0",
2119
                 "ext-json": "*",
2120
                 "ext-json": "*",
2120
                 "github/gfm": "0.29.0",
2121
                 "github/gfm": "0.29.0",
2121
                 "michelf/php-markdown": "^1.4",
2122
                 "michelf/php-markdown": "^1.4",
2123
+                "nyholm/psr7": "^1.5",
2122
                 "phpstan/phpstan": "^0.12.88 || ^1.0.0",
2124
                 "phpstan/phpstan": "^0.12.88 || ^1.0.0",
2123
                 "phpunit/phpunit": "^9.5.5",
2125
                 "phpunit/phpunit": "^9.5.5",
2124
                 "scrutinizer/ocular": "^1.8.1",
2126
                 "scrutinizer/ocular": "^1.8.1",
2133
             "type": "library",
2135
             "type": "library",
2134
             "extra": {
2136
             "extra": {
2135
                 "branch-alias": {
2137
                 "branch-alias": {
2136
-                    "dev-main": "2.3-dev"
2138
+                    "dev-main": "2.4-dev"
2137
                 }
2139
                 }
2138
             },
2140
             },
2139
             "autoload": {
2141
             "autoload": {
2190
                     "type": "tidelift"
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
             "name": "league/config",
2198
             "name": "league/config",
2276
         },
2278
         },
2277
         {
2279
         {
2278
             "name": "league/flysystem",
2280
             "name": "league/flysystem",
2279
-            "version": "3.0.13",
2281
+            "version": "3.0.15",
2280
             "source": {
2282
             "source": {
2281
                 "type": "git",
2283
                 "type": "git",
2282
                 "url": "https://github.com/thephpleague/flysystem.git",
2284
                 "url": "https://github.com/thephpleague/flysystem.git",
2283
-                "reference": "15dc1ccb2db8daef507c4d3e501565bae42a9f0e"
2285
+                "reference": "3b71cd136dc0331ee87b636b25f4ee339368c718"
2284
             },
2286
             },
2285
             "dist": {
2287
             "dist": {
2286
                 "type": "zip",
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
                 "shasum": ""
2291
                 "shasum": ""
2290
             },
2292
             },
2291
             "require": {
2293
             "require": {
2346
             ],
2348
             ],
2347
             "support": {
2349
             "support": {
2348
                 "issues": "https://github.com/thephpleague/flysystem/issues",
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
             "funding": [
2353
             "funding": [
2352
                 {
2354
                 {
2362
                     "type": "tidelift"
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
             "name": "league/mime-type-detection",
2370
             "name": "league/mime-type-detection",
2784
         },
2786
         },
2785
         {
2787
         {
2786
             "name": "monolog/monolog",
2788
             "name": "monolog/monolog",
2787
-            "version": "2.4.0",
2789
+            "version": "2.5.0",
2788
             "source": {
2790
             "source": {
2789
                 "type": "git",
2791
                 "type": "git",
2790
                 "url": "https://github.com/Seldaek/monolog.git",
2792
                 "url": "https://github.com/Seldaek/monolog.git",
2791
-                "reference": "d7fd7450628561ba697b7097d86db72662f54aef"
2793
+                "reference": "4192345e260f1d51b365536199744b987e160edc"
2792
             },
2794
             },
2793
             "dist": {
2795
             "dist": {
2794
                 "type": "zip",
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
                 "shasum": ""
2799
                 "shasum": ""
2798
             },
2800
             },
2799
             "require": {
2801
             "require": {
2867
             ],
2869
             ],
2868
             "support": {
2870
             "support": {
2869
                 "issues": "https://github.com/Seldaek/monolog/issues",
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
             "funding": [
2874
             "funding": [
2873
                 {
2875
                 {
2879
                     "type": "tidelift"
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
             "name": "myclabs/php-enum",
2887
             "name": "myclabs/php-enum",
4236
         },
4238
         },
4237
         {
4239
         {
4238
             "name": "symfony/deprecation-contracts",
4240
             "name": "symfony/deprecation-contracts",
4239
-            "version": "v3.0.0",
4241
+            "version": "v3.0.1",
4240
             "source": {
4242
             "source": {
4241
                 "type": "git",
4243
                 "type": "git",
4242
                 "url": "https://github.com/symfony/deprecation-contracts.git",
4244
                 "url": "https://github.com/symfony/deprecation-contracts.git",
4243
-                "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced"
4245
+                "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c"
4244
             },
4246
             },
4245
             "dist": {
4247
             "dist": {
4246
                 "type": "zip",
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
                 "shasum": ""
4251
                 "shasum": ""
4250
             },
4252
             },
4251
             "require": {
4253
             "require": {
4283
             "description": "A generic function and convention to trigger deprecation notices",
4285
             "description": "A generic function and convention to trigger deprecation notices",
4284
             "homepage": "https://symfony.com",
4286
             "homepage": "https://symfony.com",
4285
             "support": {
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
             "funding": [
4290
             "funding": [
4289
                 {
4291
                 {
4299
                     "type": "tidelift"
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
             "name": "symfony/error-handler",
4307
             "name": "symfony/error-handler",
4457
         },
4459
         },
4458
         {
4460
         {
4459
             "name": "symfony/event-dispatcher-contracts",
4461
             "name": "symfony/event-dispatcher-contracts",
4460
-            "version": "v3.0.0",
4462
+            "version": "v3.0.1",
4461
             "source": {
4463
             "source": {
4462
                 "type": "git",
4464
                 "type": "git",
4463
                 "url": "https://github.com/symfony/event-dispatcher-contracts.git",
4465
                 "url": "https://github.com/symfony/event-dispatcher-contracts.git",
4464
-                "reference": "aa5422287b75594b90ee9cd807caf8f0df491385"
4466
+                "reference": "7bc61cc2db649b4637d331240c5346dcc7708051"
4465
             },
4467
             },
4466
             "dist": {
4468
             "dist": {
4467
                 "type": "zip",
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
                 "shasum": ""
4472
                 "shasum": ""
4471
             },
4473
             },
4472
             "require": {
4474
             "require": {
4516
                 "standards"
4518
                 "standards"
4517
             ],
4519
             ],
4518
             "support": {
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
             "funding": [
4523
             "funding": [
4522
                 {
4524
                 {
4532
                     "type": "tidelift"
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
             "name": "symfony/finder",
4540
             "name": "symfony/finder",
5737
         },
5739
         },
5738
         {
5740
         {
5739
             "name": "symfony/service-contracts",
5741
             "name": "symfony/service-contracts",
5740
-            "version": "v3.0.0",
5742
+            "version": "v3.0.1",
5741
             "source": {
5743
             "source": {
5742
                 "type": "git",
5744
                 "type": "git",
5743
                 "url": "https://github.com/symfony/service-contracts.git",
5745
                 "url": "https://github.com/symfony/service-contracts.git",
5744
-                "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603"
5746
+                "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c"
5745
             },
5747
             },
5746
             "dist": {
5748
             "dist": {
5747
                 "type": "zip",
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
                 "shasum": ""
5752
                 "shasum": ""
5751
             },
5753
             },
5752
             "require": {
5754
             "require": {
5799
                 "standards"
5801
                 "standards"
5800
             ],
5802
             ],
5801
             "support": {
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
             "funding": [
5806
             "funding": [
5805
                 {
5807
                 {
5815
                     "type": "tidelift"
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
             "name": "symfony/string",
5823
             "name": "symfony/string",
5999
         },
6001
         },
6000
         {
6002
         {
6001
             "name": "symfony/translation-contracts",
6003
             "name": "symfony/translation-contracts",
6002
-            "version": "v3.0.0",
6004
+            "version": "v3.0.1",
6003
             "source": {
6005
             "source": {
6004
                 "type": "git",
6006
                 "type": "git",
6005
                 "url": "https://github.com/symfony/translation-contracts.git",
6007
                 "url": "https://github.com/symfony/translation-contracts.git",
6006
-                "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77"
6008
+                "reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9"
6007
             },
6009
             },
6008
             "dist": {
6010
             "dist": {
6009
                 "type": "zip",
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
                 "shasum": ""
6014
                 "shasum": ""
6013
             },
6015
             },
6014
             "require": {
6016
             "require": {
6057
                 "standards"
6059
                 "standards"
6058
             ],
6060
             ],
6059
             "support": {
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
             "funding": [
6064
             "funding": [
6063
                 {
6065
                 {
6073
                     "type": "tidelift"
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
             "name": "symfony/var-dumper",
6081
             "name": "symfony/var-dumper",
6165
         },
6167
         },
6166
         {
6168
         {
6167
             "name": "tightenco/ziggy",
6169
             "name": "tightenco/ziggy",
6168
-            "version": "v1.4.5",
6170
+            "version": "v1.4.6",
6169
             "source": {
6171
             "source": {
6170
                 "type": "git",
6172
                 "type": "git",
6171
                 "url": "https://github.com/tighten/ziggy.git",
6173
                 "url": "https://github.com/tighten/ziggy.git",
6172
-                "reference": "d3c74474f624ab80b7fb4e3e264e62bb4043eee2"
6174
+                "reference": "a9e0e078ae6f0768836bc640a80f4cf99fa3d08f"
6173
             },
6175
             },
6174
             "dist": {
6176
             "dist": {
6175
                 "type": "zip",
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
                 "shasum": ""
6180
                 "shasum": ""
6179
             },
6181
             },
6180
             "require": {
6182
             "require": {
6226
             ],
6228
             ],
6227
             "support": {
6229
             "support": {
6228
                 "issues": "https://github.com/tighten/ziggy/issues",
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
             "name": "tijsverkoyen/css-to-inline-styles",
6236
             "name": "tijsverkoyen/css-to-inline-styles",
6811
         },
6813
         },
6812
         {
6814
         {
6813
             "name": "laravel/sail",
6815
             "name": "laravel/sail",
6814
-            "version": "v1.13.8",
6816
+            "version": "v1.13.9",
6815
             "source": {
6817
             "source": {
6816
                 "type": "git",
6818
                 "type": "git",
6817
                 "url": "https://github.com/laravel/sail.git",
6819
                 "url": "https://github.com/laravel/sail.git",
6818
-                "reference": "b00f1b64afff9c16355d23bb1e0f83a7ea9bbb7e"
6820
+                "reference": "7bb294fe99fc42c3b1bee83fb667cd7698b3c385"
6819
             },
6821
             },
6820
             "dist": {
6822
             "dist": {
6821
                 "type": "zip",
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
                 "shasum": ""
6826
                 "shasum": ""
6825
             },
6827
             },
6826
             "require": {
6828
             "require": {
6867
                 "issues": "https://github.com/laravel/sail/issues",
6869
                 "issues": "https://github.com/laravel/sail/issues",
6868
                 "source": "https://github.com/laravel/sail"
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
             "name": "mockery/mockery",
6875
             "name": "mockery/mockery",
7002
         },
7004
         },
7003
         {
7005
         {
7004
             "name": "nunomaduro/collision",
7006
             "name": "nunomaduro/collision",
7005
-            "version": "v6.1.0",
7007
+            "version": "v6.2.0",
7006
             "source": {
7008
             "source": {
7007
                 "type": "git",
7009
                 "type": "git",
7008
                 "url": "https://github.com/nunomaduro/collision.git",
7010
                 "url": "https://github.com/nunomaduro/collision.git",
7009
-                "reference": "df09e21a5e5d5a7d51a8b9ecd44d3dd150d97fec"
7011
+                "reference": "c379636dc50e829edb3a8bcb944a01aa1aed8f25"
7010
             },
7012
             },
7011
             "dist": {
7013
             "dist": {
7012
                 "type": "zip",
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
                 "shasum": ""
7017
                 "shasum": ""
7016
             },
7018
             },
7017
             "require": {
7019
             "require": {
7022
             },
7024
             },
7023
             "require-dev": {
7025
             "require-dev": {
7024
                 "brianium/paratest": "^6.4.1",
7026
                 "brianium/paratest": "^6.4.1",
7025
-                "laravel/framework": "^9.0",
7027
+                "laravel/framework": "^9.7",
7026
                 "nunomaduro/larastan": "^1.0.2",
7028
                 "nunomaduro/larastan": "^1.0.2",
7027
                 "nunomaduro/mock-final-classes": "^1.1.0",
7029
                 "nunomaduro/mock-final-classes": "^1.1.0",
7028
-                "orchestra/testbench": "^7.0.0",
7030
+                "orchestra/testbench": "^7.3.0",
7029
                 "phpunit/phpunit": "^9.5.11"
7031
                 "phpunit/phpunit": "^9.5.11"
7030
             },
7032
             },
7031
             "type": "library",
7033
             "type": "library",
7085
                     "type": "patreon"
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
             "name": "phar-io/manifest",
7093
             "name": "phar-io/manifest",

+ 3
- 3
resources/views/excel/mutation-report.blade.php Voir le fichier

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

+ 2
- 2
resources/views/excel/transaction-report.blade.php Voir le fichier

22
                     <td>{{ ++$index }}</td>
22
                     <td>{{ ++$index }}</td>
23
                     <td>{{ $transaction['createdAt'] }}</td>
23
                     <td>{{ $transaction['createdAt'] }}</td>
24
                     <td>{{ $transaction['totalTransaction'] }}</td>
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
                 </tr>
26
                 </tr>
27
             @endforeach
27
             @endforeach
28
         @endforeach
28
         @endforeach
32
         <tr>
32
         <tr>
33
             <td colspan="2">Transaksi / Nilai</td>
33
             <td colspan="2">Transaksi / Nilai</td>
34
             <td>{{ $transactions->sum('totalTransaction') }}</td>
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
         </tr>
36
         </tr>
37
     </tbody>
37
     </tbody>
38
 </table>
38
 </table>