Built motion from commit 264c1c7.|0.0.142
[motion.git] / server / config / scheduler / reports.js
index ae7908c..70913f0 100644 (file)
@@ -1 +1 @@
-var _0xee56=["\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","\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","\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","\x52\x65\x70\x6F\x72\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\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","\x6E\x61\x6D\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","\x72\x65\x70\x6F\x72\x74\x49\x64","\x66\x69\x6E\x64\x42\x79\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(_0xee56[0]);var moment=require(_0xee56[1]);require(_0xee56[2]);var CustomReport=require(_0xee56[4])[_0xee56[3]];var DefaultReport=require(_0xee56[4])[_0xee56[5]];var ExtractedReport=require(_0xee56[4])[_0xee56[6]];var MailAttachment=require(_0xee56[4])[_0xee56[7]];var MailServerOut=require(_0xee56[4])[_0xee56[8]];var MailMessage=require(_0xee56[4])[_0xee56[9]];var path=require(_0xee56[10]);var config=require(_0xee56[11]);var fs=require(_0xee56[12]);function Reports(){console[_0xee56[14]](_0xee56[13])}Reports[_0xee56[16]][_0xee56[15]]= function(_0x488fxd,_0x488fxe){extract(_0x488fxd,_0x488fxe)};function extract(_0x488fxd,_0x488fxe){switch(_0x488fxd[_0xee56[18]]){case _0xee56[17]:extractTodayReport(_0x488fxd,_0x488fxe);break;default:extractRangeReport(_0x488fxd,_0x488fxe);break}}function extractTodayReport(_0x488fxd,_0x488fxe){if(_0x488fxe|| checkValidity(_0x488fxd[_0xee56[19]],_0x488fxd[_0xee56[20]])){docExtract(_0x488fxd,moment()[_0xee56[22]](_0xee56[21]),moment()[_0xee56[22]](_0xee56[21]),_0x488fxe)}}function extractRangeReport(_0x488fxd,_0x488fxe){switch(_0x488fxd[_0xee56[33]]){case _0xee56[25]:docExtract(_0x488fxd,moment()[_0xee56[24]](1,_0xee56[23])[_0xee56[22]](_0xee56[21]),moment()[_0xee56[24]](1,_0xee56[23])[_0xee56[22]](_0xee56[21]),_0x488fxe);break;case _0xee56[26]:docExtract(_0x488fxd,moment()[_0xee56[24]](7,_0xee56[23])[_0xee56[22]](_0xee56[21]),moment()[_0xee56[24]](1,_0xee56[23])[_0xee56[22]](_0xee56[21]),_0x488fxe);break;case _0xee56[27]:docExtract(_0x488fxd,moment()[_0xee56[24]](30,_0xee56[23])[_0xee56[22]](_0xee56[21]),moment()[_0xee56[24]](1,_0xee56[23])[_0xee56[22]](_0xee56[21]),_0x488fxe);break;case _0xee56[32]:docExtract(_0x488fxd,moment()[_0xee56[24]](1,_0xee56[30])[_0xee56[29]](_0xee56[28])[_0xee56[22]](_0xee56[21]),moment()[_0xee56[24]](1,_0xee56[30])[_0xee56[31]](_0xee56[28])[_0xee56[22]](_0xee56[21]),_0x488fxe);break}}function checkValidity(_0x488fx13,_0x488fx14){return moment()[_0xee56[36]](moment(_0x488fx13,_0xee56[35]),moment(_0x488fx14,_0xee56[35]))[_0xee56[34]](moment())}function docExtract(_0x488fxd,_0x488fx16,_0x488fx17,_0x488fxe){var _0x488fx18=_0x488fxd[_0xee56[37]]=== _0xee56[38]?DefaultReport:CustomReport;_0x488fx18[_0xee56[72]](_0xee56[71])[_0xee56[70]](_0x488fxd[_0xee56[69]])[_0xee56[68]](function(_0x488fx1a){if(!_0x488fx1a){console[_0xee56[14]](_0xee56[58]);return};if(_0x488fxd[_0xee56[18]]=== _0xee56[17]){_0x488fx1a[_0xee56[60]][_0xee56[59]]= _0x488fx1a[_0xee56[60]][_0xee56[59]][_0xee56[63]](_0xee56[61],_0xee56[62])};return [_0x488fx1a,ExtractedReport[_0xee56[67]]({name:_0x488fx1a[_0xee56[64]],startDate:_0x488fx16,endDate:_0x488fx17,output:_0x488fxd[_0xee56[55]],type:_0x488fxe?_0xee56[65]:_0xee56[66],UserId:_0x488fxe?_0x488fxe[_0xee56[52]]:null})]})[_0xee56[57]](function(_0x488fx1a,_0x488fx1b){var _0x488fx1c=cp[_0xee56[41]](__dirname+ _0xee56[40]);_0x488fx1c[_0xee56[44]](_0xee56[47],function(_0x488fx1d){console[_0xee56[14]](_0xee56[48],_0x488fx1d);if(_0x488fxd[_0xee56[49]]&& _0x488fx1d[_0xee56[50]]=== _0xee56[51]){sendReportByMail(_0x488fxd,_0x488fx1b[_0xee56[52]],_0x488fxe,_0x488fx1c)}else {_0x488fx1c[_0xee56[53]]()}})[_0xee56[44]](_0xee56[45],function(){console[_0xee56[14]](_0xee56[46])})[_0xee56[44]](_0xee56[42],function(_0x488fx19){console[_0xee56[14]](_0xee56[43],_0x488fx19)});_0x488fx1c[_0xee56[56]]({report:_0x488fx1a,query:{startDate:_0x488fx16,endDate:_0x488fx17},extractedId:_0x488fx1b[_0xee56[52]],user:_0x488fxe?_0x488fxe:{role:_0xee56[54]},type:_0x488fxd[_0xee56[55]]})})[_0xee56[39]](function(_0x488fx19){console[_0xee56[14]](_0x488fx19)})}function sendReportByMail(_0x488fxd,_0x488fx1f,_0x488fxe,_0x488fx1c){var _0x488fx20;return ExtractedReport[_0xee56[70]](_0x488fx1f)[_0xee56[68]](function(extract){if(!extract){console[_0xee56[14]](_0xee56[77]);return};_0x488fx20= extract;var _0x488fx22;if(_0x488fxd[_0xee56[8]]&& _0x488fxd[_0xee56[8]][_0xee56[78]]){var _0x488fx23=getAttachment(_0x488fx20);var _0x488fx24={subject:_0xee56[79],from:[_0x488fx22],to:[_0x488fxd[_0xee56[80]]],cc:[],html:null,text:null,inReplyTo:null,status:_0xee56[81],attachment:true,UserId:_0x488fxe?_0x488fxe[_0xee56[52]]:null,MailAttachments:[_0x488fx23]};return MailMessage[_0xee56[67]](_0x488fx24,{include:[{model:MailAttachment}]})}else {throw  new Error(_0xee56[82])}})[_0xee56[68]](function(_0x488fx21){return _0x488fx20[_0xee56[76]](_0x488fx21)})[_0xee56[68]](function(){console[_0xee56[14]](_0xee56[75])})[_0xee56[39]](function(_0x488fx19){console[_0xee56[14]](_0xee56[74],_0x488fx19)})[_0xee56[73]](function(){_0x488fx1c[_0xee56[53]]()})}function getAttachment(extract){var _0x488fx26=path[_0xee56[88]](config[_0xee56[83]],_0xee56[84],_0xee56[85],_0xee56[86],extract[_0xee56[87]]);var _0x488fx27=path[_0xee56[88]](config[_0xee56[83]],_0xee56[84],_0xee56[85],_0xee56[89]);var _0x488fx28=path[_0xee56[93]](extract[_0xee56[87]],_0xee56[90]+ extract[_0xee56[92]][_0xee56[91]]());try{fs[_0xee56[94]](_0x488fx26,path[_0xee56[88]](_0x488fx27,_0x488fx28));console[_0xee56[14]](_0xee56[95])}catch(err){console[_0xee56[42]](err);return null};return {size:getFilesizeInBytes(_0x488fx26),path:path[_0xee56[88]](_0x488fx27,_0x488fx28),name:extract[_0xee56[64]]+ _0xee56[96]+ moment(extract[_0xee56[98]])[_0xee56[22]](_0xee56[97])+ _0xee56[96]+ moment(extract[_0xee56[99]])[_0xee56[22]](_0xee56[97])+ _0xee56[90]+ extract[_0xee56[92]][_0xee56[91]](),type:_0xee56[100]+ extract[_0xee56[92]][_0xee56[91]](),basename:_0x488fx28}}function getFilesizeInBytes(_0x488fx2a){try{var _0x488fx2b=fs[_0xee56[101]](_0x488fx2a);var _0x488fx2c=_0x488fx2b[_0xee56[102]];return _0x488fx2c}catch(err){return 0}}module[_0xee56[103]]= Reports
\ No newline at end of file
+var _0xe7bf=["\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(_0xe7bf[0]);var moment=require(_0xe7bf[1]);require(_0xe7bf[2]);var CustomReport=require(_0xe7bf[4])[_0xe7bf[3]];var DefaultReport=require(_0xe7bf[4])[_0xe7bf[5]];var ExtractedReport=require(_0xe7bf[4])[_0xe7bf[6]];var MailAttachment=require(_0xe7bf[4])[_0xe7bf[7]];var MailServerOut=require(_0xe7bf[4])[_0xe7bf[8]];var MailMessage=require(_0xe7bf[4])[_0xe7bf[9]];var path=require(_0xe7bf[10]);var config=require(_0xe7bf[11]);var fs=require(_0xe7bf[12]);var _=require(_0xe7bf[13]);var ReportTree=require(_0xe7bf[4])[_0xe7bf[14]];function Reports(){console[_0xe7bf[16]](_0xe7bf[15])}Reports[_0xe7bf[18]][_0xe7bf[17]]= function(_0x2becxf,_0x2becx10){console[_0xe7bf[16]](_0xe7bf[19]);extract(_0x2becxf,_0x2becx10)};function extract(_0x2becxf,_0x2becx10){switch(_0x2becxf[_0xe7bf[21]]){case _0xe7bf[20]:extractTodayReport(_0x2becxf,_0x2becx10);break;default:extractRangeReport(_0x2becxf,_0x2becx10);break}}function extractTodayReport(_0x2becxf,_0x2becx10){console[_0xe7bf[16]](_0xe7bf[22]);if(_0x2becx10|| checkValidity(_0x2becxf[_0xe7bf[23]],_0x2becxf[_0xe7bf[24]])){console[_0xe7bf[16]](_0xe7bf[25]);docExtract(_0x2becxf,moment()[_0xe7bf[27]](_0xe7bf[26]),moment()[_0xe7bf[27]](_0xe7bf[26]),_0x2becx10,_0xe7bf[28],_0xe7bf[29])}else {console[_0xe7bf[16]](_0xe7bf[30])}}function extractRangeReport(_0x2becxf,_0x2becx10){switch(_0x2becxf[_0xe7bf[41]]){case _0xe7bf[33]:docExtract(_0x2becxf,moment()[_0xe7bf[32]](1,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),moment()[_0xe7bf[32]](1,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),_0x2becx10);break;case _0xe7bf[34]:docExtract(_0x2becxf,moment()[_0xe7bf[32]](7,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),moment()[_0xe7bf[32]](1,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),_0x2becx10);break;case _0xe7bf[35]:docExtract(_0x2becxf,moment()[_0xe7bf[32]](30,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),moment()[_0xe7bf[32]](1,_0xe7bf[31])[_0xe7bf[27]](_0xe7bf[26]),_0x2becx10);break;case _0xe7bf[40]:docExtract(_0x2becxf,moment()[_0xe7bf[32]](1,_0xe7bf[38])[_0xe7bf[37]](_0xe7bf[36])[_0xe7bf[27]](_0xe7bf[26]),moment()[_0xe7bf[32]](1,_0xe7bf[38])[_0xe7bf[39]](_0xe7bf[36])[_0xe7bf[27]](_0xe7bf[26]),_0x2becx10);break}}function checkValidity(_0x2becx15,_0x2becx16){return moment()[_0xe7bf[44]](moment(_0x2becx15,_0xe7bf[43]),moment(_0x2becx16,_0xe7bf[43]))[_0xe7bf[42]](moment())}function getReportPath(_0x2becx18,_0x2becx19,path){path= _0x2becx18[_0xe7bf[45]]+ _0xe7bf[46]+ path;if(_0x2becx18[_0xe7bf[47]]=== _0xe7bf[48]){return path}else {return getReportPath(_[_0xe7bf[49]](_0x2becx19,{id:_0x2becx18[_0xe7bf[47]]}),_0x2becx19,path)}}function docExtract(_0x2becxf,_0x2becx1b,_0x2becx1c,_0x2becx10,_0x2becx1d,_0x2becx1e){var _0x2becx1f=_0x2becxf[_0xe7bf[50]]=== _0xe7bf[51]?DefaultReport:CustomReport;var _0x2becx20;_0x2becx1f[_0xe7bf[88]](_0xe7bf[87])[_0xe7bf[85]](_0x2becxf[_0xe7bf[86]])[_0xe7bf[83]](function(_0x2becx25){if(!_0x2becx25){console[_0xe7bf[16]](_0xe7bf[84]);return};_0x2becx20= _0x2becx25;return ReportTree[_0xe7bf[85]](_0x2becxf[_0xe7bf[50]]=== _0xe7bf[51]?1:2)})[_0xe7bf[83]](function(_0x2becx19){_0x2becx19= JSON[_0xe7bf[73]](_0x2becx19[_0xe7bf[72]]);var _0x2becx18=_[_0xe7bf[49]](_0x2becx19,{id:_0x2becx20[_0xe7bf[47]]});var path=getReportPath(_0x2becx18,_0x2becx19,_0x2becx20[_0xe7bf[74]]);if(_0x2becxf[_0xe7bf[21]]=== _0xe7bf[20]){_0x2becx20[_0xe7bf[76]][_0xe7bf[75]]= _0x2becx20[_0xe7bf[76]][_0xe7bf[75]][_0xe7bf[79]](_0xe7bf[77],_0xe7bf[78])};return [_0x2becx20,ExtractedReport[_0xe7bf[82]]({name:_0x2becx20[_0xe7bf[74]],startDate:_0x2becx1b,endDate:_0x2becx1c,output:_0x2becxf[_0xe7bf[69]],type:_0x2becx10?_0xe7bf[80]:_0xe7bf[81],UserId:_0x2becx10?_0x2becx10[_0xe7bf[66]]:null})]})[_0xe7bf[71]](function(_0x2becx20,_0x2becx22){var _0x2becx23=cp[_0xe7bf[55]](__dirname+ _0xe7bf[54]);_0x2becx23[_0xe7bf[58]](_0xe7bf[61],function(_0x2becx24){console[_0xe7bf[16]](_0xe7bf[62],_0x2becx24);if(_0x2becxf[_0xe7bf[63]]&& _0x2becx24[_0xe7bf[64]]=== _0xe7bf[65]){sendReportByMail(_0x2becxf,_0x2becx22[_0xe7bf[66]],_0x2becx10,_0x2becx23)}else {_0x2becx23[_0xe7bf[67]]()}})[_0xe7bf[58]](_0xe7bf[59],function(){console[_0xe7bf[16]](_0xe7bf[60])})[_0xe7bf[58]](_0xe7bf[56],function(_0x2becx21){console[_0xe7bf[16]](_0xe7bf[57],_0x2becx21)});_0x2becx23[_0xe7bf[70]]({report:_0x2becx20,query:{startDate:_0x2becx1b,endDate:_0x2becx1c,startTime:_0x2becx1d|| null,endTime:_0x2becx1e|| null},extractedId:_0x2becx22[_0xe7bf[66]],user:_0x2becx10?_0x2becx10:{role:_0xe7bf[68]},type:_0x2becxf[_0xe7bf[69]]})})[_0xe7bf[53]](function(_0x2becx21){console[_0xe7bf[16]](_0xe7bf[52],_0x2becx21)})}function sendReportByMail(_0x2becxf,_0x2becx27,_0x2becx10,_0x2becx23){var _0x2becx28;return ExtractedReport[_0xe7bf[85]](_0x2becx27)[_0xe7bf[83]](function(extract){if(!extract){console[_0xe7bf[16]](_0xe7bf[93]);return};_0x2becx28= extract;if(_0x2becxf[_0xe7bf[8]]&& _0x2becxf[_0xe7bf[8]][_0xe7bf[94]]){var _0x2becx2a=getAttachment(_0x2becx28);var _0x2becx2b={subject:_0xe7bf[95],from:[_0x2becxf[_0xe7bf[8]][_0xe7bf[94]]],to:[_0x2becxf[_0xe7bf[96]]],cc:[],html:null,text:null,inReplyTo:null,status:_0xe7bf[97],attachment:true,UserId:_0x2becx10?_0x2becx10[_0xe7bf[66]]:null,MailAttachments:[_0x2becx2a]};return MailMessage[_0xe7bf[82]](_0x2becx2b,{include:[{model:MailAttachment}]})}else {throw  new Error(_0xe7bf[98])}})[_0xe7bf[83]](function(_0x2becx29){return _0x2becx28[_0xe7bf[92]](_0x2becx29)})[_0xe7bf[83]](function(){console[_0xe7bf[16]](_0xe7bf[91])})[_0xe7bf[53]](function(_0x2becx21){console[_0xe7bf[16]](_0xe7bf[90],_0x2becx21)})[_0xe7bf[89]](function(){_0x2becx23[_0xe7bf[67]]()})}function getAttachment(extract){var _0x2becx2d=path[_0xe7bf[104]](config[_0xe7bf[99]],_0xe7bf[100],_0xe7bf[101],_0xe7bf[102],extract[_0xe7bf[103]]);var _0x2becx2e=path[_0xe7bf[104]](config[_0xe7bf[99]],_0xe7bf[100],_0xe7bf[101],_0xe7bf[105]);var _0x2becx2f=path[_0xe7bf[109]](extract[_0xe7bf[103]],_0xe7bf[106]+ extract[_0xe7bf[108]][_0xe7bf[107]]());try{fs[_0xe7bf[110]](_0x2becx2d,path[_0xe7bf[104]](_0x2becx2e,_0x2becx2f));console[_0xe7bf[16]](_0xe7bf[111])}catch(err){console[_0xe7bf[56]](_0xe7bf[112]);return null};return {size:getFilesizeInBytes(_0x2becx2d),path:path[_0xe7bf[104]](_0x2becx2e,_0x2becx2f),name:extract[_0xe7bf[74]]+ _0xe7bf[113]+ moment(extract[_0xe7bf[115]])[_0xe7bf[27]](_0xe7bf[114])+ _0xe7bf[113]+ moment(extract[_0xe7bf[116]])[_0xe7bf[27]](_0xe7bf[114])+ _0xe7bf[106]+ extract[_0xe7bf[108]][_0xe7bf[107]](),type:_0xe7bf[117]+ extract[_0xe7bf[108]][_0xe7bf[107]](),basename:_0x2becx2f}}function getFilesizeInBytes(_0x2becx31){try{var _0x2becx32=fs[_0xe7bf[118]](_0x2becx31);var _0x2becx33=_0x2becx32[_0xe7bf[119]];return _0x2becx33}catch(err){return 0}}module[_0xe7bf[120]]= Reports
\ No newline at end of file