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.
22 lines
980 B
JavaScript
22 lines
980 B
JavaScript
// /components/financialReports/financialReportController.js
|
|
'use strict';
|
|
|
|
const catchAsync = require('../../utils/catchAsync');
|
|
const financialReportService = require('./financialReportService');
|
|
const { successResponse } = require('../../utils/apiResponse');
|
|
|
|
exports.getClassReport = catchAsync(async (req, res) => {
|
|
const report = await financialReportService.getClassReport(req.params.classId);
|
|
return successResponse(res, 200, 'Class financial report retrieved successfully', report);
|
|
});
|
|
|
|
exports.getSessionReport = catchAsync(async (req, res) => {
|
|
const report = await financialReportService.getSessionReport(req.params.sessionId);
|
|
return successResponse(res, 200, 'Session financial report retrieved successfully', report);
|
|
});
|
|
|
|
exports.getRangeReport = catchAsync(async (req, res) => {
|
|
const report = await financialReportService.getRangeReport(req.query);
|
|
return successResponse(res, 200, 'Date-range financial report retrieved successfully', report);
|
|
});
|