SELECT  'L', trans.Ledger_ID,  led.Ledger_Name as 'Ledger', SUM(Credit_Amount) as 'Cr Amount',  SUM(Debit_Amount) as 'Dr Amount' FROM $trans_db.Transaction_Helper trans JOIN $master_db.Ledger_Master led  ON trans.ledger_id = led.ledger_id  WHERE Voucher_Date >=str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') AND Voucher_Date <=str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s') AND Voucher_Type = 'ReceiptVoucher' GROUP BY trans.Ledger_ID ORDER BY Ledger