Added production mail and invoice mail report
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
use App\Models\AlertMailRule;
|
use App\Models\AlertMailRule;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Artisan::command('inspire', function () {
|
||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
@@ -11,6 +12,72 @@ Artisan::command('inspire', function () {
|
|||||||
// Schedule::command('send:invoice-report');
|
// Schedule::command('send:invoice-report');
|
||||||
// Schedule::command('send:production-report');
|
// Schedule::command('send:production-report');
|
||||||
|
|
||||||
|
// $rules = [
|
||||||
|
// [
|
||||||
|
// 'module' => 'InvoiceValidation',
|
||||||
|
// 'rule_name' => 'InvoiceMail',
|
||||||
|
// 'argument' => 'InvoiceMail',
|
||||||
|
// ],
|
||||||
|
// [
|
||||||
|
// 'module' => 'InvoiceValidation',
|
||||||
|
// 'rule_name' => 'SerialInvoiceMail',
|
||||||
|
// 'argument' => 'SerialInvoiceMail',
|
||||||
|
// ],
|
||||||
|
// [
|
||||||
|
// 'module' => 'InvoiceValidation',
|
||||||
|
// 'rule_name' => 'MaterialInvoiceMail',
|
||||||
|
// 'argument' => 'MaterialInvoiceMail',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// foreach ($rules as $rule) {
|
||||||
|
// $scheduleType = AlertMailRule::where('module', $rule['module'])
|
||||||
|
// ->where('rule_name', $rule['rule_name'])
|
||||||
|
// ->value('schedule_type');
|
||||||
|
|
||||||
|
// switch ($scheduleType) {
|
||||||
|
// case 'Live':
|
||||||
|
// Schedule::command("send:invoice-report {$rule['argument']}")->everyMinute();
|
||||||
|
// break;
|
||||||
|
// case 'Hourly':
|
||||||
|
// Schedule::command("send:invoice-report {$rule['argument']}")->hourly();
|
||||||
|
// break;
|
||||||
|
// case 'Daily':
|
||||||
|
// Schedule::command("send:invoice-report {$rule['argument']}")->dailyAt('07:59');
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// Schedule::command("send:invoice-report {$rule['argument']}")->hourly();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Production Report Scheduling
|
||||||
|
// $productionScheduleType = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
|
// ->where('rule_name', 'ProductionMail')
|
||||||
|
// ->value('schedule_type');
|
||||||
|
|
||||||
|
// // $this->info($productionScheduleType);
|
||||||
|
// // \Log::info('Production Schedule Type: ' . $productionScheduleType);
|
||||||
|
|
||||||
|
// switch ($productionScheduleType) {
|
||||||
|
// case 'Live':
|
||||||
|
// Schedule::command('send:production-report')->everyMinute();
|
||||||
|
// break;
|
||||||
|
// case 'Hourly':
|
||||||
|
// Schedule::command('send:production-report')->hourly();
|
||||||
|
// break;
|
||||||
|
// case 'Daily':
|
||||||
|
// Schedule::command('send:production-report')->dailyAt('07:59');
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// Schedule::command('send:production-report')->hourly();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
app()->booted(function () {
|
||||||
|
$schedule = app(Schedule::class);
|
||||||
|
|
||||||
|
// Dynamic rules for invoice reports
|
||||||
$rules = [
|
$rules = [
|
||||||
[
|
[
|
||||||
'module' => 'InvoiceValidation',
|
'module' => 'InvoiceValidation',
|
||||||
@@ -36,16 +103,16 @@ foreach ($rules as $rule) {
|
|||||||
|
|
||||||
switch ($scheduleType) {
|
switch ($scheduleType) {
|
||||||
case 'Live':
|
case 'Live':
|
||||||
Schedule::command("send:invoice-report {$rule['argument']}")->everyMinute();
|
$schedule->command("send:invoice-report {$rule['argument']}")->everyMinute();
|
||||||
break;
|
break;
|
||||||
case 'Hourly':
|
case 'Hourly':
|
||||||
Schedule::command("send:invoice-report {$rule['argument']}")->hourly();
|
$schedule->command("send:invoice-report {$rule['argument']}")->hourly();
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
Schedule::command("send:invoice-report {$rule['argument']}")->dailyAt('07:59');
|
$schedule->command("send:invoice-report {$rule['argument']}")->dailyAt('07:59');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Schedule::command("send:invoice-report {$rule['argument']}")->hourly();
|
$schedule->command("send:invoice-report {$rule['argument']}")->hourly();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,16 +124,18 @@ $productionScheduleType = AlertMailRule::where('module', 'ProductionQuantities')
|
|||||||
|
|
||||||
switch ($productionScheduleType) {
|
switch ($productionScheduleType) {
|
||||||
case 'Live':
|
case 'Live':
|
||||||
Schedule::command('send:production-report')->everyMinute();
|
$schedule->command('send:production-report')->everyMinute();
|
||||||
break;
|
break;
|
||||||
case 'Hourly':
|
case 'Hourly':
|
||||||
Schedule::command('send:production-report')->hourly();
|
$schedule->command('send:production-report')->hourly();
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
Schedule::command('send:production-report')->dailyAt('07:59');
|
$schedule->command('send:production-report')->dailyAt('07:59');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Schedule::command('send:production-report')->hourly();
|
$schedule->command('send:production-report')->hourly();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user