Esempio n. 1
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;
     }
 }
 public function getList($date)
 {
     $limit = 12;
     if ($date == 'today') {
         $datename = "Bu <u>gün</u>e ait olan";
         $list = Order::orderBy('id', 'desc')->where('status', 1)->where('days', date('Y-m-d'))->paginate($limit);
     } else {
         if ($date == 'month') {
             $datename = "Bu <u>ay</u>a ait olan";
             $list = Order::orderBy('id', 'desc')->where('status', 1)->where('months', date('Y-m'))->paginate($limit);
         } else {
             if ($date == 'year') {
                 $datename = "Bu <u>yıl</u>a ait olan";
                 $list = Order::orderBy('id', 'desc')->where('status', 1)->where('years', date('Y'))->paginate($limit);
             } else {
                 $datename = "Tüm";
                 $list = Order::orderBy('id', 'desc')->where('status', 1)->paginate($limit);
             }
         }
     }
     $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('order.list', compact('list', 'order_years', 'order_months', 'order_days', 'order_all'))->with(['title' => 'Siparişler', 'count_static' => true, 'date_visible' => true, 'price_all' => 0, 'datetime' => $date, 'datename' => $datename]);
 }
Esempio n. 3
0
 public function index()
 {
     require 'models/product.php';
     require_once 'models/order_detail.php';
     $orders = Order::all();
     require_once 'views/orders/index.php';
 }
 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');
 }
Esempio n. 5
0
 public function listOfBuyerOrderCakes()
 {
     //  $buyer = Buyer::orderBy('created_at', 'desc')->first();
     //  $name = $buyer->name;
     // $order = Order::where('buyersName', '=', $name)->get();
     // $cakes = Cake::all();
     //$order = DB::SELECT(DB::RAW("SELECT * FROM order"));
     $orders = Order::all();
     // var_dump($order);
     return View::make('myaccountBuyer', ['orders' => $orders]);
 }
 public function delivery()
 {
     $djt = Delivery::with('employee')->join('tblOrders', function ($join) {
         $join->on('tblDeliveries.strOrdDlvry', '=', 'tblOrders.strOrdersID');
     })->join('tblSuppliers', function ($join3) {
         $join3->on('tblOrders.strSupplID', '=', 'tblSuppliers.strSuppID');
     })->get();
     $ids = DB::table('tblDeliveries')->select('strDlvryID')->orderBy('updated_at', 'desc')->orderBy('strDlvryID', 'desc')->take(1)->get();
     $ID = $ids["0"]->strDlvryID;
     $newID = $this->smart($ID);
     $orders = Order::all();
     $op = OrderProduct::all();
     $ord = Order::lists('strOrdersID', 'strOrdersID');
     $products = Product::lists('strProdName', 'strProdID');
     $data = array('orders' => $ord, 'products' => $products);
     return View::make('delivery')->with('djt', $djt)->with('newID', $newID)->with('orders', $orders)->with('op', $op)->with('data', $data);
 }
 public function run()
 {
     $faker = $this->getFaker();
     $orders = Order::all();
     $products = Product::all()->toArray();
     foreach ($orders as $order) {
         $used = [];
         for ($i = 0; $i < rand(1, 5); $i++) {
             $product = $faker->randomElement($products);
             if (!in_array($product["id"], $used)) {
                 $id = $product["id"];
                 $price = $product["price"];
                 $quantity = rand(1, 3);
                 OrderItem::create(["order_id" => $order->id, "product_id" => $id, "price" => $price, "quantity" => $quantity]);
                 $used[] = $product["id"];
             }
         }
     }
 }
Esempio n. 8
0
 public function getIndex()
 {
     $super = 0;
     $vendor = 0;
     if (isset($_GET['vendor']) && $_GET['vendor']) {
         $affected = Order::where('vendor_id', '=', Auth::user()->id)->update(array('notification' => 0));
         $vendor = 1;
         $orders = Order::where('vendor_id', '=', Auth::user()->id)->get();
         return View::make('orders.index')->with('orders', $orders)->with('super', $super)->with('vendor', $vendor);
     } else {
         if (isset($_GET['super']) && $_GET['super'] && Auth::user()->isSuper) {
             $super = 1;
             $orders = Order::all();
             $ordermasters = Ordermaster::all();
             return View::make('orders.index')->with('orders', $orders)->with('ordermasters', $ordermasters)->with('super', $super)->with('vendor', $vendor);
         } else {
             $data_set = DB::table('orders')->leftJoin('ratings', 'orders.order_id', '=', 'ratings.odr_id')->where('orders.user_id', '=', Auth::user()->id)->get();
             return View::make('orders.userindex')->with('orders', $data_set)->with('super', $super)->with('vendor', $vendor);
         }
     }
     //return View::make('orders.index');
 }
Esempio n. 9
0
 /**
  * @before _secure
  */
 public function orders()
 {
     $this->seo(array("title" => "Orders", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $orders = array();
     $os = Order::all(array("user_id = ?" => $this->user->id), array("id", "amount", "ref_id"), "created", "desc");
     foreach ($os as $o) {
         $title = array();
         $appointments = Appointment::all(array("order_id = ?" => $o->id), array("service_id", "start", "end", "patient_id"));
         foreach ($appointments as $a) {
             $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id"));
             $model = ucfirst($service->property);
             $item = $model::first(array("id = ?" => $service->property_id), array("title"));
             $title[] = $item->title;
             $start = $a->start;
             $end = $a->end;
             $patient_id = $a->patient_id;
         }
         $patient = User::first(array("id = ?" => $patient_id), array("name"));
         array_push($orders, array("item" => implode(", ", $title), "amount" => $o->amount, "id" => $o->id, "ref_id" => $o->ref_id, "patient" => $patient->name, "start" => $start, "end" => $end));
     }
     $view->set("orders", $orders);
 }
Esempio n. 10
0
/**
 * get_export 
 * saved to public folder
 * 
 * @access public
 * @return void
 */
function get_export()
{
    $table = Order::all();
    $file = fopen('file.csv', 'w');
    foreach ($table as $row) {
        fputcsv($file, $row->toarray());
    }
    fclose($file);
    //return Redirect::to('consolidated');
}
Esempio n. 11
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $orders = Order::all();
     return View::make('order.index')->with('orders', $orders);
 }
Esempio n. 12
0
 public static function user_index()
 {
     return function ($request, $response) {
         if (!$request->session('admin')) {
             $user_id = $request->session('id');
             $orders = Order::findByUser($user_id);
             if (!$user_id) {
                 $response->code(403);
             } else {
                 if ($orders) {
                     $response->json($orders->as_array());
                 } else {
                     $response->json(array());
                 }
             }
         } else {
             $order = Order::all();
             $response->json($order->as_array());
         }
     };
 }
Esempio n. 13
0
 /**
  * Display a listing of orders
  *
  * @return Response
  */
 public function index()
 {
     $orders = Order::all();
     return View::make('orders.index', compact('orders'));
 }
Esempio n. 14
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Response::json($this->order->all());
 }
 public function getOrder()
 {
     $orders = Order::all();
     return View::make('admin.order')->with('orders', $orders);
 }
Esempio n. 16
0
<?php

// All your app routes goes here
$app->get('/', function ($req, $res, $args) {
    return $this->view->render($res, 'welcome.php');
});
$app->get('/orders', function ($req, $res, $args) {
    $orders = Order::all();
    return $this->view->render($res, 'orders/index.php', compact('orders'));
});
$app->get('/conf', function ($req, $res, $args) {
    echo $this->config->get('url');
});
Esempio n. 17
0
 /**
  *  This function responses to
  *  the post request of /admin/order/active
  *  and deactivated all active order from list
  */
 public function postOrderDeactive()
 {
     /**
      *  If Print button press 
      *  shows active order report
      */
     if (Input::has('Print')) {
         $parameterr = array();
         $parameter['title'] = "Active Orders";
         $parameter['orders'] = Order::all();
         $pdf = PDF::loadView('reports.order.getAllActiveOrders', $parameter);
         return $pdf->stream('Active Orders.pdf');
     }
     $orderId = Input::get('checked');
     foreach ($orderId as $id) {
         $order = Order::find($id);
         $order->status = '0';
         $order->save();
     }
     return Redirect::route('active-order-get', 1);
 }
Esempio n. 18
0
 public function index()
 {
     $orders = Order::all();
     $customers = Customer::all();
     return View::make('reports.index')->with('page_title', 'Reports')->with('orders', $orders)->with('customers', $customers);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $emloyeeTerritories = Order::all();
     return view('emloyeeTerritories.index', compact('emloyeeTerritories'));
 }
Esempio n. 20
0
 public function getIndex()
 {
     $ords = Order::all();
     return View::make('orders')->with('ords', $ords);
 }