diff --git a/pos/static/js/dashboard.js b/pos/static/js/dashboard.js
index c57dcbc..0c0b872 100644
--- a/pos/static/js/dashboard.js
+++ b/pos/static/js/dashboard.js
@@ -453,14 +453,25 @@ const Dashboard = (() => {
days.push(daysAgo(i));
}
- const summaries = await Promise.all(
- days.map(d => apiFetch(`/pos/api/register/daily-summary?date=${d}`))
- );
+ const [summaries, histData] = await Promise.all([
+ Promise.all(days.map(d => apiFetch(`/pos/api/register/daily-summary?date=${d}`))),
+ apiFetch(`/pos/api/historical-sales?date_from=${days[0]}&date_to=${days[6]}&per_page=200`).catch(() => ({ data: [] }))
+ ]);
+
+ // Group historical sales by day
+ const histRows = histData.data || [];
+ const histByDay = {};
+ histRows.forEach(r => {
+ if (!r.sale_date) return;
+ histByDay[r.sale_date] = (histByDay[r.sale_date] || 0) + (r.total || 0);
+ });
let weekTotal = 0;
const dayData = days.map((dateStr, i) => {
const s = summaries[i];
- const total = s ? (s.total_sales || 0) : 0;
+ const normalTotal = s ? (s.total_sales || 0) : 0;
+ const histTotal = histByDay[dateStr] || 0;
+ const total = normalTotal + histTotal;
weekTotal += total;
const d = new Date(dateStr + 'T12:00:00');
return {
diff --git a/pos/templates/dashboard.html b/pos/templates/dashboard.html
index 3334254..6065a56 100644
--- a/pos/templates/dashboard.html
+++ b/pos/templates/dashboard.html
@@ -568,7 +568,7 @@
-
+