Built motion from commit fa8c70b.|0.0.144
[motion.git] / server / config / scheduler / reports.js
index fb07655..a6a98e8 100644 (file)
@@ -1 +1 @@
-var _0xe43b=["\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x6D\x6F\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74\x2D\x72\x61\x6E\x67\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x66\x73\x2D\x65\x78\x74\x72\x61","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x52\x65\x70\x6F\x72\x74\x73\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x73\x20\x6C\x61\x75\x6E\x63\x68\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x78\x74\x72\x61\x63\x74\x52\x65\x70\x6F\x72\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x63\x75\x72\x72\x65\x6E\x74\x44\x61\x79","\x63\x72\x6F\x6E\x54\x79\x70\x65","\x76\x61\x6C\x69\x64\x69\x74\x79\x53\x74\x61\x72\x74","\x76\x61\x6C\x69\x64\x69\x74\x79\x45\x6E\x64","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\x64\x61\x79\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x79\x65\x73\x74\x65\x72\x64\x61\x79","\x6C\x61\x73\x74\x37","\x6C\x61\x73\x74\x33\x30","\x6D\x6F\x6E\x74\x68","\x73\x74\x61\x72\x74\x4F\x66","\x6D\x6F\x6E\x74\x68\x73","\x65\x6E\x64\x4F\x66","\x6C\x61\x73\x74\x4D\x6F\x6E\x74\x68","\x72\x65\x70\x6F\x72\x74\x52\x61\x6E\x67\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x73","\x68","\x72\x61\x6E\x67\x65","\x74\x65\x78\x74","\x2F\x20","\x70\x61\x72\x65\x6E\x74","\x23","\x66\x69\x6E\x64","\x72\x65\x70\x6F\x72\x74\x54\x79\x70\x65","\x64\x65\x66\x61\x75\x6C\x74","\x63\x61\x74\x63\x68","\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x2E\x6A\x73","\x66\x6F\x72\x6B","\x65\x72\x72\x6F\x72","\x63\x68\x69\x6C\x64\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x63\x68\x69\x6C\x64\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x63\x68\x69\x6C\x64\x20\x6D\x65\x73\x73\x61\x67\x65","\x73\x65\x6E\x64\x4D\x61\x69\x6C","\x73\x74\x61\x74\x75\x73","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x69\x64","\x6B\x69\x6C\x6C","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x4F\x75\x74\x70\x75\x74","\x73\x65\x6E\x64","\x73\x70\x72\x65\x61\x64","\x74\x72\x65\x65","\x70\x61\x72\x73\x65","\x6E\x61\x6D\x65","\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x68\x69\x73\x74\x6F\x72\x79","","\x72\x65\x70\x6C\x61\x63\x65","\x6D\x61\x6E\x75\x61\x6C","\x73\x63\x68\x65\x64\x75\x6C\x65\x64","\x63\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x52\x65\x70\x6F\x72\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x66\x69\x6E\x64\x42\x79\x49\x64","\x72\x65\x70\x6F\x72\x74\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x66\x69\x6E\x61\x6C\x6C\x79","\x45\x72\x72\x6F\x72\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x65\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x62\x79\x20\x6D\x61\x69\x6C\x21","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x73\x65\x6E\x74\x21","\x73\x65\x74\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x52\x65\x70\x6F\x72\x74","\x65\x6D\x61\x69\x6C","\x53\x45\x4E\x44\x49\x4E\x47","\x4E\x6F\x20\x41\x63\x63\x6F\x75\x6E\x74\x20\x6F\x72\x20\x53\x4D\x54\x50\x20\x61\x64\x64\x72\x65\x73\x73\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x64","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x72\x65\x70\x6F\x72\x74\x73","\x73\x61\x76\x65\x6E\x61\x6D\x65","\x6A\x6F\x69\x6E","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x2E","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x6F\x75\x74\x70\x75\x74","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x73\x75\x63\x63\x65\x73\x73\x21","\x5F","\x44\x44\x2D\x4D\x4D\x2D\x59\x59\x59\x59","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x65\x6E\x64\x44\x61\x74\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F","\x73\x74\x61\x74\x53\x79\x6E\x63","\x73\x69\x7A\x65","\x65\x78\x70\x6F\x72\x74\x73"];var cp=require(_0xe43b[0]);var moment=require(_0xe43b[1]);require(_0xe43b[2]);var CustomReport=require(_0xe43b[4])[_0xe43b[3]];var DefaultReport=require(_0xe43b[4])[_0xe43b[5]];var ExtractedReport=require(_0xe43b[4])[_0xe43b[6]];var MailAttachment=require(_0xe43b[4])[_0xe43b[7]];var MailServerOut=require(_0xe43b[4])[_0xe43b[8]];var MailMessage=require(_0xe43b[4])[_0xe43b[9]];var path=require(_0xe43b[10]);var config=require(_0xe43b[11]);var fs=require(_0xe43b[12]);var _=require(_0xe43b[13]);var ReportTree=require(_0xe43b[4])[_0xe43b[14]];function Reports(){console[_0xe43b[16]](_0xe43b[15])}Reports[_0xe43b[18]][_0xe43b[17]]= function(_0xc26cxf,_0xc26cx10){extract(_0xc26cxf,_0xc26cx10)};function extract(_0xc26cxf,_0xc26cx10){switch(_0xc26cxf[_0xe43b[20]]){case _0xe43b[19]:extractTodayReport(_0xc26cxf,_0xc26cx10);break;default:extractRangeReport(_0xc26cxf,_0xc26cx10);break}}function extractTodayReport(_0xc26cxf,_0xc26cx10){if(_0xc26cx10|| checkValidity(_0xc26cxf[_0xe43b[21]],_0xc26cxf[_0xe43b[22]])){docExtract(_0xc26cxf,moment()[_0xe43b[24]](_0xe43b[23]),moment()[_0xe43b[24]](_0xe43b[23]),_0xc26cx10)}}function extractRangeReport(_0xc26cxf,_0xc26cx10){switch(_0xc26cxf[_0xe43b[35]]){case _0xe43b[27]:docExtract(_0xc26cxf,moment()[_0xe43b[26]](1,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),moment()[_0xe43b[26]](1,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),_0xc26cx10);break;case _0xe43b[28]:docExtract(_0xc26cxf,moment()[_0xe43b[26]](7,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),moment()[_0xe43b[26]](1,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),_0xc26cx10);break;case _0xe43b[29]:docExtract(_0xc26cxf,moment()[_0xe43b[26]](30,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),moment()[_0xe43b[26]](1,_0xe43b[25])[_0xe43b[24]](_0xe43b[23]),_0xc26cx10);break;case _0xe43b[34]:docExtract(_0xc26cxf,moment()[_0xe43b[26]](1,_0xe43b[32])[_0xe43b[31]](_0xe43b[30])[_0xe43b[24]](_0xe43b[23]),moment()[_0xe43b[26]](1,_0xe43b[32])[_0xe43b[33]](_0xe43b[30])[_0xe43b[24]](_0xe43b[23]),_0xc26cx10);break}}function checkValidity(_0xc26cx15,_0xc26cx16){return moment()[_0xe43b[38]](moment(_0xc26cx15,_0xe43b[37]),moment(_0xc26cx16,_0xe43b[37]))[_0xe43b[36]](moment())}function getReportPath(_0xc26cx18,_0xc26cx19,path){path= _0xc26cx18[_0xe43b[39]]+ _0xe43b[40]+ path;if(_0xc26cx18[_0xe43b[41]]=== _0xe43b[42]){return path}else {return getReportPath(_[_0xe43b[43]](_0xc26cx19,{id:_0xc26cx18[_0xe43b[41]]}),_0xc26cx19,path)}}function docExtract(_0xc26cxf,_0xc26cx1b,_0xc26cx1c,_0xc26cx10){var _0xc26cx1d=_0xc26cxf[_0xe43b[44]]=== _0xe43b[45]?DefaultReport:CustomReport;var _0xc26cx1e;_0xc26cx1d[_0xe43b[81]](_0xe43b[80])[_0xe43b[78]](_0xc26cxf[_0xe43b[79]])[_0xe43b[76]](function(_0xc26cx23){if(!_0xc26cx23){console[_0xe43b[16]](_0xe43b[77]);return};_0xc26cx1e= _0xc26cx23;return ReportTree[_0xe43b[78]](_0xc26cxf[_0xe43b[44]]=== _0xe43b[45]?1:2)})[_0xe43b[76]](function(_0xc26cx19){_0xc26cx19= JSON[_0xe43b[66]](_0xc26cx19[_0xe43b[65]]);var _0xc26cx18=_[_0xe43b[43]](_0xc26cx19,{id:_0xc26cx1e[_0xe43b[41]]});var path=getReportPath(_0xc26cx18,_0xc26cx19,_0xc26cx1e[_0xe43b[67]]);if(_0xc26cxf[_0xe43b[20]]=== _0xe43b[19]){_0xc26cx1e[_0xe43b[69]][_0xe43b[68]]= _0xc26cx1e[_0xe43b[69]][_0xe43b[68]][_0xe43b[72]](_0xe43b[70],_0xe43b[71])};return [_0xc26cx1e,ExtractedReport[_0xe43b[75]]({name:_0xc26cx1e[_0xe43b[67]],startDate:_0xc26cx1b,endDate:_0xc26cx1c,output:_0xc26cxf[_0xe43b[62]],type:_0xc26cx10?_0xe43b[73]:_0xe43b[74],UserId:_0xc26cx10?_0xc26cx10[_0xe43b[59]]:null})]})[_0xe43b[64]](function(_0xc26cx1e,_0xc26cx20){var _0xc26cx21=cp[_0xe43b[48]](__dirname+ _0xe43b[47]);_0xc26cx21[_0xe43b[51]](_0xe43b[54],function(_0xc26cx22){console[_0xe43b[16]](_0xe43b[55],_0xc26cx22);if(_0xc26cxf[_0xe43b[56]]&& _0xc26cx22[_0xe43b[57]]=== _0xe43b[58]){sendReportByMail(_0xc26cxf,_0xc26cx20[_0xe43b[59]],_0xc26cx10,_0xc26cx21)}else {_0xc26cx21[_0xe43b[60]]()}})[_0xe43b[51]](_0xe43b[52],function(){console[_0xe43b[16]](_0xe43b[53])})[_0xe43b[51]](_0xe43b[49],function(_0xc26cx1f){console[_0xe43b[16]](_0xe43b[50],_0xc26cx1f)});_0xc26cx21[_0xe43b[63]]({report:_0xc26cx1e,query:{startDate:_0xc26cx1b,endDate:_0xc26cx1c},extractedId:_0xc26cx20[_0xe43b[59]],user:_0xc26cx10?_0xc26cx10:{role:_0xe43b[61]},type:_0xc26cxf[_0xe43b[62]]})})[_0xe43b[46]](function(_0xc26cx1f){console[_0xe43b[16]](_0xc26cx1f)})}function sendReportByMail(_0xc26cxf,_0xc26cx25,_0xc26cx10,_0xc26cx21){var _0xc26cx26;return ExtractedReport[_0xe43b[78]](_0xc26cx25)[_0xe43b[76]](function(extract){if(!extract){console[_0xe43b[16]](_0xe43b[86]);return};_0xc26cx26= extract;var _0xc26cx28;if(_0xc26cxf[_0xe43b[8]]&& _0xc26cxf[_0xe43b[8]][_0xe43b[87]]){var _0xc26cx29=getAttachment(_0xc26cx26);var _0xc26cx2a={subject:_0xe43b[88],from:[_0xc26cx28],to:[_0xc26cxf[_0xe43b[89]]],cc:[],html:null,text:null,inReplyTo:null,status:_0xe43b[90],attachment:true,UserId:_0xc26cx10?_0xc26cx10[_0xe43b[59]]:null,MailAttachments:[_0xc26cx29]};return MailMessage[_0xe43b[75]](_0xc26cx2a,{include:[{model:MailAttachment}]})}else {throw  new Error(_0xe43b[91])}})[_0xe43b[76]](function(_0xc26cx27){return _0xc26cx26[_0xe43b[85]](_0xc26cx27)})[_0xe43b[76]](function(){console[_0xe43b[16]](_0xe43b[84])})[_0xe43b[46]](function(_0xc26cx1f){console[_0xe43b[16]](_0xe43b[83],_0xc26cx1f)})[_0xe43b[82]](function(){_0xc26cx21[_0xe43b[60]]()})}function getAttachment(extract){var _0xc26cx2c=path[_0xe43b[97]](config[_0xe43b[92]],_0xe43b[93],_0xe43b[94],_0xe43b[95],extract[_0xe43b[96]]);var _0xc26cx2d=path[_0xe43b[97]](config[_0xe43b[92]],_0xe43b[93],_0xe43b[94],_0xe43b[98]);var _0xc26cx2e=path[_0xe43b[102]](extract[_0xe43b[96]],_0xe43b[99]+ extract[_0xe43b[101]][_0xe43b[100]]());try{fs[_0xe43b[103]](_0xc26cx2c,path[_0xe43b[97]](_0xc26cx2d,_0xc26cx2e));console[_0xe43b[16]](_0xe43b[104])}catch(err){console[_0xe43b[49]](err);return null};return {size:getFilesizeInBytes(_0xc26cx2c),path:path[_0xe43b[97]](_0xc26cx2d,_0xc26cx2e),name:extract[_0xe43b[67]]+ _0xe43b[105]+ moment(extract[_0xe43b[107]])[_0xe43b[24]](_0xe43b[106])+ _0xe43b[105]+ moment(extract[_0xe43b[108]])[_0xe43b[24]](_0xe43b[106])+ _0xe43b[99]+ extract[_0xe43b[101]][_0xe43b[100]](),type:_0xe43b[109]+ extract[_0xe43b[101]][_0xe43b[100]](),basename:_0xc26cx2e}}function getFilesizeInBytes(_0xc26cx30){try{var _0xc26cx31=fs[_0xe43b[110]](_0xc26cx30);var _0xc26cx32=_0xc26cx31[_0xe43b[111]];return _0xc26cx32}catch(err){return 0}}module[_0xe43b[112]]= Reports
\ No newline at end of file
+var _0xf7ae=["\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x6D\x6F\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74\x2D\x72\x61\x6E\x67\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x44\x65\x66\x61\x75\x6C\x74\x52\x65\x70\x6F\x72\x74","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x66\x73\x2D\x65\x78\x74\x72\x61","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x52\x65\x70\x6F\x72\x74\x73\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x73\x20\x6C\x61\x75\x6E\x63\x68\x65\x72\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x78\x74\x72\x61\x63\x74\x52\x65\x70\x6F\x72\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x45\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74\x2E\x2E\x2E","\x63\x75\x72\x72\x65\x6E\x74\x44\x61\x79","\x63\x72\x6F\x6E\x54\x79\x70\x65","\x43\x68\x65\x63\x6B\x69\x6E\x67\x20\x74\x6F\x64\x61\x79\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x20\x72\x61\x6E\x67\x65\x20\x76\x61\x6C\x69\x64\x69\x74\x79\x2E\x2E\x2E","\x76\x61\x6C\x69\x64\x69\x74\x79\x53\x74\x61\x72\x74","\x76\x61\x6C\x69\x64\x69\x74\x79\x45\x6E\x64","\x54\x68\x65\x20\x68\x6F\x75\x72\x73\x20\x72\x61\x6E\x67\x65\x20\x69\x73\x20\x76\x61\x6C\x69\x64\x2C\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x74\x6F\x64\x61\x79\x20\x72\x65\x70\x6F\x72\x74\x2E\x2E\x2E","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\x30\x30\x3A\x30\x30","\x32\x33\x3A\x35\x39","\x4F\x75\x74\x20\x6F\x66\x20\x68\x6F\x75\x72\x73\x20\x72\x61\x6E\x67\x65\x2C\x20\x73\x6B\x69\x70\x70\x69\x6E\x67\x20\x72\x65\x63\x6F\x72\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x21","\x64\x61\x79\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x79\x65\x73\x74\x65\x72\x64\x61\x79","\x6C\x61\x73\x74\x37","\x6C\x61\x73\x74\x33\x30","\x6D\x6F\x6E\x74\x68","\x73\x74\x61\x72\x74\x4F\x66","\x6D\x6F\x6E\x74\x68\x73","\x65\x6E\x64\x4F\x66","\x6C\x61\x73\x74\x4D\x6F\x6E\x74\x68","\x72\x65\x70\x6F\x72\x74\x52\x61\x6E\x67\x65","\x63\x6F\x6E\x74\x61\x69\x6E\x73","\x68","\x72\x61\x6E\x67\x65","\x74\x65\x78\x74","\x2F\x20","\x70\x61\x72\x65\x6E\x74","\x23","\x66\x69\x6E\x64","\x72\x65\x70\x6F\x72\x74\x54\x79\x70\x65","\x64\x65\x66\x61\x75\x6C\x74","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72\x3A\x20","\x63\x61\x74\x63\x68","\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x2E\x6A\x73","\x66\x6F\x72\x6B","\x65\x72\x72\x6F\x72","\x63\x68\x69\x6C\x64\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x63\x68\x69\x6C\x64\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x63\x68\x69\x6C\x64\x20\x6D\x65\x73\x73\x61\x67\x65","\x73\x65\x6E\x64\x4D\x61\x69\x6C","\x73\x74\x61\x74\x75\x73","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x69\x64","\x6B\x69\x6C\x6C","\x61\x64\x6D\x69\x6E","\x72\x65\x70\x6F\x72\x74\x4F\x75\x74\x70\x75\x74","\x73\x65\x6E\x64","\x73\x70\x72\x65\x61\x64","\x74\x72\x65\x65","\x70\x61\x72\x73\x65","\x6E\x61\x6D\x65","\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x68\x69\x73\x74\x6F\x72\x79","","\x72\x65\x70\x6C\x61\x63\x65","\x6D\x61\x6E\x75\x61\x6C","\x73\x63\x68\x65\x64\x75\x6C\x65\x64","\x63\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x52\x65\x70\x6F\x72\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x66\x69\x6E\x64\x42\x79\x49\x64","\x72\x65\x70\x6F\x72\x74\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x66\x69\x6E\x61\x6C\x6C\x79","\x45\x72\x72\x6F\x72\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x65\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x62\x79\x20\x6D\x61\x69\x6C\x21","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x73\x65\x6E\x74\x21","\x73\x65\x74\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x52\x65\x70\x6F\x72\x74","\x65\x6D\x61\x69\x6C","\x53\x45\x4E\x44\x49\x4E\x47","\x4E\x6F\x20\x41\x63\x63\x6F\x75\x6E\x74\x20\x6F\x72\x20\x53\x4D\x54\x50\x20\x61\x64\x64\x72\x65\x73\x73\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x64","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x72\x65\x70\x6F\x72\x74\x73","\x73\x61\x76\x65\x6E\x61\x6D\x65","\x6A\x6F\x69\x6E","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x2E","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x6F\x75\x74\x70\x75\x74","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x73\x75\x63\x63\x65\x73\x73\x21","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x65\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x20\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x21","\x5F","\x44\x44\x2D\x4D\x4D\x2D\x59\x59\x59\x59","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x65\x6E\x64\x44\x61\x74\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F","\x73\x74\x61\x74\x53\x79\x6E\x63","\x73\x69\x7A\x65","\x65\x78\x70\x6F\x72\x74\x73"];var cp=require(_0xf7ae[0]);var moment=require(_0xf7ae[1]);require(_0xf7ae[2]);var CustomReport=require(_0xf7ae[4])[_0xf7ae[3]];var DefaultReport=require(_0xf7ae[4])[_0xf7ae[5]];var ExtractedReport=require(_0xf7ae[4])[_0xf7ae[6]];var MailAttachment=require(_0xf7ae[4])[_0xf7ae[7]];var MailServerOut=require(_0xf7ae[4])[_0xf7ae[8]];var MailMessage=require(_0xf7ae[4])[_0xf7ae[9]];var path=require(_0xf7ae[10]);var config=require(_0xf7ae[11]);var fs=require(_0xf7ae[12]);var _=require(_0xf7ae[13]);var ReportTree=require(_0xf7ae[4])[_0xf7ae[14]];function Reports(){console[_0xf7ae[16]](_0xf7ae[15])}Reports[_0xf7ae[18]][_0xf7ae[17]]= function(_0x2045xf,_0x2045x10){console[_0xf7ae[16]](_0xf7ae[19]);extract(_0x2045xf,_0x2045x10)};function extract(_0x2045xf,_0x2045x10){switch(_0x2045xf[_0xf7ae[21]]){case _0xf7ae[20]:extractTodayReport(_0x2045xf,_0x2045x10);break;default:extractRangeReport(_0x2045xf,_0x2045x10);break}}function extractTodayReport(_0x2045xf,_0x2045x10){console[_0xf7ae[16]](_0xf7ae[22]);if(_0x2045x10|| checkValidity(_0x2045xf[_0xf7ae[23]],_0x2045xf[_0xf7ae[24]])){console[_0xf7ae[16]](_0xf7ae[25]);docExtract(_0x2045xf,moment()[_0xf7ae[27]](_0xf7ae[26]),moment()[_0xf7ae[27]](_0xf7ae[26]),_0x2045x10,_0xf7ae[28],_0xf7ae[29])}else {console[_0xf7ae[16]](_0xf7ae[30])}}function extractRangeReport(_0x2045xf,_0x2045x10){switch(_0x2045xf[_0xf7ae[41]]){case _0xf7ae[33]:docExtract(_0x2045xf,moment()[_0xf7ae[32]](1,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),moment()[_0xf7ae[32]](1,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),_0x2045x10);break;case _0xf7ae[34]:docExtract(_0x2045xf,moment()[_0xf7ae[32]](7,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),moment()[_0xf7ae[32]](1,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),_0x2045x10);break;case _0xf7ae[35]:docExtract(_0x2045xf,moment()[_0xf7ae[32]](30,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),moment()[_0xf7ae[32]](1,_0xf7ae[31])[_0xf7ae[27]](_0xf7ae[26]),_0x2045x10);break;case _0xf7ae[40]:docExtract(_0x2045xf,moment()[_0xf7ae[32]](1,_0xf7ae[38])[_0xf7ae[37]](_0xf7ae[36])[_0xf7ae[27]](_0xf7ae[26]),moment()[_0xf7ae[32]](1,_0xf7ae[38])[_0xf7ae[39]](_0xf7ae[36])[_0xf7ae[27]](_0xf7ae[26]),_0x2045x10);break}}function checkValidity(_0x2045x15,_0x2045x16){return moment()[_0xf7ae[44]](moment(_0x2045x15,_0xf7ae[43]),moment(_0x2045x16,_0xf7ae[43]))[_0xf7ae[42]](moment())}function getReportPath(_0x2045x18,_0x2045x19,path){path= _0x2045x18[_0xf7ae[45]]+ _0xf7ae[46]+ path;if(_0x2045x18[_0xf7ae[47]]=== _0xf7ae[48]){return path}else {return getReportPath(_[_0xf7ae[49]](_0x2045x19,{id:_0x2045x18[_0xf7ae[47]]}),_0x2045x19,path)}}function docExtract(_0x2045xf,_0x2045x1b,_0x2045x1c,_0x2045x10,_0x2045x1d,_0x2045x1e){var _0x2045x1f=_0x2045xf[_0xf7ae[50]]=== _0xf7ae[51]?DefaultReport:CustomReport;var _0x2045x20;_0x2045x1f[_0xf7ae[88]](_0xf7ae[87])[_0xf7ae[85]](_0x2045xf[_0xf7ae[86]])[_0xf7ae[83]](function(_0x2045x25){if(!_0x2045x25){console[_0xf7ae[16]](_0xf7ae[84]);return};_0x2045x20= _0x2045x25;return ReportTree[_0xf7ae[85]](_0x2045xf[_0xf7ae[50]]=== _0xf7ae[51]?1:2)})[_0xf7ae[83]](function(_0x2045x19){_0x2045x19= JSON[_0xf7ae[73]](_0x2045x19[_0xf7ae[72]]);var _0x2045x18=_[_0xf7ae[49]](_0x2045x19,{id:_0x2045x20[_0xf7ae[47]]});var path=getReportPath(_0x2045x18,_0x2045x19,_0x2045x20[_0xf7ae[74]]);if(_0x2045xf[_0xf7ae[21]]=== _0xf7ae[20]){_0x2045x20[_0xf7ae[76]][_0xf7ae[75]]= _0x2045x20[_0xf7ae[76]][_0xf7ae[75]][_0xf7ae[79]](_0xf7ae[77],_0xf7ae[78])};return [_0x2045x20,ExtractedReport[_0xf7ae[82]]({name:_0x2045x20[_0xf7ae[74]],startDate:_0x2045x1b,endDate:_0x2045x1c,output:_0x2045xf[_0xf7ae[69]],type:_0x2045x10?_0xf7ae[80]:_0xf7ae[81],UserId:_0x2045x10?_0x2045x10[_0xf7ae[66]]:null})]})[_0xf7ae[71]](function(_0x2045x20,_0x2045x22){var _0x2045x23=cp[_0xf7ae[55]](__dirname+ _0xf7ae[54]);_0x2045x23[_0xf7ae[58]](_0xf7ae[61],function(_0x2045x24){console[_0xf7ae[16]](_0xf7ae[62],_0x2045x24);if(_0x2045xf[_0xf7ae[63]]&& _0x2045x24[_0xf7ae[64]]=== _0xf7ae[65]){sendReportByMail(_0x2045xf,_0x2045x22[_0xf7ae[66]],_0x2045x10,_0x2045x23)}else {_0x2045x23[_0xf7ae[67]]()}})[_0xf7ae[58]](_0xf7ae[59],function(){console[_0xf7ae[16]](_0xf7ae[60])})[_0xf7ae[58]](_0xf7ae[56],function(_0x2045x21){console[_0xf7ae[16]](_0xf7ae[57],_0x2045x21)});_0x2045x23[_0xf7ae[70]]({report:_0x2045x20,query:{startDate:_0x2045x1b,endDate:_0x2045x1c,startTime:_0x2045x1d|| null,endTime:_0x2045x1e|| null},extractedId:_0x2045x22[_0xf7ae[66]],user:_0x2045x10?_0x2045x10:{role:_0xf7ae[68]},type:_0x2045xf[_0xf7ae[69]]})})[_0xf7ae[53]](function(_0x2045x21){console[_0xf7ae[16]](_0xf7ae[52],_0x2045x21)})}function sendReportByMail(_0x2045xf,_0x2045x27,_0x2045x10,_0x2045x23){var _0x2045x28;return ExtractedReport[_0xf7ae[85]](_0x2045x27)[_0xf7ae[83]](function(extract){if(!extract){console[_0xf7ae[16]](_0xf7ae[93]);return};_0x2045x28= extract;if(_0x2045xf[_0xf7ae[8]]&& _0x2045xf[_0xf7ae[8]][_0xf7ae[94]]){var _0x2045x2a=getAttachment(_0x2045x28);var _0x2045x2b={subject:_0xf7ae[95],from:[_0x2045xf[_0xf7ae[8]][_0xf7ae[94]]],to:[_0x2045xf[_0xf7ae[96]]],cc:[],html:null,text:null,inReplyTo:null,status:_0xf7ae[97],attachment:true,UserId:_0x2045x10?_0x2045x10[_0xf7ae[66]]:null,MailAttachments:[_0x2045x2a]};return MailMessage[_0xf7ae[82]](_0x2045x2b,{include:[{model:MailAttachment}]})}else {throw  new Error(_0xf7ae[98])}})[_0xf7ae[83]](function(_0x2045x29){return _0x2045x28[_0xf7ae[92]](_0x2045x29)})[_0xf7ae[83]](function(){console[_0xf7ae[16]](_0xf7ae[91])})[_0xf7ae[53]](function(_0x2045x21){console[_0xf7ae[16]](_0xf7ae[90],_0x2045x21)})[_0xf7ae[89]](function(){_0x2045x23[_0xf7ae[67]]()})}function getAttachment(extract){var _0x2045x2d=path[_0xf7ae[104]](config[_0xf7ae[99]],_0xf7ae[100],_0xf7ae[101],_0xf7ae[102],extract[_0xf7ae[103]]);var _0x2045x2e=path[_0xf7ae[104]](config[_0xf7ae[99]],_0xf7ae[100],_0xf7ae[101],_0xf7ae[105]);var _0x2045x2f=path[_0xf7ae[109]](extract[_0xf7ae[103]],_0xf7ae[106]+ extract[_0xf7ae[108]][_0xf7ae[107]]());try{fs[_0xf7ae[110]](_0x2045x2d,path[_0xf7ae[104]](_0x2045x2e,_0x2045x2f));console[_0xf7ae[16]](_0xf7ae[111])}catch(err){console[_0xf7ae[56]](_0xf7ae[112]);return null};return {size:getFilesizeInBytes(_0x2045x2d),path:path[_0xf7ae[104]](_0x2045x2e,_0x2045x2f),name:extract[_0xf7ae[74]]+ _0xf7ae[113]+ moment(extract[_0xf7ae[115]])[_0xf7ae[27]](_0xf7ae[114])+ _0xf7ae[113]+ moment(extract[_0xf7ae[116]])[_0xf7ae[27]](_0xf7ae[114])+ _0xf7ae[106]+ extract[_0xf7ae[108]][_0xf7ae[107]](),type:_0xf7ae[117]+ extract[_0xf7ae[108]][_0xf7ae[107]](),basename:_0x2045x2f}}function getFilesizeInBytes(_0x2045x31){try{var _0x2045x32=fs[_0xf7ae[118]](_0x2045x31);var _0x2045x33=_0x2045x32[_0xf7ae[119]];return _0x2045x33}catch(err){return 0}}module[_0xf7ae[120]]= Reports
\ No newline at end of file