From the format of the code, it appears to be Crystal Reports. But to answer the question. There are couple of ways to filter for a date range. My preference is this:
{ledgerdetails.date} >= {?datef} and
{ledgerdetails.date} <= {?dateto}
and to avoid issues with the or statement. The whole filter should probably look something like this.
{ledgerdetails.date} >= {?datef} and
{ledgerdetails.date} <= {?dateto}
(
{ledgerdetails.Accountnamedr} = {?tran} or
{ledgerdetails.accountnamecr}={?tran}
)