浏览代码

fix_rcjhz_tiaojia

Xiaopeng Zhang 5 月之前
父节点
当前提交
18cd80d162
共有 2 个文件被更改,包括 146 次插入62 次删除
  1. 3 1
      README
  2. 143 61
      subdir/db.py

+ 3 - 1
README

@@ -7,12 +7,14 @@ Feature
 可以对人材机补充(安装的时候用来补充主材)
 可以选择附注
 可以选择替换预拌砂浆
+对于人材机汇总表,可以改价格(不包括安装费用的子目
+对于费率表,可以改费率
 
 导入功能
 附注disable
 预拌砂浆disable
 补充enable这个功能
-安装费用有两套体系
+安装费用用单位是元的另外一套体系
 
 TODO
 套定额不能套重复的定额,因为我们是以定额编码做key的

+ 143 - 61
subdir/db.py

@@ -1656,7 +1656,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
             continue
         children = post["__children"]
         qdsl = post['数量']
-        hit = False
+        hit = False##清单级别
         for entry in children:###对一条定额,调价
             hitde = False
             dercj = entry["dercj"]
@@ -1672,7 +1672,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
                     rcj[5] = jiage
                     hanliang = rcj[10]
                     rcj[11] = str(float(jiage) * float(hanliang))
-                if int(rcj[8]) == 1:
+                if int(rcj[8]) == 1:##rcjlb
                     dergf = dergf + float(rcj[11])
                 elif int(rcj[8]) == 2:
                     declf = declf + float(rcj[11])
@@ -1680,63 +1680,145 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
                         dezcf = dezcf + float(rcj[11])
                 elif int(rcj[8]) == 3:
                     dejxf = dejxf + float(rcj[11])
-                if hitde:
-                    entry['人工费'] = str(dergf)
-                    entry['辅材费'] = str(declf - dezcf)
-                    entry['主材费'] = str(dezcf)
-                    entry['材料费'] = str(declf)
-                    entry['机械费'] = str(dejxf)
-                    if bm.startswith("D"):
-                        entry['管理费'] = '0'
-                        entry['利润'] = '0'
-                    elif bz == 0:
-                        entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
-                        entry['利润'] =   str((dergf + dejxf) * float(lr) / float(100))
-                    else:
-                        entry['管理费'] = str((dergf) * float(glf) / float(100))
-                        entry['利润'] =   str((dergf) * float(lr) / float(100))
-                    entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
-                    entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
+            if hitde:
+                entry['人工费'] = str(dergf)
+                entry['辅材费'] = str(declf - dezcf)
+                entry['主材费'] = str(dezcf)
+                entry['材料费'] = str(declf)
+                entry['机械费'] = str(dejxf)
+                if bm.startswith("D"):
+                    entry['管理费'] = '0'
+                    entry['利润'] = '0'
+                elif bz == 0:
+                    entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
+                    entry['利润'] =   str((dergf + dejxf) * float(lr) / float(100))
+                else:
+                    entry['管理费'] = str((dergf) * float(glf) / float(100))
+                    entry['利润'] =   str((dergf) * float(lr) / float(100))
+                entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
+                entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
         if hit:
             ##调整清单
             qdrcj = post['rcj']
-            qdrgf = 0
-            qdclf = 0
-            qdzcf = 0
-            qdjxf = 0
             for i in range(1, len(qdrcj)):
                 entry = qdrcj[i]
                 if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
                     entry[5] = jiage
                     hanliang = entry[10]
                     entry[11] = str(float(jiage) * float(hanliang))
-                if int(entry[8]) == 1:
-                    qdrgf = qdrgf + float(entry[11])
-                elif int(entry[8]) == 2:
-                    qdclf = qdclf + float(entry[11])
-                    if entry[14] == 'true':
-                        qdzcf = qdzcf + float(entry[11])
-                elif int(entry[8]) == 3:
-                    qdjxf = qdjxf + float(entry[11])
-            post['人工费'] = str(qdrgf)
-            post['辅材费'] = str(qdclf - qdzcf)
-            post['主材费'] = str(qdzcf)
-            post['材料费'] = str(qdclf)
-            post['机械费'] = str(qdjxf)
+            post['综合单价'] = 0
+            post['合价'] = 0
+            post['人工费'] = 0
+            post['主材费'] = 0
+            post['设备费'] = 0
+            post['辅材费'] = 0
+            post['材料费'] = 0
+            post['机械费'] = 0
             post['管理费'] = 0
             post['利润'] = 0
-            for entry in children:
-                post['管理费'] = post['管理费'] + float(entry['管理费']) * float(entry['数量'])
-                post['利润'] = post['利润'] + float(entry['利润']) * float(entry['数量'])
-            post['管理费'] =  str(post['管理费'])
-            post['利润'] = str(post['利润'])
-
-            post['综合单价'] = str(float(post['人工费']) + float(post['材料费']) + float(post['机械费']) + float(post['管理费']) + float(post['利润']))
-            post['合价'] = str(float(post['综合单价']) * float(qdsl))
-            ##print(post)
+            for i in range(len(post["__children"])):
+                if len(post["__children"][i]['azfytag']) > 0:
+                    continue
+                post['综合单价'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['综合单价'])
+                post['合价'] += float(post['__children'][i]['合价'])
+                post['人工费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['人工费'])
+                post['主材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['主材费'])
+                post['设备费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['设备费'])
+                post['辅材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['辅材费'])
+                post['材料费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['材料费'])
+                post['机械费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['机械费'])
+                post['管理费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['管理费'])
+                post['利润'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['利润'])
+            
+            ##处理安装费用
+            ##console.log(qd["_children"].length);
+            for i in range(len(post["__children"])):
+                ##console.log(i);
+                if len(post["__children"][i]['azfytag']) > 0:
+                    tag = post["__children"][i]['azfytag']
+                    if tag[0] == '人工费':
+                       current_rgf = post['人工费']
+                       added = float(current_rgf) * float(tag[1]) / float(100)
+                       added_rgf = added * float(tag[2]) / float(100)
+                       added_clf = added * float(tag[3]) / float(100)
+                       added_jxf = added * float(tag[4]) / float(100)
+                       post["__children"][i]['人工费'] = added_rgf
+                       post["__children"][i]['辅材费'] = added_clf
+                       post["__children"][i]['材料费'] = added_clf
+                       post["__children"][i]['机械费'] = added_jxf
+                       if bz == 0:
+                           ##changuiqufei
+                           post["__children"][i]['管理费'] = (added_rgf + added_jxf) * float(glf) / float(100)
+                           post["__children"][i]['利润'] = (added_rgf + added_jxf) * float(lr) / float(100)
+                       else:
+                           post["__children"][i]['管理费'] = (added_rgf) * float(glf) / float(100)
+                           post["__children"][i]['利润'] = (added_rgf) * float(lr) / float(100)
+                       
+                       
+                       post["__children"][i]['综合单价'] = post["__children"][i]['人工费'] + post["__children"][i]['材料费'] + post["__children"][i]['机械费'] + post["__children"][i]['管理费'] +  post["__children"][i]['利润']
+                       post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post['数量'])
+                       dercj = post["__children"][i]['dercj']
+                       for j in range(1, len(dercj)):
+                           dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
+                       
+                    
+                    if tag[0] == '人工费+机械费':
+                       current_rgf = post['人工费'] + post['机械费']
+                       added = float(current_rgf) * float(tag[1]) / float(100)
+                       added_rgf = added * float(tag[2]) / float(100)
+                       added_clf = added * float(tag[3]) / float(100)
+                       added_jxf = added * float(tag[4]) / float(100)
+                       post["__children"][i]['人工费'] = added_rgf
+                       post["__children"][i]['辅材费'] = added_clf
+                       post["__children"][i]['材料费'] = added_clf
+                       post["__children"][i]['机械费'] = added_jxf
+                       if bz == 0:
+                           ###changuiqufei
+                           post["__children"][i]['管理费'] = (added_rgf + added_jxf) * float(glf) / float(100)
+                           post["__children"][i]['利润'] = (added_rgf + added_jxf) * float(lr) / float(100)
+                       else:
+                           post["__children"][i]['管理费'] = (added_rgf) * float(glf) / float(100)
+                           post["__children"][i]['利润'] = (added_rgf) * float(lr) / float(100)
+                       
+                       
+                       post["__children"][i]['综合单价'] = post["__children"][i]['人工费'] + post["__children"][i]['材料费'] + post["__children"][i]['机械费'] + post["__children"][i]['管理费'] +  post["__children"][i]['利润']
+                       post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post["数量"])
+                       dercj = post["__children"][i]['dercj']
+                       for j in range(1, len(dercj)):
+                           dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
+                       
+                    
+                
+            
+            post['综合单价'] = 0
+            post['合价'] = 0
+            post['人工费'] = 0
+            post['主材费'] = 0
+            post['设备费'] = 0
+            post['辅材费'] = 0
+            post['材料费'] = 0
+            post['机械费'] = 0
+            post['管理费'] = 0
+            post['利润'] = 0
+            for i in range(len(post["__children"])):
+                post['综合单价'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['综合单价'])
+                post['合价'] += float(post['__children'][i]['合价'])
+                post['人工费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['人工费'])
+                post['主材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['主材费'])
+                post['设备费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['设备费'])
+                post['辅材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['辅材费'])
+                post['材料费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['材料费'])
+                post['机械费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['机械费'])
+                post['管理费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['管理费'])
+                post['利润'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['利润'])
+                
+         
             await collection.replace_one({'_id': post['_id']}, post )
     collection = db["Djcs"]
     async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}):
+        if "__children" not in post:
+            ##print(post)
+            continue
         children = post["__children"]
         qdsl = post['数量']
         hit = False
@@ -1760,22 +1842,22 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
                     declf = declf + float(rcj[11])
                 elif int(rcj[8]) == 3:
                     dejxf = dejxf + float(rcj[11])
-                if hitde:
-                    entry['人工费'] = str(dergf)
-                    entry['辅材费'] = str(declf)
-                    entry['材料费'] = str(declf)
-                    entry['机械费'] = str(dejxf)
-                    if bm.startswith("D"):
-                        entry['管理费'] = '0'
-                        entry['利润'] = '0'  
-                    elif bz == 0:
-                        entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
-                        entry['利润'] =   str((dergf + dejxf) * float(lr) / float(100))
-                    else:
-                        entry['管理费'] = str((dergf) * float(glf) / float(100))
-                        entry['利润'] =   str((dergf) * float(lr) / float(100))
-                    entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
-                    entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
+            if hitde:
+                entry['人工费'] = str(dergf)
+                entry['辅材费'] = str(declf)
+                entry['材料费'] = str(declf)
+                entry['机械费'] = str(dejxf)
+                if bm.startswith("D"):
+                    entry['管理费'] = '0'
+                    entry['利润'] = '0'  
+                elif bz == 0:
+                    entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
+                    entry['利润'] =   str((dergf + dejxf) * float(lr) / float(100))
+                else:
+                    entry['管理费'] = str((dergf) * float(glf) / float(100))
+                    entry['利润'] =   str((dergf) * float(lr) / float(100))
+                entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
+                entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
         if hit:
             ##调整清单
             qdrcj = post['rcj']