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);
}
@@ -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();
});
}
@@ -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();
});
}
+244 -216
View File
@@ -2,25 +2,25 @@
<el-main>
<!-- Input-Amount -->
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col :span="20">
<div class="grid-content bg-purple" align="center">
I need :
<el-select v-model="value" placeholder="RMB">
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
<!-- <el-option v-for="item in options2" :key="item.value2" :label="item.label2" :value="item.value2" /> -->
</el-select>
</div>
</el-col>
</el-row>
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col :xs="18" :sm="18" :md="8" :lg="8" :xl="8">
<div class="grid-content bg-purple" align="left">
<el-input v-model="booking.amount" placeholder="Amount" />
</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col :span="20">
<div class="grid-content bg-purple" align="center">
I need :
<el-select v-model="value" placeholder="RMB">
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
<!-- <el-option v-for="item in options2" :key="item.value2" :label="item.label2" :value="item.value2" /> -->
</el-select>
</div>
</el-col>
</el-row>
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col :xs="18" :sm="18" :md="8" :lg="8" :xl="8">
<div class="grid-content bg-purple" align="left">
<el-input v-model="booking.amount" placeholder="Amount" />
</div>
</el-col>
</el-row>
<!-- Input-Amount-end -->
<div align="right">
@@ -28,210 +28,241 @@
<hr>
<!-- Rate-Display -->
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" align="right" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="left" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">Cash/Bank Transfer</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">Cheque</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">BA</div>
</el-col>
</el-row>
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" align="right" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="left" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">Cash/Bank Transfer</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">Cheque</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">BA</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<el-tooltip class="item" effect="dark" content="Payment to China Supplier" placement="left">
<div class="grid-content bg-purple" align="right">
<i type="button" class="el-icon-question" circle/>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<el-tooltip class="item" effect="dark" content="Payment to China Supplier" placement="left">
<div class="grid-content bg-purple" align="right">
<i type="button" class="el-icon-question" circle/>
</div>
</el-tooltip>
</el-col>
<!-- <el-col><div class="grid-content bg-purple" align="right"><i type="button" class="el-icon-question" circle/></div></el-col> -->
<el-col>
<div class="grid-content bg-purple" align="left">X1 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_ba }}</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_cash')">Book</el-button>
</div>
</el-tooltip>
</el-col>
<!-- <el-col><div class="grid-content bg-purple" align="right"><i type="button" class="el-icon-question" circle/></div></el-col> -->
<el-col>
<div class="grid-content bg-purple" align="left">X1 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x1_ba }}</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_cash')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_cheque')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_ba')">Book</el-button>
</div>
</el-col>
</el-row>
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<el-tooltip class="item" effect="dark" content="Payment to China Supplier Only" placement="left">
<div class="grid-content bg-purple" align="right">
<i type="button" class="el-icon-question" circle/>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_cheque')">Book</el-button>
</div>
</el-tooltip>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="left">X2 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_ba }}</div>
</el-col>
</el-row>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x1_ba')">Book</el-button>
</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_cash')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_cheque')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_ba')">Book</el-button>
</div>
</el-col>
</el-row>
<br>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<el-tooltip class="item" effect="dark" content="Payment to China Supplier Only" placement="left">
<div class="grid-content bg-purple" align="right">
<i type="button" class="el-icon-question" circle/>
</div>
</el-tooltip>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="left">X2 :</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cash }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_cheque }}</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">{{ rate.x2_ba }}</div>
</el-col>
</el-row>
<el-row :gutter="20" type="flex" justify="center" align="middle">
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" />
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_cash')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_cheque')">Book</el-button>
</div>
</el-col>
<el-col>
<div class="grid-content bg-purple" align="center">
<el-button type="text" @click="acceptTerm('x2_ba')">Book</el-button>
</div>
</el-col>
</el-row>
<!-- Rate-Display-end -->
<!-- Form_popup -->
<el-dialog :visible.sync="dialogFormVisible" :fullscreen="true" title="Booking" center>
<el-form ref="bookingForm" :model="bookingForm" :rules="rules">
<div align="center">
<el-form-item prop="account_name">
<el-input v-model="bookingForm.account_name" placeholder="China Beneficiary Account" style="width: 80%" required="true" />
</el-form-item>
<el-form-item prop="bank_name">
<el-input v-model="bookingForm.bank_name" type="text" placeholder="Bank Name / AliPay / WechatPay" style="width: 80%" />
</el-form-item>
<el-form-item prop="bank_branch">
<el-input v-model="bookingForm.bank_branch" type="text" placeholder="Branch / 分行/支行" style="width: 80%" />
</el-form-item>
<el-form-item prop="account_num">
<el-input v-model="bookingForm.account_num" type="text" placeholder="Account Number / AliPay_ID / WechatPay_ID" style="width: 80%"
/>
</el-form-item>
<el-form-item>
<el-button @click="dialogFormVisible = false">Cancel</el-button>
<el-dialog :visible.sync="dialogFormVisible" :fullscreen="true" title="Booking" center>
<el-form ref="bookingForm" :model="bookingForm" :rules="rules">
<div align="center">
<el-form-item prop="account_name">
<el-input v-model="bookingForm.account_name" placeholder="China Beneficiary Account" style="width: 80%" required="true" />
</el-form-item>
<el-form-item prop="bank_name">
<el-input v-model="bookingForm.bank_name" type="text" placeholder="Bank Name / AliPay / WechatPay" style="width: 80%" />
</el-form-item>
<el-form-item prop="bank_branch">
<el-input v-model="bookingForm.bank_branch" type="text" placeholder="Branch / 分行/支行" style="width: 80%" />
</el-form-item>
<el-form-item prop="account_num">
<el-input v-model="bookingForm.account_num" type="text" placeholder="Account Number / AliPay_ID / WechatPay_ID" style="width: 80%"
/>
</el-form-item>
<el-form-item>
<el-button @click="dialogFormVisible = false">Cancel</el-button>
<el-button :loading="loading" type="primary" @click="getCalculationValue('bookingForm')">Book Now</el-button>
</el-form-item>
</div>
</el-form>
</el-dialog>
<el-button :loading="loading" type="primary" @click="getCalculationValue('bookingForm')">Book Now</el-button>
</el-form-item>
</div>
</el-form>
</el-dialog>
<!-- Form_popup-end -->
<!-- Booking_confirmation_popup -->
<el-dialog :visible.sync="dialogFormVisible1" :fullscreen="true" title="Booking Confirmation" center>
<el-dialog :visible.sync="dialogFormVisible1" :fullscreen="true" title="Booking Confirmation" center>
<!-- Table_booking_confirmation -->
<!-- <el-table :data="bookingConfirmTable" align="center">
<el-table-column prop="data1" align="right" width="200" />
<el-table-column prop="data2" align="left" width="200" />
</el-table> -->
<!-- Table_booking_confirmation-end -->
<!-- Table_booking_confirmation -->
<!-- <el-table :data="bookingConfirmTable" align="center">
<el-table-column prop="data1" align="right" width="200" />
<el-table-column prop="data2" align="left" width="200" />
</el-table> -->
<!-- Table_booking_confirmation-end -->
<table class="table-responsive el-table" style="display:table; width:80%; margin: 0 auto;">
<tbody>
<tr>
<td class="el-table_2_column_9 is-right ">Date : </td>
<td class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.date }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Customer Marking : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.marking }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Payment Method : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.payment_method }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">CNY/RMB : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.amount }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">+ Service Charge : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; RMB {{ bookingConfirmTable.service_charge }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "> RATE :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.rate }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "/>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; RM {{ bookingConfirmTable.bankin_amount }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "/>
<td width="200" class="el-table_2_column_9 is-left "/>
</tr>
<table class="table-responsive el-table" style="display:table; width:80%; margin: 0 auto;">
<div class="el-col el-col-12" style="padding-left: 6px; padding-right: 6px;">
<tbody>
<tr>
<td class="el-table_2_column_9 is-right ">Date : </td>
<td class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.date }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Marking : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.marking }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Payment For : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.payment_for }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Payment Method : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.payment_method }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Remark : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.remark }}</td>
</tr>
</tbody>
</div>
<div class="el-col el-col-12" style="padding-left: 6px; padding-right: 6px;">
<tbody>
<tr>
<td class="el-table_2_column_9 is-right ">CNY/RMB :</td>
<td class="el-table_2_column_9 is-center">RMB</td>
<td class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.amount }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">+ Service Charge :</td>
<td width="200" class="el-table_2_column_9 is-center">RMB</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.service_charge }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">/ RATE :</td>
<td width="200" class="el-table_2_column_9 is-center"></td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.rate }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Subtotal : </td>
<td width="200" class="el-table_2_column_9 is-center">MYR</td>
<td width="200" class="el-table_2_column_9 is-left "><b>{{ bookingConfirmTable.subtotal}} </b></td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">+ Tax : </td>
<td width="200" class="el-table_2_column_9 is-center">MYR</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.rate }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">+ Billing Charge : </td>
<td width="200" class="el-table_2_column_9 is-center">MYR</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.billingChargeAmount }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Bank in Amount :</td>
<td width="200" class="el-table_2_column_9 is-center">MYR</td>
<td width="200" class="el-table_2_column_9 is-left "><b> RM {{ bookingConfirmTable.bankin_amount }}</b></td>
</tr>
</tbody>
</div>
</table>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">China Beneficiary Acc :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{ bookingConfirmTable.account_name }}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Bank in Amount :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;
<b> RM {{ bookingConfirmTable.bankin_amount }}</b>
</td>
</tr>
</tbody>
</table>
<table class="table-responsive el-table" style="display:table; width:80%; margin: 0 auto;">
<tbody>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Beneficiary Account : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{bookingForm.account_name}}</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Beneficiary Account Number : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; {{bookingForm.account_num}}</td>
</tr>
</tbody>
</table>
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormVisible = false">Cancel</el-button> -->
<el-button :loading="loading" type="primary" @click="createBooking">Confirm</el-button>
</span>
</el-dialog>
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormVisible = false">Cancel</el-button> -->
<el-button :loading="loading" type="primary" @click="createBooking">Confirm</el-button>
</span>
</el-dialog>
<!-- Booking_confirmation_popup -->
<br>
@@ -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({
@@ -7,7 +7,7 @@
<el-form>
<el-form-item align="center">
Tax :
<el-input size="mini" v-model="tax_setting.tax_rate" style=width:20%></el-input>
<el-input size="mini" v-model="tax_setting.tax_rate" style=width:20%></el-input> %
</el-form-item>
<el-form-item align="center">
<el-button type="primary" align="center" :loading="loading_btn" size="primary" @click="updateTaxSetting">Update</el-button>