示例#1
0
 /**
  * Display the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request, $id)
 {
     $anggotas = Anggota::findOrFail($id);
     $simpanans = Simpanan::where('anggota_id', $id)->get();
     $simpananswajib = Simpanan::where('anggota_id', $id)->sum('simpanan_wajib');
     $simpananssukarela = Simpanan::where('anggota_id', $id)->sum('simpanan_sukarela');
     return view('anggotas.show', compact('anggotas'), ['simpanans' => $simpanans, 'anggotas' => $anggotas, 'simpananswajib' => $simpananswajib, 'simpananssukarela' => $simpananssukarela]);
 }
 public function laporansimpananexport($bulan, $tahun)
 {
     $data = array();
     $data = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('created_at', 'like', $tahun . "-%" . $bulan . "-%")->where('jenis_transaksi', 'Simpanan')->get();
     $export = array();
     foreach ($data as $key) {
         $export[] = array('Tanggal' => date_format(date_create($key->created_at), "d") . " " . \App\Bulan::where('bulan', date_format(date_create($key->created_at), "m"))->first()['nama'] . " " . date_format(date_create($key->created_at), "Y"), 'Nama' => \App\Anggota::where('id_koperasi', Auth::user()->assigned_koperasi)->find($key->id_anggota)['nama'], 'Jenis' => \App\Simpanan::where('id_koperasi', Auth::user()->assigned_koperasi)->find($key->id_jenis)['nama'], 'Jumlah' => (int) $key->jumlah_total);
     }
     Excel::create('Laporan Simpanan', function ($excel) use($export) {
         $excel->sheet('Laporan Simpanan', function ($sheet) use($export) {
             $sheet->fromArray($export);
         });
     })->download('xls');
 }
示例#3
0
 public function get_simpanan($id)
 {
     $data = \App\Simpanan::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id);
     echo $data->jumlah;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Simpanan::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id)->delete();
     return redirect(url('preferensi/simpanan'));
 }
示例#5
0
 public function Simpanan(User $id)
 {
     return Simpanan::where('anggota_id', $id->id)->get();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $new = \App\Simpanan::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id);
     $new->nama = Input::get('nama');
     $new->jumlah = Input::get('jumlah');
     $new->id_koperasi = Auth::user()->assigned_koperasi;
     $new->save();
     return redirect(url('transaksi/simpanan'));
 }
示例#7
0
 public function SimpananSukarela(User $user)
 {
     return Simpanan::where('user_id', $user->id)->sum('simpanan_sukarela');
 }
示例#8
0
 /**
  * Get all of the tasks for a given user.
  *
  * @param User $user
  *
  * @return Collection
  */
 public function forUser(User $user)
 {
     return Simpanan::where('user_id', $user->id)->orderBy('tanggal_pembayaran', 'desc')->get();
 }