Built motion from commit 02c0abe.|0.0.118
[motion.git] / server / utils / report_extraction.js
index 335ac10..b0b8333 100644 (file)
@@ -1 +1 @@
-var _0x7140=["\x74\x6F\x2D\x63\x73\x76","\x70\x64\x66\x6D\x61\x6B\x65","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x73","\x6D\x6F\x6D\x65\x6E\x74","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x70\x61\x74\x68","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x72\x6F\x6F\x74","\x63\x6C\x69\x65\x6E\x74","\x61\x73\x73\x65\x74\x73","\x66\x6F\x6E\x74\x73","\x52\x6F\x62\x6F\x74\x6F\x2D\x52\x65\x67\x75\x6C\x61\x72\x2E\x74\x74\x66","\x6A\x6F\x69\x6E","\x52\x6F\x62\x6F\x74\x6F\x2D\x4D\x65\x64\x69\x75\x6D\x2E\x74\x74\x66","\x52\x6F\x62\x6F\x74\x6F\x2D\x49\x74\x61\x6C\x69\x63\x2E\x74\x74\x66","\x65\x78\x74\x72\x61\x63\x74\x50\x44\x46","\x70\x64\x66","\x65\x78\x74\x72\x61\x63\x74\x43\x53\x56","\x63\x73\x76","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6C\x6F\x67","\x71\x75\x65\x72\x79\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x65\x6D\x70\x74\x79","\x71\x75\x65\x72\x79\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x74\x68\x65\x6E","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x71\x75\x65\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F","\x2E\x70\x64\x66","\x61\x6C\x69\x61\x73","\x74\x61\x62\x6C\x65\x48\x65\x61\x64\x65\x72","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x66\x6F\x72\x4F\x77\x6E","\x6E\x61\x6D\x65","\x68\x65\x61\x64\x65\x72","\x20\x2D\x20","\x74\x61\x62\x6C\x65\x45\x78\x61\x6D\x70\x6C\x65","\x62\x6C\x61\x63\x6B","\x63\x72\x65\x61\x74\x65\x50\x64\x66\x4B\x69\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x66\x69\x6C\x65\x73\x2F\x72\x65\x70\x6F\x72\x74\x73\x2F","\x63\x72\x65\x61\x74\x65\x57\x72\x69\x74\x65\x53\x74\x72\x65\x61\x6D","\x65\x72\x72\x6F\x72","\x70\x64\x66\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x66\x69\x6E\x69\x73\x68","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x70\x69\x70\x65","\x65\x6E\x64","\x70\x64\x66\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x2E\x63\x73\x76","\x63\x73\x76\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x63\x73\x76\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74\x20\x77\x69\x74\x68\x20\x65\x72\x72\x6F\x72\x20\x3A\x20","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65","","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x43\x4F\x55\x4E\x54\x28\x44\x49\x53\x54\x49\x4E\x43\x54\x20\x25\x73\x29","\x66\x69\x65\x6C\x64","\x43\x4F\x55\x4E\x54\x20\x44\x49\x53\x54\x49\x4E\x43\x54","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x41\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x41\x53\x43","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x44\x45\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x44\x45\x53\x43","\x25\x73\x28\x25\x73\x29","\x25\x73\x20\x41\x53\x20\x27\x25\x73\x27","\x67\x72\x6F\x75\x70\x42\x79","\x6F\x72\x64\x65\x72\x42\x79","\x25\x73\x20\x25\x73","\x67\x72\x6F\x75\x70","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x70\x61\x72\x73\x65","\x20","\x2C","\x20\x46\x52\x4F\x4D\x20","\x74\x61\x62\x6C\x65","\x28\x29","\x20\x57\x48\x45\x52\x45\x20","\x20\x41\x4E\x44\x20\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3E\x3D\x20\x27","\x27","\x20\x41\x4E\x44\x20\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3C\x3D\x20\x27","\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20","\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20","\x28","\x72\x75\x6C\x65\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x20\x27","\x4C\x49\x4B\x45","\x25","\x76\x61\x6C\x75\x65","\x29"];var csv=require(_0x7140[0]);var pdfMake=require(_0x7140[1]);var _=require(_0x7140[2]);var util=require(_0x7140[3]);var ExtractedReport=require(_0x7140[5])[_0x7140[4]];var sequelize=require(_0x7140[5])[_0x7140[6]];var fs=require(_0x7140[7]);var moment=require(_0x7140[8]);var sr=require(_0x7140[9]);var path=require(_0x7140[10]);var config=require(_0x7140[11]);var fonts={Roboto:{normal:path[_0x7140[17]](config[_0x7140[12]],_0x7140[13],_0x7140[14],_0x7140[15],_0x7140[16]),bold:path[_0x7140[17]](config[_0x7140[12]],_0x7140[13],_0x7140[14],_0x7140[15],_0x7140[18]),italics:path[_0x7140[17]](config[_0x7140[12]],_0x7140[13],_0x7140[14],_0x7140[15],_0x7140[19]),bolditalics:path[_0x7140[17]](config[_0x7140[12]],_0x7140[13],_0x7140[14],_0x7140[15],_0x7140[19])}};exports[_0x7140[20]]=function(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10){general(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10,_0x7140[21])};exports[_0x7140[22]]=function(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10){general(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10,_0x7140[23])};function general(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10,_0xfeabx12){extract(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10,_0xfeabx12)}function extract(_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10,_0xfeabx12){var _0xfeabx14=buildReport(_0xfeabxd[_0x7140[24]],_0xfeabxe,_0xfeabxf);sequelize[_0x7140[34]](_0xfeabx14,{type:sequelize[_0x7140[33]][_0x7140[32]]})[_0x7140[31]](function(_0xfeabx16){if(_0xfeabx16){if(_0xfeabx16[_0x7140[28]]){switch(_0xfeabx12){case _0x7140[21]:createPdf(_0xfeabx16,_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10);break ;;case _0x7140[23]:createCsv(_0xfeabx16,_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10);break ;;default:createCsv(_0xfeabx16,_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx10);;}}else {updateExtracted(_0xfeabx10,null,_0x7140[29])}}else {updateExtracted(_0xfeabx10,null,_0x7140[30])}})[_0x7140[27]](function(_0xfeabx15){console[_0x7140[25]](_0xfeabx15);updateExtracted(_0xfeabx10,null,_0x7140[26]);});}function createPdf(_0xfeabx16,_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx18){var _0xfeabx19=sr({length:20,prefix:_0x7140[35],suffix:_0x7140[36]});var _0xfeabx1a=[];_[_0x7140[40]](_0xfeabxd.Fields,function(_0xfeabx1b){_0xfeabx1a[_0x7140[39]]({text:_0xfeabx1b[_0x7140[37]],style:_0x7140[38]})});var _0xfeabx1c=[_0xfeabx1a];_[_0x7140[40]](_0xfeabx16,function(_0xfeabx1b){var _0xfeabx1d=[];_[_0x7140[43]](_0xfeabx1b,function(_0xfeabx1e,_0xfeabx1f){_0xfeabx1d[_0x7140[39]](_0xfeabx1e instanceof Date?moment(_0xfeabx1e)[_0x7140[42]](_0x7140[41]).toString():_0xfeabx1e)});_0xfeabx1c[_0x7140[39]](_0xfeabx1d);});var _0xfeabx20={content:[{text:_0xfeabxd[_0x7140[44]],style:_0x7140[45]},moment(_0xfeabxe)[_0x7140[42]](_0x7140[41]).toString()+_0x7140[46]+moment(_0xfeabxf)[_0x7140[42]](_0x7140[41]).toString(),{style:_0x7140[47],table:{headerRows:1,body:_0xfeabx1c}}],styles:{header:{fontSize:18,bold:true,margin:[0,0,0,10]},subheader:{fontSize:16,bold:true,margin:[0,10,0,5]},tableExample:{margin:[0,5,0,15]},tableHeader:{bold:true,fontSize:13,color:_0x7140[48]}}};var _0xfeabx21= new pdfMake(fonts);var _0xfeabx22=_0xfeabx21[_0x7140[49]](_0xfeabx20);if(_0xfeabx22){var _0xfeabx23=fs[_0x7140[51]](__dirname+_0x7140[50]+_0xfeabx19);_0xfeabx23[_0x7140[54]](_0x7140[52],function(){updateExtracted(_0xfeabx18,null,_0x7140[53])});_0xfeabx23[_0x7140[54]](_0x7140[55],function(){updateExtracted(_0xfeabx18,_0xfeabx19,_0x7140[56])});_0xfeabx22[_0x7140[57]](_0xfeabx23);_0xfeabx22[_0x7140[58]]();}else {updateExtracted(_0xfeabx18,null,_0x7140[59])};}function createCsv(_0xfeabx16,_0xfeabxd,_0xfeabxe,_0xfeabxf,_0xfeabx18){var _0xfeabx19=sr({length:20,prefix:_0x7140[35],suffix:_0x7140[60]});var _0xfeabx25=csv(_0xfeabx16);if(_0xfeabx25){fs[_0x7140[62]](__dirname+_0x7140[50]+_0xfeabx19,_0xfeabx25,function(_0xfeabx15){if(_0xfeabx15){updateExtracted(_0xfeabx18,null,_0x7140[61])}else {updateExtracted(_0xfeabx18,_0xfeabx19,_0x7140[56])}})}else {updateExtracted(_0xfeabx18,null,_0x7140[63])};}function updateExtracted(_0xfeabx18,_0xfeabx19,_0xfeabx27){ExtractedReport[_0x7140[66]]({status:_0xfeabx27,savename:_0xfeabx19},{where:{id:_0xfeabx18}})[_0x7140[31]](function(){console[_0x7140[25]](_0x7140[65])})[_0x7140[27]](function(_0xfeabx15){console[_0x7140[25]](_0x7140[64]+_0xfeabx15)})}function buildReport(_0xfeabxd,_0xfeabxe,_0xfeabxf){var _0xfeabx29=[],_0xfeabx2a=[],_0xfeabx2b=[];_[_0x7140[40]](_0xfeabxd.Fields,function(_0xfeabx1b){var _0xfeabx2c=_0x7140[67];if(_0xfeabx1b[_0x7140[68]]){switch(_0xfeabx1b[_0x7140[68]]){case _0x7140[71]:_0xfeabx2c=util[_0x7140[42]](_0x7140[69],_0xfeabx1b[_0x7140[70]]);break ;;case _0x7140[73]:_0xfeabx2c=util[_0x7140[42]](_0x7140[72],_0xfeabx1b[_0x7140[70]],_0xfeabx1b[_0x7140[70]]);break ;;case _0x7140[75]:_0xfeabx2c=util[_0x7140[42]](_0x7140[74],_0xfeabx1b[_0x7140[70]],_0xfeabx1b[_0x7140[70]]);break ;;default:_0xfeabx2c=util[_0x7140[42]](_0x7140[76],_0xfeabx1b[_0x7140[68]],_0xfeabx1b[_0x7140[70]]);;}}else {_0xfeabx2c=_0xfeabx1b[_0x7140[70]]};_0xfeabx29[_0x7140[39]](util[_0x7140[42]](_0x7140[77],_0xfeabx2c,_0xfeabx1b[_0x7140[37]]));if(_0xfeabx1b[_0x7140[78]]){_0xfeabx2a[_0x7140[39]](_0xfeabx1b[_0x7140[70]])};if(_0xfeabx1b[_0x7140[79]]){_0xfeabx2b[_0x7140[39]](util[_0x7140[42]](_0x7140[80],_0xfeabx1b[_0x7140[70]],_0xfeabx1b[_0x7140[79]]))};});var _0xfeabx2d=getConditions(JSON[_0x7140[83]](_0xfeabxd[_0x7140[82]])[_0x7140[81]]);var _0xfeabx2e=_0x7140[32];_0xfeabx2e+=_0x7140[84]+_0xfeabx29[_0x7140[17]](_0x7140[85]);_0xfeabx2e+=_0x7140[86]+_0xfeabxd[_0x7140[87]];_0xfeabx2e+=_0xfeabx2d!==_0x7140[88]?_0x7140[89]+_0xfeabx2d:_0x7140[67];_0xfeabx2e+=_0x7140[90]+_0xfeabxe+_0x7140[91];_0xfeabx2e+=_0x7140[92]+_0xfeabxf+_0x7140[91];_0xfeabx2e+=_0xfeabx2a[_0x7140[28]]?_0x7140[93]+_0xfeabx2a[_0x7140[17]](_0x7140[85]):_0x7140[67];_0xfeabx2e+=_0xfeabx2b[_0x7140[28]]?_0x7140[94]+_0xfeabx2b[_0x7140[17]](_0x7140[85]):_0x7140[67];return _0xfeabx2e;}function getConditions(_0xfeabx30){if(!_0xfeabx30){return _0x7140[67]};for(var _0xfeabx31=_0x7140[95],_0xfeabx32=0;_0xfeabx32<_0xfeabx30[_0x7140[96]][_0x7140[28]];_0xfeabx32++){_0xfeabx32>0&&(_0xfeabx31+=_0x7140[84]+_0xfeabx30[_0x7140[97]]+_0x7140[84]);_0xfeabx31+=_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[81]]?getConditions(_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[81]]):_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[70]]+_0x7140[84]+_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[98]]+_0x7140[99]+(_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[98]]===_0x7140[100]?_0x7140[101]+_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[102]]+_0x7140[101]:_0xfeabx30[_0x7140[96]][_0xfeabx32][_0x7140[102]])+_0x7140[91];};return _0xfeabx31+_0x7140[103];}
\ No newline at end of file
+var _0x4250=["\x74\x6F\x2D\x63\x73\x76","\x70\x64\x66\x6D\x61\x6B\x65","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x73","\x6D\x6F\x6D\x65\x6E\x74","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x70\x61\x74\x68","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x66\x6F\x6E\x74\x73","\x52\x6F\x62\x6F\x74\x6F\x2D\x52\x65\x67\x75\x6C\x61\x72\x2E\x74\x74\x66","\x6A\x6F\x69\x6E","\x52\x6F\x62\x6F\x74\x6F\x2D\x4D\x65\x64\x69\x75\x6D\x2E\x74\x74\x66","\x52\x6F\x62\x6F\x74\x6F\x2D\x49\x74\x61\x6C\x69\x63\x2E\x74\x74\x66","\x6D\x65\x73\x73\x61\x67\x65","\x72\x65\x70\x6F\x72\x74","\x71\x75\x65\x72\x79","\x65\x78\x74\x72\x61\x63\x74\x65\x64\x49\x64","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x74\x79\x70\x65","\x75\x73\x65\x72","\x6F\x6E","\x6C\x6F\x67","\x71\x75\x65\x72\x79\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x66\x6F\x72\x4F\x77\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x70\x64\x66","\x63\x73\x76","\x65\x6D\x70\x74\x79","\x71\x75\x65\x72\x79\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x74\x68\x65\x6E","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x62\x75\x69\x6C\x64\x51\x75\x65\x72\x79","\x73\x70\x72\x65\x61\x64","\x62\x75\x69\x6C\x64\x46\x69\x6C\x74\x65\x72","\x74\x61\x62\x6C\x65","\x61\x6C\x6C","\x72\x65\x70\x6F\x72\x74\x5F","\x6E\x61\x6D\x65","\x5F","\x2E\x70\x64\x66","\x61\x6C\x69\x61\x73","\x74\x61\x62\x6C\x65\x48\x65\x61\x64\x65\x72","\x70\x75\x73\x68","","\x68\x65\x61\x64\x65\x72","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x23\x38\x32\x38\x36\x38\x32","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x46\x72\x6F\x6D\x3A\x20","\x6C\x61\x62\x65\x6C","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x20\x20\x54\x6F\x3A\x20","\x65\x6E\x64\x4F\x66","\x65\x6E\x64\x44\x61\x74\x65","\x74\x61\x62\x6C\x65\x45\x78\x61\x6D\x70\x6C\x65","\x6C\x61\x6E\x64\x73\x63\x61\x70\x65","\x62\x6C\x61\x63\x6B","\x63\x72\x65\x61\x74\x65\x50\x64\x66\x4B\x69\x74\x44\x6F\x63\x75\x6D\x65\x6E\x74","\x72\x65\x70\x6F\x72\x74\x73","\x63\x72\x65\x61\x74\x65\x57\x72\x69\x74\x65\x53\x74\x72\x65\x61\x6D","\x65\x72\x72\x6F\x72","\x70\x64\x66\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x66\x69\x6E\x69\x73\x68","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x70\x69\x70\x65","\x65\x6E\x64","\x70\x64\x66\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x2E\x63\x73\x76","\x63\x73\x76\x20\x77\x72\x69\x74\x65\x20\x65\x72\x72\x6F\x72","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x63\x73\x76\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x66\x69\x6E\x69\x73\x68\x65\x64","\x73\x65\x6E\x64","\x66\x69\x6E\x61\x6C\x6C\x79","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74\x20\x77\x69\x74\x68\x20\x65\x72\x72\x6F\x72\x20\x3A\x20","\x2D\x2D\x46\x69\x6E\x69\x73\x68\x65\x64\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6E\x67\x20\x72\x65\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65"];var csv=require(_0x4250[0]);var pdfMake=require(_0x4250[1]);var _=require(_0x4250[2]);var util=require(_0x4250[3]);var ExtractedReport=require(_0x4250[5])[_0x4250[4]];var sequelize=require(_0x4250[5])[_0x4250[6]];var fs=require(_0x4250[7]);var moment=require(_0x4250[8]);var sr=require(_0x4250[9]);var path=require(_0x4250[10]);var config=require(_0x4250[11]);var Promise=require(_0x4250[12]);var reportBuildUtils=require(_0x4250[13]);var fonts={Roboto:{normal:path[_0x4250[16]](config[_0x4250[14]],_0x4250[15]),bold:path[_0x4250[16]](config[_0x4250[14]],_0x4250[17]),italics:path[_0x4250[16]](config[_0x4250[14]],_0x4250[18]),bolditalics:path[_0x4250[16]](config[_0x4250[14]],_0x4250[18])}};process[_0x4250[26]](_0x4250[19],function(_0x4312xf){general(_0x4312xf[_0x4250[20]],_0x4312xf[_0x4250[21]],_0x4312xf[_0x4250[22]],_0x4312xf[_0x4250[24]][_0x4250[23]](),_0x4312xf[_0x4250[25]])});function general(_0x4312x11,_0x4312x12,_0x4312x13,_0x4312x14,_0x4312x15){extract(_0x4312x11,_0x4312x12,_0x4312x13,_0x4312x14,_0x4312x15)}function extract(_0x4312x11,_0x4312x17,_0x4312x13,_0x4312x14,_0x4312x15){return Promise[_0x4250[46]]([])[_0x4250[39]](function(){return _0x4312x11[_0x4250[45]]})[_0x4250[39]](reportBuildUtils[_0x4250[44]](_0x4312x15))[_0x4250[39]](function(_0x4312x1d){return [_0x4312x1d,_0x4312x11]})[_0x4250[43]](reportBuildUtils[_0x4250[42]](_0x4312x17))[_0x4250[39]](function(_0x4312x12){return _0x4312x12?sequelize[_0x4250[21]](_0x4312x12,{type:sequelize[_0x4250[41]][_0x4250[40]]}):[]})[_0x4250[39]](function(_0x4312x19){if(_0x4312x19){if(_0x4312x19[_0x4250[30]]){_[_0x4250[34]](_0x4312x19,function(_0x4312x1a){_[_0x4250[33]](_0x4312x1a,function(_0x4312x1b,_0x4312x1c){if(_0x4312x1b instanceof  Date){_0x4312x1a[_0x4312x1c]= moment(_0x4312x1b)[_0x4250[32]](_0x4250[31]).toString()}})});switch(_0x4312x14){case _0x4250[35]:createPdf(_0x4312x19,_0x4312x11,_0x4312x17,_0x4312x13);break;case _0x4250[36]:createCsv(_0x4312x19,_0x4312x11,_0x4312x17,_0x4312x13);break;default:createCsv(_0x4312x19,_0x4312x11,_0x4312x17,_0x4312x13)}}else {updateExtracted(_0x4312x13,null,_0x4250[37])}}else {updateExtracted(_0x4312x13,null,_0x4250[38])}})[_0x4250[29]](function(_0x4312x18){console[_0x4250[27]](_0x4312x18);updateExtracted(_0x4312x13,null,_0x4250[28])})}function createPdf(_0x4312x19,_0x4312x11,_0x4312x17,_0x4312x1f){var _0x4312x20=sr({length:20,prefix:_0x4250[47]+ _0x4312x11[_0x4250[48]]+ _0x4250[49],suffix:_0x4250[50]});var _0x4312x21=[],_0x4312x22=0;_[_0x4250[34]](_0x4312x11.Fields,function(_0x4312x23){_0x4312x21[_0x4250[53]]({text:String(_0x4312x23[_0x4250[51]]),style:_0x4250[52]});_0x4312x22++});var _0x4312x24=[_0x4312x21];_[_0x4250[34]](_0x4312x19,function(_0x4312x23){var _0x4312x1a=[];_[_0x4250[33]](_0x4312x23,function(_0x4312x25,_0x4312x1c){_0x4312x1a[_0x4250[53]](_0x4312x25?String(_0x4312x25):_0x4250[54])});_0x4312x24[_0x4250[53]](_0x4312x1a)});var _0x4312x26=[{text:_0x4312x11[_0x4250[48]],style:_0x4250[55]}];if(_0x4312x11[_0x4250[56]]){_0x4312x26[_0x4250[53]]({text:_0x4312x11[_0x4250[56]]|| _0x4250[54],color:_0x4250[57],margin:[0,0,0,10]})};if(_0x4312x17[_0x4250[58]]){_0x4312x26[_0x4250[53]]({text:[{text:_0x4250[59],style:_0x4250[60]},moment(_0x4312x17[_0x4250[58]])[_0x4250[63]](_0x4250[62])[_0x4250[32]](_0x4250[61]).toString(),{text:_0x4250[64],style:_0x4250[60]},moment(_0x4312x17[_0x4250[66]]|| _0x4312x17[_0x4250[58]])[_0x4250[65]](_0x4250[62])[_0x4250[32]](_0x4250[61]).toString()]})};_0x4312x26[_0x4250[53]]({style:_0x4250[67],table:{headerRows:1,body:_0x4312x24}});var _0x4312x27={pageOrientation:_0x4250[68],content:_0x4312x26,styles:{header:{fontSize:18,bold:true,margin:[0,0,0,10]},tableExample:{margin:[0,10,0,15]},tableHeader:{bold:true,fontSize:13,color:_0x4250[69]},label:{bold:true,color:_0x4250[69]}}};var _0x4312x28= new pdfMake(fonts);var _0x4312x29=_0x4312x28[_0x4250[70]](_0x4312x27);if(_0x4312x29){var _0x4312x2a=fs[_0x4250[72]](config[_0x4250[71]]+ _0x4312x20);_0x4312x2a[_0x4250[26]](_0x4250[73],function(){updateExtracted(_0x4312x1f,null,_0x4250[74])});_0x4312x2a[_0x4250[26]](_0x4250[75],function(){updateExtracted(_0x4312x1f,_0x4312x20,_0x4250[76])});_0x4312x29[_0x4250[77]](_0x4312x2a);_0x4312x29[_0x4250[78]]()}else {updateExtracted(_0x4312x1f,null,_0x4250[79])}}function createCsv(_0x4312x19,_0x4312x11,_0x4312x17,_0x4312x1f){var _0x4312x20=sr({length:20,prefix:_0x4250[47]+ _0x4312x11[_0x4250[48]]+ _0x4250[49],suffix:_0x4250[80]});var _0x4312x2c=csv(_0x4312x19);if(_0x4312x2c){fs[_0x4250[82]](config[_0x4250[71]]+ _0x4312x20,_0x4312x2c,function(_0x4312x18){if(_0x4312x18){console[_0x4250[27]](_0x4312x18);updateExtracted(_0x4312x1f,null,_0x4250[81])}else {updateExtracted(_0x4312x1f,_0x4312x20,_0x4250[76])}})}else {updateExtracted(_0x4312x1f,null,_0x4250[83])}}function updateExtracted(_0x4312x1f,_0x4312x20,_0x4312x2e){return ExtractedReport[_0x4250[89]]({status:_0x4312x2e,savename:_0x4312x20},{where:{id:_0x4312x1f}})[_0x4250[39]](function(){console[_0x4250[27]](_0x4250[88])})[_0x4250[29]](function(_0x4312x18){console[_0x4250[27]](_0x4250[87]+ _0x4312x18)})[_0x4250[86]](function(){process[_0x4250[85]]({message:_0x4250[84],status:_0x4312x2e})})}
\ No newline at end of file