Excellent! The SQL is working. Now let's create the PDF output template.

Step 3: Configure the Output Template (HTML → PDF)

In Reporting → Sales by Customer Summary, look for:

3.1. Select Output Format

3.2. Create the HTML Template

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Sales Summary - ${CompanyName}</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 40px;
            color: #333;
        }
        .header {
            border-bottom: 3px solid #2c3e50;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .company-name {
            font-size: 28px;
            font-weight: bold;
            color: #2c3e50;
        }
        .section-title {
            font-size: 18px;
            font-weight: bold;
            color: #2c3e50;
            border-left: 4px solid #3498db;
            padding-left: 10px;
        }
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }
        .metric-box {
            background: #f8f9fa;
            padding: 15px;
            border-left: 4px solid #3498db;
        }
        .metric-label {
            font-size: 12px;
            color: #666;
            text-transform: uppercase;
        }
        .metric-value {
            font-size: 24px;
            font-weight: bold;
            color: #2c3e50;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="company-name">${CompanyName}</div>
        <div>Attn: ${ContactName}</div>
        <div>${City}, ${Country}</div>
    </div>

    <div class="section-title">Sales Performance Summary</div>

    <div class="metrics-grid">
        <div class="metric-box">
            <div class="metric-label">Total Revenue</div>
            <div class="metric-value">${TotalRevenue?string["#,##0.00"]}</div>
        </div>
        <div class="metric-box">
            <div class="metric-label">Total Orders</div>
            <div class="metric-value">${TotalOrders}</div>
        </div>
        <div class="metric-box">
            <div class="metric-label">Average Order Value</div>
            <div class="metric-value">${AvgOrderValue?string["#,##0.00"]}</div>
        </div>
        <div class="metric-box">
            <div class="metric-label">Total Freight</div>
            <div class="metric-value">${TotalFreight?string["#,##0.00"]}</div>
        </div>
    </div>

    <div class="section-title">Customer Relationship Period</div>
    <div>
        <strong>First Order:</strong> ${FirstOrderDate?string["MMM dd, yyyy"]}<br>
        <strong>Most Recent Order:</strong> ${LastOrderDate?string["MMM dd, yyyy"]}
    </div>

    <div class="footer">
        Generated by Northwind Trading Co. | Sales by Customer Summary Report<br>
        Report Date: ${now?string["MMM dd, yyyy HH:mm"]}
    </div>
</body>
</html>

3.3. Test the Template

What do you see when you paste the template and test it? Let me know if the preview looks correct or if you need any adjustments!