PDF Reports

This commit is contained in:
David Bomba 2024-11-12 17:17:25 +11:00
parent ca8889b207
commit bb5e71dcf6
2 changed files with 16 additions and 5 deletions

View File

@ -76,8 +76,13 @@ class SendToAdmin implements ShouldQueue
$nmo->company = $this->company;
$nmo->settings = $this->company->settings;
$nmo->to_user = $user;
try {
(new NinjaMailerJob($nmo))->handle();
} catch (\Throwable $th) {
nlog("EXCEPTION:: SendToAdmin:: could not email report for" . $th->getMessage());
}
NinjaMailerJob::dispatch($nmo);
}
public function middleware()

View File

@ -120,12 +120,18 @@ class EmailReport
}
$nmo = new NinjaMailerObject();
$nmo->mailable = new DownloadReport($this->scheduler->company, $files);
$nmo->company = $this->scheduler->company;
$nmo->mailable = new DownloadReport($this->scheduler->company->withoutRelations(), $files);
$nmo->company = $this->scheduler->company->withoutRelations();
$nmo->settings = $this->scheduler->company->settings;
$nmo->to_user = $this->scheduler->user;
$nmo->to_user = $this->scheduler->user->withoutRelations();
try {
(new NinjaMailerJob($nmo))->handle();
} catch (\Throwable $th) {
nlog("EXCEPTION:: EmailReport:: could not email report for schdule {$this->scheduler->id} ". $th->getMessage());
}
NinjaMailerJob::dispatch($nmo);
//calculate next run dates;
$this->scheduler->calculateNextRun();