SELECT SUM(l.`in`) AS `Credit Applied`,
COALESCE(cx.iso,'Main Currency') AS `Currency`,
l.admin_id AS `Staff ID`,
CONCAT( ad.firstname, ' ', ad.lastname ) AS `Staff Member`
FROM hb_client_credit_log l
JOIN hb_client_details cd ON cd.id =l.client_id
JOIN hb_client_billing b ON b.client_id=l.client_id
LEFT JOIN hb_transactions t ON t.id=l.transaction_id
LEFT JOIN hb_modules_configuration mc ON mc.id=t.module
LEFT JOIN hb_currencies cx ON cx.id=b.currency_id
LEFT JOIN hb_admin_details ad ON ad.id=l.admin_id
WHERE l.date>:date_bottom
AND l.date<:date_top
AND
l.`in`>0
GROUP BY b.currency_id, l.admin_id