public function laporanpinjamanexport($bulan, $tahun)
 {
     $data = array();
     $data = \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->where('created_at', 'like', $tahun . "-%" . $bulan . "-%")->where('jenis_transaksi', 'Pinjaman')->get();
     $export = array();
     foreach ($data as $key) {
         $export[] = array('Nama' => \App\Anggota::where('id_koperasi', Auth::user()->assigned_koperasi)->find($key->id_anggota)['nama'], 'Jenis' => \App\Pinjaman::where('id_koperasi', Auth::user()->assigned_koperasi)->find($key->id_jenis)['nama'], 'Angsuran' => (int) $key->angsuran, 'Total' => (int) $key->jumlah_total, 'Status' => $key->status, 'Jatuh Tempo' => "Tanggal " . date_format(date_create($key->created_at), "d") . " setiap bulan", 'Jangka Waktu' => $key->info_ke . " bulan");
     }
     Excel::create('Laporan Pinjaman', function ($excel) use($export) {
         $excel->sheet('Laporan Pinjaman', function ($sheet) use($export) {
             $sheet->fromArray($export);
         });
     })->download('xls');
 }
示例#2
0
 public function get_pinjaman($id)
 {
     $data = \App\Pinjaman::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id);
     echo json_encode($data);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Pinjaman::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id)->delete();
     return redirect(url('preferensi/pinjaman'));
 }
示例#4
0
        </div>
        <div class="col-lg-4 col-xs-6">
          <div class="small-box bg-yellow">
            <div class="inner">
              <h3>{{sizeof(\App\Transaksi::where('id_koperasi',Auth::user()->assigned_koperasi)->where('jenis_transaksi','Pinjaman')->where('status','Lunas')->get())}}</h3>

              <p>Pinjaman Lunas</p>
            </div>
            <div class="icon">
              <i class="fa fa-area-chart"></i>
            </div>
            <a href="{{url('transaksi/pinjaman')}}" class="small-box-footer">Lihat Semua <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
        <?php 
$data_pinjaman = \App\Pinjaman::where('id_koperasi', Auth::user()->assigned_koperasi)->get();
?>
        @foreach($data_pinjaman as $key)
        <div class="col-lg-6 col-xs-6">
          <div class="small-box bg-orange">
            <div class="inner">
              <h3>Rp. {{number_format(DB::select("select sum(a.jumlah_total) as saldo from transaksis a left join transaksis b on a.id_induk=b.id where b.id_jenis=".$key->id." and a.id_koperasi=".Auth::user()->assigned_koperasi." and a.status='Belum Lunas'")[0]->saldo,2,",",".")}}</h3>

              <p>Saldo {{$key->nama}} di Lapangan</p>
            </div>
            <div class="icon">
              <i class="ion ion-pie-graph"></i>
            </div>
            <a href="{{url('transaksi/pembayaran/all')}}" class="small-box-footer">Cek Data Pembayaran <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $new = \App\Pinjaman::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/pinjaman'));
 }