This article gives you an overview of advanced reporting in iVendNext, highlighting tools like custom templates, SQL queries, and Python scripts for deeper, tailored insights.
Use these tools when you need:
✔ Data beyond standard reports (e.g., profit margins by region).
✔ Complex calculations (e.g., inventory turnover ratios).
✔ Automated workflows (e.g., low-stock alerts).
No coding required – Drag-and-drop interface.
Child table support – Pull data from linked tables (e.g., invoice items).
Save & reuse – Create templates for recurring needs.
Navigate to Home > Build > Add Report > Report Builder.
Click New, select "Sales Invoice" as the doctype.
Add fields:
Parent table: Customer Name, Grand Total.
Child table (Invoice Items): Item Code, Qty, Rate.
Apply filters (e.g., "Status = Paid").
Save as "High-Value Sales Report."
Multi-table joins (e.g., sales + inventory data).
Custom aggregations (e.g., average basket size by store).
SELECT
item.item_name,
SUM(invoice_item.amount) AS total_revenue
FROM `tabSales Invoice Item` AS invoice_item
JOIN `tabItem` AS item ON invoice_item.item_code = item.item_code
GROUP BY item.item_name
ORDER BY total_revenue DESC
LIMIT 10;
Steps to Implement:
Navigate to Home > Build > Add Report > Query Report.
Paste the SQL query, test with "Run."
Save as "Top 10 Products by Revenue."
Note: Requires read access to database tables.
Dynamic logic (e.g., apply discounts based on rules).
External integrations (e.g., pull weather data for sales correlation).
def execute(filters=None):
columns = ["Item", "Warehouse", "Qty", "Reorder Level"]
data = frappe.db.sql("""
SELECT item.item_name, bin.warehouse, bin.actual_qty, item.reorder_level
FROM `tabBin` AS bin
JOIN `tabItem` AS item ON bin.item_code = item.item_code
WHERE bin.actual_qty < item.reorder_level
""")
return columns, data
Steps to Implement:
Navigate to Home > Build > Add Report > Script Report.
Enter the Python code, set filters (e.g., warehouse).
Schedule to run daily and email to managers.
🔹 Reuse Scripts – Save frequently used queries as templates.
🔹 Limit Data – Use filters to avoid slow performance.
🔹 Test Safely – Run scripts in development mode first.
Warning: Always back up data before running write-access scripts.