コード例 #1
0
ファイル: History.php プロジェクト: s3444261/assignment2
 public function searchResults($search)
 {
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $_SESSION['accountID'] = $search['accountID'];
     $this->setAccountSelected($_SESSION['accountID']);
     $account = new Account();
     $account->accountID = $_SESSION['accountID'];
     $account->getAccount();
     $_SESSION['searchDetails'] = $search['searchDetails'];
     $_SESSION['fromAmount'] = $search['fromAmount'];
     $_SESSION['toAmount'] = $search['toAmount'];
     if (strlen($search['toDate']) != 0) {
         $_SESSION['toDate'] = $search['toDate'];
     } else {
         $_SESSION['toDate'] = date('Y-m-d');
     }
     if (strlen($search['fromDate']) != 0) {
         $_SESSION['fromDate'] = $search['fromDate'];
     } else {
         $_SESSION['fromDate'] = date("Y-m-d", strtotime("-1 months"));
     }
     $_SESSION['period'] = date('d/m/Y', strtotime($_SESSION['fromDate'])) . ' to ' . date('d/m/Y', strtotime($_SESSION['toDate']));
     $transactions = new Transactions();
     $transactions->accountID = $_SESSION['accountID'];
     $arr = array('openBalance' => $account->openBalance);
     $_SESSION['history'] = $transactions->getTransactions($arr);
     $_SESSION['found'] = $transactions->countTransactions($arr);
     $_SESSION['historyDebit'] = $transactions->getDebits($arr);
     $_SESSION['historyCredit'] = $transactions->getCredits($arr);
     $_SESSION['historyFee'] = $transactions->getFees($arr);
     $_SESSION['historyNet'] = $transactions->getNet($arr);
 }