Add SendInvoiceDataReport command and InvoiceDataMail class with HTML view for invoice data reporting

This commit is contained in:
dhanabalan
2025-11-02 16:33:12 +05:30
parent 4f51643254
commit 9f38cda857
4 changed files with 432 additions and 2 deletions

View File

@@ -12,12 +12,16 @@ Artisan::command('inspire', function () {
// Schedule::command('send:invoice-report');
// Schedule::command('send:production-report');
app()->booted(function () {
$schedule = app(Schedule::class);
// Production report scheduling
//$schedule->command('report:send-daily-production')->dailyAt('07:59');
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
//Production report scheduling
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->select('plant', 'schedule_type')
->select('plant', 'schedule_type')
@@ -67,6 +71,31 @@ Artisan::command('inspire', function () {
break;
}
}
//Invoice Data report scheduling
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceValidation')
->select('plant', 'schedule_type')
->distinct()
->get();
foreach ($invoiceDataRules as $rule) {
$type = $rule->schedule_type;
$plantId = $rule->plant;
$command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
switch ($type) {
case 'Live':
$command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
}
}
});