private function getBalanceEntry($current, $balances, $accId, $datestamp)
    {
        if (isset($balances[$accId][$datestamp])) {
            /* there is data for this account on this date */
            $result = $balances[$accId][$datestamp];
        } else {
            /* there is NO data for this account on this date */
            $result = new EBalance();
            $result->setAccountId($accId);
            $result->setDate($datestamp);
            $result->setBalanceOpen(0);
            $result->setTotalDebit(0);
            $result->setTotalCredit(0);
            $result->setBalanceClose(0);
            if (isset($current[$accId])) {
                /* we need to update entry balances for newly created entry */
                $result->setBalanceOpen($current[$accId]);
                $result->setBalanceClose($current[$accId]);
            }
        }
        return $result;
    }
private function getBalanceEntry($current, $balances, $accId, $datestamp)
    {
        if (isset($balances[$accId][$datestamp])) {
            /* there is data for this account on this date */
            $result = $balances[$accId][$datestamp];
        } else {
            /* there is NO data for this account on this date */
            $result = new EBalance();
            $result->setAccountId($accId);
            $result->setDate($datestamp);
            $result->setBalanceOpen(0);
            $result->setTotalDebit(0);
            $result->setTotalCredit(0);
            $result->setBalanceClose(0);
            if (isset($current[$accId])) {
                /* we need to update entry balances for newly created entry */
                $result->setBalanceOpen($current[$accId]);
                $result->setBalanceClose($current[$accId]);
            }
        }
        return $result;
    }
private function getBalanceEntry ( $ current , $ balances , $ accId , $ datestamp ) { if ( isset ( $ balances [ $ accId ] [ $ datestamp ] ) ) { /* there is data for this account on this date */ $ result = $ balances [ $ accId ] [ $ datestamp ] ; } else { /* there is NO data for this account on this date */ $ result = new EBalance ( ) ; $ result -> setAccountId ( $ accId ) ; $ result -> setDate ( $ datestamp ) ; $ result -> setBalanceOpen ( 0 ) ; $ result -> setTotalDebit ( 0 ) ; $ result -> setTotalCredit ( 0 ) ; $ result -> setBalanceClose ( 0 ) ; if ( isset ( $ current [ $ accId ] ) ) { /* we need to update entry balances for newly created entry */ $ result -> setBalanceOpen ( $ current [ $ accId ] ) ; $ result -> setBalanceClose ( $ current [ $ accId ] ) ; } } return $ result ; }
Extract existing balance on the date or create new empty entity.

@param array $current [accId => balance]
@param EBalance[] $balances
@param $accId
@param $datestamp
@return EBalance
@throws \Exception
Extract existing balance on the date or create new empty entity .