flexbiz-server
Version:
Flexible Server
4 lines (3 loc) • 976 B
JavaScript
const cdpsnphep=require("../../libs/cdpsnphep"),User=global.getModel("user"),controller=require("../../controllers/controllerRPT"),async=require("async");
module.exports=function($router$$){new controller($router$$,"cdpsnphep",function($query_req$$,$callback$$){$query_req$$=$query_req$$.query;if(!$query_req$$.tu_ngay||!$query_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: tu_ngay,den_ngay");cdpsnphep($query_req$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);async.series({email:$callback$$=>{$report$$.joinModel2(null,User,{where:{email:"email"},fields:"name"},()=>{$callback$$()})}},
()=>{let $total$$={email:"",name:"T\u1ed5ng c\u1ed9ng",ton_dau:$report$$.csum("ton_dau"),so_ngay_phep:$report$$.csum("so_ngay_phep"),so_ngay_nghi:$report$$.csum("so_ngay_nghi"),ton_cuoi:$report$$.csum("ton_cuoi"),systotal:1,bold:!0};$report$$.push($total$$);$callback$$(null,$report$$)})})},{stream:!1})};