Initial commit for new repo
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
This commit is contained in:
85
app/Mail/Calibration.php
Normal file
85
app/Mail/Calibration.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use DateTime;
|
||||
|
||||
class Calibration extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $tableData;
|
||||
public $scheduleType;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Calibration Mail',
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached calibration report status details for the 'calibrated on' and 'calibrated next date'";
|
||||
|
||||
if ($this->scheduleType == '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;
|
||||
}
|
||||
|
||||
if ($this->scheduleType == '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->scheduleType == '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.calibration_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
135
app/Mail/InvalidQualityMail.php
Normal file
135
app/Mail/InvalidQualityMail.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class InvalidQualityMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public $serial;
|
||||
public $invoiceNumber;
|
||||
public $mplantName;
|
||||
public $mProdOrder;
|
||||
public $mPartNo;
|
||||
public $mailType;
|
||||
public $greeting;
|
||||
public $subjectLine;
|
||||
|
||||
public $itemCode;
|
||||
public function __construct($parNo, $mProdOrder, $mplantName, $mailType = 'InvalidPartNumber')
|
||||
{
|
||||
$this->mPartNo = $parNo;
|
||||
$this->mProdOrder = $mProdOrder;
|
||||
$this->mplantName = $mplantName;
|
||||
$this->mailType = $mailType;
|
||||
}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
// dynamic subject based on mail type
|
||||
switch ($this->mailType) {
|
||||
case 'InvalidPartNumber2':
|
||||
$this->subjectLine = "Invalid Part Number 2 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber3':
|
||||
$this->subjectLine = "Invalid Part Number 3 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber4':
|
||||
$this->subjectLine = "Invalid Part Number 4 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber5':
|
||||
$this->subjectLine = "Invalid Part Number 5 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber':
|
||||
default:
|
||||
$this->subjectLine = "Invalid Part Number 1 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Envelope(
|
||||
subject: $this->subjectLine,
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
// dynamic greeting/message body
|
||||
switch ($this->mailType) {
|
||||
case 'InvalidPartNumber2':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned part number appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||
<b>Scanned Part Number 2:</b> {$this->mPartNo}<br>
|
||||
";
|
||||
break;
|
||||
case 'InvalidPartNumber3':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned part number appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||
<b>Scanned Part Number 3:</b> {$this->mPartNo}<br>
|
||||
";
|
||||
break;
|
||||
case 'InvalidPartNumber4':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned part number appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||
<b>Scanned Part Number 4:</b> {$this->mPartNo}<br>
|
||||
";
|
||||
break;
|
||||
case 'InvalidPartNumber5':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned part number appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||
<b>Scanned Part Number 5:</b> {$this->mPartNo}<br>
|
||||
";
|
||||
break;
|
||||
case 'InvalidPartNumber':
|
||||
default:
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned part number appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||
<b>Scanned Part Number 1:</b> {$this->mPartNo}<br>
|
||||
";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.invalid-serial',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'greeting' => $this->greeting,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions",
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
402
app/Mail/InvalidSerialMail.php
Normal file
402
app/Mail/InvalidSerialMail.php
Normal file
@@ -0,0 +1,402 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
// class InvalidSerialMail extends Mailable
|
||||
// {
|
||||
// use Queueable, SerializesModels;
|
||||
|
||||
// /**
|
||||
// * Create a new message instance.
|
||||
// */
|
||||
// public $serial;
|
||||
// public $invoiceNumber;
|
||||
// public $plantName;
|
||||
// public $invoiceType;
|
||||
|
||||
// public $greetings;
|
||||
|
||||
|
||||
// public function __construct($serial, $invoiceNumber, $plantName, $invoiceType)
|
||||
// {
|
||||
// $this->serial = $serial;
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->plantName = $plantName;
|
||||
// $this->invoiceType = $invoiceType;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the message envelope.
|
||||
// */
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Invalid Serial Mail',
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the message content definition.
|
||||
// */
|
||||
// public function content(): Content
|
||||
// {
|
||||
// $greeting = "Dear Sir/Madam,<br><br>Please note that the scanned serial number format appears to be incorrect.";
|
||||
|
||||
// return new Content(
|
||||
// view: 'mail.invalid-serial',
|
||||
// with: [
|
||||
// 'company' => "CRI Digital Manufacturing Solutions",
|
||||
// 'greeting' => $greeting,
|
||||
// 'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the attachments for the message.
|
||||
// *
|
||||
// * @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
// */
|
||||
// public function attachments(): array
|
||||
// {
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
class InvalidSerialMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $serial;
|
||||
public $invoiceNumber;
|
||||
public $mplantName;
|
||||
public $mInvoiceType;
|
||||
public $mailType; // new
|
||||
public $greeting;
|
||||
public $subjectLine;
|
||||
|
||||
public $itemCode;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat')
|
||||
{
|
||||
$this->serial = $serial;
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
$this->mplantName = $mplantName;
|
||||
$this->mInvoiceType = $mInvoiceType;
|
||||
$this->mailType = $mailType;
|
||||
$this->itemCode = $itemCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
// dynamic subject based on mail type
|
||||
switch ($this->mailType) {
|
||||
case 'NotFound':
|
||||
$this->subjectLine = "Serial Number Not Found ({$this->mplantName})";
|
||||
break;
|
||||
case 'NotFoundInvoice':
|
||||
$this->subjectLine = "Serial Number Not Found in Invoice ({$this->mplantName})";
|
||||
break;
|
||||
case 'NotFoundItemS':
|
||||
$this->subjectLine = "Item Code Not Found ({$this->mplantName})";
|
||||
break;
|
||||
case 'NotValidPackage':
|
||||
$this->subjectLine = "Not Valid Package ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidMaterialFormat':
|
||||
$this->subjectLine = "Invalid Qr code format Found material ({$this->mplantName})";
|
||||
break;
|
||||
case 'DuplicateMotorQR':
|
||||
$this->subjectLine = "Duplicate Serial Number ({$this->mplantName})";
|
||||
break;
|
||||
case 'NotMotorQR':
|
||||
$this->subjectLine = "Item Code doesn't have Motor QR ({$this->mplantName})";
|
||||
break;
|
||||
case 'CompletedSerialInvoice':
|
||||
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
|
||||
break;
|
||||
case 'NotPumpQR':
|
||||
$this->subjectLine = "Item Code doesn't have Pump QR ({$this->mplantName})";
|
||||
break;
|
||||
case 'DuplicatePumpQR':
|
||||
$this->subjectLine = "Duplicate Serial Number ({$this->mplantName})";
|
||||
break;
|
||||
case 'CSerialInvoice':
|
||||
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
|
||||
break;
|
||||
case 'MissingPanelBox':
|
||||
$this->subjectLine = "Missing Panel Box ({$this->mplantName})";
|
||||
break;
|
||||
case 'DuplicateCapacitorQR':
|
||||
$this->subjectLine = "Duplicate Capacitor QR ({$this->mplantName})";
|
||||
break;
|
||||
case 'UnknownPumpsetQR':
|
||||
$this->subjectLine = "Unknown PumpSet QR ({$this->mplantName})";
|
||||
break;
|
||||
case 'DuplicatePumpsetQR':
|
||||
$this->subjectLine = "Duplicate PumpSet QR ({$this->mplantName})";
|
||||
break;
|
||||
case 'ComSerInv':
|
||||
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidFormat':
|
||||
default:
|
||||
$this->subjectLine = "Invalid Serial Format Found ({$this->mplantName})";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Envelope(
|
||||
subject: $this->subjectLine,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
// dynamic greeting/message body
|
||||
switch ($this->mailType) {
|
||||
case 'NotFound':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
The scanned Serial Number <b>{$this->serial}</b> was not found in the database
|
||||
for the plant <b>{$this->mplantName}</b>.<br><br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
|
||||
Please verify the serial number.
|
||||
";
|
||||
break;
|
||||
case 'NotFoundInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
The scanned Serial Number <b>'{$this->serial}'</b> was not found in the Invoice Number <b>'{$this->invoiceNumber}'</b>
|
||||
for the plant <b>{$this->mplantName}</b>.<br><br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
|
||||
Please verify the serial number.
|
||||
";
|
||||
break;
|
||||
case 'NotFoundItemS':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item Code <b>'{$this->itemCode}'</b> with Serial Number<b>'{$this->serial}'</b> not found in sticker master
|
||||
for the plant <b>{$this->mplantName}</b>.<br><br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br><br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
|
||||
Please verify the Item Code.
|
||||
";
|
||||
break;
|
||||
case 'NotValidPackage':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned Item Code<b>'{$this->itemCode}'</b> doesn't have valid package type to proceed!
|
||||
for the plant <b>{$this->mplantName}</b>.<br><br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br><br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br><br>
|
||||
Please verify the Item Code.
|
||||
";
|
||||
break;
|
||||
case 'InvalidMaterialFormat':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned serial number format appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'DuplicateMotorQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned 'Motor' serial number <b>{$this->serial}</b> already completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'NotMotorQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned Item Code <b>{$this->itemCode}</b> doesn't have 'Motor' QR to proceed!<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'CompletedSerialInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'NotPumpQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Pump' QR to proceed!<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'DuplicatePumpQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned 'Pump' serial number already completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'CSerialInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'MissingPanelBox':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Panel Box Code' to proceed!<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'DuplicateCapacitorQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned 'Capacitor' serial number already completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'UnknownPumpsetQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned Item Code <b>'{$this->itemCode}'</b> doesn't have 'Pump Set' QR to proceed!<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'DuplicatePumpsetQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Scanned 'Pump Set' serial number already completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ComSerInv':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ItemNotFound':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item code <b>'{$this->itemCode}'</b> not found in database.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ItemNotFoundDB':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item code <b>'{$this->itemCode}'</b> not found in database for choosed plant.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ItemNotValidMaterialType':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item code <b>'{$this->itemCode}'</b> doesn't have a valid material type.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ItemNotInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item code <b>'{$this->itemCode}'</b> doesn't exist in invoice.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ItemNotInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Item code <b>'{$this->itemCode}'</b> doesn't exist in invoice.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'InvalidFormat':
|
||||
default:
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Please note that the scanned serial number format appears to be incorrect.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.invalid-serial',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'greeting' => $this->greeting,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions",
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
103
app/Mail/InvoiceDataMail.php
Normal file
103
app/Mail/InvoiceDataMail.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\InvoiceDataValidation;
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class InvoiceDataMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $scheduleType;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $mailSubject;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->mailSubject = $mailSubject ?? 'Despatch Pending Sale Invoice & STO Invoice as on Date';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: $this->mailSubject,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"';
|
||||
|
||||
if ($this->scheduleType == 'Daily') {
|
||||
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
|
||||
|
||||
$startDate = null;
|
||||
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
|
||||
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
|
||||
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
|
||||
} else {
|
||||
$startDate = now()->subDay()->setTime(10, 0, 0);
|
||||
}
|
||||
$endDate = now()->setTime(10, 0, 0);
|
||||
|
||||
// $fromDate = (new DateTime('yesterday 10:00'))->format('d/m/Y H:i') . ':000';//08:00
|
||||
// $toDate = (new DateTime('today 09:59')) ->format('d/m/Y H:i') . ':999';//07:59
|
||||
$reportPeriod = "from: $startDate to $endDate\".<br><br>Please arrange to despatch the same immediately.";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
|
||||
if ($this->scheduleType == 'Hourly') {
|
||||
$now = now();
|
||||
$fromHour = $now->copy()->subHour()->format('H:i:s');
|
||||
$toHour = $now->format('H:i:s');
|
||||
$reportDate = $now->format('d/m/Y');
|
||||
$greeting .= "from: $reportDate, $fromHour to $toHour. <br><br>Please arrange to despatch the same immediately.";
|
||||
}
|
||||
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to despatch the same immediately.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.invoice_data_report',
|
||||
with: [
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
65
app/Mail/InvoiceNotification.php
Normal file
65
app/Mail/InvoiceNotification.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class InvoiceNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $invoiceNumber;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($invoiceNumber)
|
||||
{
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->subject("Invoice Notification")
|
||||
->view('mail.invoice_notification') // Make sure this Blade exists
|
||||
->with([
|
||||
'invoiceNumber' => $this->invoiceNumber, // Pass data to the Blade
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Invoice Notification',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'view.name',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
102
app/Mail/ProductionMail.php
Normal file
102
app/Mail/ProductionMail.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ProductionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $tableData;
|
||||
public $scheduleType;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Production Mail',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'mail.production_report',
|
||||
// with: [
|
||||
// 'company' => "CRI Digital Manufacturing Solutions",
|
||||
// 'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,",
|
||||
// // 'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,<br>" . $reportPeriod,
|
||||
// 'tableData' => $this->tableData,
|
||||
// 'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
|
||||
|
||||
if ($this->scheduleType == '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;
|
||||
}
|
||||
|
||||
if ($this->scheduleType == '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->scheduleType == '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.production_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
114
app/Mail/test.php
Normal file
114
app/Mail/test.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class test extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $serialTableData;
|
||||
public $materialTableData;
|
||||
public $bundleTableData;
|
||||
|
||||
public $schedule;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
|
||||
public function __construct($serialTableData, $materialTableData, $bundleTableData, $schedule)
|
||||
{
|
||||
$this->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,<br><br>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,<br>CRI Digital Manufacturing Solutions"
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>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 .= "<br><br>$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,<br><br>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,<br>CRI Digital Manufacturing Solutions"
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user