resolved logic invoice report
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user