mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
test sending booking do to email
This commit is contained in:
@@ -352,33 +352,6 @@ class InvoiceController extends Controller
|
||||
$booking->admin_status = 7;
|
||||
$booking->save();
|
||||
|
||||
$zipname = 'do_'.Carbon::today()->format('Y_m_d').'.zip';
|
||||
$zip = new ZipArchive;
|
||||
$zip->open($zipname, ZipArchive::CREATE);
|
||||
$approvedInvoices = InvoiceStatuses::where('status', 'approve')->whereDate('created_at', Carbon::today())->distinct()->get(['invoice_id']);
|
||||
$bookings = [];
|
||||
foreach($approvedInvoices as $approved){
|
||||
$bookings[] = $approved->invoice->booking->id;
|
||||
}
|
||||
foreach ($bookings as $id) {
|
||||
$do = $this->generateSupplierDo($id);
|
||||
$zip->addFromString('do_'.Carbon::today()->format('Y_m_d').'_'.$id.'.pdf', $do->Output('do.pdf', 'S'));
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
// $attachment = chunk_split(base64_encode(File::get($zipname)));
|
||||
$attachment = public_path($zipname);
|
||||
|
||||
Mail::raw( 'DO for bookings po approved on '.Carbon::today(), function($message) use ($attachment){
|
||||
$message->from('exchange@cief-malaysia.com');
|
||||
$message->to('uldvstar@gmail.com');
|
||||
$message->subject('DO for bookings on'.Carbon::today());
|
||||
|
||||
$message->attach($attachment);
|
||||
});
|
||||
|
||||
File::delete($zipname);
|
||||
|
||||
if(!$booking) {
|
||||
return response()->json(['message' => 'Unable to Complete Booking. Please Approve Again'], 500);
|
||||
}
|
||||
@@ -459,9 +432,7 @@ class InvoiceController extends Controller
|
||||
$fontData = $defaultFontConfig['fontdata'];
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'fontDir' => array_merge($fontDirs, [
|
||||
__DIR__ . '/custom/font/directory',
|
||||
]),
|
||||
'fontDir' => array_merge($fontDirs, [storage_path('tempdir')]),
|
||||
]);
|
||||
$mpdf->shrink_tables_to_fit=1;
|
||||
$mpdf->keep_table_proportions = true;
|
||||
|
||||
Reference in New Issue
Block a user