public function getPartydue($invoiceId) { $totalPrice = 0; $totalAmount = 0; $sale = Sale::where('invoice_id', '=', $invoiceId)->first(); $saleDetails = SAleDetail::where('invoice_id', '=', $invoiceId)->get(); $transactions = Transaction::where('invoice_id', '=', $invoiceId)->where('payment_method', '=', 'Check')->where('type', '=', 'Receive')->where('cheque_status', '=', 1)->get(); foreach ($saleDetails as $saleDetail) { $totalPrice = $totalPrice + $saleDetail->price * $saleDetail->quantity; } $totalPrice -= $sale->discount_percentage; foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $transactions2 = Transaction::where('invoice_id', '=', $invoiceId)->where('type', '=', 'Receive')->where('payment_method', '!=', 'Check')->get(); foreach ($transactions2 as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $due = $totalPrice - $totalAmount; if ($due > 0) { return "Due is {$due}"; } else { return 'No due'; } }
public function one($id) { if ($transaction = Transaction::where(['order_id' => $id])->orderBy('updated_at', 'desc')->first()) { return response()->json(['status' => $transaction->status]); } return false; }
public function getComplete($id) { $register2 = Transaction::find($id); $register2->cheque_status = 1; $register2->save(); $register = Transaction::where('payment_method', '=', 'check')->where('type', '=', 'Receive')->orderBy('id', 'desc')->get(); return view('ChequeRegister.list', compact('register')); }
public function get_transactions($domain, Request $request) { $limit = 20; if ($request->limit) { $limit = $request->limit; } $transactions = Transaction::where('sender_id', $this->user->id)->orWhere('receiver_id', $this->user->id)->orderBy('created_at', 'desc')->paginate($limit); return $this->respondWithPagination($transactions, ["data" => $this->transactionTransformer->transformCollection($transactions)]); }
public function transaction($id) { $transaction = \App\Transaction::where('transaction_number', '=', $id)->get(); foreach ($transaction as $trns) { $t_num = $trns->transaction_number; } // dd($t_num); return view('dashboard.admin.transaction')->with(['transaction' => $transaction, 'user' => \Auth::User(), 't_num' => $t_num]); }
public function getIndex(Request $request) { $accounts = \App\Account::where('user_id', '=', \Auth::id())->find($request->id); $transactions = \App\Transaction::where('account_id', '=', $accounts->id)->orderBy('id', 'ASC')->get(); $balance = $transactions->sum('amount'); $acctType = $accounts->type; if ($acctType == 'Credit Card') { $balance = $balance * -1; } return view('transaction.index')->with('transactions', $transactions)->with('accounts', $accounts)->with('balance', $balance); }
public function destroy($id) { $userid = Auth::id(); $currentTransaction = Transaction::where('user_id', '=', $userid)->findOrFail($id); $purchasedItem = Item::where('user', $userid)->where('sku', $currentTransaction->sku)->first(); $inventoryQuantity = $currentTransaction->quantity; $newQuantity = $inventoryQuantity + $purchasedItem->quantity; $purchasedItem->update(array('quantity' => $newQuantity)); $currentTransaction->delete(); return redirect('home'); }
public function getConfirm($tnx) { // return $tnx; $tnx_id = Crypt::decrypt($tnx); $rTw = substr($tnx_id, 0, 3); if ($rTw == 'r2w') { $confirmVar = Transaction::where('tnx_id', $tnx_id)->get(); return view('accounts.transferConfirmation', compact('confirmVar')); } else { $confirmVar = Transaction::where('tnx_id', $tnx_id)->get(); $forReceiver = Transaction::where('tnx_id', $tnx_id)->first()->related_id; $receiver = User::where('id', $forReceiver)->first()->username; return view('accounts.transferConfirmation', compact('confirmVar', 'receiver')); } }
protected function computeBalance($id) { $balance = 0; $transactions = Transaction::where('investor_id', $id)->orderBy('transactionDate', 'asc')->get(); foreach ($transactions as $key => $value) { if ($value->transactionType->account_type === 'DR') { $balance -= $value->amount; } else { $balance += $value->amount; } $value->runningBalance = $balance; $value->save(); } return $balance; }
public function getPurchasedue($invoiceId) { $totalPrice = $this->getTotalAmount($invoiceId); $totalAmount = 0; $transactions = Transaction::where('invoice_id', '=', $invoiceId)->where('payment_method', '=', 'Check')->where('type', '=', 'Payment')->where('cheque_status', '=', 1)->get(); foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $transactions2 = Transaction::where('invoice_id', '=', $invoiceId)->where('type', '=', 'Payment')->where('payment_method', '!=', 'Check')->get(); foreach ($transactions2 as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $due = $totalPrice[0]->total - $totalAmount; return $due; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // get user's categories $categories = Category::with('transactions')->where('user_id', Auth::user()->id)->orderBy('name', 'ASC')->get(); // get all transactions of the user $transactions = Transaction::where('user_id', Auth::user()->id)->get(); // calculate total income and total expense $incomeTotal = $transactions->where('type', 'DEPOSIT')->sum('amount'); $expenseTotal = $transactions->where('type', 'WITHDRAWAL')->sum('amount'); // get uncategorized transactions $transactions = Transaction::where('user_id', Auth::user()->id)->whereNull('category_id')->get(); // stuff to pass into view $title = "Categories"; $heading = "Categories"; return view('categories.index', compact('categories', 'transactions', 'incomeTotal', 'expenseTotal', 'title', 'heading')); }
/** * заполнение таблицы пранзакций */ private function transactionsTable() { Transaction::truncate(); $u = User::count(); $c = Card::count(); $i = 0; while ($i < 10) { ++$i; Transaction::create(['user_id' => rand(1, $u), 'card_id' => rand(1, $c), 'money' => rand(0, 1000)]); } $crd = Card::all(); foreach ($crd as $v) { $v->balance = Transaction::where('card_id', $v->id)->sum('money'); $v->save(); } }
/** * Responds to requests to */ public function getPage($id = null) { // get the transaction $transaction = \App\Transaction::where('public_item_id', '=', $id)->first(); //dump($transaction); $transactionArray = $transaction->public_item->toArray(); //dump($transactionArray); $transactionArray["transaction_type"] = $transaction->transaction_type; $transactionArray["transaction_date"] = $transaction->created_at; $transactionArray["tax"] = $transaction->tax; $transactionArray["total"] = $transaction->total; //dump($transactionArray); $transactionObject = (object) $transactionArray; //$addedItemsArray = $addedItems->toArray(); return view('pongo.transaction_details')->with('transaction', $transactionObject); }
public function verify() { $data = \Input::all(); $transaction = \App\Transaction::where('transaction_number', '=', $data['t_num'])->get(); $status = \App\Status::find(1); foreach ($transaction as $trns) { $trns->verify(); $slots = $trns->slots; foreach ($slots as $slot) { $slot->verifySlot($slot); $slot->rank($slot); } } $trns->verify(); return redirect('valence'); }
public function getDashboard() { $reports = new Report(); $totalProducts = $reports->getTotalProducts(); $totalImports = $reports->getTotalImports(); $totalSales = $reports->getTotalSalesToday(); $totalPurchase = $reports->getTotalPurchaseToday(); $accountsBalance = $reports->getAccountBalances(); $accountBalanceTransfers = $reports->getBalanceTransferFullReport(); $stocksBranch = $reports->getStocksBranch(); $stockRequisitions = StockRequisition::orderBy('id', 'desc')->take(3)->get(); $latestTransactions = Transaction::orderBy('id', 'desc')->take(5)->get(); $register = Transaction::where('payment_method', '=', 'check')->where('type', '=', 'Receive')->where('cheque_status', '=', 0)->orderBy('id', 'desc')->get(); $purchaseregister = Transaction::where('payment_method', '=', 'check')->where('type', '=', 'Payment')->where('cheque_status', '=', 0)->orwhere('type', '=', 'Expense')->where('cheque_status', '=', 0)->orderBy('id', 'desc')->get(); //var_dump($stockRequisitions); return view('Users.dashboard')->with('latestTransactions', $latestTransactions)->with('totalProducts', $totalProducts)->with('totalSales', $totalSales)->with('stockRequisitions', $stockRequisitions)->with('stocksBranch', $stocksBranch)->with('accountsBalance', $accountsBalance)->with('accountBalanceTransfers', $accountBalanceTransfers)->with('totalPurchase', $totalPurchase)->with('totalImports', $totalImports)->with('register', $register)->with('purchaseregister', $purchaseregister); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function showTransaction() { // $transaction = Transaction::find($id); $id = Input::get('transaction_id'); $pw = Input::get('password'); // $transaction = Transaction::find($id); $transaction = Transaction::where('transaction_id', '=', $id)->first(); if ($transaction == null) { return Redirect::route('customer')->with('transaction', $transaction)->with('message', 'Invalid Transaction ID or Password'); } else { $transpas = $transaction->password; if ($transpas == $pw) { return Redirect::route('customer')->with('transaction', $transaction)->with('message', 'Transaction found'); } else { return Redirect::route('customer')->with('transaction', $transaction)->with('message', 'Invalid Transaction ID or Password'); } } }
public function process() { $transactionID = Input::get('transactionID'); $transaction = Transaction::where('transaction_id', '=', $transactionID)->first(); $logs = Log::where('transaction_id', '=', $transactionID)->get(); $recentLog = Log::where('transaction_id', '=', $transactionID)->orderBy('created_at', 'desc')->first(); if (Input::has('create')) { // Redirect to different route / URI return Redirect::route('superadmin/create_transaction')->with('transactionID', $transactionID); // Alternatively, you could process action 1 here } elseif (Input::has('update')) { // Process action 2 return Redirect::route('superadmin/update_transaction')->with('transaction', $transaction)->with('logs', $logs)->with('recentLog', $recentLog); } elseif (Input::has('out')) { // Process action 3 return Redirect::route('superadmin/out_transaction')->with('transaction', $transaction)->with('logs', $logs)->with('users', '')->with('recentLog', $recentLog); } }
public function complete(Request $request, $id) { $userid = Auth::id(); $transaction_id = Transaction::where('user_id', $userid)->where('status', 'open')->first()->transaction_id; $totalValue = Transaction::where('user_id', $userid)->where('status', 'open')->sum('price'); $tax = 0.08; $total = $totalValue * $tax + $totalValue; $change = $id; $notes = $request->input('notes'); $cash_received = $change + $total; //store receipt Receipt::create(array('transaction_id' => $transaction_id, 'user_id' => $userid, 'total' => $total, 'cash_received' => $cash_received, 'change' => $change, 'notes' => $notes)); //close transaction $transactionItems = Transaction::where('user_id', $userid)->where('status', 'open')->get(); foreach ($transactionItems as $item) { $item->update(array('status' => 'closed')); } return redirect('home'); }
/** * Responds to requests to */ public function getPage() { // get all the items added by the user $addedItems = \App\AddedItem::where('user_id', '=', \Auth::id())->get(); //dump($addedItems); $addedItemsArray = $addedItems->toArray(); // get all the transactions of the user $transactions = \App\Transaction::where('user_id', '=', \Auth::id())->get(); //dump($transactions); $transactionArrays = array(); foreach ($transactions as $transaction) { $transactionArray = $transaction->public_item->toArray(); //dump($transactionArray); $transactionArray["transaction_type"] = $transaction->transaction_type; $transactionArray["transaction_date"] = $transaction->created_at->timezone('America/New_York')->format('m/d/Y h:i A'); array_push($transactionArrays, $transactionArray); } //dump($transactionArrays); return view('pongo.myspace')->with(['addedItems' => $addedItemsArray, 'transactions' => $transactionArrays]); }
/** * Display search results * * @return \Illuminate\Http\Response */ public function search(Request $request) { // validate request $this->validate($request, ['sort' => 'in:date,amount', 'order' => 'in:DESC,ASC', 'type' => 'in:WITHDRAWAL,DEPOSIT']); // get a list of all transactions $transactions = Transaction::where('user_id', Auth::user()->id)->where('comment', 'LIKE', '%' . $request->q . '%'); // filter if (!empty($request->type)) { $transactions = $transactions->where('type', $request->type); } // remember total records session()->flash('total_count', ceil($transactions->count() / 25)); // sort if (!empty($request->sort)) { $transactions = $transactions->orderBy($request->sort, $request->order)->simplePaginate(25); } else { $transactions = $transactions->orderBy('date', 'desc')->simplePaginate(25); } // stuff to pass into view $action = 'TransactionsController@search'; $emptyMsg = "No Results for '" . $request->q . "'"; $title = "Search Transactions"; $heading = "Search Transactions - '" . $request->q . "'"; $request->flash(); return view('transactions.index', compact('transactions', 'action', 'emptyMsg', 'title', 'heading')); }
private function setReceiveSalePayment() { $sales[0] = Sale::where('invoice_id', '=', Input::get('invoice_id'))->get(); $saleTransaction = new Transaction(); $saleTransaction->account_category_id = Input::get('account_category_id'); $saleTransaction->account_name_id = Input::get('account_name_id'); $saleTransaction->amount = Input::get('amount'); $saleTransaction->remarks = Input::get('remarks'); $saleTransaction->type = "Receive"; $saleTransaction->user_id = Session::get('user_id'); $saleTransaction->payment_method = Input::get('payment_method'); $saleTransaction->cheque_no = Input::get('cheque_no'); $saleTransaction->invoice_id = Input::get('invoice_id'); $totalAmount = 0; $totalPrice = 0; $saleDetails = SAleDetail::where('invoice_id', '=', $saleTransaction->invoice_id)->get(); $transactions = Transaction::where('invoice_id', '=', $saleTransaction->invoice_id)->get(); foreach ($saleDetails as $saleDetail) { $totalPrice = $totalPrice + $saleDetail->price * $saleDetail->quantity; } foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $sale = Sale::find($sales[0][0]['id']); if ($totalAmount == $totalPrice) { $sale->status = "Completed"; } else { $sale->status = "Partial"; } $accountPayment = NameOfAccount::find(Input::get('account_name_id')); $accountPayment->opening_balance = $accountPayment->opening_balance + Input::get('amount'); $saleTransaction->branch_id = Input::get('branch_id'); $saleTransaction->save(); $sale->save(); $accountPayment->save(); Session::flash('message', 'Sales Due has been Successfully Received.'); }
public function get_keyword_amount($keyword_id) { return Transaction::where('keyword_id', $keyword_id)->where('postdate', '>', date('Y-m-d', strtotime('-6 weeks')))->lists('amount')->sum(); }
public function search(Request $request, $race_id) { $race = Race::find($race_id); $gateways = Gateway::where('enabled', true)->get(); $gateway_list = $gateways->lists('name', 'id'); $runners = []; $codes = []; $transactions = []; if (!($criteria = $request->get('criteria'))) { $criteria = ''; } if (!($type = $request->get('type'))) { $type = ''; } if (!($runner_status = $request->get('runner_status'))) { $runner_status = ''; } if (!($payment_id = $request->get('payment_id'))) { $payment_id = ''; } if (!($code_status = $request->get('code_status'))) { $code_status = ''; } if (!($transaction_status = $request->get('transaction_status'))) { $transaction_status = ''; } if (!($gateway_id = $request->get('gateway_id'))) { $gateway_id = ''; } if (!($date = $request->get('date'))) { $date = ''; } if ($request->has('criteria')) { switch ($type) { case 'runner_name': $runners_query = Runner::where([['last_name_01', 'like', '%' . $criteria . '%'], ['race_id', $race->id]]); break; case 'runner_doc': $runners_query = Runner::where([['doc_num', $criteria], ['race_id', $race->id]]); break; case 'runner_bib': $runners_query = Runner::where([['bib', $criteria], ['race_id', $race->id]]); break; case 'code': $codes = Code::where([['code', 'like', '%' . $criteria . '%'], ['race_id', $race->id]]); if ($code_status < 2) { $codes = $codes->where('status', $code_status); } $codes = $codes->get(); break; case 'transaction': $transactions = Transaction::where('id', $criteria); if ($transaction_status > 3) { $transactions = $transactions->where('status', $transaction_status); } if ($gateway_id > 0) { $transactions = $transactions->where('gateway_id', $gateway_id); } $transactions = $transactions->get(); break; default: $runners_query = Runner::where('last_name_01', 'like', '%' . $criteria . '%')->get(); break; } if (!empty($runners_query)) { if ($runner_status < 2) { $runners_query = $runners_query->where('status', $runner_status); } if ($payment_id > 0) { $runners_query = $runners_query->where('payment_id', $payment_id); } $runners = $runners_query->get(); } } return view('admin.search')->with(['race' => $race, 'runners' => $runners, 'codes' => $codes, 'transactions' => $transactions, 'gateway_list' => $gateway_list, 'criteria' => $criteria, 'type' => $type, 'date' => $date, 'runner_status' => $runner_status, 'code_status' => $code_status, 'transaction_status' => $transaction_status, 'payment_id' => $payment_id, 'gateway_id' => $gateway_id]); }
<th>Purpose</th> <th>Amount</th> <th>Remarks</th> <th>Status</th> <th>Created</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($expenseAll as $expense ) <?php $branch = \App\Branch::find($expense->branch_id); $transaction = \App\Transaction::where('invoice_id', '=', $expense->invoice_id)->first(); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$branch->name}}</td> <td>{{$expense->invoice_id}}</td> <td>{{$expense->category}}</td> @if($expense->particular) <td>{{$expense->particular}}</td> @else <td>{{"Not Available"}}</td> @endif @if($expense->purpose)
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Transaction $transactions) { $revenue = $transactions->where('business_expense', '=', 1)->where('amount', '>', 0)->where('category_id', '=', 14)->sum('amount'); return view('taxes.index', ['revenue' => $revenue]); }
public function postCheckout() { $tos = Cart::tos(); $total = Cart::total(); $input = array('order_date' => date('Y-m-d H:i:s'), 'total_tax' => $tos, 'total_purchase' => $total, 'order_status' => 'pending', 'name' => Input::get('name'), 'email' => Input::get('email'), 'no_tel' => Input::get('no_tel'), 'address' => Input::get('address'), 'city' => Input::get('city'), 'poskod' => Input::get('poskod'), 'state' => Input::get('state')); $order = Order::create($input); $formid = str_random(); $cart_content = Cart::content(); foreach ($cart_content as $cart) { $transaction = new Transaction(); $transaction->product_id = $cart->id; $transaction->form_id = $formid; $transaction->qty = $cart->qty; $transaction->total_price = $cart->subtotal; $transaction->order_id = $order->id; $transaction->gambar_id = $cart->options->img_id; $transaction->color = $cart->options->color; $transaction->size = $cart->options->size; $transaction->category_id = $cart->options->cat; $transaction->save(); } $ttr = Transaction::where('order_id', '=', $order->id); Cart::destroy(); Session::forget('values'); return redirect('store/thankyou/'); }
private function setPurchasePayment() { $accountPayment = NameOfAccount::find(Input::get('account_name_id')); if ($accountPayment->opening_balance >= Input::get('amount')) { $expense[0] = Expense::where('invoice_id', '=', Input::get('invoice_id'))->get(); $expenseTransaction = new Transaction(); $expenseTransaction->branch_id = Input::get('branch_id'); $expenseTransaction->account_category_id = Input::get('account_category_id'); $expenseTransaction->account_name_id = Input::get('account_name_id'); $expenseTransaction->amount = Input::get('amount'); $expenseTransaction->remarks = Input::get('remarks'); $expenseTransaction->type = "Expense"; $expenseTransaction->user_id = Session::get('user_id'); $expenseTransaction->payment_method = Input::get('payment_method'); $expenseTransaction->invoice_id = Input::get('invoice_id'); $expenseTransaction->cheque_no = Input::get('cheque_no'); $expenseTransaction->save(); $totalAmount = 0; $transactions = Transaction::where('invoice_id', '=', $expenseTransaction->invoice_id)->get(); foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $expense = Expense::find($expense[0][0]['id']); if ($totalAmount == $expense->amount) { $expense->status = "Completed"; } else { $expense->status = "Partial"; } $expense->save(); $accountPayment->opening_balance = $accountPayment->opening_balance - Input::get('amount'); $accountPayment->save(); Session::flash('message', 'Expense has been Successfully Cleared.'); } else { Session::flash('message', 'You dont have Enough Balance'); } }
public function getPartydue($party_id) { $partySales = PurchaseInvoice::where('party_id', '=', $party_id)->where('status', '!=', 'Completed')->get(); if (count($partySales) > 0) { $totalAmount = 0; $totalPrice = 0; foreach ($partySales as $sale) { $saleDetails = PurchaseInvoiceDetail::where('detail_invoice_id', '=', $sale->invoice_id)->get(); $transactions = Transaction::where('invoice_id', '=', $sale->invoice_id)->where('payment_method', '=', 'Check')->where('type', '=', 'Payment')->where('cheque_status', '=', 1)->get(); foreach ($saleDetails as $saleDetail) { $totalPrice = $totalPrice + $saleDetail->price * $saleDetail->quantity; } foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $transactions2 = Transaction::where('invoice_id', '=', $sale->invoice_id)->where('type', '=', 'Payment')->where('payment_method', '!=', 'Check')->get(); foreach ($transactions2 as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } } $due = $totalPrice - $totalAmount; echo "<p3 style='color: red;font-size: 114%; margin-left: 32px;'>Due is {$due}</p3>"; } else { echo "<p3 style='color: blue;font-size: 114%; margin-left: 32px; '>No Due</p3>"; } }
/** * Remove the specified resource from storage. * * @param Transaction $transaction * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Transaction $transaction, $id) { $transaction->where('id', '=', $id)->firstOrFail()->delete(); return redirect('transactions')->with('success', 'Successfully deleted transaction.'); }
/** * Check activation code * * @param $email * @param $activationCode * @param Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function checkActivationCode($email, $activationCode, Request $request) { /** * Check if user exists */ $user = User::where('email', $email)->where('activation_code', $activationCode)->first(); /** * User not exists or code is not valid */ if (empty($user)) { $request->session()->flash('custom_error', 'Zadaný e-mail neexistuje nebo je neplatný aktivační kód'); } else { $user->active = true; $user->activation_code = str_random(16); $user->save(); /** * Add reward for registration */ $rewardsCount = Transaction::where('transactionstatus_id', 5)->where('user_id', $user->id)->count(); if ($rewardsCount < 1) { /** * Save transaction */ $this->_saveTransation(5, $user->id, $this->_getSettings(6)); } /** * Add reward for recommedation */ if (!empty($user->recomendation_id)) { $recommendation = Recommendation::find($user->reccomendation_id); if (!empty($recommendation)) { /** * Check transaction */ $transactionCount = Transaction::where('recommendation_id', $recommendation->id)->count(); if ($transactionCount < 1) { /** * Find user and save money */ $rUser = User::find($recommendation->user_id); if (!empty($rUser)) { $this->_saveTransation(2, $rUser->id, $this->_getSettings(2)); } } } } $request->session()->flash('success', 'Gratulujeme, váš účet byl úspěšně aktivován. Přihlásit se můžete zde: ' . '<br><a href="' . route('admin.dashboard.index') . '">' . route('admin.dashboard.index') . '</a>'); /** * Save reward */ if ($user->recommendation_id != null && $user->recommendation_id > 0) { /** * Load recommendation */ $recommendation = Recommendation::find($user->recommendation_id); $this->_saveTransation(2, $recommendation->user_id, $this->_getSettings(2), null, null, $user->recommendation_id); } } return redirect(route('frontend.homepage.index')); }