Explorar el Código

feat: 修改设备购置

zhangweicheng hace 4 años
padre
commit
f5cf6b4570

+ 1 - 1
public/web/sheet/sheet_common.js

@@ -198,7 +198,7 @@ var sheetCommonObj = {
                         val =scMathUtil.roundToString(val,decimal);
                         sheet.setFormatter(-1, col,getFormatter(decimal), GC.Spread.Sheets.SheetArea.viewport);
                     }else {
-                        val =scMathUtil.roundToString(val,2);
+                        //val =scMathUtil.roundToString(val,2);
                     }
                 }
                 if(val!=null && setting.header[col].cellType == "checkBox"){

+ 2 - 1
web/building_saas/main/html/main.html

@@ -73,11 +73,12 @@
         </li>
         <li class="nav-item"><a data-toggle="tab" href="#project_glj" id="tab_project_glj" data-name="tab_project_glj"
             role="tab">人材机汇总</a></li>
+            <li class="nav-item"><a data-toggle="tab" href="#equipment_purchase" id="tab_equipment_purchase" role="tab">设备购置</a></li>
         <li class="nav-item"><a data-toggle="tab" href="#fee_rates" id="tab_fee_rate" role="tab">费率</a></li>
         <li class="nav-item"><a data-toggle="tab" href="#calc_program_manage" id="tab_calc_program_manage" role="tab"
             style="display:none">总计算程序</a></li>
         <li class="nav-item"><a data-toggle="tab" href="#tender_price" id="tab_tender_price" role="tab" style="display:none">调价</a></li>
-     <li class="nav-item"><a data-toggle="tab" href="#equipment_purchase" id="tab_equipment_purchase" role="tab">设备购置</a></li>
+     
               <li class="nav-item"><a data-toggle="tab" href="#gather_fees" id="tab_gather_fees" role="tab">费用汇总</a></li>
         <li class="nav-item"><a data-toggle="tab" href="#reports" role="tab" id="tab_report"
             onclick="rptTplObj.iniPage();">报表</a></li>

+ 37 - 25
web/building_saas/main/js/views/equipment_purchase_view.js

@@ -6,20 +6,22 @@ let equipmentPurchaseObj  = {
     parentMap:{},
     setting:{
         header: [
-            {headerName: "编号", headerWidth: 160, dataCode: "code", dataType: "String",formatter: "@",spanRows: [2]},
-            {headerName: "设备名称", headerWidth: 200, dataCode: "name", dataType: "String",spanRows: [2]},
-            {headerName: "单位", headerWidth: 60, dataCode: "unit",  dataType: "String",hAlign: "center",cellType:'comboBox',editable:true,options:unitOptions,spanRows: [2]},
-            {headerName: ["设备价格","设备原价"], headerWidth: 160, dataCode: "originalPrice", hAlign: "right", dataType: "Number",validator:'number',spanCols: [4,1]},
-            {headerName: ["","设备运杂费"], headerWidth: 160, dataCode: "freight", hAlign: "right", dataType: "Number",validator:'number',spanCols: [0,1]},
-            {headerName: ["","备品备件费"], headerWidth: 160, dataCode: "sparePartCost", hAlign: "right", dataType: "Number",validator:'number',spanCols: [0,1]},
-            {headerName: ["","单价"], headerWidth: 160, dataCode: "unitPrice", hAlign: "right", dataType: "Number",validator:'number',spanCols: [0,1]},
-            {headerName: "数量", headerWidth: 160, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:'number',spanRows: [2]},
-            {headerName: "合价", headerWidth: 160, dataCode: "totalPrice", hAlign: "right", dataType: "Number",spanRows: [2]},
+            {headerName: "编码", headerWidth: 160, dataCode: "code", dataType: "String",formatter: "@"},
+            {headerName: "设备名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 60, dataCode: "unit",  dataType: "String",hAlign: "center",cellType:'comboBox',editable:true,options:unitOptions},
+            {headerName: "数量", headerWidth: 100, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "原价", headerWidth: 100, dataCode: "originalPrice", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "运杂费费率(%)", headerWidth: 100, dataCode: "freightRate", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "运杂费", headerWidth: 100, dataCode: "freight", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "备品备件购置费\n费率(%)", headerWidth: 130, dataCode: "sparePartCostRate", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "备品备件购置费", headerWidth: 100, dataCode: "sparePartCost", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "单价", headerWidth: 100, dataCode: "unitPrice", hAlign: "right", dataType: "Number",validator:'number'},
+            {headerName: "合价", headerWidth: 100, dataCode: "totalPrice", hAlign: "right", dataType: "Number"},
+            {headerName: "备注", headerWidth: 100, dataCode: "remark", dataType: "String"},
         ],
-        headRows:2,
         view: {
-            lockColumns: ["totalPrice",'unitPrice'],
-            rowHeaderWidth:40,
+            lockColumns: ["totalPrice",'unitPrice','freight','sparePartCost'],
+            colHeaderHeight:40,
         }
     
     },
@@ -144,6 +146,7 @@ let equipmentPurchaseObj  = {
         let treeData = this.getTreeData();
 
         this.data = treeData;
+        console.log(data);
         sheetCommonObj.showTreeData(this.sheet, this.setting,treeData);
         this.checkBtn();
         $('#equipment_total').text(this.sourceData.total);
@@ -178,7 +181,7 @@ let equipmentPurchaseObj  = {
             return me.showData();
         }
         let data = {doc:{},ID:equipment.ID};
-        if(dataCode == 'quantity' || dataCode == 'originalPrice'|| dataCode == 'freight'|| dataCode == 'sparePartCost'){
+        if(dataCode == 'quantity' || dataCode == 'originalPrice'|| dataCode == 'freightRate'|| dataCode == 'sparePartCostRate'){
             value = me.calcTotalPrice(value,dataCode,data.doc,equipment);
         }
         if(equipment[dataCode] == value) return me.showData();
@@ -205,7 +208,7 @@ let equipmentPurchaseObj  = {
             let newChildren = temParentMap[d.ID];
             if((children&&children.length > 0) || (newChildren && newChildren.length > 0)){
               let totalPrice = getTotalPrice(d.ID);
-              if(d.totalPrice !== totalPrice) updateData.push({ID:d.ID,doc: {totalPrice,unitPrice:'',sparePartCost:'',freight:'',originalPrice:'',quantity:''} })  
+              if(d.totalPrice !== totalPrice) updateData.push({ID:d.ID,doc: {totalPrice,unitPrice:'',sparePartCost:'',sparePartCostRate:'',freight:'',freightRate:'',originalPrice:'',quantity:''} })  
             }
 
             
@@ -249,13 +252,15 @@ let equipmentPurchaseObj  = {
     calcTotalPrice:function(newValue = 0,dataCode,doc,equipment){   
         //设备原价
         let originalPrice = equipment.originalPrice?scMathUtil.roundForObj(equipment.originalPrice,getDecimal('glj.unitPrice')):0;
-        //设备运杂费
-        let freight = equipment.freight?scMathUtil.roundForObj(equipment.freight,getDecimal('glj.unitPrice')):0;
-        //备品备件费
-        let sparePartCost = equipment.sparePartCost?scMathUtil.roundForObj(equipment.sparePartCost,getDecimal('glj.quantity')):0;
+        //设备运杂费费率
+        let freightRate = equipment.freightRate?scMathUtil.roundForObj(equipment.freightRate,getDecimal('feeRate')):0;
+        //备品备件费费率
+        let sparePartCostRate = equipment.sparePartCostRate?scMathUtil.roundForObj(equipment.sparePartCostRate,getDecimal('feeRate')):0;
         let quantity = equipment.quantity?scMathUtil.roundForObj(equipment.quantity,getDecimal('glj.quantity')):0;
         
         let unitPrice = 0;
+        let freight = 0;
+        let sparePartCost = 0;
 
         if(gljUtil.isDef(doc.originalPrice)) originalPrice = doc.originalPrice;
         if(gljUtil.isDef(doc.freight)) freight = doc.freight;
@@ -269,17 +274,24 @@ let equipmentPurchaseObj  = {
             newValue =  scMathUtil.roundForObj(newValue,getDecimal('glj.unitPrice'));
             originalPrice = newValue;
         }
-        if(dataCode === 'freight') {
-            newValue =  scMathUtil.roundForObj(newValue,getDecimal('glj.unitPrice'));
-            freight = newValue;
+        if(dataCode === 'freightRate') {
+            newValue =  scMathUtil.roundForObj(newValue,getDecimal('feeRate'));
+            freightRate = newValue;
         }
-        if(dataCode === 'sparePartCost') {
-            newValue =  scMathUtil.roundForObj(newValue,getDecimal('glj.unitPrice'));
-            sparePartCost = newValue;
+        if(dataCode === 'sparePartCostRate') {
+            newValue =  scMathUtil.roundForObj(newValue,getDecimal('feeRate'));
+            sparePartCostRate = newValue;
         }
         
+        //运杂费 =  原价*运杂费费率(%)*0.01
+        freight = scMathUtil.roundForObj(originalPrice * freightRate * 0.01,getDecimal('glj.unitPrice'));
+        // 备品备件费 = 原价*备品备件购置费费率(%)*0.01
+        sparePartCost = scMathUtil.roundForObj(originalPrice * sparePartCostRate * 0.01,getDecimal('glj.unitPrice'));
+
         unitPrice = scMathUtil.roundForObj(originalPrice + freight,getDecimal('process'));
         unitPrice = scMathUtil.roundForObj(unitPrice + sparePartCost,getDecimal('glj.unitPrice'));
+        doc.freight = freight;
+        doc.sparePartCost = sparePartCost;
         doc.unitPrice = unitPrice;
         doc.totalPrice = scMathUtil.roundForObj(quantity * unitPrice,getDecimal('glj.unitPrice'));
         return newValue;
@@ -317,7 +329,7 @@ let equipmentPurchaseObj  = {
                 return ;
             }
             let tem = updateMap[equipment.ID]?updateMap[equipment.ID]:{};
-            if(dataCode == 'quantity' || dataCode == 'originalPrice'|| dataCode == 'freight'|| dataCode == 'sparePartCost'){
+            if(dataCode == 'quantity' || dataCode == 'originalPrice'|| dataCode == 'freightRate'|| dataCode == 'sparePartCostRate'){
                 value = me.calcTotalPrice(value,dataCode,tem,equipment);
             } 
             tem[dataCode] = value;