/** * Displays a single order. */ public function getOrder($id) { // Get the order. $order = Order::with('order_lines.product', 'user', 'address')->first(); // Render the view. return View::make('admin.order', ['order' => $order]); }
public function index() { if (Auth::user()->check()) { $query = Order::with(["user", "orderDetails", "orderDetails.image"]); $query->where("user_id", Auth::user()->get()->id); return $query->get(); } return Redirect::route('account-sign-in'); }
public function indexAction() { $query = Order::with(["account", "orderItems", "orderItems.product", "orderItems.product.category"]); $account = Input::get("account"); if ($account) { $query->where("account_id", $account); } return $query->get(); }
public function remembLog() { if (!Session::has('username')) { return Redirect::to('/'); } else { $empId = DB::table('tblLogin')->join('tblEmployees', function ($join) { $join->on('tblLogin.strLoginEmpID', '=', 'tblEmployees.strEmpID'); // ->where('tblLogin.strUsername','=',Session::get('username')); })->get(); $orders = Order::with('supplier', 'employee', 'products', 'notes')->get(); $index = DB::table('tblInventory')->join('tblProducts', function ($join) { $join->on('tblInventory.strProdID', '=', 'tblProducts.strProdID')->where('tblInventory.intAvailQty', '<=', '10'); })->get(); return View::make('index')->with('index', $index)->with('empId', $empId)->with('orders', $orders); } }
function get_index() { $vars = array('isManager' => $this->can('manager'), 'can' => array(), 'user' => $this->user(false)); $query = Order::with('manager')->name('o'); Event::fire('order.list.query', array($query, $this, &$vars['can'])); $rows = S::keys($query->get(), '?->id'); if ($rows) { foreach ($rows as &$order) { $order->current = false; } $current = static::detectCurrentOrder(); $current and $rows[$current->id]->current = true; Event::fire('order.list.populate', array(&$rows, $this, &$vars)); } $vars['rows'] = func('to_array', $rows); Event::fire('order.list.vars', array(&$vars, $this)); return $vars; }
public function editOrder($orderId) { try { $order = Order::with('images')->findorFail($orderId); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { return App::abort(404); } $order = $order->toArray(); $order['images'] = reset($order['images']); $this->layout->title = 'Edit Order'; $this->layout->content = View::make('admin.orders-one')->with(['order' => $order]); }
<?php require_once '../classes/session.php'; require_once '../classes/functions.php'; require __DIR__ . '/../vendor/autoload.php'; require '../config.php'; require '../classes/boot.php'; require_once '../classes/Item.php'; require_once '../classes/Restaurant.php'; require_once '../classes/User.php'; require_once '../classes/Order.php'; $session = new Session(); $session->forceLogin('../index.php'); $user = User::find($session->getUsername()); $orders = Order::with('restaurant')->where('userid', $user->id)->orderBy('id', 'desc')->get(); getTemplate(1, 'header', []); ?> <body> <?php include './includes/nav.php'; ?> <div class="orderscontainer" ng-controller="PageController"> <div class="container"> <div class="row"> <div class="col s12 m12"> <h3>Orders</h3> <ul class="collection"> <?php foreach ($orders as $key => $value) { ?>
public function edit_get($id) { $this->_data['data'] = Order::with("user", "menu")->where("order_id", $id)->first(); return View::make("admin.content.order.edit", $this->_data)->with("titlePage", "Edit Order")->with("titleTable", "Sửa yêu cầu tại nhà hàng"); }
protected function _sendDeliveryStoredInfo($id) { $order = \Order::with('orderSchedule', 'orderStuff', 'user')->find($id); $order['order_payment'] = GetLastInvoiceOrder($id); $to = ['code' => $order['order_payment']['code'], 'email' => $order['user']['email'], 'name' => $order['user']['fullname']]; $data = ['order' => $order]; \Mail::send('emails.order-stored-by-driver', $data, function ($message) use($to) { $message->to($to['email'], $to['name'])->subject('[ThankSpace] Order #' . $to['code'] . ' sudah kami tangani'); }); }
<?php require_once '../classes/session.php'; require_once '../classes/functions.php'; require __DIR__ . '/../vendor/autoload.php'; require '../config.php'; require '../classes/boot.php'; require_once '../classes/Item.php'; require_once '../classes/Restaurant.php'; require_once '../classes/User.php'; require_once '../classes/Order.php'; $session = new Session(); $session->adminForceLogin("../index.php"); $orders = Order::with('restaurant')->where('status', 'Processing')->orderBy('id', 'desc')->get(); $delivered = Order::with('restaurant')->where('status', 'Delivered')->orderBy('id', 'desc')->get(); getTemplate(1, 'header', []); ?> <body> <?php getTemplate(1, 'admin_nav', []); ?> <div class="orderscontainer" ng-controller="PageController"> <div class="container"> <div class="row"> <div class="col s12 m12"> <h3>New Orders</h3> <?php if (sizeof($orders) > 0) { ?> <ul class="collection">
public function order() { $orders = Order::with('supplier', 'employee', 'products', 'notes')->get(); return View::make('order.order')->with('orders', $orders); }
/** * Get order detail * * @param integer $id * @return \Illuminate\Database\Eloquent\Model */ public function getStorageDetail($id) { $data = \Order::with('orderSchedule', 'orderStuff')->find($id); $data['order_payment'] = GetLastInvoiceOrder($id); return $data; }
public function getIndex() { $member_id = Auth::user()->id; $orders = Order::with('orderItems')->where('member_id', '=', $member_id)->get(); return View::make('order')->with('orders', $orders); }
/** * Display the specified product. * * @param int $id * @return Response */ public function show($id) { $orders = Order::with(["customer.orders.invoices", "customer.orders.orderItems", "customer.customerType", "invoices", "employee", "business", "orderItems", "orderItems.product.unit"])->whereId($id)->get(); foreach ($orders as $order) { if ($order->customer->customerType->customer_type == "Chủ cửa hàng") { if ($order->business->type == "Nhập") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->type == "Xuất") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->name == "Thu góp vốn") { $orderTotal = $order->price; array_add($order, 'order_total', $orderTotal); } if ($order->business->type == "Thu" || $order->business->type == "Chi") { $orderTotal = $order->price; array_add($order, 'order_total', $orderTotal); } $paid = 0; foreach ($order->invoices as $invoice) { if ($order->business->type == "Xuất") { if ($invoice->business->type == "Thu") { $paid += $invoice->price; } } if ($invoice->business->type == "Chi") { $paid += $invoice->price; } } array_add($order, 'paid', $paid); } if ($order->customer->customerType->customer_type == "Nhà cung cấp") { if ($order->business->type == "Nhập") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->type == "Xuất") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->type == "Thu" || $order->business->type == "Chi") { $orderTotal = $order->price; array_add($order, 'order_total', $orderTotal); } $paid = 0; foreach ($order->invoices as $invoice) { if ($order->business->type == "Xuất") { if ($invoice->business->type == "Thu") { $paid += $invoice->price; } } if ($invoice->business->type == "Chi") { $paid += $invoice->price; } } array_add($order, 'paid', $paid); } if ($order->customer->customerType->customer_type == "Khách mua lẻ") { $oldDebt = 0; foreach ($order->customer->orders as $od) { if ($od->id != $id && $od->customer->name !== "Khách vãng lai") { $it = 0; $et = 0; if ($od->business->type == "Nhập") { foreach ($od->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; $it += $total; } } if ($od->business->type == "Xuất") { foreach ($od->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; $et += $total; } } if ($od->business->name == "Nợ phải thu") { $et = $od->price; } $ip = 0; $ep = 0; foreach ($od->invoices as $invoice) { if ($od->business->type == "Nhập") { if ($invoice->business->type == "Chi") { $ep += $invoice->price; } } if ($od->business->type == "Xuất") { if ($invoice->business->type == "Thu") { $ip += $invoice->price; } } } $oldDebt += $et - $ip - ($it - $ep); } } array_add($order, 'old_debt', $oldDebt); if ($order->business->type == "Nhập") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->type == "Xuất") { $orderTotal = 0; foreach ($order->orderItems as $product) { $raw = $product->price * $product->quantity; $discountValue = $raw * $product->discount / 100; $taxValue = $raw * $product->tax / 100; $total = $raw + $taxValue - $discountValue; array_add($product, 'total', $total); $orderTotal += $total; } array_add($order, 'order_total', $orderTotal); } if ($order->business->name == "Nợ phải thu" || $order->business->name == "Chi khác") { $orderTotal = $order->price; array_add($order, 'order_total', $orderTotal); } $paid = 0; foreach ($order->invoices as $invoice) { if ($order->business->type == "Nhập") { if ($invoice->business->type == "Chi") { $paid += $invoice->price; } } if ($invoice->business->type == "Thu") { $paid += $invoice->price; } } array_add($order, 'paid', $paid); } array_add($order, 'paid', $paid); array_add($order, 'order_total', $orderTotal); /*array_add($od,'order_total',$orderTotal); array_add($od,'sub_total',$subTotal); array_add($od,'total_quantity',$totalQuantity); array_add($od,'total_product',$totalProduct);*/ } return Response::json($orders); }
public function payment() { $orderId = Session::get('order_id'); if (isset($orderId)) { $order = Order::with('orderItems')->find($orderId); if (isset($order)) { $product_array = array(); foreach ($order->orderItems as $orderItem) { $product = Product::find($orderItem->product_id); if (isset($product)) { $product_array[] = array("name" => $product->name, "value" => $product->discounted_price, "description" => ""); } } $transactionId = microtime(true); Session::put('transactionId', $transactionId); $order->transaction_id = $transactionId; $order->save(); return View::make('checkout.payment')->with('order', $order)->with('product_json', json_encode($product_array))->with('transactionId', $transactionId); } else { return Redirect::to('/'); } } else { return Redirect::to('/'); } }
public function listOrders($status, $page) { $adminId = Session::get('admin_id'); if (!isset($adminId)) { return json_encode(array('message' => 'not logged')); } if (isset($status)) { $orders = Order::with('user')->where('status', '=', $status)->get(); if (isset($orders) && count($orders) > 0) { return json_encode(array('message' => 'found', 'orders' => $orders->toArray())); } else { return json_encode(array('message' => 'empty')); } } else { return json_encode(array('message' => 'invalid')); } }
require __DIR__ . '/../vendor/autoload.php'; require '../config.php'; require '../classes/boot.php'; require_once '../classes/Item.php'; require_once '../classes/Restaurant.php'; require_once '../classes/User.php'; require_once '../classes/Order.php'; $session = new Session(); $session->forceLogin('../index.php'); if (isset($_POST['status'])) { $order = Order::find($_GET['id']); $order->status = $_POST['status']; $order->save(); } $user = User::find($session->getUsername()); $order = Order::with('restaurant')->find($_GET['id']); $items = json_decode($order->items, TRUE); getTemplate(1, 'header', []); ?> <body> <?php getTemplate(1, 'admin_nav', []); ?> <div class="orderscontainer" ng-controller="PageController"> <div class="container"> <div class="row"> <div class="col s12 m12"> <h3>Order Details</h3> <p>Order ID: <?php echo $order->id;
<?php require_once '../classes/session.php'; require '../classes/functions.php'; require __DIR__ . '/../vendor/autoload.php'; require_once '../classes/Restaurant.php'; require '../config.php'; require '../classes/boot.php'; require '../classes/Order.php'; $session = new Session(); $session->adminForceLogin("../index.php"); $restaurants = Restaurant::orderBy("id", "desc")->get(); $orders = Order::with('restaurant')->where('status', 'Delivered')->orderBy('rest_id')->get(); $colours = ['#97BBCD', '#DCDCDC', '#F7464A', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360', '#1CBB9B', '#2DCC70', '#3598DB', '#AE7AC4', '#354A5F', '#F2C311', '#E67F22', '#E84C3D', '#ED2458', '#2D54B8', '#15B35C', '#F88505', '#FBBF4F', '#C1A985', '#FF6F69', '#BF235E', '#FF3155', '#49F770', '#FF3155', '#BA097D', '#F49600', '#1AA3A3', '#EA0F23', '#6C5871', '#C2CF99']; $totals = []; $data = "["; $current = $orders[0]->rest_id; $c_rest = $orders[0]->restaurant->name; $c_count = 0; $c_total = 0; $count = 0; foreach ($orders as $key => $value) { if ($current != $value->rest_id || $key == sizeof($orders) - 1) { $val = ['count' => $c_count, 'total' => $c_total, 'restaurant' => $c_rest]; $data .= '{value: ' . $c_total . ',color: "' . $colours[$count % sizeof($colours)] . '",highlight: "' . $colours[$count % sizeof($colours)] . '",label:"' . $c_rest . '"},'; $totals[] = $val; $c_count = 0; $c_total = 0; $current = $value->rest_id; $c_rest = $value->restaurant->name; $count++;