Commit c635121d by Juliper

no message

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