Browse Source

结算量单位取现货商品单位、已完结的合同不再计算待收支额

zou.yingbin 4 years ago
parent
commit
32c9b5910a
2 changed files with 8 additions and 2 deletions
  1. 7 1
      models/ermcp.go
  2. 1 1
      models/ermcpOPApply.go

+ 7 - 1
models/ermcp.go

@@ -217,7 +217,13 @@ type ErmcpModel struct {
 
 func (r *ErmcpModel) calc() {
 	r.TotalAmount = r.LoanAmount + r.ReckonOtherAmount + r.Margin
-	r.UnpayAmount = r.TotalAmount - r.ReckonedAmount
+	if r.Contracctstatus == 3 {
+		// 已完结的合同, 不再计算待支收额,=0
+		r.UnpayAmount = 0
+	} else {
+		r.UnpayAmount = r.TotalAmount - r.ReckonedAmount
+	}
+
 	if r.Contracttype == 1 {
 		//采购合同, 取销售方名称
 		r.AccountName = mtpcache.GetUserNameByUserId(r.SELLUSERID)

+ 1 - 1
models/ermcpOPApply.go

@@ -84,7 +84,7 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		"  left join useraccount u2" +
 		"    on s.selluserid = u2.userid" +
 		"  left join enumdicitem e" +
-		"    on e.enumitemname = g.goodunitid" +
+		"    on e.enumitemname = w.unitid" +
 		"   and e.enumdiccode = 'goodsunit'" +
 		" where t.operateapplytype = %v" +
 		"   and s.userid = %v"