Commit 618b0176 by Juliper

no message

parent 49a6f740
...@@ -73,46 +73,52 @@ class AdminController extends Controller ...@@ -73,46 +73,52 @@ class AdminController extends Controller
$dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get(); $dataHomestay = Homestay::where('nama_homestay',$request['nama_homestay'])->get();
//dd($dataHomestay[0]->id); // $asd = Transaksi::all()->where('status',1);
//$dataBok = DB::table('daftar_book')
// ->where('da');
$asd = Transaksi::all()->where('status',1);
//dd($asd); //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('transaksi','daftar_book.id_transaksi','=','transaksi.id')
->join('homestay','daftar_book.homestay','=','homestay.id') ->join('homestay','daftar_book.homestay','=','homestay.id')
//->join('pelanggan','transaksi.id_pelanggan','=','pelanggan.id')
->where('daftar_book.homestay','=',$dataHomestay[0]->id) ->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan']) ->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.*') ->select('homestay.nama_homestay','homestay.owner','transaksi.total_pembayaran','transaksi.jumlah_kamar','daftar_book.*')
->get(); ->get();
$data2 = DB::table('daftar_book') $data2 = DB::table('daftar_book')
->where('daftar_book.homestay','=',$dataHomestay[0]->id) ->where('daftar_book.homestay','=',$dataHomestay[0]->id)
->where('daftar_book.id_transaksi','=',null) ->where('daftar_book.id_transaksi','=',null)
->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan']) ->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get(); ->get();
//$i=0;
$penghasilan = 0;
foreach ($data as $a){
$penghasilan += $a->total_pembayaran;
//$i++;
}
foreach ($data2 as $b){ //$i=0;
$biaya = ($b->jumlah_kamar * 150000) * $b->lama_menginap; $penghasilan = 0;
$penghasilan += $biaya; 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 ...@@ -53,8 +53,13 @@ class GuestController extends Controller
$trans->jumlah_kamar = $request['jumlah_kamar']; $trans->jumlah_kamar = $request['jumlah_kamar'];
$trans->jumlah_tamu = $request['jumlah_tamu']; $trans->jumlah_tamu = $request['jumlah_tamu'];
$trans->lama_menginap = $request['lama_menginap']; $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->permintaan_khusus = $request['permintaan_khusus'];
$trans->total_pembayaran = $request['total_harga']; $trans->total_pembayaran = $request['total_harga'] + ($request['extrabed'] * 30000);
$trans->status = 0; $trans->status = 0;
$trans->save(); $trans->save();
...@@ -63,7 +68,10 @@ class GuestController extends Controller ...@@ -63,7 +68,10 @@ class GuestController extends Controller
->select('transaksi.id') ->select('transaksi.id')
->where('transaksi.tanggal_mulai','=',$request['tanggal_mulai']) ->where('transaksi.tanggal_mulai','=',$request['tanggal_mulai'])
->where('transaksi.tanggal_berakhir','=',$request['tanggal_selesai']) ->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(); ->get();
//dd($dataTrans); //dd($dataTrans);
...@@ -73,7 +81,12 @@ class GuestController extends Controller ...@@ -73,7 +81,12 @@ class GuestController extends Controller
$lb->homestay = $request['id_homestay']; $lb->homestay = $request['id_homestay'];
$lb->id_transaksi = $dataTrans[0]->id; $lb->id_transaksi = $dataTrans[0]->id;
$lb->nama_pemesan = $request['nama']; $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->permintaan_khusus = $request['permintaan_khusus'];
$lb->jumlah_kamar = $request['jumlah_kamar']; $lb->jumlah_kamar = $request['jumlah_kamar'];
$lb->jumlah_tamu = $request['jumlah_tamu']; $lb->jumlah_tamu = $request['jumlah_tamu'];
......
...@@ -9,7 +9,7 @@ class ListBook extends Model ...@@ -9,7 +9,7 @@ class ListBook extends Model
protected $table = "daftar_book"; protected $table = "daftar_book";
protected $fillable = [ 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; public $timestamps = false;
......
...@@ -9,7 +9,7 @@ class Transaksi extends Model ...@@ -9,7 +9,7 @@ class Transaksi extends Model
protected $table = "transaksi"; protected $table = "transaksi";
protected $fillable = [ 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; public $timestamps = false;
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
<label>Alamat Email Kontak</label> <label>Alamat Email Kontak</label>
<input type="text" name="kontak_email" class="form-control" id="inputEmail3" value="{{Auth::user()->email}}"> <input type="text" name="kontak_email" class="form-control" id="inputEmail3" value="{{Auth::user()->email}}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-10"> <div class="col-sm-10">
...@@ -34,6 +36,14 @@ ...@@ -34,6 +36,14 @@
<textarea name="permintaan_khusus" style="border: #cccccc 1px solid;border-radius: 5px; min-height:150px;"></textarea> <textarea name="permintaan_khusus" style="border: #cccccc 1px solid;border-radius: 5px; min-height:150px;"></textarea>
</div> </div>
</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="{{$dataUser->no_telepon}}" name="id_user">
<input type="hidden" value="{{$request->lama_menginap}}" name="lama_menginap"> <input type="hidden" value="{{$request->lama_menginap}}" name="lama_menginap">
<input type="hidden" value="{{$request->tanggal_mulai}}" name="tanggal_mulai"> <input type="hidden" value="{{$request->tanggal_mulai}}" name="tanggal_mulai">
......
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