Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
 public function singleYours($id)
 {
     $singleReport = SMReport::findOrFail($id);
     $singleReport['promotedProducts'] = SMReportPromotedProduct::select('product_id')->where('report_id', $singleReport->id)->get();
     $singleReport['sampleProducts'] = SMReportSampleProduct::select('product_id')->where('report_id', $singleReport->id)->get();
     $singleReport['gifts'] = SMReportGift::select('gift_id')->where('report_id', $singleReport->id)->get();
     $singleReport['soldProducts'] = SMReportSoldProduct::select('product_id', 'quantity')->where('report_id', $singleReport->id)->get();
     $dataView = ['singleReport' => $singleReport];
     return view('sm.report.single', $dataView);
 }