diff --git a/VERSION b/VERSION index 7658c64..921648e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.134 \ No newline at end of file +1.3.135 \ No newline at end of file diff --git a/app/customers/frontend/customer_detail.html b/app/customers/frontend/customer_detail.html index c8b5796..49090d2 100644 --- a/app/customers/frontend/customer_detail.html +++ b/app/customers/frontend/customer_detail.html @@ -507,6 +507,19 @@ + +
| Ingen produkter matcher søgningen | '; + tableBody.appendChild(noResultsRow); + } + } else { + const noResultsRow = document.getElementById('matrixNoResults'); + if (noResultsRow) { + noResultsRow.remove(); + } + } +} + +/** + * Clear matrix search filter + */ +function clearMatrixSearch() { + const searchInput = document.getElementById('matrixSearchInput'); + searchInput.value = ''; + filterMatrixProducts(); + searchInput.focus(); +} + // Auto-load matrix when subscriptions tab is shown document.addEventListener('DOMContentLoaded', () => { const subscriptionsTab = document.querySelector('a[href="#subscriptions"]'); diff --git a/app/services/economic_service.py b/app/services/economic_service.py index 3924935..5ebbbbf 100644 --- a/app/services/economic_service.py +++ b/app/services/economic_service.py @@ -9,6 +9,7 @@ Send invoices and supplier invoices (kassekladde) to e-conomic accounting system import logging import aiohttp import json +from datetime import datetime, timedelta from typing import Dict, Optional, List from app.core.config import settings @@ -439,16 +440,20 @@ class EconomicService: async def get_customer_invoices(self, customer_number: int, include_lines: bool = True) -> List[Dict]: """ - Get customer invoices (sales invoices) from e-conomic + Get customer invoices (sales invoices) from e-conomic (last 1 year only) Args: customer_number: e-conomic customer number include_lines: Whether to include invoice lines (adds more API calls but gets full data) Returns: - List of invoice records with lines + List of invoice records with lines from the last year """ try: + # Calculate date 1 year ago + one_year_ago = (datetime.now() - timedelta(days=365)).strftime('%Y-%m-%d') + logger.info(f"📅 Fetching invoices from {one_year_ago} onwards (1 year filter)") + async with aiohttp.ClientSession() as session: # Try multiple endpoints to find invoices # Include drafts, paid, unpaid, booked, sent, archived, etc. @@ -475,7 +480,11 @@ class EconomicService: while True: async with session.get( endpoint, - params={"pagesize": 1000, "skippages": page}, + params={ + "pagesize": 1000, + "skippages": page, + "filter": f"date$gte:{one_year_ago}" + }, headers=self._get_headers() ) as response: logger.info(f"🔍 [API] Response status from {endpoint} (page {page}): {response.status}")