예제 #1
0
 public function singleReport($id, $type)
 {
     $singleReport = Report::findOrFail($id);
     \Excel::create('report-' . $singleReport->date, function ($excel) use($singleReport) {
         $excel->sheet('report', function ($sheet) use($singleReport) {
             $sheet->setAllBorders('thin');
             $sheet->loadView('mr.export.single_report')->with('singleReport', $singleReport);
         });
     })->export($type);
 }
예제 #2
0
 public function singleReport($level, $id, $type)
 {
     if ($level == 'sm') {
         $singleReport = SMReport::findOrFail($id);
     } elseif ($level == 'am') {
         $singleReport = AMReport::findOrFail($id);
     } elseif ($level == 'mr') {
         $singleReport = Report::findOrFail($id);
     }
     \Excel::create('report-' . $level . '-' . $singleReport->emp->name . '-' . $singleReport->date, function ($excel) use($singleReport) {
         $excel->sheet('report', function ($sheet) use($singleReport) {
             $sheet->setAllBorders('thin');
             $sheet->loadView('admin.export.single_report')->with('singleReport', $singleReport);
         });
     })->export($type);
 }
 public function edit($id)
 {
     $report = Report::findOrFail($id);
     $categories = Category::all();
     return view('reports.edit')->with('categories', $categories)->with('report', $report);
 }
예제 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if needed.
     $report = Report::findOrFail($id);
     $update = $request->all();
     // is new image uploaded?
     if ($file = Input::file('image')) {
         $fileName = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension() ?: 'png';
         $folderName = '/uploads/';
         $destinationPath = Config::get('app.path') . $folderName;
         $safeName = time() . "_" . str_random(10) . '.' . $extension;
         $file->move($destinationPath, $safeName);
         //delete old pic if exists
         if (File::exists(Config::get('app.path') . $report->image)) {
             File::delete(Config::get('app.path') . $report->image);
         }
         $update['image'] = $safeName ? $folderName . $safeName : '';
     }
     if (isset(Report::$boolean)) {
         foreach (Report::$boolean as $field) {
             if (isset($update[$field]) && $update[$field] == "on") {
                 $update[$field] = 1;
             } else {
                 $update[$field] = 0;
             }
         }
     }
     $report->update($update);
     return redirect('admin/reports')->with('success', Lang::get('message.success.update'));
 }
예제 #5
0
 public function singleMR($id)
 {
     $singleReport = Report::findOrFail($id);
     $singleReport['promotedProducts'] = ReportPromotedProduct::select('product_id')->where('report_id', $singleReport->id)->get();
     $singleReport['sampleProducts'] = ReportSampleProduct::select('product_id')->where('report_id', $singleReport->id)->get();
     $singleReport['gifts'] = ReportGift::select('gift_id')->where('report_id', $singleReport->id)->get();
     $singleReport['soldProducts'] = ReportSoldProduct::select('product_id', 'quantity')->where('report_id', $singleReport->id)->get();
     $dataView = ['singleReport' => $singleReport];
     return view('sm.report.single', $dataView);
 }
예제 #6
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     //        $router->model('user' , 'App\User');
     $router->bind('user', function ($value) {
         return User::with('roles')->findOrFail($value);
     });
     /**
      * created by dara on 6/9/2015
      * add binding for admin wild card
      */
     $router->bind('admin', function ($value) {
         return User::with('roles')->findOrFail($value);
     });
     /**
      * Created by Emad Mirzaie on 09/09/2015.
      * province wild cart
      */
     $router->model('province', 'App\\Province');
     $router->model('city', 'App\\Province');
     $router->model('university', 'App\\University');
     $router->model('article', 'App\\Article');
     $router->model('post', 'App\\Post');
     $router->model('category', 'App\\Category');
     $router->model('sub_category', 'App\\Category');
     $router->model('skill', 'App\\Skill');
     $router->model('profile', 'App\\User');
     $router->model('comment', 'App\\Comment');
     $router->model('poll', 'App\\Poll');
     $router->model('questionnaire', 'App\\Questionnaire');
     $router->model('coupon_user', 'App\\CouponUser');
     $router->model('showcase', 'App\\Showcase');
     $router->model('sticky', 'App\\Sticky');
     /**
      * Created By Dara on 22/10/2015
      */
     //        $router->bind('offer',function($value){
     //            return Offer::findOrFail($value);
     //        });
     $router->bind('service', function ($value) {
         return CouponGallery::findOrFail($value);
     });
     $router->bind('coupon', function ($value) {
         return Coupon::findOrFail($value);
     });
     $router->bind('group', function ($value) {
         return Group::findOrFail($value);
     });
     $router->bind('problem', function ($value) {
         return Problem::findOrFail($value);
     });
     $router->model('offer', 'App\\Offer');
     $router->model('shop', 'App\\Shop');
     $router->model('product', 'App\\Product');
     $router->bind('event', function ($value) {
         return Event::findOrFail($value);
     });
     $router->bind('settle', function ($value) {
         return Settle::findOrFail($value);
     });
     $router->bind('report', function ($value) {
         return Report::findOrFail($value);
     });
     $router->bind('corporation', function ($value) {
         return Corporation::findOrFail($value);
     });
     /**
      * Created By Dara on 25/12/2015
      */
     $router->bind('announcement', function ($value) {
         return Announcement::findOrFail($value);
     });
     $router->bind('storage', function ($value) {
         return Storage::findOrFail($value);
     });
     $router->bind('role', function ($value) {
         return Role::findOrFail($value);
     });
 }
예제 #7
0
 public function show($id)
 {
     $report = Report::findOrFail($id);
     return view('reports/edit', ['report' => $report]);
 }
예제 #8
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $report = Report::findOrFail($id);
     //dd($report->created_at->addDays(0.5)->diffForHumans());
     dd($report->created_at->date());
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $report = Report::findOrFail($id);
     $report->data = $report->getReportData();
     return view('reports.show', ['report' => $report]);
 }