1
0
forked from poc/pds

resolved logic invoice report

This commit is contained in:
dhanabalan
2025-07-10 17:46:34 +05:30
parent 6a8978f676
commit b73202e03f
2 changed files with 211 additions and 159 deletions

View File

@@ -12,57 +12,55 @@ Artisan::command('inspire', function () {
// Schedule::command('send:invoice-report');
// Schedule::command('send:production-report');
// app()->booted(function () {
// $schedule = app(Schedule::class);
app()->booted(function () {
$schedule = app(Schedule::class);
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
// ->where('rule_name', 'ProductionMail')
// ->get();
//Production report scheduling
// $types = $productionRules->pluck('schedule_type')->unique();
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->get();
// foreach ($types as $type) {
// $command = $schedule->command("send:production-report", [$type]);
// switch ($type) {
// case 'Live':
// $command->everyMinute();
// break;
// case 'Hourly':
// $command->hourly();
// break;
// case 'Daily':
// $command->dailyAt('07:59');
// break;
// }
// }
// });
foreach ($productionRules as $rule) {
$type = $rule->schedule_type;
$plantId = $rule->plant;
app()->booted(function () {
$schedule = app(Schedule::class);
$command = $schedule->command('send:production-report', [$type, $plantId]);
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->get();
// Loop each mail rule individually (plant + schedule_type)
foreach ($productionRules as $rule) {
$type = $rule->schedule_type;
$plantId = $rule->plant;
$command = $schedule->command('send:production-report', [$type, $plantId]);
switch ($type) {
case 'Live':
$command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
switch ($type) {
case 'Live':
$command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
}
}
}
});
//Invoice report scheduling
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')->get();
foreach ($invoiceRules as $rule) {
$type = $rule->schedule_type;
$plantId = $rule->plant;
$command = $schedule->command('send:invoice-report', [$type, $plantId]);
switch ($type) {
case 'Live':
$command->everyMinute();
break;
case 'Hourly':
$command->hourly();
break;
case 'Daily':
$command->dailyAt('07:59');
break;
}
}
});