瀏覽代碼

fix: mutation

Muhammad Iqbal Afandi 3 年之前
父節點
當前提交
1204c4b955
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      app/Http/Controllers/TransactionController.php

+ 2
- 2
app/Http/Controllers/TransactionController.php 查看文件

@@ -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 {