/**
  * Return all the orders with their products and price/amount at given time
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function index()
 {
     return Order::with(['products' => function ($query) {
         $query->select(['id', 'name', 'price', 'pivot.price', 'pivot.amount']);
         $query->orderBy('sort');
     }])->get();
 }
Example #2
0
 public function edit($id)
 {
     $orders = Order::with('product')->where('order_unique_id', $id)->get();
     $products = Product::lists('product_name', 'id');
     $title = "Edit order ( {$id})";
     return view('order.edit', compact('orders', 'title', 'products', 'id'));
 }
 /**
  * Handle the event.
  *
  * @param  MadeCheckout  $event
  * @return void
  */
 public function handle(MadeCheckout $event)
 {
     $user = $event->user;
     $checkout = $event->checkout;
     $orders = Order::with('product')->where('checkout_id', $checkout->id)->get();
     $admin = Sentinel::findRoleBySlug('admin');
     $admins = $admin->users()->get();
     $admin_emails = [];
     foreach ($admins as $admin) {
         array_push($admin_emails, $admin->email);
     }
     $data = ['checkout' => $checkout, 'orders' => $orders, 'user' => $user];
     //dd($data);
     Mail::send('email.orderconfirmation', $data, function ($message) use($user) {
         $message->from('*****@*****.**', $name = "Trolleyin");
         $message->subject('Trolleyin.com Order Confirmation');
         $message->to($user->email);
     });
     foreach ($admin_emails as $email) {
         Mail::send('email.admin.orderconfirmation', $data, function ($message) use($email) {
             $message->from('*****@*****.**');
             $message->subject('New Order Placed');
             $message->to($email);
         });
     }
 }
Example #4
0
 /**
  * Make sure order belong to user given.
  *
  * @param User  $user
  * @param Order $order
  *
  * @return bool
  */
 public function belongToUser(User $user, $order_id, &$order = null)
 {
     $query = Order::with('details')->where(['id' => $order_id, 'user_id' => $user->id])->first();
     if (func_num_args() > 1) {
         $order = $query;
     }
     return $query ? true : false;
 }
Example #5
0
 /**
  * Execute the console command.
  * updating status prepared to traveling
  * @return mixed
  */
 public function fire()
 {
     $orders = Order::with('user')->where('status', 3)->get();
     if ($orders) {
         foreach ($orders as $order) {
             $order->update(['status' => 4, 'shipped_on' => Carbon::now(), 'expected_delivery_on' => Carbon::now()->addDay()]);
             event(new OrderShippedOn($order));
         }
     }
 }
 /**
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function show($id)
 {
     try {
         $order = Order::with('user', 'items.item')->findOrFail($id);
         return view('orders.show', compact('order'));
     } catch (ModelNotFoundException $ex) {
         Flash::error('Model not found');
         return view('orders.index');
     }
 }
Example #7
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $orders = Order::with('user')->where('status', 1)->whereNotNull('address_id')->get();
     if (count($orders)) {
         foreach ($orders as $order) {
             $order->update(['status' => 2, 'processed_on' => Carbon::now()]);
             event(new OrderWasProcessed($order));
         }
     }
 }
Example #8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $orders = Order::with('user', 'address')->where('status', 4)->where('expected_delivery_on', '<', Carbon::now())->get();
     if ($orders) {
         foreach ($orders as $order) {
             $order->update(['status' => 5, 'delivered_on' => Carbon::now()]);
             event(new OrderWasDelivered($order));
         }
     }
 }
Example #9
0
 public function index(Request $request)
 {
     //取出订单列表
     $builder = Order::with(['details'])->where('uid', '=', $this->user->getKey())->orderBy('updated_at', 'desc');
     if ($request->get('status')) {
         $builder->where('status', '=', $request->get('status'));
     }
     $this->_order_list = $builder->get();
     $this->_status = $request->get('status') ?: 0;
     return $this->view('m.ucenter');
 }
Example #10
0
 public function getIndex()
 {
     $user_id = Auth::user()->id;
     $orders = Order::with('orderItems')->where('user_id', $user_id)->get();
     $order_count = $orders->count();
     foreach ($orders as $order) {
         $order->fullname = unserialize($order->fullname);
         $order->address = unserialize($order->address);
     }
     return view('/order', ['orders' => $orders, 'order_count' => $order_count]);
 }
 public function index()
 {
     dd(\Auth::user()->email);
     $user = \Auth::user();
     $member_id = \Auth::user()->id;
     // vibiraem vse zakazy usera
     $orders = \App\Order::with('orderItems')->where('member_id', '=', $member_id)->orderBy('created_at', 'desc')->get();
     // foreach ($orders as $order) {
     // 	dd($order->orderItems);
     // }
     return view('orders', compact('orders', 'user'));
 }
Example #12
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $sortBy = Input::get('sortBy');
     $direction = Input::get('direction');
     $limit = Input::get('limit') ? Input::get('limit') : 20;
     $q = Input::get('q');
     /* 정렬이 있는경우 */
     if ($sortBy and $direction) {
         /*  정렬이 있고 검색이 있는 경우
          */
         //   $order = Order::whereHas('orderItem', function($query) use ($q){
         //     $query->where('product_code','LIKE',"%$q%");
         // })->with('orderItem')->orderBy($sortBy,$direction)->paginate($limit);
         $order = Order::whereHas('orderItem', function ($query) use($q) {
             $query->where('order_items.product_code', 'Like', "%{$q}%");
         })->with(['orderItem' => function ($query) use($sortBy, $direction) {
             $query->join('products', 'order_items.product_id', '=', 'products.id');
         }])->orderBy($sortBy, $direction)->paginate($limit);
         if ($q) {
             // /* 정렬이 있지만 검색은 없는경우
             // */
         } else {
             //$order = Order::with('orderItem')->orderBy($sortBy, $direction)->paginate($limit);
             $order = Order::with(['orderItem' => function ($query) use($sortBy, $direction) {
                 $query->leftJoin('products', 'order_items.product_id', '=', 'products.id')->get();
             }])->orderBy($sortBy, $direction)->paginate($limit);
         }
         //정렬이 없는 경우
     } else {
         /* 정렬은 없지만 검색이 있는 경우
          */
         if ($q) {
             $order = Order::whereHas('orderItem', function ($query) use($q) {
                 $query->where('order_items.product_code', 'Like', "%{$q}%");
             })->with(['orderItem' => function ($query) {
                 $query->join('products', 'order_items.product_id', '=', 'products.id');
             }])->orderBy('order_date', 'desc')->paginate($limit);
             //return dd($order);
         } else {
             $order = Order::with(['orderItem' => function ($query) {
                 $query->leftJoin('products', 'order_items.product_id', '=', 'products.id')->get();
             }])->orderBy('id', 'desc')->paginate($limit);
         }
     }
     //return dd($order);
     return view('order.index', compact('order'));
 }
Example #13
0
 public function edit($id)
 {
     $order = Order::with(['details', 'order_express'])->join('order_expresses', 'order_expresses.id', '=', 'orders.id', 'INNER')->where('order_expresses.sid', $this->store->getKey())->find($id);
     if (empty($order)) {
         return $this->failure_noexists();
     }
     if ($order->order_express->express_type == 39) {
         $this->_express_address = UserAddress::find($order->order_express->uaid)->getFullAddressAttribute();
     } else {
         $user_stores = Store::with('user')->find($order->order_express->sid);
         $this->_express_address = $user_stores->name . '-店主:' . $user_stores->user->realname . '-电话:' . $user_stores->phone . '-地址:' . $user_stores->address ?: '无';
     }
     $keys = 'expresses_money';
     $this->_validates = $this->getScriptValidate('order.express', $keys);
     $this->_data = $order;
     return $this->view('store-backend.order.edit');
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $throwModelNotFound = function () {
         throw new ModelNotFoundException();
     };
     $router->model('admins', User::class, $throwModelNotFound);
     $router->model('users', User::class, $throwModelNotFound);
     $router->model('dispatchers', User::class, $throwModelNotFound);
     $router->model('drivers', User::class, $throwModelNotFound);
     $router->bind('orders', function ($id) {
         try {
             return Order::with('statusHistory')->findOrFail($id);
         } catch (Exception $e) {
             $this->throwModelNotFound();
         }
     });
 }
Example #15
0
 public function edit($id)
 {
     $order = Order::with(['order_express'])->where('fid', $this->factory->getKey())->find($id);
     if (empty($order)) {
         return $this->failure_noexists();
     }
     if ($order->order_express->express_type == 39) {
         $this->_user_address = UserAddress::find($order->order_express->uaid)->getFullAddressAttribute();
         $keys = 'express_name,no';
         $this->_validates = $this->getScriptValidate('order.deliver', $keys);
     } else {
         $this->_user_stores = User::find($order->uid)->stores()->get();
         $keys = 'sid';
         $this->_validates = $this->getScriptValidate('order.express_store', $keys);
     }
     $this->_data = $order;
     return $this->view('factory-backend.express.edit');
 }
Example #16
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $view = 'orders.index';
     $statuses = [];
     if ($this->user->is_admin) {
         $statuses = OrderStatus::$statuses;
         if (Input::get('status')) {
             $orders = Order::where('status', Input::get('status'))->with('user', 'products')->get();
         } else {
             $orders = Order::with('user', 'products')->get();
         }
     } else {
         $view .= '_client';
         if (!Input::get('status')) {
             $orders = $this->user->orders()->with('products')->get();
         } else {
             $orders = $this->user->orders()->where('status', Input::get('status'))->with('products')->get();
         }
     }
     return view($view, compact('orders', 'statuses'));
 }
Example #17
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $orders = Order::with('user', 'products')->orderBy('order_date', 'ASC')->paginate(20);
     return view('admin.order.index', compact('orders'));
 }
Example #18
0
 public function lab_upload($id)
 {
     $user = \Auth::user();
     $userId = $user->id;
     if ($id) {
         $job = DB::table('work_schedule.events')->join('work_schedule.calendars', 'work_schedule.events.calendar_id', '=', 'work_schedule.calendars.calendar_id')->where('work_schedule.events.order_id', '=', $id)->first();
         $file_path = base_path() . '/storage/excel/' . $id;
         if (File::exists($file_path)) {
             $job_file = 'exist';
         } else {
             $job_file = '';
         }
         $detail = Order::with('details')->join('site_details', 'site_details.id', '=', 'orders.site_id')->where('orders.id', '=', $id)->first();
         foreach ($detail['details'] as $value) {
             $test_material[] = DB::table('test_processes')->join('process_items', 'test_processes.item_id', '=', 'process_items.id')->select('process_items.name', 'process_items.image', 'process_items.type')->where('test_id', '=', $value['test_id'])->get();
         }
         $documents = array();
         foreach ($detail['details'] as $item) {
             $test_id = $item['test_id'];
             // $path = public_path().'/TestFiles/'.$userId."/".$id;
             $path = public_path() . '/TestFiles/' . $id;
             //$main_path = public_path().'/TestFiles/'.$userId."/".$id;
             // $half_path = public_path().'/TestFiles/'.$userId;
             if (File::exists($path)) {
                 $uploaded_file = \Input::File('test_files');
                 if ($uploaded_file) {
                     $fileName = $uploaded_file->getClientOriginalName();
                     $uploaded_file->move($path, $fileName);
                     // read uploaded file //
                     Excel::load($path . '/' . $fileName, function ($reader) {
                         // Getting all results
                         $results = $reader->toArray();
                     });
                 }
                 //Session::flash('flash_type', 'alert-success');
                 //Session::flash('flash_message', 'File uploaded successfully.');
                 $files = File::allFiles($path);
                 if (!empty($files)) {
                     foreach ($files as $file) {
                         $documents[] = array('name' => $file->getfileName(), 'path' => $file->getpathName());
                     }
                 }
             }
         }
     }
     $items = DB::table('users')->select('id', 'name')->where('type', '=', 'laboratory')->get();
     return view('lab/lab_detail')->with(compact('job', 'detail', 'documents', 'job_file', 'test_material', 'items'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return Order::with('meals', 'status')->get();
 }
Example #20
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return JsonResponse::create(Order::with('sweeties')->findOrFail($id));
 }
 public function pertanggalReturn(Request $request)
 {
     $tanggal = $request->get('tanggal') ? $request->get('tanggal') : date('Y-m-d');
     $orders = Order::with('karyawan')->whereHas('detail', function ($query) {
         $query->leftJoin('order_detail_returns', 'order_details.id', '=', 'order_detail_returns.order_detail_id')->whereNotNull('order_detail_returns.id');
     })->where(DB::raw('SUBSTRING(tanggal, 1, 10)'), $tanggal)->get();
     $data = ['tanggal' => Carbon::parse($tanggal), 'orders' => $orders];
     return view(config('app.template') . '.order.return-pertanggal', $data);
 }
Example #22
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $order = Order::with('shares')->find($id);
     return view('order.show', compact('order'));
 }
Example #23
0
 /**
  * Responds to requests to GET /books/edit/{$id}
  */
 public function getEdit($id = null)
 {
     # Get this book and eager load its tags
     /* $ordertreat = \App\Order::with('treat')->find($id);
        $orderaccesory = \App\Order::with('accesory')->find($id); */
     /* $order = \App\Order::where('user_id','=',\Auth::id())->orderBy('id','DESC')->get(); */
     $order = \App\Order::with('accesory')->find($id);
     if (is_null($order)) {
         \Session::flash('flash_message', 'We are sorry, but your order was not found.');
         return redirect('\\orders');
     }
     # Get all the possible accessories to display to the user
     $accesoryModel = new \App\Accesory();
     $accesories_for_checkbox = $accesoryModel->getAccesoriesForCheckboxes();
     $accesories_for_inputbox = $accesoryModel->getAccesoriesForInputboxes();
     $accesoryprices_for_display = $accesoryModel->getAccesoriesPrices();
     # Get all the possible treats to display to the user
     $treatModel = new \App\Treat();
     $treats_for_checkbox = $treatModel->getTreatsForCheckboxes();
     $treats_for_inputbox = $treatModel->getTreatsForInputboxes();
     $treatprices_for_display = $treatModel->getTreatsPrices();
     /*
     Create a simple array of just the tag names for tags associated with this book;
     will be used in the view to decide which tags should be checked off
     */
     /*  $accesories_for_this_order = [];
         $accesoryquantities_for_this_order = [];
         $accesoryprices_for_this_order = [];
         $accesory =new \App\Accesory();
         for($i=0; $i < count($accesories_for_checkbox); ++$i) {
           $accesories_for_this_order[$i]=$accesory->name;
           $accesoryquantities_for_this_order[$i]=$accesory->quantity;
           $accesoryprices_for_this_order[$i]=$accesory->price;
         } */
     $accesories_for_this_order = [];
     $accesoryquantities_for_this_order = [];
     $accesoryprices_for_this_order = [];
     foreach ($order->accesory as $accesory) {
         $accesories_for_this_order[] = $accesory->name;
         $accesoryquantities_for_this_order[] = $accesory->quantity;
         $accesoryprices_for_this_order[] = $accesory->price;
     }
     $treats_for_this_order = [];
     $treatquantities_for_this_order = [];
     $treatprices_for_this_order = [];
     foreach ($order->treat as $treat) {
         $treats_for_this_order[] = $treat->name;
         $treatquantities_for_this_order[] = $treat->quantity;
         $treatprices_for_this_order[] = $treat->price;
     }
     /* for($i=0; $i < count($dataname); ++$i) {
         $accesory = new \App\Accesory();
         $accesory->name = $dataname[$i];
         $accesory->size = $datasize[$i];
         $accesory->price = $dataprice[$i];
         $accesory->quantity = $dataquantity[$i];
         $accesory->order_total = $dataquantity[$i] * $dataprice[$i];
         $accesory->description = $datadescription[$i];
        $accesory->save(); */
     /*
             $treats_for_this_order = [];
             $treatquantities_for_this_order = [];
             $treatprices_for_this_order = [];
             foreach($ordertreat->treats as $treat) {
                 $treats_for_this_order[] = $treat->name;
                 $treatquantities_for_this_order[] = $treat->quantity;
                 $treatprices_for_this_order[] = $treat->price;
             }
     */
     /*$treats_for_this_order = [];
     $treatquantities_for_this_order = [];
     $treatprices_for_this_order = [];
     $treat =new \App\Treat();
     for($i=0; $i < count($treats_for_checkbox); ++$i) {
       $treats_for_this_order[$i]=$treat->name;
       $treatquantities_for_this_order[$i]=$treat->quantity;
       $treatprices_for_this_order[$i]=$treat->price;
     } */
     return view('orders.edit')->with(['order' => $order, 'accesories_for_checkbox' => $accesories_for_checkbox, 'accesories_for_inputbox' => $accesories_for_inputbox, 'accesoryprices_for_display' => $accesoryprices_for_display, 'accesories_for_this_order' => $accesories_for_this_order, 'accesoryquantities_for_this_order' => $accesoryquantities_for_this_order, 'accesoryprices_for_this_order' => $accesoryprices_for_this_order, 'treats_for_checkbox' => $treats_for_checkbox, 'treats_for_inputbox' => $treats_for_inputbox, 'treats_for_display' => $accesoryprices_for_display, 'treats_for_this_order' => $treats_for_this_order, 'treatquantities_for_this_order' => $treatquantities_for_this_order, 'treatprices_for_this_order' => $treatprices_for_this_order]);
 }
Example #24
0
 function order_reveiw($id)
 {
     if (!is_numeric($id)) {
         return Response::view('errors.404', array(), 404);
     }
     $result = DB::table('orders')->where('id', '=', $id)->first();
     if (is_null($result)) {
         return Response::view('errors.404', array(), 404);
     }
     $order = Order::with(array('customer', 'site'))->where('orders.id', '=', $id)->first();
     //$technicians = User::where('role_id','=',4)->where('status','=',1)->get();
     //$tech_schedule = TechnicianSchedule::where('order_id','=',$id)->first();
     $tech = DB::table('work_schedule.events')->join('work_schedule.calendars', 'work_schedule.events.calendar_id', '=', 'work_schedule.calendars.calendar_id')->leftjoin('raman.reporting_schedule', 'raman.reporting_schedule.order_id', '=', 'work_schedule.events.order_id')->leftjoin('raman.laboratory_schedule', 'raman.laboratory_schedule.order_id', '=', 'work_schedule.events.order_id')->where('work_schedule.events.order_id', '=', $id)->select('work_schedule.calendars.name', 'raman.reporting_schedule.start_date as rstart', 'raman.reporting_schedule.start_time as rstart_time', 'raman.laboratory_schedule.start_date as lstart', 'raman.laboratory_schedule.start_time as lstart_time')->first();
     /*echo "<pre>";
     		print_r($tech);die;*/
     return view('order_review')->with(compact('order', 'tech'));
 }
 public function edit()
 {
     //check for integer in quantity
     if (!(Input::get('quantity') >= 0 && Input::get('quantity') < 1000)) {
         Session::flash('type', "danger");
         Session::flash('message', "Please enter a quantity between 1 and 1000");
         return Redirect::back();
     }
     if (!Auth::check()) {
         //create unregistered user and a new make for them
         $user = new User();
         $user->save();
         Auth::login($user);
     }
     //save cookes for new user
     if (!Session::has('order')) {
         //create new order
         $order = new Order();
         $order->user_id = Auth::user()->id;
         $order->status = 'Open';
         $order->save();
         Session::put('order', $order->id);
         Session::put('orderCount', 0);
     }
     //return Session::has('order');
     $quantity = Input::get('quantity');
     $product_id = Input::get('product_id');
     $colour_hex = Input::get('colour_hex');
     $colour_name = Input::get('colour_name');
     $action_id = Input::get('action_id');
     $order = Order::with('product')->find(Session::get('order'));
     //if order bnot open then send to dash with message
     if ($order->status !== 'Quote' && $order->status !== 'Open') {
         Session::flash('message', 'This order is locked. Please click \'Start a new quote\' below to begin another order');
         Session::flash('alert-class', "alert-danger");
         return Redirect::to('users/dashboard');
     }
     //return $order;
     //derach product is the same as existing
     //$order->product()->detach($product_id, ['hex' => $colour_hex]);
     \DB::delete('delete from order_product where order_id = ? AND product_id = ? AND hex = ?', array($order->id, $product_id, $colour_hex));
     //attach if not 0
     if (Input::get('quantity') != 0) {
         $order->product()->attach($product_id, ['quantity' => $quantity, 'colour' => $colour_name, 'hex' => $colour_hex]);
     }
     //count them again
     $updatedOrder = Order::with('product')->find(Session::get('order'));
     $orderCount = 0;
     foreach ($updatedOrder->product as $products) {
         $orderCount = $orderCount + 1;
     }
     //return $orderCount;
     Session::put('orderCount', $orderCount);
     //set message depending od whethet order is open or quote
     if ($order->status !== 'Open') {
         Session::flash('registerMessage', "You are updating an existing quote. When you are happy please click the green button below to confirm your update.");
         Session::flash('type', "danger");
         return redirect()->route('orders.show', [$order->id]);
     }
     //updating quantities
     if ($action_id == 'update') {
         return redirect()->route('orders.show', [$order->id]);
     }
     Session::flash('message', $quantity . " of these have been added to your quote");
     Session::flash('type', "success");
     return Redirect::back()->withCookie(cookie('user_id', Auth::user()->id, 3600));
     //return $quantity;
 }
Example #26
0
 public function edit($id)
 {
     $order = Order::with(['details', 'order_express'])->find($id);
     if (empty($order)) {
         return $this->failure_noexists();
     }
     $keys = 'expresses_money';
     $this->_validates = $this->getScriptValidate('order.express', $keys);
     $this->_data = $order;
     return $this->view('admin.order.edit');
 }
Example #27
0
 function getOrder($orderId)
 {
     if ($orderId) {
         $order = Order::with('details')->where('id', '=', $orderId)->orderBy('id', 'DESC')->get();
         if ($order) {
             return $order;
         }
     }
 }
 public function bayar(Request $request)
 {
     if ($request->get('id')) {
         $id = $request->get('id');
         $order = Order::with(['karyawan', 'bayar.karyawan', 'tax.tax', 'bayarBank.bank', 'place.place', 'customer'])->find($id);
         $total = $orderDetails = OrderDetail::with('order')->leftJoin('order_detail_returns', 'order_details.id', '=', 'order_detail_returns.order_detail_id')->join('produks', 'order_details.produk_id', '=', 'produks.id')->where('order_details.order_id', $id)->select(['order_details.id', 'order_details.produk_id', 'produks.nama', 'order_details.harga_jual', 'order_details.qty as qty_ori', DB::raw('ifnull(order_detail_returns.qty, 0) as qty_return'), DB::raw('(order_details.qty - ifnull(order_detail_returns.qty, 0))qty'), DB::raw('(order_details.harga_jual * (order_details.qty - ifnull(order_detail_returns.qty, 0)))subtotal')])->get()->sum('subtotal');
         foreach ($order->place as $op) {
             if ($op->harga > 0) {
                 $total += $op->harga;
             }
         }
         $total += $order->bayar->service_cost;
         $tax_procentage = round($order->tax->procentage);
         $tax = round($total * ($tax_procentage / 100));
         $tax_bayar_procentage = $order->bayarBank != null ? round($order->bayarBank->tax_procentage) : 0;
         $tax_bayar = round(($total + $tax) * ($tax_bayar_procentage / 100));
         $jumlah = round($total + $tax + $tax_bayar);
         $sisa = round($jumlah - $order->bayar->diskon);
         $kembali = round($order->bayar->bayar - $sisa);
         return ['kasir' => $order->bayar->karyawan->nama, 'waiters' => $order->karyawan->nama, 'customer' => $order->customer != null ? $order->customer->nama : null, 'total' => number_format($total, 0, ",", "."), 'tax_pro' => $order->tax->procentage, 'tax' => number_format($tax, 0, ",", "."), 'tax_bayar_pro' => $tax_bayar_procentage, 'tax_bayar' => number_format($tax_bayar, 0, ",", "."), 'jumlah' => number_format($jumlah, 0, ",", "."), 'diskon' => number_format($order->bayar->diskon, 0, ",", "."), 'sisa' => number_format($sisa, 0, ",", "."), 'bayar' => number_format($order->bayar->bayar, 0, ",", "."), 'kembali' => number_format($kembali, 0, ",", ".")];
     } else {
         abort(500);
     }
 }