fix/adminBookingTableComplete

This commit is contained in:
lonetrinity
2018-08-08 11:55:14 +08:00
48 changed files with 390 additions and 5490 deletions
+18 -16
View File
@@ -137,7 +137,8 @@ class BookingController extends Controller
}
return $bookings;
}
}
public function adminIndex(){
$user = Auth::user();
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
@@ -410,33 +411,34 @@ class BookingController extends Controller
break;
}
// Service charge (RMB) : if amount higher than 10,000, no service charge. if amount lower than 10,000, 20.00 service charge
// Service charge (RMB) : if amount higher than 10,000 or term x2 no service charge.
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
$svcharge = 0;
} else {
$svcharge = 20.00;
}
$subtotal = round(($amount + $svcharge) / $rate,2);
$subtotal = round(($amount + $svcharge) / $rate, 2);
// TODO : refactor
if ($taxrate !=0){
$taxAmount = round($subtotal * $taxrate - $subtotal,2);
$taxAmount = round($subtotal * $taxrate - $subtotal, 2);
}
else{
$taxAmount = 0;
}
if ($billingChargeRate !=0){
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate - ($amount + $svcharge), 2);
if ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba'){
$billingChargeAmount = 0;
}
else{
$billingChargeAmount = 0;
// TODO : billing charge rate to percentage so we do not need to minus amount + svcharge
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
}
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
$booking = new Booking();
$booking->account_name = $request->input('account_name');
$booking->account_num = $request->input('account_num');
@@ -753,14 +755,14 @@ class BookingController extends Controller
$taxAmount = 0;
}
if ($billingChargeRate !=0){
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate - ($amount + $svcharge), 2);
}
else{
if ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba'){
$billingChargeAmount = 0;
}
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
}
else{
// TODO : billing charge rate to percentage so we do not need to minus amount + svcharge
$billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2);
}
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
return response()->json([