mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
APP_NAME=IZYIM
|
||||
APP_ENV=production
|
||||
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=default
|
||||
DB_USERNAME=default
|
||||
DB_PASSWORD=secret
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
APP_NAME=exchange
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=default
|
||||
DB_USERNAME=default
|
||||
DB_PASSWORD=secret
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
|
||||
@@ -325,6 +325,8 @@ class BookingController extends Controller
|
||||
$booking->bank_name = $request->input('bank_name');
|
||||
$booking->bank_branch = $request->input('bank_branch');
|
||||
$booking->amount = $request->input('amount');
|
||||
$booking->order_no = $request->input('order_no');
|
||||
$booking->payment_for = $request->input('payment_for');
|
||||
$booking->term = $term;
|
||||
$booking->rate_id = $rates->id;
|
||||
$booking->rate = $rate;
|
||||
@@ -422,19 +424,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);
|
||||
@@ -559,6 +568,8 @@ class BookingController extends Controller
|
||||
$amount = $request->input('amount');
|
||||
$term = $request->input('term');
|
||||
$china_beneficiary = $request->input('china_beneficiary');
|
||||
$order_no = $request->input('order_no');
|
||||
$payment_for = $request->input('payment_for');
|
||||
$rates = Rate::orderby('updated_at','desc')->first();
|
||||
$marking = $user = Auth::user()->marking;
|
||||
$taxrate = SettingTaxRate::latest()->first()->tax_rate;
|
||||
@@ -577,11 +588,11 @@ class BookingController extends Controller
|
||||
switch ($term) {
|
||||
case "x1_cash":
|
||||
$rate = $rates->x1_cash;
|
||||
$payment_method = "cash";
|
||||
$payment_method = "CASH";
|
||||
break;
|
||||
case "x1_cheque":
|
||||
$rate = $rates->x1_cheque;
|
||||
$payment_method = "Cheque";
|
||||
$payment_method = "CHEQUE";
|
||||
break;
|
||||
case "x1_ba":
|
||||
$rate = $rates->x1_ba;
|
||||
@@ -589,11 +600,11 @@ class BookingController extends Controller
|
||||
break;
|
||||
case "x2_cash":
|
||||
$rate = $rates->x2_cash;
|
||||
$payment_method = "Cash";
|
||||
$payment_method = "CASH";
|
||||
break;
|
||||
case "x2_cheque":
|
||||
$rate = $rates->x2_cheque;
|
||||
$payment_method = "Cheque";
|
||||
$payment_method = "CHEQUE";
|
||||
break;
|
||||
case "x2_ba":
|
||||
$rate = $rates->x2_ba;
|
||||
@@ -635,6 +646,8 @@ class BookingController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'date' => date('Y-m-d'),
|
||||
'order_no' => $order_no,
|
||||
'payment_for' => $payment_for,
|
||||
'marking' => $marking,
|
||||
'payment_method' => $payment_method,
|
||||
'china_beneficary' => $china_beneficiary,
|
||||
@@ -845,23 +858,23 @@ class BookingController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// public function adminShowCompletedOrders()
|
||||
// {
|
||||
// $bookings = Booking::select('id','created_at','user_id','rate','amount', 'bia', 'admin_status')
|
||||
// ->where('admin_status', 7)
|
||||
// ->orderBy('id', 'desc')
|
||||
// ->get();
|
||||
public function adminShowCompletedOrders()
|
||||
{
|
||||
$bookings = Booking::select('id','created_at','user_id','rate','amount', 'bia', 'admin_status')
|
||||
->where('admin_status', 7)
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
|
||||
// foreach ($bookings as $booking) {
|
||||
// $booking->id;
|
||||
// $booking->created_at;
|
||||
// $booking->marking = $booking->user->marking;
|
||||
// $booking->rate;
|
||||
// $booking->amount;
|
||||
// $booking->bia;
|
||||
// $booking->admin_status = "(". $booking->admin_status ."/7)";;
|
||||
// }
|
||||
// return $bookings;
|
||||
// }
|
||||
foreach ($bookings as $booking) {
|
||||
$booking->id;
|
||||
$booking->created_at;
|
||||
$booking->marking = $booking->user->marking;
|
||||
$booking->rate;
|
||||
$booking->amount;
|
||||
$booking->bia;
|
||||
$booking->admin_status = "(". $booking->admin_status ."/7)";;
|
||||
}
|
||||
return $bookings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ use App\UserBankSlip;
|
||||
use App\SettingBeneficiary;
|
||||
use App\SupplierBookingItem;
|
||||
use App\SettingSupplier;
|
||||
use App\SettingTaxRate;
|
||||
use App\SettingActiveBank;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookingSupplierController extends Controller
|
||||
@@ -30,15 +32,66 @@ class BookingSupplierController extends Controller
|
||||
public function show($id)
|
||||
{
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$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;
|
||||
|
||||
$active_bank = SettingActiveBank::first();
|
||||
|
||||
// if setting is set to use customer's beneficiary
|
||||
if ($active_bank->beneficiary_id == 0){
|
||||
$supplier_booking->acc_name = $booking->account_name;
|
||||
$supplier_booking->acc_no = $booking->account_num; // TODO : standardize acc_no
|
||||
$supplier_booking->bank_name = $booking->bank_name;
|
||||
}
|
||||
|
||||
else{
|
||||
$beneficiary = SettingBeneficiary::find($active_bank->beneficiary_id);
|
||||
$supplier_booking->acc_name = $beneficiary->company_name;
|
||||
$supplier_booking->acc_no = $beneficiary->acc_no;
|
||||
$supplier_booking->bank_name = $beneficiary->bank_name;
|
||||
}
|
||||
|
||||
return response()->json($supplier_booking ,200);
|
||||
}
|
||||
@@ -47,41 +100,59 @@ class BookingSupplierController extends Controller
|
||||
// TODO : Multiple booking
|
||||
public function store(Request $request)
|
||||
{
|
||||
$transfer_amount = $request->input("transfer_amount");
|
||||
//$transfer_amount = $request->input("transfer_amount");
|
||||
$supplier_id = $request->input("supplier_id");
|
||||
$booking_id = $request->input("booking_id");
|
||||
$rate = $request->input('rate');
|
||||
//$rate = $request->input('rate');
|
||||
$rebate = $request->input('rebate');
|
||||
|
||||
// Calculation
|
||||
$amountInRMB = $transfer_amount * $rate;
|
||||
$billing = 0.015 * $transfer_amount;
|
||||
$sales_tax = 0.10 * $transfer_amount;
|
||||
$gst = 0 * $transfer_amount; // do we still need this ?
|
||||
$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
|
||||
$rmbBankAmount = $customerBankInAmount + $rebate;
|
||||
|
||||
$user = Auth::user();
|
||||
$supplier = SettingSupplier::find($supplier_id);
|
||||
$booking = Booking::find($booking_id);
|
||||
|
||||
|
||||
|
||||
// Calculation (backup)
|
||||
// $amountInRMB = $transfer_amount * $rate;
|
||||
// $billing = 0.015 * $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 = round($customerBankInAmount + $rebate, 2);
|
||||
|
||||
// Update: changes in 1.1 according to new supplier booking report
|
||||
$transfer_amount = $booking->amount;
|
||||
$rate = $booking->rate;
|
||||
|
||||
$amount_in_myr = round($transfer_amount / $rate, 2);
|
||||
$amountInRMB = $transfer_amount;
|
||||
$tax_rate = SettingTaxRate::latest()->first()->tax_rate;
|
||||
$sales_tax = round($tax_rate * $amount_in_myr - $amount_in_myr, 2);
|
||||
$amount_after_tax = round($amount_in_myr * $tax_rate,2);
|
||||
//$billing = 0.015 * $transfer_amount;
|
||||
//
|
||||
//$gst = 0 * $transfer_amount; // do we still need this ?
|
||||
//$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
|
||||
//$rmbBankAmount = round($customerBankInAmount + $rebate, 2);
|
||||
|
||||
// update existing booking supplier if exist
|
||||
$bookingsupplier = SupplierBooking::where('booking_id', $booking_id)->first();
|
||||
|
||||
if (!$bookingsupplier){
|
||||
$bookingsupplier = new SupplierBooking();
|
||||
|
||||
}
|
||||
|
||||
$bookingsupplier->supplier_id = $supplier->id;
|
||||
$bookingsupplier->payment_method = $request->input('payment_method');
|
||||
$bookingsupplier->transfer_amount = $transfer_amount;
|
||||
$bookingsupplier->amountInRMB = $amountInRMB; // TODO : rename to underscore
|
||||
$bookingsupplier->amount_in_myr = $amount_in_myr;
|
||||
$bookingsupplier->tax_rate = $tax_rate;
|
||||
$bookingsupplier->amount_after_tax = $amount_after_tax;
|
||||
$bookingsupplier->rate = $rate;
|
||||
$bookingsupplier->billing_amount = $billing;
|
||||
$bookingsupplier->salestax_amount = $sales_tax;
|
||||
$bookingsupplier->rebate = $rebate;
|
||||
$bookingsupplier->amountInRMB = $amountInRMB;
|
||||
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
|
||||
$bookingsupplier->rebate = $rebate;
|
||||
$bookingsupplier->salestax_amount = $sales_tax;
|
||||
//$bookingsupplier->payment_method = $request->input('payment_method'); // TODO : remove from db
|
||||
//$bookingsupplier->transfer_amount = $transfer_amount; // TODO : remove from db
|
||||
//$bookingsupplier->billing_amount = $billing; // TODO : remove from db
|
||||
|
||||
//$bookingsupplier->rmbBankAmount = $rmbBankAmount; // TODO : remove from db
|
||||
$bookingsupplier->booking_id = $booking->id;
|
||||
$bookingsupplier->save();
|
||||
|
||||
@@ -89,47 +160,12 @@ class BookingSupplierController extends Controller
|
||||
$booking->status = 4;
|
||||
$booking->admin_status = 4;
|
||||
$booking->save();
|
||||
|
||||
|
||||
|
||||
return response()->json($bookingsupplier, 201);
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$bookingsupplier = SupplierBooking::find($id);
|
||||
$bookingsupplier->payment_method = $request->input('payment_method');
|
||||
$bookingsupplier->transfer_amount = $request->input('transfer_amount');
|
||||
$bookingsupplier->rate = $request->input('rate');
|
||||
$bookingsupplier->rebate = $request->input('rebate');
|
||||
// calculation
|
||||
$amountInRMB = $amount * $rate;
|
||||
$billing = 0.015 * $amount;
|
||||
$sales_tax = 0.10 * $amount;
|
||||
$gst = 0 * $amount;
|
||||
$customerBankInAmount = round($amount + $gst + $sales_tax + $billing,2);
|
||||
$rmbBankAmount = $customerBankInAmount + $rebate;
|
||||
|
||||
// save amount in rmb
|
||||
$bookingsupplier->amountInRMB = $amountInRMB;
|
||||
// save rmb bank amount
|
||||
$bookingsupplier->rmbBankAmount = $rmbBankAmount;
|
||||
$bookingsupplier->save();
|
||||
|
||||
/* For multiple booking */
|
||||
// $supplierbookingitems = $request->input("supplierbookingitem");
|
||||
// foreach ($bookings as $booking)
|
||||
// {
|
||||
// $update_supplierbookingitem = SupplierBookingItem::where('supplierbooking_id', $id)->first();
|
||||
// $update_supplierbookingitem->china_bankslip_url = $booking['china_bankslip_url'];
|
||||
// $update_supplierbookingitem->bank_in_amount = $booking['bank_in_amount'];
|
||||
// $update_supplierbookingitem->date = $booking['date'];
|
||||
// $update_supplierbookingitem->details = $booking['details'];
|
||||
// $update_supplierbookingitem->save();
|
||||
// }
|
||||
return response()->json(['book_id'=>$book_id],201);
|
||||
}
|
||||
|
||||
|
||||
public function report(Request $request, $id)
|
||||
{
|
||||
$supplier_booking = Booking::firstOrFail($id)->supplierBooking()->firstOrFail();
|
||||
|
||||
@@ -12,8 +12,12 @@ class SettingBeneficiaryController extends Controller
|
||||
return SettingBeneficiary::all();
|
||||
}
|
||||
|
||||
public function show(SettingBeneficiary $beneficiary)
|
||||
public function show($beneficiary)
|
||||
{
|
||||
if ($beneficiary == 0){
|
||||
response()->json(["company_name"=>"123", "account_number"=>"123"] , 201);
|
||||
}
|
||||
$beneficiary = SettingBeneficiary::find($beneficiary);
|
||||
return $beneficiary;
|
||||
}
|
||||
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakeChinaBeneficiaryAccNulabbleInBeneficiarysettingTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('setting_active_banks', function (Blueprint $table) {
|
||||
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
|
||||
$table->integer('beneficiary_id')->nullable()->unsigned()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('beneficiarysetting', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddOrdernoNPaymentforFieldToBookingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->string('order_no')->nullable();
|
||||
$table->string('payment_for');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsIntoSupplierBookingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('supplier_bookings', function (Blueprint $table) {
|
||||
$table->string('amount_in_myr')->nullable();
|
||||
$table->string('tax_rate')->nullable();
|
||||
$table->string('amount_after_tax')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,8 @@ class BookTableSeeder extends Seeder
|
||||
$rate = Rate::all()->last();
|
||||
|
||||
DB::table('bookings')->insert([
|
||||
'account_name' => 'milah',
|
||||
'account_num' => '99898',
|
||||
'account_name' => 'EXCHANGE SDN BHD',
|
||||
'account_num' => '99898239298123',
|
||||
'bank_name' => 'maybank',
|
||||
'bank_branch' => 'rembau',
|
||||
'company_name' => 'ICEF',
|
||||
@@ -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'),
|
||||
]);
|
||||
|
||||
@@ -13,8 +13,8 @@ class SettingActiveBankSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$bankx1 = SettingMalaysiaBank::where('acc_no', "=" ,'malaysiaacc01')->first();
|
||||
$bankx2 = SettingMalaysiaBank::where('acc_no', "=",'malaysiaacc02')->first();
|
||||
$bankx1 = SettingMalaysiaBank::find(1);
|
||||
$bankx2 = SettingMalaysiaBank::find(2);
|
||||
$chinabank = SettingBeneficiary::where('acc_no', "=" ,'123456789')->first();
|
||||
|
||||
DB::table('setting_active_banks')->truncate();
|
||||
|
||||
@@ -15,8 +15,8 @@ class SettingMalaysiaBankSeeder extends Seeder
|
||||
DB::table('setting_malaysia_banks')->truncate();
|
||||
DB::table('setting_malaysia_banks')->insert([
|
||||
'company_name' => 'CIEF',
|
||||
'bank_name' => 'Maybank',
|
||||
'acc_no' => 'malaysiaacc01',
|
||||
'bank_name' => 'MAYBANK',
|
||||
'acc_no' => '75930284783',
|
||||
'bank_address' => 'Jalan putrajaya',
|
||||
'swift' => 'ABC123',
|
||||
'cnap' => 'CED234',
|
||||
@@ -24,8 +24,8 @@ class SettingMalaysiaBankSeeder extends Seeder
|
||||
]);
|
||||
DB::table('setting_malaysia_banks')->insert([
|
||||
'company_name' => 'CIEF',
|
||||
'bank_name' => 'Maybank',
|
||||
'acc_no' => 'malaysiaacc02',
|
||||
'bank_name' => 'MAYBANK',
|
||||
'acc_no' => '85839298348',
|
||||
'bank_address' => 'Jalan putrajaya',
|
||||
'swift' => 'ABC123',
|
||||
'cnap' => 'CED234',
|
||||
|
||||
+1
-2
@@ -16,7 +16,7 @@
|
||||
"@fortawesome/fontawesome-free-brands": "^5.0.8",
|
||||
"@fortawesome/fontawesome-free-regular": "^5.0.8",
|
||||
"@fortawesome/fontawesome-free-solid": "^5.0.8",
|
||||
"@fortawesome/vue-fontawesome": "^0.0.22",
|
||||
"@fortawesome/vue-fontawesome": "0.0.22",
|
||||
"@xkeshi/vue-countdown": "^0.6.0",
|
||||
"axios": "^0.18.0",
|
||||
"bootstrap": "^4.0.0",
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
<el-dialog align="center" :visible.sync="UpdateRateDialogVisible" width="900px">
|
||||
<el-form :inline="true" align="center" ref="rate" :model="rate" :rules="rules">
|
||||
|
||||
<el-form-item prop="x1_cash" >X1: Cash : <el-input v-model.number="rate.x1_cash" style=width:25% ></el-input></el-form-item>
|
||||
<el-form-item prop="x1_cheque" >Cheque : <el-input v-model.number="rate.x1_cheque" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x1_ba">BA : <el-input v-model.number="rate.x1_ba" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x1_cash" >X1: Cash : <el-input v-model.number="rate.x1_cash" style=width:60% ></el-input></el-form-item>
|
||||
<el-form-item prop="x1_cheque" >Cheque : <el-input v-model.number="rate.x1_cheque" style=width:60%></el-input></el-form-item>
|
||||
<el-form-item prop="x1_ba">BA : <el-input v-model.number="rate.x1_ba" style=width:60%></el-input></el-form-item>
|
||||
<br>
|
||||
<el-form-item prop="x2_cash" >X2: Cash : <el-input v-model.number="rate.x2_cash" style=width:25% ></el-input></el-form-item>
|
||||
<el-form-item prop="x2_cheque" >Cheque : <el-input v-model.number="rate.x2_cheque" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x2_ba" >BA : <el-input v-model.number="rate.x2_ba" style=width:25%></el-input></el-form-item>
|
||||
<el-form-item prop="x2_cash" >X2: Cash : <el-input v-model.number="rate.x2_cash" style=width:60% ></el-input></el-form-item>
|
||||
<el-form-item prop="x2_cheque" >Cheque : <el-input v-model.number="rate.x2_cheque" style=width:60%></el-input></el-form-item>
|
||||
<el-form-item prop="x2_ba" >BA : <el-input v-model.number="rate.x2_ba" style=width:60%></el-input></el-form-item>
|
||||
</el-form>
|
||||
<br>
|
||||
<div align="center">
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
this.rate = response.data
|
||||
})
|
||||
},
|
||||
createRate: function () {
|
||||
createRate: function () { // TODO : we do not have create rate, only update rate. Delete this ?
|
||||
this.loading = true,
|
||||
this.dialogFormVisible1 = true
|
||||
let newRate = {
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
</li>
|
||||
<!-- Guest -->
|
||||
<template v-else>
|
||||
<li class="nav-item">
|
||||
|
||||
@@ -210,15 +210,15 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="rate">
|
||||
<!-- <el-form-item prop="rate">
|
||||
<el-input v-model="supplierBookingForm.rate" type="text" placeholder="Rate" style="width: 80%" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item prop="rebate">
|
||||
<el-input v-model="supplierBookingForm.rebate" type="text" placeholder="Rebate" style="width: 80%" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="transfer_amount">
|
||||
<!-- <el-form-item prop="transfer_amount">
|
||||
<el-input v-model="supplierBookingForm.transfer_amount" type="text" placeholder="Payment Amount" style="width: 80%" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button :loading="loading_btn" type="primary" @click="generateReport('supplierBookingForm')">Generate Report</el-button>
|
||||
</el-form-item>
|
||||
@@ -260,7 +260,6 @@
|
||||
supplier_options: null,
|
||||
supplierBookingForm: {
|
||||
supplier: null,
|
||||
amount: null,
|
||||
rebate: null,
|
||||
rate: null,
|
||||
transfer_amount: null,
|
||||
@@ -333,10 +332,9 @@
|
||||
let newReport = {
|
||||
booking_id: this.$route.params.id,
|
||||
supplier_id: this.supplierBookingForm.supplier,
|
||||
amount: this.supplierBookingForm.amount,
|
||||
rebate: this.supplierBookingForm.rebate,
|
||||
rate: this.supplierBookingForm.rate,
|
||||
transfer_amount: this.supplierBookingForm.transfer_amount,
|
||||
//rate: this.supplierBookingForm.rate,
|
||||
//transfer_amount: this.supplierBookingForm.transfer_amount,
|
||||
}
|
||||
|
||||
axios.post('/api/supplier-booking', newReport)
|
||||
|
||||
@@ -313,43 +313,14 @@
|
||||
axios.get('/api/supplier-booking/' + this.$route.params.id)
|
||||
.then((response) => {
|
||||
this.supplier_booking = response.data
|
||||
loading.close()
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
loading.close()
|
||||
})
|
||||
|
||||
axios.get('/api/active-bank')
|
||||
.then((response) => {
|
||||
axios.get('/api/setting-beneficiary/' + response.data.beneficiary_id)
|
||||
.then((response) => {
|
||||
loading.close();
|
||||
this.supplier_booking.china_bank_name = response.data.bank_name;
|
||||
this.supplier_booking.china_company_name = response.data.company_name;
|
||||
this.supplier_booking.china_acc_no = response.data.acc_no;
|
||||
})
|
||||
.catch((error) => {
|
||||
loading.close();
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
loading.close();
|
||||
console.log(error);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Fetch data fail',
|
||||
type: 'error',
|
||||
duration: 10000
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
downloadReport(){
|
||||
@@ -451,8 +422,8 @@
|
||||
ctx.font = "13px Arial";
|
||||
ctx.textAlign = "right";
|
||||
//// Row 1
|
||||
ctx.fillText("Payment Voucher :", column1X, rowHeight[1] - 5);
|
||||
ctx.fillText(binding.value.id, column3X, rowHeight[1] - 5);
|
||||
ctx.fillText("Ref No. :", column1X, 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);
|
||||
@@ -460,15 +431,15 @@
|
||||
ctx.fillText("Marking :", column1X, rowHeight[3] - 5);
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("CIEF/605HOS", column3X, rowHeight[3] - 5);
|
||||
ctx.fillText(binding.value.marking, column3X, rowHeight[3] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
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);
|
||||
@@ -480,13 +451,17 @@
|
||||
ctx.fillText("MYR/RM :", column1X, rowHeight[9] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[9] - 5);
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText(binding.value.transfer_amount, column3X, rowHeight[9] - 5);
|
||||
ctx.fillText(binding.value.amount_in_myr, column3X, rowHeight[9] - 5);
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 8
|
||||
ctx.fillText("* RATE :", column1X, rowHeight[10] - 5);
|
||||
ctx.fillText(binding.value.rate, column3X, rowHeight[10] - 5);
|
||||
//// Row 9
|
||||
// Empty
|
||||
ctx.fillText("REBATE :", column1X, rowHeight[11] - 5);
|
||||
ctx.fillText("MYR", column2X, rowHeight[11] - 5);
|
||||
ctx.font = "14px Arial";
|
||||
ctx.fillText(binding.value.rebate, column3X, rowHeight[11] - 5);
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 10
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("CNY", column2X, rowHeight[12] - 5);
|
||||
@@ -506,25 +481,26 @@
|
||||
//// 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.amount_in_myr, 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 "+ (Math.round((binding.value.tax_rate * 100 - 100) * 100) / 100) + "% :", column1X, rowHeight[16] - 5); // TODO : Change to percentage
|
||||
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);
|
||||
ctx.fillText("Bank In Amount :", column1X, rowHeight[18] - 5);
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("MYR", column2X, rowHeight[18] - 5);
|
||||
ctx.fillText(binding.value.amountInRMB, column3X, rowHeight[18] - 5);
|
||||
ctx.fillText(binding.value.amount_after_tax, column3X, rowHeight[18] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
//line
|
||||
@@ -542,16 +518,16 @@
|
||||
ctx.lineTo(column3X + 20, rowHeight[18] - 2);
|
||||
ctx.stroke();
|
||||
//// Row 16
|
||||
ctx.fillText("Rebate :", column1X, rowHeight[19] - 25);
|
||||
ctx.fillText("CNY", column2X, rowHeight[19] - 25);
|
||||
ctx.fillText("224.68", column3X, rowHeight[19] - 25);
|
||||
// ctx.fillText("Rebate :", column1X, rowHeight[19] - 25);
|
||||
// ctx.fillText("CNY", column2X, rowHeight[19] - 25);
|
||||
// ctx.fillText("224.68", column3X, rowHeight[19] - 25);
|
||||
//// Row 16
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.fillText("Bank In to Account Below :", column1X, rowHeight[20] - 5);
|
||||
ctx.font = "bold italic 15px Arial";
|
||||
ctx.fillStyle = "#0070D5";
|
||||
ctx.fillText("CNY", column2X, rowHeight[20] - 5);
|
||||
ctx.fillText("7692.17", column3X - 20, rowHeight[20] - 5);
|
||||
ctx.fillText(binding.value.amountInRMB, column3X - 20, rowHeight[20] - 5);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "13px Arial";
|
||||
//// Row 17
|
||||
@@ -573,9 +549,9 @@
|
||||
ctx.font = "bold 14px Arial";
|
||||
ctx.textAlign = "center";
|
||||
ctx.fillText("China beneficiary Account", column2X - 40, rowHeight[22] - 80);
|
||||
ctx.fillText("户名 : " + binding.value.china_company_name, column2X - 40, rowHeight[22] - 60);
|
||||
ctx.fillText(binding.value.china_acc_no, column2X - 40, rowHeight[22] - 40);
|
||||
ctx.fillText(binding.value.china_bank_name , column2X - 40, rowHeight[22] - 20);
|
||||
ctx.fillText("户名 : " + binding.value.acc_name, column2X - 40, rowHeight[22] - 60);
|
||||
ctx.fillText(binding.value.acc_no, column2X - 40, rowHeight[22] - 40);
|
||||
ctx.fillText(binding.value.bank_name , column2X - 40, rowHeight[22] - 20);
|
||||
|
||||
ctx.font = "13px Arial";
|
||||
}, 1000,canvasElement,binding);
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -142,7 +142,15 @@
|
||||
<!-- Form_popup -->
|
||||
<el-dialog :visible.sync="dialogFormVisible" :fullscreen="true" title="Booking" center>
|
||||
<el-form ref="bookingForm" :model="bookingForm" :rules="rules">
|
||||
<div align="center">
|
||||
<div align="center">
|
||||
<el-form-item prop="payment_for"> <!-- TODO : this should be payment for order number -->
|
||||
<el-select v-model="bookingForm.payment_for" placeholder="Payment For" style="width: 80%" required="true">
|
||||
<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="order_no">
|
||||
<el-input v-model="bookingForm.order_no" placeholder="Order No." style="width: 80%" required="true" />
|
||||
</el-form-item>
|
||||
<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>
|
||||
@@ -180,7 +188,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Payment for (Order No.) : </td>
|
||||
<td> {{ bookingConfirmTable.payment_order }}</td>
|
||||
<td> {{ bookingConfirmTable.order_no }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Payment for : </td>
|
||||
<td> {{ bookingConfirmTable.payment_for }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Payment Method : </td>
|
||||
@@ -209,7 +221,7 @@
|
||||
<tr>
|
||||
<td>/ Rate :</td>
|
||||
<td>
|
||||
{{ bookingConfirmTable.rate }}
|
||||
{{ bookingConfirmTable.rate }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -328,6 +340,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- Booking Table-end -->
|
||||
|
||||
</el-main>
|
||||
</template>
|
||||
<style>
|
||||
@@ -372,6 +385,16 @@ export default {
|
||||
account_num: ''
|
||||
},
|
||||
rules: {
|
||||
order_no: [{
|
||||
required: true,
|
||||
message: 'Please input order number',
|
||||
trigger: 'change'
|
||||
}],
|
||||
payment_for: [{
|
||||
required: true,
|
||||
message: 'Please input payment for',
|
||||
trigger: 'change'
|
||||
}],
|
||||
amount: [{
|
||||
required: true,
|
||||
message: 'Please input amount',
|
||||
@@ -407,6 +430,10 @@ export default {
|
||||
value2: 'MYR',
|
||||
label2: 'MYR'
|
||||
}],
|
||||
options3: [{
|
||||
value: 'Full Payment',
|
||||
label: 'Full Payment'
|
||||
}],
|
||||
value: 'RMB',
|
||||
dialogFormVisible: false,
|
||||
dialogFormVisible1: false,
|
||||
@@ -522,6 +549,8 @@ export default {
|
||||
let newConfirmation = {
|
||||
amount: this.booking.amount,
|
||||
term: this.term,
|
||||
order_no: this.bookingForm.order_no,
|
||||
payment_for: this.bookingForm.payment_for,
|
||||
acc_name: this.bookingForm.account_name,
|
||||
acc_no: this.bookingForm.account_num
|
||||
}
|
||||
@@ -529,9 +558,6 @@ export default {
|
||||
.then((response) => {
|
||||
this.loading = false
|
||||
this.bookingConfirmTable = response.data;
|
||||
this.bookingConfirmTable.payment_for = 'Full Payment';//For future purpose
|
||||
this.bookingConfirmTable.remark = '';//For future purpose
|
||||
this.bookingConfirmTable.payment_order = '';//For future purpose
|
||||
this.dialogFormVisible = false
|
||||
this.dialogFormVisible1 = true
|
||||
})
|
||||
@@ -560,6 +586,8 @@ export default {
|
||||
this.loading = true,
|
||||
this.dialogFormVisible1 = true
|
||||
let newBooking = {
|
||||
order_no: this.bookingForm.order_no,
|
||||
payment_for: this.bookingForm.payment_for,
|
||||
account_name: this.bookingForm.account_name,
|
||||
account_num: this.bookingForm.account_num,
|
||||
bank_name: this.bookingForm.bank_name,
|
||||
|
||||
@@ -99,6 +99,10 @@ export default {
|
||||
label : item.acc_no,
|
||||
};
|
||||
});
|
||||
this.options_china_bank.unshift({
|
||||
value : 0,
|
||||
label : "Use Customer's Beneficiary"
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
Reference in New Issue
Block a user