/** * Get income for current month from begin to current datetime * @param $accountId * * @return int */ public static function getIncomeForCurrentMonth($accountId) { $transactions = AccountsHistoryContainer::getTransactionsByInterval($accountId, DateFormatter::getCurrentMonthInterval()); $money = 0; foreach ($transactions as $transaction) { $money += $transaction->money; } return $money; }
/** * Set transactions data for each graphics * * @param $accountId * * @return mixed */ private function setDataForGraphics($accountId) { $this->resultContainer['income']->data = AccountsHistoryContainer::getTransactionsByInterval($accountId, $this->resultContainer['income']->interval); $this->resultContainer['receipt']->data = AccountsHistoryContainer::getReceiptByInterval($accountId, $this->resultContainer['receipt']->interval); $this->resultContainer['expense']->data = AccountsHistoryContainer::getExpenseByInterval($accountId, $this->resultContainer['expense']->interval); return $this->resultContainer; }