コード例 #1
0
 public function saldo()
 {
     $data = array();
     $data['saldo'] = \App\Keuangan::selectRaw('(sum(masuk)-sum(keluar)) as jumlah')->where('id_koperasi', Auth::user()->assigned_koperasi)->first();
     $data['saldo_bulan_lalu'] = \App\Keuangan::selectRaw('(sum(masuk)-sum(keluar)) as jumlah')->where('created_at', 'like', date("Y-m-", strtotime("-1 month")) . "%")->where('id_koperasi', Auth::user()->assigned_koperasi)->first();
     $data['saldo_tahun_lalu'] = \App\Keuangan::selectRaw('(sum(masuk)-sum(keluar)) as jumlah')->where('created_at', 'like', date("Y-", strtotime("-1 year")) . "%")->where('id_koperasi', Auth::user()->assigned_koperasi)->first();
     return view('laporan.saldo')->with($data);
 }
コード例 #2
0
 public function get_keuangan($id)
 {
     $data = \App\Keuangan::where('id_koperasi', Auth::user()->assigned_koperasi)->where('id_anggota', $id)->whereRaw('masuk > 0')->where('info', 'like', 'Pembayaran%')->get();
     $kirim = array();
     foreach ($data as $key) {
         $tanggal = date_format(date_create($key->created_at), "Y-m-d H:i:s");
         $kirim[] = array($key->id, $tanggal, $key->no_nota, $key->info, $key->masuk);
     }
     echo json_encode(array('data' => $kirim));
 }
コード例 #3
0
    public function rekapexport()
    {
        //$data = \App\Keuangan::selectRaw('created_at as "Waktu",no_nota as "No. Nota", jenis as "Jenis",info as "Keterangan",masuk as "Pemasukan",keluar as "Pengeluaran"')->get();
        $tgl[0] = session('tgl0');
        $tgl[1] = session('tgl1');
        $id_anggota = session('id_anggota');
        $lama = \App\Keuangan::selectRaw('created_at as "Waktu",
											no_nota as "No. Nota", 
											id_anggota, 
											jenis as "Jenis",
											info as "Keterangan",
											masuk as "Pemasukan",
											keluar as "Pengeluaran"')->whereRaw('DATE_FORMAT(created_at,"%Y-%m-%d") between "' . $tgl[0] . '" and "' . $tgl[1] . '"')->where('id_koperasi', Auth::user()->assigned_koperasi)->where('id_anggota', 'like', '%' . $id_anggota . '%')->get();
        $data = array();
        foreach ($lama as $key) {
            $data[] = array('Waktu' => $key['Waktu'], 'No. Nota' => $key['No. Nota'], 'Jenis' => $key['Jenis'], 'Anggota' => \App\Anggota::find($key['id_anggota'])['nama'], 'Keterangan' => $key['Keterangan'], 'Pemasukan' => (int) $key['Pemasukan'], 'Pengeluaran' => (int) $key['Pengeluaran']);
        }
        Excel::create('Laporan Keuangan', function ($excel) use($data) {
            $excel->sheet('Laporan Keuangan', function ($sheet) use($data) {
                $sheet->fromArray($data);
            });
        })->download('xls');
    }
コード例 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Transaksi::where('id_koperasi', Auth::user()->assigned_koperasi)->find($id)->delete();
     \App\Keuangan::where('id_koperasi', Auth::user()->assigned_koperasi)->where('tabel', 'transaksis')->where('id_transaksi', $id)->delete();
     return redirect(url('transaksi/simpanan'));
 }
コード例 #5
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);
 }