mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
small change
This commit is contained in:
+81
-2
@@ -5,6 +5,7 @@ use App\Http\Controllers\InvoiceController;
|
||||
use App\Invoice;
|
||||
use App\InvoiceStatuses;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/*
|
||||
@@ -20,7 +21,85 @@ use Illuminate\Support\Facades\File;
|
||||
Route::get('/', 'WelcomeController@index');
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
|
||||
Route::get('/products', function(){
|
||||
DB::table('invoice_details')->update([
|
||||
'description' => 'Confidential Product Description',
|
||||
'stock_code' => '########',
|
||||
'quantity' => '1',
|
||||
'unit_price_rmb' => '1',
|
||||
'unit_price_rm' => '1',
|
||||
'total' => '1',
|
||||
]);
|
||||
});
|
||||
Route::get('/bookings', function(){
|
||||
DB::beginTransaction();
|
||||
$lastRate = 1;
|
||||
$faker = Faker\Factory::create();
|
||||
$bookings = Booking::offset(9000)->limit(3000)->get();
|
||||
foreach ($bookings as $booking) {
|
||||
if($booking->supplierBooking){
|
||||
$rate = $booking->supplierBooking->rate;
|
||||
$lastRate = $rate;
|
||||
} else {
|
||||
$rate = $lastRate;
|
||||
}
|
||||
|
||||
$amount = $faker->randomFloat(3, 10, 10000);
|
||||
$localAmount = $amount * (1/$rate);
|
||||
$bia = $localAmount + ($localAmount * 0.02);
|
||||
|
||||
$booking->rate = $rate;
|
||||
$booking->account_name = $faker->company;
|
||||
$booking->account_num = $faker->bothify('###################');
|
||||
$booking->amount = $amount;
|
||||
$booking->rmb_book_amount = $amount;
|
||||
$booking->bia = $bia;
|
||||
$booking->save();
|
||||
|
||||
if($booking->userBankSlip){
|
||||
$userBankSlip = $booking->userBankSlip;
|
||||
$userBankSlip->transfer_amount = $bia;
|
||||
$userBankSlip->save();
|
||||
}
|
||||
|
||||
if($booking->invoice){
|
||||
foreach ($booking->invoice->invoiceDetails as $item ) {
|
||||
$amount = $faker->randomFloat(3, 10, 1000);
|
||||
$item->unit_price_rmb = $amount;
|
||||
$item->unit_price_rm = $amount * (1/$rate);
|
||||
}
|
||||
$userBankSlip = $booking->userBankSlip;
|
||||
$userBankSlip->transfer_amount = $bia;
|
||||
$userBankSlip->save();
|
||||
}
|
||||
|
||||
if($booking->chinaBankSlip()->exists()){
|
||||
$chinaBankSlip = $booking->chinaBankSlip()->first();
|
||||
$chinaBankSlip->actual_transfer_amount = $amount;
|
||||
$chinaBankSlip->save();
|
||||
}
|
||||
|
||||
if($booking->supplierBooking){
|
||||
$supplierBooking = $booking->supplierBooking;
|
||||
$supplierBooking->rate = $rate;
|
||||
$supplierBooking->amountInRMB = $amount;
|
||||
$supplierBooking->amount_in_myr = $localAmount;
|
||||
$supplierBooking->amount_after_tax = $localAmount;
|
||||
|
||||
}
|
||||
|
||||
$bookingRate = $booking->rates;
|
||||
$bookingRate->x1_cash = $rate;
|
||||
$bookingRate->x1_cheque = $rate;
|
||||
$bookingRate->x1_ba = $rate;
|
||||
$bookingRate->x2_cash = $rate;
|
||||
$bookingRate->x2_cheque = $rate;
|
||||
$bookingRate->x2_ba = $rate;
|
||||
$bookingRate->save();
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
})->name('bookings');
|
||||
Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('/report/x1', function(){
|
||||
$bookings = Booking::where('admin_status', '>=', 3)->where('term', 'like', 'x1_%')->where('is_cancel', false)->where('user_id', '!=', 1)->get();
|
||||
@@ -132,10 +211,10 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
$total = count($oldCompletedInvoices) + count($newCompletedInvoices);
|
||||
echo "<h1>Total Po Approved: <b>".$total."</b></h1>";
|
||||
foreach ($newCompletedInvoices as $invoice){
|
||||
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a><br>";
|
||||
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a>$invoice->booking->amount<br>";
|
||||
}
|
||||
foreach ($oldCompletedInvoices as $invoice){
|
||||
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a><br>";
|
||||
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->booking->id."/admin/complete'>".$invoice->booking->id."</a>$invoice->booking->amount<br>";
|
||||
}
|
||||
})->name('po.approved');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user