SELECT _id, ( SELECT Ledger_Name FROM Ledger_Master WHERE Ledger_Id = chq.Ledger_ID) as Ledger, ( SELECT Ledger_Name FROM Ledger_Master WHERE Ledger_Id = chq.Our_Bank_Id) as 'Our Bank', Debit_Amount 'Debit Amount', Credit_Amount 'Credit Amount',  CASE WHEN is_Returned = 1 THEN 'Rejected'  WHEN is_Presented = 1 THEN 'Presented' END AS 'Current Status', Issued_On 'Issued On', Presented_On 'Presented On',   '' as 'Update Status', '' as 'Status Date'  FROM Cheque_Details chq  WHERE is_Cleared <> 1 AND Issued_On <= str_to_date('$toDateTime','%Y-%m-%d')