mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 06:54:02 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into improve-responsive-ui
This commit is contained in:
+2
-2
@@ -4,7 +4,7 @@ namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class IssuerNot implements Filter
|
||||
class IssuerNotIn implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@ class IssuerNot implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('issuer', '!=', $value);
|
||||
return $builder->whereNotIn('issuer', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,8 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
|
||||
return [
|
||||
$company->reference,
|
||||
$company->name,
|
||||
$company->employees()->first() ? $company->employees()->first()->name : '',
|
||||
$company->contacts()->first() ? $company->contacts()->first()->phone : '',
|
||||
$company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual',
|
||||
count($company->bookings),
|
||||
$company->bookings()->sum('fix_amount'),
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Document;
|
||||
use App\Models\State;
|
||||
use App\Http\Helpers\General;
|
||||
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Classes\Jobs\FetchContainersStatusUpdateFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchDeliveryListFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchLoadedContainersFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchPackingListFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchWarehouseReceiveListFromVTPortalJob;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use ZipArchive;
|
||||
|
||||
class EmailDoToVTCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $signature = 'mail:EmailDoToVTCommand';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Send do to vt nation';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
Auth::login(User::findOrFail(1));
|
||||
$zip_file = 'do_'.Carbon::yesterday()->format('Y_m_d').'.zip';
|
||||
$attachment = storage_path().'/'.$zip_file;
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
|
||||
$bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', Carbon::yesterday())
|
||||
->whereHas('transactions', function ($query){
|
||||
return $query->where('type', TransactionType::BILL)->where('issuer', 2);
|
||||
})->get();
|
||||
|
||||
if(!$bookings){ return; }
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
$file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
|
||||
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf');
|
||||
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION ".Carbon::yesterday()->format('d-m-Y').".\r\n\r\n**This is an automatically generated email – please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment){
|
||||
$message->from('exchange@cief-malaysia.com');
|
||||
$message->to(['vtnation16@gmail.com', 'vtnation@gmail.com', 'atvantic04@gmail.com', 'vtnation2@gmail.com']);
|
||||
$message->cc(['shafiqa_sukeri@cief-malaysia.com', 'frontendcief@gmail.com', 'pm@cief-malaysia.com', 'hasan@cief-malaysia.com', 'shipping_admin@cief-malaysia.com', 'hasanakbar27@gmail.com', 'pmwong2019@gmail.com']);
|
||||
$message->subject('CIEF DO COMPILATION '.Carbon::yesterday()->format('d-m-Y'));
|
||||
|
||||
$message->attach($attachment);
|
||||
});
|
||||
|
||||
File::delete($attachment);
|
||||
|
||||
echo 'success';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,15 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use ZipArchive;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
@@ -23,7 +30,10 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
|
||||
// $schedule->command('inspire')->hourly();
|
||||
$schedule->command('mail:EmailDoToVTCommand')->dailyAt('10:00');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ class TransactionResource extends JsonResource
|
||||
'booking' => new BookingResource($this->booking),
|
||||
'type' => (int) $this->type,
|
||||
'bill_no' => $this->bill_no,
|
||||
'issuer_name' => $this->issuerCompany->name,
|
||||
'recipient_bank_account' => new BankResource($this->when((int) $this->type === TransactionType::BILL,$this->booking->bank)),
|
||||
'amount' => (double) $this->amount,
|
||||
'original_amount' => (double) $this->original_amount,
|
||||
|
||||
@@ -26,6 +26,14 @@ class Transaction extends AbstractModel implements Documentable
|
||||
return $this->BelongsTo( Booking::class, 'booking_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function issuerCompany(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo( Company::class, 'issuer', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5">
|
||||
<div class="col" v-if="$store.getters.isAdmin && item.type === 3">
|
||||
<div class="font-heading fs-8 muted all-caps">Supplier</div>
|
||||
<div class="font-heading fs-10 bold">
|
||||
{{item.issuer_name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-8 all-caps" :class="[{'text-danger': item.status === 4}, {'text-primary': item.status !== 4}]">{{ item.status === 1 ? 'Submitted' : item.status === 2 ? 'Received' : item.status === 4 ? 'Rejected' : 'Paid'}} On: {{item.updated_at}}</div>
|
||||
@@ -49,7 +57,7 @@
|
||||
<div class="font-heading all-caps fs-10">Recipient Gets</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-10">{{this.customerBooking.original_currency.short_code}} {{(item.original_amount).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
<div class="font-heading fs-10">{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? customerBooking.original_amount : item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end bold m-b-10 text-primary">
|
||||
|
||||
@@ -28,12 +28,23 @@
|
||||
{{item.booking.company.reference}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" v-if="item.status === 3">
|
||||
<div v-for="file in item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-l-5">
|
||||
<document-file-viewer-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-0">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<bank-in-component :data="item"></bank-in-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 b-a b-dashed b-success requestModal pointer" @click="selectedID(item.id)" data-type="paymentProofModal">
|
||||
<div class="col-2 b-a b-dashed b-success requestModal pointer" v-if="item.status !== 3" @click="selectedID(item.id)" data-type="paymentProofModal">
|
||||
<div class="row align-item-center justify-content-center h-100">
|
||||
<div class="col-auto" >
|
||||
<div class="row align-items-center h-100">
|
||||
|
||||
+1
-1
@@ -305,7 +305,7 @@
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-8 text-white all-caps">Payable</div>
|
||||
<div class="font-heading fs-10 text-white bold">
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,8 +1,15 @@
|
||||
<div class="row d-none" :class="[{'d-flex': $store.getters.isDestinationAccountAdmin}]" v-if="$store.getters.isDestinationAccountAdmin">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-5 bg-white padding-25">
|
||||
<list-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list')" :options="{status: 2, type: 3, issuer_not: 2}">
|
||||
<div class="col col-md-5 bg-white padding-25">
|
||||
<list-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list')" :options="{status: 2, type: 3, issuer_not_in: [2, 1937]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-proof-component :data="data" class="m-b-15 m-r-0"></payment-proof-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
<div class="col col-md-5 bg-white padding-25">
|
||||
<list-component ref="paymentProofList" section="paymentProofHistorySection" :endpoint="route('api.transaction.list')" :options="{status: 3, type: 3, issuer_not_in: [2, 1937]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-proof-component :data="data" class="m-b-15 m-r-0"></payment-proof-component>
|
||||
</template>
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
<div class="text-white all-caps fs-12">Payments & Billing</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-auto p-r-20" v-if="$store.getters.isAdmin">
|
||||
<a href="{{route('currency_orders')}}">
|
||||
<div class="text-white all-caps fs-12">Currency Orders</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-auto p-r-20" v-if="$store.getters.isAdmin">
|
||||
<a href="{{route('bookings')}}">
|
||||
<div class="text-white all-caps fs-12">Transfers</div>
|
||||
|
||||
+7
-33
@@ -55,8 +55,12 @@ Route::get('/payments', function () {
|
||||
return view('pages.payments');
|
||||
})->name('payments');
|
||||
|
||||
Route::get('/currency_orders', function () {
|
||||
return view('pages.currency_orders');
|
||||
})->name('currency_orders');
|
||||
|
||||
Route::get('/bookings', function () {
|
||||
return view('pages.bookings');
|
||||
return view('pages.bookings.index');
|
||||
})->name('bookings');
|
||||
|
||||
Route::get('/bookings/urgent', function () {
|
||||
@@ -64,42 +68,12 @@ Route::get('/bookings/urgent', function () {
|
||||
})->name('bookings.urgent');
|
||||
|
||||
Route::get('/transfer/{marking}', function ($marking) {
|
||||
return view('pages.booking_details', ['marking' => $marking]);
|
||||
return view('pages.bookings.profile', ['marking' => $marking]);
|
||||
})->name('booking.details');
|
||||
|
||||
Route::get('/transfer/merge/{marking}', function ($marking) {
|
||||
return view('pages.booking_merge', ['marking' => $marking]);
|
||||
return view('pages.bookings.merge', ['marking' => $marking]);
|
||||
})->name('booking.merge');
|
||||
|
||||
Route::get('/test', function(){
|
||||
|
||||
// Auth::login(User::findOrFail(1));
|
||||
// try {
|
||||
// $zip_file = 'cief_jun_to_september_delivery_orders.zip'; // Name of our archive to download
|
||||
// $zip = new ZipArchive();
|
||||
// if ($zip->open(storage_path().'/'.$zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE) {
|
||||
//
|
||||
// //whereMonth('created_at', 5)->whereYear('created_at', 2021)->
|
||||
// $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->get();
|
||||
//
|
||||
// foreach ($bookings as $booking) {
|
||||
// $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
|
||||
// if (! $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), Carbon::now()->format('d_m_Y').'_'.$booking->marking.'.pdf')) {
|
||||
// echo 'Could not add file to ZIP: ' . $file;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Close ZipArchive
|
||||
// $zip->close();
|
||||
// } else {
|
||||
// echo 'Could not open ZIP file.';
|
||||
// }
|
||||
// } catch (Exception $exception) {
|
||||
// dd($exception);
|
||||
// }
|
||||
|
||||
|
||||
});
|
||||
|
||||
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
|
||||
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');
|
||||
|
||||
Reference in New Issue
Block a user