/**
 * Created by Tony on 2017/3/13.
 */

import express from "express";
let rptRouter = express.Router();
import reportController from "./../controllers/rpt_controller";

module.exports =function (app) {
    app.get('/report',  function(req, res) {
        if (!req.session.managerData.username) {
            res.redirect('/login');
        }
        else {
            res.render('maintain/report/rpt_test.html',
                {userAccount: req.session.userAccount,
                    userID: req.session.managerData.userID});
        }
    });
    rptRouter.post('/getReport', reportController.getReportAllPages);

    rptRouter.get('/getExcel/:id/:size/:rptName/:isOneSheet/:option', reportController.getExcel);
    rptRouter.get('/getExcelInOneBook/:ids/:size/:rptName/:option', reportController.getExcelInOneBook);

    rptRouter.get('/getPDF/:id/:size/:rptName', reportController.getPDF);//2/A4/07-1表
    app.use("/report_api", rptRouter);
};
