change billingcharge rate and tax rate table to double. Modify Customer calculation table

This commit is contained in:
weiweitoo
2018-07-20 21:16:36 +08:00
parent 73c36dd8e3
commit 21c13d3e60
5 changed files with 261 additions and 223 deletions
+14 -4
View File
@@ -11,6 +11,8 @@ use App\UserBankSlip;
use App\User;
use App\Invoice;
use App\SettingCredit;
use App\SettingTaxRate;
use App\SettingBillingCharge;
use Auth;
use Validator;
use DateTime;
@@ -545,6 +547,8 @@ class BookingController extends Controller
$china_beneficiary = $request->input('china_beneficiary');
$rates = Rate::orderby('updated_at','desc')->first();
$marking = $user = Auth::user()->marking;
$taxrate = SettingTaxRate::latest()->first()->tax_rate;
$billingChargeRate = SettingBillingCharge::latest()->first()->billing_charge_rate;
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
@@ -595,18 +599,24 @@ class BookingController extends Controller
} else {
$svcharge = 20.00;
}
$bankin_amount = round(($amount + $svcharge) / $rate + (0 * ($amount + $svcharge)), 2);
$subtotal = ($amount + $svcharge) / $rate + (0 * ($amount + $svcharge));
$taxAmount = round($subtotal * $taxrate,2);
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate, 2);
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
return response()->json([
'date' => date('Y-m-d'),
'marking' => $marking,
'amount' => $amount,
'payment_method' => $payment_method,
'china_beneficary' => $china_beneficiary,
'amount' => $amount,
'service_charge' => $svcharge,
'rate' => $rate,
'subtotal' => $subtotal,
'taxAmount' => $taxAmount,
'billingChargeAmount' => $billingChargeAmount,
'bankin_amount' => $bankin_amount,
'china_beneficary' => $china_beneficiary
], 200);
}