From e0ffcdb0e4fa490c9988747faa466bc317eaf7a1 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 11 Nov 2021 16:23:27 +0800 Subject: [PATCH 01/77] download do's for vt --- routes/web.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/routes/web.php b/routes/web.php index 37db6461..706d3b3e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -73,30 +73,30 @@ Route::get('/transfer/merge/{marking}', function ($marking) { 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); -// } + 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)->where('update_date', '>', Carbon::parse('04-10-2021'))->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), $booking->created_at->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); + } }); From 617afb4379cd4b7a46aad6c0e4533a43a06f6928 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 11 Nov 2021 16:24:45 +0800 Subject: [PATCH 02/77] download do's for vt --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 706d3b3e..931e3c72 100644 --- a/routes/web.php +++ b/routes/web.php @@ -80,7 +80,7 @@ Route::get('/test', function(){ 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)->where('update_date', '>', Carbon::parse('04-10-2021'))->get(); + $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->where('update_at', '>', Carbon::parse('04-10-2021'))->get(); foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); From 1a3566e62aef70572921ac85424a4c978c71f23a Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 11 Nov 2021 16:25:10 +0800 Subject: [PATCH 03/77] download do's for vt --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 931e3c72..bd865f0f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -80,7 +80,7 @@ Route::get('/test', function(){ 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)->where('update_at', '>', Carbon::parse('04-10-2021'))->get(); + $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->where('updated_at', '>', Carbon::parse('04-10-2021'))->get(); foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); From d2ad5c3d9ad3d3fd8ded0f785bc6ec5d2f17daf3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 11 Nov 2021 16:30:25 +0800 Subject: [PATCH 04/77] download do's for vt --- routes/web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index bd865f0f..fbfed07c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -75,12 +75,12 @@ 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_file = 'cief_oct_to_nov_11_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)->where('updated_at', '>', Carbon::parse('04-10-2021'))->get(); + $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->where('updated_at', '>=', Carbon::parse('01-10-2021'))->get(); foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); From 9da87c93d3fe175204deb29af98cc789dfd32bb5 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 16 Nov 2021 17:07:04 +0800 Subject: [PATCH 05/77] payment history standardize amount --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 6e9ea19f..9164b020 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -49,7 +49,7 @@
Recipient Gets
-
{{this.customerBooking.original_currency.short_code}} {{(item.original_amount).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From 27c93bc7cd2c40471deb91affeedc632f28bd0c4 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 22 Nov 2021 16:40:19 +0800 Subject: [PATCH 06/77] fix receipient amount --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 9164b020..7c3a9e4a 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -49,7 +49,7 @@
Recipient Gets
-
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? customerBooking.original_amount : customerBooking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From 3e74c5378b00a29e5a741d9422207433dcfd02b0 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 22 Nov 2021 16:42:18 +0800 Subject: [PATCH 07/77] fix receipient amount --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 7c3a9e4a..ce1421b6 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -49,7 +49,7 @@
Recipient Gets
-
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? customerBooking.original_amount : customerBooking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? customerBooking.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From 211439d328aafa711ac5c50c5b4ed1f6dad9d7d3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 22 Nov 2021 16:43:41 +0800 Subject: [PATCH 08/77] fix receipient amount --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index ce1421b6..cb8a0341 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -49,7 +49,7 @@
Recipient Gets
-
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? customerBooking.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : customerBooking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From 2997680957c87f35c6a45feb7c8f4169791690f6 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 22 Nov 2021 16:46:12 +0800 Subject: [PATCH 09/77] fix receipient amount --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index cb8a0341..8bbb639c 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -49,7 +49,7 @@
Recipient Gets
-
{{this.customerBooking.original_currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : customerBooking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{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, ",")}}
From ac3279104367b7df3de517f9eab625bd5b855a6d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 00:50:31 +0800 Subject: [PATCH 10/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 95 +++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 app/Console/Commands/EmailDoToVTCommand.php diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php new file mode 100644 index 00000000..471982bc --- /dev/null +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -0,0 +1,95 @@ +open(storage_path().'/'.$zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE) { + + $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) + ->whereHas('transactions', function ($query){ + return $query->where('type', TransactionType::BILL)->where('issuer', 5); + })->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(); + $attachment = storage_path().'/'.$zip_file; + + Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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(['uldvstar@gmail.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 from 12-11-2021 to 23-11-2021'); + + $message->attach($attachment); + }); + + File::delete($attachment); + + } + } +} From 1f6dd521165f42d89596eb971913054fcecebf0b Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 00:53:41 +0800 Subject: [PATCH 11/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 471982bc..a67f1134 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -67,7 +67,7 @@ class EmailDoToVTCommand extends Command ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 5); })->get(); - +dd(count($bookings)); if(!$bookings){ return; } foreach ($bookings as $booking) { From 31cf5dd4447bb92231a051237b9f23dac1d2dbb3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 00:55:19 +0800 Subject: [PATCH 12/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index a67f1134..807f9ecc 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -65,7 +65,7 @@ class EmailDoToVTCommand extends Command $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ - return $query->where('type', TransactionType::BILL)->where('issuer', 5); + return $query->where('type', TransactionType::BILL)->where('issuer', 2); })->get(); dd(count($bookings)); if(!$bookings){ return; } @@ -90,6 +90,8 @@ dd(count($bookings)); File::delete($attachment); + echo 'success'; + } } } From 2a685a1ea2445d27100a798da69faeb5603fdbb7 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 00:55:48 +0800 Subject: [PATCH 13/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 807f9ecc..ce99ddcf 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -67,7 +67,7 @@ class EmailDoToVTCommand extends Command ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); })->get(); -dd(count($bookings)); + if(!$bookings){ return; } foreach ($bookings as $booking) { From 0c8e9dd920f0f5ed95bc811130272c4c665aab61 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 00:59:28 +0800 Subject: [PATCH 14/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index ce99ddcf..22e04560 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -61,7 +61,7 @@ class EmailDoToVTCommand extends Command Auth::login(User::findOrFail(1)); $zip_file = 'do_from_11_nov_to_23_nov.zip'; $zip = new ZipArchive(); - if ($zip->open(storage_path().'/'.$zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE) { + if ($zip->open(storage_path().'/'.$zip_file, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ From 1d96fc9ced593aa43ac1cfeaea8596b404253720 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:01:26 +0800 Subject: [PATCH 15/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 22e04560..21a5a69b 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -88,7 +88,7 @@ class EmailDoToVTCommand extends Command $message->attach($attachment); }); - File::delete($attachment); +// File::delete($attachment); echo 'success'; From 3f784daf823f3ea27b71bdca94b176fd2662f826 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:02:02 +0800 Subject: [PATCH 16/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 21a5a69b..cf5100a6 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -74,7 +74,7 @@ class EmailDoToVTCommand extends Command $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'); } - +dd($zip); $zip->close(); $attachment = storage_path().'/'.$zip_file; @@ -88,7 +88,7 @@ class EmailDoToVTCommand extends Command $message->attach($attachment); }); -// File::delete($attachment); + File::delete($attachment); echo 'success'; From be8af08f67aed7a3d68206ada75f93ba06ebd2af Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:03:43 +0800 Subject: [PATCH 17/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index cf5100a6..aa5c7cf0 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -72,7 +72,9 @@ class EmailDoToVTCommand extends Command 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'); + if(!$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf')){ + echo 'Could not add file to ZIP: ' . $file; + } } dd($zip); $zip->close(); From 2ff944f4602bc7da6cffb85635a0144206660d79 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:04:07 +0800 Subject: [PATCH 18/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index aa5c7cf0..9d318a1a 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -76,7 +76,7 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } -dd($zip); + $zip->close(); $attachment = storage_path().'/'.$zip_file; From e9276f2cad46afaa4d9944e053809197c40beecf Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:05:11 +0800 Subject: [PATCH 19/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 9d318a1a..aa5c7cf0 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -76,7 +76,7 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } - +dd($zip); $zip->close(); $attachment = storage_path().'/'.$zip_file; From f9256eafb4d4a7f273e6f4bd9f0b52d30da9e334 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:08:27 +0800 Subject: [PATCH 20/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index aa5c7cf0..6dd8e6b6 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -60,8 +60,9 @@ class EmailDoToVTCommand extends Command { Auth::login(User::findOrFail(1)); $zip_file = 'do_from_11_nov_to_23_nov.zip'; + $attachment = storage_path('temp').'/'.$zip_file; $zip = new ZipArchive(); - if ($zip->open(storage_path().'/'.$zip_file, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { + if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ @@ -76,9 +77,9 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } -dd($zip); + $zip->close(); - $attachment = storage_path().'/'.$zip_file; + Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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'); From de810249cd6b61ae15ff03f328017b2e413cd6ab Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:09:25 +0800 Subject: [PATCH 21/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 6dd8e6b6..01c42789 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -60,7 +60,7 @@ class EmailDoToVTCommand extends Command { Auth::login(User::findOrFail(1)); $zip_file = 'do_from_11_nov_to_23_nov.zip'; - $attachment = storage_path('temp').'/'.$zip_file; + $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { From 92e48496f59ce4cb55986a6952c20872eaa44783 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:11:56 +0800 Subject: [PATCH 22/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 01c42789..8ac28a9a 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -58,7 +58,9 @@ class EmailDoToVTCommand extends Command */ public function handle() { + Auth::login(User::findOrFail(1)); + chdir(storage_path()); $zip_file = 'do_from_11_nov_to_23_nov.zip'; $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); @@ -80,7 +82,6 @@ class EmailDoToVTCommand extends Command $zip->close(); - Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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(['uldvstar@gmail.com']); From c4ebc772cd4b1f9d5ed214301c53b6131719732c Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:13:36 +0800 Subject: [PATCH 23/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 8ac28a9a..954a9202 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -60,12 +60,11 @@ class EmailDoToVTCommand extends Command { Auth::login(User::findOrFail(1)); - chdir(storage_path()); $zip_file = 'do_from_11_nov_to_23_nov.zip'; $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { - + chmod($attachment, 0777); $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); From 902b905498504d09574b2f6c77fd4bc8777ed16c Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:14:10 +0800 Subject: [PATCH 24/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 954a9202..db951bce 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -64,7 +64,6 @@ class EmailDoToVTCommand extends Command $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { - chmod($attachment, 0777); $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); @@ -78,7 +77,7 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } - + chmod($attachment, 0777); $zip->close(); Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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){ From 9a71eeaf9bf2f5fb26a6a92cfaf0b584293ec037 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:19:22 +0800 Subject: [PATCH 25/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index db951bce..25a1a3e2 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -63,7 +63,7 @@ class EmailDoToVTCommand extends Command $zip_file = 'do_from_11_nov_to_23_nov.zip'; $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); - if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { + if ($zip->open($attachment, ZIPARCHIVE::OVERWRITE)) { $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); @@ -77,7 +77,7 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } - chmod($attachment, 0777); + $zip->close(); Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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){ From 33fea09710559d80069e24aa4304d9afb4c0e6b8 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:20:45 +0800 Subject: [PATCH 26/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 25a1a3e2..89f2ed14 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -63,7 +63,7 @@ class EmailDoToVTCommand extends Command $zip_file = 'do_from_11_nov_to_23_nov.zip'; $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); - if ($zip->open($attachment, ZIPARCHIVE::OVERWRITE)) { + if ($zip->open($attachment, ZIPARCHIVE::CREATE)) { $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); From c23a0e60a347b3dd0ee654f0ea2b0fc42e95a284 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:24:02 +0800 Subject: [PATCH 27/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 89f2ed14..d23eb44b 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -73,8 +73,8 @@ class EmailDoToVTCommand extends Command foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); - if(!$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf')){ - echo 'Could not add file to ZIP: ' . $file; + if(file_exists(Storage::disk('documents')->path($file->file->file_info->original->file))){ + $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf'); } } From 6e35fe1d76e177b523555dc2ecfad53bbf9ca5c6 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:25:28 +0800 Subject: [PATCH 28/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index d23eb44b..8fd1ec12 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -73,9 +73,11 @@ class EmailDoToVTCommand extends Command foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); - if(file_exists(Storage::disk('documents')->path($file->file->file_info->original->file))){ - $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf'); + if(!file_exists(Storage::disk('documents')->path($file->file->file_info->original->file))){ + echo 'file doesnot exist'; } + $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf'); + } $zip->close(); From ef83674935240896214d6379d8b3d671c274cda7 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:32:01 +0800 Subject: [PATCH 29/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 8fd1ec12..665ab903 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -73,9 +73,6 @@ class EmailDoToVTCommand extends Command foreach ($bookings as $booking) { $file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first(); - if(!file_exists(Storage::disk('documents')->path($file->file->file_info->original->file))){ - echo 'file doesnot exist'; - } $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf'); } @@ -84,9 +81,9 @@ class EmailDoToVTCommand extends Command Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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(['uldvstar@gmail.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->to(['uldvstar@gmail.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 from 12-11-2021 to 23-11-2021'); $message->attach($attachment); From bbcda12bcdcbe900f826c5b8d55511c3a0782a65 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:37:53 +0800 Subject: [PATCH 30/77] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 11 +++++------ app/Console/Kernel.php | 10 ++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 665ab903..d9d463f0 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -60,11 +60,11 @@ class EmailDoToVTCommand extends Command { Auth::login(User::findOrFail(1)); - $zip_file = 'do_from_11_nov_to_23_nov.zip'; + $zip_file = 'do_'.Carbon::yesterday()->format('Y_m_d').'.zip'; $attachment = storage_path().'/'.$zip_file; $zip = new ZipArchive(); - if ($zip->open($attachment, ZIPARCHIVE::CREATE)) { - $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) + 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(); @@ -79,12 +79,11 @@ class EmailDoToVTCommand extends Command $zip->close(); - Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\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){ + 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(['uldvstar@gmail.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 from 12-11-2021 to 23-11-2021'); + $message->subject('CIEF DO COMPILATION '.Carbon::yesterday()->format('d-m-Y')); $message->attach($attachment); }); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 16f673e8..75c6edf1 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -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'); + } /** From 4360c720be2d638a6782179ea3ebd6eaf31e447c Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 10:46:53 +0800 Subject: [PATCH 31/77] fix incorrect currency for expired payments --- .../bookings/sections/BookingDetailsSectionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue index 013a511e..dab5196e 100644 --- a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue @@ -240,7 +240,7 @@
Payable
- {{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} + {{item.original_currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From 5cdc6b67b0b8ad0fda324c4a8dea3082bc67ab57 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 10:49:16 +0800 Subject: [PATCH 32/77] fix incorrect currency for expired payments --- .../bookings/sections/BookingDetailsSectionComponent.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue index dab5196e..d30aba90 100644 --- a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue @@ -240,7 +240,7 @@
Payable
- {{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, ",")}}
@@ -305,7 +305,7 @@
Payable
- {{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, ",")}}
From 8ac00929ebf0a429bfe0340d14ae03b478d5cf40 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:21:31 +0800 Subject: [PATCH 33/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index a397e6f5..e6c09af7 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -47,6 +47,8 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping return [ $company->reference, $company->name, + $company->employees->first()->name, + $company->contacts->first()->phone, $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), $company->bookings()->sum('fix_amount'), From ed90cecd23c4934ffde875a2c1626be9fa5182fa Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:23:10 +0800 Subject: [PATCH 34/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index e6c09af7..00d99b20 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -48,7 +48,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping $company->reference, $company->name, $company->employees->first()->name, - $company->contacts->first()->phone, + $company->contacts()->first()->phone, $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), $company->bookings()->sum('fix_amount'), From fc387bc70f70c7437c9f78f29c57e1e84da26af3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:24:33 +0800 Subject: [PATCH 35/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index 00d99b20..ba3fd66a 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -47,7 +47,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping return [ $company->reference, $company->name, - $company->employees->first()->name, + $company->employees()->first()->name, $company->contacts()->first()->phone, $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), From 5e0469e2bf2de53dc4b254d1eab9fb5400d72d41 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:28:00 +0800 Subject: [PATCH 36/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index ba3fd66a..97d974e6 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -48,7 +48,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping $company->reference, $company->name, $company->employees()->first()->name, - $company->contacts()->first()->phone, + $company->contacts()->first() ? $company->contacts()->first()->phone : '', $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), $company->bookings()->sum('fix_amount'), From 8066dd3b18598bbb2b7e7f191fec49d82e3db016 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:32:04 +0800 Subject: [PATCH 37/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index 97d974e6..9f565c81 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -47,7 +47,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping return [ $company->reference, $company->name, - $company->employees()->first()->name, + $company->employees()->first() ? $company->employees()->first()->phone : '', $company->contacts()->first() ? $company->contacts()->first()->phone : '', $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), From ffa1e45796253b61fc4593df1c626f387bb33b6d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 26 Nov 2021 18:32:58 +0800 Subject: [PATCH 38/77] add column to user csv list --- app/Classes/Modules/Exports/Services/ExportsCustomers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index 9f565c81..1972935e 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -47,7 +47,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping return [ $company->reference, $company->name, - $company->employees()->first() ? $company->employees()->first()->phone : '', + $company->employees()->first() ? $company->employees()->first()->name : '', $company->contacts()->first() ? $company->contacts()->first()->phone : '', $company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual', count($company->bookings), From f4ae3c3cf2ff4787084b8192d0644501dcdf28bf Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 28 Nov 2021 13:00:56 +0800 Subject: [PATCH 39/77] currency orders page --- .../{IssuerNot.php => IssuerNotIn.php} | 4 +- .../index.blade.php} | 0 .../merge.blade.php} | 0 .../profile.blade.php} | 0 .../views/pages/currency_orders.blade.php | 120 ++++++++++++++++++ .../pages/dashboards/account_admin.blade.php | 9 +- routes/web.php | 40 +----- 7 files changed, 137 insertions(+), 36 deletions(-) rename app/Classes/General/Eloquent/Filters/{IssuerNot.php => IssuerNotIn.php} (74%) rename resources/views/pages/{bookings.blade.php => bookings/index.blade.php} (100%) rename resources/views/pages/{booking_merge.blade.php => bookings/merge.blade.php} (100%) rename resources/views/pages/{booking_details.blade.php => bookings/profile.blade.php} (100%) create mode 100644 resources/views/pages/currency_orders.blade.php diff --git a/app/Classes/General/Eloquent/Filters/IssuerNot.php b/app/Classes/General/Eloquent/Filters/IssuerNotIn.php similarity index 74% rename from app/Classes/General/Eloquent/Filters/IssuerNot.php rename to app/Classes/General/Eloquent/Filters/IssuerNotIn.php index 77423b5d..61ca4f4c 100644 --- a/app/Classes/General/Eloquent/Filters/IssuerNot.php +++ b/app/Classes/General/Eloquent/Filters/IssuerNotIn.php @@ -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); } } \ No newline at end of file diff --git a/resources/views/pages/bookings.blade.php b/resources/views/pages/bookings/index.blade.php similarity index 100% rename from resources/views/pages/bookings.blade.php rename to resources/views/pages/bookings/index.blade.php diff --git a/resources/views/pages/booking_merge.blade.php b/resources/views/pages/bookings/merge.blade.php similarity index 100% rename from resources/views/pages/booking_merge.blade.php rename to resources/views/pages/bookings/merge.blade.php diff --git a/resources/views/pages/booking_details.blade.php b/resources/views/pages/bookings/profile.blade.php similarity index 100% rename from resources/views/pages/booking_details.blade.php rename to resources/views/pages/bookings/profile.blade.php diff --git a/resources/views/pages/currency_orders.blade.php b/resources/views/pages/currency_orders.blade.php new file mode 100644 index 00000000..df395982 --- /dev/null +++ b/resources/views/pages/currency_orders.blade.php @@ -0,0 +1,120 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
Payment Proof
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
Verification
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
Complete
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/pages/dashboards/account_admin.blade.php b/resources/views/pages/dashboards/account_admin.blade.php index 51ce8ebe..3e6f0c87 100644 --- a/resources/views/pages/dashboards/account_admin.blade.php +++ b/resources/views/pages/dashboards/account_admin.blade.php @@ -2,7 +2,14 @@
- + + + +
+
+ diff --git a/routes/web.php b/routes/web.php index fbfed07c..b2b61059 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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('payments'); + 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_oct_to_nov_11_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)->where('updated_at', '>=', Carbon::parse('01-10-2021'))->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), $booking->created_at->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'); From 78984e8c38069b3233a3521d930eaa93070faff5 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 28 Nov 2021 13:03:25 +0800 Subject: [PATCH 40/77] currency orders page --- resources/views/pages/currency_orders.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/views/pages/currency_orders.blade.php b/resources/views/pages/currency_orders.blade.php index df395982..d1eb6fa1 100644 --- a/resources/views/pages/currency_orders.blade.php +++ b/resources/views/pages/currency_orders.blade.php @@ -1,7 +1,7 @@ @extends('layouts.base_portal') @section('inner_content')
-
+
@@ -37,7 +37,7 @@
-
+
-
+
@@ -91,16 +91,16 @@
-
+
- +
-
+