/**
  * Dashboard / All Transactions
  */
 public function getIndex()
 {
     // Page Title
     $this->_data['page_title'] = "Transactions";
     $this->_data['affiliates'] = Affiliate::orderBy('name', 'ASC')->get();
     $this->_data['products'] = Product::orderBy('name', 'ASC')->get();
     $transactions = new Transaction();
     $this->_data['transactions'] = $transactions->search();
     $this->_data['searchParams'] = $transactions->getSearchParams();
     $this->_data['revenue'] = $transactions->totalRevenue();
     $this->_data['paidAffliates'] = $transactions->paidToAffiliates();
     $this->_data['refundQueue'] = $transactions->refundQueueCount();
     return View::make('admin.transactions.index', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
 }
<?php

require_once 'core/init.php';
$member_role = $_SESSION['roles'];
if (in_array("Laboratory Assistant", $member_role)) {
} else {
    header('location:restricted_page.php');
}
if (count($_POST) > 0) {
    //print_r($_POST);
    //print_r($_POST["condition"]);
    //print_r($_POST["returned"]);
    $tid = $_POST["tid"];
    $tran = Transaction::search($tid);
    $tran->updateComment($_POST["comment"]);
    $tran->updateRemark($_POST["remark"]);
    $condition = $_POST["condition"];
    $returned = $_POST["returned"];
    $i = 0;
    for ($i = 1; $i < count($returned); $i++) {
        if ($tran->finishReturn($returned[$i], $condition[$i])) {
            $status = true;
        } else {
            $status = false;
        }
    }
    if ($status) {
        echo "<div style='text-align:center';>";
        echo "<img src='img/icons/success-icon.png' hight='200' width='200'>";
        echo "<h2>Item Return Successful !</h2>";
        echo "<a href='item_return_panel1.php'><h4>Back to Item Returns</h4></a>";
Exemplo n.º 3
0
 public function transactions()
 {
     $collection = Transaction::search([TransactionSearch::ids()->in($this->transactionIds)]);
     return $collection;
 }
Exemplo n.º 4
0
 /**
  * Recent Transactions
  *
  * Get 25 recent transactions of a user
  */
 public function postRecentTransactions()
 {
     if ($this->_isValidRequest()) {
         $email = Input::get('email');
         if (!$email) {
             $this->_invalidRequest("Email parameter is required");
         }
         $transaction = new Transaction();
         $product_id = Product::where('code', '=', Input::get('code'))->first()->id;
         // Set search params
         $params = array("from" => "1970-01-01", "to" => date("Y-m-d", time()), "range" => "custom", "product" => $product_id, "affiliate" => NULL, "paid" => 1, "refunded" => 1, "search" => "true", "q" => NULL, "email" => $email);
         $transactions = $transaction->search($params);
         $response = array();
         if (!$transactions) {
             die(json_encode(array('data' => $response)));
         }
         foreach ($transactions as $transaction) {
             $response[] = array('transaction_id' => $transaction->pay_id, 'amount' => $transaction->amount, 'is_refunded' => $transaction->is_refunded ? 'true' : 'false', 'date' => $transaction->updated_at, 'plan_name' => $transaction->plan_name, 'plan' => Plan::where('id', '=', $transaction->plan_id)->first()->code);
         }
         die(json_encode(array('data' => $response)));
     }
 }