ソースを参照

fix: sale master

コミット
aabfeb7ef6
共有2 個のファイルを変更した6 個の追加8 個の削除を含む
  1. 2
    2
      app/Models/SaleDetail.php
  2. 4
    6
      resources/js/pages/Sales/Composables/useCart.js

+ 2
- 2
app/Models/SaleDetail.php ファイルの表示

20
                 $ppn = Ppn::first()->ppn;
20
                 $ppn = Ppn::first()->ppn;
21
 
21
 
22
                 return $this->sale->ppn
22
                 return $this->sale->ppn
23
-                    ? HelperService::addPPN($value, $ppn)
24
-                    : $value;
23
+                    ? HelperService::addPPN($value, $ppn) * $this->qty
24
+                    : $value * $this->qty;
25
             }
25
             }
26
         );
26
         );
27
     }
27
     }

+ 4
- 6
resources/js/pages/Sales/Composables/useCart.js ファイルの表示

1
 import { reactive } from 'vue'
1
 import { reactive } from 'vue'
2
-import { FormValidationError } from '@/utils/helpers'
2
+import { FormValidationError, ppn } from '@/utils/helpers'
3
 
3
 
4
 export function useCart(form, initialProducts = []) {
4
 export function useCart(form, initialProducts = []) {
5
   const cart = reactive(initialProducts)
5
   const cart = reactive(initialProducts)
83
 
83
 
84
   const totalCartPrice = () => {
84
   const totalCartPrice = () => {
85
     const itemPrices = cart.map((product) => {
85
     const itemPrices = cart.map((product) => {
86
-      if (form.checkedPpn) {
87
-        return product.price + product.price * (form.ppn / 100)
88
-      } else {
89
-        return product.price
90
-      }
86
+      return form.checkedPpn
87
+        ? ppn(product.price, form.ppn) * product.qty
88
+        : product.price * product.qty
91
     })
89
     })
92
 
90
 
93
     return itemPrices.reduce(
91
     return itemPrices.reduce(