fixes account balance calculation in some case

- we only want to sum transaction in the period when there is a from date.
- when from date is passed, really get period start date from from date