10 Commits

Author SHA1 Message Date
2a3946e956 Update dependency laravel/framework to v12
Some checks failed
renovate/artifacts Artifact file update failure
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 9s
Gemini PR Review / review (pull_request) Failing after 38s
Laravel Pint / pint (pull_request) Failing after 1m26s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 1m39s
2025-11-30 00:00:58 +00:00
e20915ca82 Merge pull request 'Refactor content method in InvoiceDataMail to use null-safe operator for document_date check' (#29) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #29
2025-11-29 12:58:25 +00:00
dhanabalan
5f4494f5aa Refactor content method in InvoiceDataMail to use null-safe operator for document_date check
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Larastan / larastan (pull_request) Failing after 2m44s
Laravel Pint / pint (pull_request) Failing after 2m34s
2025-11-29 18:27:56 +05:30
58e6cbfac0 Merge pull request 'Added proper imports for mail' (#28) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #28
2025-11-29 12:57:53 +00:00
dhanabalan
9fa73b2ecc Added proper imports for mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Failing after 2m19s
Laravel Larastan / larastan (pull_request) Failing after 2m39s
2025-11-29 18:27:23 +05:30
1ace049687 Merge pull request 'Uncommented the mail schedule logic' (#27) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #27
2025-11-29 12:33:52 +00:00
dhanabalan
d75d435456 Uncommented the mail schedule logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Larastan / larastan (pull_request) Failing after 2m1s
Laravel Pint / pint (pull_request) Failing after 2m0s
Gemini PR Review / review (pull_request) Failing after 26s
2025-11-29 18:02:25 +05:30
e5e85a8eea Merge pull request 'ranjith-dev' (#26) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #26
2025-11-29 12:28:01 +00:00
dhanabalan
ff8aa8b536 Update startDate logic in InvoiceDataMail content method to handle null document_date
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m7s
2025-11-29 17:54:12 +05:30
dhanabalan
53f0a7bfdf Refactor InvoiceDataMail class for improved readability and consistency and __construct arg passing $tableData instead of $tableData = []
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2025-11-29 17:37:16 +05:30
3 changed files with 87 additions and 88 deletions

View File

@@ -2,13 +2,13 @@
namespace App\Mail; namespace App\Mail;
use App\Models\InvoiceDataValidation;
use DateTime;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope; use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use DateTime;
class InvoiceDataMail extends Mailable class InvoiceDataMail extends Mailable
{ {
@@ -23,7 +23,7 @@ class InvoiceDataMail extends Mailable
/** /**
* Create a new message instance. * Create a new message instance.
*/ */
public function __construct($scheduleType, $tableData = [], $mailSubject) public function __construct($scheduleType, $tableData, $mailSubject)
{ {
$this->scheduleType = $scheduleType; $this->scheduleType = $scheduleType;
$this->tableData = $tableData ?? []; $this->tableData = $tableData ?? [];
@@ -48,17 +48,19 @@ class InvoiceDataMail extends Mailable
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"'; $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') { if ($this->scheduleType == 'Daily') {
$firstRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'asc')->first(); $firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
//$lastRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'desc')->first();
if ($firstRecord) { $startDate = null;
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay(); $startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
//$endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay(); // $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
} else {
$startDate = now()->subDay()->setTime(10, 0, 0);
} }
$endDate = now()->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 // $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 // $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."; $reportPeriod = "from: $startDate to $endDate\".<br><br>Please arrange to despatch the same immediately.";
$greeting .= $reportPeriod; $greeting .= $reportPeriod;
} }
@@ -74,17 +76,17 @@ class InvoiceDataMail extends Mailable
if ($this->scheduleType == 'Live') { if ($this->scheduleType == 'Live') {
$now = now(); $now = now();
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s'); $fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
$toMinute = $now->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."; $greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to despatch the same immediately.";
} }
return new Content( return new Content(
view: 'mail.invoice_data_report', view: 'mail.invoice_data_report',
with: [ with: [
'company' => "CRI Digital Manufacturing Solutions", 'company' => 'CRI Digital Manufacturing Solutions',
'greeting' => $greeting, 'greeting' => $greeting,
'tableData' => $this->tableData, 'tableData' => $this->tableData,
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions" 'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
], ],
); );
} }

View File

@@ -13,7 +13,7 @@
"filament/filament": "^3.3", "filament/filament": "^3.3",
"intervention/image": "^3.11", "intervention/image": "^3.11",
"irazasyed/telegram-bot-sdk": "^3.15", "irazasyed/telegram-bot-sdk": "^3.15",
"laravel/framework": "^11.31", "laravel/framework": "^12.0",
"laravel/sanctum": "^4.0", "laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9", "laravel/tinker": "^2.9",
"league/flysystem-sftp-v3": "^3.30", "league/flysystem-sftp-v3": "^3.30",

View File

@@ -1,10 +1,11 @@
<?php <?php
use App\Models\AlertMailRule;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Inspiring; use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema; use App\Models\AlertMailRule;
use Illuminate\Console\Scheduling\Schedule;
Artisan::command('inspire', function () { Artisan::command('inspire', function () {
$this->comment(Inspiring::quote()); $this->comment(Inspiring::quote());
@@ -13,88 +14,84 @@ Artisan::command('inspire', function () {
// Schedule::command('send:invoice-report'); // Schedule::command('send:invoice-report');
// Schedule::command('send:production-report'); // Schedule::command('send:production-report');
// app()->booted(function () { app()->booted(function () {
// $schedule = app(Schedule::class); $schedule = app(Schedule::class);
// // $schedule->command('report:send-daily-production')->dailyAt('07:59'); // $schedule->command('report:send-daily-production')->dailyAt('07:59');
// Production report scheduling
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->select('plant', 'schedule_type')
->distinct()
->get();
// if (Schema::hasTable('alert_mail_rules')) { foreach ($productionRules as $rule) {
$type = $rule->schedule_type;
$plantId = $rule->plant;
// // Production report scheduling $command = $schedule->command('send:production-report', [$type, $plantId]);
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities') // ->appendOutputTo(storage_path('logs/scheduler.log'));
// ->where('rule_name', 'ProductionMail')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($productionRules as $rule) { switch ($type) {
// $type = $rule->schedule_type; case 'Live':
// $plantId = $rule->plant; $command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
}
}
// $command = $schedule->command('send:production-report', [$type, $plantId]); // Invoice report scheduling
// // ->appendOutputTo(storage_path('logs/scheduler.log')); $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
->select('plant', 'schedule_type')
->distinct()
->get();
// switch ($type) { foreach ($invoiceRules as $rule) {
// case 'Live': $type = $rule->schedule_type;
// $command->everyMinute(); $plantId = $rule->plant;
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('07:59');
// break;
// }
// }
// // Invoice report scheduling $command = $schedule->command('send:invoice-report', [$type, $plantId]);
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($invoiceRules as $rule) { switch ($type) {
// $type = $rule->schedule_type; case 'Live':
// $plantId = $rule->plant; $command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
}
}
// $command = $schedule->command('send:invoice-report', [$type, $plantId]); // Invoice Data Report Scheduling
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
->select('plant', 'schedule_type')
->distinct()
->get();
// switch ($type) { foreach ($invoiceDataRules as $rule) {
// case 'Live': $type = $rule->schedule_type;
// $command->everyMinute(); $plantId = $rule->plant;
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('07:59');
// break;
// }
// }
// // Invoice Data Report Scheduling $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
// ->select('plant', 'schedule_type')
// ->distinct()
// ->get();
// foreach ($invoiceDataRules as $rule) { switch ($type) {
// $type = $rule->schedule_type; case 'Live':
// $plantId = $rule->plant; $command->everyMinute();
break;
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]); case 'Hourly':
$command->hourly();
// switch ($type) { break;
// case 'Live': case 'Daily':
// $command->everyMinute(); $command->dailyAt('10:00');
// break; break;
// case 'Hourly': }
// $command->hourly(); }
// break; });
// case 'Daily':
// $command->dailyAt('10:00');
// break;
// }
// }
// }
// });