codbex / codbex-olympus

Enterprise Resource Planing
Eclipse Public License 2.0
0 stars 0 forks source link

[Jason] Report budget and expense report #181

Open bob4o-afk opened 2 hours ago

bob4o-afk commented 2 hours ago

Project Overview Report


Project Report Query Configuration

This document provides an explanation of the query logic and configuration used to generate a Project Report with detailed budget and expense calculations.


Purpose

The goal of this report is to provide a detailed financial overview for each project. It calculates:

  1. Total Budget - The sum of all budget allocations for the project.
  2. Total Contingency Reserves - The sum of reserved funds within the project's budget that may be set aside for emergencies or unexpected costs.
  3. Total Expense - The sum of all recorded expenses for the project.
  4. Remaining Budget Without Reserves - The remaining budget after excluding contingency reserves and subtracting expenses.
  5. Remaining Budget With Reserves - The remaining budget including contingency reserves.

Report Breakdown

Data Sources

Logic

  1. Joins:

    • The query joins CODBEX_BUDGET and CODBEX_EXPENSE to the CODBEX_PROJECT table using the PROJECT_ID as the common key.
    • This ensures that all budgets and expenses are associated with their respective projects.
  2. Aggregations:

    • SUM(BUDGET_AMOUNT): Calculates the total budget for each project.
    • SUM(BUDGET_CONTINGENCYRESERVES): Calculates the total contingency reserves for each project.
    • SUM(EXPENSE_AMOUNT): Calculates the total expenses for each project.
  3. Remaining Budget Calculations:

    • Remaining Budget Without Reserves: [ \text{(Total Budget - Total Contingency Reserves - Total Expenses)} ]
    • Remaining Budget With Reserves: [ \text{(Total Budget - Total Expenses)} ]
  4. Handling Null Values:

    • COALESCE is used to handle null values for budgets or expenses. If a project does not have budgets or expenses, the system treats them as 0 to avoid breaking the calculations.
  5. Filtering:

    • The query includes a WHERE condition to filter projects by name using a placeholder parameter (:PROJECT_NAME). This allows dynamic filtering based on user input.
  6. Grouping:

    • The results are grouped by project name (PROJECT_NAME) to ensure accurate calculations for each project individually.
  7. Sorting:

    • The results are sorted alphabetically by project name for ease of navigation.

Columns in the Report

Column Name Description
Project The name of the project.
Total Budget The total allocated budget for the project.
Total Contingency Reserves The portion of the budget set aside for unexpected expenses.
Total Expense The total expenses incurred for the project.
Remaining Budget Without Reserves The remaining budget after excluding contingency reserves and expenses.
Remaining Budget With Reserves The remaining budget including contingency reserves and expenses.

Parameters

Parameter Type Default Value Description
PROJECT_NAME VARCHAR % A filter for project names (e.g., "Project A"). % returns all projects.

This query provides a comprehensive overview of project financials, including dynamic filtering and precise calculations for budgets, reserves, and expenses.

bob4o-afk commented 2 hours ago

Commit - https://github.com/codbex/codbex-projects-reports/commit/12e187e703f0cbcbdbfbfa3ecffd15c5e5190418