Accounts Receivables
Overview
The Accounts Receivables feature in the system is designed to manage and report on the financial status of students. This feature provides details about the total number of students, the total amount of outstanding fees, the total amount paid, and detailed information about each student's financial status.
Components and Flow
-
API Endpoints:
- Fetch Financial Summary:
- Retrieves a comprehensive financial summary, including the total number of students, total outstanding fees, total fees paid, and individual student details.
- Method: GET
- Endpoint:
/finance/receivables/summary
- Fetch Financial Summary:
-
Database Models:
- Students Table:
- Stores information about students, including their status, current program level, registration number, payments, and user details.
- Program Levels Table:
- Stores information about different program levels, including fees per semester.
- Payments Table:
- Stores information about payments made by students.
- Semesters Table:
- Stores information about semesters, including the current semester status.
- Financial Statements Table:
- Stores financial statements for students, including balances and other financial details.
- Students Table:
-
Implementation Details:
-
Calculate Financial Summary:
- Fetches the total number of active students.
- Retrieves the total fees per semester for all students and other necessary details.
- For each student:
- Calculates the total fees per semester based on the student's current program level.
- Calculates the total amount paid by the student.
- Retrieves the latest financial statement for the current semester to determine the remaining balance.
- If no financial statement is found, the remaining balance is assumed to be the total fees per semester.
- Calculates the total outstanding fees.
- Converts amounts from milli-units to standard units.
- Returns the financial summary.
-
AccountReceivable Component:
- Displays the financial summary, including total students, total outstanding fees, total fees paid, and detailed student accounts.
- Allows filtering and sorting of student accounts by name, balance, and registration number.
- Uses memoization to optimize performance by recalculating filtered and sorted accounts only when dependencies change.
-
Flow Diagram
Users/Clients
|
+---> API Endpoints
|
+---> Fetch Financial Summary (GET /finance/receivables/summary)
|
+---> Calculate Financial Summary
|
+---> Fetch Total Students from DB
| |
| +---> Students Table
|
+---> Fetch Students Data from DB
| |
| +---> Students Table
| +---> Program Levels Table
| +---> Registration Numbers Table
| +---> Payments Table
| +---> Users Table
|
+---> Process Each Student
| |
| +---> Calculate Total Fees Per Semester
| | |
| | +---> Program Levels Table
| |
| +---> Calculate Total Paid
| | |
| | +---> Payments Table
| |
| +---> Fetch Current Semester
| | |
| | +---> Semesters Table
| |
| +---> Fetch Latest Financial Statement
| | |
| | +---> Financial Statements Table
| |
| +---> Calculate Remaining Balance
|
+---> Calculate Total Outstanding
|
+---> Convert Amounts from Milli-units
|
+---> Return Financial Summary
Components
- AccountReceivable Component:
- Props:
financialSummary: The financial summary object containing total students, total outstanding, total paid, and student details.
- State:
search: The search term for filtering student accounts.sortBy: The criterion for sorting student accounts (balance or registration number).sortOrder: The order of sorting (ascending or descending).
- Memoized Filter and Sort:
- Filters student accounts based on the search term.
- Sorts student accounts based on the selected criterion and order.
- Render:
- Displays the financial summary.
- Provides search and sorting functionality for student accounts.
- Props: