Open Orders Report (Excluding Unpaid)
Generate and email a report of open orders (excluding unpaid), grouped by date and postal service, with totals and CSV attachment.
Overview
The RIS-SM-2267 – Open Orders Report (Excluding Unpaid) macro automates reporting of pending orders by generating a structured summary and sending it via email with a CSV attachment.
Schedule this macro daily to maintain consistent visibility of pending orders and workload.
Purpose
This macro:
-
Retrieves open orders excluding unpaid
-
Groups data by date and courier
-
Calculates totals and breakdowns
-
Sends report via email with CSV attachment
👉 In short:
Fetch data → group → calculate → generate report → email.
When It Runs
Typically executed:
-
Daily scheduled reporting
-
Before warehouse processing
-
Operations monitoring
-
Management reporting
-
Pending workload tracking
-
Manually or via automation
Parameters
Recipient email address(es).
CC email address(es).
Example:
toemail = "ops@company.com"
emailCC = "manager@company.com"
Simple Explanation
The macro retrieves open orders, groups them by date and courier, calculates totals, generates a CSV report, and emails it to stakeholders.
Step-by-Step Flow
Start Macro
Log macro start and initialize execution.
Define Date Range
Set:
Execute SQL Query
Fetch open orders:
Group by date and postal service using pivot.
Process Data
Convert:
Calculate Totals
Compute:
Generate CSV File
Create file:
Prepare Email Body
Include:
Send Email
Send via SMTP:
Attach CSV file and send to recipients.
Cleanup
Delete temporary CSV file after sending email.
Logging
Log data retrieval, file creation, email status, and errors.
Final Result
-
Open order summary report generated
-
CSV file created and attached
-
Date-wise and courier-wise breakdown
-
Email sent to stakeholders
Usefulness
-
Real-Time Visibility – Track pending orders easily
-
Better Planning – Prioritize workload effectively
-
Automation – Remove manual reporting effort
-
Data Insights – Analyze courier and date trends
-
Email Distribution – Share reports instantly
Example Scenario
Key Insight
This macro follows a complete reporting flow:
Fetch Data → Transform → Calculate Totals → Generate Report → Send Email.
It prevents manual errors, lack of visibility, delayed decisions, untracked orders, and poor operational insights.
Last updated today
Built with Documentation.AI