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 @@ +
+
+
+
{{ $siswa }}
+
Siswa/Siswi
+
+
+
+
+
+
+
{{ $kelas }}
+
Kelas
+
+
+
+
+
+
+
{{ $item }}
+
Item Tagihan
+
+
+
diff --git a/resources/views/siswa/show.blade.php b/resources/views/siswa/show.blade.php index 1ec2838..4121d1b 100644 --- a/resources/views/siswa/show.blade.php +++ b/resources/views/siswa/show.blade.php @@ -29,10 +29,12 @@

Tabungan

+ @if($saldo != '0') + @endif

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 @@ KD Keterangan Jumlah - {{-- --}} + Cetak @@ -103,9 +103,11 @@ {{ $index+1 }} {{ $item->created_at->format('d-m-Y') }} - {{ $item->siswa->nama }} - - {{ $item->siswa->kelas->nama }} - - {{ isset($item->siswa->kelas->periode) ? $item->siswa->kelas->periode->nama : '' }} + + {{ $item->siswa->nama }} - + {{ $item->siswa->kelas->nama }} - + {{ isset($item->siswa->kelas->periode) ? $item->siswa->kelas->periode->nama : '' }} + @if($item->tipe == 'in') @@ -116,14 +118,11 @@ {{ $item->keperluan }} IDR. {{ format_idr($item->jumlah) }} - {{-- --}} - {{-- - - --}} - {{--
- @csrf -
--}} - {{-- --}} + + + Cetak + + @endforeach diff --git a/resources/views/tabungan/tabunganprint.blade.php b/resources/views/tabungan/tabunganprint.blade.php new file mode 100644 index 0000000..961dc25 --- /dev/null +++ b/resources/views/tabungan/tabunganprint.blade.php @@ -0,0 +1,50 @@ +

{{ $sitename }}

+

Tabungan

+
+

Nama : {{ $siswa->nama }} Kelas : {{ $siswa->kelas->nama }}{{ isset($siswa->kelas->periode) ? '('.$siswa->kelas->periode->nama.')' : '' }}

+

Saldo : IDR. {{ $saldo }}

+ + + + + + + + + + + + + +
NoTanggalKDJumlah
+ 1 + + {{ $tabungan->created_at->format('d-m-Y') }} + + @if($tabungan->tipe == 'in') + Menabung + @else + Penarikan + @endif + + IDR. {{ format_idr($tabungan->jumlah) }} +
+ + \ No newline at end of file diff --git a/resources/views/transaksi/index.blade.php b/resources/views/transaksi/index.blade.php index 1c30d72..0ca51a8 100644 --- a/resources/views/transaksi/index.blade.php +++ b/resources/views/transaksi/index.blade.php @@ -101,6 +101,7 @@

Histori Transaksi

@@ -114,6 +115,7 @@ Diskon Dibayarkan Keterangan + Cetak @@ -121,11 +123,21 @@ {{ $index+1 }} {{ $item->created_at->format('d-m-Y') }} - {{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }} + + + {{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }} + + {{ $item->tagihan->nama }} IDR. {{ format_idr($item->diskon) }} IDR. {{ format_idr($item->keuangan->jumlah) }} {{ $item->keterangan }} + + + @endforeach @@ -315,6 +327,34 @@ }) + $('#mass-cetak').on('click', function(){ + var ids = [] + $('.tandai').each(function(){ + if(this.checked){ + ids.push(this.value) + } + }) + + var form = document.createElement("form"); + form.setAttribute("style", "display: none"); + form.setAttribute("method", "post"); + form.setAttribute("action", "{{ route('transaksi.print') }}"); + form.setAttribute("target", "_blank"); + + var token = document.createElement("input"); + token.setAttribute("name", "_token"); + token.setAttribute("value", "{{csrf_token()}}"); + + var idsForm = document.createElement("input"); + idsForm.setAttribute("name", "ids"); + idsForm.setAttribute("value", ids); + + form.appendChild(token); + form.appendChild(idsForm); + document.body.appendChild(form); + form.submit(); + + }) }); }); diff --git a/resources/views/transaksi/transaksiprint.blade.php b/resources/views/transaksi/transaksiprint.blade.php new file mode 100644 index 0000000..4ec3f93 --- /dev/null +++ b/resources/views/transaksi/transaksiprint.blade.php @@ -0,0 +1,111 @@ +@extends('layouts.app') + +@section('page-name','Kuitansi') + +@section('content') + +
+
+
+
+
+
+

{{ $sitename }}

+

+ Pembayaran Biaya SPP
+ Invoice: 01/SPP/{{ now()->format('YmdHis') }} +

+
+
+
+

+ Tanggal : {{ now()->format('d-m-Y') }}
+ Nama : {{ Auth::user()->name }} +

+
+
+
+ + + + + + + + + + + + @foreach ($items as $item) + + + + + + + + @endforeach + + +
TanggalNama SiswaNama TagihanDiskonDibayarkan
+
+ +
+ + + + + + + + + + + +
TOTALIDR. {{ $total }}
+ Tanda Terima +
+
+

............................

+
+ Hormat Kami +
+
+

............................

+
+
+ +
+ +
+
+
+@endsection +@section('js') + +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b0e4aa9..9566930 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,83 +10,89 @@ | contains the "web" middleware group. Now create something great! | */ -Auth::routes(); -Route::middleware(['auth:web'])->group(function(){ - Route::get('/', 'HomeController@index')->name('web.index'); - Route::get('pengaturan','HomeController@pengaturan')->name('pengaturan.index'); - Route::get('ubah-pengaturan','HomeController@editPengaturan')->name('pengaturan.edit'); - Route::post('ubah-pengaturan','HomeController@storePengaturan')->name('pengaturan.store'); - Route::Post('cetak-laporan-harian','HomeController@cetak')->name('laporan-harian.cetak'); - Route::post('export-laporan-harian','HomeController@export')->name('laporan-harian.export'); +// Route::prefix('spp')->group(function(){ + Auth::routes(); - //Siswa - Route::get('siswa','SiswaController@index')->name('siswa.index'); - Route::get('tambah-siswa','SiswaController@create')->name('siswa.create'); - Route::post('tambah-siswa', 'SiswaController@store')->name('siswa.store'); - Route::get('siswa/{siswa}/detail', 'SiswaController@show')->name('siswa.show'); - Route::get('siswa/{siswa}/ubah', 'SiswaController@edit')->name('siswa.edit'); - Route::post('siswa/{siswa}/ubah','SiswaController@update')->name('siswa.update'); - Route::post('siswa/{siswa}/hapus', 'SiswaController@destroy')->name('siswa.destroy'); - Route::get('import-siswa', 'SiswaController@showFormImport')->name('siswa.showimport'); - Route::post('import-siswa', 'SiswaController@import')->name('siswa.import'); - Route::get('export-siswa', 'SiswaController@export')->name('siswa.export'); + Route::middleware(['auth:web'])->group(function(){ + Route::get('/', 'HomeController@index')->name('web.index'); + Route::get('pengaturan','HomeController@pengaturan')->name('pengaturan.index'); + Route::get('ubah-pengaturan','HomeController@editPengaturan')->name('pengaturan.edit'); + Route::post('ubah-pengaturan','HomeController@storePengaturan')->name('pengaturan.store'); + Route::Post('cetak-laporan-harian','HomeController@cetak')->name('laporan-harian.cetak'); + Route::post('export-laporan-harian','HomeController@export')->name('laporan-harian.export'); + + //Siswa + Route::get('siswa','SiswaController@index')->name('siswa.index'); + Route::get('tambah-siswa','SiswaController@create')->name('siswa.create'); + Route::post('tambah-siswa', 'SiswaController@store')->name('siswa.store'); + Route::get('siswa/{siswa}/detail', 'SiswaController@show')->name('siswa.show'); + Route::get('siswa/{siswa}/ubah', 'SiswaController@edit')->name('siswa.edit'); + Route::post('siswa/{siswa}/ubah','SiswaController@update')->name('siswa.update'); + Route::post('siswa/{siswa}/hapus', 'SiswaController@destroy')->name('siswa.destroy'); + Route::get('import-siswa', 'SiswaController@showFormImport')->name('siswa.showimport'); + Route::post('import-siswa', 'SiswaController@import')->name('siswa.import'); + Route::get('export-siswa', 'SiswaController@export')->name('siswa.export'); + + //Periode + Route::get('periode','PeriodeController@index')->name('periode.index'); + Route::get('tambah-periode','PeriodeController@create')->name('periode.create'); + Route::post('tambah-periode', 'PeriodeController@store')->name('periode.store'); + Route::get('periode/{periode}/ubah', 'PeriodeController@edit')->name('periode.edit'); + Route::post('periode/{periode}/ubah','PeriodeController@update')->name('periode.update'); + Route::post('periode/{periode}/hapus', 'PeriodeController@destroy')->name('periode.destroy'); + + //Kelas + Route::get('kelas','KelasController@index')->name('kelas.index'); + Route::get('tambah-kelas','KelasController@create')->name('kelas.create'); + Route::post('tambah-kelas', 'KelasController@store')->name('kelas.store'); + Route::get('kelas/{kelas}/ubah', 'KelasController@edit')->name('kelas.edit'); + Route::post('kelas/{kelas}/ubah','KelasController@update')->name('kelas.update'); + Route::post('kelas/{kelas}/hapus', 'KelasController@destroy')->name('kelas.destroy'); + + //Tagihan + Route::get('tagihan','TagihanController@index')->name('tagihan.index'); + Route::get('tambah-tagihan','TagihanController@create')->name('tagihan.create'); + Route::post('tambah-tagihan', 'TagihanController@store')->name('tagihan.store'); + Route::get('tagihan/{tagihan}/ubah', 'TagihanController@edit')->name('tagihan.edit'); + Route::post('tagihan/{tagihan}/ubah','TagihanController@update')->name('tagihan.update'); + Route::post('tagihan/{tagihan}/hapus', 'TagihanController@destroy')->name('tagihan.destroy'); + + //Users + Route::get('user','UserController@index')->name('user.index'); + Route::get('tambah-user','UserController@create')->name('user.create'); + Route::post('tambah-user', 'UserController@store')->name('user.store'); + Route::get('user/{user}/ubah', 'UserController@edit')->name('user.edit'); + Route::post('user/{user}/ubah','UserController@update')->name('user.update'); + Route::post('user/{user}/hapus', 'UserController@destroy')->name('user.destroy'); + + //Menabung + Route::get('tabungan', 'TabunganController@index')->name('tabungan.index'); + Route::post('menabung', 'TabunganController@menabung')->name('tabungan.store'); + Route::get('cetak-tabungan/{id}', 'TabunganController@transaksiCetak')->name('tabungan.transaksicetak'); + Route::get('export-mutasi', 'TabunganController@export')->name('tabungan.export'); + Route::get('cetak-tabungan-siswa/{siswa}', 'TabunganController@cetak')->name('tabungan.cetak'); + Route::get('export-tabungan/{siswa}', 'TabunganController@siswaexport')->name('tabungan.siswa.export'); + + //Keuangan + Route::get('keuangan', 'KeuanganController@index')->name('keuangan.index'); + Route::post('keuangan', 'KeuanganController@store')->name('keuangan.store'); + Route::get('export-keuangan', 'KeuanganController@export')->name('keuangan.export'); + + //Pembayaran SPP + Route::get('transaksi-spp','TransaksiController@index')->name('spp.index'); + Route::post('print-spp', 'TransaksiController@transaksiPrint')->name('transaksi.print'); + Route::get('export-spp','TransaksiController@transaksiExport')->name('transaksi.export'); + Route::post('print-spp/{siswa?}','TransaksiController@print')->name('spp.print'); + Route::post('export-spp/{siswa?}','TransaksiController@export')->name('spp.export'); + + //Kuitansi + Route::get('kuitansi', 'KuitansiController@index')->name('kuitansi.index'); + Route::post('kuitansi', 'KuitansiController@store')->name('kuitansi.store'); + Route::get('kuitansi/{kuitansi}', 'KuitansiController@print')->name('kuitansi.print'); + }); +// }); - //Periode - Route::get('periode','PeriodeController@index')->name('periode.index'); - Route::get('tambah-periode','PeriodeController@create')->name('periode.create'); - Route::post('tambah-periode', 'PeriodeController@store')->name('periode.store'); - Route::get('periode/{periode}/ubah', 'PeriodeController@edit')->name('periode.edit'); - Route::post('periode/{periode}/ubah','PeriodeController@update')->name('periode.update'); - Route::post('periode/{periode}/hapus', 'PeriodeController@destroy')->name('periode.destroy'); - - //Kelas - Route::get('kelas','KelasController@index')->name('kelas.index'); - Route::get('tambah-kelas','KelasController@create')->name('kelas.create'); - Route::post('tambah-kelas', 'KelasController@store')->name('kelas.store'); - Route::get('kelas/{kelas}/ubah', 'KelasController@edit')->name('kelas.edit'); - Route::post('kelas/{kelas}/ubah','KelasController@update')->name('kelas.update'); - Route::post('kelas/{kelas}/hapus', 'KelasController@destroy')->name('kelas.destroy'); - - //Tagihan - Route::get('tagihan','TagihanController@index')->name('tagihan.index'); - Route::get('tambah-tagihan','TagihanController@create')->name('tagihan.create'); - Route::post('tambah-tagihan', 'TagihanController@store')->name('tagihan.store'); - Route::get('tagihan/{tagihan}/ubah', 'TagihanController@edit')->name('tagihan.edit'); - Route::post('tagihan/{tagihan}/ubah','TagihanController@update')->name('tagihan.update'); - Route::post('tagihan/{tagihan}/hapus', 'TagihanController@destroy')->name('tagihan.destroy'); - - //Users - Route::get('user','UserController@index')->name('user.index'); - Route::get('tambah-user','UserController@create')->name('user.create'); - Route::post('tambah-user', 'UserController@store')->name('user.store'); - Route::get('user/{user}/ubah', 'UserController@edit')->name('user.edit'); - Route::post('user/{user}/ubah','UserController@update')->name('user.update'); - Route::post('user/{user}/hapus', 'UserController@destroy')->name('user.destroy'); - - //Menabung - Route::get('tabungan', 'TabunganController@index')->name('tabungan.index'); - Route::post('menabung', 'TabunganController@menabung')->name('tabungan.store'); - Route::get('export-mutasi', 'TabunganController@export')->name('tabungan.export'); - Route::get('cetak-tabungan/{siswa}', 'TabunganController@cetak')->name('tabungan.cetak'); - Route::get('export-tabungan/{siswa}', 'TabunganController@siswaexport')->name('tabungan.siswa.export'); - - //Keuangan - Route::get('keuangan', 'KeuanganController@index')->name('keuangan.index'); - Route::post('keuangan', 'KeuanganController@store')->name('keuangan.store'); - Route::get('export-keuangan', 'KeuanganController@export')->name('keuangan.export'); - - //Pembayaran SPP - Route::get('transaksi-spp','TransaksiController@index')->name('spp.index'); - Route::get('export-spp','TransaksiController@transaksiExport')->name('transaksi.export'); - Route::post('print-spp/{siswa?}','TransaksiController@print')->name('spp.print'); - Route::post('export-spp/{siswa?}','TransaksiController@export')->name('spp.export'); - - //Kuitansi - Route::get('kuitansi', 'KuitansiController@index')->name('kuitansi.index'); - Route::post('kuitansi', 'KuitansiController@store')->name('kuitansi.store'); - Route::get('kuitansi/{kuitansi}', 'KuitansiController@print')->name('kuitansi.print'); -});