diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index aaba0a2..2153824 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -9,6 +9,8 @@ use App\Models\Tagihan; use App\Models\Transaksi; use App\Exports\LaporanHarianExport; use Maatwebsite\Excel\Facades\Excel; +use App\Models\Siswa; +use App\Models\Kelas; class HomeController extends Controller { @@ -21,6 +23,10 @@ class HomeController extends Controller $transaksi = Transaksi::orderBy('siswa_id','desc')->whereDate('created_at', now()->today())->get(); + $siswa = Siswa::count(); + $item = Tagihan::count(); + $kelas = Kelas::count(); + return view('dashboard.index',[ 'total_uang' => $total_uang, 'total_uang_tabungan' => $total_uang_tabungan, @@ -28,7 +34,10 @@ class HomeController extends Controller 'total_uang_masuk' => $total_uang_masuk, 'total_uang_keluar' => $total_uang_keluar, 'transaksi' => $transaksi, - 'jumlah' => '0' + 'jumlah' => '0', + 'siswa' => $siswa, + 'item' => $item, + 'kelas' => $kelas, ]); } diff --git a/app/Http/Controllers/TabunganController.php b/app/Http/Controllers/TabunganController.php index 87e5eeb..cfd115b 100644 --- a/app/Http/Controllers/TabunganController.php +++ b/app/Http/Controllers/TabunganController.php @@ -23,6 +23,21 @@ class TabunganController extends Controller ]); } + public function transaksiCetak($id) + { + $tabungan = Tabungan::find($id); + $siswa = $tabungan->siswa; + $input = Tabungan::where('tipe','in')->where('siswa_id',$siswa->id)->sum('jumlah'); + $output = Tabungan::where('tipe','out')->where('siswa_id',$siswa->id)->sum('jumlah'); + + $verify = Tabungan::where('siswa_id', $siswa->id)->orderBy('created_at','desc')->first()->saldo; + return view('tabungan.tabunganprint', [ + 'siswa' => $siswa, + 'tabungan' => $tabungan, + 'saldo' => format_idr($input - $output).(($input - $output) == $verify ? '' : ' invalid'), + ]); + } + //api manabung public function menabung(Request $request, Siswa $siswa) { diff --git a/app/Http/Controllers/TransaksiController.php b/app/Http/Controllers/TransaksiController.php index 4576228..e9a3f6e 100644 --- a/app/Http/Controllers/TransaksiController.php +++ b/app/Http/Controllers/TransaksiController.php @@ -108,6 +108,21 @@ class TransaksiController extends Controller return \Excel::download(new SppExport, 'histori_spp-'.now().'.xlsx'); } + public function transaksiPrint(Request $request) + { + $ids = explode(',',$request->ids); + $total = 0; + $transaksi = Transaksi::whereIn('id', $ids)->get(); + foreach($transaksi as $trans){ + $total += $trans->keuangan->jumlah; + } + + return view('transaksi.transaksiprint',[ + 'items' => $transaksi, + 'total' => $total, + ]); + } + //get list tagihan of siswa public function tagihan(Siswa $siswa) { diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 1d7a1c5..1349b16 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -49,6 +49,30 @@ +
Saldo : IDR. {{$saldo}}
diff --git a/resources/views/tabungan/index.blade.php b/resources/views/tabungan/index.blade.php index dfddb9e..63c7cc4 100644 --- a/resources/views/tabungan/index.blade.php +++ b/resources/views/tabungan/index.blade.php @@ -94,7 +94,7 @@Nama : {{ $siswa->nama }} Kelas : {{ $siswa->kelas->nama }}{{ isset($siswa->kelas->periode) ? '('.$siswa->kelas->periode->nama.')' : '' }}
+Saldo : IDR. {{ $saldo }}
+No | +Tanggal | +KD | +Jumlah | +
---|---|---|---|
+ 1 + | ++ {{ $tabungan->created_at->format('d-m-Y') }} + | ++ @if($tabungan->tipe == 'in') + Menabung + @else + Penarikan + @endif + | ++ IDR. {{ format_idr($tabungan->jumlah) }} + | +
+ Pembayaran Biaya SPP
+ Invoice: 01/SPP/{{ now()->format('YmdHis') }}
+
+ Tanggal : {{ now()->format('d-m-Y') }}
+ Nama : {{ Auth::user()->name }}
+
Tanggal | +Nama Siswa | +Nama Tagihan | +Diskon | +Dibayarkan | +
---|---|---|---|---|
+ | + | + | + | + |
+ | TOTAL | +IDR. {{ $total }} | +
+ |
+ Tanda Terima
+ + + ............................ + |
+
+ Hormat Kami
+ + + ............................ + |
+