aXin-0810 1 tahun lalu
induk
melakukan
a2520ef192
1 mengubah file dengan 25 tambahan dan 32 penghapusan
  1. 25 32
      src/views/salesPurchasing/mixins/storage_goods.js

+ 25 - 32
src/views/salesPurchasing/mixins/storage_goods.js

@@ -183,24 +183,20 @@ export default {
                             row['unit'] = res?.unit
                             row['stockQty'] = res?.stockQty
                             row['insideQty'] =
-                              [
-                                0,
-                                0,
-                                0,
-                                ...res.items.filter(item => item.type === 'INSIDE').map(item => item.qty)
-                              ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
                             row['outQty'] =
-                              [0, 0, 0, ...res.items.filter(item => item.type === 'OUT').map(item => item.qty)].reduce(
-                                (accumulator, currentValue) => accumulator + currentValue,
-                                0
-                              ) * Number(row?.qty)
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
                             row['partsQty'] =
-                              [
-                                0,
-                                0,
-                                0,
-                                ...res.items.filter(item => item.type === 'PARTS').map(item => item.qty)
-                              ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
                           }
                         })
                       } else {
@@ -276,25 +272,22 @@ export default {
                         res => {
                           if (this.formDialogType == 0) {
                             row['insideQty'] =
-                              [
-                                0,
-                                0,
-                                0,
-                                ...res.items.filter(item => item.type === 'INSIDE').map(item => item.qty)
-                              ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
                               row[column.columnAttributes.prop]
                             row['outQty'] =
-                              [0, 0, 0, ...res.items.filter(item => item.type === 'OUT').map(item => item.qty)].reduce(
-                                (accumulator, currentValue) => accumulator + currentValue,
-                                0
-                              ) * row[column.columnAttributes.prop]
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
                             row['partsQty'] =
-                              [
-                                0,
-                                0,
-                                0,
-                                ...res.items.filter(item => item.type === 'PARTS').map(item => item.qty)
-                              ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
                               row[column.columnAttributes.prop]
                           }
                         }