Commit c635121d by Juliper

no message

parent a7ea1fd8
......@@ -63,9 +63,6 @@ class AdminController extends Controller
return view('adminlte::layouts.admin.listhomestay')->with('data',$data);
}
public function cariPesanan(Request $request){
$dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get();
......@@ -493,6 +490,8 @@ class AdminController extends Controller
$req->status = 2;
$req->notif = 1;
$req->pesan = $request->pesan;
$req->update();
}
}
......@@ -344,16 +344,16 @@ class GuestController extends Controller
//dd($dataHomestay,$dataCurrent,$currentKamar);
}else{
return redirect('')->with('message','Jumlah Kamar yang Avilable tidak mencukupi');
return redirect('')->with('message','Jumlah Kamar yang sesuai tidak mencukupi');
}
if($dataHomestay == null){
dd('salah');
return redirect('')->with('message','Jumlah Kamar yang Avilable tidak mencukupi');
return redirect('')->with('message','Jumlah Kamar yang sesuai tidak mencukupi');
}
if($dataHomestay[0] == null){
return redirect('')->with('message','Jumlah Kamar yang Avilable tidak mencukupi');
return redirect('')->with('message','Jumlah Kamar yang sesuai tidak mencukupi');
dd('salah');
}
......@@ -412,7 +412,19 @@ class GuestController extends Controller
$cus->save();
return redirect('login');
$dataUser = DB::table('users')
->where('users.username','=',$data['username'])
->where('users.email','=',$data['email'])
->get();
//dd($dataUser[0]);
if (Auth::attempt(['username' => $dataUser[0]->username, 'password' => $dataUser[0]->password])) {
return redirect('/');
}else{
return redirect('login');
}
}
}
......
......@@ -27,16 +27,28 @@ class OwnerController extends Controller
public function Report(Request $request){
//dd('masuk');
return redirect()->action('OwnerController@findReport', ['id' => $request['bulan']]);
//return redirect('report/{id}',$request['bulan']);
//dd($dataHomestay,$request['bulan'],$dataPesanan,$penghasilan);
}
public function printReport(Request $request){
//dd('masuk',$request['bulan']);
$dataHomestay = DB::table('homestay')
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
->where('pemilikhomestay.id_akun','=',Auth::user()->id)
->select('homestay.id')
->get();
->join('pemilikhomestay','homestay.id_pemilik','=','pemilikhomestay.id')
->where('pemilikhomestay.id_akun','=',Auth::user()->id)
->select('homestay.id','homestay.nama_homestay')
->get();
$dataPesanan = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
$penghasilan = 0;
$jumlah_tamu = 0;
......@@ -45,12 +57,33 @@ class OwnerController extends Controller
$jumlah_tamu += $a->jumlah_tamu;
}
return view('adminlte::layouts.owner.Report')->with('data',$dataPesanan)->with('penghasilan',$penghasilan)->with('jumlahTamu',$jumlah_tamu);
//dd($dataHomestay,$request['bulan'],$dataPesanan,$penghasilan);
$pdf = PDF::loadView('pdf.reportOwner',['data' => $dataPesanan],['tamu'=>$jumlah_tamu,'penghasilan'=>$penghasilan,'bulan'=>$request['bulan'],'namaHomestay'=>$dataHomestay[0]->nama_homestay]);
$pdf->stream('reportOwner.pdf');
}
public function findReport($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','=',$id)
->get();
$penghasilan = 0;
$jumlah_tamu = 0;
foreach ($dataPesanan as $a){
$penghasilan += $a->total_harga;
$jumlah_tamu += $a->jumlah_tamu;
}
return view('adminlte::layouts.owner.Report')->with('data',$dataPesanan)->with('penghasilan',$penghasilan)->with('jumlahTamu',$jumlah_tamu);
}
public function printReportOwner(Request $request){
......
......@@ -64,28 +64,9 @@
<table class="table table-user-information">
<tr>
<th></th>
<th>Nama Pemesan</th>
<th>Jumlah Kamar</th>
<th>Jumlah Tamu</th>
<th>Lama Menginap</th>
<th>Extra-bed</th>
<th>Tanggal Check-in</th>
<th>Tanggal Check-out</th>
<th>Total Pembayaran</th>
</tr>
@foreach($data as $a)
<tr>
<td></td>
<td>{{$a->nama_pemesan}}</td>
<td>{{$a->jumlah_kamar}} kamar</td>
<td>{{$a->jumlah_tamu}} orang</td>
<td>{{$a->lama_menginap}} Malam </td>
<table class="table-style-one">
<body>
<tr>
<th>Nama Pemesan</th>
<th>Jumlah Kamar</th>
<th>Jumlah Tamu</th>
......@@ -107,31 +88,15 @@
<td>Rp. {{$a->total_harga}}</td>
</tr>
@endforeach
<tr>
<td>Total</td>
<td></td>
<td></td>
<td>{{$tamu}}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{$penghasilan}}</td>
</tr>
</table>
</body>
</html>
</tr>
@endforeach
<tr>
<td colspan="2">Total</td>
<td>{{$tamu}} Orang </td>
<td colspan="4"></td>
<td>Rp. {{$penghasilan}}</td>
</tr>
</body>
</table>
</table>
</body>
</html>
......@@ -7,14 +7,14 @@
<h3>Rincian Pemesanan Homestay</h3>
<table class="table-condensed" style="font-size: 16px; margin-left: -3px; color: #777; margin-top:5px;">
<tr>
<td>Nama Pemilik Homestay</td>
<td>Nama </td>
<td>:</td>
<td>{{$data->nama}} Malam</td>
</tr>
<tr>
<td>Nama Homestay</td>
<td>:</td>
<td>{{$data->nama_homestay}} Malam</td>
<td>{{$data->nama_homestay}}</td>
</tr>
<tr>
<td>Tanggal Check-in</td>
......@@ -34,7 +34,7 @@
<tr>
<td>Total Pembayaran</td>
<td>:</td>
<td>{{$data->total_pembayaran}}</td>
<td>Rp {{number_format($data->total_pembayaran)}}</td>
</tr>
<tr>
<td> <a href="{{url('rincianHistoryPrint/'.$data->id)}}" class="btn btn-warning"><i class="glyphicon glyphicon-print"></i> print </a></td>
......
......@@ -16,9 +16,12 @@
<input type="number" min="1" onchange="updateVal(this)" max="12" name="bulan" required >
<input type="submit" value="Cari" class="btn-btn info">
</form>
{{--<a class="btn btn-warning" onclick="cancelRequest()"> <i class="fa fa-print"></i> Print </a>--}}
<form action="{{url('printReportOwner')}}" enctype="multipart/form-data" style="float:right;">
<div class="form-group" align="right">
<input type="number" hidden id="print" min="1" max="12" name="bulan" display="none" required >
<input type="number" hidden value="{{Request::segment(2)}}" min="1" max="12" name="bulan" display="none" required >
<input type="submit" class="btn btn-warning" value="Print">
</div>
</form>
......@@ -70,12 +73,27 @@
</div>
</div>
<script>
function updateVal(object) {
{{--<script>--}}
{{--function updateVal(object) {--}}
{{--var field = document.getElementById('print');--}}
{{--field.value = parseInt(object.value);--}}
var field = document.getElementById('print');
field.value = parseInt(object.value);
{{--}--}}
{{--</script>--}}
<script>
function cancelRequest() {
$.ajax({
data: {
bulan: '{{ Request::segment(2) }}',
_token: '{{ csrf_token() }}',
},
url: '{{ url('printreport') }}',
type: 'POST',
});
}
</script>
@endsection
......@@ -64,9 +64,11 @@ Route::get('DataPemesanan', function(){
});
Route::group(['middleware' => 'owner'], function () {
Route::post('printreport','OwnerController@printReport');
Route::put('asread/{id}','OwnerController@Asread');
Route::get('record','OwnerController@Record');
Route::get('report','OwnerController@Report');
Route::get('report/{id}','OwnerController@findReport');
Route::put('check/{id}','OwnerController@Check');
Route::put('editRoom/{id}','OwnerController@updateRoom');
Route::post('addManual','OwnerController@addBookManual');
......@@ -147,6 +149,4 @@ Route::group(['middleware' => 'dinaspariwisata'], function () {
Route::get('printFasilitas/{id}','AdminController@printFasilitas');
Route::post('/cancelrequest', 'AdminController@cancelrequest');
Route::get('admin/create','AdminController@create');
});
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