GL total is not including the opening balance

Hello Experts

I am using a self hosted server and when I am pulling the GL report for an account where the opening balance exists, the closing balance total is not including the opening balance into consideration while calculating and thus the closing balance and totals are displaying incorrectly. Can anyone help in fixing up the code?
2017-10-25_LI