flexbiz-server
Version:
Flexible Server
45 lines (42 loc) • 16.3 kB
JavaScript
'use strict';const socai=global.getModel("socai"),cktk=require("../../libs/cktk"),dktk=require("../../libs/dktk"),kbmpttct=global.getModel("kbmPttct"),rptform=global.getModel("rptform"),async=require("async"),_=require("lodash"),utils=require("../../libs/utils"),controller=require("../../controllers/controllerRPT"),moment=require("moment"),numeral=require("numeral"),getRegString=function($arrayTk$$){return $arrayTk$$.reg()},{getCodeChildren}=require("../../libs/utils");
module.exports=function($router$$){new controller($router$$,"pttct",async function($req$$,$callback$jscomp$0$$){let $query$$=$req$$.query;if(!$query$$.den_ngay||!$query$$.tu_ngay||!$query$$.id_rptform)return $callback$jscomp$0$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 t\u1eeb ng\u00e0y(tu_ngay), \u0111\u1ebfn ng\u00e0y(den_ngay), id m\u1eabu b\u00e1o c\u00e1o");if(!global.mongoose.Types.ObjectId.isValid($query$$.id_rptform))return $callback$jscomp$0$$("M\u1eabu b\u00e1o c\u00e1o n\u00e0y kh\u00f4ng c\u00f3 gi\u00e1 tr\u1ecb");
if($query$$.ma_bp){var $bps_dts_phis$$=await getCodeChildren(global.getModel("dmbp"),$query$$.id_app,$query$$.ma_bp,"ma_bp","ma_bp_me");$query$$.ma_bp={$in:$bps_dts_phis$$}}$query$$.ma_phi&&($bps_dts_phis$$=await getCodeChildren(global.getModel("dmphi"),$query$$.id_app,$query$$.ma_phi,"ma_phi","ma_phi_me"),$query$$.ma_phi={$in:$bps_dts_phis$$});$query$$.ma_dt&&($bps_dts_phis$$=await getCodeChildren(global.getModel("dmdt"),$query$$.id_app,$query$$.ma_dt,"ma_dt","ma_dt_me"),$query$$.ma_dt={$in:$bps_dts_phis$$});
(new Promise(($resolve$$,$reject$$)=>{rptform.findOne({_id:$query$$.id_rptform,id_app:$query$$.id_app}).lean().exec(($e$$,$rs$$)=>{if($e$$||!$rs$$)return $reject$$($e$$);$resolve$$($rs$$)})})).then(async $_rptform$$=>{$query$$.tu_ngay=moment(new Date($query$$.tu_ngay)).startOf("date").toDate();$query$$.den_ngay=moment(new Date($query$$.den_ngay)).endOf("date").toDate();let $report$$=$_rptform$$.report;$report$$&&0!==$_rptform$$.report.length||($report$$=await kbmpttct.find({id_rptform:$_rptform$$._id.toString(),
id_app:$query$$.id_app}).sort({stt:1}).lean());let $kys$$=[];switch($query$$.loai_ky){case "ngay":for(var $tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($query$$.tu_ngay).startOf("date").toDate();$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getTime()<$query$$.den_ngay.getTime();){var $den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).endOf("date").toDate();
$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$.getTime()>$query$$.den_ngay.getTime()&&($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=$query$$.den_ngay);$kys$$.push({ma_ky:`${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getDate()}-${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getMonth()+1}-${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,ten_ky:`${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getDate()}/${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getMonth()+
1}/${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,tu_ngay:$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$,den_ngay:$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$});$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$).add(1,"days").startOf("date").toDate()}break;case "tuan":for($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=
moment($query$$.tu_ngay).startOf("date").toDate();$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getTime()<$query$$.den_ngay.getTime();)$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).endOf("week").toDate(),$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$.getTime()>$query$$.den_ngay.getTime()&&($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=
$query$$.den_ngay),$kys$$.push({ma_ky:`${moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).get("weeks")}-${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,ten_ky:`Tu\u1ea7n ${moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).get("weeks")}/${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,tu_ngay:$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$,den_ngay:$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$}),
$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$).add(1,"days").startOf("date").toDate();break;case "thang":for($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($query$$.tu_ngay).startOf("date").toDate();$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getTime()<$query$$.den_ngay.getTime();)$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=
moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).endOf("month").toDate(),$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$.getTime()>$query$$.den_ngay.getTime()&&($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=$query$$.den_ngay),$kys$$.push({ma_ky:`${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getMonth()+1}-${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,
ten_ky:`Th\u00e1ng ${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getMonth()+1}/${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,tu_ngay:$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$,den_ngay:$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$}),$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$).add(1,
"days").startOf("date").toDate();break;case "quy":for($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($query$$.tu_ngay).startOf("date").toDate();$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getTime()<$query$$.den_ngay.getTime();)$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).endOf("quarters").toDate(),$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$.getTime()>
$query$$.den_ngay.getTime()&&($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=$query$$.den_ngay),$kys$$.push({ma_ky:`${moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).get("quarters")}-${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,ten_ky:`${moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).get("quarters")}/${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,
tu_ngay:$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$,den_ngay:$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$}),$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$).add(1,"days").startOf("date").toDate();break;case "nam":for($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($query$$.tu_ngay).startOf("date").toDate();$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getTime()<
$query$$.den_ngay.getTime();)$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=moment($tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$).endOf("year").toDate(),$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$.getTime()>$query$$.den_ngay.getTime()&&($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$=$query$$.den_ngay),$kys$$.push({ma_ky:`${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,
ten_ky:`${$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$.getFullYear()}`,tu_ngay:$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$,den_ngay:$den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$}),$tu_ngay_tu_ngay$jscomp$1_tu_ngay$jscomp$2_tu_ngay$jscomp$3_tu_ngay$$=moment($den_ngay_den_ngay$jscomp$1_den_ngay$jscomp$2_den_ngay$jscomp$3_den_ngay$$).add(1,"days").startOf("date").toDate();break;case "kn":$kys$$=[{ma_ky:"kn",ten_ky:"Gi\u00e1 tr\u1ecb",
tu_ngay:$query$$.tu_ngay,den_ngay:$query$$.den_ngay}];break;default:$query$$.tu_ngay_kt=new Date($query$$.tu_ngay),$query$$.tu_ngay_kt.setYear($query$$.tu_ngay_kt.getFullYear()-1),$query$$.den_ngay_kt=new Date($query$$.den_ngay),$query$$.den_ngay_kt.setYear($query$$.den_ngay_kt.getFullYear()-1),$kys$$=[{ma_ky:"kt",ten_ky:"K\u1ef3 tr\u01b0\u1edbc",tu_ngay:$query$$.tu_ngay_kt,den_ngay:$query$$.den_ngay_kt},{ma_ky:"kn",ten_ky:"K\u1ef3 n\u00e0y",tu_ngay:$query$$.tu_ngay,den_ngay:$query$$.den_ngay}]}async.mapSeries($report$$,
($r$$,$c1$$)=>{setImmediate(()=>{switch($r$$.cach_tinh){case "9":$r$$.cong_thuc="";utils.getInfoFromQuery($query$$,$r$$.query,($e$$,$rs$$)=>{if($e$$)return $c1$$();_.isNumber($rs$$)?($r$$.so_kn=$rs$$,$r$$.so_kn_nt=$rs$$,$r$$.so_kt=$rs$$,$r$$.so_kt_nt=$rs$$):$r$$.value_string=$rs$$;$c1$$()});break;case "2":$r$$.cong_thuc="";async.mapSeries($kys$$,($ky$$,$callback$$)=>{setImmediate(async()=>{let $condition$$={ngay_ct:{$gte:$ky$$.tu_ngay,$lte:$ky$$.den_ngay},id_app:$query$$.id_app};$query$$.ma_dvcs&&
($condition$$.ma_dvcs=$query$$.ma_dvcs);$query$$.ma_bp&&($condition$$.ma_bp=$query$$.ma_bp);$query$$.ma_hd&&($condition$$.ma_hd=$query$$.ma_hd);$query$$.ma_dt&&($condition$$.ma_dt=$query$$.ma_dt);$query$$.ma_sp&&($condition$$.ma_sp=$query$$.ma_sp);$query$$.ma_nv&&($condition$$.ma_nv=$query$$.ma_nv);$r$$.ma_phi&&($condition$$.ma_phi={$in:await getCodeChildren(global.getModel("dmphi"),$query$$.id_app,$r$$.ma_phi,"ma_phi","ma_phi_me")});$r$$.ma_kho&&($condition$$.ma_kho=$r$$.ma_kho);var $tk_co_tk_no$$=
getRegString($r$$.tk_no);$tk_co_tk_no$$&&($condition$$.tk_no=$r$$.giam_tru_no?{$not:new RegExp($tk_co_tk_no$$)}:{$regex:$tk_co_tk_no$$,$options:"i"});if($tk_co_tk_no$$=getRegString($r$$.tk_co))$condition$$.tk_co=$r$$.giam_tru_co&&$tk_co_tk_no$$?{$not:new RegExp($tk_co_tk_no$$)}:{$regex:$tk_co_tk_no$$,$options:"i"};if($r$$.dieu_kien_khac)try{0>$r$$.dieu_kien_khac.indexOf("{")&&($r$$.dieu_kien_khac="{"+$r$$.dieu_kien_khac+"}");let $str_func$$=$r$$.dieu_kien_khac;0>$str_func$$.indexOf("return ")&&($str_func$$=
`return ${$str_func$$}`);let $dieu_kien_khac$$=utils.evalute($str_func$$,{moment,condition:$condition$$,row:$r$$});$condition$$={...$condition$$,...$dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}socai.find($condition$$).lean().exec(($error$$,$rs$$)=>{if($error$$)return $callback$$($error$$);$r$$[`so_${$ky$$.ma_ky}`]=$rs$$.csum("tien");$r$$[`so_${$ky$$.ma_ky}_nt`]=$rs$$.csum("tien_nt");$callback$$(null,$r$$)})})},($e$$,$rs$$)=>{$c1$$($e$$,$rs$$)});break;case "5":$r$$.cong_thuc=
"";async.mapSeries($kys$$,($ky$$,$callback$$)=>{let $condition$$={...$query$$};$condition$$.ngay=$ky$$.tu_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;dktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$[`so_${$ky$$.ma_ky}`]=$result$$.csum("du_no00");$r$$[`so_${$ky$$.ma_ky}_nt`]=$result$$.csum("du_no_nt00");0>$r$$[`so_${$ky$$.ma_ky}`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}`]=
0);0>$r$$[`so_${$ky$$.ma_ky}_nt`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}_nt`]=0);$callback$$(null,$r$$)})},($e$$,$rs$$)=>{$c1$$($e$$,$rs$$)});break;case "6":$r$$.cong_thuc="";async.mapSeries($kys$$,($ky$$,$callback$$)=>{let $condition$$={...$query$$};$condition$$.ngay=$ky$$.tu_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;dktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$[`so_${$ky$$.ma_ky}`]=
$result$$.csum("du_co00");$r$$[`so_${$ky$$.ma_ky}_nt`]=$result$$.csum("du_co_nt00");0>$r$$[`so_${$ky$$.ma_ky}`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}`]=0);0>$r$$[`so_${$ky$$.ma_ky}_nt`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}_nt`]=0);$callback$$(null,$r$$)})},($e$$,$rs$$)=>{$c1$$($e$$,$rs$$)});break;case "7":$r$$.cong_thuc="";async.mapSeries($kys$$,($ky$$,$callback$$)=>{let $condition$$={...$query$$};$condition$$.ngay=$ky$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;
delete $condition$$.tu_ngay;delete $condition$$.den_ngay;cktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$[`so_${$ky$$.ma_ky}`]=$result$$.csum("du_no00");$r$$[`so_${$ky$$.ma_ky}_nt`]=$result$$.csum("du_no_nt00");0>$r$$[`so_${$ky$$.ma_ky}`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}`]=0);0>$r$$[`so_${$ky$$.ma_ky}_nt`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}_nt`]=0);$callback$$(null,$r$$)})},($e$$,$rs$$)=>{$c1$$($e$$,$rs$$)});break;case "8":$r$$.cong_thuc="";
async.mapSeries($kys$$,($ky$$,$callback$$)=>{let $condition$$={...$query$$};$condition$$.ngay=$ky$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;cktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$[`so_${$ky$$.ma_ky}`]=$result$$.csum("du_co00");$r$$[`so_${$ky$$.ma_ky}_nt`]=$result$$.csum("du_co_nt00");0>$r$$[`so_${$ky$$.ma_ky}`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}`]=0);
0>$r$$[`so_${$ky$$.ma_ky}_nt`]&&$r$$.khong_am&&($r$$[`so_${$ky$$.ma_ky}_nt`]=0);$callback$$(null,$r$$)})},($e$$,$rs$$)=>{$c1$$($e$$,$rs$$)});break;case "99":if(!$r$$.script)return $c1$$(null,$r$$);if(0<=$r$$.script.indexOf("async "))return $c1$$("async function is not allow");let $func_string$$=`return (async ()=>{
try{
${$r$$.script}
}catch(e){
return {error:e}
}
})`;$r$$.cong_thuc="";utils.evalute($func_string$$,{row:$r$$,moment,condition:$query$$,user:$req$$.user,_,utils})().then($rs$$=>{if($rs$$&&$rs$$.error)return console.error($rs$$.error,$func_string$$),$c1$$($rs$$.error.message||$rs$$.error.error||$rs$$.error);$c1$$(null,$r$$)}).catch($e$$=>{console.error($e$$,$func_string$$);return $c1$$($e$$.message||$e$$.error||$e$$)});break;default:$c1$$(null,$r$$)}})},function($error$$){if($error$$)return $callback$jscomp$0$$($error$$);$error$$=$kys$$.map($k$$=>
`so_${$k$$.ma_ky},so_${$k$$.ma_ky}_nt`).join(",");utils.calcGrid($report$$,$error$$,async function($data$$){if($_rptform$$.handle_data_expression_server){if(0<=$_rptform$$.handle_data_expression_server.indexOf("async "))return $callback$jscomp$0$$("async function is not allow");let $func_string$$=`return (async ()=>{
try{
${$_rptform$$.handle_data_expression_server}
}catch(e){
return {error:e}
}
})`;try{let $rs$$=await utils.evalute($func_string$$,{data:$data$$,moment,numeral,condition:$req$$.query})();if($rs$$){if($rs$$.error)return console.error($rs$$.error,$func_string$$),$callback$jscomp$0$$($rs$$.error.message||$rs$$.error);$data$$=$rs$$}}catch($e$$){return console.error($e$$,$func_string$$),$callback$jscomp$0$$($e$$.message||$e$$)}}$req$$.query.loai_ky?$callback$jscomp$0$$(null,{data:$data$$.filter($r$$=>$r$$.print),columns:$kys$$}):$callback$jscomp$0$$(null,$data$$.filter($r$$=>
$r$$.print))})})}).catch($e$$=>{$callback$jscomp$0$$($e$$||"Kh\u00f4ng c\u00f3 m\u1eabu b\u00e1o c\u00e1o n\u00e0o cho b\u00e1o c\u00e1o n\u00e0y")})})};