create function getLastIncomeDateForOverdue(sPlandate varchar(40), sPlanId varchar(40)) returns varchar(80)
RETURN (
		SELECT MAX(lri.hire_date) AS sumrent FROM LC_RENT_INCOME lri WHERE lri.plan_id=sPlanId AND lri.hire_date>splandate AND lri.rent>0 GROUP BY lri.plan_id
	);

