function to get opening balance