Initial
This commit is contained in:
28
server/routes/reports.js
Normal file
28
server/routes/reports.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const express = require('express');
|
||||
const {
|
||||
depreciationReport,
|
||||
monthlyDepreciationReport,
|
||||
writeDepreciationPdf
|
||||
} = require('../services/reports');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/reports/depreciation', (req, res) => {
|
||||
const year = Number(req.query.year || new Date().getFullYear());
|
||||
const bookType = req.query.book || 'GAAP';
|
||||
res.json(depreciationReport(year, bookType));
|
||||
});
|
||||
|
||||
router.get('/reports/monthly-depreciation', (req, res) => {
|
||||
const year = Number(req.query.year || new Date().getFullYear());
|
||||
const bookType = req.query.book || 'GAAP';
|
||||
res.json(monthlyDepreciationReport(year, bookType));
|
||||
});
|
||||
|
||||
router.get('/reports/depreciation.pdf', (req, res) => {
|
||||
const year = Number(req.query.year || new Date().getFullYear());
|
||||
const book = req.query.book || 'GAAP';
|
||||
writeDepreciationPdf(res, year, book);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user