Esempio n. 1
0
 public function today_sale()
 {
     $shop_id = (int) Input::get('shop_id');
     $TotalQty = 0;
     $user_type = Session::get('user_type');
     $data = new Sale();
     $sales = $data->today_sale($shop_id);
     $detail_sale = $sales['total_sale'];
     $sum_sale = $sales['sum_sale'];
     $discount_amount = $sales['discount_amount'];
     $TotalSale = number_format((int) $sum_sale[0]->TotalPrice);
     $TotalQty = number_format((int) $sum_sale[0]->TotalQty);
     $DiscountAmount = number_format((int) $discount_amount[0]->DiscountAmount);
     $shops = DB::table('shops')->orderBy('shop_id', 'desc')->get();
     //echo $user_type."-----"; die;
     if ($user_type == 1) {
         return View('today_sale', compact('detail_sale', 'TotalSale', 'TotalQty', 'DiscountAmount'));
     } else {
         // Yester day sale
         $yesterday_sale = $sales['yesterday_sale'];
         $YesterdaySale = number_format((int) $yesterday_sale[0]->YesterdaySale);
         // Today Expense
         $today_expense = $sales['today_expense'];
         $TodayExpense = number_format((int) $today_expense[0]->TodayExpense);
         // Yesterday Expense
         $yesterday_expense = $sales['yesterday_expense'];
         $YesterdayExpense = number_format((int) $yesterday_expense[0]->YesterdayExpense);
         // get_opening_balance
         //$OpBalance = $data->get_opening_balance();
         $OpBalance = 0;
         return View('admin/reports/today_sale', compact('detail_sale', 'TotalSale', 'TotalQty', 'YesterdaySale', 'TodayExpense', 'YesterdayExpense', 'DiscountAmount', 'OpBalance', 'shops', 'shop_id'));
     }
 }