Projectreportdetail Documentation
Project Detailed Financial Report Controller Documentation
File: /controllers/projectreportControllerdetail.php
Purpose: Generate comprehensive financial analysis with detailed breakdowns for individual projects
Last Updated: 2024-12-20
---
๐ Overview
Primary Functions
- โ Detailed project financial analysis
- โ Client payment breakdown
- โ Income stream analysis
- โ Expense categorization
- โ Material cost tracking
- โ Profit/loss calculation with supervision fees
Related Controllers
- โข projectReportController.php - Basic project reports
- โข projectController.php - Project master data
---
๐๏ธ Database Tables
Primary Tables
All tables from projectReportController.php plus detailed material breakdowns
---
๐ง Key Functions
1. Financial Analysis Engine
Purpose: Comprehensive financial breakdown with detailed material tracking
Business Logic:
Client Payments Analysis:
$clientdebtchangeData = R::getAll("SELECT * FROM clientdebtchange WHERE clientdebtchange.del = 0 and paySerialNo > 0 and clientdebtchange.clientid = $projectData->clientid");
$clientdebtchangeamount = R::getCell("SELECT sum(clientdebtchangeamount) FROM clientdebtchange WHERE clientdebtchange.del = 0 and paySerialNo > 0 and clientdebtchange.clientid = $projectData->clientid");
$clientdebtchangeamountint = abs($clientdebtchangeamount);
Income Analysis:
$incomeData = R::getAll("SELECT * FROM `income` left join incometype on income.incomeTypeId = incometype.incomeTypeId WHERE income.conditions = 0 and income.costcenterid = $projectData->costcenterid");
$allincomeValue = R::getCell("SELECT sum(incomeValue) FROM `income` left join incometype on income.incomeTypeId = incometype.incomeTypeId WHERE income.conditions = 0 and income.costcenterid = $projectData->costcenterid");
Material Cost Analysis:
$projectexchmaterial = R::findAll('projectexchmaterial'," WHERE projectexchmaterial.projectid = $projectId");
foreach($projectexchmaterial as $projecte) {
$projectepro = R::getAll("SELECT * FROM projectexchmaterialdetail left join product on projectexchmaterialdetail.productId = product.productId WHERE projectexchmaterialdetail.projectexchid = $projecte->id");
$projecte->proname = $projectepro;
}
$projectexchmaterialtotal = R::getRow("SELECT sum(totalbuyprice) as totals, sum(finalsupervision) as finalsupervisions FROM projectexchmaterial WHERE projectexchmaterial.projectid = $projectId");
Supervision Fee Calculation:
$finalsupervisions = ($sumexpenseexchanges['finalsupervisions'] + $projectexchmaterialtotal['finalsupervisions']) - $projectexchmaterialreturntotal['finalsupervisions'];
Final Position Calculation:
$proMasrofat = $clientdebtchangeamountint + $allincomeValue;
$clientPaids = $projectexchmaterialtotal['totals'] - $projectexchmaterialreturntotal['totals'] + $allexpensesValue + $allsupplierdebtchangeamount + $finalsupervisions;
$operation = abs($clientPaids) - $proMasrofat;
if($proMasrofat < abs($clientPaids)) {
$txt = 'ุตุงูู ู
ุฏููููุฉ'; // Net Debt
} else {
$txt = 'ุตุงูู ุฑุตูุฏ'; // Net Credit
}
---
๐ Financial Components
Revenue Streams
1. Client Payments: Direct payments with serial numbers
2. Project Income: Additional income by cost center
3. Total Revenue: Sum of all income sources
Cost Components
1. Material Costs: Net materials (issued - returned)
2. Direct Expenses: Operating expenses by cost center
3. Supervision Fees: Project management fees
4. Total Costs: Sum of all project costs
Financial Position Analysis
Total Revenue = Client Payments + Project Income
Total Costs = Material Costs + Expenses + Supervision
Net Position = |Total Costs| - Total Revenue
If Revenue > Costs: Net Credit Balance
If Costs > Revenue: Net Debt Position
---
๐ฏ URL Routes & Actions
| Action (`?do=`) | Method | Description | View Template |
|---|---|---|---|
| (empty) | GET/POST | Generate detailed financial report | reportdetail.html |
๐ Notes
Important Features
- โข Detailed material breakdown with product names
- โข Supervision fee tracking and calculation
- โข Multi-currency support indicators
- โข Complete audit trail integration
- โข Real-time financial position calculation
Report Components Displayed
- โข Client payment history with details
- โข Income streams by type
- โข Material issues with product breakdown
- โข Material returns with impact calculation
- โข Expense categorization
- โข Supervision fee analysis
- โข Net financial position
---