Browse Source

fix: mutation

Muhammad Iqbal Afandi 3 years ago
parent
commit
1204c4b955
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      app/Http/Controllers/TransactionController.php

+ 2
- 2
app/Http/Controllers/TransactionController.php View File

@@ -175,13 +175,13 @@ class TransactionController extends Controller
175 175
             if ($request->discount) {
176 176
                 $transaction->mutation()->create([
177 177
                     'type' => 1,
178
-                    'amount' => $transaction->totalPrice() < 0 ? $transaction->subTotal() : $transaction->totalPrice(),
178
+                    'amount' => $transaction->totalPrice(),
179 179
                     'outlet_id' => $request->user()->outlet_id,
180 180
                 ]);
181 181
 
182 182
                 $transaction->mutation()->create([
183 183
                     'type' => 2,
184
-                    'amount' => $transaction->totalPrice() < 0 ? $transaction->subTotal() : $transaction->totalPrice(),
184
+                    'amount' => $transaction->totalDiscountGiven(),
185 185
                     'outlet_id' => $request->user()->outlet_id,
186 186
                 ]);
187 187
             } else {