29 lines
873 B
JavaScript
29 lines
873 B
JavaScript
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;
|