From 29754d9a3b86ed6f67e66385d87995f7529fd4ae Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Tue, 11 Jun 2019 12:12:05 +0700 Subject: [PATCH] fixing transaksi, fixing other --- app/Exports/SppExport.php | 25 +++++++++++++++++++ app/Http/Controllers/TransaksiController.php | 6 +++++ resources/views/dashboard/export.blade.php | 8 +++--- resources/views/kuitansi/index.blade.php | 7 +++++- resources/views/transaksi/index.blade.php | 10 ++++---- .../views/transaksi/transaksiexport.blade.php | 24 ++++++++++++++++++ routes/web.php | 1 + 7 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 app/Exports/SppExport.php create mode 100644 resources/views/transaksi/transaksiexport.blade.php diff --git a/app/Exports/SppExport.php b/app/Exports/SppExport.php new file mode 100644 index 0000000..219924d --- /dev/null +++ b/app/Exports/SppExport.php @@ -0,0 +1,25 @@ +get(); + } + + public function view(): View + { + return view('transaksi.transaksiexport', [ + 'transaksi' => $this->collection(), + ]); + } +} diff --git a/app/Http/Controllers/TransaksiController.php b/app/Http/Controllers/TransaksiController.php index f2d64b6..4576228 100644 --- a/app/Http/Controllers/TransaksiController.php +++ b/app/Http/Controllers/TransaksiController.php @@ -10,6 +10,7 @@ use Illuminate\Support\Facades\DB; use App\Models\Keuangan; use App\Models\Tabungan; use App\Exports\SppSiswaExport; +use App\Exports\SppExport; class TransaksiController extends Controller { @@ -102,6 +103,11 @@ class TransaksiController extends Controller } + public function transaksiExport() + { + return \Excel::download(new SppExport, 'histori_spp-'.now().'.xlsx'); + } + //get list tagihan of siswa public function tagihan(Siswa $siswa) { diff --git a/resources/views/dashboard/export.blade.php b/resources/views/dashboard/export.blade.php index 9dde15e..b208133 100644 --- a/resources/views/dashboard/export.blade.php +++ b/resources/views/dashboard/export.blade.php @@ -4,10 +4,10 @@ - - - - + + + + diff --git a/resources/views/kuitansi/index.blade.php b/resources/views/kuitansi/index.blade.php index 15081bb..2d98c8f 100644 --- a/resources/views/kuitansi/index.blade.php +++ b/resources/views/kuitansi/index.blade.php @@ -81,6 +81,7 @@ @@ -122,6 +123,7 @@ $('#tambah').hide() $('.hapus').hide() $('#histori').toggle() + $('#baru').toggle() window.print() @@ -159,6 +161,7 @@ $('.page-title').show() $('#tambah').show() $('.hapus').show() + $('#baru').toggle() } var index = 0 $('#tambah').on('click', function(){ @@ -196,7 +199,9 @@ }); $('#total').text(seluruh); }) - + $('#baru').on('click', function(){ + window.location.reload() + }) $(document).on('click','.hapus', function(){ id = this.value console.log(id) diff --git a/resources/views/transaksi/index.blade.php b/resources/views/transaksi/index.blade.php index 824d4ee..1c30d72 100644 --- a/resources/views/transaksi/index.blade.php +++ b/resources/views/transaksi/index.blade.php @@ -100,7 +100,7 @@

Histori Transaksi

@@ -110,9 +110,9 @@
- + - + @@ -122,9 +122,9 @@ - + - + @endforeach diff --git a/resources/views/transaksi/transaksiexport.blade.php b/resources/views/transaksi/transaksiexport.blade.php new file mode 100644 index 0000000..1207e3b --- /dev/null +++ b/resources/views/transaksi/transaksiexport.blade.php @@ -0,0 +1,24 @@ +
TanggalNamaPembayaranTotalTanggalNamaPembayaranTotal
No. Tanggal SiswaJumlahTagihan DiskonTotalDibayarkan Keterangan
{{ $index+1 }} {{ $item->created_at->format('d-m-Y') }} {{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }}IDR. {{ format_idr($item->tagihan->jumlah) }}{{ $item->tagihan->nama }} IDR. {{ format_idr($item->diskon) }}IDR. {{ format_idr($item->tagihan->jumlah - $item->diskon) }}IDR. {{ format_idr($item->keuangan->jumlah) }} {{ $item->keterangan }}
+ + + + + + + + + + + + @foreach($transaksi as $item) + + + + + + + + + @endforeach + +
TanggalSiswaTagihanDiskonDibayarkanKeterangan
{{ $item->created_at->format('d-m-Y') }}{{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }}{{ $item->tagihan->nama }}IDR. {{ format_idr($item->diskon) }}IDR. {{ format_idr($item->keuangan->jumlah) }}{{ $item->keterangan }}
\ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 5cefa90..b0e4aa9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -78,6 +78,7 @@ Route::middleware(['auth:web'])->group(function(){ //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');