Commit 6f8f0893 by 马丽华

Merge branch 'mlh_jzjx_project' into 'master'

财务收支记录

See merge request !35
parents cdd07d60 d4d7c7f3
......@@ -78,15 +78,19 @@ class ProductIncomeExpenseIframe(http.Controller):
return {"code": 1, "message": "更新失败,没找到对应数据。"}
else: # 创建
# 支出
expenditure = float(v.get("expenditure", 0) or 0)
# 收入
income = float(v.get("income", 0) or 0)
# # 支出
# expenditure = float(v.get("expenditure", 0) or 0)
# # 收入
# income = float(v.get("income", 0) or 0)
if v.get("expenditure") in ['', None, False]:
v.update({"expenditure": 0})
if v.get("income") in ['', None, False]:
v.update({"income": 0})
# 最新一条数据
latest_record = model.search([], order="business_date desc,create_date desc", limit=1)
# 计算结余
balance = round(latest_record.balance + (income - expenditure), 2)
balance = round(latest_record.balance + float(v.get("income")) - float(v.get("expenditure")), 2)
cr.execute("""
INSERT INTO roke_product_income_expense
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment