ClientProject #2808
openClientProject #2305: [Module] Report
ClientProject #2306: Customer Reports
BE merge customer report to sales executive report
Description
Description
Customer Balance Sheet API
Refactored the customer balance sheet logic into smaller service functions for better maintainability.
Made startDate and endDate query parameters optional. If omitted, the API will return all transactions for the customer.
Only approved sales and payments are now included in the balance calculation and report.
Types for customer balance logic have been moved to a separate file.
Sales Executive Report
The executive sales report now only includes approved sales records.
How to Test
Customer Balance Sheet API
Endpoint : GET /api/reports/customer-balances/v1/balance-sheet
Required Query : customerId
Optional Queries : startDate, endDate (format: YYYY-MM-DD)
Example :
All transactions:
GET /api/reports/customer-balances/v1/balance-sheet?customerId=1
Filtered by date:
GET /api/reports/customer-balances/v1/balance-sheet?customerId=1&startDate=2025-08-01&endDate=2025-08-06
Expected :
Only approved sales and payments are included in the response.
If startDate/endDate are omitted, the full history is returned.
Sales Executive Report
Endpoint: (as previously used)
Expected:
Only approved sales are included in the report.
Test using Postman by sending requests with different combinations of customerId, startDate, and endDate to verify filtering and correctness.