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:
@@ -79,6 +79,31 @@ const classSchema = new mongoose.Schema({
|
||||
min: 1,
|
||||
default: null
|
||||
},
|
||||
/** Professor compensation model for this class */
|
||||
payoutType: {
|
||||
type: String,
|
||||
enum: ['percentage', 'hourly'],
|
||||
default: 'percentage'
|
||||
},
|
||||
/** Used when payoutType === 'percentage' — professor's share of class revenue (0-100) */
|
||||
payoutPercentage: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
min: 0,
|
||||
max: 100
|
||||
},
|
||||
/** Used when payoutType === 'hourly' — professor's rate per teaching hour (Toman) */
|
||||
payoutHourlyRate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
min: 0
|
||||
},
|
||||
/** Optional flat allowance (travel/catering/etc.) paid per session held, regardless of payout model */
|
||||
extraExpensePerSession: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
min: 0
|
||||
},
|
||||
isActive: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
||||
Reference in New Issue
Block a user