Discounts support / make rates configurable
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const moment = require('moment-timezone');
|
||||
|
||||
const { getMappingsFromDatabase, fetchOffices, fetchResources, saveNewMappingToDatabase } = require('../services/officeRnD/resources');
|
||||
const { getAllIncidents, getMemberPracticeSummaryReport } = require('../services/integration/reports');
|
||||
const { getMembersFeesForDateRange } = require('../services/integration/invoiceIntegration');
|
||||
@@ -7,6 +9,8 @@ const { deleteFeesFromORD, addFeesToORD } = require('../services/officeRnD/fees'
|
||||
const { checkBookingChanges } = require('../services/integration/checkBookingChange');
|
||||
const { checkIfProcessing } = require('../services/integration/processingStatus');
|
||||
|
||||
const { UI_TIMEZONE } = require('../constants/constants');
|
||||
|
||||
const getKnownOfficeResourceMappings = (req, res) => {
|
||||
const dataToFetch = [getMappingsFromDatabase(), fetchOffices(), fetchResources() ];
|
||||
|
||||
@@ -127,7 +131,22 @@ const checkProcessingStatus = (req, res) => {
|
||||
};
|
||||
|
||||
const getPracticeSummaryReport = (req, res) => {
|
||||
getMemberPracticeSummaryReport()
|
||||
const year = req.params.year;
|
||||
|
||||
const currentYear = moment.tz(UI_TIMEZONE).year();
|
||||
const parsedYear = parseInt(year);
|
||||
|
||||
if (!parsedYear || isNaN(parsedYear)){
|
||||
res.status(400).send('Year is not a number');
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsedYear > currentYear){
|
||||
res.status(400).send('Selected year cannot be greater than current year');
|
||||
return;
|
||||
}
|
||||
|
||||
getMemberPracticeSummaryReport(parsedYear)
|
||||
.then((result) => {
|
||||
const pathToDownloadFile = `${__dirname}/../${result.reportPath}`;
|
||||
res.download(pathToDownloadFile);
|
||||
|
||||
Reference in New Issue
Block a user