Commit 72fa80b2 by Juliper

no message

parent 0c3bf67b
...@@ -87,10 +87,23 @@ class AdminController extends Controller ...@@ -87,10 +87,23 @@ class AdminController extends Controller
->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)
->select('homestay.nama_homestay','homestay.owner','daftar_book.*') ->select('homestay.nama_homestay','homestay.owner','daftar_book.*')
//->whereMonth('daftar_book.tanggal_mulai','=',$request['bulan'])
->get(); ->get();
//dd($dataHos2);
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$dataHos)->with('data2',$dataHos2 ); $penghasilan = 0;
foreach ($dataHos as $a){
$penghasilan += $a->total_pembayaran;
//$i++;
}
foreach ($dataHos2 as $b){
$biaya = ($b->jumlah_kamar * 150000) * $b->lama_menginap;
$penghasilan += $biaya;
}
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$dataHos)->with('data2',$dataHos2 )
->with('penghasilan',$penghasilan);
}else{ }else{
$data = DB::table('daftar_book') $data = DB::table('daftar_book')
->join('transaksi','daftar_book.id_transaksi','=','transaksi.id') ->join('transaksi','daftar_book.id_transaksi','=','transaksi.id')
...@@ -123,7 +136,8 @@ class AdminController extends Controller ...@@ -123,7 +136,8 @@ class AdminController extends Controller
//dd($data,$data2,$penghasilan); //dd($data,$data2,$penghasilan);
//dd($data2); //dd($data2);
return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$data)->with('data2',$data2); return view('adminlte::layouts.admin.resultlistpesanan')->with('data',$data)->with('data2',$data2)
->with('penghasilan',$penghasilan);
} }
} }
......
...@@ -258,7 +258,7 @@ class GuestController extends Controller ...@@ -258,7 +258,7 @@ class GuestController extends Controller
//$dataKamarHomestay = ListBook::find(14); //$dataKamarHomestay = ListBook::find(14);
//dd($dataKamarHomestay); //dd($dataKamarHomestay);
//dd($dataCurrent); //dd($dataCurrent,$counter);
for ($l = 0; $l<$counter;$l++){ for ($l = 0; $l<$counter;$l++){
// echo $dataCurrent[$l]; // echo $dataCurrent[$l];
...@@ -272,12 +272,9 @@ class GuestController extends Controller ...@@ -272,12 +272,9 @@ class GuestController extends Controller
$currentKamar = $a->jumlah_kamar; $currentKamar = $a->jumlah_kamar;
} }
} }
//dd($dataKamarHomestay[1][0]->homestay);
//dd($currentKamar);
//dd($dataKamarHomestay);
// echo $currentKamar;
//dd('asd');
if($request['jumlah_kamar'] <= $currentKamar){ if($request['jumlah_kamar'] <= $currentKamar){
if($request['jumlah_Tamu'] <= ($request['jumlah_kamar']*2)){ if($request['jumlah_Tamu'] <= ($request['jumlah_kamar']*2)){
$dataHomestay[$i] = DB::table('homestay') $dataHomestay[$i] = DB::table('homestay')
...@@ -312,6 +309,8 @@ class GuestController extends Controller ...@@ -312,6 +309,8 @@ class GuestController extends Controller
$i++; $i++;
} }
//dd($currentKamar);
//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 Avilable tidak mencukupi');
......
...@@ -395,11 +395,51 @@ class OwnerController extends Controller ...@@ -395,11 +395,51 @@ class OwnerController extends Controller
$lb->lama_menginap = $request['lama_menginap']; $lb->lama_menginap = $request['lama_menginap'];
$lb->total_harga = $tohar + $datam; $lb->total_harga = $tohar + $datam;
//dd($tohar + $datam);
$time = explode('-', $request['tanggal_mulai']); $time = explode('-', $request['tanggal_mulai']);
$time[2] += $request['jumlah_hari'];
if ($time[1]==2){
$time[2] += $request['lama_menginap'];
if ($time[2]>28){
$time[2] = 0;
$time[2] += $request['lama_menginap'];
$time[2] -=1;
$time[1] +=1;
if($time[1]>12){
$time[1] = 1;
}
}
}else{
if($time[1]%2==1){
$time[2] += $request['lama_menginap'];
if($time[2]>31){
if($request['lama_menginap']!=1){
$time[2] = 0;
$time[2] += $request['lama_menginap'];
$time[1] +=1;
}
}
//$time[2] -=1;
}else{
$time[2] += $request['lama_menginap'];
if($time[2]>30){
if($request['lama_menginap']!=1){
$time[2] = 0;
$time[2] += $request['lama_menginap'];
$time[1] +=1;
}
}
//$time[2] -=1;
}
}
//$time[2] += $request['lama_menginap'];
$baru = join('-',$time); $baru = join('-',$time);
// dd($time,$request['tanggal_mulai'],$baru,$request['lama_menginap']);
$lb->tanggal_berakhir = $baru; $lb->tanggal_berakhir = $baru;
$lb->save(); $lb->save();
......
...@@ -59,6 +59,16 @@ ...@@ -59,6 +59,16 @@
</tr> </tr>
@endforeach @endforeach
<tr>
<td>Total</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{$penghasilan}}</td>
</tr>
</table> </table>
......
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