Commit 2cd41842 by Juliper
parents d7e0162a 196e320d
...@@ -45,7 +45,33 @@ class OwnerController extends Controller ...@@ -45,7 +45,33 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.Report')->with('data',$dataPesanan)->with('penghasilan',$penghasilan)->with('jumlahTamu',$jumlah_tamu); return view('adminlte::layouts.owner.Report')->with('data',$dataPesanan)->with('penghasilan',$penghasilan)->with('jumlahTamu',$jumlah_tamu);
dd($dataHomestay,$request['bulan'],$dataPesanan,$penghasilan); //dd($dataHomestay,$request['bulan'],$dataPesanan,$penghasilan);
}
public function printReportOwner(Request $request){
$dataHomestay = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
->where('pemilikhomestay.id_akun','=',Auth::user()->id)
->select('homestay.id','homestay.nama_homestay')
->get();
//dd($dataHomestay[0]->nama_homestay);
$dataPesanan = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
$penghasilan = 0;
$jumlah_tamu = 0;
foreach ($dataPesanan as $a){
$penghasilan += $a->total_harga;
$jumlah_tamu += $a->jumlah_tamu;
}
//dd($jumlah_tamu);
$pdf = PDF::loadView('pdf.reportOwner',['data' => $dataPesanan],['tamu'=>$jumlah_tamu,'penghasilan'=>$penghasilan,'bulan'=>$request['bulan'],'namaHomestay'=>$dataHomestay[0]->nama_homestay]);
return $pdf->stream('reportOwner.pdf');
} }
public function Record(){ public function Record(){
......
...@@ -50,4 +50,29 @@ class PDFController extends Controller ...@@ -50,4 +50,29 @@ class PDFController extends Controller
$pdf = PDF::loadView('pdf.rincianHistory',['data'=>$rincianHistory[0]]); $pdf = PDF::loadView('pdf.rincianHistory',['data'=>$rincianHistory[0]]);
return $pdf->stream('rincianHistory'); return $pdf->stream('rincianHistory');
} }
public function printReportOwner($id){
$dataHomestay = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
->where('pemilikhomestay.id_akun','=',Auth::user()->id)
->select('homestay.id')
->get();
$dataPesanan = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
$penghasilan = 0;
$jumlah_tamu = 0;
foreach ($dataPesanan as $a){
$penghasilan += $a->total_harga;
$jumlah_tamu += $a->jumlah_tamu;
}
$pdf = PDF::loadView('pdf.reportOwner',['data' => $dataPesanan[0]],['penghasilan'=>$penghasilan],['tamu'=>$jumlah_tamu]);
return $pdf->stream('reportOwner.pdf');
}
} }
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p style="float:right;"><b>Tanggal : </b> <?php echo date("Y/m/d") ;?></p>
<br><br><br>
<center> <h1>Laporan di Bulan {{$bulan}}</h1></center>
<center> {{$namaHomestay}} </center>
@foreach($data as $a)
<table class="table table-user-information">
<tr>
<th>Nama Pemesan</th>
<td>: </td>
<td>{{$a->nama_pemesan}}</td>
</tr>
<tr>
<th>Jumlah Kamar</th>
<td>: </td>
<td>{{$a->jumlah_kamar}} kamar</td>
</tr>
<tr>
<th>Jumlah Tamu</th>
<td>: </td>
<td>{{$a->jumlah_tamu}} orang</td>
</tr>
<tr>
<th>Lama Menginap</th>
<td>: </td>
<td>{{$a->lama_menginap}} Malam </td>
</tr>
<tr>
<th>Extra-bed</th>
<td>: </td>
<td>{{$a->extrabed}} buah</td>
</tr>
<tr>
<th>Tanggal Check-in</th>
<td>:</td>
<td>{{$a->tanggal_mulai}}</td>
</tr>
<tr>
<th>Tanggal Check-out</th>
<td>:</td>
<td>{{$a->tanggal_berakhir}}</td>
</tr>
<tr>
<th>Total Pembayaran</th>
<td>:</td>
<td>{{$a->total_harga}}</td>
</tr> <br><br>
</table>
@endforeach
<h3>Total Tamu : </h3> {{$tamu}}
<h3>Total Penghasilan : </h3> {{$penghasilan}}
</body>
</html>
...@@ -5,60 +5,69 @@ ...@@ -5,60 +5,69 @@
@endsection @endsection
@section('main-content') @section('main-content')
<section class="content"> <div class="box box-primary">
<!-- Small boxes (Stat box) --> <div class="box-header with-border">
<div class="row"> <h3 class="box-title"> Laporan </h3>
<form action="{{url('report')}}"> </div>
<label>Bulan</label>
<input type="number" min="1" max="12" name="bulan" >
<input type="submit" value="Cari" class="btn-btn info">
</form>
</div>
@if($data==null)<H2>Data Tidak Ada</H2> <div class="box-body">
@else <form action="{{url('report')}}">
<table class="table"> <label>Bulan</label>
<tr> <input type="number" min="1" max="12" name="bulan" required >
<td></td> <input type="submit" value="Cari" class="btn-btn info">
<td>Nama Pemesan</td> </form>
<td>Jumlah Kamar</td> <form action="{{url('printReportOwner')}}" enctype="multipart/form-data">
<td>Jumlah Tamu</td> <div class="form-group" align="right">
<td>Lama Menginap</td> <label>Bulan</label>
<td>Extrabed</td> <input type="number" min="1" max="12" name="bulan" required >
<td>Tanggal Mulai</td> <input type="submit" class="btn btn-warning" value="Print">
<td>Tanggal Berakhir</td> </div>
<td>Total Harga</td> </form>
</tr> @if($data==null)
@foreach($data as $a) <H2>Data Tidak Ada</H2>
<tr> @else
<td></td>
<td>{{$a->nama_pemesan}}</td>
<td>{{$a->jumlah_kamar}}</td>
<td>{{$a->jumlah_tamu}}</td>
<td>{{$a->lama_menginap}}</td>
<td>{{$a->extrabed}}</td>
<td>{{$a->tanggal_mulai}}</td>
<td>{{$a->tanggal_berakhir}}</td>
<td>{{$a->total_harga}}</td>
</tr>
@endforeach
<tr>
<td>Total</td>
<td></td>
<td></td>
<td>{{$jumlahTamu}}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{$penghasilan}}</td>
</tr>
</table>
@endif
<table class="table">
<tr>
<td></td>
<td>Nama Pemesan</td>
<td>Jumlah Kamar</td>
<td>Jumlah Tamu</td>
<td>Lama Menginap</td>
<td>Extrabed</td>
<td>Tanggal Mulai</td>
<td>Tanggal Berakhir</td>
<td>Total Harga</td>
</tr>
@foreach($data as $a)
<tr>
<td></td>
<td>{{$a->nama_pemesan}}</td>
<td>{{$a->jumlah_kamar}}</td>
<td>{{$a->jumlah_tamu}}</td>
<td>{{$a->lama_menginap}}</td>
<td>{{$a->extrabed}}</td>
<td>{{$a->tanggal_mulai}}</td>
<td>{{$a->tanggal_berakhir}}</td>
<td>{{$a->total_harga}}</td>
</tr>
@endforeach
<tr>
<td>Total</td>
<td></td>
<td></td>
<td>{{$jumlahTamu}}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{$penghasilan}}</td>
</tr>
</table>
@endif
<!-- /.row (main row) -->
</section> </div>
</div>
@endsection @endsection
...@@ -95,6 +95,7 @@ Route::group(['middleware' => 'owner'], function () { ...@@ -95,6 +95,7 @@ Route::group(['middleware' => 'owner'], function () {
Route::get('detailpesanan/{id}','OwnerController@detailpesanan'); Route::get('detailpesanan/{id}','OwnerController@detailpesanan');
Route::get('pesanan/{id}','OwnerController@pesanan'); Route::get('pesanan/{id}','OwnerController@pesanan');
Route::resource('pdf','PDFController@showPDF'); Route::resource('pdf','PDFController@showPDF');
Route::get('printReportOwner','OwnerController@printReportOwner');
}); });
Route::post('booking','GuestController@booking'); Route::post('booking','GuestController@booking');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment