|
@@ -651,6 +651,9 @@ def roundstr4(input):
|
|
|
b = round(a, 4)
|
|
b = round(a, 4)
|
|
|
return str(b)
|
|
return str(b)
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+###################################build xml file##################################
|
|
|
async def build(client, root, id):
|
|
async def build(client, root, id):
|
|
|
db = client["baojia"]
|
|
db = client["baojia"]
|
|
|
collection = db["jingjibiao"]
|
|
collection = db["jingjibiao"]
|
|
@@ -876,12 +879,6 @@ async def build(client, root, id):
|
|
|
QdxrcjhlMx.set('Zcbz', str(qdmx['rcj'][i][14]))
|
|
QdxrcjhlMx.set('Zcbz', str(qdmx['rcj'][i][14]))
|
|
|
QdxrcjhlMx.set('Sbbz', str(qdmx['rcj'][i][15]))
|
|
QdxrcjhlMx.set('Sbbz', str(qdmx['rcj'][i][15]))
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
########################################Csxm##########################
|
|
########################################Csxm##########################
|
|
|
Csxm = ET.SubElement(Dwgcxx, 'Csxm')
|
|
Csxm = ET.SubElement(Dwgcxx, 'Csxm')
|
|
|
ZjCs = ET.SubElement(Csxm, 'ZjCs')
|
|
ZjCs = ET.SubElement(Csxm, 'ZjCs')
|
|
@@ -986,36 +983,6 @@ async def build(client, root, id):
|
|
|
CsxrcjhlMx.set('Zcbz', str(djcs['rcj'][i][14]))
|
|
CsxrcjhlMx.set('Zcbz', str(djcs['rcj'][i][14]))
|
|
|
CsxrcjhlMx.set('Sbbz', str(djcs['rcj'][i][15]))
|
|
CsxrcjhlMx.set('Sbbz', str(djcs['rcj'][i][15]))
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
########################################Qtxm##########################
|
|
########################################Qtxm##########################
|
|
|
Qtxm = ET.SubElement(Dwgcxx, 'Qtxm')
|
|
Qtxm = ET.SubElement(Dwgcxx, 'Qtxm')
|
|
|
for qtxm_ in qtxm:
|
|
for qtxm_ in qtxm:
|
|
@@ -1100,20 +1067,7 @@ async def build(client, root, id):
|
|
|
RcjhzMx.set('Zgjbz', str(rcjhz[i][15]))
|
|
RcjhzMx.set('Zgjbz', str(rcjhz[i][15]))
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+############################end of build xml file#################################
|
|
|
|
|
|
|
|
async def delete_files(client, id):
|
|
async def delete_files(client, id):
|
|
|
db = client["baojia"]
|
|
db = client["baojia"]
|
|
@@ -1134,10 +1088,6 @@ async def list_files(client):
|
|
|
|
|
|
|
|
def getDwgc(id, Zylb):
|
|
def getDwgc(id, Zylb):
|
|
|
result = []
|
|
result = []
|
|
|
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
|
|
|
|
|
id = id + "Zylb" + Zylb
|
|
id = id + "Zylb" + Zylb
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1327,13 +1277,8 @@ async def getDjcs(client, objectid, id):
|
|
|
collection = db["Djcs"]
|
|
collection = db["Djcs"]
|
|
|
result = []
|
|
result = []
|
|
|
async for post in collection.find({"Dwgcbh": id, "biao_id": objectid}):
|
|
async for post in collection.find({"Dwgcbh": id, "biao_id": objectid}):
|
|
|
- ##post["ID"] = post["_id"]
|
|
|
|
|
del post["_id"]
|
|
del post["_id"]
|
|
|
- ##print( post["rcj"])
|
|
|
|
|
- ## del post["DogNum"]
|
|
|
|
|
result.append(post)
|
|
result.append(post)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
return result
|
|
return result
|
|
|
|
|
|
|
|
async def getDjcsQingdanrcj(client, name, bh, bt, bm):
|
|
async def getDjcsQingdanrcj(client, name, bh, bt, bm):
|
|
@@ -1374,10 +1319,7 @@ async def getQdmx(client, name, bh, bt):
|
|
|
collection = db["qdxm"]
|
|
collection = db["qdxm"]
|
|
|
result = []
|
|
result = []
|
|
|
async for post in collection.find({'biao_id': name, "Dwgcbh": bh, "bt": bt}):
|
|
async for post in collection.find({'biao_id': name, "Dwgcbh": bh, "bt": bt}):
|
|
|
- ##post["ID"] = post["_id"]
|
|
|
|
|
del post["_id"]
|
|
del post["_id"]
|
|
|
- #del post["rcj"]
|
|
|
|
|
- #del post["DogNum"]
|
|
|
|
|
result.append(post)
|
|
result.append(post)
|
|
|
return result
|
|
return result
|
|
|
|
|
|
|
@@ -1431,152 +1373,390 @@ async def searchde(client, zhuanye, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-##################################editor##########################
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-async def updatezjcs(client, id, bh, mc, fl):
|
|
|
|
|
- db = client["baojia"]
|
|
|
|
|
- collection = db["Dwgc"]
|
|
|
|
|
-
|
|
|
|
|
- document = await collection.find_one({'biao_id': id, 'Dwgcbh': bh}, {'rcjhz': 0})
|
|
|
|
|
- zjcs = document['zjcs']
|
|
|
|
|
- for entry in zjcs:
|
|
|
|
|
- if entry['名称'] == mc:
|
|
|
|
|
- entry['费率'] = fl
|
|
|
|
|
- entry['金额'] = str(float(entry['计算基数']) * float(fl) / float(100))
|
|
|
|
|
-
|
|
|
|
|
- await collection.update_one({'biao_id': id, "Dwgcbh": bh}, {'$set': {'zjcs': zjcs}})
|
|
|
|
|
-
|
|
|
|
|
|
|
+##################################editor_code##########################
|
|
|
|
|
+def bjhz_template():
|
|
|
|
|
+ result = []
|
|
|
|
|
+ result.append({'序号': '1', '名称': '分部分项工程', '金额': '0', '暂估价': '0', '类别' : '1', '__children': [
|
|
|
|
|
+ {'序号': '1.1', '名称': '人工费', '金额': '0', '暂估价': '0', '类别' : '1.1'},
|
|
|
|
|
+ {'序号': '1.2', '名称': '材料费', '金额': '0', '暂估价': '0', '类别' : '1.2'},
|
|
|
|
|
+ {'序号': '1.3', '名称': '施工机具使用费', '金额': '0', '暂估价': '0', '类别' : '1.3'},
|
|
|
|
|
+ {'序号': '1.4', '名称': '企业管理费', '金额': '0', '暂估价': '0', '类别' : '1.4'},
|
|
|
|
|
+ {'序号': '1.5', '名称': '利润', '金额': '0', '暂估价': '0', '类别' : '1.5'}
|
|
|
|
|
+ ]})
|
|
|
|
|
+ result.append({'序号': '2', '名称': '措施项目', '金额': '0', '暂估价': '0', '类别' : '2', '__children': [
|
|
|
|
|
+ {'序号': '2.1', '名称': '单价措施项目费', '金额': '0', '暂估价': '0', '类别' : '2.1'},
|
|
|
|
|
+ {'序号': '2.2', '名称': '总价措施项目费', '金额': '0', '暂估价': '0', '类别' : '2.2', '__children' : [
|
|
|
|
|
+ {'序号': '2.2.1', '名称': '其中:安全文明施工措施费', '金额': '0', '暂估价': '0', '类别' : '2.2.1'},]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ]})
|
|
|
|
|
+ result.append({'序号': '3', '名称': '其他项目', '金额': '0', '暂估价': '0', '类别' : '3', '__children': [
|
|
|
|
|
+ {'序号': '3.1', '名称': '其中:暂列金额', '金额': '0', '暂估价': '0', '类别' : '3.1'},
|
|
|
|
|
+ {'序号': '3.2', '名称': '其中:专业工程暂估价', '金额': '0', '暂估价': '0', '类别' : '3.2'},
|
|
|
|
|
+ {'序号': '3.3', '名称': '其中:计日工', '金额': '0', '暂估价': '0', '类别' : '3.3'},
|
|
|
|
|
+ {'序号': '3.4', '名称': '其中:总承包服务费', '金额': '0', '暂估价': '0', '类别' : '3.4'},
|
|
|
|
|
|
|
|
|
|
+ ]})
|
|
|
|
|
+ result.append({'序号': '4', '名称': '规费', '金额': '0', '暂估价': '0', '类别' : '4', })
|
|
|
|
|
+ result.append({'序号': '5', '名称': '税金', '金额': '0', '暂估价': '0', '类别' : '5', })
|
|
|
|
|
+ result.append({'序号': '6', '名称': '工程造价', '金额': '0', '暂估价': '0', '类别' : '6', })
|
|
|
|
|
|
|
|
|
|
+ return result
|
|
|
|
|
|
|
|
|
|
|
|
|
-async def save(client, data):
|
|
|
|
|
|
|
+async def zongjiaDwgc(client, biao_id, bh):
|
|
|
db = client["baojia"]
|
|
db = client["baojia"]
|
|
|
- collection = db["qdxm"]
|
|
|
|
|
- biao_id = None
|
|
|
|
|
- bh = None
|
|
|
|
|
- for entry in data:
|
|
|
|
|
- entry["__children"] = entry["_children"]
|
|
|
|
|
- del entry["_children"]
|
|
|
|
|
- biao_id = entry['biao_id']
|
|
|
|
|
- bh = entry['Dwgcbh']
|
|
|
|
|
- await collection.replace_one({"biao_id": entry["biao_id"], "Dwgcbh": entry["Dwgcbh"], "bt": entry["bt"], "清单编码": entry["清单编码"]}, entry)
|
|
|
|
|
- if not biao_id:
|
|
|
|
|
- return {"result" : "ok"}
|
|
|
|
|
- rcjhz = []
|
|
|
|
|
- async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
- qdrcj = post['rcj'][1:]
|
|
|
|
|
- for entry in qdrcj:
|
|
|
|
|
- print(entry[4])
|
|
|
|
|
- if entry[4] != '%':
|
|
|
|
|
- entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
- rcjhz = rcjhz + qdrcj
|
|
|
|
|
|
|
+ djcs_sum = 0###单价措施汇总
|
|
|
collection = db["Djcs"]
|
|
collection = db["Djcs"]
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
-
|
|
|
|
|
- qdrcj = post['rcj'][1:]
|
|
|
|
|
- for entry in qdrcj:
|
|
|
|
|
- print(entry[4])
|
|
|
|
|
- if entry[4] != '%':
|
|
|
|
|
- entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
- rcjhz = rcjhz + qdrcj
|
|
|
|
|
- newHuizong = util.huizongrcj(rcjhz)
|
|
|
|
|
- collection = db["Dwgc"]
|
|
|
|
|
- await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
|
|
- await zongjiaDwgc(client, biao_id, bh)
|
|
|
|
|
- await tbxx(client, biao_id)
|
|
|
|
|
- return {"result": "ok"}
|
|
|
|
|
-
|
|
|
|
|
-async def savedjcs(client, data):
|
|
|
|
|
- db = client["baojia"]
|
|
|
|
|
- collection = db["Djcs"]
|
|
|
|
|
- biao_id = None
|
|
|
|
|
- bh = None
|
|
|
|
|
- for entry in data:
|
|
|
|
|
- entry["__children"] = entry["_children"]
|
|
|
|
|
- del entry["_children"]
|
|
|
|
|
- biao_id = entry['biao_id']
|
|
|
|
|
- bh = entry['Dwgcbh']
|
|
|
|
|
- await collection.replace_one({"biao_id": entry["biao_id"], "Dwgcbh": entry["Dwgcbh"], "清单编码": entry["清单编码"]}, entry)
|
|
|
|
|
-
|
|
|
|
|
- if not biao_id:
|
|
|
|
|
- return {"result" : "ok"}
|
|
|
|
|
- rcjhz = []
|
|
|
|
|
|
|
+ djcs_sum = djcs_sum + float(post['合价'])
|
|
|
|
|
+
|
|
|
|
|
+ collection = db['Dwgc']
|
|
|
|
|
+ document = await collection.find_one({'biao_id': biao_id, "Dwgcbh": bh}, {'rcjhz': 0})
|
|
|
|
|
+ qdbt = document['qdbt']
|
|
|
|
|
+ qdbt_addition = document['qdbt_addition']
|
|
|
|
|
+ bts = {}
|
|
|
|
|
+ distinguish = True
|
|
|
|
|
+
|
|
|
|
|
+ for item in qdbt_addition:
|
|
|
|
|
+ bts[item['Mc']] = 0
|
|
|
|
|
+
|
|
|
collection = db["qdxm"]
|
|
collection = db["qdxm"]
|
|
|
|
|
+ qd_sum = 0###清单汇总
|
|
|
|
|
+ rgf_sum = 0
|
|
|
|
|
+ clf_sum = 0
|
|
|
|
|
+ jxf_sum = 0
|
|
|
|
|
+ glf_sum = 0
|
|
|
|
|
+ lr_sum = 0
|
|
|
|
|
+ fbrgycl_sum = 0
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
- qdrcj = post['rcj'][1:]
|
|
|
|
|
- for entry in qdrcj:
|
|
|
|
|
- if entry[4] != '%':
|
|
|
|
|
- entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
- rcjhz = rcjhz + qdrcj
|
|
|
|
|
- collection = db["Djcs"]
|
|
|
|
|
- async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
- qdrcj = post['rcj'][1:]
|
|
|
|
|
- for entry in qdrcj:
|
|
|
|
|
- if entry[4] != '%':
|
|
|
|
|
- entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
- rcjhz = rcjhz + qdrcj
|
|
|
|
|
- newHuizong = util.huizongrcj(rcjhz)
|
|
|
|
|
- collection = db["Dwgc"]
|
|
|
|
|
- await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
|
|
- await zongjiaDwgc(client, biao_id, bh)
|
|
|
|
|
- await tbxx(client, biao_id)
|
|
|
|
|
- return {"result": "ok"}
|
|
|
|
|
|
|
+ qd_sum = qd_sum + float(post['合价'])
|
|
|
|
|
+ rgf_sum = rgf_sum + float(post['数量']) * float(post['人工费'])
|
|
|
|
|
+ clf_sum = clf_sum + float(post['数量']) * float(post['材料费'])
|
|
|
|
|
+ jxf_sum = jxf_sum + float(post['数量']) * float(post['机械费'])
|
|
|
|
|
+ glf_sum = glf_sum + float(post['数量']) * float(post['管理费'])
|
|
|
|
|
+ lr_sum = lr_sum + float(post['数量']) * float(post['利润'])
|
|
|
|
|
+ if distinguish and post['bt'] in bts:
|
|
|
|
|
+ bts[post['bt']] = bts[post['bt']] + float(post['合价'])
|
|
|
|
|
|
|
|
-async def applyFL(client, id, data):
|
|
|
|
|
- db = client["baojia"]
|
|
|
|
|
- collection = db["qufei"]
|
|
|
|
|
-
|
|
|
|
|
- await collection.replace_one({"biao_id": id}, {"biao_id": id, "qufei": data})
|
|
|
|
|
- collection = db['qdxm']
|
|
|
|
|
- xm = data[0]
|
|
|
|
|
- for dxgc in xm["children"]:
|
|
|
|
|
- for dwgc in dxgc["children"]:
|
|
|
|
|
- bh = dwgc['key']
|
|
|
|
|
- glf = float(dwgc['管理费(%)'])
|
|
|
|
|
- lr = float(dwgc['利润(%)'])
|
|
|
|
|
- bz = dwgc['备注']
|
|
|
|
|
- ##print(bh+glf+lr+bz)
|
|
|
|
|
- async for post in collection.find({'biao_id': id, "Dwgcbh": bh}):
|
|
|
|
|
- rgfs = float(post['人工费'])
|
|
|
|
|
- clfs = float(post['材料费'])
|
|
|
|
|
- jxfs = float(post['机械费'])
|
|
|
|
|
- sl = float(post['数量'])
|
|
|
|
|
- if rgfs < 0.0001 and clfs < 0.0001 and jxfs < 0.0001:
|
|
|
|
|
- continue
|
|
|
|
|
- ##danxiang = False
|
|
|
|
|
-
|
|
|
|
|
- for child in post['__children']:##一条定额
|
|
|
|
|
- bm = child['清单编码']
|
|
|
|
|
- if bm.startswith("D"):
|
|
|
|
|
- ##danxiang = True
|
|
|
|
|
- continue
|
|
|
|
|
- rgf = float(child['人工费'])
|
|
|
|
|
- clf = float(child['材料费'])
|
|
|
|
|
- jxf = float(child['机械费'])
|
|
|
|
|
- zhdj = float(child['综合单价'])
|
|
|
|
|
- sl_ = float(child['数量'])
|
|
|
|
|
- if len(bz) == 0:
|
|
|
|
|
- ##常规计算
|
|
|
|
|
- child['管理费'] = (rgf + jxf) * glf / float(100)
|
|
|
|
|
- child['利润'] = (rgf + jxf) * lr / float(100)
|
|
|
|
|
- child['综合单价'] = rgf + clf + jxf + child['管理费'] + child['利润']
|
|
|
|
|
- child['合价'] = sl * sl_ * child['综合单价']
|
|
|
|
|
|
|
+ sum = qd_sum + djcs_sum##作为总价措施和后续费用计算的的计算基础
|
|
|
|
|
+ fbrgycl = document['fbrgycl']
|
|
|
|
|
+ for entry in fbrgycl:
|
|
|
|
|
+ fbrgycl_sum = fbrgycl_sum + float(entry['合价'])
|
|
|
|
|
+ zjcs = document['zjcs']
|
|
|
|
|
+ def process(n):
|
|
|
|
|
+ n['计算基数'] = str(sum)
|
|
|
|
|
+ n['金额'] = float(sum) * float(n['费率']) / float(100)
|
|
|
|
|
+ if "__children" in n:
|
|
|
|
|
+ for entry in n['__children']:
|
|
|
|
|
+ entry['计算基数'] = str(sum)
|
|
|
|
|
+ entry['金额'] = float(sum) * float(entry['费率']) / float(100)
|
|
|
|
|
+ return n
|
|
|
|
|
|
|
|
- else:
|
|
|
|
|
- child['管理费'] = (rgf) * glf / float(100)
|
|
|
|
|
- child['利润'] = (rgf) * lr / float(100)
|
|
|
|
|
- child['综合单价'] = rgf + clf + jxf + child['管理费'] + child['利润']
|
|
|
|
|
- child['合价'] = sl * sl_ * child['综合单价']
|
|
|
|
|
- if True:
|
|
|
|
|
- post['管理费'] = 0
|
|
|
|
|
- post['利润'] = 0
|
|
|
|
|
- for entry in post['__children']:
|
|
|
|
|
- post['管理费'] = post['管理费'] + float(entry['管理费']) * float(entry['数量'])
|
|
|
|
|
- post['利润'] = post['利润'] + float(entry['利润']) * float(entry['数量'])
|
|
|
|
|
- post['管理费'] = str(post['管理费'])
|
|
|
|
|
- post['利润'] = str(post['利润'])
|
|
|
|
|
|
|
+ ##目标数据,会存到数据库
|
|
|
|
|
+ result = [process(item) for item in zjcs]
|
|
|
|
|
+ for entry in result:
|
|
|
|
|
+ if '安全文明施工' in entry['名称']:
|
|
|
|
|
+ sum_ = 0
|
|
|
|
|
+ for child in entry['__children']:
|
|
|
|
|
+ sum_ = sum_ + float(child['金额'])
|
|
|
|
|
+ entry['金额'] = str(sum_)
|
|
|
|
|
+ entry['计算基数'] = str(sum_)
|
|
|
|
|
+ zjcs_sum = 0###总价措施汇总
|
|
|
|
|
+ for entry in result:
|
|
|
|
|
+ zjcs_sum = zjcs_sum + float(entry['金额'])
|
|
|
|
|
+ qtxm = document['qtxm']##dwgc qtxm
|
|
|
|
|
+ qtxm_sum = 0###其他项目汇总, 为了计算规费税金,其他项目本身不会改变
|
|
|
|
|
+ for entry in qtxm:
|
|
|
|
|
+ qtxm_sum = qtxm_sum + float(entry['金额'])
|
|
|
|
|
+ gfsj = document['gfsj']
|
|
|
|
|
+ gf_sum = 0###规费税金汇总
|
|
|
|
|
+ sj_sum = 0
|
|
|
|
|
+ for item in gfsj:
|
|
|
|
|
+ if item['名称'] == '规费':
|
|
|
|
|
+ child = item['__children']
|
|
|
|
|
+ for children in child:
|
|
|
|
|
+ children['取费基数'] = str(sum + zjcs_sum + qtxm_sum)
|
|
|
|
|
+ children['金额'] = str(float(sum + zjcs_sum + qtxm_sum) * float(children['费率']) / float(100))
|
|
|
|
|
+ gf_sum = gf_sum + float(children['金额'])
|
|
|
|
|
+ for item in gfsj:
|
|
|
|
|
+ if item['名称'] == '规费':
|
|
|
|
|
+ item['取费基数'] = str(gf_sum)
|
|
|
|
|
+ item['金额'] = str(gf_sum)
|
|
|
|
|
+ for item in gfsj:
|
|
|
|
|
+ if item['名称'] == '税金':
|
|
|
|
|
+ item['取费基数'] = str(sum + zjcs_sum + qtxm_sum + gf_sum - fbrgycl_sum / float(1.01))
|
|
|
|
|
+ item['金额'] = float(item['取费基数']) * float(item['费率']) / float(100)
|
|
|
|
|
+ sj_sum = float(item['金额'])
|
|
|
|
|
+ for item in gfsj:
|
|
|
|
|
+ if item['名称'] == '合计':
|
|
|
|
|
+ item['取费基数'] = str(sj_sum + gf_sum)
|
|
|
|
|
+ item['金额'] = item['取费基数']
|
|
|
|
|
+
|
|
|
|
|
+ qtxm = document['qtxm']
|
|
|
|
|
+ zlje = 0
|
|
|
|
|
+ zygczgj = 0
|
|
|
|
|
+ jrg = 0
|
|
|
|
|
+ zcbfwf = 0
|
|
|
|
|
+ clzgj = 0
|
|
|
|
|
+ for entry in qtxm:
|
|
|
|
|
+ if entry['序号'] == '1':
|
|
|
|
|
+ zlje = entry['金额']
|
|
|
|
|
+ if entry['序号'] == '3':
|
|
|
|
|
+ jrg = entry['金额']
|
|
|
|
|
+ if entry['序号'] == '4':
|
|
|
|
|
+ zcbfwf = entry['金额']
|
|
|
|
|
+ if entry['序号'] == '2':
|
|
|
|
|
+ for child in entry['__children']:
|
|
|
|
|
+ if child['序号'] == '2.2':
|
|
|
|
|
+ zygczgj = child['金额']
|
|
|
|
|
+ if child['序号'] == '2.1':
|
|
|
|
|
+ clzgj = child['金额']
|
|
|
|
|
+ ###重新算了一遍其他项目汇总
|
|
|
|
|
+ qtxm_sum = float(zlje) + float(zygczgj) + float(jrg) + float(zcbfwf) + float(clzgj)
|
|
|
|
|
+
|
|
|
|
|
+ bjhz = bjhz_template()
|
|
|
|
|
+ for entry in bjhz:
|
|
|
|
|
+ if entry['序号'] == '1':
|
|
|
|
|
+ entry['金额'] = qd_sum
|
|
|
|
|
+ for child in entry['__children']:
|
|
|
|
|
+ if child['序号'] == '1.1':
|
|
|
|
|
+ child['金额'] = str(rgf_sum)
|
|
|
|
|
+ if child['序号'] == '1.2':
|
|
|
|
|
+ child['金额'] = str(clf_sum)
|
|
|
|
|
+ if child['序号'] == '1.3':
|
|
|
|
|
+ child['金额'] = str(jxf_sum)
|
|
|
|
|
+ if child['序号'] == '1.4':
|
|
|
|
|
+ child['金额'] = str(glf_sum)
|
|
|
|
|
+ if child['序号'] == '1.5':
|
|
|
|
|
+ child['金额'] = str(lr_sum)
|
|
|
|
|
+ if entry['序号'] == '2':
|
|
|
|
|
+ entry['金额'] = str(djcs_sum + zjcs_sum)
|
|
|
|
|
+ for child in entry['__children']:
|
|
|
|
|
+ if child['序号'] == '2.1':
|
|
|
|
|
+ child['金额'] = str(djcs_sum)
|
|
|
|
|
+ if child['序号'] == '2.2':
|
|
|
|
|
+ child['金额'] = str(zjcs_sum)
|
|
|
|
|
+ for grandchild in child['__children']:
|
|
|
|
|
+ if grandchild['序号'] == '2.2.1':
|
|
|
|
|
+ grandchild['金额'] = str(sum_)
|
|
|
|
|
+ if entry['序号'] == '3':
|
|
|
|
|
+ entry['金额'] = str(qtxm_sum)
|
|
|
|
|
+ if entry['序号'] == '4':
|
|
|
|
|
+ entry['金额'] = str(gf_sum)
|
|
|
|
|
+ if entry['序号'] == '5':
|
|
|
|
|
+ entry['金额'] = str(sj_sum)
|
|
|
|
|
+ if entry['序号'] == '6':
|
|
|
|
|
+ entry['金额'] = str(float(qd_sum) + float(djcs_sum) + float(zjcs_sum) + float(qtxm_sum) + float(gf_sum) + float(sj_sum))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ collection = db['Dwgc']
|
|
|
|
|
+ if distinguish:
|
|
|
|
|
+ for entry in qdbt_addition:
|
|
|
|
|
+ entry['Je'] = str(bts[entry['Mc']])
|
|
|
|
|
+ await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'zjcs': result, 'gfsj' : gfsj, 'bjhz': bjhz, 'qdbt_addition' : qdbt_addition}})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+async def tbxx(client, biao_id):
|
|
|
|
|
+ db = client["baojia"]
|
|
|
|
|
+ collection = db["jingjibiao"]
|
|
|
|
|
+ document = await collection.find_one({'_id': ObjectId(biao_id)})
|
|
|
|
|
+ dxgcxx = document['Dxgcxx']
|
|
|
|
|
+ tbxx = document['TouBiaoXx']
|
|
|
|
|
+ tbxx['Tbzj'] = '0'
|
|
|
|
|
+ tbxx['Zgj'] = '0'
|
|
|
|
|
+ tbxx['Aqwmf'] = '0'
|
|
|
|
|
+ tbxx['Gf'] = '0'
|
|
|
|
|
+
|
|
|
|
|
+ dwdx = {}##单位工程映射单项工程
|
|
|
|
|
+ for dxgc in dxgcxx:
|
|
|
|
|
+ dxgc['Aqwmf'] = '0'
|
|
|
|
|
+ dxgc['Gf'] = '0'
|
|
|
|
|
+ dxgc['Je'] = '0'
|
|
|
|
|
+ dxgc['Zgj'] = '0'
|
|
|
|
|
+ mc = dxgc['Dxgcmc']
|
|
|
|
|
+ Dwgc = dxgc['Dwgc']
|
|
|
|
|
+ for dwgc in Dwgc:
|
|
|
|
|
+ Dwgcbh = dwgc['Dwgcbh']
|
|
|
|
|
+ dwdx[Dwgcbh] = dxgc
|
|
|
|
|
+ collection = db['Dwgc']
|
|
|
|
|
+ async for post in collection.find({'biao_id': biao_id}):
|
|
|
|
|
+ bh = post['Dwgcbh']
|
|
|
|
|
+ dx = dwdx[bh]
|
|
|
|
|
+ bjhz = post['bjhz']
|
|
|
|
|
+
|
|
|
|
|
+ if len(bjhz) == 0:
|
|
|
|
|
+ pass
|
|
|
|
|
+ else:
|
|
|
|
|
+ qtxm = post['qtxm']
|
|
|
|
|
+ dx['Aqwmf'] = str(float(dx['Aqwmf']) + float(bjhz[1]['__children'][1]['__children'][0]['金额']))
|
|
|
|
|
+ dx['Gf'] = str(float(dx['Gf']) + float(bjhz[3]['金额']))
|
|
|
|
|
+ dx['Je'] = str(float(dx['Je']) + float(bjhz[5]['金额']))
|
|
|
|
|
+ dx['Zgj']= str(float(dx['Zgj']) + float(qtxm[1]['金额']))
|
|
|
|
|
+ for dxgc in dxgcxx:
|
|
|
|
|
+ tbxx['Tbzj'] = str(float(tbxx['Tbzj']) + float(dxgc['Je']))
|
|
|
|
|
+ tbxx['Zgj'] = str(float(tbxx['Zgj']) + float(dxgc['Zgj']))
|
|
|
|
|
+ tbxx['Aqwmf'] = str(float(tbxx['Aqwmf']) + float(dxgc['Aqwmf']))
|
|
|
|
|
+ tbxx['Gf'] = str(float(tbxx['Gf']) + float(dxgc['Gf']))
|
|
|
|
|
+ collection = db["jingjibiao"]
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ await collection.update_one({'_id': ObjectId(biao_id)}, {'$set': {'Dxgcxx': dxgcxx, 'TouBiaoXx' : tbxx}})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+async def updatezjcs(client, id, bh, mc, fl):
|
|
|
|
|
+ db = client["baojia"]
|
|
|
|
|
+ collection = db["Dwgc"]
|
|
|
|
|
+
|
|
|
|
|
+ document = await collection.find_one({'biao_id': id, 'Dwgcbh': bh}, {'rcjhz': 0})
|
|
|
|
|
+ zjcs = document['zjcs']
|
|
|
|
|
+ for entry in zjcs:
|
|
|
|
|
+ if entry['名称'] == mc:
|
|
|
|
|
+ entry['费率'] = fl
|
|
|
|
|
+ entry['金额'] = str(float(entry['计算基数']) * float(fl) / float(100))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ await collection.update_one({'biao_id': id, "Dwgcbh": bh}, {'$set': {'zjcs': zjcs}})
|
|
|
|
|
+ await zongjiaDwgc(client, id, bh)
|
|
|
|
|
+ await tbxx(client, id)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#################保存清单项#############################
|
|
|
|
|
+async def save(client, data):
|
|
|
|
|
+ db = client["baojia"]
|
|
|
|
|
+ collection = db["qdxm"]
|
|
|
|
|
+ biao_id = None
|
|
|
|
|
+ bh = None
|
|
|
|
|
+ for entry in data:
|
|
|
|
|
+ entry["__children"] = entry["_children"]
|
|
|
|
|
+ del entry["_children"]
|
|
|
|
|
+ biao_id = entry['biao_id']
|
|
|
|
|
+ bh = entry['Dwgcbh']
|
|
|
|
|
+ await collection.replace_one({"biao_id": entry["biao_id"], "Dwgcbh": entry["Dwgcbh"], "bt": entry["bt"], "清单编码": entry["清单编码"]}, entry)
|
|
|
|
|
+ if not biao_id:
|
|
|
|
|
+ return {"result" : "ok"}
|
|
|
|
|
+ rcjhz = []
|
|
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
|
|
+ for entry in qdrcj:
|
|
|
|
|
+ print(entry[4])
|
|
|
|
|
+ if entry[4] != '%':
|
|
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
|
|
+ collection = db["Djcs"]
|
|
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
+
|
|
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
|
|
+ for entry in qdrcj:
|
|
|
|
|
+ print(entry[4])
|
|
|
|
|
+ if entry[4] != '%':
|
|
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
|
|
+ newHuizong = util.huizongrcj(rcjhz)
|
|
|
|
|
+ collection = db["Dwgc"]
|
|
|
|
|
+ await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
|
|
+ await zongjiaDwgc(client, biao_id, bh)
|
|
|
|
|
+ await tbxx(client, biao_id)
|
|
|
|
|
+ return {"result": "ok"}
|
|
|
|
|
+
|
|
|
|
|
+async def savedjcs(client, data):
|
|
|
|
|
+ db = client["baojia"]
|
|
|
|
|
+ collection = db["Djcs"]
|
|
|
|
|
+ biao_id = None
|
|
|
|
|
+ bh = None
|
|
|
|
|
+ for entry in data:
|
|
|
|
|
+ entry["__children"] = entry["_children"]
|
|
|
|
|
+ del entry["_children"]
|
|
|
|
|
+ biao_id = entry['biao_id']
|
|
|
|
|
+ bh = entry['Dwgcbh']
|
|
|
|
|
+ await collection.replace_one({"biao_id": entry["biao_id"], "Dwgcbh": entry["Dwgcbh"], "清单编码": entry["清单编码"]}, entry)
|
|
|
|
|
+
|
|
|
|
|
+ if not biao_id:
|
|
|
|
|
+ return {"result" : "ok"}
|
|
|
|
|
+ rcjhz = []
|
|
|
|
|
+ collection = db["qdxm"]
|
|
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
|
|
+ for entry in qdrcj:
|
|
|
|
|
+ if entry[4] != '%':
|
|
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
|
|
+ collection = db["Djcs"]
|
|
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
|
|
+ for entry in qdrcj:
|
|
|
|
|
+ if entry[4] != '%':
|
|
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
|
|
+ newHuizong = util.huizongrcj(rcjhz)
|
|
|
|
|
+ collection = db["Dwgc"]
|
|
|
|
|
+ await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
|
|
+ await zongjiaDwgc(client, biao_id, bh)
|
|
|
|
|
+ await tbxx(client, biao_id)
|
|
|
|
|
+ return {"result": "ok"}
|
|
|
|
|
+
|
|
|
|
|
+async def applyFL(client, id, data):
|
|
|
|
|
+ db = client["baojia"]
|
|
|
|
|
+ collection = db["qufei"]
|
|
|
|
|
+
|
|
|
|
|
+ await collection.replace_one({"biao_id": id}, {"biao_id": id, "qufei": data})
|
|
|
|
|
+ collection = db['qdxm']
|
|
|
|
|
+ xm = data[0]
|
|
|
|
|
+ for dxgc in xm["children"]:
|
|
|
|
|
+ for dwgc in dxgc["children"]:
|
|
|
|
|
+ bh = dwgc['key']
|
|
|
|
|
+ glf = float(dwgc['管理费(%)'])
|
|
|
|
|
+ lr = float(dwgc['利润(%)'])
|
|
|
|
|
+ bz = dwgc['备注']
|
|
|
|
|
+ ##print(bh+glf+lr+bz)
|
|
|
|
|
+ async for post in collection.find({'biao_id': id, "Dwgcbh": bh}):
|
|
|
|
|
+ rgfs = float(post['人工费'])
|
|
|
|
|
+ clfs = float(post['材料费'])
|
|
|
|
|
+ jxfs = float(post['机械费'])
|
|
|
|
|
+ sl = float(post['数量'])
|
|
|
|
|
+ if rgfs < 0.0001 and clfs < 0.0001 and jxfs < 0.0001:
|
|
|
|
|
+ continue
|
|
|
|
|
+ ##danxiang = False
|
|
|
|
|
+
|
|
|
|
|
+ for child in post['__children']:##一条定额
|
|
|
|
|
+ bm = child['清单编码']
|
|
|
|
|
+ if bm.startswith("D"):
|
|
|
|
|
+ ##danxiang = True
|
|
|
|
|
+ continue
|
|
|
|
|
+ rgf = float(child['人工费'])
|
|
|
|
|
+ clf = float(child['材料费'])
|
|
|
|
|
+ jxf = float(child['机械费'])
|
|
|
|
|
+ zhdj = float(child['综合单价'])
|
|
|
|
|
+ sl_ = float(child['数量'])
|
|
|
|
|
+ if len(bz) == 0:
|
|
|
|
|
+ ##常规计算
|
|
|
|
|
+ child['管理费'] = (rgf + jxf) * glf / float(100)
|
|
|
|
|
+ child['利润'] = (rgf + jxf) * lr / float(100)
|
|
|
|
|
+ child['综合单价'] = rgf + clf + jxf + child['管理费'] + child['利润']
|
|
|
|
|
+ child['合价'] = sl * sl_ * child['综合单价']
|
|
|
|
|
+
|
|
|
|
|
+ else:
|
|
|
|
|
+ child['管理费'] = (rgf) * glf / float(100)
|
|
|
|
|
+ child['利润'] = (rgf) * lr / float(100)
|
|
|
|
|
+ child['综合单价'] = rgf + clf + jxf + child['管理费'] + child['利润']
|
|
|
|
|
+ child['合价'] = sl * sl_ * child['综合单价']
|
|
|
|
|
+ if True:
|
|
|
|
|
+ post['管理费'] = 0
|
|
|
|
|
+ post['利润'] = 0
|
|
|
|
|
+ for entry in post['__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(post['材料费']) + float(post['机械费']) + float(post['管理费']) + float(post['利润']))
|
|
|
post['合价'] = str(float(post['综合单价']) * float(post['数量']))
|
|
post['合价'] = str(float(post['综合单价']) * float(post['数量']))
|
|
|
|
|
|
|
@@ -1646,7 +1826,7 @@ async def applyFL(client, id, data):
|
|
|
return {"result": "ok"}
|
|
return {"result": "ok"}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+###人材机汇总页面调价
|
|
|
async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz):
|
|
async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz):
|
|
|
db = client["baojia"]
|
|
db = client["baojia"]
|
|
|
rcjhz = []
|
|
rcjhz = []
|
|
@@ -1753,7 +1933,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post['数量'])
|
|
post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post['数量'])
|
|
|
dercj = post["__children"][i]['dercj']
|
|
dercj = post["__children"][i]['dercj']
|
|
|
for j in range(1, len(dercj)):
|
|
for j in range(1, len(dercj)):
|
|
|
- dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
|
|
|
|
|
|
|
+ dercj[j][11] = float(added) * float(dercj[j][10]) / float(100)
|
|
|
|
|
|
|
|
|
|
|
|
|
if tag[0] == '人工费+机械费':
|
|
if tag[0] == '人工费+机械费':
|
|
@@ -1779,7 +1959,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post["数量"])
|
|
post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post["数量"])
|
|
|
dercj = post["__children"][i]['dercj']
|
|
dercj = post["__children"][i]['dercj']
|
|
|
for j in range(1, len(dercj)):
|
|
for j in range(1, len(dercj)):
|
|
|
- dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
|
|
|
|
|
|
|
+ dercj[j][11] = float(added) * float(dercj[j][10]) / float(100)
|
|
|
|
|
|
|
|
|
|
|
|
|
qdrcj = []
|
|
qdrcj = []
|
|
@@ -1940,9 +2120,6 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
|
|
|
|
|
await collection.replace_one({'_id': post['_id']}, post )
|
|
await collection.replace_one({'_id': post['_id']}, post )
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
|
|
|
qdrcj = post['rcj'][1:]
|
|
qdrcj = post['rcj'][1:]
|
|
@@ -1952,7 +2129,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
rcjhz = rcjhz + qdrcj
|
|
rcjhz = rcjhz + qdrcj
|
|
|
newHuizong = util.huizongrcj(rcjhz)
|
|
newHuizong = util.huizongrcj(rcjhz)
|
|
|
collection = db["Dwgc"]
|
|
collection = db["Dwgc"]
|
|
|
- document = await collection.find_one({'biao_id': biao_id, "Dwgcbh": bh})
|
|
|
|
|
|
|
+ #document = await collection.find_one({'biao_id': biao_id, "Dwgcbh": bh})
|
|
|
await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'rcjhz': newHuizong}})
|
|
await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'rcjhz': newHuizong}})
|
|
|
await zongjiaDwgc(client, biao_id, bh)
|
|
await zongjiaDwgc(client, biao_id, bh)
|
|
|
await tbxx(client, biao_id)
|
|
await tbxx(client, biao_id)
|
|
@@ -1960,266 +2137,19 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-def bjhz_template():
|
|
|
|
|
- result = []
|
|
|
|
|
- result.append({'序号': '1', '名称': '分部分项工程', '金额': '0', '暂估价': '0', '类别' : '1', '__children': [
|
|
|
|
|
- {'序号': '1.1', '名称': '人工费', '金额': '0', '暂估价': '0', '类别' : '1.1'},
|
|
|
|
|
- {'序号': '1.2', '名称': '材料费', '金额': '0', '暂估价': '0', '类别' : '1.2'},
|
|
|
|
|
- {'序号': '1.3', '名称': '施工机具使用费', '金额': '0', '暂估价': '0', '类别' : '1.3'},
|
|
|
|
|
- {'序号': '1.4', '名称': '企业管理费', '金额': '0', '暂估价': '0', '类别' : '1.4'},
|
|
|
|
|
- {'序号': '1.5', '名称': '利润', '金额': '0', '暂估价': '0', '类别' : '1.5'}
|
|
|
|
|
- ]})
|
|
|
|
|
- result.append({'序号': '2', '名称': '措施项目', '金额': '0', '暂估价': '0', '类别' : '2', '__children': [
|
|
|
|
|
- {'序号': '2.1', '名称': '单价措施项目费', '金额': '0', '暂估价': '0', '类别' : '2.1'},
|
|
|
|
|
- {'序号': '2.2', '名称': '总价措施项目费', '金额': '0', '暂估价': '0', '类别' : '2.2', '__children' : [
|
|
|
|
|
- {'序号': '2.2.1', '名称': '其中:安全文明施工措施费', '金额': '0', '暂估价': '0', '类别' : '2.2.1'},]
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- ]})
|
|
|
|
|
- result.append({'序号': '3', '名称': '其他项目', '金额': '0', '暂估价': '0', '类别' : '3', '__children': [
|
|
|
|
|
- {'序号': '3.1', '名称': '其中:暂列金额', '金额': '0', '暂估价': '0', '类别' : '3.1'},
|
|
|
|
|
- {'序号': '3.2', '名称': '其中:专业工程暂估价', '金额': '0', '暂估价': '0', '类别' : '3.2'},
|
|
|
|
|
- {'序号': '3.3', '名称': '其中:计日工', '金额': '0', '暂估价': '0', '类别' : '3.3'},
|
|
|
|
|
- {'序号': '3.4', '名称': '其中:总承包服务费', '金额': '0', '暂估价': '0', '类别' : '3.4'},
|
|
|
|
|
-
|
|
|
|
|
- ]})
|
|
|
|
|
- result.append({'序号': '4', '名称': '规费', '金额': '0', '暂估价': '0', '类别' : '4', })
|
|
|
|
|
- result.append({'序号': '5', '名称': '税金', '金额': '0', '暂估价': '0', '类别' : '5', })
|
|
|
|
|
- result.append({'序号': '6', '名称': '工程造价', '金额': '0', '暂估价': '0', '类别' : '6', })
|
|
|
|
|
-
|
|
|
|
|
- return result
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-async def tbxx(client, biao_id):
|
|
|
|
|
- db = client["baojia"]
|
|
|
|
|
- collection = db["jingjibiao"]
|
|
|
|
|
- document = await collection.find_one({'_id': ObjectId(biao_id)})
|
|
|
|
|
- dxgcxx = document['Dxgcxx']
|
|
|
|
|
- tbxx = document['TouBiaoXx']
|
|
|
|
|
- tbxx['Tbzj'] = '0'
|
|
|
|
|
- tbxx['Zgj'] = '0'
|
|
|
|
|
- tbxx['Aqwmf'] = '0'
|
|
|
|
|
- tbxx['Gf'] = '0'
|
|
|
|
|
-
|
|
|
|
|
- dwdx = {}##单位工程映射单项工程
|
|
|
|
|
- for dxgc in dxgcxx:
|
|
|
|
|
- dxgc['Aqwmf'] = '0'
|
|
|
|
|
- dxgc['Gf'] = '0'
|
|
|
|
|
- dxgc['Je'] = '0'
|
|
|
|
|
- dxgc['Zgj'] = '0'
|
|
|
|
|
- mc = dxgc['Dxgcmc']
|
|
|
|
|
- Dwgc = dxgc['Dwgc']
|
|
|
|
|
- for dwgc in Dwgc:
|
|
|
|
|
- Dwgcbh = dwgc['Dwgcbh']
|
|
|
|
|
- dwdx[Dwgcbh] = dxgc
|
|
|
|
|
- collection = db['Dwgc']
|
|
|
|
|
- async for post in collection.find({'biao_id': biao_id}):
|
|
|
|
|
- bh = post['Dwgcbh']
|
|
|
|
|
- dx = dwdx[bh]
|
|
|
|
|
- bjhz = post['bjhz']
|
|
|
|
|
- print('######################################################')
|
|
|
|
|
- print(bjhz)
|
|
|
|
|
- if len(bjhz) == 0:
|
|
|
|
|
- pass
|
|
|
|
|
- else:
|
|
|
|
|
- qtxm = post['qtxm']
|
|
|
|
|
- dx['Aqwmf'] = str(float(dx['Aqwmf']) + float(bjhz[1]['__children'][1]['__children'][0]['金额']))
|
|
|
|
|
- dx['Gf'] = str(float(dx['Gf']) + float(bjhz[3]['金额']))
|
|
|
|
|
- dx['Je'] = str(float(dx['Je']) + float(bjhz[5]['金额']))
|
|
|
|
|
- dx['Zgj']= str(float(dx['Zgj']) + float(qtxm[1]['金额']))
|
|
|
|
|
- for dxgc in dxgcxx:
|
|
|
|
|
- tbxx['Tbzj'] = str(float(tbxx['Tbzj']) + float(dxgc['Je']))
|
|
|
|
|
- tbxx['Zgj'] = str(float(tbxx['Zgj']) + float(dxgc['Zgj']))
|
|
|
|
|
- tbxx['Aqwmf'] = str(float(tbxx['Aqwmf']) + float(dxgc['Aqwmf']))
|
|
|
|
|
- tbxx['Gf'] = str(float(tbxx['Gf']) + float(dxgc['Gf']))
|
|
|
|
|
- collection = db["jingjibiao"]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- await collection.update_one({'_id': ObjectId(biao_id)}, {'$set': {'Dxgcxx': dxgcxx, 'TouBiaoXx' : tbxx}})
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
-async def zongjiaDwgc(client, biao_id, bh):
|
|
|
|
|
- db = client["baojia"]
|
|
|
|
|
- djcs_sum = 0
|
|
|
|
|
- collection = db["Djcs"]
|
|
|
|
|
- async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
- djcs_sum = djcs_sum + float(post['合价'])
|
|
|
|
|
-
|
|
|
|
|
- collection = db['Dwgc']
|
|
|
|
|
- document = await collection.find_one({'biao_id': biao_id, "Dwgcbh": bh}, {'rcjhz': 0})
|
|
|
|
|
- qdbt = document['qdbt']
|
|
|
|
|
- qdbt_addition = document['qdbt_addition']
|
|
|
|
|
- bts = {}
|
|
|
|
|
- distinguish = True
|
|
|
|
|
|
|
|
|
|
- for item in qdbt_addition:
|
|
|
|
|
- bts[item['Mc']] = 0
|
|
|
|
|
-
|
|
|
|
|
- collection = db["qdxm"]
|
|
|
|
|
- qd_sum = 0
|
|
|
|
|
- rgf_sum = 0
|
|
|
|
|
- clf_sum = 0
|
|
|
|
|
- jxf_sum = 0
|
|
|
|
|
- glf_sum = 0
|
|
|
|
|
- lr_sum = 0
|
|
|
|
|
- fbrgycl_sum = 0
|
|
|
|
|
- async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
|
|
- qd_sum = qd_sum + float(post['合价'])
|
|
|
|
|
- rgf_sum = rgf_sum + float(post['数量']) * float(post['人工费'])
|
|
|
|
|
- clf_sum = clf_sum + float(post['数量']) * float(post['材料费'])
|
|
|
|
|
- jxf_sum = jxf_sum + float(post['数量']) * float(post['机械费'])
|
|
|
|
|
- glf_sum = glf_sum + float(post['数量']) * float(post['管理费'])
|
|
|
|
|
- lr_sum = lr_sum + float(post['数量']) * float(post['利润'])
|
|
|
|
|
- if distinguish and post['bt'] in bts:
|
|
|
|
|
- bts[post['bt']] = bts[post['bt']] + float(post['合价'])
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- sum = qd_sum + djcs_sum
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- fbrgycl = document['fbrgycl']
|
|
|
|
|
- for entry in fbrgycl:
|
|
|
|
|
- fbrgycl_sum = fbrgycl_sum + float(entry['合价'])
|
|
|
|
|
- zjcs = document['zjcs']
|
|
|
|
|
- def process(n):
|
|
|
|
|
- n['计算基数'] = str(sum)
|
|
|
|
|
- n['金额'] = float(sum) * float(n['费率']) / float(100)
|
|
|
|
|
- if "__children" in n:
|
|
|
|
|
- for entry in n['__children']:
|
|
|
|
|
- entry['计算基数'] = str(sum)
|
|
|
|
|
- entry['金额'] = float(sum) * float(entry['费率']) / float(100)
|
|
|
|
|
- return n
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- result = [process(item) for item in zjcs]
|
|
|
|
|
- for entry in result:
|
|
|
|
|
- if '安全文明施工' in entry['名称']:
|
|
|
|
|
- sum_ = 0
|
|
|
|
|
- for child in entry['__children']:
|
|
|
|
|
- sum_ = sum_ + float(child['金额'])
|
|
|
|
|
- entry['金额'] = str(sum_)
|
|
|
|
|
- entry['计算基数'] = str(sum_)
|
|
|
|
|
- zjcs_sum = 0
|
|
|
|
|
- for entry in result:
|
|
|
|
|
- zjcs_sum = zjcs_sum + float(entry['金额'])
|
|
|
|
|
- qtxm = document['qtxm']##dwgc qtxm
|
|
|
|
|
- qtxm_sum = 0
|
|
|
|
|
- for entry in qtxm:
|
|
|
|
|
- qtxm_sum = qtxm_sum + float(entry['金额'])
|
|
|
|
|
- gfsj = document['gfsj']
|
|
|
|
|
- gf_sum = 0
|
|
|
|
|
- sj_sum = 0
|
|
|
|
|
- for item in gfsj:
|
|
|
|
|
- if item['名称'] == '规费':
|
|
|
|
|
- child = item['__children']
|
|
|
|
|
- for children in child:
|
|
|
|
|
- children['取费基数'] = str(sum + zjcs_sum + qtxm_sum)
|
|
|
|
|
- children['金额'] = str(float(sum + zjcs_sum + qtxm_sum) * float(children['费率']) / float(100))
|
|
|
|
|
- gf_sum = gf_sum + float(children['金额'])
|
|
|
|
|
- for item in gfsj:
|
|
|
|
|
- if item['名称'] == '规费':
|
|
|
|
|
- item['取费基数'] = str(gf_sum)
|
|
|
|
|
- item['金额'] = str(gf_sum)
|
|
|
|
|
- for item in gfsj:
|
|
|
|
|
- if item['名称'] == '税金':
|
|
|
|
|
- item['取费基数'] = str(sum + zjcs_sum + qtxm_sum + gf_sum - fbrgycl_sum / float(1.01))
|
|
|
|
|
- item['金额'] = float(item['取费基数']) * float(item['费率']) / float(100)
|
|
|
|
|
- sj_sum = float(item['金额'])
|
|
|
|
|
- for item in gfsj:
|
|
|
|
|
- if item['名称'] == '合计':
|
|
|
|
|
- item['取费基数'] = str(sj_sum + gf_sum)
|
|
|
|
|
- item['金额'] = item['取费基数']
|
|
|
|
|
-
|
|
|
|
|
- qtxm = document['qtxm']
|
|
|
|
|
- zlje = 0
|
|
|
|
|
- zygczgj = 0
|
|
|
|
|
- jrg = 0
|
|
|
|
|
- zcbfwf = 0
|
|
|
|
|
- clzgj = 0
|
|
|
|
|
- for entry in qtxm:
|
|
|
|
|
- if entry['序号'] == '1':
|
|
|
|
|
- zlje = entry['金额']
|
|
|
|
|
- if entry['序号'] == '3':
|
|
|
|
|
- jrg = entry['金额']
|
|
|
|
|
- if entry['序号'] == '4':
|
|
|
|
|
- zcbfwf = entry['金额']
|
|
|
|
|
- if entry['序号'] == '2':
|
|
|
|
|
- for child in entry['__children']:
|
|
|
|
|
- if child['序号'] == '2.2':
|
|
|
|
|
- zygczgj = child['金额']
|
|
|
|
|
- if child['序号'] == '2.1':
|
|
|
|
|
- clzgj = child['金额']
|
|
|
|
|
- qtxm_sum = float(zlje) + float(zygczgj) + float(jrg) + float(zcbfwf) + float(clzgj)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- bjhz = bjhz_template()
|
|
|
|
|
- for entry in bjhz:
|
|
|
|
|
- if entry['序号'] == '1':
|
|
|
|
|
- entry['金额'] = qd_sum
|
|
|
|
|
- for child in entry['__children']:
|
|
|
|
|
- if child['序号'] == '1.1':
|
|
|
|
|
- child['金额'] = str(rgf_sum)
|
|
|
|
|
- if child['序号'] == '1.2':
|
|
|
|
|
- child['金额'] = str(clf_sum)
|
|
|
|
|
- if child['序号'] == '1.3':
|
|
|
|
|
- child['金额'] = str(jxf_sum)
|
|
|
|
|
- if child['序号'] == '1.4':
|
|
|
|
|
- child['金额'] = str(glf_sum)
|
|
|
|
|
- if child['序号'] == '1.5':
|
|
|
|
|
- child['金额'] = str(lr_sum)
|
|
|
|
|
- if entry['序号'] == '2':
|
|
|
|
|
- entry['金额'] = str(djcs_sum + zjcs_sum)
|
|
|
|
|
- for child in entry['__children']:
|
|
|
|
|
- if child['序号'] == '2.1':
|
|
|
|
|
- child['金额'] = str(djcs_sum)
|
|
|
|
|
- if child['序号'] == '2.2':
|
|
|
|
|
- child['金额'] = str(zjcs_sum)
|
|
|
|
|
- for grandchild in child['__children']:
|
|
|
|
|
- if grandchild['序号'] == '2.2.1':
|
|
|
|
|
- grandchild['金额'] = str(sum_)
|
|
|
|
|
- if entry['序号'] == '3':
|
|
|
|
|
- entry['金额'] = str(qtxm_sum)
|
|
|
|
|
- if entry['序号'] == '4':
|
|
|
|
|
- entry['金额'] = str(gf_sum)
|
|
|
|
|
- if entry['序号'] == '5':
|
|
|
|
|
- entry['金额'] = str(sj_sum)
|
|
|
|
|
- if entry['序号'] == '6':
|
|
|
|
|
- entry['金额'] = str(float(qd_sum) + float(djcs_sum) + float(zjcs_sum) + float(qtxm_sum) + float(gf_sum) + float(sj_sum))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- collection = db['Dwgc']
|
|
|
|
|
- if distinguish:
|
|
|
|
|
- for entry in qdbt_addition:
|
|
|
|
|
- entry['Je'] = str(bts[entry['Mc']])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'zjcs': result, 'gfsj' : gfsj, 'bjhz': bjhz, 'qdbt_addition' : qdbt_addition}})
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|