Commit de32596c by Palti Sinaga

asdasd

parents 75fac108 ffc0f29f
......@@ -73,46 +73,52 @@ class AdminController extends Controller
$dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get();
//dd($dataHomestay[0]->id);
//$dataBok = DB::table('daftar_book')
// ->where('da');
$asd = Transaksi::all()->where('status',1);
// $asd = Transaksi::all()->where('status',1);
//dd($asd);
//dd($request['bulan']);
$data = DB::table('daftar_book')
if($request['bulang']== null){
$dataHos = DB::table('daftar_book')
->join('transaksi','daftar_book.id_transaksi','=','transaksi.id')
->join('homestay','daftar_book.homestay','=','homestay.id')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->select('homestay.nama_homestay','homestay.owner','transaksi.total_pembayaran','transaksi.jumlah_kamar','daftar_book.*')
->get();
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$dataHos);
}else{
$data = DB::table('daftar_book')
->join('transaksi','daftar_book.id_transaksi','=','transaksi.id')
->join('homestay','daftar_book.homestay','=','homestay.id')
//->join('pelanggan','transaksi.id_pelanggan','=','pelanggan.id')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
//->where('transaksi.status','=',1)
->select('homestay.nama_homestay','homestay.owner','transaksi.total_pembayaran','transaksi.jumlah_kamar','daftar_book.*')
->get();
$data2 = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->where('daftar_book.id_transaksi','=',null)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
//$i=0;
$penghasilan = 0;
foreach ($data as $a){
$penghasilan += $a->total_pembayaran;
//$i++;
}
$data2 = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->where('daftar_book.id_transaksi','=',null)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get();
foreach ($data2 as $b){
$biaya = ($b->jumlah_kamar * 150000) * $b->lama_menginap;
$penghasilan += $biaya;
}
//$i=0;
$penghasilan = 0;
foreach ($data as $a){
$penghasilan += $a->total_pembayaran;
//$i++;
}
foreach ($data2 as $b){
$biaya = ($b->jumlah_kamar * 150000) * $b->lama_menginap;
$penghasilan += $biaya;
}
// dd($data,$data2,$penghasilan);
// dd($data,$data2,$penghasilan);
// dd('masuk',$request['bulan'],$request['nama_homestay'],$data);
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$data);
}
// dd('masuk',$request['bulan'],$request['nama_homestay'],$data);
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$data);
}
......
......@@ -53,8 +53,13 @@ class GuestController extends Controller
$trans->jumlah_kamar = $request['jumlah_kamar'];
$trans->jumlah_tamu = $request['jumlah_tamu'];
$trans->lama_menginap = $request['lama_menginap'];
if ($request['extrabed']==null){
$trans->extrabed = 0;
}else{
$trans->extrabed = $request['extrabed'];
}
$trans->permintaan_khusus = $request['permintaan_khusus'];
$trans->total_pembayaran = $request['total_harga'];
$trans->total_pembayaran = $request['total_harga'] + ($request['extrabed'] * 30000);
$trans->status = 0;
$trans->save();
......@@ -63,7 +68,10 @@ class GuestController extends Controller
->select('transaksi.id')
->where('transaksi.tanggal_mulai','=',$request['tanggal_mulai'])
->where('transaksi.tanggal_berakhir','=',$request['tanggal_selesai'])
->where('transaksi.total_pembayaran','=',$request['total_harga'])
->where('transaksi.total_pembayaran','=',$request['total_harga'] + + ($request['extrabed'] * 30000))
->where('transaksi.jumlah_kamar','=',$request['jumlah_kamar'])
->where('transaksi.jumlah_tamu','=', $request['jumlah_tamu'])
->where('transaksi.lama_menginap','=', $request['lama_menginap'])
->get();
//dd($dataTrans);
......@@ -73,7 +81,12 @@ class GuestController extends Controller
$lb->homestay = $request['id_homestay'];
$lb->id_transaksi = $dataTrans[0]->id;
$lb->nama_pemesan = $request['nama'];
$lb->total_harga = $request['total_harga'];
if($request['extrabed'] == null){
$lb->extrabed = 0;
}else{
$lb->extrabed = $request['extrabed'];
}
$lb->total_harga = $request['total_harga']+ ($request['extrabed'] * 30000);
$lb->permintaan_khusus = $request['permintaan_khusus'];
$lb->jumlah_kamar = $request['jumlah_kamar'];
$lb->jumlah_tamu = $request['jumlah_tamu'];
......
......@@ -9,7 +9,7 @@ class ListBook extends Model
protected $table = "daftar_book";
protected $fillable = [
'jumlah_tamu','total_harga','permintaan_khusus','nama_pemesan','tanggal_mulai','tanggal_berakhir','homestay','jumlah_kamar'
'extrabed','jumlah_tamu','total_harga','permintaan_khusus','nama_pemesan','tanggal_mulai','tanggal_berakhir','homestay','jumlah_kamar'
];
public $timestamps = false;
......
......@@ -9,7 +9,7 @@ class Transaksi extends Model
protected $table = "transaksi";
protected $fillable = [
'tanggal_konfirmasi','jumlah_tamu','permintaan_khusus','id_pelanggan', 'tanggal_mulai', 'tanggal_berakhir','lama_menginap','total_pembayaran','tanggal_konfirmasi','status',
'extrabed','tanggal_konfirmasi','jumlah_tamu','permintaan_khusus','id_pelanggan', 'tanggal_mulai', 'tanggal_berakhir','lama_menginap','total_pembayaran','tanggal_konfirmasi','status',
];
public $timestamps = false;
......
......@@ -95,8 +95,8 @@
<button type="submit" class="btn btn-info"><i class="fa fa-check"> Terima</i></button>
</form>
<!-- {{url('requestFasilitass/'.$data->id)}} -->
<form action="" method="post" style="display:inline">
<!-- -->
<form action="{{url('requestFasilitass/'.$data->id)}}" method="post" style="display:inline">
{{csrf_field()}}
<input type="hidden" name="_method" value="PUT">
<button type="submit" class="btn btn-danger" data-toggle="modal" data-target="#confirmDelete"
......
......@@ -26,7 +26,9 @@
<label>Alamat Email Kontak</label>
<input type="text" name="kontak_email" class="form-control" id="inputEmail3" value="{{Auth::user()->email}}">
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
......@@ -34,6 +36,14 @@
<textarea name="permintaan_khusus" style="border: #cccccc 1px solid;border-radius: 5px; min-height:150px;"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label>ExtraBed</label>
<input type="number" min="0" name="extrabed" class="form-control" id="inputEmail3" >
</div>
</div>
<input type="hidden" value="{{$dataUser->no_telepon}}" name="id_user">
<input type="hidden" value="{{$request->lama_menginap}}" name="lama_menginap">
<input type="hidden" value="{{$request->tanggal_mulai}}" name="tanggal_mulai">
......@@ -106,7 +116,7 @@
<tr>
<td> Total Bayar</td>
<td>:</td>
<td>{{$totalHarga}}</td>
<td><input type="text" name="total_harga" value="{{$totalHarga}}" disabled></td>
</tr>
</table>
<br>
......
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