예제 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $cek = Docbook::where('user_id', $id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->first();
     $docbook = Docbook::findOrFail($cek->id);
     $data['docbook'] = Input::has('docbook') ? true : false;
     $docbook->update($data);
     return Redirect::back();
 }
예제 #2
0
 public function invoice()
 {
     $jenjang = Sentry::getUser()->last_name;
     $cost = Setting::first();
     $school = School::where('user_id', Sentry::getUser()->id)->first();
     $payment = Payment::where('user_id', Sentry::getUser()->id)->where(DB::raw('year'), '=', date('Y'))->first();
     if ($jenjang === 'SMA') {
         $runpas = Contest::where('nocontest', 'Lari 100m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $runpis = Contest::where('nocontest', 'Lari 100m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
         $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
         $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
         $jrunpas = $runpas * $cost->moneyreg;
         $jrunpis = $runpis * $cost->moneyreg;
         $jljpas = $ljpas * $cost->moneyreg;
         $jljpis = $ljpis * $cost->moneyreg;
         $jtppas = $tppas * $cost->moneyreg;
         $jtppis = $tppis * $cost->moneyreg;
         $jltpas = $ltpas * $cost->moneyreg;
         $jltpis = $ltpis * $cost->moneyreg;
         $jsertatl = $sertatl * $cost->moneysertatl;
         $jsertoff = $sertoff * $cost->moneysertoff;
         $jbook = $book * $cost->moneydocbook;
         $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
         return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
     } elseif ($jenjang === 'SMP') {
         $runpas = Contest::where('nocontest', 'Lari 60m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $runpis = Contest::where('nocontest', 'Lari 60m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
         $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
         $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
         $jrunpas = $runpas * $cost->moneyreg;
         $jrunpis = $runpis * $cost->moneyreg;
         $jljpas = $ljpas * $cost->moneyreg;
         $jljpis = $ljpis * $cost->moneyreg;
         $jtppas = $tppas * $cost->moneyreg;
         $jtppis = $tppis * $cost->moneyreg;
         $jltpas = $ltpas * $cost->moneyreg;
         $jltpis = $ltpis * $cost->moneyreg;
         $jsertatl = $sertatl * $cost->moneysertatl;
         $jsertoff = $sertoff * $cost->moneysertoff;
         $jbook = $book * $cost->moneydocbook;
         $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
         return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
     } elseif ($jenjang === 'SD') {
         $runpas = Contest::where('nocontest', 'Lari 50m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $runpis = Contest::where('nocontest', 'Lari 50m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $lbpas = Contest::where('nocontest', 'Lempar Bola pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $lbpis = Contest::where('nocontest', 'Lempar Bola pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $lespa = Contest::where('nocontest', 'Lari Estafet pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $lespi = Contest::where('nocontest', 'Lari Estafet pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
         $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
         $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
         $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
         $jrunpas = $runpas * $cost->moneyreg;
         $jrunpis = $runpis * $cost->moneyreg;
         $jljpas = $ljpas * $cost->moneyreg;
         $jljpis = $ljpis * $cost->moneyreg;
         $jlbpas = $lbpas * $cost->moneyreg;
         $jlbpis = $lbpis * $cost->moneyreg;
         if ($lespa % 8 == 0) {
             $lespa = $lespa / 8;
             $jlespa = $lespa * $cost->moneyregest;
         } else {
             $lespa = 0;
             $jlespa = $lespa * $cost->moneyregest;
         }
         if ($lespi % 8 == 0) {
             $lespi = $lespi / 8;
             $jlespi = $lespi * $cost->moneyregest;
         } else {
             $lespi = 0;
             $jlespi = $lespi * $cost->moneyregest;
         }
         $jsertatl = $sertatl * $cost->moneysertatl;
         $jsertoff = $sertoff * $cost->moneysertoff;
         $jbook = $book * $cost->moneydocbook;
         $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jlbpas + $jlbpis + $jlespa + $jlespi + $jsertatl + $jsertoff + $jbook;
         return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('lbpas', $lbpas)->with('lbpis', $lbpis)->with('lespa', $lespa)->with('lespi', $lespi)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jlbpas', $jlbpas)->with('jlbpis', $jlbpis)->with('jlespa', $jlespa)->with('jlespi', $jlespi)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
     }
 }
예제 #3
0
 public function exportdocbook()
 {
     Session::put('dtahun', Input::get('tahun'));
     $docbooks = Docbook::rightJoin('payments', function ($join) {
         $join->on('docbooks.user_id', '=', 'payments.user_id');
     })->rightJoin('schools', function ($join) {
         $join->on('schools.user_id', '=', 'docbooks.user_id');
     })->where('payments.year', Session::get('dtahun'))->where('payments.verifikasi', '1')->orderBy('payments.user_id', 'asc')->where('docbooks.docbook', '1')->get();
     // dd($docbooks);
     // $docbooks = Docbook::where(DB::raw('YEAR(created_at)'), '=', Session::get('dtahun'))->where('docbook', '1')->orderBy('user_id', 'asc')->get();
     return $this->exportExceldocbook($docbooks);
 }