Added invoicemail ad productionmail report views pages and commands pages
This commit is contained in:
55
app/Console/Commands/ScheduleList.php
Normal file
55
app/Console/Commands/ScheduleList.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
class ScheduleList
|
||||||
|
{
|
||||||
|
public function schedule(Schedule $schedule): void
|
||||||
|
{
|
||||||
|
// Invoice Report Scheduling
|
||||||
|
$scheduleType = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->where('rule_name', 'InvoiceMailAlert')
|
||||||
|
->value('schedule_type');
|
||||||
|
|
||||||
|
switch ($scheduleType) {
|
||||||
|
case 'Live':
|
||||||
|
$schedule->command('send:invoice-report')->everyMinute()->runInBackground();
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
$schedule->command('send:invoice-report')->hourly()->runInBackground();
|
||||||
|
break;
|
||||||
|
// case 'Daily':
|
||||||
|
// $schedule->command('send:invoice-report')->daily()->runInBackground(); //->dailyAt('07:59')
|
||||||
|
// break;
|
||||||
|
case 'Daily':
|
||||||
|
$schedule->command('send:invoice-report')->dailyAt('07:59')->runInBackground(); //->dailyAt('07:59')
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$schedule->command('send:invoice-report')->hourly()->runInBackground();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Production Report Scheduling
|
||||||
|
$productionScheduleType = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
|
->where('rule_name', 'ProductionMailAlert')
|
||||||
|
->value('schedule_type');
|
||||||
|
|
||||||
|
switch ($productionScheduleType) {
|
||||||
|
case 'Live':
|
||||||
|
$schedule->command('send:production-report')->everyMinute()->runInBackground();
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
$schedule->command('send:production-report')->hourly()->runInBackground();
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
$schedule->command('send:production-report')->dailyAt('07:59')->runInBackground();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$schedule->command('send:production-report')->hourly()->runInBackground();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
223
app/Console/Commands/SendInvoiceReport.php
Normal file
223
app/Console/Commands/SendInvoiceReport.php
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\InvoiceValidation;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\test;
|
||||||
|
|
||||||
|
class SendInvoiceReport extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
// protected $signature = 'app:send-invoice-report';
|
||||||
|
protected $signature = 'send:invoice-report';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Command description';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
// public function handle()
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function handle()
|
||||||
|
// {
|
||||||
|
|
||||||
|
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
// ->where('rule_name', 'InvoiceMailAlert')
|
||||||
|
// ->get();
|
||||||
|
|
||||||
|
// $emails = $mailRules->pluck('email')->unique()->toArray();
|
||||||
|
// $plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
|
||||||
|
// $tableData = [];
|
||||||
|
// $no = 1;
|
||||||
|
|
||||||
|
// foreach ($plants as $plantId) {
|
||||||
|
// $plant = Plant::find($plantId);
|
||||||
|
// $plantName = $plant ? $plant->name : $plantId;
|
||||||
|
|
||||||
|
// $totalInvoice = InvoiceValidation::where('plant_id', $plantId)
|
||||||
|
// ->distinct('invoice_number')
|
||||||
|
// ->count('invoice_number');
|
||||||
|
|
||||||
|
// $startDate = now()->setTime(8, 0, 0);
|
||||||
|
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
|
|
||||||
|
// $scannedInvoice = InvoiceValidation::select('invoice_number')
|
||||||
|
// ->where('plant_id', $plantId)
|
||||||
|
// ->whereNull('quantity')
|
||||||
|
// ->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
|
// ->groupBy('invoice_number')
|
||||||
|
// ->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
||||||
|
// ->count();
|
||||||
|
|
||||||
|
// $tableData[] = [
|
||||||
|
// 'no' => $no++,
|
||||||
|
// 'plant' => $plantName,
|
||||||
|
// 'totalInvoice' => $totalInvoice,
|
||||||
|
// 'scannedInvoice' => $scannedInvoice,
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Mail::to('jothikumar.padmanaban@cripumps.com')->send(
|
||||||
|
// // new test($tableData)
|
||||||
|
// // );
|
||||||
|
|
||||||
|
// if (!empty($emails))
|
||||||
|
// {
|
||||||
|
// // Mail::to($emails)->send(new test($tableData));
|
||||||
|
// // $this->info('Invoice report email sent successfully to: ' . implode(', ', $emails));
|
||||||
|
// foreach ($emails as $email) {
|
||||||
|
// Mail::to($email)->send(new test($tableData));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $this->info('No recipients found for InvoiceMailAlert.');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// Group emails by rule name
|
||||||
|
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||||
|
|
||||||
|
$startDate = now()->setTime(8, 0, 0);
|
||||||
|
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
|
$plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
|
||||||
|
|
||||||
|
// Build all tables once
|
||||||
|
$serialTableData = [];
|
||||||
|
$materialTableData = [];
|
||||||
|
$bundleTableData = [];
|
||||||
|
$noSerial = 1;
|
||||||
|
$noMaterial = 1;
|
||||||
|
$noBundle = 1;
|
||||||
|
|
||||||
|
foreach ($plants as $plantId) {
|
||||||
|
$plant = Plant::find($plantId);
|
||||||
|
$plantName = $plant ? $plant->name : $plantId;
|
||||||
|
|
||||||
|
//..Serial Invoice
|
||||||
|
|
||||||
|
$totalSerialCount = InvoiceValidation::where('plant_id', $plantId)
|
||||||
|
->whereNull('quantity')
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->distinct('invoice_number')
|
||||||
|
->count('invoice_number');
|
||||||
|
|
||||||
|
$scannedSerialCount = InvoiceValidation::select('invoice_number')
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->whereNull('quantity')
|
||||||
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
|
->groupBy('invoice_number')
|
||||||
|
->havingRaw(
|
||||||
|
"COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
|
||||||
|
)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$serialTableData[] = [
|
||||||
|
'no' => $noSerial++,
|
||||||
|
'plant' => $plantName,
|
||||||
|
'totalInvoice' => $totalSerialCount,
|
||||||
|
'scannedInvoice' => $scannedSerialCount,
|
||||||
|
];
|
||||||
|
|
||||||
|
//..Individual Invoice
|
||||||
|
|
||||||
|
$TotalMatCount = InvoiceValidation::where('plant_id', $plantId)
|
||||||
|
->where('quantity', 1)
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->distinct('invoice_number')
|
||||||
|
->count('invoice_number');
|
||||||
|
|
||||||
|
$scannedMatCount = InvoiceValidation::select('invoice_number')
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->where('quantity', 1)
|
||||||
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
|
->groupBy('invoice_number')
|
||||||
|
->havingRaw(
|
||||||
|
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
||||||
|
)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$materialTableData[] = [
|
||||||
|
'no' => $noMaterial++,
|
||||||
|
'plant' => $plantName,
|
||||||
|
'totalInvoice' => $TotalMatCount,
|
||||||
|
'scannedInvoice' => $scannedMatCount,
|
||||||
|
];
|
||||||
|
|
||||||
|
//..BUndle Invoice
|
||||||
|
|
||||||
|
$totalBundleCount = InvoiceValidation::where('plant_id', $plantId)
|
||||||
|
->where('quantity', '>', 1)
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->distinct('invoice_number')
|
||||||
|
->count('invoice_number');
|
||||||
|
|
||||||
|
$scannedBundleCount = InvoiceValidation::select('invoice_number')
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->where('quantity', '>', 1)
|
||||||
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
|
->groupBy('invoice_number')
|
||||||
|
->havingRaw(
|
||||||
|
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
||||||
|
)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$bundleTableData[] = [
|
||||||
|
'no' => $noBundle++,
|
||||||
|
'plant' => $plantName,
|
||||||
|
'totalInvoice' => $totalBundleCount,
|
||||||
|
'scannedInvoice' => $scannedBundleCount,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send to SerialInvoiceMail recipients
|
||||||
|
if ($mailRules->has('SerialInvoiceMail')) {
|
||||||
|
$emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
Mail::to($email)->send(new test($serialTableData, [], []));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
||||||
|
if ($mailRules->has('MaterialInvoiceMail')) {
|
||||||
|
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
Mail::to($email)->send(new test([], $materialTableData, $bundleTableData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send to InvoiceMail recipients (all three tables)
|
||||||
|
if ($mailRules->has('InvoiceMail')) {
|
||||||
|
$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//$this->info(json_encode($materialTableData));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
133
app/Console/Commands/SendProductionReport.php
Normal file
133
app/Console/Commands/SendProductionReport.php
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\InvoiceValidation;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\ProductionMail;
|
||||||
|
use App\Models\Line;
|
||||||
|
use App\Models\ProductionQuantity;
|
||||||
|
|
||||||
|
class SendProductionReport extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'send:production-report';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Command description';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$mailRules = \App\Models\AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
|
->where('rule_name', 'ProductionMail')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$emails = $mailRules->pluck('email')->unique()->toArray();
|
||||||
|
|
||||||
|
$lines = Line::all();
|
||||||
|
$fgLineIds = [];
|
||||||
|
$nonFgLineIds = [];
|
||||||
|
$lineNames = [];
|
||||||
|
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$lineNames[$line->id] = $line->name;
|
||||||
|
if ($line->type == 'FG Line') {
|
||||||
|
$fgLineIds[] = $line->id;
|
||||||
|
} else {
|
||||||
|
$nonFgLineIds[] = $line->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Set date range
|
||||||
|
$startDate = now()->setTime(8, 0, 0);
|
||||||
|
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
|
|
||||||
|
// 3. Get all plants
|
||||||
|
$plants = ProductionQuantity::select('plant_id')->distinct()->pluck('plant_id');
|
||||||
|
|
||||||
|
// 4. Get production quantities for FG and non-FG lines in one go
|
||||||
|
// $fgProduction = ProductionQuantity::select('line_id', \DB::raw('COUNT(*) as total_quantity'))
|
||||||
|
// ->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
// ->whereIn('line_id', $fgLineIds)
|
||||||
|
// ->groupBy('line_id')
|
||||||
|
// ->pluck('total_quantity', 'line_id')
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
$nonFgProduction = ProductionQuantity::select('line_id', \DB::raw('COUNT(*) as total_quantity'))
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->whereIn('line_id', $nonFgLineIds)
|
||||||
|
->groupBy('line_id')
|
||||||
|
->pluck('total_quantity', 'line_id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$tableData = [];
|
||||||
|
$no = 1;
|
||||||
|
|
||||||
|
foreach ($plants as $plantId)
|
||||||
|
{
|
||||||
|
$plant = Plant::find($plantId);
|
||||||
|
$plantName = $plant ? $plant->name : $plantId;
|
||||||
|
|
||||||
|
//Get all unique line_ids for this plant
|
||||||
|
$lineIds = ProductionQuantity::where('plant_id', $plantId)
|
||||||
|
->select('line_id')
|
||||||
|
->distinct()
|
||||||
|
->pluck('line_id');
|
||||||
|
|
||||||
|
foreach ($lineIds as $lineId) {
|
||||||
|
$lineName = $lineNames[$lineId] ?? $lineId;
|
||||||
|
|
||||||
|
$targetQuantity = \App\Models\ProductionPlan::where('plant_id', $plantId)
|
||||||
|
->where('line_id', $lineId)
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->sum('plan_quantity');
|
||||||
|
|
||||||
|
// Use the correct production quantity array based on line type
|
||||||
|
if (in_array($lineId, $nonFgLineIds))
|
||||||
|
{
|
||||||
|
$productionQuantity = $nonFgProduction[$lineId] ?? 0;
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $productionQuantity = $nonFgProduction[$lineId] ?? 0;
|
||||||
|
// }
|
||||||
|
$tableData[] = [
|
||||||
|
'no' => $no++,
|
||||||
|
'plant' => $plantName,
|
||||||
|
'line' => $lineName,
|
||||||
|
'targetQuantity' => $targetQuantity,
|
||||||
|
'productionQuantity' => $productionQuantity,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$this->info(json_encode($tableData));
|
||||||
|
|
||||||
|
if (!empty($emails))
|
||||||
|
{
|
||||||
|
// Mail::to($emails)->send(new test($tableData));
|
||||||
|
// $this->info('Invoice report email sent successfully to: ' . implode(', ', $emails));
|
||||||
|
foreach ($emails as $email)
|
||||||
|
{
|
||||||
|
Mail::to($email)->send(new ProductionMail($tableData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->info('No recipients found for InvoiceMailAlert.');
|
||||||
|
}
|
||||||
|
//$this->info(implode(', ', $emails));
|
||||||
|
}
|
||||||
|
}
|
||||||
61
app/Mail/ProductionMail.php
Normal file
61
app/Mail/ProductionMail.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?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 ProductionMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $tableData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct($tableData = [])
|
||||||
|
{
|
||||||
|
$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,",
|
||||||
|
'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 [];
|
||||||
|
}
|
||||||
|
}
|
||||||
77
app/Mail/test.php
Normal file
77
app/Mail/test.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
// public function __construct($tableData = [])
|
||||||
|
// {
|
||||||
|
// $this->tableData = $tableData ?? [];
|
||||||
|
// }
|
||||||
|
public function __construct($serialTableData, $materialTableData, $bundleTableData)
|
||||||
|
{
|
||||||
|
$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: [
|
||||||
|
// 'name' => "CRI Digital Manufacturing Solutions<br><br>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,
|
||||||
|
// 'wishes' => "Thanks & Regards<br><br>CRI Digital Manufacturing Solutions"
|
||||||
|
// ],
|
||||||
|
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"
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
82
resources/views/mail/production_report.blade.php
Normal file
82
resources/views/mail/production_report.blade.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Invoice Table</title>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #444;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{-- <h5>{{ $name }}</h5> --}}
|
||||||
|
{{-- <h5>{!! $name !!}</h5> --}}
|
||||||
|
<div style="text-align: center; font-weight: bold;">
|
||||||
|
{{ $company }}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<p>{!! $greeting !!}</p>
|
||||||
|
{{-- <table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">No</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Plant</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Line</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Target Quantity</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Production Quantity</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tableData as $row)
|
||||||
|
{{-- <tr>
|
||||||
|
<td>{{ $row['no'] }}</td>
|
||||||
|
<td>{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr> --}}
|
||||||
|
{{-- <tr>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['no'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['line'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['targetQuantity'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['productionQuantity'] }}</td> --}}
|
||||||
|
{{-- <td style="border: 1px solid #444; padding: 8px; text-align: center;"></td> --}}
|
||||||
|
{{-- </tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table> --}}
|
||||||
|
<table style="table-layout: auto; width: 100%; border-collapse: collapse;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">No</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2; white-space: nowrap;">Plant</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2; white-space: nowrap;">Line</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Target Quantity</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Production Quantity</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['no'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['line'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['targetQuantity'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['productionQuantity'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>{!! $wishes !!}</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
169
resources/views/mail/test_mail.blade.php
Normal file
169
resources/views/mail/test_mail.blade.php
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
{{-- {{ $name }} --}}
|
||||||
|
|
||||||
|
{{-- <!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Invoice Table</title>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #444;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{-- <h5>{{ $name }}</h5> --}}
|
||||||
|
{{-- <h5>{!! $name !!}</h5> --}}
|
||||||
|
{{-- <div style="text-align: center; font-weight: bold;">
|
||||||
|
{{ $company }}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<h5>{!! $greeting !!}</h5>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">No</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Plant</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Total Number Of Invoice</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Scanned Number Of Invoice</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tableData as $row) --}}
|
||||||
|
{{-- <tr>
|
||||||
|
<td>{{ $row['no'] }}</td>
|
||||||
|
<td>{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr> --}}
|
||||||
|
{{-- <tr>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['no'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h5>{!! $wishes !!}</h5>
|
||||||
|
</body>
|
||||||
|
</html> --}}
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Invoice Tables</title>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 60%;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #444;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="text-align: center; font-weight: bold;">
|
||||||
|
{{ $company }}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<p>{!! $greeting !!}</p>
|
||||||
|
|
||||||
|
{{-- Serial Invoice Table --}}
|
||||||
|
@if(!empty($serialTableData))
|
||||||
|
<h4>Serial Invoice</h4>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Plant</th>
|
||||||
|
<th>Total Number of Invoice</th>
|
||||||
|
<th>Scanned Number of Invoice</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($serialTableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $row['no'] }}</td>
|
||||||
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{-- Material Invoice Table --}}
|
||||||
|
@if(!empty($materialTableData))
|
||||||
|
<h4>Material Invoice</h4>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Plant</th>
|
||||||
|
<th>Total Number of Invoice</th>
|
||||||
|
<th>Scanned Number of Invoice</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($materialTableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $row['no'] }}</td>
|
||||||
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{-- Bundle Invoice Table --}}
|
||||||
|
@if(!empty($bundleTableData))
|
||||||
|
<h4>Bundle Invoice</h4>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Plant</th>
|
||||||
|
<th>Total Number of Invoice</th>
|
||||||
|
<th>Scanned Number of Invoice</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($bundleTableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $row['no'] }}</td>
|
||||||
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
<p>{!! $wishes !!}</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Artisan::command('inspire', function () {
|
||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
|
Schedule::command('send:invoice-report');
|
||||||
|
Schedule::command('send:production-report');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user