Commit 2cd41842 by Juliper
parents d7e0162a 196e320d
......@@ -45,7 +45,33 @@ class OwnerController extends Controller
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(){
......
......@@ -50,4 +50,29 @@ class PDFController extends Controller
$pdf = PDF::loadView('pdf.rincianHistory',['data'=>$rincianHistory[0]]);
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 @@
@endsection
@section('main-content')
<section class="content">
<!-- Small boxes (Stat box) -->
<div class="row">
<form action="{{url('report')}}">
<label>Bulan</label>
<input type="number" min="1" max="12" name="bulan" >
<input type="submit" value="Cari" class="btn-btn info">
</form>
</div>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"> Laporan </h3>
</div>
@if($data==null)<H2>Data Tidak Ada</H2>
@else
<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
<div class="box-body">
<form action="{{url('report')}}">
<label>Bulan</label>
<input type="number" min="1" max="12" name="bulan" required >
<input type="submit" value="Cari" class="btn-btn info">
</form>
<form action="{{url('printReportOwner')}}" enctype="multipart/form-data">
<div class="form-group" align="right">
<label>Bulan</label>
<input type="number" min="1" max="12" name="bulan" required >
<input type="submit" class="btn btn-warning" value="Print">
</div>
</form>
@if($data==null)
<H2>Data Tidak Ada</H2>
@else
<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
......@@ -95,6 +95,7 @@ Route::group(['middleware' => 'owner'], function () {
Route::get('detailpesanan/{id}','OwnerController@detailpesanan');
Route::get('pesanan/{id}','OwnerController@pesanan');
Route::resource('pdf','PDFController@showPDF');
Route::get('printReportOwner','OwnerController@printReportOwner');
});
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