Module — Grant¶
Financial master data and budget management. It owns donor-funded Projects (with extensions, places, programmes and donors), the Master Budget and its monthly detail lines, project Budget Lines (procurement and personnel), staff cost Allocations across budget lines and donors, and the donor / global Exchange Rates that the whole system uses for currency conversion.
Source: NKO.Main/NKO.Main/Controllers/{MasterBudget,BudgetLines,Allocations,ExchangeRate,Project}Controller.cs,
NKO.Main/NKO.Main/BAL/{BMasterBudget,BBudgetLinesCategory,BExchangeRate,BDonor,BProject,AllocationHandler,BudgetLinesHandler,ProcBudgetLineHandler}.cs.
Purpose & scope¶
- In scope: Projects and their satellites, the Master Budget → monthly detail, Budget Lines and their payment schedules, salary Allocations, donor and global Exchange Rates, and the aggregation that rolls procurement and payroll spend back up against a budget.
- Out of scope: raising purchase documents (Procurement) and running payroll (Payroll) — Grant provides the budget lines and rates those modules charge against.
- Database:
NKO_DB(core), contextNKO_DBEntities1.
Key features¶
- Projects — CRUD with places / donors / programmes / attachments (S3); manager roles (Program /
Finance / Logistic / HR / Compliance) and segregation-of-duty fields (
Sod1–4,FinanceSod1); currency and exchange rate; contract number; warehouse activation; extensions (cost / no-cost, amount, dates, code); monthly amounts; a status (ProjectStatus); validity = end date (or an active extension) ≥ today; focal-point notifications on create / update; a per-project allocations screen; export by month / year. - Master Budget — a header (start / end / notes) plus detail lines (category, place, quantity,
amount, dates) auto-split into monthly rows (pro-rata by day / 30); month edit (budget vs. real
amount); Excel import / export of detail lines; the "AllocationBase", "FullMasterBudget" and
"AllocationCosts" analytical views;
GetDifferenceAmount/GetConsumedAmount(budget − real). - Budget Lines — per project;
Type= Procurement / Personnel / Both; procurement lines carryCode / Title / Qty / Duration / LOE / Amount / OtherDeductions / UnitId / CategoryId / MasterBudgetDetailId; personnel lines carry aPositionId+ assigned users and generate monthlyBudgetLinePaymentrows; "ProcBudgetLines" and "Employees" views; a budget report aggregating PR / PO / PTO spend; import / export; aBudgetLinesCategorylookup. - Allocations — create / edit / delete
AppUserAllocation; a per-employeeAllocatescreen (LOE % per budget line, donor-based FX conversion to USD / EUR); aSalaryroll-up; budget-line search per project. - Exchange Rates — the single global
ExchangeRatesrow (EURRate/SYPRate/TRYRate, with an external fetch fromdata.fixer.io, base TRY — written but never called, R7-17) and per-donorDonorExchangeRate(year, month, USD, EUR) CRUD under a donor.
Screens¶
Route = /{Controller}/{Action}; primary screens only.
ProjectController — /Project/*¶
| Feature | Route | View | Permission key |
|---|---|---|---|
| Projects list | / |
Project/ |
Project |
| Project detail | / |
Details. |
Project |
| Create / edit | /, / |
Create., Edit. |
Project, Project |
| Extensions | /, / |
_Add |
Project, Project |
| Monthly amounts | / |
_Edit |
Project |
| Per-project allocations | / |
Allocations. |
Project |
| Export | / |
Export. |
Project |
MasterBudgetController — /MasterBudget/*¶
| Feature | Route | View | Permission key |
|---|---|---|---|
| Master budgets list | / |
Master |
Master |
| Detail (lines) | / |
Details. |
Master |
| Monthly split | / |
Month |
Master |
| Create budget / detail line / month rows | /, /, / |
Create., _Create*. |
Master |
| Analytical views | /, /, / |
*. |
Master / Master |
| Import / export detail lines | /, / |
_Import |
Master / Master |
BudgetLinesController — /BudgetLines/*¶
| Feature | Route | View | Permission key |
|---|---|---|---|
| Budget-lines grid | / |
Budget |
Budget |
| Procurement budget-line consumption | / |
Proc |
Budget |
| Personnel allocation coverage | / |
Employees. |
Budget |
| Detail | / |
Details. |
Budget |
| Create / edit / delete | /, /, / |
Create/ |
Budget, Budget |
| Import / export | /, / |
_Import. |
Budget, Budget |
AllocationsController — /Allocations/* · ExchangeRateController — /ExchangeRate/*¶
| Feature | Route | View | Permission key |
|---|---|---|---|
| Allocations list / detail / create / edit / delete | /, /, /, /, / |
Allocations/ |
Allocations |
| Per-employee allocate (LOE split) | / |
Allocate. |
Allocations |
| Salary roll-up | / |
Salary. |
Allocations |
| Donor list | / |
Exchange |
Exchange |
| Per-month USD/EUR rate table for a donor | / |
Exchange |
Exchange |
| Create / edit / delete a donor rate | /, / |
_*Exchange |
Exchange |
Business logic¶
| Class | File | Responsibility & notable logic |
|---|---|---|
BProject |
NKO. (~725 ln) |
Create — parses Reference from the segment of Project after the last -; builds Project / Project / Project; uploads attachments to S3; notifies Get + e-mail. Edit — removes & re-adds the satellites, copies the manager & SOD fields. Add / Edit / Edit. Validity queries: Get (end ≥ now OR an extension covering today), Get (Status & within dates), Get. Authorisation: Get over App. Remove soft-deletes the project and cascades to its Budget. |
BMaster |
NKO. (~470 ln) |
Create → Calculate → one Master per month (full calendar month → amount; partial → amount /). Edit regenerates the month rows (resets Real to 0). Get = Σ month.; Get = Σ month.. |
Allocation |
NKO. (~400 ln; contract IAllocation) |
Add / Calculate(model, — reject if Σ LOE > 100; wipe the user's month allocations; get their Payroll; per line ratio = payroll; look up Donor (donor + month + year) → Salary, …EURO = ratio × Exchange; write App. A missing rate → Allocation. Get — per user aggregate budgetline. (salary) and × Benefit (benefit). |
Proc |
NKO. (~800 ln; contract IProc — wired to Budget) |
The procurement ↔ finance bridge. Add — creates a Budget; for non-procurement types attaches Budget and calls Create. Create — monthly split (partial month amount /) → Budget. Budget — recomputes Master (rolls line spend into the master budget). Budget — per line: Accepted PR (Materials.), Accepted PO (Purchase), Accepted / Paid Payment Orders. Reallocate(month, — regenerates App for every payroll user (LOE-capped so cumulative ≤ 100; ratio = salary × current; Donor conversion; leftover < goes onto hard-coded Budget). Called by BPayroll.. |
Budget |
NKO. (~730 ln; contract IBudget) |
The older personnel-oriented variant, still injected into Allocation. Add / Update; Create (same monthly pro-rata); Calc — Consumed; day-accurate Get / Get with a leap-aware month table. |
BExchange |
NKO. |
Get — HTTP GET data.. Get() — the single Exchange row where Is. |
BDonor, BBudget |
NKO. |
Donor + Donor CRUD (Get, Add, Edit); Budget CRUD (description-only edit). |
Known code issues (advisory — see Recommendations)
BExchangeRate.Update reassigns each field to itself, so a rate edit currently saves nothing
(R7-1). Separately, AllocationHandler.Add / Calculate and ProcBudgetLineHandler copy
ExchangeRateUsd into the ExchangeRateEuro column (R7-2). The EUR amounts are correct —
SalaryAmountEURO is computed with the real EUR rate — so only the stored audit column
misstates the rate that was applied.
Data¶
- Budget:
MasterBudget,MasterBudgetDetails,MasterBudgetDetailsMonths;BudgetLine(NotMappedBalance = Amount − Σ PurchaseOrderMat.Total,IsAvailable = Balance ≥ 0),BudgetLineBranch,BudgetLinePayment,BudgetLinesCategory,BudgetLinesUser. - Rates & donors:
ExchangeRates,DonorExchangeRate,Donor,MainDonor,DonorPartners,ProjectDonors,PartnersContribution,PartnersContributionMain. - Projects:
Project,ProjectExtensions,ProjectMonths,ProjectPlace,ProjectProgram,ProjectFilterSettings,CommitteeUser(entity here, but written by RFQ — see Procurement).
Full column detail: Finance database.
Permissions¶
Distinct keys: MasterBudgetIndex, MasterBudgetCreate, MasterBudgetDetails, BudgetLinesIndex,
BudgetLinesDetails, BudgetLinesCreate, BudgetLinesDelete, AllocationsIndex,
ExchangeRateIndex, ProjectIndex, ProjectDetails, ProjectCreate, ProjectEdit,
ProjectAllocations, ProjectAddExtension, ProjectEditExtension, ProjectEditMonth,
ProjectExport, ProjectDeleteActivity. Cross-module keys reused: General,
HumanResourceDeleteAttachment, PurchaseRequestAddComment. Per-project access is scoped through
AppUserProjectPermission (see Permissions).
Screenshots¶
Projects — /Project:

Master Budget — /MasterBudget:

Actual Budget / budget lines — /BudgetLines:

Salary allocations — /Allocations:

Donor exchange rates — /ExchangeRate/ExchangeRates/{donor} (reached from /Admin/Donors →
"Exchange Rates"):

Related¶
- Procurement module — every PR / PO line is charged to a Grant budget line (availability is shown, not enforced).
- Payroll module —
ProcBudgetLineHandler.ReallocateandDonorExchangeRatedrive salary allocation. - Grant API · Finance database.