コード例 #1
0
 public function getRolloverCancel($id, Rollover $rollover, Payment $payment)
 {
     $customer_rollover = $rollover->whereId((int) $id)->first();
     $amount = $customer_rollover->rollover_amount;
     $rollover_from_id = $customer_rollover->rollover_from_user;
     $rollover_to_id = $customer_rollover->rollover_to_user;
     $delete = $rollover->whereId((int) $id)->delete();
     if ($delete) {
         $payment->where('customer_id', (int) $rollover_from_id)->increment('account_balance', $amount);
         $payment->where('customer_id', (int) $rollover_to_id)->decrement('account_balance', $amount);
         flash()->success(nairaFormater($amount) . ' has been rolled over from ' . customerFullname($rollover_to_id) . ' to ' . customerFullname($rollover_from_id) . '!');
     } else {
         flash()->error('An error occurred while rolling over ' . nairaFormater($amount) . ' back to ' . customerFullname($rollover_from_id) . '!');
     }
     return redirect()->back();
 }
コード例 #2
0
 public function index()
 {
     $data = $this->load_common_data();
     $payments = Payment::where('user_status', 'ENABLED')->get();
     $data['payments'] = $payments;
     return $this->back_view('payments.list', $data);
 }
コード例 #3
0
ファイル: PageController.php プロジェクト: jdrda/olapus
 /**
  * Get homepage
  *
  * @param Request $request
  * @return View|void
  */
 public function getHomepage(Request $request)
 {
     /**
      * Load data
      */
     $this->_arViewData = $this->_loadPageByUrl('/');
     /**
      * Number of users
      */
     $this->_arViewData['users_no'] = User::count() + 135000;
     /**
      * Number of campaigns
      */
     $this->_arViewData['campaigns_no'] = Campaign::count();
     /**
      * Number of payments total
      */
     $this->_arViewData['payments_no_total'] = Payment::sum('amount');
     /**
      * Number of payments last month
      */
     $this->_arViewData['payments_no_last_month'] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count();
     /**
      * Return view
      */
     return $this->_showViewOr404('frontend.homepage');
 }
コード例 #4
0
 /**
  * Show the board index for the user.
  *
  * @return Response
  */
 public function getContribute()
 {
     $devTimeSum = 0;
     $devTimer = "0 hours";
     $donors = Payment::where('amount', '>', '0')->orderBy('amount', 'desc')->get();
     $donorGroups = ['uber' => [], 'plat' => [], 'gold' => [], 'silver' => [], 'bronze' => []];
     $donorWeights = ['uber' => 25, 'plat' => 20, 'gold' => 15, 'silver' => 10, 'bronze' => 10];
     foreach ($donors as $donor) {
         // Add the amount to the dev timer.
         $devTimeSum += $donor->amount;
         // Sort each donor into groups.
         if ($donor->amount >= 10000) {
             $donorGroups['uber'][] = $donor;
         } else {
             if ($donor->amount >= 5000) {
                 $donorGroups['plat'][] = $donor;
             } else {
                 if ($donor->amount >= 1800) {
                     $donorGroups['gold'][] = $donor;
                 } else {
                     if ($donor->amount >= 1200) {
                         $donorGroups['silver'][] = $donor;
                     } else {
                         $donorGroups['bronze'][] = $donor;
                     }
                 }
             }
         }
     }
     // Determine the time in a literal string.
     $devHours = 0;
     $devDays = 0;
     $devInflation = 24 * 7 / (8 * 5);
     // This inflation factor will make the dev timer reflect off hours too, on the assumption of a 40 hour work week.
     $devHours = $devTimeSum / 100 / (double) env('CONTRIB_HOUR_COST', 10) * $devInflation;
     $devDays = (int) ($devHours / 24);
     $devHours = (int) ($devHours % 24);
     if ($devHours > 0 || $devDays > 0) {
         $devTimer = "";
         if ($devDays > 0) {
             if ($devDays != 1) {
                 $devTimer .= "{$devDays} days";
             } else {
                 $devTimer .= "{$devDays} day";
             }
             if ($devHours > 0) {
                 $devTimer .= " and ";
             }
         }
         if ($devHours > 0) {
             if ($devHours != 1) {
                 $devTimer .= "{$devHours} hours";
             } else {
                 $devTimer .= "{$devHours} hour";
             }
         }
     }
     return $this->view(static::VIEW_CONTRIBUTE, ["devTimer" => $devTimer, "donations" => $devTimeSum, "donors" => $donorGroups, "donorWeight" => $donorWeights]);
 }
コード例 #5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     if (Auth::user()->admin == 1) {
         $payment = Payment::findOrFail($id);
     } else {
         $payment = Payment::where('group', Auth::user()->group)->where('id', $id)->firstOrFail();
     }
     return view('payment.show', ['payment' => $payment]);
 }
コード例 #6
0
 public function single($slug)
 {
     $start = Carbon::today()->startOfDay();
     $end = Carbon::today()->endOfDay();
     $company = TravelCompany::where('slug', $slug)->first();
     $bookings = Payment::where('travel_company_id', $company->id)->whereBetween('updated_at', [$start, $end])->orderBy('updated_at', 'asc')->get();
     //        dd($bookings);
     return view('admin.accounting.single', ['bookings' => $bookings]);
 }
コード例 #7
0
ファイル: PaymentController.php プロジェクト: reis/fp
 public function getReport(Request $request)
 {
     if ($request->has('restaurant')) {
         $Payments = Payment::where('restaurant', $request->input('restaurant'))->where('created_at', '>=', time() - 24 * 60 * 60)->get();
     } else {
         $Payments = Payment::where('created_at', '>=', time() - 24 * 60 * 60)->get();
     }
     return response()->json($Payments);
 }
コード例 #8
0
ファイル: UserController.php プロジェクト: 3oatkung/engine
 public function cancelMember($id, Request $request)
 {
     $users = User::where('id', $id)->get();
     $users[0]->memberStatus = '';
     $users[0]->save();
     $payments = Payment::where('email', $users[0]->email)->get();
     $payment = $payments[0];
     $payment->delete();
     return redirect('/user');
 }
コード例 #9
0
ファイル: IsMember.php プロジェクト: 3oatkung/engine
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::user()->memberStatus == "Member" || Auth::user()->memberStatus == "Admin") {
         return $next($request);
     } elseif (count(Payment::where('email', Auth::user()->email)->get()) > 0) {
         $user = Auth::user();
         $user->memberStatus = 'Member';
         $user->save();
         return $next($request);
     }
     return view('errors.notMember');
 }
コード例 #10
0
ファイル: PaymentController.php プロジェクト: 3oatkung/engine
 public function uncheckedPayment($id)
 {
     $payments = Payment::where('id', $id)->get();
     $payment = $payments[0];
     $payment->checked = "";
     $payment->save();
     $users = User::where('email', $payment->email)->get();
     if (count($users) > 0) {
         $user = $users[0];
         $user->checked = "";
         $user->save();
     }
     return redirect('/showPayments');
 }
コード例 #11
0
 /**
  * Validates Paypal IPN and updates the status.
  *
  * @return Response
  */
 public function paypal(Request $request)
 {
     if ($request->status != 'COMPLETED') {
         abort(404, 'Not Found.');
         return;
     }
     $payment = Payment::where('payment_key', '=', $request->pay_key)->first();
     if ($payment) {
         $payment->status = 1;
         $payment->ipn_result = json_encode($request->all());
         $payment->save();
         echo 'success';
     } else {
         abort(404, 'Not Found.');
     }
 }
コード例 #12
0
 /**
  * Show the affiliate dashboard to the user.
  *
  * @return Response
  */
 public function index(Request $request, $link, $app_name, $aff_code)
 {
     $affiliate_row = Affiliate::where('external_link', '=', $link)->first();
     if ($affiliate_row == null) {
         return redirect('error');
     }
     //$user_infusionsoft = UserInfusionsoft::where('app_name','=', $app_name)->first();
     $user_infusionsoft = $affiliate_row->infusionsoft_user;
     $app_infusionsoft = new iSDK();
     if (!$app_infusionsoft->cfgCon($user_infusionsoft->app_name, $user_infusionsoft->app_apikey)) {
         return redirect('error');
     }
     $affiliate_id = $affiliate_row->aff_id;
     $payout = 0;
     $payment_sum = DB::table('payments')->select(DB::raw('sum(amount) as amount'))->where('affiliate_id', '=', $affiliate_row->id)->where('status', '=', 1)->first();
     if ($payment_sum) {
         $payout = $payment_sum->amount;
     }
     $payments = Payment::where('affiliate_id', '=', $affiliate_row->id)->where('status', '=', 1)->get();
     $aff_fields = array('Id', 'AffCode', 'AffName', 'ContactId', 'ParentId', 'PayoutType', 'SalePercent', 'Status');
     $query = array('Id' => $affiliate_id);
     $results = $app_infusionsoft->dsQuery("Affiliate", 1, 0, $query, $aff_fields);
     if (count($results) < 1) {
         return redirect('/')->with('error', 'No affiliate has been found.');
     }
     $affiliate = $results[0];
     $start = date('Ymd\\TH:i:s', mktime(00, 00, 00, 1, 01, 2014));
     $end = date('Ymd\\TH:i:s');
     $clawbacks = $app_infusionsoft->affClawbacks($affiliate_id, $start, $end);
     $commissions = $app_infusionsoft->affCommissions($affiliate_id, $start, $end);
     $payouts = $app_infusionsoft->affPayouts($affiliate_id, $start, $end);
     $total = $app_infusionsoft->affRunningTotals(array($affiliate_id));
     $total_record = $total[0];
     $amount = $total_record['RunningBalance'] - $payout;
     return view('affiliates.public', compact('affiliate', 'payments', 'total_record', 'payout', 'affiliate_row', 'clawbacks', 'commissions', 'payouts', 'amount'));
 }
コード例 #13
0
 public function getPayment(Request $request)
 {
     if ($request->session()->has('email')) {
         $payments = Payment::where('is_paid', '=', 'Waiting for Verification')->get();
         return view('admin.payment', compact('payments'));
     } else {
         return Redirect::action('AdminController@getAdminLogin');
     }
 }
コード例 #14
0
ファイル: Reward.php プロジェクト: sordev/bootup
 public function getAmountLeftAttribute()
 {
     $amount = $this->amount;
     $sold = \App\Payment::where('reward_id', $this->id)->where('status', 1)->get();
     return (int) $amount - count($sold);
 }
コード例 #15
0
 public function getPaynow(Request $request, $affiliate_id)
 {
     $user_is = $request->user_infusionsoft;
     $app = $request->app_infusionsoft;
     $affiliate_row = Affiliate::where('user_is_id', '=', $user_is->id)->where('aff_id', '=', $affiliate_id)->first();
     $payout = 0;
     if ($affiliate_row) {
         $payment_sum = DB::table('payments')->select(DB::raw('sum(amount) as amount'))->where('affiliate_id', '=', $affiliate_row->id)->where('status', '=', 1)->first();
         if ($payment_sum) {
             $payout = $payment_sum->amount;
         }
     }
     $payments = Payment::where('affiliate_id', '=', $affiliate_row->id)->where('status', '=', 1)->get();
     $total = $app->affRunningTotals(array($affiliate_id));
     $total_record = $total[0];
     $amount = $total_record['RunningBalance'] - $payout;
     return view('affiliates.pay', compact('affiliate_row', 'payments', 'total_record', 'payout', 'amount'));
 }
コード例 #16
0
ファイル: OrderController.php プロジェクト: BarkaBoss/TheHex
 public function getOrderCancel($id, Order $order, Payment $payment)
 {
     $customer_order = $order->whereId((int) $id)->first();
     $amount = $customer_order->order_amount;
     $customer_id = $customer_order->customer_id;
     $delete = $order->whereId((int) $id)->delete();
     if ($delete) {
         //            ->increment('votes', 5);
         $payment->where('customer_id', (int) $customer_id)->increment('account_balance', $amount);
         flash()->success('Order #' . $id . ' has been cancelled and ' . nairaFormater($amount) . ' refunded to ' . customerFullname($customer_id) . '!');
     } else {
         flash()->error('An error occurred while cancelling Order #' . $id . '!');
     }
     return redirect()->back();
 }
コード例 #17
0
 public function paymentDelete($type, $id)
 {
     $user = Auth::user();
     $date = Input::get('date');
     $amount = Input::get('amount');
     $bankID = Input::get('bank');
     $accountID = Input::get('payment');
     $note = Input::get('note');
     //add intial trans back onto
     if ($type == 0) {
         //tansfer
         $trans = Transfer::where('id', $id)->where('userID', $user->id)->first();
         if ($trans->creditAccountID == 0) {
             $month = Month::where('userID', $user->id)->where('name', date('M'))->first();
             $month->cash = $month->cash + $trans->amount;
             $month->save();
         } else {
             $debit = Account::find($trans->creditAccountID);
             $debit->balance = $debit->balance + $trans->amount;
             $debit->save();
         }
         if ($trans->debitAccountID == 0) {
             $month = Month::where('userID', $user->id)->where('name', date('M'))->first();
             $month->cash = $month->cash - $trans->amount;
             $month->save();
         } else {
             $debit = Account::find($trans->debitAccountID);
             $debit->balance = $debit->balance + $trans->amount;
             $debit->save();
         }
     } else {
         //payment
         $trans = Payment::where('id', $id)->where('userID', $user->id)->first();
         //add initial payment amount back on
         if ($trans->creditAccountID == 0) {
             $month = Month::where('userID', $user->id)->where('name', date('M'))->first();
             $month->cash = $month->cash + $trans->amount;
             $month->save();
         } else {
             $credit = Account::find($trans->creditAccountID);
             $credit->balance = $credit->balance + $trans->amount;
             $credit->save();
         }
         //add initial payment back on
         $debit = Account::find($trans->debitAccountID);
         $debit->balance = $debit->balance + $trans->amount;
         $debit->save();
     }
     $trans->forceDelete();
     return redirect('home')->with('message', 'Payment/Transfer deleted successfully.');
 }
コード例 #18
0
 public function postDestroy($id)
 {
     Payment::where('id', $id)->delete();
     return redirect('admin/payments')->with('flash_message', 'Payment Option Deleted');
 }
コード例 #19
0
ファイル: Payment.php プロジェクト: GazzD/asoyaracuy
 public static function get_payments_from_user($id)
 {
     $payments = Payment::where('user_id', '=', $id)->get();
     return $payments;
 }
コード例 #20
0
                                                    <thead>
                                                    <tr>
                                                        <th>
                                                            Müşteri İsmi
                                                        </th>
                                                        <th>
                                                            Tutar
                                                        </th>
                                                        <th>
                                                        </th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @foreach($checkouts as $checkout)
                                                        <?php 
$payment = \App\Payment::where('id', $checkout->payment_id)->first();
?>

                                                        <tr>
                                                            <td class="highlight">
                                                                <div class="success">
                                                                </div>
                                                                <a href="javascript:;">
                                                                    {{ $payment->checkOuts()->first()->customer->user->name }} {{ $payment->checkOuts()->first()->customer->user->surname }}  </a>
                                                            </td>
                                                            <td>
                                                                {{$checkout->total}} TRY
                                                            </td>
                                                            <td>
                                                                <a href="{{action('Dashboard\SupplierController@waitingPaymentDetail',$payment->id)}}" class="btn default btn-xs purple">
コード例 #21
0
 public function undeposited(Property $property, Request $request)
 {
     $propertyid = $property->id;
     // return $propertyid;
     // (isset($propertyid)) ? $property = Property::find($propertyid) : $property = null;
     $rentpayments = Payment::where('payment_type', '<>', 'Deposit')->whereRaw('bank_deposits_id IS NULL')->whereHas('lease', function ($q) use($propertyid) {
         $q->join('apartments', function ($join) use($propertyid) {
             $join->on('apartments.id', '=', 'leases.apartment_id')->where('property_id', '=', $propertyid);
         });
     })->get();
     $depositpayments = Payment::where('payment_type', '=', 'Deposit')->whereRaw('bank_deposits_id IS NULL')->whereHas('lease', function ($q) use($propertyid) {
         $q->join('apartments', function ($join) use($propertyid) {
             $join->on('apartments.id', '=', 'leases.apartment_id')->where('property_id', '=', $propertyid);
         });
     })->get();
     $properties = Property::all();
     $title = 'Undeposited Funds';
     $title = $title . ": " . $property->name;
     return view('deposits.undeposited_funds', ['title' => $title, 'property' => $property, 'properties' => $properties, 'rentpayments' => $rentpayments, 'depositpayments' => $depositpayments]);
 }
コード例 #22
0
 public function postNewTopUp(NewTopUpRequest $request, Payment $payment)
 {
     $customer_id = thcToCustomerId($request->input('customer_thc'));
     $topup_amount = (int) $request->input('topup_amount');
     $topup = $payment->where('customer_id', $customer_id)->increment('account_balance', $topup_amount);
     if ($topup) {
         flash()->success(nairaFormater($topup_amount) . ' was added to ' . customerFullname($customer_id) . '\'s Account!');
     } else {
         flash()->error('An error occurred while topping up ' . customerFullname($customer_id) . '\'s Account!');
     }
     return redirect()->route('customer.list');
 }
コード例 #23
0
 public function index()
 {
     $user = Auth::user();
     $payments = Payment::where('user_id', '=', $user->id)->get();
     return view('payment.index', compact('payments'));
 }