Exemplo n.º 1
0
 /**
  * 获取成功的订单
  * @return [type] [description]
  */
 public function getSuccess()
 {
     $data = array('main' => url('/'), 'announce' => url('/announce'), 'category' => url('/category'), 'deliver' => url('/deliver'), 'good' => url('/good'), 'map' => url('/map'), 'shop_info' => url('/shop_info'), 'success' => url('/success'), 'widge_success' => array());
     $shop_id = Auth::user()->shop_id;
     $orders = Order::where('shop_id', $shop_id)->where('state_of_shop', 3)->get();
     $data['widge_success']['deal_count'] = count($orders);
     $data['widge_success']['deal'] = array();
     $shop = Shop::find($shop_id);
     foreach ($orders as $order) {
         $comment = CommentOrder::where('order_id', $order->id)->get();
         $one = array('deal_id' => $order->id, 'deal_statue' => $order->state, 'same_again' => '##', 'deal_again' => '##', 'shop_name' => $shop->name, 'deal_number' => $order->number, 'deal_time' => date('Y-m-d', $order->ordertime), 'deal_phone' => $shop->linktel, 'deliver_address' => $order->receive_address, 'deliver_phone' => $order->receive_phone, 'deliver_remark' => $order->beta, 'deal_speed' => isset($comment[0]) ? $comment[0]->speed : 0, 'deal_satisfied' => isset($comment[0]) ? $comment[0]->value : 0, 'good' => array(), 'others' => array(array('item_name' => '不知道', 'item_value' => '-5', 'item_amount' => '1', 'item_total' => '0')));
         $one['total'] = $order->total;
         $menu_ids = array_count_values(explode(',', $order->order_menus));
         foreach ($menu_ids as $menu_id => $amount) {
             $menuComment = CommentMenu::where('order_id', $order->id)->where('menu_id', $menu_id)->get();
             $menu = Menu::find($menu_id);
             //var_dump($menuComment);
             $onemenu = array('goods_id' => $menu_id, 'goods_name' => $menu->title, 'goods_value' => $menu->price, 'goods_amount' => $amount, 'goods_total' => $amount * $menu->price, 'good_atisfied' => isset($menuComment[0]) ? $menuComment[0]->value : 0);
             array_push($one['good'], $onemenu);
         }
         array_push($data['widge_success']['deal'], $one);
     }
     return View::make("template.success.success")->with($data);
     //var_dump($data);
 }
Exemplo n.º 2
0
 public static function ProductPrices()
 {
     $param = func_get_args();
     if (@$param[0] != null) {
         if ($param[0] == 'todays') {
             $orders = Order::where('days', date('Y-m-d'))->get();
         } else {
             if ($param[0] == 'months') {
                 $orders = Order::where('months', date('Y-m'))->get();
             } else {
                 if ($param[0] == 'years') {
                     $orders = Order::where('years', date('Y'))->get();
                 } else {
                     $orders = Order::all();
                 }
             }
         }
         if (count($orders) > 0) {
             $priceall = 0;
             foreach ($orders as $order) {
                 $otplist = OrderToProduct::where('order_id', $order->id)->get();
                 foreach ($otplist as $value) {
                     $priceall += $value->number * self::ProductInfo($value->product_id, 'price');
                 }
             }
             return $priceall;
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
Exemplo n.º 3
0
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $totalamount = \Input::get('AMOUNT');
     $storeid = \Input::get('STOREID');
     $status = false;
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         $order = \Order::where('kodeOrder', $transidmerchant)->first();
         if ($order) {
             //check amount is valid + admin ofcourse!
             $doku_akun = \DokuAccount::where('akunId', $order->akunId)->first();
             $total_order = $order->total + $order->dokuFee;
             if ($totalamount == $total_order) {
                 $status = true;
             } else {
                 $status = false;
             }
         }
     }
     if ($status == true) {
         echo 'Continue';
     } else {
         echo 'Stop';
     }
 }
Exemplo n.º 4
0
 public function getIndex()
 {
     $order_years = Order::where('years', date('Y'))->get();
     $order_months = Order::where('months', date('Y-m'))->get();
     $order_days = Order::where('days', date('Y-m-d'))->get();
     $order_all = Order::all();
     return View::make('home', compact('order_years', 'order_months', 'order_days', 'order_all'))->with('title', 'Anasayfa');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $order = Order::find($id);
     $order = Order::findOrFail($id);
     $orders = Order::where('cliente', '=', $id)->get();
     $user = $order->user();
     $orders = $user->orders();
 }
 function search($email)
 {
     $user = Order::where('email_id', $email)->first();
     if (!empty($user)) {
         $orderitem = new Orderitem();
         $data = $orderitem->getOrderbyemail($email);
     } else {
         $data['message'] = "no data found";
     }
     return Response::json($data, 400);
 }
Exemplo n.º 7
0
 public function adminSection()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     $orderCount = Order::where('status', '=', 'pending')->count();
     $userCount = User::where('status', '=', 'active')->count();
     $softwareUserCount = SoftwareUser::where('status', '=', 'active')->count();
     $complaintCount = Complaint::whereIn('status', array('Complaint', 'Problem'))->count();
     return View::make('admin.admin-section')->with('orderCount', $orderCount)->with('userCount', $userCount)->with('complaintCount', $complaintCount)->with('softwareUserCount', $softwareUserCount);
 }
Exemplo n.º 8
0
 public function onGetEditInput($formField, array &$row)
 {
     if ($row) {
         if ($formField->getFieldName() == 'products') {
             $order = \Order::where("id", $row['id'])->first();
             if (isset($order->id)) {
                 $orderProducts = $order->products();
                 return View::make('partials.order_products', compact('orderProducts'));
             }
         }
     }
 }
Exemplo n.º 9
0
 public function deleteUser($id)
 {
     $user = $this->_getUserById($id);
     if ($user) {
         \Order::where('user_id', $user->id)->update(['status' => 0]);
         $user->update(['status' => 0]);
         return true;
     } else {
         $this->setErrors(['Whoops, something went wrong. Please try again']);
         return false;
     }
 }
Exemplo n.º 10
0
 /**
  * getDatatable
  */
 public function getDatatable()
 {
     $collection = Order::where('order_status', 'order_stockuped')->get();
     return Datatable::collection($collection)->showColumns('date', 'no', 'customer', 'status', 'actions')->orderColumns('date', 'customer')->searchColumns('date', 'no', 'customer')->addColumn('date', function ($model) {
         return date('Y-m-d', strtotime($model->created_at));
     })->addColumn('customer', function ($model) {
         return $model->customer->name;
     })->addColumn('status', function ($model) {
         return get_order_status($model->order_status);
     })->addColumn('actions', function ($model) {
         return $str = '<button data-id="' . $model->id . '" class="btn btn-info btn-stockorder">查看货品</button>';
     })->make();
 }
 public function success()
 {
     if (Input::get("token") && Input::get("PayerID")) {
         $token = Input::get('token');
         $update = Order::where('token', '=', $token)->update(array("status" => 1));
         $order = Order::where('token', '=', $token)->first();
         $items = Orderitem::where('order_id', '=', $order->id)->get();
         foreach ($items as $item) {
             $qt = $item->item_qt;
             Product::where('id', '=', $item->item_id)->decrement('stock', $qt);
         }
         return Redirect::to('product/all')->with('message', 'Votre commande a été passé !');
     }
 }
 public function show()
 {
     $addresses = Useradd::where('user_id', '=', Auth::user()->id)->get();
     $orders = Order::where('orders.user_id', '=', Auth::user()->id)->leftJoin('user_adds as shipadd', 'orders.add_id', '=', 'shipadd.id')->leftJoin('user_adds as rcpadd', 'orders.rcp_id', '=', 'rcpadd.id')->select('orders.*', 'shipadd.title AS ship_title', 'shipadd.address AS ship_add', 'shipadd.address2 AS ship_add2', 'shipadd.postal AS ship_post', 'shipadd.city AS ship_city', 'shipadd.first_name AS ship_first', 'shipadd.last_name AS ship_last', 'rcpadd.title AS rcp_title', 'rcpadd.address AS rcp_add', 'rcpadd.address2 AS rcp_add2', 'rcpadd.postal AS rcp_post', 'rcpadd.city AS rcp_city', 'rcpadd.first_name AS rcp_first', 'rcpadd.last_name AS rcp_last')->orderBy('orders.date', 'DESC')->get();
     // on va récupérer les produits de chaque commande
     // commence par récupérer l'id de chaque commande
     $orders_id = Order::where('orders.user_id', '=', Auth::user()->id)->select('orders.id')->orderBy('orders.date', 'DESC')->get();
     $items = array();
     // rangés par commandes
     foreach ($orders_id->toArray() as $row => $ord) {
         $i = Orderitem::where('order_id', '=', $ord['id'])->leftJoin('products', 'order_items.item_id', '=', 'products.id')->select('order_items.*', 'products.name', 'products.picture')->get();
         $items[$ord['id']] = $i->toArray();
     }
     return View::make('user/show', array('addresses' => $addresses, 'orders' => $orders, 'items' => $items));
 }
 /**
  * Display the customer's profile page after successful login.
  */
 public function profile(Customer $customer = NULL)
 {
     if (is_null($customer)) {
         if (Auth::check()) {
             //echo Auth::user()->email;
             $customer = Customer::find(Auth::id());
             $orders = Order::where('customer_id', '=', Auth::id())->get();
             $this->layout->content = View::make('customers.profile', compact('customer', 'orders'));
         } else {
             return Redirect::to('login');
         }
     } else {
         $orders = Order::where('customer_id', '=', $customer->id)->get();
         $this->layout->content = View::make('customers.profile', compact('customer', 'orders'));
     }
 }
Exemplo n.º 14
0
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $statuscode = \Input::get('STATUSCODE');
     $transdate = \Input::get('TRANSDATE');
     $ptype = \Input::get('PTYPE');
     $totalamount = \Input::get('AMOUNT');
     $result = strtoupper(\Input::get('RESULT'));
     $xtrainfo = strtoupper(\Input::get('EXTRAINFO'));
     $status = false;
     $order = \Order::where('kodeOrder', $transidmerchant)->first();
     if ($order) {
         echo "Order tidak ditemukan..";
     }
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         if ($result == 'SUCCESS') {
             //update order ke pembayaran diterima
             $order->status = 2;
             $order->save();
             $detail_konfirmasi = '<p>Doku MyshopCart Detail:<br> MerchantId : ' . $transidmerchant . '<br> Total : ' . $amount . '<br> Tanggal : ' . $transdate . '</p>';
             $setting = \Pengaturan::where('akunId', '=', $order->akunId)->first();
             $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => $order->tanggalOrder, 'namaPengirim' => $order->konfirmasi == null ? '-' : $order->konfirmasi->nama, 'noRekening' => $order->konfirmasi == null ? '-' : $order->konfirmasi->noRekPengirim, 'rekeningTujuan' => $order->konfirmasi == null ? '-' : $order->konfirmasi->bank->atasNama . '<br>' . $order->konfirmasi->bank->noRekening . ' - ' . $order->konfirmasi->bank->bankdefault->nama, 'jumlah' => $order->konfirmasi == null ? '-' : $order->konfirmasi->jumlah, 'cart' => \View::make('admin.order.detailorder')->with('order', $order), 'namaEkspedisi' => $order->jenisPengiriman, 'noResi' => $order->noResi, 'tujuanPengiriman' => $order->alamat . ' - ' . $order->kota, 'linkRegistrasi' => \URL::to('member/create'), 'detailKonfirmasi' => $detail_konfirmasi);
             $order->fromEmail = $setting->email;
             $order->fromtoko = $setting->nama;
             $qtyProduk = $order->detailorder;
             $template = \Templateemail::where('akunId', '=', $order->akunId)->where('no', '=', 6)->first();
             $email = bind_to_template($data, $template->isi);
             $subject = bind_to_template($data, $template->judul);
             $a = \Mail::send('emails.email', array('data' => $email, 'nama' => '', 'web' => '', 'email' => '', 'telp' => '', 'jmlProduk' => '', 'metatag' => 0), function ($message) use($subject, $order) {
                 $message->from($order->fromEmail, $order->fromtoko);
                 $message->to($order->pelanggan->email, $order->pelanggan->nama)->cc($order->fromEmail)->subject($subject);
             });
         }
     }
     $akun = \Akun::find($order->akunId);
     if ($akun->alamatWeb != '') {
         $url = 'http://' . $akun->alamatWeb . '/konfirmasiorder/' . $order->id;
     } else {
         $url = 'http://' . $akun->alamatJarvis . '.' . \Config::get('app.domain') . '/konfirmasiorder/' . $order->id;
     }
     echo "Status : " . $status . " <a href='{$url}'> Klik disini jika halaman tidak terload..</a>";
     return \Redirect::to($url)->with('message', 'Success Update Order');
 }
Exemplo n.º 15
0
 /**
  * ------------ Payment Make on a Order ----------.
  *
  * @param  int  $id
  * @return Response
  */
 public function orderPay()
 {
     $input = Input::all();
     $payment = array('supplier_id' => $input['payOrderSuppId'], 'order_id' => $input['payOrderId'], 'comment' => "Paid on Order-" . $input['payOrderId'], 'ammount' => $input['payOrderPay'], 'date' => $input['payOrderDate']);
     if ($input['payOrderPay'] > 0) {
         $order = PaySupp::create($payment);
         if ($order->exists) {
             $upDue = Order::where('id', '=', $input['payOrderId'])->update(array('due' => $input['payOrderDue'], 'pay' => $input['payOrderCurPay']));
             if ($upDue) {
                 return json_encode(array('pay' => 1, 'order' => 1, 'error' => 0));
             } else {
                 return json_encode(array('pay' => 1, 'order' => 0, 'error' => 0));
             }
         }
     } else {
         return json_encode(array('pay' => 0, 'order' => 0, 'error' => 1));
     }
 }
Exemplo n.º 16
0
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $totalamount = \Input::get('AMOUNT');
     $result = strtoupper(\Input::get('RESULT'));
     $status = false;
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         $order = \Order::where('kodeOrder', $transidmerchant)->first();
         if ($order) {
             if ($result == 'SUCCESS') {
                 //update order ke pembayaran diterima
                 $order->status = 2;
                 $order->save();
                 $status = true;
                 //send email to member and toko
                 //kirim email konfirmasi pembayaran
                 $detail_konfirmasi = '<p>Doku MyshopCart Detail:<br> MerchantId : ' . $transidmerchant . '<br> Total : ' . $amount . '<br> Tanggal : ' . $transdate . '</p>';
                 $setting = \Pengaturan::where('akunId', '=', $order->akunId)->first();
                 $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => $order->tanggalOrder, 'namaPengirim' => $order->konfirmasi == null ? '-' : $order->konfirmasi->nama, 'noRekening' => $order->konfirmasi == null ? '-' : $order->konfirmasi->noRekPengirim, 'rekeningTujuan' => $order->konfirmasi == null ? '-' : $order->konfirmasi->bank->atasNama . '<br>' . $order->konfirmasi->bank->noRekening . ' - ' . $order->konfirmasi->bank->bankdefault->nama, 'jumlah' => $order->konfirmasi == null ? '-' : $order->konfirmasi->jumlah, 'cart' => \View::make('admin.order.detailorder')->with('order', $order), 'namaEkspedisi' => $order->jenisPengiriman, 'noResi' => $order->noResi, 'tujuanPengiriman' => $order->alamat . ' - ' . $order->kota, 'linkRegistrasi' => \URL::to('member/create'), 'detailKonfirmasi' => $detail_konfirmasi);
                 $order->fromEmail = $setting->email;
                 $order->fromtoko = $setting->nama;
                 $qtyProduk = $order->detailorder;
                 $template = \Templateemail::where('akunId', '=', $order->akunId)->where('no', '=', 6)->first();
                 $email = bind_to_template($data, $template->isi);
                 $subject = bind_to_template($data, $template->judul);
                 $a = \Mail::send('emails.email', array('data' => $email, 'nama' => '', 'web' => '', 'email' => '', 'telp' => '', 'jmlProduk' => '', 'metatag' => 0), function ($message) use($subject, $order) {
                     $message->from($order->fromEmail, $order->fromtoko);
                     $message->to($order->pelanggan->email, $order->pelanggan->nama)->cc($order->fromEmail)->subject($subject);
                 });
             }
         }
     }
     if ($status == true) {
         echo 'Continue';
     } else {
         echo 'Stop';
     }
 }
Exemplo n.º 17
0
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $statuscode = \Input::get('STATUSCODE');
     $transdate = \Input::get('TRANSDATE');
     $ptype = \Input::get('PTYPE');
     $totalamount = \Input::get('AMOUNT');
     $result = strtoupper(\Input::get('RESULT'));
     $xtrainfo = strtoupper(\Input::get('EXTRAINFO'));
     $status = false;
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         $order = \Order::where('kodeOrder', $transidmerchant)->first();
         if ($order) {
             $akun = \Akun::find($order->akunId);
             return \Redirect::to('http://' . $akun->alamatJarvis . '.' . \Config::get('app.domain') . '/konfirmasiorder/' . $order->id)->with('message', 'Success Update Order');
         }
     }
 }
Exemplo n.º 18
0
 public static function DeadLineFinished()
 {
     date_default_timezone_set(config::$timezone);
     $today = date("Y-m-d");
     $orders = Order::where('to', '<', $today)->where('status', '=', 1)->orderBy('id', 'desc')->get();
     $info = array();
     $x = 0;
     foreach ($orders as $order) {
         $single = array();
         $single['email'] = User::where('details_id', '=', $order->member->id)->where('user_level', '=', 'member')->get()->first()->email;
         $single['movie name'] = Movie::where("id", '=', $order->movie_id)->get()->first()->name;
         $single['first name'] = Member::where("id", '=', $order->member_id)->get()->first()->first_name;
         $single['last name'] = Member::where("id", '=', $order->member_id)->get()->first()->last_name;
         $info[$x++] = $single;
     }
     foreach ($info as $member) {
         Mail::send('emails.deadlinefinishedorder', array('first_name' => $member['first name'], 'last_name' => $member['last name'], 'movie' => $member['movie name']), function ($message) use($member) {
             $message->to($member['email'], $member['first name'])->subject('DVD Rental Notification');
         });
     }
     return "Email has been successfully sent.";
 }
Exemplo n.º 19
0
 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 public function __construct()
 {
     $this->beforeFilter(function () {
         // if((isset($_GET['access_id']) && $_GET['access_id'] == '5437edf7890') || isset($_COOKIE['access_id'])){
         // 	if(!isset($_COOKIE['access_id'])){
         // 		setcookie('access_id', $_GET['access_id'], time() + (3600));
         // 	}
         View::share('catnav', Category::all());
         View::share('cart_values', Cart::contents());
         if (Auth::check()) {
             View::share('super', 0);
             View::share('vendor', 0);
             View::share('user', 0);
             View::share('user_id', Auth::user()->id);
             if (Auth::user()->isSuper) {
                 View::share('super', 1);
                 Session::put('user_status', 'super');
             } elseif (Auth::user()->isVendor) {
                 $notification = Order::where('vendor_id', '=', Auth::user()->id)->where('notification', '=', 1)->count();
                 View::share('vendor', 1);
                 Session::put('notification', $notification);
                 Session::put('user_status', 'vendor');
             } else {
                 View::share('user', 1);
                 Session::put('user_status', 'user');
             }
             View::share('guest_user', 0);
         } else {
             View::share('guest_user', 1);
             $notification = 0;
             Session::put('notification', $notification);
             Session::put('user_status', 'guest_user');
             View::share('user_id', uniqid());
         }
         // }else{
         // 	 return Redirect::to('http://www.Funfest.com');
         // }
     });
 }
Exemplo n.º 20
0
 /**
  * 未评论页面
  */
 public function Uncomment()
 {
     $orders = Order::where('state', 4)->get();
     $data['userbar'] = $this->userBar();
     $data['sidebar'] = $this->sideBar();
     $data['uncomment']['deal_count'] = count($orders);
     $data['uncomment']['deal'] = array();
     foreach ($orders as $order) {
         $shop = Shop::find($order->shop_id);
         $one = array();
         $one['shop_id'] = $order->shop_id;
         $one['deal_id'] = $order->id;
         $one['deal_statue'] = $order->state;
         $one['same_again'] = '##';
         $one['deal_is_return'] = '##';
         // 是否能退单
         $one['deal_return'] = '##';
         // 退单链接
         $one['deal_is_pre'] = $order->is_pre;
         // 是否是预定单
         $one['deal_pre_time'] = $order->arrivetime;
         // 送餐时间
         $one['deal_again'] = '##';
         // 商品的地址
         $one['shop_name'] = $shop->name;
         // 商店的名称
         $one['deal_number'] = $order->id;
         // 订单号,先用订单ID代替
         $one['deal_time'] = $order->ordertime;
         //订单时间
         $one['deal_phone'] = $shop->linktel;
         //餐厅电话
         $one['deliver_address'] = $order->receive_address;
         //订单送往地址
         $one['deliver_phone'] = $order->receive_phone;
         $one['deliver_remark'] = $order->beta;
         //订单备注
         $one['deal_speed'] = 0;
         // 送餐速度,0没有评价1不满意2一般般3满意
         $one['deal_satisfied'] = '';
         $one['good'] = array();
         $menus = array_count_values(explode(',', $order->order_menus));
         foreach ($menus as $menu_id => $count) {
             $good = Menu::find($menu_id);
             array_push($one['good'], array('goods_id' => $good->id, 'goods_name' => $good->title, 'goods_value' => $good->price, 'goods_amount' => $count, 'goods_total' => $good->price * $count, 'good_atisfied' => '##'));
         }
         // others表示其他费用
         $one['others'] = array(array('item_name' => '', 'item_value' => '', 'item_amount' => '', 'item_total' => ''));
         $one['total'] = $order->total;
         array_push($data['uncomment']['deal'], $one);
     }
     return View::make("template.personal.personal_uncomment")->with($data);
 }
Exemplo n.º 21
0
 /**
  * 获取某个店铺指定时间的订单列表
  * @return [type] [description]
  */
 public function getOrderlist()
 {
     $shop_id = Input::get('shop_id');
     $amount = Order::where('shop_id', $shop_id)->count();
     $beginToday = mktime(0, 0, 0, date('m'), date('m'), date('d'), date('Y'));
     $endToday = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
     echo $endToday;
     echo '<br>';
     $beginLastweek = mktime(0, 0, 0, date('m'), date('d') - date('w') + 1 - 7, date('Y'));
     echo $beginLastweek;
     echo '<br>';
     echo time();
 }
Exemplo n.º 22
0
 public function transactionSuccess()
 {
     $transactionId = Session::get('transactionId');
     if ($transactionId) {
         $status = Input::get('status');
         if ($status == 'success') {
             $payment_mode = Input::get('mode');
             $gateway_payment_id = Input::get('mihpayid');
             $net_amount_debit = Input::get('net_amount_debit');
             $order = Order::where('transaction_id', $transactionId)->first();
             if (isset($order)) {
                 $order->payment_mode = $payment_mode;
                 $order->gateway_payment_id = $gateway_payment_id;
                 $order->net_amount_debit = $net_amount_debit;
                 $order->save();
                 $order_id = $order->id;
                 $mail = SendMailController::userInvoiceMail($order_id);
                 if ($mail) {
                     $order = Order::find($order_id);
                     $orderItems = OrderItem::where('order_id', $order_id)->get();
                     return View::make('checkout.transaction-success')->with('order', $order)->with('orderItems', $orderItems);
                 }
             } else {
                 return Redirect::to('/transaction-failure');
             }
         } else {
             return Redirect::to('/transaction-failure');
         }
     } else {
         return Redirect::to('/');
     }
 }
Exemplo n.º 23
0
 public function viewOrder($id)
 {
     if (empty($id)) {
         return Redirect::to('/');
     }
     $orderItem = OrderItem::find($id);
     if (isset($orderItem)) {
         $order = Order::where('id', $orderItem->order_id)->get();
         if (isset($orderItem) && count($orderItem) > 0) {
             return View::make('order.viewOrder')->with('found', true)->with('order', $order)->with('orderItem', $orderItem);
         } else {
             return View::make('order.viewOrder')->with('found', false);
         }
     } else {
         return Redirect::to('/');
     }
 }
Exemplo n.º 24
0
 public function countSellOrders()
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     try {
         $user = User::chkUserByToken($token, $u_id);
         $booths = Booth::where('u_id', '=', $u_id)->lists('b_id');
         if (empty($booths)) {
             throw new Exception("您还没有任何店铺", 7001);
         }
         $count_nonshipping = Order::where('orders.o_shipping_status', '=', 1)->whereIn('carts.b_id', $booths)->leftJoin('carts', function ($q) {
             $q->on('carts.o_id', '=', 'orders.o_id');
         })->groupBy('carts.o_id')->count();
         $count_shipped = Order::where('orders.o_shipping_status', '=', 5)->whereIn('carts.b_id', $booths)->leftJoin('carts', function ($q) {
             $q->on('carts.o_id', '=', 'orders.o_id');
         })->groupBy('carts.o_id')->count();
         $count_nonpay = Order::where('orders.o_status', '=', 1)->whereIn('carts.b_id', $booths)->leftJoin('carts', function ($q) {
             $q->on('carts.o_id', '=', 'orders.o_id');
         })->groupBy('carts.o_id')->count();
         $count_paied = Order::where('orders.o_status', '=', 2)->whereIn('carts.b_id', $booths)->leftJoin('carts', function ($q) {
             $q->on('carts.o_id', '=', 'orders.o_id');
         })->groupBy('carts.o_id')->count();
         $count_finished = Order::where('orders.o_shipping_status', '=', 10)->whereIn('carts.b_id', $booths)->leftJoin('carts', function ($q) {
             $q->on('carts.o_id', '=', 'orders.o_id');
         })->groupBy('carts.o_id')->count();
         $count_nonfinished = $count_nonshipping + $count_shipped;
         $data = ['nonshipping' => $count_nonshipping, 'shipped' => $count_shipped, 'nonpay' => $count_nonpay, 'paied' => $count_paied, 'nonfinished' => $count_nonfinished, 'finished' => $count_finished];
         $re = Tools::reTrue('获取订单统计成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '获取订单统计失败:' . $e->getMessage());
     }
     return Response::json($re);
 }
Exemplo n.º 25
0
 public function postUpdateclearance()
 {
     if (Order::where('order_id', '=', $_POST['ordrid'])->update(array('payment_clearance' => $_POST['status']))) {
         $msg = $_POST['status'] == 'cleared' ? 'cleared' : $_POST['status'];
         $username = "******";
         $password = "******";
         $url = "http://smslane.com/vendorsms/pushsms.aspx?user="******"&password="******"&msisdn=91" . $_POST['phone'] . "&sid=WebSms&msg=Your order has been updated and payment is " . $msg . ".Please refer the website for details.&fl=1";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_exec($ch);
         $response = array('success' => true);
     } else {
         $response = array('success' => false);
     }
     return json_encode($response);
 }
    public function postImeiOrder()
    {
        /*if(Request::ajax()){*/
        $posted = Input::all();
        $product = $posted['network_name'];
        $rules = array('imei' => 'min:15|numeric|required', 'order_contact' => 'required');
        $validator = Validator::make($posted, $rules);
        if ($validator->passes()) {
            /*$url = 'http://localhost/iunlockgh/public/confirm-order';*/
            $your_order = Order::where('user_id', '=', Auth::user()->id)->get();
            $counter = count($your_order);
            if ($counter > 0) {
                return Redirect::back()->with('warning', 'You have already placed an order, complete that order before placing new');
            }
            /*for($s=0; $s<10; $s++){
            	                $possible = '0123456789';
            	                $code = '';
            	                $i = 0;
            	                while($i < 7){
            	                    $code .= substr($possible, mt_rand(0, strlen($possible)+1),1);
            
            	                    $i++;
            	                }
            	            }*/
            $code = mt_rand(10000, 99999);
            $order = new Order();
            $order->user_id = Auth::user()->id;
            if ($product == 1) {
                $order->network_name = 'Network Lock Check ';
            } elseif ($product == 2) {
                $order->network_name = 'Blacklisted/Barred/clean imei';
            } elseif ($product == 3) {
                $order->network_name = 'Free iCloud check';
            } else {
                $order->network_name = 'Sprint USA - All iPhone Eligibility Test Clean/Blacklist/Unpaid Bill';
            }
            $order->product_name = $posted['product_name'];
            $order->price = $posted['price'];
            $order->email = $posted['email'];
            $order->imei = $posted['imei'];
            $order->delivery = $posted['delivery'];
            $order->status = 'processing';
            $order->order_contact = $posted['order_contact'];
            $order->order_code = $code;
            $order->net_id = $posted['network_name'];
            $order->p_id = $posted['p_id'];
            $order->save();
            /* Mail::send('email.order', array('product_name'=>Input::get('product_name'), 'price'=>Input::get('price'), 'delivery'=>Input::get('delivery'), 'network_name'=>Input::get('netwwork_name'), 'imei'=>Input::get('imei')), function($message){
                        $message->from('*****@*****.**', 'PerfectUnlockgh');
                        $message->to(Input::get('email'), Input::get('product_name'), Input::get('price'), Input::get('delivery'), Input::get('network_name'))->subject('You have successfully created your order');
                        });
            */
            return Redirect::to('confirm-order')->with('message', 'Ensure to complete order within 48hrs else 
		    	order will be automatically deleted ');
        } else {
            return Redirect::back()->with('error', 'To create order, Enter a correct IMEI');
        }
    }
Exemplo n.º 27
0
 public function get_user()
 {
     $user = User::find($this->user_id);
     $response_array['user'] = $user->toArray();
     $response_array['address'] = UserAddress::where('user_id', $this->user_id)->get()->toArray();
     $response_array['credits'] = UserCredit::where('user_id', $this->user_id)->first()->toArray();
     $response_array['payments'] = Payment::where('user_id', $this->user_id)->get();
     $response_array['orders'] = Order::where('user_id', $this->user_id)->get();
     if (Request::format() == 'html') {
         return View::make('account')->with('data', $response_array)->with('store', $this->store)->with('departments', $this->departments)->with('zipcode', $this->zipcode)->with('city', $this->city)->with('stores1', $this->stores);
     } else {
         $response_array['success'] = 'true';
         $response_code = 200;
         $response = Response::json($response_array, $response_code);
         return $response;
     }
 }
Exemplo n.º 28
0
 public function viewAllOrders()
 {
     $today = Carbon\Carbon::toDay()->toDateTimeString();
     if (Auth::user()->role == "admin" || Auth::user()->role == "cashier") {
         $orders_today = Order::where('created_at', '>=', Carbon\Carbon::now()->startOfDay())->orderBy('created_at', 'desc')->paginate(10);
         $orders_all = Order::orderBy('created_at', 'desc')->paginate(10);
         return View::make('order.list')->with(array('orders_today' => $orders_today, 'orders_all' => $orders_all));
     } else {
         echo "Access Denied. You have no permission to access this area.";
     }
 }
 public function bulkImportOrder()
 {
     DB::transaction(function () {
         $orderdetails_count = count(Input::json('orderdetails'));
         $orderDetails = Input::json('orderdetails');
         $skip_count = 0;
         for ($i = 0; $i < $orderdetails_count; $i++) {
             if (Order::where('RefOrderId', '=', $orderDetails[$i]['Order_ID'])->count() > 0) {
                 $skip_count++;
             } else {
                 //Insert New Jobs Details in Jobs Table
                 $jobs_dtl = new Jobs();
                 $jobs_dtl->Channel_Id = $orderDetails[$i]['Channel_Id'];
                 $jobs_dtl->Job_Type_Id = "1";
                 $jobs_dtl->Job_Status_Id = "1";
                 $jobs_dtl->ACTIVE = 1;
                 $jobs_dtl->CREATE_TS = date("Y-m-d H:i:s");
                 $jobs_dtl->MODIFY_TS = date("Y-m-d H:i:s");
                 $jobs_dtl->save();
                 //return Response::json($jobs_dtl);
                 // Insert New order Details in Order Table
                 $order_dtl = new Order();
                 $order_dtl->Job_Id = $jobs_dtl->id;
                 $order_dtl->Order_Date = date("Y-m-d", strtotime($orderDetails[$i]['Order_Date']));
                 //$orderDetails[$i]['Order_Date'];
                 $order_dtl->ChannelName = $orderDetails[$i]['Channel_Name'];
                 $order_dtl->OrderStatus = $orderDetails[$i]['Order_Status'];
                 $order_dtl->SubTotal = $orderDetails[$i]['SubTotal'];
                 $order_dtl->Tax = $orderDetails[$i]['Tax'];
                 $order_dtl->TaxRate = $orderDetails[$i]['Tax_Rate'];
                 $order_dtl->ShipRate = $orderDetails[$i]['Ship_Rate'];
                 $order_dtl->FinalTotal = $orderDetails[$i]['Final_Total'];
                 $order_dtl->ShipMethod = $orderDetails[$i]['Ship_Method'];
                 //$order_dtl->Requested_Ship_Date =  "";
                 $order_dtl->ShipName = $orderDetails[$i]['Ship_FirstName'] . ' ' . $orderDetails[$i]['Ship_LastName'];
                 $order_dtl->ShipAddress1 = $orderDetails[$i]['Ship_Address1'];
                 $order_dtl->ShipAddress2 = $orderDetails[$i]['Ship_Address2'];
                 $order_dtl->ShipCompany = $orderDetails[$i]['Ship_Company'];
                 $order_dtl->ShipCity = $orderDetails[$i]['Ship_City'];
                 $order_dtl->ShipZip = $orderDetails[$i]['Ship_PostalCode'];
                 $order_dtl->ShipState = $orderDetails[$i]['Ship_StateProvince'];
                 $order_dtl->ShipCountry = $orderDetails[$i]['Ship_Country'];
                 $order_dtl->ShipEmail = $orderDetails[$i]['Bill_Email'];
                 $order_dtl->BillName = $orderDetails[$i]['Bill_FirstName'] . ' ' . $orderDetails[$i]['Bill_LastName'];
                 $order_dtl->BillAddress1 = $orderDetails[$i]['Bill_Address1'];
                 $order_dtl->BillAddress2 = $orderDetails[$i]['Bill_Address2'];
                 $order_dtl->BillCompany = $orderDetails[$i]['Bill_Company'];
                 $order_dtl->BillCity = $orderDetails[$i]['Bill_City'];
                 $order_dtl->BillZip = $orderDetails[$i]['Bill_PostalCode'];
                 $order_dtl->BillState = $orderDetails[$i]['Bill_StateProvince'];
                 $order_dtl->BillCountry = $orderDetails[$i]['Bill_Country'];
                 $order_dtl->BillEmail = $orderDetails[$i]['Bill_Email'];
                 $order_dtl->BillPhone = $orderDetails[$i]['Bill_Phone_Number'];
                 $order_dtl->RefOrderId = $orderDetails[$i]['Order_ID'];
                 //$order_dtl->OrderTotal 			=  "";
                 $order_dtl->TotalShipmentPrice = $orderDetails[$i]['Ship_Rate'];
                 //$order_dtl->ShipmentsTotalCost 	=  "";
                 //$order_dtl->CarrierName 		=  "";
                 //$order_dtl->CarrierServiceName 	=  "";
                 //$order_dtl->Comments 			=  "";
                 $order_dtl->ACTIVE = 1;
                 $order_dtl->CREATE_TS = date("Y-m-d H:i:s");
                 $order_dtl->MODIFY_TS = date("Y-m-d H:i:s");
                 $order_dtl->save();
                 //return Response::json($order_dtl);
                 // Order Item Table
                 $order_item_dtl = new Orderitems();
                 $order_item_dtl->Order_Id = $order_dtl->id;
                 $order_item_dtl->Order_Item = 0;
                 $order_item_dtl->ItemName = $orderDetails[$i]['Product_Name'];
                 $order_item_dtl->ItemDescription = $orderDetails[$i]['Product_Customizations_Description'];
                 //$order_item_dtl->SKU 				= "";
                 //$order_item_dtl->UnitWeight 		= "";
                 $order_item_dtl->ItemPrice = $orderDetails[$i]['Product_Paid'];
                 $order_item_dtl->ItemRefId = $orderDetails[$i]['Order_ID'];
                 $order_item_dtl->Order_Qty = $orderDetails[$i]['Product_Quantity'];
                 $order_item_dtl->Balance_Qty = $orderDetails[$i]['Product_Quantity'];
                 $order_item_dtl->ProductName = $orderDetails[$i]['Product_Name'];
                 $order_item_dtl->ProductPartNumber = $orderDetails[$i]['Product_Part_Number'];
                 $order_item_dtl->ProductPaid = $orderDetails[$i]['Product_Paid'];
                 $order_item_dtl->ProductQuantity = $orderDetails[$i]['Product_Quantity'];
                 $order_item_dtl->ProductCustomizationDescription = $orderDetails[$i]['Product_Customizations_Description'];
                 $order_item_dtl->ACTIVE = 1;
                 $order_item_dtl->CREATE_TS = date("Y-m-d H:i:s");
                 $order_item_dtl->MODIFY_TS = date("Y-m-d H:i:s");
                 $order_item_dtl->save();
                 $orderItems_count = count(Input::json('orderdetails')[$i]['Items']);
                 $itemDetails = Input::json('orderdetails')[$i]['Items'];
                 if ($orderItems_count > 0) {
                     for ($j = 0; $j < $orderItems_count; $j++) {
                         // Order Item Table
                         $order_item_dtl = new Orderitems();
                         $order_item_dtl->Order_Id = $order_dtl->id;
                         $order_item_dtl->Order_Item = 0;
                         $order_item_dtl->ItemName = $itemDetails[$j]['Product_Name'];
                         $order_item_dtl->ItemDescription = $itemDetails[$j]['Product_Customizations_Description'];
                         //$order_item_dtl->SKU 				= "";
                         //$order_item_dtl->UnitWeight 		= "";
                         $order_item_dtl->ItemPrice = $itemDetails[$j]['Product_Paid'];
                         $order_item_dtl->ItemRefId = $itemDetails[$j]['Order_ID'];
                         $order_item_dtl->Order_Qty = $itemDetails[$j]['Product_Quantity'];
                         $order_item_dtl->Balance_Qty = $itemDetails[$j]['Product_Quantity'];
                         $order_item_dtl->ProductName = $itemDetails[$j]['Product_Name'];
                         $order_item_dtl->ProductPartNumber = $itemDetails[$j]['Product_Part_Number'];
                         $order_item_dtl->ProductPaid = $itemDetails[$j]['Product_Paid'];
                         $order_item_dtl->ProductQuantity = $itemDetails[$j]['Product_Quantity'];
                         $order_item_dtl->ProductCustomizationDescription = $itemDetails[$j]['Product_Customizations_Description'];
                         $order_item_dtl->ACTIVE = 1;
                         $order_item_dtl->CREATE_TS = date("Y-m-d H:i:s");
                         $order_item_dtl->MODIFY_TS = date("Y-m-d H:i:s");
                         $order_item_dtl->save();
                     }
                 }
                 //return Response::json($order_item_dtl);
             }
         }
         return Response::json(array('flash' => $orderdetails_count . ' Bulk Orders Processed Successfully, ' . $skip_count . ' Orders already in system'))->setCallback(Input::get('callback'));
     });
 }
Exemplo n.º 30
0
 function getUserOrders($status = 'pending', $page = 1, $startDate = null, $endDate = null)
 {
     $userId = Session::get('user_id');
     if (isset($userId)) {
         if (isset($startDate) && isset($endDate)) {
             $startDate = date('Y-m-d', strtotime($startDate));
             $endDate = date('Y-m-d', strtotime($endDate));
             $orders = Order::where('user_id', '=', $userId)->where('start_date', '>=', $startDate)->where('end_date', '<=', $endDate)->get();
         } else {
             if (isset($startDate)) {
                 $startDate = date('Y-m-d', strtotime($startDate));
                 $orders = Order::where('user_id', '=', $userId)->where('start_date', '>=', $startDate)->get();
             } else {
                 $orders = Order::where('user_id', '=', $userId)->get();
             }
         }
         if (isset($orders)) {
             return json_encode(array('message' => 'found', 'orders' => $orders->toArray()));
         } else {
             return json_encode(array('message' => 'empty'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }