Add professor share calculation and financial reporting feature

Introduces per-class payout configuration (percentage or hourly rate,
plus an optional per-session expense allowance), pure calculation
utilities for professor payout/net profit/receivables, and a new
financial-reports API surface with per-class, per-session, and
date-range/monthly reports. Also adds full CRUD for institutional
expenses used in the range report, and wires up the new permissions
and roles. Fixes a pre-existing ReferenceError (missing
parseImportDate import) in paymentService that blocked creating
payments with dated transactions.
This commit is contained in:
2026-08-21 12:19:09 +03:30
parent 3c6eb278b0
commit 22b57eeae2
20 changed files with 1095 additions and 6 deletions
+43
View File
@@ -0,0 +1,43 @@
// /components/expenses/expenseModel.js
'use strict';
const mongoose = require('mongoose');
const expenseSchema = new mongoose.Schema({
title: {
type: String,
required: true,
trim: true
},
/** Free-form category label (e.g. "اجاره", "قبوض", "تجهیزات") */
category: {
type: String,
trim: true,
default: 'عمومی'
},
amount: {
type: Number,
required: true,
min: 0
},
/** Date the expense applies to — used to bucket expenses into date-range/monthly reports */
date: {
type: Date,
required: true
},
notes: {
type: String,
trim: true,
maxlength: 2000
},
recordedBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}
}, {
timestamps: true
});
expenseSchema.index({ date: -1 });
module.exports = mongoose.model('Expense', expenseSchema);