gtiorgi

Untitled

Apr 28th, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. router.get('/exportNew2', app.filters.commons.sessionRequired(), function (req, res, next) {
  2. try {
  3. console.log("ახალი ექსპორტი", req.query);
  4. var reqObj = {
  5. month: req.query.month,
  6. serviceObjectId: req.query.serviceObjectId
  7. };
  8. app.requestHelpers.circleServices.request("attendanceReport/byMonth", {
  9. data: reqObj
  10. }, function (error, data) {
  11. console.log("ახალი ექსპორტი სერვერიდან დაბრუნებული პასუხი");
  12. console.log(error, data);
  13. if (error) {
  14. next(error)
  15. }
  16. console.log('yyyyyyyyyyyyyyyyyyyyyuuuu', data.data);
  17. var xlsData = generateDataArrays2(data.data[0]);
  18. var buffer = xlsx.build([{name: "სერვისის მიწოდების თვის ანგარიში", data: xlsData}]);
  19. res.set({
  20. 'Content-disposition': ' attachment; filename=export.xlsx'
  21. });
  22. res.write(buffer);
  23. res.end();
  24. });
  25. } catch (e) {
  26. res.write(e);
  27. res.end();
  28. }
  29. });
Add Comment
Please, Sign In to add comment