SELECT l.date AS `Date`,
l.`in` AS `Credit Applied`,
l.`admin_id` AS `Staff ID`,
CONCAT( ad.firstname, ' ', ad.lastname ) AS `Staff Member`,
COALESCE(mc.modname,'None') AS `Gateway`,
COALESCE(cx.iso,'Main Currency') AS `Currency`,
l.client_id AS `Client Id`,
CONCAT(cd.firstname,' ',cd.lastname) AS `Client name`
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
ORDER BY l.date ASC