zhangweicheng před 5 roky
rodič
revize
f7d81a458d

+ 2 - 1
modules/all_models/std_glj.js

@@ -42,7 +42,8 @@ const std_glj = new Schema({
     materialIndexType:String,//工料指标类别
     materialIndexUnit:String,//工料指标单位
     materialIndexCoe:Number,//单位转换系数
-    component: [std_gljComponent]
+    component: [std_gljComponent],
+    taxRate:String//税率
 },{versionKey: false});
 
 mongoose.model('std_glj_lib_gljList', std_glj, 'std_glj_lib_gljList');

+ 1 - 1
modules/glj/controllers/glj_controller.js

@@ -85,7 +85,7 @@ class GLJController extends BaseController {
         };
         try {
             // 可编辑的字段
-            let editableField = ['is_evaluate', 'unit_price.market_price', 'is_adjust_price', 'mix_ratio.consumption','is_eval_material','no_tax_eqp','is_coe_adjust','is_info_adjust','FI','FO','standardPrice','riskCoe',
+            let editableField = ['is_evaluate','unit_price.taxRate', 'unit_price.market_price', 'is_adjust_price', 'mix_ratio.consumption','is_eval_material','no_tax_eqp','is_coe_adjust','is_info_adjust','FI','FO','standardPrice','riskCoe',
                 'supply', 'supply_quantity','delivery_address','delivery','materialType','materialCoe','is_main_material','originPlace','vender','qualityGrace','brand','remark'];
             if (editableField.indexOf(field) < 0) {
                 throw '对应字段不能编辑';

+ 1 - 0
modules/glj/models/unit_price_model.js

@@ -113,6 +113,7 @@ class UnitPriceModel extends BaseModel {
             code: data.code,
             base_price: data.base_price,
             market_price: data.market_price,
+            taxRate:data.taxRate,
             unit_price_file_id: unitPriceFileId,
             name: data.name,
             specs:data.specs,

+ 1 - 0
modules/main/facade/ration_facade.js

@@ -455,6 +455,7 @@ async function addRationGLJ(std,newRation,compilation) {
                 newGLJ.model = std_glj.model;
                 newGLJ.basePrice = std_glj.basePrice;
                 newGLJ.marketPrice = std_glj.basePrice;
+                newGLJ.taxRate= std_glj.taxRate;
                 newGLJ.shortName = std_glj.shortName;
                 newGLJ.type = std_glj.gljType;
                 newGLJ.repositoryId = std_glj.repositoryId;

+ 4 - 0
modules/ration_glj/facade/ration_glj_facade.js

@@ -136,6 +136,7 @@ function get_lib_glj_info(ration_glj) {
                 ration_glj.specs = glj.specs;
                 ration_glj.basePrice = glj.basePrice;
                 ration_glj.marketPrice = glj.basePrice;
+                ration_glj.taxRate = glj.taxRate;
                 ration_glj.shortName = glj.shortName;
                 ration_glj.type = glj.gljType;
                 ration_glj.repositoryId = glj.repositoryId;
@@ -605,6 +606,7 @@ function getGLJSearchInfo(ration_glj) {
         type_of_work: ration_glj.subType ? ration_glj.subType : ration_glj.type,
         base_price: ration_glj.basePrice,
         market_price: ration_glj.marketPrice,
+        taxRate:ration_glj.taxRate,//税率
         repositoryId: ration_glj.repositoryId,
         adjCoe: ration_glj.adjCoe,
         materialType:ration_glj.materialType,
@@ -766,6 +768,7 @@ async function updateRationGLJFromDoc(rg,doc,priceInfo) {
     }
     projectGLJ.base_price = priceInfo.base_price;
     projectGLJ.market_price = priceInfo.market_price;
+    projectGLJ.taxRate = priceInfo.taxRate;
     let projcetGLJ_n = await gljListModel.modifyGLJ(projectGLJ, rg);
     doc.code = projcetGLJ_n.code;
     doc.projectGLJID = projcetGLJ_n.id;
@@ -795,6 +798,7 @@ async function doRationGLJUpdate(data) {
     doc.basePrice = projcetGLJ_n.unit_price.base_price;
     doc.marketPrice = projcetGLJ_n.unit_price.market_price;
     doc.adjustPrice = projcetGLJ_n.adjust_price;
+    doc.taxRate = projcetGLJ_n.unit_price.taxRate;
     doc.isAdd = projcetGLJ_n.unit_price.is_add;
     resutl.doc = doc;
     let stateResult = await glj_calculate_facade.calculateQuantity({

+ 7 - 2
web/building_saas/main/js/models/project_glj.js

@@ -481,11 +481,16 @@ ProjectGLJ.prototype.batchUpdateConsumption = function (updateData,updateMap,cal
 
 ProjectGLJ.prototype.pGljUpdate= function (data,callback) {
     let me = this;
+    let glj = me.getByID(data.id);
+    if(data.field == 'taxRate'){
+        data.field = "unit_price.taxRate";
+        data.id = glj.unit_price.id;
+    }
     $.bootstrapLoading.start();
     CommonAjax.specialPost( '/glj/update',data,function (result) {
-        let glj = me.getByID(data.id);//更新缓存
         let impactList = [];
-        glj[data.field] = data.value;
+        _.set(glj,data.field,data.value);//更新缓存
+       // glj[data.field] = data.value;
         if(data.extend&&data.extend!=""){
             let extend = JSON.parse(data.extend);
             for (let key in extend) {

+ 4 - 1
web/building_saas/main/js/models/ration_glj.js

@@ -437,7 +437,8 @@ let ration_glj = {
             };
             let priceInfo = {
                 base_price: recode.basePrice,
-                market_price: recode.marketPrice
+                market_price: recode.marketPrice,
+                taxRate:recode.taxRate
             };
             if(updateData['type'] != undefined || updateData['type'] != null){
                 updateData.shortName = projectObj.project.projectGLJ.getShortNameByID(updateData['type']);
@@ -622,6 +623,7 @@ let ration_glj = {
                         model:glj.model,
                         basePrice: glj.basePrice,
                         marketPrice:glj.basePrice,
+                        taxRate:glj.taxRate,
                         original_code: glj.code,
                         shortName: glj.shortName,
                         serialNo: serialNo,
@@ -704,6 +706,7 @@ let ration_glj = {
                 specs: glj.specs,
                 basePrice: glj.basePrice,
                 marketPrice:glj.basePrice,
+                taxRate:glj.taxRate,
                 shortName: glj.shortName,
                 type: glj.gljType,
                 model:glj.model,

+ 3 - 0
web/building_saas/main/js/views/glj_col.js

@@ -2,6 +2,7 @@
  * Created by zhang on 2018/7/3.
  */
 let gljCol = {
+    showTaxRate:false,
     ration_glj_setting: {
         header: [
             {headerName: "编码", headerWidth: 110, dataCode: "code", dataType: "String", formatter: "@"},
@@ -42,6 +43,7 @@ let gljCol = {
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String",spanRows: [2]},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String",spanRows: [2]},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2]},//,decimalField:"glj.unitPrice"
+            {headerName: "税率", headerWidth: 70, dataCode: "taxRate", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2]},//,decimalField:"glj.unitPrice"
             {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",spanRows: [2]},//,decimalField:"glj.unitPrice"
             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2]},//decimalField:'glj.unitPrice',
             {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',spanRows: [2]},
@@ -245,6 +247,7 @@ let gljCol = {
             me.removeCol('adjustPrice',me.project_glj_setting);
             me.removeCol('adjustPrice',me.mixRatio_Setting);
         };
+        if(me.showTaxRate == false)  me.removeCol('taxRate',me.project_glj_setting);
         me.showTenderFields(showTenderFields, false);
 
         gljOprObj.setting = me.ration_glj_setting;

+ 1 - 0
web/building_saas/main/js/views/glj_view.js

@@ -800,6 +800,7 @@ var gljOprObj = {
             data.basePrice =  result.basePrice;
             data.adjustPrice = result.adjustPrice;
             data.marketUnitFee = data.marketPrice;//更新树节点市场单价列的值
+            data.taxRate = glj.unit_price.taxRate;//税率
         }
         return data;
 

+ 14 - 17
web/building_saas/main/js/views/project_glj_view.js

@@ -271,30 +271,24 @@ let projectGljObject={
         }
         let dataCode = setting.header[col].dataCode;
         let lockColumns = setting.view.lockColumns;
-
-        if(lockColumns.indexOf(col)!= -1){
-            return false;
-        }
+        if(lockColumns.indexOf(col)!= -1) return false;
 
         if(isPaste == false &&(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='is_main_material'||dataCode == 'is_eval_material'||dataCode=='no_tax_eqp')){//除了粘贴,拖动填充等操作,其它的都不能编辑
             return false;
         }
         if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
-            if (data.ratio_data  && data.ratio_data.length > 0){
-                return false;
-            }
-            if(dataCode=='basePrice'&&data.is_add!=1){//如果不是新增,定额价不可修改。
-                return false;
-            }
+            if (data.ratio_data  && data.ratio_data.length > 0)  return false;
+            if(dataCode=='basePrice'&&data.is_add!=1)   return false;//如果不是新增,定额价不可修改。
         }
-        if(dataCode == 'supply_quantity'){
-            if (data.supply != 1) {// 如果为部分甲供则甲供数量需要可编辑,其它的都不能编辑
-                return false;
-            }
+        if(dataCode == 'supply_quantity' && data.supply != 1) return false;// 如果为部分甲供则甲供数量需要可编辑,其它的都不能编辑
+
+        if(dataCode == 'materialCoe') {//三材类别为空时,三材系数应只读,不允许输入。
+            if (data.materialType == undefined || data.materialType == null || data.materialType == '') return false;
         }
-        if(dataCode == 'materialCoe'){//三材类别为空时,三材系数应只读,不允许输入。
-            if(data.materialType == undefined || data.materialType == null||data.materialType==''){
-                return false;
+        if(dataCode == 'taxRate') {
+            //普通材料、商品混凝土、商品砂浆、机械组成物、主材、设备才能编辑
+            if(!_.includes([gljType.GENERAL_MATERIAL,gljType.COMMERCIAL_CONCRETE,gljType.COMMERCIAL_MORTAR,gljType.MACHINE_COMPOSITION,gljType.MAIN_MATERIAL,gljType.EQUIPMENT],data.type)){
+                return false
             }
         }
 
@@ -737,6 +731,7 @@ let projectGljObject={
             vender:glj.vender,
             qualityGrace:glj.qualityGrace,
             brand:glj.brand,
+            unitPriceID:glj.unit_price.id,
             remark:glj.remark
         };
         gljOprObj.setGLJPrice(data,glj);
@@ -979,6 +974,8 @@ let projectGljObject={
             if(dataCode == 'materialCoe'){
                 value = scMathUtil.roundForObj(value,getDecimal("material"));
             }
+            if(dataCode == 'taxRate') value = scMathUtil.roundToString(value,2);
+
             extend = Object.keys(extend).length > 0 ?  JSON.stringify(extend) : '';
             if(recode[dataCode] == value) return;
 

+ 4 - 0
web/over_write/js/guangdong_2018.js

@@ -126,3 +126,7 @@ if (typeof module !== 'undefined') {
         };
     }
 }
+
+if(typeof gljCol !== 'undefined'){
+    gljCol.showTaxRate = true;
+}