<% // ✅ active aus view setzen (view kommt vom Controller) let active = "sales_year"; if (view === "quarter") active = "sales_quarter"; if (view === "month") active = "sales_month"; if (view === "patient") active = "sales_patient"; if (view === "year") active = "sales_year"; %>
<%- include("../partials/invoice_sidebar", { active, t }) %>
<% if (view === "year") { %>
<%= t.adminInvoice.annualSales %>
<% if (yearly.length === 0) { %> <% } %> <% yearly.forEach(y => { %> <% }) %>
<%= t.global.year %>
Keine Daten
<%= y.year %> <%= Number(y.total).toFixed(2) %>
<% } else if (view === "quarter") { %>
<%= t.adminInvoice.quarterlySales %>
<% if (quarterly.length === 0) { %> <% } %> <% quarterly.forEach(q => { %> <% }) %>
<%= t.global.year %> Q
Keine Daten
<%= q.year %> Q<%= q.quarter %> <%= Number(q.total).toFixed(2) %>
<% } else if (view === "month") { %>
<%= t.adminInvoice.monthSales %>
<% if (monthly.length === 0) { %> <% } %> <% monthly.forEach(m => { %> <% }) %>
<%= t.global.month %>
Keine Daten
<%= m.month %> <%= Number(m.total).toFixed(2) %>
<% } else if (view === "patient") { %>
<%= t.adminInvoice.patientsSales %>
<%= t.global.reset %>
<% if (patients.length === 0) { %> <% } %> <% patients.forEach(p => { %> <% }) %>
<%= t.adminInvoice.patient %>
Keine Daten
<%= p.patient %> <%= Number(p.total).toFixed(2) %>
<% } %>