Browse Source

销售报价单-子表计算公式修改

jingbb 1 month ago
parent
commit
58e9fd2b4b

+ 9 - 5
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -942,16 +942,19 @@
         prop.row.tariff = prop.row.tariff == '' || prop.row.tariff === null || !prop.row.tariff ? 0 : prop.row.tariff;
         prop.row.intermediatorCommission =prop.row.intermediatorCommission == '' || prop.row.intermediatorCommission === null || !prop.row.intermediatorCommission? 0: prop.row.intermediatorCommission;
         //计算销售单价
-        if (prop.col.key == 'purchasePrice' || prop.col.key == 'taxRate' || prop.col.key == 'tariff' || prop.col.key == 'discount' || prop.col.key == 'grossMargin' || prop.col.key == 'customerCommision' || prop.col.key == 'intermediatorCommission') {
+        if (prop.col.key == 'purchasePrice' || prop.col.key == 'taxRate' || prop.col.key == 'tariff' ||  prop.col.key == 'grossMargin' || prop.col.key == 'customerCommision' || prop.col.key == 'intermediatorCommission') {
           // var num =((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100);
           var num=(prop.row.purchasePrice * Number(formData.exchangeRate)*(1 + prop.row.tariff / 100))/(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100-prop.row.intermediatorCommission / 100)*(1 + prop.row.taxRate / 100)
           prop.row.salePrice = !isNaN(num) ? num.toFixed(2) : '';
-          prop.row.preDiscountPrice =(prop.row.salePrice/(1-prop.row.discount / 100)).toFixed(2);
+          prop.row.taxPriceOriginal =(prop.row.salePrice/(1-prop.row.discount / 100)).toFixed(2);
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2); //计算金额
             prop.row.purchaseAmount = (prop.row.purchasePrice * prop.row.quantity).toFixed(2);  //计算采购金额
           }
         }
+        if (prop.col.key == 'discount'&& prop.row.taxPriceOriginal ) {
+          prop.row.salePrice = (Number(prop.row.taxPriceOriginal)*(1-prop.row.discount/100)).toFixed(2)
+        }
         //计算金额
         if (prop.col.key == 'quantity'&& prop.row.salePrice && prop.row.quantity) {
           prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
@@ -961,7 +964,8 @@
           prop.row.purchaseAmount = (prop.row.purchasePrice * prop.row.quantity).toFixed(2);
         }
         //计算毛利率/金额
-        if (prop.col.key == 'salePrice') {
+        if (prop.col.key == 'taxPriceOriginal') {
+          prop.row.salePrice = (Number(prop.row.taxPriceOriginal)*(1-prop.row.discount/100)).toFixed(2)
           // var num =1 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100-((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /prop.row.salePrice;
           var num = 1-(prop.row.customerCommision / 100)-(prop.row.intermediatorCommission / 100)-(prop.row.purchasePrice*Number(formData.exchangeRate)*(1 + prop.row.tariff / 100))*(1 + prop.row.tariff / 100)/prop.row.salePrice
           num = (Number(num) * 100).toFixed(2);
@@ -969,7 +973,7 @@
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
           }
-          prop.row.preDiscountPrice =(prop.row.salePrice/(1-prop.row.discount / 100)).toFixed(2);
+          // prop.row.taxPriceOriginal =(prop.row.salePrice/(1-prop.row.discount / 100)).toFixed(2);
         }
         countGrossMargin()
       }
@@ -986,7 +990,7 @@
             //汇率默认为1
             var num =(item.purchasePrice * Number(formData.exchangeRate)*(1 + item.tariff / 100))/(1 - item.grossMargin / 100 - item.customerCommision / 100-item.intermediatorCommission / 100)*(1 + item.taxRate / 100)
             item.salePrice = !isNaN(num) ? num.toFixed(2) : '';
-            item.preDiscountPrice =(item.salePrice/(1-item.discount / 100)).toFixed(2);
+            item.taxPriceOriginal =(item.salePrice/(1-item.discount / 100)).toFixed(2);
             if (item.quantity) {
               item.taxAmount = (item.salePrice * item.quantity).toFixed(2);
             }

+ 6 - 6
src/views/saleCode/quotation/quotationForm.data.ts

@@ -314,18 +314,18 @@ export const saleQuotationFormProductColumns: JVxeColumn[] = [
       defaultValue:'',
     },
     {
-      title: '折前单价(pre discount price)',
-      key: 'preDiscountPrice',
-      type: JVxeTypes.normal,
+      title: '折前单价(taxPriceOriginal)',
+      key: 'taxPriceOriginal',
+      type: JVxeTypes.inputNumber,
       placeholder: '请输入${title}',
-      width:"200px",
+      width:"250px",
       defaultValue:'',
       
     },
     {
-      title: '销售单价(sale price)',
+      title: '折后单价(sale price)',
       key: 'salePrice',
-      type: JVxeTypes.inputNumber,
+      type: JVxeTypes.normal,
       validateRules: [{ required: true, message: '' }],
       placeholder: '请输入${title}',
       width:"200px",