我的投资 本金和利息算法(公司做的笔记)
我的投资(以下是针对投资人来算的)
=========================================================
本期应收总额 = 本期回收本息(now_amount) - 利息管理费(fee)
应收本金 = 本期回收本息(now_amount) - 利息(accrual)
应收利息 = 收益(lucre)
-----
名次解释:
本期回收本息(now_amount) = 应收本金 + 利息(accrual)
利息(accrual) = 收益(lucre) + 利息管理费(fee)
正确的查询语句是(然后再根据算法加减就ok了):
SELECT SUM(now_amount), SUM(accrual), SUM(lucre), SUM(fee)
FROM `d_repay_list`
WHERE STATUS = 0
AND ((uid =13951 AND juid = 0) OR (juid = 13951))
个人中心 > 投资统计
===========================================================
待收本金算法
SELECT SUM(now_amount) AS tp_sum FROM `d_repay_list` WHERE (status=0 and uid=13951 ) LIMIT 1
+
SELECT SUM(now_amount) AS tp_sum FROM `d_repay_list` WHERE (status=0 and juid=13951 ) LIMIT 1
-
SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and uid=13951 ) LIMIT 1
-
SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=1 and juid=13951 ) LIMIT 1
status = 状态:0 待还,1 已还
待收本金 = 待收本息 - 利息(收益 + 管理费)
待收本息 = 作为投资人的待收本息之和 + 作为承接人的待收本息之和
利息 = 作为投资人的利息之和 + 作为承接人的利息之和
==========================================================================
待收利息
SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and and uid=13951 ) LIMIT 1
+
SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and juid=13951 ) LIMIT 1
待收次数
SELECT COUNT(*) AS tp_count FROM `d_invest_list` WHERE ( 1=1 AND status =5 AND (CASE juid WHEN 0 THEN uid =13951 ELSE juid
=13951 END) ) LIMIT 1
SELECT * FROM `d_repay_list` WHERE ( STATUS = 0 AND (CASE juid WHEN 0 THEN uid =13951 ELSE juid =13951 END) ) ORDER BY
repay_date ASC