Browse Source

UPDATE:添加修改报销、提交审核时报销金额为0的验证

zoie 7 months ago
parent
commit
1ff8bc1775
1 changed files with 13 additions and 0 deletions
  1. 13 0
      controllers/Reimburse.go

+ 13 - 0
controllers/Reimburse.go

@@ -354,6 +354,13 @@ func (c *ReimburseController) Reimburse_Edit() {
 		return
 		return
 	}
 	}
 
 
+	if body.T_money == 0 {
+		o.Rollback()
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "报销金额不能为0"}
+		c.ServeJSON()
+		return
+	}
+
 	reimburse.T_money = body.T_money
 	reimburse.T_money = body.T_money
 	_, err = ReimburseDao.Update_Reimburse(reimburse, "T_money")
 	_, err = ReimburseDao.Update_Reimburse(reimburse, "T_money")
 	if err != nil {
 	if err != nil {
@@ -502,6 +509,12 @@ func (c *ReimburseController) Reimburse_Submit_Audit() {
 		c.ServeJSON()
 		c.ServeJSON()
 		return
 		return
 	}
 	}
+	if reimburse.T_money == 0 {
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "报销总金额为0,请检查!"}
+		c.ServeJSON()
+		return
+	}
+
 	if c.User.T_uuid != reimburse.T_uid {
 	if c.User.T_uuid != reimburse.T_uid {
 		c.Data["json"] = lib.JSONS{Code: 202, Msg: "没有权限!"}
 		c.Data["json"] = lib.JSONS{Code: 202, Msg: "没有权限!"}
 		c.ServeJSON()
 		c.ServeJSON()