Ejemplo n.º 1
0
 public function get_anggota($nama)
 {
     $data = \App\Anggota::where('nama', 'like', '%' . $nama . '%')->where('id_koperasi', Auth::user()->assigned_koperasi)->get();
     $kirim = array();
     foreach ($data as $key) {
         $saldo = \App\Keuangan::selectRaw('(sum(keluar)-sum(masuk)) as tabungan')->where('id_koperasi', Auth::user()->assigned_koperasi)->where('jenis', 'tabungan')->where('id_anggota', $key->id)->first();
         $kirim[] = array('id' => $key['id'], 'value' => $key['nama'], 'label' => $key['no_anggota'] . " - " . $key['nama'], 'saldo' => $saldo->tabungan);
     }
     echo json_encode($kirim);
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $v = Validator::make(Input::all(), ['nama' => 'required|min:1', 'jumlah' => 'required|min:1|numeric', 'tahun' => 'required|numeric']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $cek = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('id_jenis', Input::get('id_jenis'))->where('bulan', Input::get('bulan'))->where('tahun', Input::get('tahun'))->where('id_anggota', Input::get('id_anggota'))->where('jenis_transaksi', 'Simpanan')->get();
     if (sizeof($cek) == 0) {
         $info_ke = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('id_jenis', Input::get('id_jenis'))->where('id_anggota', Input::get('id_anggota'))->where('jenis_transaksi', 'Simpanan')->get();
         $info_ke = sizeof($info_ke);
         $data = \App\Transaksi::orderBy('id', 'desc')->first()['id'];
         $new = new \App\Transaksi();
         $new->no_transaksi = 'KSP-' . date("ymd") . ($data + 1) . "-S";
         $new->id_anggota = Input::get('id_anggota');
         $new->keterangan = Input::get('keterangan');
         $new->jenis_transaksi = 'Simpanan';
         $new->status = 'Lunas';
         $new->id_jenis = Input::get('id_jenis');
         $new->jumlah_asli = Input::get('jumlah');
         $new->jumlah_bunga = 0;
         $new->bunga = 0;
         $new->info_ke = $info_ke + 1;
         $new->bulan = Input::get('bulan');
         $new->tahun = Input::get('tahun');
         $new->jumlah_total = Input::get('jumlah');
         $new->id_koperasi = Auth::user()->assigned_koperasi;
         $new->created_by = Auth::user()->id;
         $new->save();
         $data = \App\Keuangan::orderBy('id', 'desc')->first()['id'];
         $finan = new \App\Keuangan();
         $finan->no_nota = 'KSP-' . date("ymd") . ($data + 1) . "-B";
         $finan->id_koperasi = Auth::user()->assigned_koperasi;
         $finan->id_anggota = Input::get('id_anggota');
         $finan->tabel = 'transaksis';
         $finan->jenis = 'tabungan';
         $finan->info = "Pembayaran " . \App\Simpanan::where('id_koperasi', Auth::user()->assigned_koperasi)->find(Input::get('id_jenis'))['nama'] . " " . \App\Anggota::where('id_koperasi', Auth::user()->assigned_koperasi)->find(Input::get('id_anggota'))['nama'] . " Rp. " . number_format(Input::get('jumlah'), 2, ",", ".") . " (" . date("d/m/Y H:i:s") . ") " . Auth::user()->name;
         $finan->id_transaksi = $new->id;
         $finan->masuk = Input::get('jumlah');
         $finan->keluar = 0;
         $finan->save();
         return redirect(url('transaksi/simpanan'));
     } else {
         return redirect(url('transaksi/simpanan/baru'))->withPesan('sudah_ada');
     }
 }
Ejemplo n.º 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['password' => 'required|min:6|same:confirm_password']);
     $data = $request->all();
     $fill1['name'] = $data['nip'];
     $fill1['nama'] = $data['nama'];
     $fill1['password'] = bcrypt($data['password']);
     $fill2['nip'] = $data['nip'];
     $fill2['nama'] = $data['nama'];
     $fill2['email'] = $data['email'];
     $fill2['jabatan'] = $data['jabatan'];
     //        dd($fill1,$fill2);
     $test = Anggota::where('nip', $fill1['name'])->firstOrFail();
     if (!$test) {
         User::create($fill1);
         Anggota::create($fill2);
         return redirect()->action('AnggotaController@index');
     } else {
         return redirect()->back()->withErrors(['NIP sudah digunakan']);
     }
 }
Ejemplo n.º 5
0
 /**
  * Get all of the tasks for a given user.
  *
  * @param User $user
  *
  * @return Collection
  */
 public function forUser(User $user)
 {
     return Anggota::where('user_id', $user->id)->get();
 }
Ejemplo n.º 6
0
 /**
  * Get all of the tasks for a given user.
  *
  * @param User $user
  *
  * @return Collection
  */
 public function Anggota(User $user)
 {
     return Anggota::where('user_id', $user->id)->count();
 }
Ejemplo n.º 7
0
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('relasi-1', function () {
    $anggota = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    return $anggota->detailanggota->alamat;
});
Route::get('relasi-2', function () {
    $anggota = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    return $anggota->rental->nama;
});
Route::get('relasi-3', function () {
    $rental = Rental::where('nama', '=', 'Hanzo')->first();
    foreach ($rental->anggota as $temp) {
        echo '<li> Nama : ' . $temp->nama . '</li>';
    }
});
Route::get('relasi-4', function () {
    $arvin = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    foreach ($arvin->game as $temp) {
        echo '<li>' . $temp->judul . '</li>';
    }
});
Route::get('relasi-5', function () {
    $fallout_4 = Game::where('judul', '=', 'Fallout 4')->first();
    foreach ($fallout_4->anggota as $temp) {
        echo '<li> Nama : ' . $temp->nama . '</li>';
    }
});
Ejemplo n.º 8
0
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('relasi-1', function () {
    $anggota = Anggota::where('email', '=', '*****@*****.**')->first();
    return $anggota->status->pekerjaan;
});
Route::get('relasi-2', function () {
    $anggota = Anggota::where('email', '=', '*****@*****.**')->first();
    return $anggota->tokoBuku->nama;
});
Route::get('relasi-3', function () {
    $tokoBuku = TokoBuku::where('nama', '=', 'Taman Bacaan')->first();
    foreach ($tokoBuku->anggota as $temp) {
        echo '<li>  Nama : ' . $temp->nama . '
					    ' . $temp->email . ' </li>';
    }
});
Route::get('relasi-4', function () {
    $aulia = Anggota::where('nama', '=', 'Aulia Marchita')->first();
    foreach ($aulia->buku as $temp) {
        echo '<li>' . $temp->judul . '</li>';
    }
});
Route::get('relasi-5', function () {
    $circa = Buku::where('judul', '=', 'Circa')->first();
    foreach ($circa->anggota as $temp) {
        echo '<li> Nama : ' . $temp->nama . ' <strong>' . $temp->email . '</strong></li>';
    }
});
Ejemplo n.º 9
0
 public function livebuktimanual($id_induk, $id_transaksi, $id_anggota, $arrIDKeu)
 {
     $data['keuangan'] = \App\Keuangan::where('id_koperasi', Auth::user()->assigned_koperasi)->whereIn('id', explode(",", $arrIDKeu))->get();
     $data['koperasi'] = \App\Koperasi::find(Auth::user()->assigned_koperasi);
     $jumlah = 0;
     foreach ($data['keuangan'] as $key) {
         $jumlah += $key->masuk;
     }
     $data['total'] = $jumlah;
     $data['transaksi'] = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('id', $id_transaksi)->first();
     $data['anggota'] = \App\Anggota::where('id_koperasi', Auth::user()->assigned_koperasi)->find($data['transaksi']->id_anggota);
     $data['induk'] = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('id', $id_induk)->first();
     // $pdf = \App::make('dompdf.wrapper');
     //$pdf->loadView('transaksi.printpembayaran',$data);
     $pdf = PDF::loadView('transaksi.printpembayaran', $data);
     $pdf->setPaper(array(0, 0, 612, 379));
     return $pdf->stream('download.pdf');
     //return view('transaksi.printpembayaran')->with($data);
 }
Ejemplo n.º 10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Anggota::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id)->delete();
     return redirect(url('anggota'));
 }