schedule = $schedule;
$this->serialTableData = $serialTableData;
$this->materialTableData = $materialTableData;
$this->bundleTableData = $bundleTableData;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Invoice Table Report'
);
}
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'mail.test_mail',
// with: [
// 'company' => "CRI Digital Manufacturing Solutions",
// 'greeting' => "Dear Sir/Madam,
Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,",
// //'tableData' => $this->tableData,
// 'serialTableData' => $this->serialTableData,
// 'materialTableData' => $this->materialTableData,
// 'bundleTableData' => $this->bundleTableData,
// 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions"
// ],
// );
// }
public function content(): Content
{
$greeting = "Dear Sir/Madam,
Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,";
if ($this->schedule == 'Daily') {
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
//$greeting .= $reportPeriod;
$greeting .= "
$reportPeriod";
}
if ($this->schedule == 'Hourly') {
$now = now();
$fromHour = $now->copy()->subHour()->format('H:i:s');
$toHour = $now->format('H:i:s');
$reportDate = $now->format('d/m/Y');
$greeting .= "The following report presents results from: $reportDate, $fromHour to $toHour.";
}
if ($this->schedule == 'Live') {
$now = now();
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
$toMinute = $now->format('d/m/Y H:i:s');
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
}
return new Content(
view: 'mail.test_mail',
with: [
'company' => "CRI Digital Manufacturing Solutions",
'greeting' => $greeting,
//'greeting' => "Dear Sir/Madam,
Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,",
//'tableData' => $this->tableData,
'serialTableData' => $this->serialTableData,
'materialTableData' => $this->materialTableData,
'bundleTableData' => $this->bundleTableData,
'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions"
],
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{
return [];
}
}