/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $berangkat = \App\berangkat::find($id);
     $data = [];
     $rute = \App\rute::where('sjt', '=', $id)->get();
     $i = 0;
     foreach ($rute as $rt) {
         $resi = \App\resi::where('idberangkat', $rt->sjt)->where('idrute', $rt->id)->get();
         $data[$i]['rute'] = $rt;
         $data[$i]['resi'] = $resi;
         $i++;
     }
     return view('admin.transaction.keberangkatan-detail')->with('berangkat', $berangkat)->with('data', $data);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     date_default_timezone_set('Asia/Jakarta');
     $abouts = array();
     $news = array();
     $memo = array();
     Config::set('registered', false);
     $articles = \App\article::select('article.*', 'users.first_name', 'users.last_name')->leftJoin('users', 'article.user', '=', 'users.id')->get();
     foreach ($articles as $article) {
         switch ($article->type) {
             case 'about':
                 $abouts[] = $article;
                 break;
             case 'news':
                 $news[] = $article;
                 break;
             case 'memo':
                 $memo[] = $article;
                 break;
         }
     }
     $kota = \App\kota::all();
     foreach ($kota as $v) {
         $dkota[$v->idkota] = $v->nmkota;
     }
     $satuan = \App\satuan::all();
     foreach ($satuan as $v) {
         $dsatuan[$v->idsatuan] = $v->namasatuan;
     }
     $cabang = \App\cabang::all();
     foreach ($cabang as $v) {
         $dcabang[$v->idcabang] = $v->nama;
     }
     $dcabang = \App\Helpers::assoc_merge([0 => '--Daftar Cabang--'], $dcabang);
     //Hitung total quote yang baru
     $quotes = \App\quote::where('status', '=', '0');
     $quotesData['all'] = $quotes->limit(3)->get();
     $quotesData['count'] = $quotes->count();
     //Hitung total SJT yang belum tiba
     $sjt = \App\berangkat::where('status', '<', '3');
     $sjtData['all'] = $sjt->limit(3)->get();
     $sjtData['count'] = $sjt->count();
     //Hitung total tagihan yang belum terbayar
     $totNotification = $quotes->count() + $sjt->count();
     $notification = ['all' => $totNotification, 'quote' => $quotesData, 'sjt' => $sjtData];
     $data = array('abouts' => $abouts, 'news' => $news, 'memo' => $memo, 'kota' => $dkota, 'satuan' => $dsatuan, 'cabang' => $dcabang, 'nquotes' => $quotes, 'notification' => $notification);
     return View::share($data);
 }
Exemplo n.º 3
0
    $table .= '<tbody>';
    foreach ($resi as $r) {
        $table .= '<tr><td>' . $r->tglresi . '</td>';
        $table .= '<td>' . $r->noresi . '</td>';
        $table .= '<td>' . $r->totqty . '</td>';
        $table .= '<td>' . $r->idkonsumen . '</td>';
        $table .= '<td>' . $r->idpenerima . '</td>';
        $table .= '<td>' . $r->totalbiaya . '</td>';
        $table .= '<td>' . $r->dp . '</td>';
        $table .= '<td>' . $r->sisa . '</td></tr>';
    }
    $table .= '</tbody>';
    $table .= '</table>';
    return $table;
});
Route::get('go', function () {
    return view('test.test1');
});
Route::get('go2/{id}', function ($id) {
    $berangkat = \App\berangkat::find($id);
    $data = [];
    $rute = \App\rute::where('sjt', '=', $id)->get();
    $i = 0;
    foreach ($rute as $rt) {
        $resi = \App\resi::where('idberangkat', $rt->sjt)->where('idrute', $rt->id)->get();
        $data[$i]['rute'] = $rt;
        $data[$i]['resi'] = $resi;
        $i++;
    }
    return view('test.test2')->with('data', $data)->with('berangkat', $berangkat);
});