|
@@ -274,7 +274,7 @@ LEFT JOIN (
|
|
whereSql = fmt.Sprintf(" where %s", strings.Join(orderSql, " and "))
|
|
whereSql = fmt.Sprintf(" where %s", strings.Join(orderSql, " and "))
|
|
}
|
|
}
|
|
//列表
|
|
//列表
|
|
- sql := fmt.Sprintf(sqlWhere, " a.id,\n a.is_backstage_order, a.order_code,\n a.personPhone,\n a.personName,\n a.create_time,\n a.order_money,\n a.company_name,\n a.user_phone,\n a.user_nickname,\n a.buy_subject,\n a.audit_status,\n a.order_status,\n a.pay_money - IFNULL(g.orderMoney, 0) as pay_money,\n a.commission,\n a.return_status,\n IFNULL(c.return_money, 0) as return_money,\n IFNULL(b.invoiced_amount, 0) as invoiced_amount,\n a.refund_status,\n IFNULL(d.refund_money, 0) as refund_money,\n e.contract_status,\n DATE(e.contract_time) as contract_time,\n e.contract_archive_status,\n DATE(e.contract_archive_time) as contract_archive_time,\n h.name as ent_user_name", productSql, channelSql, whereSql)
|
|
|
|
|
|
+ sql := fmt.Sprintf(sqlWhere, " a.id,\n a.is_backstage_order, a.order_code,\n a.personPhone,\n a.personName,\n a.create_time,\n a.order_money,\n a.company_name,\n a.user_phone,\n a.user_nickname,\n a.buy_subject,\n a.audit_status,\n a.order_status,\n (IFNULL(CASE WHEN a.is_backstage_order = 1 THEN a.pay_money ELSE a.order_money END, 0)) - IFNULL(g.orderMoney, 0) as pay_money,\n a.commission,\n a.return_status,\n IFNULL(c.return_money, 0) as return_money,\n IFNULL(b.invoiced_amount, 0) as invoiced_amount,\n a.refund_status,\n IFNULL(d.refund_money, 0) as refund_money,\n e.contract_status,\n DATE(e.contract_time) as contract_time,\n e.contract_archive_status,\n DATE(e.contract_archive_time) as contract_archive_time,\n h.name as ent_user_name", productSql, channelSql, whereSql)
|
|
//数量
|
|
//数量
|
|
sqlCount := fmt.Sprintf(sqlWhere, " count(1) ", productSql, channelSql, whereSql)
|
|
sqlCount := fmt.Sprintf(sqlWhere, " count(1) ", productSql, channelSql, whereSql)
|
|
//合同总金额
|
|
//合同总金额
|
|
@@ -323,7 +323,7 @@ LEFT JOIN (
|
|
remainingAmount := gconv.Int(m["return_money"])
|
|
remainingAmount := gconv.Int(m["return_money"])
|
|
returnAmount := gconv.Int(m["return_money"])
|
|
returnAmount := gconv.Int(m["return_money"])
|
|
if gconv.Int(m["is_backstage_order"]) == 0 && gconv.Int(m["order_status"]) == 1 &&
|
|
if gconv.Int(m["is_backstage_order"]) == 0 && gconv.Int(m["order_status"]) == 1 &&
|
|
- gconv.Int(m["pay_money"]) > 0 && gconv.Int(m["return_status"]) == 0 {
|
|
|
|
|
|
+ gconv.Int(m["pay_money"]) > 0 {
|
|
remainingAmount = gconv.Int(m["pay_money"])
|
|
remainingAmount = gconv.Int(m["pay_money"])
|
|
returnAmount = gconv.Int(m["pay_money"])
|
|
returnAmount = gconv.Int(m["pay_money"])
|
|
m["return_money"] = returnAmount
|
|
m["return_money"] = returnAmount
|