SELECT 'V' as Ind, VoucherID,  VoucherPrefix, VoucherType, VoucherDate as 'Date', VoucherID as Voucher, (select ledger_name from $master_db.ledger_master where ledger_id = to_ledger) as Ledger,  (CR_QTY) as Quantity, (Cr_Amount) as Value  FROM $trans_db.transaction_item_helper  Where from_location like '$f2' AND VoucherDate >= str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') AND VoucherDate <= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s') and ItemID ='$f1'