> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled Report Delivery

> ABC Collections schedules a weekly report.

## Real-World Example

ABC Collections schedules a weekly report. On Monday morning, the report job generates the file, sends it by email or SFTP depending on setup, and deletes temporary export files after delivery.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Creditor schedules report"] --> B["Daily, weekly, or monthly command runs"]
    B --> C["Portal generates report file"]
    C --> D{"Delivery method?"}
    D -->|Email| E["Report email is queued"]
    D -->|SFTP| F["Report is uploaded to SFTP"]
    E --> G["Temporary file is cleaned up"]
    F --> G
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,C,E,F,G system;
    class D decision;
    class G outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should run scheduled exports at the configured daily, weekly, or monthly cadence.
* It should deliver files through the selected channel and keep report history traceable.
* It should clean up temporary files after delivery.

## How It Should Not Work

* It should not send a report to the wrong creditor recipient or SFTP destination.
* It should not generate duplicate reports for the same schedule window.
* It should not leave temporary export files indefinitely.

## Developer Notes

* Creditor and CRM report schedules use separate commands but similar delivery services.
* Report delivery is background work even though users configure it in the portal.

## Related App Areas

* `app/Livewire/Creditor/Reports/ScheduleExport/ListPage.php`
* `app/Console/Commands/DailyScheduleExportCommand.php`
* `app/Console/Commands/WeeklyScheduleExportCommand.php`
* `app/Console/Commands/MonthlyScheduleExportCommand.php`
* `app/Jobs/SendScheduleExportEmailJob.php`
* `app/Jobs/PutScheduleExportOnSftpJob.php`
* `app/Jobs/DeleteScheduleExportFileJob.php`
