mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
removed vee-validate which causes cief bank details not showing in user upload bank slip
added exception if userbankslip not save show error added tax rate to supplier booking added order number and payment for to booking seeder
This commit is contained in:
@@ -417,19 +417,26 @@ class BookingController extends Controller
|
||||
'user_bankslip', $bankslip_file, $unique_image_path
|
||||
);
|
||||
|
||||
$user_bankslip = $booking->userBankSlip()->first();
|
||||
if($upload_path){
|
||||
$user_bankslip = $booking->userBankSlip()->first();
|
||||
|
||||
// if user bankslip not exist, create new one
|
||||
if(!$user_bankslip){
|
||||
$user_bankslip = new UserBankSlip;
|
||||
// if user bankslip not exist, create new one
|
||||
if(!$user_bankslip){
|
||||
$user_bankslip = new UserBankSlip;
|
||||
}
|
||||
$user_bankslip->booking_id = $booking->id;
|
||||
$user_bankslip->bankslip_path = $upload_path;
|
||||
$user_bankslip->transfer_amount = $request->input('transfer_amount');
|
||||
$user_bankslip->save();
|
||||
|
||||
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
else{
|
||||
return response()->json(['message' => 'File not uploaded. Please contact support'], 400);
|
||||
}
|
||||
$user_bankslip->booking_id = $booking->id;
|
||||
$user_bankslip->bankslip_path = $upload_path;
|
||||
$user_bankslip->transfer_amount = $request->input('transfer_amount');
|
||||
$user_bankslip->save();
|
||||
|
||||
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
else {
|
||||
return response()->json(['message' => 'No file detected'], 400);
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\UserBankSlip;
|
||||
use App\SettingBeneficiary;
|
||||
use App\SupplierBookingItem;
|
||||
use App\SettingSupplier;
|
||||
use App\SettingTaxRate;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookingSupplierController extends Controller
|
||||
@@ -30,15 +31,53 @@ class BookingSupplierController extends Controller
|
||||
public function show($id)
|
||||
{
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$tax_rate = SettingTaxRate::latest()->first()->tax_rate;
|
||||
$bankin_amount = round($booking->amount / $booking->rate, 2);
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['message' => 'Booking not found'], 404);
|
||||
}
|
||||
|
||||
switch ($booking->term) {
|
||||
case "x1_cash":
|
||||
$payment_method = "CASH";
|
||||
break;
|
||||
case "x1_cheque":
|
||||
|
||||
$payment_method = "CHEQUE";
|
||||
break;
|
||||
case "x1_ba":
|
||||
|
||||
$payment_method = "BA";
|
||||
break;
|
||||
case "x2_cash":
|
||||
|
||||
$payment_method = "CASH";
|
||||
break;
|
||||
case "x2_cheque":
|
||||
$payment_method = "CHEQUE";
|
||||
break;
|
||||
case "x2_ba":
|
||||
$payment_method = "BA";
|
||||
break;
|
||||
default:
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Invalid input',
|
||||
], 422);
|
||||
break;
|
||||
}
|
||||
|
||||
$supplier_booking = $booking->supplierBooking()->first();
|
||||
$dt = new \DateTime($supplier_booking->created_at);
|
||||
$supplier_booking->date = $dt->format('j F Y');
|
||||
$supplier_booking->marking = $booking->user->marking;
|
||||
$supplier_booking->payment_for = $booking->payment_for;
|
||||
$supplier_booking->order_no = $booking->order_no;
|
||||
$supplier_booking->payment_method = $payment_method;
|
||||
$supplier_booking->tax_rate = $tax_rate;
|
||||
$supplier_booking->rate = $booking->rate;
|
||||
$supplier_booking->bankin_amount = $bankin_amount;
|
||||
|
||||
|
||||
return response()->json($supplier_booking ,200);
|
||||
@@ -57,10 +96,10 @@ class BookingSupplierController extends Controller
|
||||
// Calculation
|
||||
$amountInRMB = $transfer_amount * $rate;
|
||||
$billing = 0.015 * $transfer_amount;
|
||||
$sales_tax = 0.10 * $transfer_amount;
|
||||
$sales_tax = 0.0 * $transfer_amount;
|
||||
$gst = 0 * $transfer_amount; // do we still need this ?
|
||||
$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
|
||||
$rmbBankAmount = $customerBankInAmount + $rebate;
|
||||
$rmbBankAmount = round($customerBankInAmount + $rebate, 2);
|
||||
|
||||
$user = Auth::user();
|
||||
$supplier = SettingSupplier::find($supplier_id);
|
||||
@@ -90,6 +129,8 @@ class BookingSupplierController extends Controller
|
||||
$booking->status = 4;
|
||||
$booking->admin_status = 4;
|
||||
$booking->save();
|
||||
|
||||
|
||||
|
||||
return response()->json($bookingsupplier, 201);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ class BookTableSeeder extends Seeder
|
||||
'user_id' => $user->id,
|
||||
'status' => 2,
|
||||
'admin_status' => 2,
|
||||
'order_no' => '001',
|
||||
'payment_for' => 'FULL PAYMENT',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"npm": "^6.0.1",
|
||||
"popper.js": "^1.14.1",
|
||||
"sweetalert2": "^7.15.1",
|
||||
"vee-validate": "^2.1.0-beta.5",
|
||||
"vform": "^1.0.0",
|
||||
"vue": "^2.5.16",
|
||||
"vue-axios": "^2.1.1",
|
||||
|
||||
@@ -10,7 +10,6 @@ import locale from 'element-ui/lib/locale/lang/en'
|
||||
import '~/plugins'
|
||||
import '~/components'
|
||||
|
||||
import VeeValidate from 'vee-validate';
|
||||
const config = {
|
||||
errorBagName: 'errors', // change if property conflicts.
|
||||
fieldsBagName: 'fields',
|
||||
@@ -29,7 +28,6 @@ const config = {
|
||||
events: 'blur',
|
||||
inject: true
|
||||
};
|
||||
Vue.use(VeeValidate, config);
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@
|
||||
ctx.textAlign = "right";
|
||||
//// Row 1
|
||||
ctx.fillText("Ref No. :", column1X, rowHeight[1] - 5);
|
||||
ctx.fillText(binding.value.id, column3X, rowHeight[1] - 5);
|
||||
ctx.fillText(binding.value.booking_id, column3X, rowHeight[1] - 5);
|
||||
//// Row 2
|
||||
ctx.fillText("Date :", column1X, rowHeight[2] - 5);
|
||||
ctx.fillText(binding.value.date, column3X, rowHeight[2] - 5);
|
||||
@@ -465,10 +465,10 @@
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 4
|
||||
ctx.fillText("Payment For(Order No.) :", column1X, rowHeight[4] - 5);
|
||||
ctx.fillText(binding.value.id, column3X, rowHeight[4] - 5);
|
||||
ctx.fillText(binding.value.order_no, column3X, rowHeight[4] - 5);
|
||||
//// Row 4
|
||||
ctx.fillText("Payment For :", column1X, rowHeight[5] - 5);
|
||||
ctx.fillText("Full Payment", column3X, rowHeight[5] - 5);
|
||||
ctx.fillText(binding.value.payment_for, column3X, rowHeight[5] - 5);
|
||||
//// Row 5
|
||||
ctx.fillText("Payment Method :", column1X, rowHeight[6] - 5);
|
||||
ctx.fillText(binding.value.payment_method, column3X, rowHeight[6] - 5);
|
||||
@@ -506,19 +506,20 @@
|
||||
//// Row 11
|
||||
ctx.fillText("MYR/RM :", column1X, rowHeight[14] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[14] - 5);
|
||||
ctx.fillText("4830.68", column3X, rowHeight[14] - 5);
|
||||
ctx.fillText(binding.value.bankin_amount, column3X, rowHeight[14] - 5);
|
||||
//// Row 12
|
||||
ctx.fillText("Billing(1.0%) :", column1X, rowHeight[15] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[15] - 5);
|
||||
ctx.fillText(binding.value.billing_amount, column3X, rowHeight[15] - 5);
|
||||
// ctx.fillText("Billing(1.0%) :", column1X, rowHeight[15] - 5);
|
||||
// ctx.fillText("MYR", column2X, rowHeight[15] - 5);
|
||||
// ctx.fillText(binding.value.billing_amount, column3X, rowHeight[15] - 5);
|
||||
//// Row 13
|
||||
ctx.fillText("+ SALES TAX (10%) :", column1X, rowHeight[16] - 5);
|
||||
|
||||
ctx.fillText("+ TAX "+ binding.value.tax_rate + ":", column1X, rowHeight[16] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[16] - 5);
|
||||
ctx.fillText(binding.value.salestax_amount, column3X, rowHeight[16] - 5);
|
||||
//// Row 14
|
||||
ctx.fillText("+ GST 6% :", column1X, rowHeight[17] - 15);
|
||||
ctx.fillText("MYR", column2X, rowHeight[17] - 15);
|
||||
ctx.fillText("289.84", column3X, rowHeight[17] - 15);
|
||||
// //// Row 14
|
||||
// ctx.fillText("+ GST 6% :", column1X, rowHeight[17] - 15);
|
||||
// ctx.fillText("MYR", column2X, rowHeight[17] - 15);
|
||||
// ctx.fillText("289.84", column3X, rowHeight[17] - 15);
|
||||
//// Row 15
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("Customer Bank In Amount :", column1X, rowHeight[18] - 5);
|
||||
|
||||
@@ -83,8 +83,6 @@ import Form from 'vform'
|
||||
import LoginWithGithub from '~/components/LoginWithGithub'
|
||||
import store from '~/store'
|
||||
import Vue from 'vue'
|
||||
import VeeValidate from 'vee-validate';
|
||||
Vue.use(VeeValidate);
|
||||
|
||||
export default {
|
||||
middleware: 'guest',
|
||||
|
||||
@@ -224,7 +224,7 @@ export default {
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
message: 'Fetch bank details fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user