Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pa2d4ti06
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Juliper
pa2d4ti06
Commits
2652cc7c
Commit
2652cc7c
authored
May 18, 2017
by
Palti Sinaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.del.ac.id/juliper19/pa2d4ti06
parents
02e91aee
51e742ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
CustomerController.php
app/Http/Controllers/CustomerController.php
+36
-7
ListBook.php
app/ListBook.php
+1
-1
No files found.
app/Http/Controllers/CustomerController.php
View file @
2652cc7c
...
@@ -171,20 +171,49 @@ class CustomerController extends Controller
...
@@ -171,20 +171,49 @@ class CustomerController extends Controller
public
function
booking
(
Request
$request
){
public
function
booking
(
Request
$request
){
$lb
=
new
ListBook
();
$lb
=
new
ListBook
();
$data
=
DB
::
table
(
'homestay'
)
$data
Homestay
=
DB
::
table
(
'homestay'
)
->
join
(
'kamar'
,
'homestay.id'
,
'='
,
'kamar.idHomestay'
)
->
join
(
'kamar'
,
'homestay.id'
,
'='
,
'kamar.idHomestay'
)
->
select
(
'kamar.*'
,
'homestay.harga'
,
'homestay.'
)
->
select
(
'kamar.*'
,
'homestay.harga'
,
'homestay.
jumlahKamar
'
)
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
get
();
->
get
();
dd
(
$data
);
$homestayJumlahKamar
=
DB
::
table
(
'homestay'
)
->
select
(
'homestay.jumlahKamar'
)
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
get
();
$dataBookingMulai
=
DB
::
table
(
'daftar_book'
)
->
select
(
'daftar_book.*'
)
->
where
(
'daftar_book.tanggal_mulai'
,
'='
,
$request
[
'tanggal'
])
->
get
();
$dataBookingBerakhir
=
DB
::
table
(
'daftar_book'
)
->
select
(
'daftar_book.*'
)
->
where
(
'daftar_book.tanggal_mulai'
,
'='
,
$request
[
'tanggal'
])
->
get
();
if
(
$dataBookingMulai
->
count
()
>
0
){
$currentJumlahKamar
=
$homestayJumlahKamar
[
0
]
->
jumlahKamar
-
$dataBookingMulai
[
0
]
->
jumlah_kamar
;
$data2
=
DB
::
table
(
'users'
)
if
(
$currentJumlahKamar
>=
$request
[
'jumlah_kamar'
]){
dd
(
"masuk gan"
,
$request
[
'jumlah_kamar'
],
$request
[
'tanggal'
]);
}
else
{
dd
(
"nggak boleh"
);
}
}
else
{
echo
(
'langsung aja'
);
}
//dd('dataBooking',$dataBooking,'dataHomestay',$dataHomestay);
$dataPelanggan
=
DB
::
table
(
'users'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_Akun'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_Akun'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
->
get
();
//dd($dataHomestay,$dataPelanggan);
$time
=
explode
(
'-'
,
$request
[
'tanggal'
]);
$time
=
explode
(
'-'
,
$request
[
'tanggal'
]);
$time
[
2
]
+=
$request
[
'jumlah_hari'
];
$time
[
2
]
+=
$request
[
'jumlah_hari'
];
...
@@ -192,17 +221,17 @@ class CustomerController extends Controller
...
@@ -192,17 +221,17 @@ class CustomerController extends Controller
//Insert Table Transaksi
//Insert Table Transaksi
$trans
=
new
Transaksi
();
$trans
=
new
Transaksi
();
$trans
->
id_pelanggan
=
$data
2
[
0
]
->
id
;
$trans
->
id_pelanggan
=
$data
Pelanggan
[
0
]
->
id
;
$trans
->
id_homestay
=
$request
[
'id'
];
$trans
->
id_homestay
=
$request
[
'id'
];
$trans
->
tanggal_mulai
=
$request
[
'tanggal'
];
$trans
->
tanggal_mulai
=
$request
[
'tanggal'
];
$trans
->
tanggal_berakhir
=
$baru
;
$trans
->
tanggal_berakhir
=
$baru
;
$trans
->
jumlah_kamar
=
$request
[
'jumlah_kamar'
];
$trans
->
jumlah_kamar
=
$request
[
'jumlah_kamar'
];
$trans
->
lama_menginap
=
$request
[
'jumlah_hari'
];
$trans
->
lama_menginap
=
$request
[
'jumlah_hari'
];
$trans
->
total_pembayaran
=
$request
[
'jumlah_kamar'
]
*
$data
[
0
]
->
harga
;
$trans
->
total_pembayaran
=
$request
[
'jumlah_kamar'
]
*
$data
Homestay
[
0
]
->
harga
;
//Insert Table Daftar Booking
//Insert Table Daftar Booking
$lb
->
homestay
=
$request
[
'id'
];
$lb
->
homestay
=
$request
[
'id'
];
$lb
->
nama_pemesan
=
$data
2
[
0
]
->
nama
;
$lb
->
nama_pemesan
=
$data
Pelanggan
[
0
]
->
nama
;
$lb
->
jumlah_kamar
=
$request
[
'jumlah_kamar'
];
$lb
->
jumlah_kamar
=
$request
[
'jumlah_kamar'
];
$lb
->
tanggal_mulai
=
$request
[
'tanggal'
]
;
$lb
->
tanggal_mulai
=
$request
[
'tanggal'
]
;
$lb
->
tanggal_berakhir
=
$baru
;
$lb
->
tanggal_berakhir
=
$baru
;
...
...
app/ListBook.php
View file @
2652cc7c
...
@@ -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
=
[
'nama_pemesan'
,
'tanggal_mulai'
,
'tanggal_berakhir'
,
'homestay'
'nama_pemesan'
,
'tanggal_mulai'
,
'tanggal_berakhir'
,
'homestay'
,
'jumlah_kamar'
];
];
public
$timestamps
=
false
;
public
$timestamps
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment