<?php require_once 'core/init.php'; $user = new User(); if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validate(); $validation = $validate->check($_POST, array('ddlMyAccounts' => array('name' => "Saját számla", 'required' => true), 'ddlAccountTypes' => array('name' => "Tipus", 'required' => true), 'amount' => array('name' => 'Összeg', 'required' => true, 'min' => 1), 'description' => array('name' => 'Leírás', 'required' => true, 'min' => 7))); if ($validation->passed()) { if (Input::get('amount') <= $user->getAccAmount(Input::get('ddlMyAccounts'))) { $transactionid = $user->getTranByAccID(Input::get('ddlMyAccounts')); if (Input::get('ddlAccountTypes') == "accountid") { $toaccid = $user->getAccByCode(Input::get('accountid')); $totranid = $user->getTranByAccID($toaccid->ID); } else { if (Input::get('ddlAccountTypes') == "contact") { $toaccid = $user->getAccByCode(Input::get('ddlContacts')); $totranid = $user->getTranByAccID($toaccid->ID); } } $senderaccid = Input::get('ddlMyAccounts'); if ($toaccid != 0) { $user->send(array('Transaction_ID' => $transactionid->ID, 'Account_ID' => $toaccid->ID, 'When' => date(DATE_ATOM), 'Amount' => Input::get('amount'), 'IsIncome' => 0, 'Description' => Input::get('description'))); $user->send(array('Transaction_ID' => $totranid->ID, 'Account_ID' => Input::get('ddlMyAccounts'), 'When' => date(DATE_ATOM), 'Amount' => Input::get('amount'), 'IsIncome' => 1, 'Description' => Input::get('description'))); Session::flash('home', 'Tranzakció sikeresen végrehajtva !'); Redirect::to('index.php'); } else { echo 'Tranzakció sikertelen! Ellenőrizze a megadott információkat!'; } } else { echo 'Nincs elég pénz a számláján!!!';
?> </h5> <table class="table"> <thead class="table-invers"> <tr> <th>#</th> <th>Irány</th> <th>Ügyfél</th> <th>Összeg</th> <th>Leírás</th> </tr> </thead> <tbody> <?php $accid = $user->getAccByUserID($user->data()->ID); $tranid = $user->getTranByAccID($accid->ID); $transactions = $user->getTransactions($tranid->ID); if (count($transactions) > 0) { for ($i = 0; $i < count($transactions); $i++) { $lugyfel = $user->getUserByAccID($transactions[$i][2]); $ugyfel = $user->getUserByID($lugyfel->User_ID); echo '<tr> <th scope="row">' . ($i + 1) . '</th> <td>' . ($transactions[$i][5] == 0 ? '<i class="fa fa-arrow-right"></i>' : '<i class="fa fa-arrow-left"></i>') . ' </td> <td>' . $ugyfel->LastName . ' ' . $ugyfel->FirstName . '</td> <td>' . $transactions[$i][4] . ' RON</td> <td>' . $transactions[$i][6] . '</td> </tr>'; } } ?>