Built motion from commit 1333b3551.|1.0.38
[motion.git] / server / config / scheduler / reports.js
index 56bebc9..49dffe5 100644 (file)
@@ -1 +1 @@
-var _0x610c=["\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(_0x610c[0]);var moment=require(_0x610c[1]);require(_0x610c[2]);var CustomReport=require(_0x610c[4])[_0x610c[3]];var DefaultReport=require(_0x610c[4])[_0x610c[5]];var ExtractedReport=require(_0x610c[4])[_0x610c[6]];var MailAttachment=require(_0x610c[4])[_0x610c[7]];var MailServerOut=require(_0x610c[4])[_0x610c[8]];var MailMessage=require(_0x610c[4])[_0x610c[9]];var path=require(_0x610c[10]);var config=require(_0x610c[11]);var fs=require(_0x610c[12]);var _=require(_0x610c[13]);var ReportTree=require(_0x610c[4])[_0x610c[14]];function Reports(){console[_0x610c[16]](_0x610c[15])}Reports[_0x610c[18]][_0x610c[17]]= function(_0x8d52xf,_0x8d52x10){extract(_0x8d52xf,_0x8d52x10)};function extract(_0x8d52xf,_0x8d52x10){switch(_0x8d52xf[_0x610c[20]]){case _0x610c[19]:extractTodayReport(_0x8d52xf,_0x8d52x10);break;default:extractRangeReport(_0x8d52xf,_0x8d52x10);break}}function extractTodayReport(_0x8d52xf,_0x8d52x10){if(_0x8d52x10|| checkValidity(_0x8d52xf[_0x610c[21]],_0x8d52xf[_0x610c[22]])){docExtract(_0x8d52xf,moment()[_0x610c[24]](_0x610c[23]),moment()[_0x610c[24]](_0x610c[23]),_0x8d52x10)}}function extractRangeReport(_0x8d52xf,_0x8d52x10){switch(_0x8d52xf[_0x610c[35]]){case _0x610c[27]:docExtract(_0x8d52xf,moment()[_0x610c[26]](1,_0x610c[25])[_0x610c[24]](_0x610c[23]),moment()[_0x610c[26]](1,_0x610c[25])[_0x610c[24]](_0x610c[23]),_0x8d52x10);break;case _0x610c[28]:docExtract(_0x8d52xf,moment()[_0x610c[26]](7,_0x610c[25])[_0x610c[24]](_0x610c[23]),moment()[_0x610c[26]](1,_0x610c[25])[_0x610c[24]](_0x610c[23]),_0x8d52x10);break;case _0x610c[29]:docExtract(_0x8d52xf,moment()[_0x610c[26]](30,_0x610c[25])[_0x610c[24]](_0x610c[23]),moment()[_0x610c[26]](1,_0x610c[25])[_0x610c[24]](_0x610c[23]),_0x8d52x10);break;case _0x610c[34]:docExtract(_0x8d52xf,moment()[_0x610c[26]](1,_0x610c[32])[_0x610c[31]](_0x610c[30])[_0x610c[24]](_0x610c[23]),moment()[_0x610c[26]](1,_0x610c[32])[_0x610c[33]](_0x610c[30])[_0x610c[24]](_0x610c[23]),_0x8d52x10);break}}function checkValidity(_0x8d52x15,_0x8d52x16){return moment()[_0x610c[38]](moment(_0x8d52x15,_0x610c[37]),moment(_0x8d52x16,_0x610c[37]))[_0x610c[36]](moment())}function getReportPath(_0x8d52x18,_0x8d52x19,path){path= _0x8d52x18[_0x610c[39]]+ _0x610c[40]+ path;if(_0x8d52x18[_0x610c[41]]=== _0x610c[42]){return path}else {return getReportPath(_[_0x610c[43]](_0x8d52x19,{id:_0x8d52x18[_0x610c[41]]}),_0x8d52x19,path)}}function docExtract(_0x8d52xf,_0x8d52x1b,_0x8d52x1c,_0x8d52x10){var _0x8d52x1d=_0x8d52xf[_0x610c[44]]=== _0x610c[45]?DefaultReport:CustomReport;var _0x8d52x1e;_0x8d52x1d[_0x610c[81]](_0x610c[80])[_0x610c[78]](_0x8d52xf[_0x610c[79]])[_0x610c[76]](function(_0x8d52x23){if(!_0x8d52x23){console[_0x610c[16]](_0x610c[77]);return};_0x8d52x1e= _0x8d52x23;return ReportTree[_0x610c[78]](_0x8d52xf[_0x610c[44]]=== _0x610c[45]?1:2)})[_0x610c[76]](function(_0x8d52x19){_0x8d52x19= JSON[_0x610c[66]](_0x8d52x19[_0x610c[65]]);var _0x8d52x18=_[_0x610c[43]](_0x8d52x19,{id:_0x8d52x1e[_0x610c[41]]});var path=getReportPath(_0x8d52x18,_0x8d52x19,_0x8d52x1e[_0x610c[67]]);if(_0x8d52xf[_0x610c[20]]=== _0x610c[19]){_0x8d52x1e[_0x610c[69]][_0x610c[68]]= _0x8d52x1e[_0x610c[69]][_0x610c[68]][_0x610c[72]](_0x610c[70],_0x610c[71])};return [_0x8d52x1e,ExtractedReport[_0x610c[75]]({name:_0x8d52x1e[_0x610c[67]],startDate:_0x8d52x1b,endDate:_0x8d52x1c,output:_0x8d52xf[_0x610c[62]],type:_0x8d52x10?_0x610c[73]:_0x610c[74],UserId:_0x8d52x10?_0x8d52x10[_0x610c[59]]:null})]})[_0x610c[64]](function(_0x8d52x1e,_0x8d52x20){var _0x8d52x21=cp[_0x610c[48]](__dirname+ _0x610c[47]);_0x8d52x21[_0x610c[51]](_0x610c[54],function(_0x8d52x22){console[_0x610c[16]](_0x610c[55],_0x8d52x22);if(_0x8d52xf[_0x610c[56]]&& _0x8d52x22[_0x610c[57]]=== _0x610c[58]){sendReportByMail(_0x8d52xf,_0x8d52x20[_0x610c[59]],_0x8d52x10,_0x8d52x21)}else {_0x8d52x21[_0x610c[60]]()}})[_0x610c[51]](_0x610c[52],function(){console[_0x610c[16]](_0x610c[53])})[_0x610c[51]](_0x610c[49],function(_0x8d52x1f){console[_0x610c[16]](_0x610c[50],_0x8d52x1f)});_0x8d52x21[_0x610c[63]]({report:_0x8d52x1e,query:{startDate:_0x8d52x1b,endDate:_0x8d52x1c},extractedId:_0x8d52x20[_0x610c[59]],user:_0x8d52x10?_0x8d52x10:{role:_0x610c[61]},type:_0x8d52xf[_0x610c[62]]})})[_0x610c[46]](function(_0x8d52x1f){console[_0x610c[16]](_0x8d52x1f)})}function sendReportByMail(_0x8d52xf,_0x8d52x25,_0x8d52x10,_0x8d52x21){var _0x8d52x26;return ExtractedReport[_0x610c[78]](_0x8d52x25)[_0x610c[76]](function(extract){if(!extract){console[_0x610c[16]](_0x610c[86]);return};_0x8d52x26= extract;var _0x8d52x28;if(_0x8d52xf[_0x610c[8]]&& _0x8d52xf[_0x610c[8]][_0x610c[87]]){var _0x8d52x29=getAttachment(_0x8d52x26);var _0x8d52x2a={subject:_0x610c[88],from:[_0x8d52x28],to:[_0x8d52xf[_0x610c[89]]],cc:[],html:null,text:null,inReplyTo:null,status:_0x610c[90],attachment:true,UserId:_0x8d52x10?_0x8d52x10[_0x610c[59]]:null,MailAttachments:[_0x8d52x29]};return MailMessage[_0x610c[75]](_0x8d52x2a,{include:[{model:MailAttachment}]})}else {throw  new Error(_0x610c[91])}})[_0x610c[76]](function(_0x8d52x27){return _0x8d52x26[_0x610c[85]](_0x8d52x27)})[_0x610c[76]](function(){console[_0x610c[16]](_0x610c[84])})[_0x610c[46]](function(_0x8d52x1f){console[_0x610c[16]](_0x610c[83],_0x8d52x1f)})[_0x610c[82]](function(){_0x8d52x21[_0x610c[60]]()})}function getAttachment(extract){var _0x8d52x2c=path[_0x610c[97]](config[_0x610c[92]],_0x610c[93],_0x610c[94],_0x610c[95],extract[_0x610c[96]]);var _0x8d52x2d=path[_0x610c[97]](config[_0x610c[92]],_0x610c[93],_0x610c[94],_0x610c[98]);var _0x8d52x2e=path[_0x610c[102]](extract[_0x610c[96]],_0x610c[99]+ extract[_0x610c[101]][_0x610c[100]]());try{fs[_0x610c[103]](_0x8d52x2c,path[_0x610c[97]](_0x8d52x2d,_0x8d52x2e));console[_0x610c[16]](_0x610c[104])}catch(err){console[_0x610c[49]](err);return null};return {size:getFilesizeInBytes(_0x8d52x2c),path:path[_0x610c[97]](_0x8d52x2d,_0x8d52x2e),name:extract[_0x610c[67]]+ _0x610c[105]+ moment(extract[_0x610c[107]])[_0x610c[24]](_0x610c[106])+ _0x610c[105]+ moment(extract[_0x610c[108]])[_0x610c[24]](_0x610c[106])+ _0x610c[99]+ extract[_0x610c[101]][_0x610c[100]](),type:_0x610c[109]+ extract[_0x610c[101]][_0x610c[100]](),basename:_0x8d52x2e}}function getFilesizeInBytes(_0x8d52x30){try{var _0x8d52x31=fs[_0x610c[110]](_0x8d52x30);var _0x8d52x32=_0x8d52x31[_0x610c[111]];return _0x8d52x32}catch(err){return 0}}module[_0x610c[112]]= Reports
\ No newline at end of file
+var _0xada9=["\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","\x2E\x2E\x2F\x75\x74\x69\x6C","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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\x41\x63\x63\x6F\x75\x6E\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","\x69\x6E\x66\x6F","\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","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\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","\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\x70\x72\x6F\x63\x65\x73\x73\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\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\x70\x72\x6F\x63\x65\x73\x73\x20\x63\x6C\x6F\x73\x65\x64","\x64\x65\x62\x75\x67","\x6D\x65\x73\x73\x61\x67\x65","\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\x70\x72\x6F\x63\x65\x73\x73\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","\x53\x63\x68\x65\x64\x75\x6C\x65\x64\x20\x52\x65\x70\x6F\x72\x74","\x61\x64\x64\x72\x65\x73\x73","\x65\x6D\x61\x69\x6C","\x41\x20\x6E\x65\x77\x20\x72\x65\x70\x6F\x72\x74\x20\x68\x61\x73\x20\x62\x65\x65\x6E\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x79\x6F\x75\x20\x63\x61\x6E\x20\x63\x68\x65\x63\x6B\x20\x74\x68\x65\x20\x61\x74\x74\x61\x63\x68\x65\x64\x20\x66\x69\x6C\x65\x2E","\x53\x45\x4E\x44\x49\x4E\x47","\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\x2C\x20\x75\x6E\x61\x62\x6C\x65\x20\x74\x6F\x20\x73\x65\x6E\x64\x20\x69\x74\x20\x62\x79\x20\x6D\x61\x69\x6C\x21","\x75\x73\x65\x72\x6E\x61\x6D\x65","\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\x20\x74\x6F\x20\x73\x65\x6E\x64\x20\x74\x68\x65\x20\x72\x65\x70\x6F\x72\x74\x20\x62\x79\x20\x6D\x61\x69\x6C\x21","\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","\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x20\x66\x6F\x72\x20\x6D\x61\x69\x6C\x20\x72\x65\x70\x6F\x72\x74\x20\x73\x75\x63\x63\x65\x73\x73\x66\x75\x6C\x6C\x79\x20\x67\x6F\x74\x74\x65\x6E\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","\x67\x65\x74\x46\x69\x6C\x65\x53\x69\x7A\x65","\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","\x65\x78\x70\x6F\x72\x74\x73"];var cp=require(_0xada9[0]);var moment=require(_0xada9[1]);require(_0xada9[2]);var Util=require(_0xada9[3]);var logger=require(_0xada9[5])(_0xada9[4]);var CustomReport=require(_0xada9[7])[_0xada9[6]];var DefaultReport=require(_0xada9[7])[_0xada9[8]];var ExtractedReport=require(_0xada9[7])[_0xada9[9]];var MailAttachment=require(_0xada9[7])[_0xada9[10]];var MailServerOut=require(_0xada9[7])[_0xada9[11]];var MailAccount=require(_0xada9[7])[_0xada9[12]];var MailMessage=require(_0xada9[7])[_0xada9[13]];var path=require(_0xada9[14]);var config=require(_0xada9[15]);var fs=require(_0xada9[16]);var _=require(_0xada9[17]);var ReportTree=require(_0xada9[7])[_0xada9[18]];function Reports(){logger[_0xada9[20]](_0xada9[19])}Reports[_0xada9[22]][_0xada9[21]]= function(_0x6afcx12,_0x6afcx13){logger[_0xada9[20]](_0xada9[23]);extract(_0x6afcx12,_0x6afcx13)};function extract(_0x6afcx12,_0x6afcx13){switch(_0x6afcx12[_0xada9[25]]){case _0xada9[24]:extractTodayReport(_0x6afcx12,_0x6afcx13);break;default:extractRangeReport(_0x6afcx12,_0x6afcx13);break}}function extractTodayReport(_0x6afcx12,_0x6afcx13){logger[_0xada9[20]](_0xada9[26]);if(_0x6afcx13|| checkValidity(_0x6afcx12[_0xada9[27]],_0x6afcx12[_0xada9[28]])){logger[_0xada9[20]](_0xada9[29]);docExtract(_0x6afcx12,moment()[_0xada9[31]](_0xada9[30]),moment()[_0xada9[31]](_0xada9[30]),_0x6afcx13,_0xada9[32],_0xada9[33])}else {logger[_0xada9[20]](_0xada9[34])}}function extractRangeReport(_0x6afcx12,_0x6afcx13){switch(_0x6afcx12[_0xada9[45]]){case _0xada9[37]:docExtract(_0x6afcx12,moment()[_0xada9[36]](1,_0xada9[35])[_0xada9[31]](_0xada9[30]),moment()[_0xada9[36]](1,_0xada9[35])[_0xada9[31]](_0xada9[30]),_0x6afcx13);break;case _0xada9[38]:docExtract(_0x6afcx12,moment()[_0xada9[36]](7,_0xada9[35])[_0xada9[31]](_0xada9[30]),moment()[_0xada9[36]](1,_0xada9[35])[_0xada9[31]](_0xada9[30]),_0x6afcx13);break;case _0xada9[39]:docExtract(_0x6afcx12,moment()[_0xada9[36]](30,_0xada9[35])[_0xada9[31]](_0xada9[30]),moment()[_0xada9[36]](1,_0xada9[35])[_0xada9[31]](_0xada9[30]),_0x6afcx13);break;case _0xada9[44]:docExtract(_0x6afcx12,moment()[_0xada9[36]](1,_0xada9[42])[_0xada9[41]](_0xada9[40])[_0xada9[31]](_0xada9[30]),moment()[_0xada9[36]](1,_0xada9[42])[_0xada9[43]](_0xada9[40])[_0xada9[31]](_0xada9[30]),_0x6afcx13);break}}function checkValidity(_0x6afcx18,_0x6afcx19){return moment()[_0xada9[48]](moment(_0x6afcx18,_0xada9[47]),moment(_0x6afcx19,_0xada9[47]))[_0xada9[46]](moment())}function getReportPath(_0x6afcx1b,_0x6afcx1c,path){path= _0x6afcx1b[_0xada9[49]]+ _0xada9[50]+ path;if(_0x6afcx1b[_0xada9[51]]=== _0xada9[52]){return path}else {return getReportPath(_[_0xada9[53]](_0x6afcx1c,{id:_0x6afcx1b[_0xada9[51]]}),_0x6afcx1c,path)}}function docExtract(_0x6afcx12,_0x6afcx1e,_0x6afcx1f,_0x6afcx13,_0x6afcx20,_0x6afcx21){var _0x6afcx22=_0x6afcx12[_0xada9[54]]=== _0xada9[55]?DefaultReport:CustomReport;var _0x6afcx23;_0x6afcx22[_0xada9[94]](_0xada9[93])[_0xada9[91]](_0x6afcx12[_0xada9[92]])[_0xada9[89]](function(_0x6afcx28){if(!_0x6afcx28){logger[_0xada9[58]](_0xada9[90]);return};_0x6afcx23= _0x6afcx28;return ReportTree[_0xada9[91]](_0x6afcx12[_0xada9[54]]=== _0xada9[55]?1:2)})[_0xada9[89]](function(_0x6afcx1c){_0x6afcx1c= JSON[_0xada9[79]](_0x6afcx1c[_0xada9[78]]);var _0x6afcx1b=_[_0xada9[53]](_0x6afcx1c,{id:_0x6afcx23[_0xada9[51]]});var path=getReportPath(_0x6afcx1b,_0x6afcx1c,_0x6afcx23[_0xada9[80]]);if(_0x6afcx12[_0xada9[25]]=== _0xada9[24]){_0x6afcx23[_0xada9[82]][_0xada9[81]]= _0x6afcx23[_0xada9[82]][_0xada9[81]][_0xada9[85]](_0xada9[83],_0xada9[84])};return [_0x6afcx23,ExtractedReport[_0xada9[88]]({name:_0x6afcx23[_0xada9[80]],startDate:_0x6afcx1e,endDate:_0x6afcx1f,output:_0x6afcx12[_0xada9[75]],type:_0x6afcx13?_0xada9[86]:_0xada9[87],UserId:_0x6afcx13?_0x6afcx13[_0xada9[72]]:null})]})[_0xada9[77]](function(_0x6afcx23,_0x6afcx25){var _0x6afcx26=cp[_0xada9[61]](__dirname+ _0xada9[60]);_0x6afcx26[_0xada9[63]](_0xada9[67],function(_0x6afcx27){logger[_0xada9[66]](_0xada9[68],_0x6afcx27);if(_0x6afcx12[_0xada9[69]]&& _0x6afcx27[_0xada9[70]]=== _0xada9[71]){sendReportByMail(_0x6afcx12,_0x6afcx25[_0xada9[72]],_0x6afcx13,_0x6afcx26)}else {_0x6afcx26[_0xada9[73]]()}})[_0xada9[63]](_0xada9[64],function(){logger[_0xada9[66]](_0xada9[65])})[_0xada9[63]](_0xada9[58],function(_0x6afcx24){logger[_0xada9[58]](_0xada9[62],_0x6afcx24)});_0x6afcx26[_0xada9[76]]({report:_0x6afcx23,query:{startDate:_0x6afcx1e,endDate:_0x6afcx1f,startTime:_0x6afcx20|| null,endTime:_0x6afcx21|| null},extractedId:_0x6afcx25[_0xada9[72]],user:_0x6afcx13?_0x6afcx13:{role:_0xada9[74]},type:_0x6afcx12[_0xada9[75]]})})[_0xada9[59]](function(_0x6afcx24){logger[_0xada9[58]](_0xada9[56],_0x6afcx24[_0xada9[57]])})}function sendReportByMail(_0x6afcx12,_0x6afcx2a,_0x6afcx13,_0x6afcx26){var _0x6afcx2b;return ExtractedReport[_0xada9[91]](_0x6afcx2a)[_0xada9[89]](function(extract){if(!extract){throw  new Error(_0xada9[104])};_0x6afcx2b= extract;if(_0x6afcx12[_0xada9[11]]&& _0x6afcx12[_0xada9[11]][_0xada9[72]]){return MailAccount[_0xada9[53]]({attributes:[_0xada9[72],_0xada9[100]],include:[{model:MailServerOut,attributes:[_0xada9[72],_0xada9[105]],where:{id:_0x6afcx12[_0xada9[11]][_0xada9[72]]}}]})}else {throw  new Error(_0xada9[106])}})[_0xada9[89]](function(_0x6afcx2d){var _0x6afcx2e=getAttachment(_0x6afcx2b);var _0x6afcx2f={subject:_0xada9[99],from:[_0x6afcx2d[_0xada9[100]]],to:[_0x6afcx12[_0xada9[101]]],cc:[],html:_0xada9[102],text:null,inReplyTo:null,status:_0xada9[103],attachment:true,UserId:_0x6afcx13?_0x6afcx13[_0xada9[72]]:null,MailAttachments:[_0x6afcx2e]};return MailMessage[_0xada9[88]](_0x6afcx2f,{include:[{model:MailAttachment}]})})[_0xada9[89]](function(_0x6afcx2c){return _0x6afcx2b[_0xada9[98]](_0x6afcx2c)})[_0xada9[89]](function(){logger[_0xada9[20]](_0xada9[97])})[_0xada9[59]](function(_0x6afcx24){logger[_0xada9[58]](_0xada9[96],_0x6afcx24[_0xada9[57]])})[_0xada9[95]](function(){_0x6afcx26[_0xada9[73]]()})}function getAttachment(extract){var _0x6afcx31=path[_0xada9[112]](config[_0xada9[107]],_0xada9[108],_0xada9[109],_0xada9[110],extract[_0xada9[111]]);var _0x6afcx32=path[_0xada9[112]](config[_0xada9[107]],_0xada9[108],_0xada9[109],_0xada9[113]);var _0x6afcx33=path[_0xada9[117]](extract[_0xada9[111]],_0xada9[114]+ extract[_0xada9[116]][_0xada9[115]]());try{fs[_0xada9[118]](_0x6afcx31,path[_0xada9[112]](_0x6afcx32,_0x6afcx33));logger[_0xada9[66]](_0xada9[119])}catch(err){logger[_0xada9[58]](_0xada9[120]);return null};return {size:Util[_0xada9[121]](_0x6afcx31),path:path[_0xada9[112]](_0x6afcx32,_0x6afcx33),name:extract[_0xada9[80]]+ _0xada9[122]+ moment(extract[_0xada9[124]])[_0xada9[31]](_0xada9[123])+ _0xada9[122]+ moment(extract[_0xada9[125]])[_0xada9[31]](_0xada9[123])+ _0xada9[114]+ extract[_0xada9[116]][_0xada9[115]](),type:_0xada9[126]+ extract[_0xada9[116]][_0xada9[115]](),basename:_0x6afcx33}}module[_0xada9[127]]= Reports
\ No newline at end of file