fixing transaksi, fixing other

pull/1/head
Aji Kamaludin 5 years ago
parent f04a243a33
commit 29754d9a3b
No known key found for this signature in database
GPG Key ID: 23E2BDC458317AF8

@ -0,0 +1,25 @@
<?php
namespace App\Exports;
use App\Models\Transaksi;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
class SppExport implements FromView
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return Transaksi::orderBy('created_at','desc')->get();
}
public function view(): View
{
return view('transaksi.transaksiexport', [
'transaksi' => $this->collection(),
]);
}
}

@ -10,6 +10,7 @@ use Illuminate\Support\Facades\DB;
use App\Models\Keuangan; use App\Models\Keuangan;
use App\Models\Tabungan; use App\Models\Tabungan;
use App\Exports\SppSiswaExport; use App\Exports\SppSiswaExport;
use App\Exports\SppExport;
class TransaksiController extends Controller 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 //get list tagihan of siswa
public function tagihan(Siswa $siswa) public function tagihan(Siswa $siswa)
{ {

@ -4,10 +4,10 @@
<table style="border: 1px solid black; width: 100%"> <table style="border: 1px solid black; width: 100%">
<thead style="border: 1px solid black;"> <thead style="border: 1px solid black;">
<tr> <tr>
<th>Tanggal</th> <th><b>Tanggal</b></th>
<th>Nama</th> <th><b>Nama</b></th>
<th>Pembayaran</th> <th><b>Pembayaran</b></th>
<th>Total</th> <th><b>Total</b></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

@ -81,6 +81,7 @@
<div class="card-footer"> <div class="card-footer">
<div class="d-flex"> <div class="d-flex">
<button type="submit" class="btn btn-primary ml-auto" id="cetak">Cetak</button> <button type="submit" class="btn btn-primary ml-auto" id="cetak">Cetak</button>
<button type="submit" class="btn btn-secondary ml-2" id="baru">Baru</button>
</div> </div>
</div> </div>
</div> </div>
@ -122,6 +123,7 @@
$('#tambah').hide() $('#tambah').hide()
$('.hapus').hide() $('.hapus').hide()
$('#histori').toggle() $('#histori').toggle()
$('#baru').toggle()
window.print() window.print()
@ -159,6 +161,7 @@
$('.page-title').show() $('.page-title').show()
$('#tambah').show() $('#tambah').show()
$('.hapus').show() $('.hapus').show()
$('#baru').toggle()
} }
var index = 0 var index = 0
$('#tambah').on('click', function(){ $('#tambah').on('click', function(){
@ -196,7 +199,9 @@
}); });
$('#total').text(seluruh); $('#total').text(seluruh);
}) })
$('#baru').on('click', function(){
window.location.reload()
})
$(document).on('click','.hapus', function(){ $(document).on('click','.hapus', function(){
id = this.value id = this.value
console.log(id) console.log(id)

@ -100,7 +100,7 @@
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Histori Transaksi</h3> <h3 class="card-title">Histori Transaksi</h3>
<div class="card-options"> <div class="card-options">
<a href="{{ route('keuangan.export') }}" class="btn btn-primary btn-sm ml-2" download="true">Export</a> <a href="{{ route('transaksi.export') }}" class="btn btn-primary btn-sm ml-2" download="true">Export</a>
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
@ -110,9 +110,9 @@
<th class="w-1">No.</th> <th class="w-1">No.</th>
<th>Tanggal</th> <th>Tanggal</th>
<th>Siswa</th> <th>Siswa</th>
<th>Jumlah</th> <th>Tagihan</th>
<th>Diskon</th> <th>Diskon</th>
<th>Total</th> <th>Dibayarkan</th>
<th>Keterangan</th> <th>Keterangan</th>
</tr> </tr>
</thead> </thead>
@ -122,9 +122,9 @@
<td><span class="text-muted">{{ $index+1 }}</span></td> <td><span class="text-muted">{{ $index+1 }}</span></td>
<td>{{ $item->created_at->format('d-m-Y') }}</td> <td>{{ $item->created_at->format('d-m-Y') }}</td>
<td>{{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }}</td> <td>{{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }}</td>
<td>IDR. {{ format_idr($item->tagihan->jumlah) }}</td> <td>{{ $item->tagihan->nama }}</td>
<td>IDR. {{ format_idr($item->diskon) }}</td> <td>IDR. {{ format_idr($item->diskon) }}</td>
<td>IDR. {{ format_idr($item->tagihan->jumlah - $item->diskon) }}</td> <td>IDR. {{ format_idr($item->keuangan->jumlah) }}</td>
<td style="max-width:150px;">{{ $item->keterangan }}</td> <td style="max-width:150px;">{{ $item->keterangan }}</td>
</tr> </tr>
@endforeach @endforeach

@ -0,0 +1,24 @@
<table>
<thead>
<tr>
<th><b>Tanggal</b></th>
<th><b>Siswa</b></th>
<th><b>Tagihan</b></th>
<th><b>Diskon</b></th>
<th><b>Dibayarkan</b></th>
<th><b>Keterangan</b></th>
</tr>
</thead>
<tbody>
@foreach($transaksi as $item)
<tr>
<td>{{ $item->created_at->format('d-m-Y') }}</td>
<td>{{ $item->siswa->nama.'('.$item->siswa->kelas->nama.')' }}</td>
<td>{{ $item->tagihan->nama }}</td>
<td>IDR. {{ format_idr($item->diskon) }}</td>
<td>IDR. {{ format_idr($item->keuangan->jumlah) }}</td>
<td style="max-width:150px;">{{ $item->keterangan }}</td>
</tr>
@endforeach
</tbody>
</table>

@ -78,6 +78,7 @@ Route::middleware(['auth:web'])->group(function(){
//Pembayaran SPP //Pembayaran SPP
Route::get('transaksi-spp','TransaksiController@index')->name('spp.index'); 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('print-spp/{siswa?}','TransaksiController@print')->name('spp.print');
Route::post('export-spp/{siswa?}','TransaksiController@export')->name('spp.export'); Route::post('export-spp/{siswa?}','TransaksiController@export')->name('spp.export');

Loading…
Cancel
Save