From 21c13d3e6050679d2002c435b7c2975390b471de Mon Sep 17 00:00:00 2001 From: weiweitoo Date: Fri, 20 Jul 2018 21:16:36 +0800 Subject: [PATCH] change billingcharge rate and tax rate table to double. Modify Customer calculation table --- app/Http/Controllers/BookingController.php | 18 +- ...48_create_setting_billing_charge_table.php | 2 +- ...0_183325_create_setting_tax_rate_table.php | 2 +- resources/assets/js/pages/home.vue | 460 ++++++++++-------- .../js/pages/settings/admin-tax-setting.vue | 2 +- 5 files changed, 261 insertions(+), 223 deletions(-) diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index cce0fcb8..aa1fdfd7 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -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); } diff --git a/database/migrations/2018_07_20_172148_create_setting_billing_charge_table.php b/database/migrations/2018_07_20_172148_create_setting_billing_charge_table.php index 92b78a0a..e3f38dd1 100644 --- a/database/migrations/2018_07_20_172148_create_setting_billing_charge_table.php +++ b/database/migrations/2018_07_20_172148_create_setting_billing_charge_table.php @@ -15,7 +15,7 @@ class CreateSettingBillingChargeTable extends Migration { Schema::create('setting_billing_charges', function (Blueprint $table) { $table->increments('id'); - $table->double('billing_charge_rate',8,2); + $table->double('billing_charge_rate'); $table->timestamps(); }); } diff --git a/database/migrations/2018_07_20_183325_create_setting_tax_rate_table.php b/database/migrations/2018_07_20_183325_create_setting_tax_rate_table.php index e1ffd6ff..0743eb7b 100644 --- a/database/migrations/2018_07_20_183325_create_setting_tax_rate_table.php +++ b/database/migrations/2018_07_20_183325_create_setting_tax_rate_table.php @@ -15,7 +15,7 @@ class CreateSettingTaxRateTable extends Migration { Schema::create('setting_tax_rates', function (Blueprint $table) { $table->increments('id'); - $table->double('tax_rate',8,2); + $table->double('tax_rate'); $table->timestamps(); }); } diff --git a/resources/assets/js/pages/home.vue b/resources/assets/js/pages/home.vue index 46a63bea..cee8a4ae 100644 --- a/resources/assets/js/pages/home.vue +++ b/resources/assets/js/pages/home.vue @@ -2,25 +2,25 @@ - - -
- I need : - - - - -
-
-
-
- - -
- -
-
-
+ + +
+ I need : + + + + +
+
+
+
+ + +
+ +
+
+
@@ -28,210 +28,241 @@
-
- - -
- - -
- - -
Cash/Bank Transfer
-
- -
Cheque
-
- -
BA
-
- +
+ + +
+ + +
+ + +
Cash/Bank Transfer
+
+ +
Cheque
+
+ +
BA
+
+ - - - -
- + + + +
+ +
+
+
+ + +
X1 :
+
+ +
{{ rate.x1_cash }}
+
+ +
{{ rate.x1_cheque }}
+
+ +
{{ rate.x1_ba }}
+
+
+ + + +
+ + +
+ + +
+ Book
- -
- - -
X1 :
-
- -
{{ rate.x1_cash }}
-
- -
{{ rate.x1_cheque }}
-
- -
{{ rate.x1_ba }}
-
- - - - -
- - -
- - -
- Book -
-
- -
- Book -
-
- -
- Book -
-
- - -
- - - -
- + + +
+ Book
- -
- -
X2 :
-
- -
{{ rate.x2_cash }}
-
- -
{{ rate.x2_cheque }}
-
- -
{{ rate.x2_ba }}
-
- + + +
+ Book +
+
+ - - -
- - -
- - -
- Book -
-
- -
- Book -
-
- -
- Book -
-
- +
+ + + +
+ +
+
+
+ +
X2 :
+
+ +
{{ rate.x2_cash }}
+
+ +
{{ rate.x2_cheque }}
+
+ +
{{ rate.x2_ba }}
+
+
+ + + +
+ + +
+ + +
+ Book +
+
+ +
+ Book +
+
+ +
+ Book +
+
+ - - -
- - - - - - - - - - - - - - Cancel + + +
+ + + + + + + + + + + + + + Cancel - Book Now - -
-
-
+ Book Now +
+
+
+
- + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Date :    {{ bookingConfirmTable.date }}
Customer Marking :    {{ bookingConfirmTable.marking }}
Payment Method :    {{ bookingConfirmTable.payment_method }}
CNY/RMB :    {{ bookingConfirmTable.amount }}
+ Service Charge :    RMB {{ bookingConfirmTable.service_charge }}
RATE :   {{ bookingConfirmTable.rate }}
-    RM {{ bookingConfirmTable.bankin_amount }}
- -
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date :    {{ bookingConfirmTable.date }}
Marking :    {{ bookingConfirmTable.marking }}
Payment For :    {{ bookingConfirmTable.payment_for }}
Payment Method :    {{ bookingConfirmTable.payment_method }}
Remark :    {{ bookingConfirmTable.remark }}
CNY/RMB :RMB   {{ bookingConfirmTable.amount }}
+ Service Charge :RMB   {{ bookingConfirmTable.service_charge }}
/ RATE :   {{ bookingConfirmTable.rate }}
Subtotal : MYR{{ bookingConfirmTable.subtotal}}
+ Tax : MYR   {{ bookingConfirmTable.rate }}
+ Billing Charge : MYR   {{ bookingConfirmTable.billingChargeAmount }}
Bank in Amount :MYR RM {{ bookingConfirmTable.bankin_amount }}
- - China Beneficiary Acc : -    {{ bookingConfirmTable.account_name }} - - - Bank in Amount : -    - RM {{ bookingConfirmTable.bankin_amount }} - - - - + + + + + + + + + + + +
Beneficiary Account :    {{bookingForm.account_name}}
Beneficiary Account Number :    {{bookingForm.account_num}}
- - - Confirm - -
+ + + Confirm + +

@@ -489,16 +520,13 @@ export default { .then((response) => { this.loading = false console.log(response) - this.bookingConfirmTable.date = response.data.date - this.bookingConfirmTable.marking = response.data.marking - this.bookingConfirmTable.payment_method = response.data.payment_method - this.bookingConfirmTable.amount = response.data.amount - this.bookingConfirmTable.service_charge = response.data.service_charge - this.bookingConfirmTable.rate = response.data.rate - this.bookingConfirmTable.bankin_amount = response.data.bankin_amount - this.bookingConfirmTable.account_name = this.bookingForm.account_name + this.bookingConfirmTable = response.data; + this.bookingConfirmTable.payment_for = 'Full Payment';//For future purpose? + this.bookingConfirmTable.remark = '';//For future purpose? this.dialogFormVisible = false this.dialogFormVisible1 = true + console.log(this.bookingConfirmTable); + console.log(this.bookingForm); }) .catch((error) => { this.$message({ diff --git a/resources/assets/js/pages/settings/admin-tax-setting.vue b/resources/assets/js/pages/settings/admin-tax-setting.vue index 726c7793..b26c8636 100644 --- a/resources/assets/js/pages/settings/admin-tax-setting.vue +++ b/resources/assets/js/pages/settings/admin-tax-setting.vue @@ -7,7 +7,7 @@ Tax : - + % Update