Jelajahi Sumber

计算修正。

Chenshilong 8 tahun lalu
induk
melakukan
6a63442cc8

+ 9 - 2
public/calc_util.js

@@ -22,13 +22,20 @@ let executeObj = {
             base = me.calcBase[calcBaseName];
 
         if (base != null) {
-            let price = 0, tmpSum = 0;
+            let price = 0, aprice = 0, mprice = 0, tmpSum = 0;
             for (let glj of me.treeNode.data.gljList) {
                 if (base.gljTypes.indexOf(glj.type) >= 0) {
                     if (base.calcType == baseCalc){ price = glj["basePrice"];}
                     else if (base.calcType == adjustCalc){price = glj["adjustPrice"];}
                     else if (base.calcType == budgetCalc){price = glj["marketPrice"];}
-                    else if (base.calcType == diffCalc){price = glj["marketPrice"] - glj["adjustPrice"];};
+                    else if (base.calcType == diffCalc){
+                        aprice = glj["adjustPrice"];
+                        if (!aprice) aprice = 0;
+                        mprice = glj["marketPrice"];
+                        if (!mprice) mprice = 0;
+                        price = mprice - aprice;
+                    };
+                    if (!price) price = 0;
                     tmpSum = tmpSum + glj["quantity"] * price;
                 };
             };

+ 2 - 2
test/tmp_data/test_ration_calc/ration_calc_base.js

@@ -75,12 +75,12 @@ let rationCalcBase = [
     },{
         'dispName': '主材费',
         'calcFun': 'budget',
-        'calcType': baseCalc,
+        'calcType': budgetCalc,
         'gljTypes': [gljType.MAIN_MATERIAL]
     },{
         'dispName': '设备费',
         'calcFun': 'budget',
-        'calcType': baseCalc,
+        'calcType': budgetCalc,
         'gljTypes': [gljType.EQUIPMENT]
     }
 ];

+ 7 - 6
web/building_saas/main/js/models/calc_program.js

@@ -122,7 +122,7 @@ let calcTemplates = [
                 feeRateID: 101,
                 expression: "@('3') + @('5') + @('7')",
                 compiledExpr: "",
-                statement: "定额基价人工费",
+                statement: "[定额基价人工费]+[定额基价材料费]+[定额基价机械费]",
                 memo: "渝建发[2014]27号"
             },
             {
@@ -134,7 +134,7 @@ let calcTemplates = [
                 feeRateID: 301,
                 expression: "@('3') + @('5') + @('7')",
                 compiledExpr: "",
-                statement: "定额基价人工费"
+                statement: "[定额基价人工费]+[定额基价材料费]+[定额基价机械费]"
             },
             {
                 ID: "13",
@@ -145,7 +145,7 @@ let calcTemplates = [
                 feeRateID: 701,
                 expression: "@('3') + @('5') + @('7')",
                 compiledExpr: "",
-                statement: "定额基价人工费",
+                statement: "[定额基价人工费]+[定额基价材料费]+[定额基价机械费]",
                 memo: "同定额包干费"
             },
             {
@@ -164,7 +164,8 @@ let calcTemplates = [
                 name: "人工费价差",
                 fieldName: "labourDiff",
                 dispExpr: "[人工费价差]",
-                expression: "base('市场价格人工费') - base('定额基价人工费(调整后)')",
+                // expression: "base('市场价格人工费') - base('定额基价人工费(调整后)')",
+                expression: "base('人工费价差')",
                 compiledExpr: "",
                 statement: "市场价格人工费-调整后的定额人工费(基价)"
             },
@@ -174,7 +175,7 @@ let calcTemplates = [
                 name: "材料费价差",
                 fieldName: "materialDiff",
                 dispExpr: "[材料费价差]",
-                expression: "base('市场价格材料费') - base('定额基价材料费(调整后)')",
+                expression: "base('材料费价差')",
                 compiledExpr: "",
                 statement: "市场价格材料费-定额基价材料费"
             },
@@ -184,7 +185,7 @@ let calcTemplates = [
                 name: "机械费价差",
                 fieldName: "machineDiff",
                 dispExpr: "[机械费价差]",
-                expression: "base('市场价格机械费') - base('定额基价机械费(调整后)')",
+                expression: "base('机械费价差')",
                 compiledExpr: "",
                 statement: "市场价格机械费-调整后的定额基价机械费(基价)"
             },