diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index 66e4f7b4..556c94f1 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -54,10 +54,13 @@ class EmailDoToVTCommand extends Command $zip_file = 'do_'.Carbon::yesterday()->format('Y_m_d').'.zip'; $attachment = storage_path().'/'.$zip_file; + $startDate = Carbon::parse('20-02-2022'); + $endDate = Carbon::yesterday(); + $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', '>=', $startDate)->whereDate('updated_at', '<=', $endDate) ->whereHas('transactions', function ($query){ return $query->where('type', TransactionType::BILL)->where('issuer', 2); })->get(); @@ -72,11 +75,12 @@ 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 ".$startDate->format('d-m-Y')." - ".$endDate->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, $startDate, $endDate){ $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', 'uldvstar@gmail.com']); - $message->subject('CIEF DO COMPILATION '.Carbon::yesterday()->format('d-m-Y')); + $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', 'uldvstar@gmail.com']); + $message->subject('CIEF DO COMPILATION '.$startDate->format('d-m-Y').' - '.$endDate->format('d-m-Y')); $message->attach($attachment); });