Built motion from commit c56b56e.|0.0.125
[motion.git] / server / config / scheduler / reports.js
index 76c0c94..2fb531c 100644 (file)
@@ -1 +1 @@
-var _0xe700=["\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(_0xe700[0]);var moment=require(_0xe700[1]);require(_0xe700[2]);var CustomReport=require(_0xe700[4])[_0xe700[3]];var DefaultReport=require(_0xe700[4])[_0xe700[5]];var ExtractedReport=require(_0xe700[4])[_0xe700[6]];var MailAttachment=require(_0xe700[4])[_0xe700[7]];var MailServerOut=require(_0xe700[4])[_0xe700[8]];var MailMessage=require(_0xe700[4])[_0xe700[9]];var path=require(_0xe700[10]);var config=require(_0xe700[11]);var fs=require(_0xe700[12]);var _=require(_0xe700[13]);var ReportTree=require(_0xe700[4])[_0xe700[14]];function Reports(){console[_0xe700[16]](_0xe700[15])}Reports[_0xe700[18]][_0xe700[17]]= function(_0xee2cxf,_0xee2cx10){extract(_0xee2cxf,_0xee2cx10)};function extract(_0xee2cxf,_0xee2cx10){switch(_0xee2cxf[_0xe700[20]]){case _0xe700[19]:extractTodayReport(_0xee2cxf,_0xee2cx10);break;default:extractRangeReport(_0xee2cxf,_0xee2cx10);break}}function extractTodayReport(_0xee2cxf,_0xee2cx10){if(_0xee2cx10|| checkValidity(_0xee2cxf[_0xe700[21]],_0xee2cxf[_0xe700[22]])){docExtract(_0xee2cxf,moment()[_0xe700[24]](_0xe700[23]),moment()[_0xe700[24]](_0xe700[23]),_0xee2cx10)}}function extractRangeReport(_0xee2cxf,_0xee2cx10){switch(_0xee2cxf[_0xe700[35]]){case _0xe700[27]:docExtract(_0xee2cxf,moment()[_0xe700[26]](1,_0xe700[25])[_0xe700[24]](_0xe700[23]),moment()[_0xe700[26]](1,_0xe700[25])[_0xe700[24]](_0xe700[23]),_0xee2cx10);break;case _0xe700[28]:docExtract(_0xee2cxf,moment()[_0xe700[26]](7,_0xe700[25])[_0xe700[24]](_0xe700[23]),moment()[_0xe700[26]](1,_0xe700[25])[_0xe700[24]](_0xe700[23]),_0xee2cx10);break;case _0xe700[29]:docExtract(_0xee2cxf,moment()[_0xe700[26]](30,_0xe700[25])[_0xe700[24]](_0xe700[23]),moment()[_0xe700[26]](1,_0xe700[25])[_0xe700[24]](_0xe700[23]),_0xee2cx10);break;case _0xe700[34]:docExtract(_0xee2cxf,moment()[_0xe700[26]](1,_0xe700[32])[_0xe700[31]](_0xe700[30])[_0xe700[24]](_0xe700[23]),moment()[_0xe700[26]](1,_0xe700[32])[_0xe700[33]](_0xe700[30])[_0xe700[24]](_0xe700[23]),_0xee2cx10);break}}function checkValidity(_0xee2cx15,_0xee2cx16){return moment()[_0xe700[38]](moment(_0xee2cx15,_0xe700[37]),moment(_0xee2cx16,_0xe700[37]))[_0xe700[36]](moment())}function getReportPath(_0xee2cx18,_0xee2cx19,path){path= _0xee2cx18[_0xe700[39]]+ _0xe700[40]+ path;if(_0xee2cx18[_0xe700[41]]=== _0xe700[42]){return path}else {return getReportPath(_[_0xe700[43]](_0xee2cx19,{id:_0xee2cx18[_0xe700[41]]}),_0xee2cx19,path)}}function docExtract(_0xee2cxf,_0xee2cx1b,_0xee2cx1c,_0xee2cx10){var _0xee2cx1d=_0xee2cxf[_0xe700[44]]=== _0xe700[45]?DefaultReport:CustomReport;var _0xee2cx1e;_0xee2cx1d[_0xe700[81]](_0xe700[80])[_0xe700[78]](_0xee2cxf[_0xe700[79]])[_0xe700[76]](function(_0xee2cx23){if(!_0xee2cx23){console[_0xe700[16]](_0xe700[77]);return};_0xee2cx1e= _0xee2cx23;return ReportTree[_0xe700[78]](_0xee2cxf[_0xe700[44]]=== _0xe700[45]?1:2)})[_0xe700[76]](function(_0xee2cx19){_0xee2cx19= JSON[_0xe700[66]](_0xee2cx19[_0xe700[65]]);var _0xee2cx18=_[_0xe700[43]](_0xee2cx19,{id:_0xee2cx1e[_0xe700[41]]});var path=getReportPath(_0xee2cx18,_0xee2cx19,_0xee2cx1e[_0xe700[67]]);if(_0xee2cxf[_0xe700[20]]=== _0xe700[19]){_0xee2cx1e[_0xe700[69]][_0xe700[68]]= _0xee2cx1e[_0xe700[69]][_0xe700[68]][_0xe700[72]](_0xe700[70],_0xe700[71])};return [_0xee2cx1e,ExtractedReport[_0xe700[75]]({name:_0xee2cx1e[_0xe700[67]],startDate:_0xee2cx1b,endDate:_0xee2cx1c,output:_0xee2cxf[_0xe700[62]],type:_0xee2cx10?_0xe700[73]:_0xe700[74],UserId:_0xee2cx10?_0xee2cx10[_0xe700[59]]:null})]})[_0xe700[64]](function(_0xee2cx1e,_0xee2cx20){var _0xee2cx21=cp[_0xe700[48]](__dirname+ _0xe700[47]);_0xee2cx21[_0xe700[51]](_0xe700[54],function(_0xee2cx22){console[_0xe700[16]](_0xe700[55],_0xee2cx22);if(_0xee2cxf[_0xe700[56]]&& _0xee2cx22[_0xe700[57]]=== _0xe700[58]){sendReportByMail(_0xee2cxf,_0xee2cx20[_0xe700[59]],_0xee2cx10,_0xee2cx21)}else {_0xee2cx21[_0xe700[60]]()}})[_0xe700[51]](_0xe700[52],function(){console[_0xe700[16]](_0xe700[53])})[_0xe700[51]](_0xe700[49],function(_0xee2cx1f){console[_0xe700[16]](_0xe700[50],_0xee2cx1f)});_0xee2cx21[_0xe700[63]]({report:_0xee2cx1e,query:{startDate:_0xee2cx1b,endDate:_0xee2cx1c},extractedId:_0xee2cx20[_0xe700[59]],user:_0xee2cx10?_0xee2cx10:{role:_0xe700[61]},type:_0xee2cxf[_0xe700[62]]})})[_0xe700[46]](function(_0xee2cx1f){console[_0xe700[16]](_0xee2cx1f)})}function sendReportByMail(_0xee2cxf,_0xee2cx25,_0xee2cx10,_0xee2cx21){var _0xee2cx26;return ExtractedReport[_0xe700[78]](_0xee2cx25)[_0xe700[76]](function(extract){if(!extract){console[_0xe700[16]](_0xe700[86]);return};_0xee2cx26= extract;var _0xee2cx28;if(_0xee2cxf[_0xe700[8]]&& _0xee2cxf[_0xe700[8]][_0xe700[87]]){var _0xee2cx29=getAttachment(_0xee2cx26);var _0xee2cx2a={subject:_0xe700[88],from:[_0xee2cx28],to:[_0xee2cxf[_0xe700[89]]],cc:[],html:null,text:null,inReplyTo:null,status:_0xe700[90],attachment:true,UserId:_0xee2cx10?_0xee2cx10[_0xe700[59]]:null,MailAttachments:[_0xee2cx29]};return MailMessage[_0xe700[75]](_0xee2cx2a,{include:[{model:MailAttachment}]})}else {throw  new Error(_0xe700[91])}})[_0xe700[76]](function(_0xee2cx27){return _0xee2cx26[_0xe700[85]](_0xee2cx27)})[_0xe700[76]](function(){console[_0xe700[16]](_0xe700[84])})[_0xe700[46]](function(_0xee2cx1f){console[_0xe700[16]](_0xe700[83],_0xee2cx1f)})[_0xe700[82]](function(){_0xee2cx21[_0xe700[60]]()})}function getAttachment(extract){var _0xee2cx2c=path[_0xe700[97]](config[_0xe700[92]],_0xe700[93],_0xe700[94],_0xe700[95],extract[_0xe700[96]]);var _0xee2cx2d=path[_0xe700[97]](config[_0xe700[92]],_0xe700[93],_0xe700[94],_0xe700[98]);var _0xee2cx2e=path[_0xe700[102]](extract[_0xe700[96]],_0xe700[99]+ extract[_0xe700[101]][_0xe700[100]]());try{fs[_0xe700[103]](_0xee2cx2c,path[_0xe700[97]](_0xee2cx2d,_0xee2cx2e));console[_0xe700[16]](_0xe700[104])}catch(err){console[_0xe700[49]](err);return null};return {size:getFilesizeInBytes(_0xee2cx2c),path:path[_0xe700[97]](_0xee2cx2d,_0xee2cx2e),name:extract[_0xe700[67]]+ _0xe700[105]+ moment(extract[_0xe700[107]])[_0xe700[24]](_0xe700[106])+ _0xe700[105]+ moment(extract[_0xe700[108]])[_0xe700[24]](_0xe700[106])+ _0xe700[99]+ extract[_0xe700[101]][_0xe700[100]](),type:_0xe700[109]+ extract[_0xe700[101]][_0xe700[100]](),basename:_0xee2cx2e}}function getFilesizeInBytes(_0xee2cx30){try{var _0xee2cx31=fs[_0xe700[110]](_0xee2cx30);var _0xee2cx32=_0xee2cx31[_0xe700[111]];return _0xee2cx32}catch(err){return 0}}module[_0xe700[112]]= Reports
\ No newline at end of file
+var _0x87a1=["\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(_0x87a1[0]);var moment=require(_0x87a1[1]);require(_0x87a1[2]);var CustomReport=require(_0x87a1[4])[_0x87a1[3]];var DefaultReport=require(_0x87a1[4])[_0x87a1[5]];var ExtractedReport=require(_0x87a1[4])[_0x87a1[6]];var MailAttachment=require(_0x87a1[4])[_0x87a1[7]];var MailServerOut=require(_0x87a1[4])[_0x87a1[8]];var MailMessage=require(_0x87a1[4])[_0x87a1[9]];var path=require(_0x87a1[10]);var config=require(_0x87a1[11]);var fs=require(_0x87a1[12]);var _=require(_0x87a1[13]);var ReportTree=require(_0x87a1[4])[_0x87a1[14]];function Reports(){console[_0x87a1[16]](_0x87a1[15])}Reports[_0x87a1[18]][_0x87a1[17]]= function(_0x167fxf,_0x167fx10){extract(_0x167fxf,_0x167fx10)};function extract(_0x167fxf,_0x167fx10){switch(_0x167fxf[_0x87a1[20]]){case _0x87a1[19]:extractTodayReport(_0x167fxf,_0x167fx10);break;default:extractRangeReport(_0x167fxf,_0x167fx10);break}}function extractTodayReport(_0x167fxf,_0x167fx10){if(_0x167fx10|| checkValidity(_0x167fxf[_0x87a1[21]],_0x167fxf[_0x87a1[22]])){docExtract(_0x167fxf,moment()[_0x87a1[24]](_0x87a1[23]),moment()[_0x87a1[24]](_0x87a1[23]),_0x167fx10)}}function extractRangeReport(_0x167fxf,_0x167fx10){switch(_0x167fxf[_0x87a1[35]]){case _0x87a1[27]:docExtract(_0x167fxf,moment()[_0x87a1[26]](1,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),moment()[_0x87a1[26]](1,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),_0x167fx10);break;case _0x87a1[28]:docExtract(_0x167fxf,moment()[_0x87a1[26]](7,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),moment()[_0x87a1[26]](1,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),_0x167fx10);break;case _0x87a1[29]:docExtract(_0x167fxf,moment()[_0x87a1[26]](30,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),moment()[_0x87a1[26]](1,_0x87a1[25])[_0x87a1[24]](_0x87a1[23]),_0x167fx10);break;case _0x87a1[34]:docExtract(_0x167fxf,moment()[_0x87a1[26]](1,_0x87a1[32])[_0x87a1[31]](_0x87a1[30])[_0x87a1[24]](_0x87a1[23]),moment()[_0x87a1[26]](1,_0x87a1[32])[_0x87a1[33]](_0x87a1[30])[_0x87a1[24]](_0x87a1[23]),_0x167fx10);break}}function checkValidity(_0x167fx15,_0x167fx16){return moment()[_0x87a1[38]](moment(_0x167fx15,_0x87a1[37]),moment(_0x167fx16,_0x87a1[37]))[_0x87a1[36]](moment())}function getReportPath(_0x167fx18,_0x167fx19,path){path= _0x167fx18[_0x87a1[39]]+ _0x87a1[40]+ path;if(_0x167fx18[_0x87a1[41]]=== _0x87a1[42]){return path}else {return getReportPath(_[_0x87a1[43]](_0x167fx19,{id:_0x167fx18[_0x87a1[41]]}),_0x167fx19,path)}}function docExtract(_0x167fxf,_0x167fx1b,_0x167fx1c,_0x167fx10){var _0x167fx1d=_0x167fxf[_0x87a1[44]]=== _0x87a1[45]?DefaultReport:CustomReport;var _0x167fx1e;_0x167fx1d[_0x87a1[81]](_0x87a1[80])[_0x87a1[78]](_0x167fxf[_0x87a1[79]])[_0x87a1[76]](function(_0x167fx23){if(!_0x167fx23){console[_0x87a1[16]](_0x87a1[77]);return};_0x167fx1e= _0x167fx23;return ReportTree[_0x87a1[78]](_0x167fxf[_0x87a1[44]]=== _0x87a1[45]?1:2)})[_0x87a1[76]](function(_0x167fx19){_0x167fx19= JSON[_0x87a1[66]](_0x167fx19[_0x87a1[65]]);var _0x167fx18=_[_0x87a1[43]](_0x167fx19,{id:_0x167fx1e[_0x87a1[41]]});var path=getReportPath(_0x167fx18,_0x167fx19,_0x167fx1e[_0x87a1[67]]);if(_0x167fxf[_0x87a1[20]]=== _0x87a1[19]){_0x167fx1e[_0x87a1[69]][_0x87a1[68]]= _0x167fx1e[_0x87a1[69]][_0x87a1[68]][_0x87a1[72]](_0x87a1[70],_0x87a1[71])};return [_0x167fx1e,ExtractedReport[_0x87a1[75]]({name:_0x167fx1e[_0x87a1[67]],startDate:_0x167fx1b,endDate:_0x167fx1c,output:_0x167fxf[_0x87a1[62]],type:_0x167fx10?_0x87a1[73]:_0x87a1[74],UserId:_0x167fx10?_0x167fx10[_0x87a1[59]]:null})]})[_0x87a1[64]](function(_0x167fx1e,_0x167fx20){var _0x167fx21=cp[_0x87a1[48]](__dirname+ _0x87a1[47]);_0x167fx21[_0x87a1[51]](_0x87a1[54],function(_0x167fx22){console[_0x87a1[16]](_0x87a1[55],_0x167fx22);if(_0x167fxf[_0x87a1[56]]&& _0x167fx22[_0x87a1[57]]=== _0x87a1[58]){sendReportByMail(_0x167fxf,_0x167fx20[_0x87a1[59]],_0x167fx10,_0x167fx21)}else {_0x167fx21[_0x87a1[60]]()}})[_0x87a1[51]](_0x87a1[52],function(){console[_0x87a1[16]](_0x87a1[53])})[_0x87a1[51]](_0x87a1[49],function(_0x167fx1f){console[_0x87a1[16]](_0x87a1[50],_0x167fx1f)});_0x167fx21[_0x87a1[63]]({report:_0x167fx1e,query:{startDate:_0x167fx1b,endDate:_0x167fx1c},extractedId:_0x167fx20[_0x87a1[59]],user:_0x167fx10?_0x167fx10:{role:_0x87a1[61]},type:_0x167fxf[_0x87a1[62]]})})[_0x87a1[46]](function(_0x167fx1f){console[_0x87a1[16]](_0x167fx1f)})}function sendReportByMail(_0x167fxf,_0x167fx25,_0x167fx10,_0x167fx21){var _0x167fx26;return ExtractedReport[_0x87a1[78]](_0x167fx25)[_0x87a1[76]](function(extract){if(!extract){console[_0x87a1[16]](_0x87a1[86]);return};_0x167fx26= extract;var _0x167fx28;if(_0x167fxf[_0x87a1[8]]&& _0x167fxf[_0x87a1[8]][_0x87a1[87]]){var _0x167fx29=getAttachment(_0x167fx26);var _0x167fx2a={subject:_0x87a1[88],from:[_0x167fx28],to:[_0x167fxf[_0x87a1[89]]],cc:[],html:null,text:null,inReplyTo:null,status:_0x87a1[90],attachment:true,UserId:_0x167fx10?_0x167fx10[_0x87a1[59]]:null,MailAttachments:[_0x167fx29]};return MailMessage[_0x87a1[75]](_0x167fx2a,{include:[{model:MailAttachment}]})}else {throw  new Error(_0x87a1[91])}})[_0x87a1[76]](function(_0x167fx27){return _0x167fx26[_0x87a1[85]](_0x167fx27)})[_0x87a1[76]](function(){console[_0x87a1[16]](_0x87a1[84])})[_0x87a1[46]](function(_0x167fx1f){console[_0x87a1[16]](_0x87a1[83],_0x167fx1f)})[_0x87a1[82]](function(){_0x167fx21[_0x87a1[60]]()})}function getAttachment(extract){var _0x167fx2c=path[_0x87a1[97]](config[_0x87a1[92]],_0x87a1[93],_0x87a1[94],_0x87a1[95],extract[_0x87a1[96]]);var _0x167fx2d=path[_0x87a1[97]](config[_0x87a1[92]],_0x87a1[93],_0x87a1[94],_0x87a1[98]);var _0x167fx2e=path[_0x87a1[102]](extract[_0x87a1[96]],_0x87a1[99]+ extract[_0x87a1[101]][_0x87a1[100]]());try{fs[_0x87a1[103]](_0x167fx2c,path[_0x87a1[97]](_0x167fx2d,_0x167fx2e));console[_0x87a1[16]](_0x87a1[104])}catch(err){console[_0x87a1[49]](err);return null};return {size:getFilesizeInBytes(_0x167fx2c),path:path[_0x87a1[97]](_0x167fx2d,_0x167fx2e),name:extract[_0x87a1[67]]+ _0x87a1[105]+ moment(extract[_0x87a1[107]])[_0x87a1[24]](_0x87a1[106])+ _0x87a1[105]+ moment(extract[_0x87a1[108]])[_0x87a1[24]](_0x87a1[106])+ _0x87a1[99]+ extract[_0x87a1[101]][_0x87a1[100]](),type:_0x87a1[109]+ extract[_0x87a1[101]][_0x87a1[100]](),basename:_0x167fx2e}}function getFilesizeInBytes(_0x167fx30){try{var _0x167fx31=fs[_0x87a1[110]](_0x167fx30);var _0x167fx32=_0x167fx31[_0x87a1[111]];return _0x167fx32}catch(err){return 0}}module[_0x87a1[112]]= Reports
\ No newline at end of file