瀏覽代碼

fix: mutation

Muhammad Iqbal Afandi 4 年之前
父節點
當前提交
1204c4b955
共有 1 個檔案被更改,包括 2 行新增 和 2 行删除
  1. 2
    2
      app/Http/Controllers/TransactionController.php

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

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