Skip to content

email reports

weekly open shift report

Weekly open shift report is 2 reports sent to managers at hospitals.

First part is ‘upcoming shifts for the next wee’. Second part is ‘shifts outside the cancellation window’ (now within the X-day period - 30 or 15).

Files * WeeklyOpenShiftReport (mailable) * weekly-open-shifts-report.blade.php (blade mail template) * ManagerUpcomingOpenShifts * EmailManagerUpcomingOpenShifts * SendManagersUpcomingOpenShifts (job)

Steps * Invoked via kernel scheduling via “core:email-open-shifts” * EmailManagerUpcomingOpenShifts job is dispatched * EmailManagerUpcomingOpenShifts::email (action file) is invoked for each site * The email() method invokes WeeklyOpenShiftReport() and mails to the manager

Notes:

Banfield was included in these, but needed to be excluded because the email report calculated and referred to ‘30 day’ cancellation policy.

These were shut off via the ‘options’ table on production (key ‘feature-email-open-shifts’).

Code was modified to split pulling sites with and without ‘banfield’ in their name and processing separately.

config/core.php

    'weekly_open_report' => [
        'send_to_banfield' => true,
        'banfield_cancel_date_range' => \App\Mail\Manager\WeeklyOpenShiftReport::DAY_RANGE_BANFIELD,
        'nonbanfield_cancel_date_range' => \App\Mail\Manager\WeeklyOpenShiftReport::DAY_RANGE_DEFAULT,
    ]

If send_to_banfield is false, only sites related to customers with ‘banfield’ in the company_name of customer record are emailed, and the weeklyOpenShiftReport is invoked with nonbanfield_cancel_date_range (30) as a paramter, to look for shifts within the 30 day window (and 30 is passed to the mail template for rendering).

If send_to_banfield is true, sites related to customers with banfield in the name are processed separately, and the banfield_cancel_date_range (15 days) is used for the report and mail.

Longer term, we need a better way to define and manage options at customer and site level, but this works for now.