mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 05:23:58 +00:00
debug do email to vt
This commit is contained in:
@@ -47,17 +47,58 @@ class EmailDoToVTCommand extends 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(!count($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(['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 '.Carbon::yesterday()->format('d-m-Y'));
|
||||
//
|
||||
// $message->attach($attachment);
|
||||
// });
|
||||
//
|
||||
// File::delete($attachment);
|
||||
//
|
||||
// echo 'success';
|
||||
//
|
||||
// }
|
||||
// }
|
||||
public function handle()
|
||||
{
|
||||
|
||||
Auth::login(User::findOrFail(1));
|
||||
$zip_file = 'do_' . Carbon::yesterday()->format('Y_m_d') . '.zip';
|
||||
$zip_file = 'do_from_24_nov_to_12_dec.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())
|
||||
$bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('24-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('12-12-2021'))
|
||||
->whereHas('transactions', function ($query) {
|
||||
return $query->where('type', TransactionType::BILL)->where('issuer', 2);
|
||||
})->get();
|
||||
@@ -74,12 +115,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 " . 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) {
|
||||
Mail::raw("Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 24-11-2021 to 12-12-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 ' . Carbon::yesterday()->format('d-m-Y'));
|
||||
$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', 'uldvstar@gmail.com']);
|
||||
$message->subject('CIEF DO COMPILATION from 24-11-2021 to 12-12-2021');
|
||||
|
||||
$message->attach($attachment);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user