Built motion from commit (unavailable).|2.4.3
[motion2.git] / server / api / saCreditNote / saCreditNote.controller.js
index ac21c25..3d8f757 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7de=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','SACreditNote','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','where','merge','type','key','VIRTUAL','field','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','update','find','describe','toString','join','root','server','tmp','files','images','logo-invoice.png','paid-invoice.png','format','Credinote_%s-%s.pdf','SACreditNoteDetail','details','portrait','10mm','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','contents','default','footer','</div>','mkdirSync','<html>','<head>\x20<style\x20type=\x22text/css\x22>\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}</style></head>','Phone','Telefono','Fax','Email','VAT\x20number','P.IVA','C.F.','I.S.\x20code','Codice\x20S.D.I.','Soc.Cap.\x20fp','Cap.Soc.\x20iv','Invoice','Fattura','Proforma','Credit\x20note','Nota\x20di\x20credito','Due\x20date','Scadenza','Item','Articolo','Description','Descrizione','Hrs/Qty','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Subtotal','Imponibile','Total','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Bank\x20name','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','receivingCountry','Italy','<table\x20class=\x22center\x22>','<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://','\x22\x20width=\x22180\x22></td></tr>','<tr>','<td\x20class=\x22issuerInfo\x22>\x20%s<br/>','creditnote','issuerName','%s<br/>','issuerStreet','\x20%s','-\x20%s\x20<br/>','issuerCountry','fax',':\x20%s<br/>','email','issuerEmail','piva','issuerPIVA','issuerFiscalCode','sdi','issuerSocCap','</td>','<td></td>','<td\x20class=\x22receiperInfo\x22>','<div\x20class=\x22receiperCompanyName\x22>%s</div>','companyName','receivingStreet','%s\x20-\x20','receivingPostalCode','receivingCity','<div\x20class=\x22reciperFiscalInfo\x22>','receivingFiscalCode','receivingSDICode','</div></td>','</tr>','<div\x20class=\x22invoiceNumber\x22>','<div\x20class=\x22createdDate\x22>%s,\x20','issuerCity','updatedAt','%s\x20</div>','saExpiryDay','DD/MM/YYYY','<td\x20colspan=\x223\x22>','<table\x20class=\x22roundedCorners\x22>','<th\x20class=\x22itemTabTitle\x22>','item','</th>','description','hrsqty','subtotal','netPrice','discount','tax','quantity','<td>%s</td>','productName','<td\x20class=\x22numberCenter\x22>%d</td>','<td\x20class=\x22numberRight\x22>','toFixed','\x20&euro;</td>','</tr></table><div\x20class=\x22divTotal\x22><table\x20class=\x22tabTotal\x22>','isNil','receivingFiscalMessage','indexOf','split\x20payment','<td\x20>','<td\x20class=\x22\x20numberRight\x22>\x20','<td\x20class=\x22itemTotal\x22>','<td\x20class=\x22total\x22>','</td><td\x20class=\x22total\x20numberRight\x22>','</table>\x20</td>','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','<td\x20\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','replace','<br\x20/>','<div\x20class=\x22issuerFiled\x22>','sendpayment',':</div>','issuerBankAccount','accountholder',':\x20<span\x20class=\x22issuerData\x22>','bankname','issuerBankName','</span>\x20</div>','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCountry','</span></div>','abi','cab','issuerABI','issuerCAB','bic','iban','paypal','issuerPayPal','thank1','<span>','</span>','thank2','</table>','</body>','</html>','toFile','log','TCL:\x20exports.getCreditnotePDF\x20->\x20saveTo,\x20fileName','err','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a3339,_0x49273c){var _0x243c5b=function(_0x2f4638){while(--_0x2f4638){_0x5a3339['push'](_0x5a3339['shift']());}};_0x243c5b(++_0x49273c);}(_0xf7de,0x1e8));var _0xef7d=function(_0xb92c08,_0x25c6ad){_0xb92c08=_0xb92c08-0x0;var _0x361491=_0xf7de[_0xb92c08];return _0x361491;};'use strict';var pdf=require(_0xef7d('0x0'));var emlformat=require(_0xef7d('0x1'));var rimraf=require(_0xef7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef7d('0x3'));var rp=require('request-promise');var moment=require(_0xef7d('0x4'));var BPromise=require(_0xef7d('0x5'));var Mustache=require('mustache');var util=require(_0xef7d('0x6'));var path=require(_0xef7d('0x7'));var sox=require('sox');var csv=require(_0xef7d('0x8'));var ejs=require(_0xef7d('0x9'));var fs=require('fs');var _=require(_0xef7d('0xa'));var squel=require('squel');var crypto=require(_0xef7d('0xb'));var jsforce=require(_0xef7d('0xc'));var deskjs=require(_0xef7d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xef7d('0xe'));var Papa=require('papaparse');var Redis=require(_0xef7d('0xf'));var authService=require(_0xef7d('0x10'));var qs=require(_0xef7d('0x11'));var hardwareService=require(_0xef7d('0x12'));var logger=require(_0xef7d('0x13'))(_0xef7d('0x14'));var utils=require(_0xef7d('0x15'));var config=require(_0xef7d('0x16'));var db=require(_0xef7d('0x17'))['db'];function respondWithStatusCode(_0x32beb3,_0x5543fa){_0x5543fa=_0x5543fa||0xcc;return function(_0x2a4169){if(_0x2a4169){return _0x32beb3[_0xef7d('0x18')](_0x5543fa);}return _0x32beb3[_0xef7d('0x19')](_0x5543fa)['end']();};}function respondWithResult(_0x316de6,_0x28711f){_0x28711f=_0x28711f||0xc8;return function(_0x44b95c){if(_0x44b95c){return _0x316de6[_0xef7d('0x19')](_0x28711f)['json'](_0x44b95c);}};}function respondWithFilteredResult(_0x4fb4ce,_0x2b3180){return function(_0x52fd69){if(_0x52fd69){var _0x5729f5=_0x52fd69[_0xef7d('0x1a')],_0x2bab5d=_0x2b3180[_0xef7d('0x1b')],_0x9a3313=_0x2b3180['offset']+_0x2b3180[_0xef7d('0x1c')],_0x493d32;if(_0x9a3313>=_0x5729f5){_0x9a3313=_0x5729f5;_0x493d32=0xc8;}else{_0x493d32=0xce;}_0x4fb4ce['status'](_0x493d32);return _0x4fb4ce['set'](_0xef7d('0x1d'),_0x2bab5d+'-'+_0x9a3313+'/'+_0x5729f5)[_0xef7d('0x1e')](_0x52fd69);}return null;};}function patchUpdates(_0x38395f){return function(_0x26f971){try{jsonpatch[_0xef7d('0x1f')](_0x26f971,_0x38395f,!![]);}catch(_0x1b6bf4){return BPromise[_0xef7d('0x20')](_0x1b6bf4);}return _0x26f971[_0xef7d('0x21')]();};}function saveUpdates(_0x36c58a,_0x3c7827){return function(_0x3e1a7d){if(_0x3e1a7d){return _0x3e1a7d['update'](_0x36c58a)[_0xef7d('0x22')](function(_0x4f0763){return _0x4f0763;});}return null;};}function removeEntity(_0x34eac0,_0xc84416){return function(_0xa2e26a){if(_0xa2e26a){return _0xa2e26a[_0xef7d('0x23')]()[_0xef7d('0x22')](function(){_0x34eac0[_0xef7d('0x19')](0xcc)[_0xef7d('0x24')]();});}};}function handleEntityNotFound(_0x37ae50,_0x3966aa){return function(_0x55f332){if(!_0x55f332){_0x37ae50[_0xef7d('0x18')](0x194);}return _0x55f332;};}function handleError(_0x56ec0a,_0x4e6374){_0x4e6374=_0x4e6374||0x1f4;return function(_0x59ea10){logger['error'](_0x59ea10[_0xef7d('0x25')]);if(_0x59ea10[_0xef7d('0x26')]){delete _0x59ea10['name'];}_0x56ec0a[_0xef7d('0x19')](_0x4e6374)[_0xef7d('0x27')](_0x59ea10);};}exports[_0xef7d('0x28')]=function(_0x431506,_0x7e97df){var _0x1314b5={},_0x34ae17={},_0x256f5a={'count':0x0,'rows':[]};var _0x5cc748=db[_0xef7d('0x29')]['rawAttributes'];_0x34ae17[_0xef7d('0x2a')]=_[_0xef7d('0x2b')](_0x5cc748);_0x34ae17[_0xef7d('0x2c')]=_[_0xef7d('0x2b')](_0x431506[_0xef7d('0x2c')]);_0x34ae17['filters']=_[_0xef7d('0x2d')](_0x34ae17['model'],_0x34ae17[_0xef7d('0x2c')]);_0x1314b5[_0xef7d('0x2e')]=_[_0xef7d('0x2d')](_0x34ae17[_0xef7d('0x2a')],qs[_0xef7d('0x2f')](_0x431506[_0xef7d('0x2c')][_0xef7d('0x2f')]));_0x1314b5[_0xef7d('0x2e')]=_0x1314b5[_0xef7d('0x2e')][_0xef7d('0x30')]?_0x1314b5[_0xef7d('0x2e')]:_0x34ae17[_0xef7d('0x2a')];if(!_0x431506[_0xef7d('0x2c')]['hasOwnProperty'](_0xef7d('0x31'))){_0x1314b5[_0xef7d('0x1c')]=qs['limit'](_0x431506[_0xef7d('0x2c')][_0xef7d('0x1c')]);_0x1314b5['offset']=qs['offset'](_0x431506[_0xef7d('0x2c')][_0xef7d('0x1b')]);}_0x1314b5[_0xef7d('0x32')]=qs[_0xef7d('0x33')](_0x431506['query'][_0xef7d('0x33')]);_0x1314b5['where']=qs[_0xef7d('0x34')](_['pick'](_0x431506['query'],_0x34ae17['filters']));if(_0x431506[_0xef7d('0x2c')]['filter']){_0x1314b5[_0xef7d('0x35')]=_[_0xef7d('0x36')](_0x1314b5[_0xef7d('0x35')],{'$or':_['map'](_0x5cc748,function(_0x4c5942){if(_0x4c5942[_0xef7d('0x37')][_0xef7d('0x38')]!==_0xef7d('0x39')){var _0x492763={};_0x492763[_0x4c5942[_0xef7d('0x3a')]]={'$like':'%'+_0x431506[_0xef7d('0x2c')][_0xef7d('0x3b')]+'%'};return _0x492763;}})});}_0x1314b5=_[_0xef7d('0x36')]({},_0x1314b5,_0x431506[_0xef7d('0x3c')]);var _0x38963a={'where':_0x1314b5[_0xef7d('0x35')]};return db['SACreditNote']['count'](_0x38963a)[_0xef7d('0x22')](function(_0x4e7c1d){_0x256f5a['count']=_0x4e7c1d;if(_0x431506['query'][_0xef7d('0x3d')]){_0x1314b5['include']=[{'all':!![]}];}return db['SACreditNote'][_0xef7d('0x3e')](_0x1314b5);})[_0xef7d('0x22')](function(_0x5b827f){_0x256f5a[_0xef7d('0x3f')]=_0x5b827f;return _0x256f5a;})[_0xef7d('0x22')](respondWithFilteredResult(_0x7e97df,_0x1314b5))[_0xef7d('0x40')](handleError(_0x7e97df,null));};exports['show']=function(_0x179f6e,_0x303685){var _0x551e17={'raw':![],'where':{'id':_0x179f6e[_0xef7d('0x41')]['id']}},_0xfa4ca2={};_0xfa4ca2[_0xef7d('0x2a')]=_[_0xef7d('0x2b')](db[_0xef7d('0x29')][_0xef7d('0x42')]);_0xfa4ca2[_0xef7d('0x2c')]=_[_0xef7d('0x2b')](_0x179f6e['query']);_0xfa4ca2[_0xef7d('0x34')]=_['intersection'](_0xfa4ca2[_0xef7d('0x2a')],_0xfa4ca2[_0xef7d('0x2c')]);_0x551e17['attributes']=_['intersection'](_0xfa4ca2[_0xef7d('0x2a')],qs[_0xef7d('0x2f')](_0x179f6e[_0xef7d('0x2c')][_0xef7d('0x2f')]));_0x551e17[_0xef7d('0x2e')]=_0x551e17[_0xef7d('0x2e')][_0xef7d('0x30')]?_0x551e17['attributes']:_0xfa4ca2[_0xef7d('0x2a')];if(_0x179f6e[_0xef7d('0x2c')][_0xef7d('0x3d')]){_0x551e17[_0xef7d('0x43')]=[{'all':!![]}];}_0x551e17=_['merge']({},_0x551e17,_0x179f6e[_0xef7d('0x3c')]);return db['SACreditNote']['find'](_0x551e17)['then'](handleEntityNotFound(_0x303685,null))['then'](respondWithResult(_0x303685,null))[_0xef7d('0x40')](handleError(_0x303685,null));};exports[_0xef7d('0x44')]=function(_0x4646de,_0x173151){return db[_0xef7d('0x29')]['create'](_0x4646de[_0xef7d('0x45')],{})[_0xef7d('0x22')](respondWithResult(_0x173151,0xc9))[_0xef7d('0x40')](handleError(_0x173151,null));};exports[_0xef7d('0x46')]=function(_0xd160de,_0x989707){if(_0xd160de['body']['id']){delete _0xd160de['body']['id'];}return db['SACreditNote']['find']({'where':{'id':_0xd160de[_0xef7d('0x41')]['id']}})[_0xef7d('0x22')](handleEntityNotFound(_0x989707,null))['then'](saveUpdates(_0xd160de[_0xef7d('0x45')],null))['then'](respondWithResult(_0x989707,null))[_0xef7d('0x40')](handleError(_0x989707,null));};exports[_0xef7d('0x23')]=function(_0x1b737e,_0x5cf4fd){return db['SACreditNote'][_0xef7d('0x47')]({'where':{'id':_0x1b737e['params']['id']}})[_0xef7d('0x22')](handleEntityNotFound(_0x5cf4fd,null))[_0xef7d('0x22')](removeEntity(_0x5cf4fd,null))[_0xef7d('0x40')](handleError(_0x5cf4fd,null));};exports['describe']=function(_0x3ffa27,_0x2d2d18){return db[_0xef7d('0x29')][_0xef7d('0x48')]()[_0xef7d('0x22')](respondWithResult(_0x2d2d18,null))[_0xef7d('0x40')](handleError(_0x2d2d18,null));};exports['getCreditnotePDF']=function(_0x3ada2b,_0x3cf151){var _0x5063cd=moment()['unix']()[_0xef7d('0x49')]();var _0x1e0ca1=path[_0xef7d('0x4a')](config[_0xef7d('0x4b')],_0xef7d('0x4c'),'files',_0xef7d('0x4d'));var _0x3bc591=path[_0xef7d('0x4a')](config['root'],_0xef7d('0x4c'),_0xef7d('0x4e'),_0xef7d('0x4f'),'logos',_0xef7d('0x50'));var _0x38e05c=path[_0xef7d('0x4a')](config[_0xef7d('0x4b')],_0xef7d('0x4c'),_0xef7d('0x4e'),'images','logos',_0xef7d('0x51'));var _0x51cdf5=path['join'](_0x1e0ca1,_0x5063cd);var _0xc385ac=util[_0xef7d('0x52')](_0xef7d('0x53'),_0x3ada2b[_0xef7d('0x41')]['id'],_0x5063cd);var _0x39af72=path[_0xef7d('0x4a')](_0x51cdf5,_0xc385ac);var _0x1d284e=![];var _0x231e98={};return db[_0xef7d('0x29')][_0xef7d('0x47')]({'where':{'id':_0x3ada2b[_0xef7d('0x41')]['id']},'raw':!![]})[_0xef7d('0x22')](handleEntityNotFound(_0x3cf151,null))['then'](function(_0x2acafb){if(_0x2acafb){_0x231e98['creditnote']=_0x2acafb;return db[_0xef7d('0x54')][_0xef7d('0x3e')]({'where':{'CreditNoteId':_0x2acafb['id']},'raw':!![],'logging':console['log']})[_0xef7d('0x22')](function(_0x1904db){_0x231e98[_0xef7d('0x55')]=_0x1904db;_0x1d284e=!![];var _0x4af906='';var _0x3baac3={'format':'A4','orientation':_0xef7d('0x56'),'border':'1cm','footer':{'height':_0xef7d('0x57'),'contents':{'default':_0xef7d('0x58')}}};_0x3baac3['footer'][_0xef7d('0x59')][_0xef7d('0x5a')]=_0x3baac3[_0xef7d('0x5b')][_0xef7d('0x59')][_0xef7d('0x5a')]+'<div\x20class=\x22issuerFiledWeb\x22>'+_0x231e98['creditnote']['issuerWeb']+_0xef7d('0x5c');fs[_0xef7d('0x5d')](_0x51cdf5);_0x4af906=_0xef7d('0x5e');_0x4af906+=_0xef7d('0x5f');_0x4af906+='<body>';var _0x5441a8={'phone':{'en':_0xef7d('0x60'),'it':_0xef7d('0x61')},'fax':{'en':'Fax','it':_0xef7d('0x62')},'email':{'en':'Email','it':_0xef7d('0x63')},'piva':{'en':_0xef7d('0x64'),'it':_0xef7d('0x65')},'cf':{'en':'Tax\x20code','it':_0xef7d('0x66')},'sdi':{'en':_0xef7d('0x67'),'it':_0xef7d('0x68')},'cs':{'en':_0xef7d('0x69'),'it':_0xef7d('0x6a')},'invoice':{'en':_0xef7d('0x6b'),'it':_0xef7d('0x6c')},'proforma':{'en':_0xef7d('0x6d'),'it':_0xef7d('0x6d')},'creditnote':{'en':_0xef7d('0x6e'),'it':_0xef7d('0x6f')},'duedate':{'en':_0xef7d('0x70'),'it':_0xef7d('0x71')},'item':{'en':_0xef7d('0x72'),'it':_0xef7d('0x73')},'description':{'en':_0xef7d('0x74'),'it':_0xef7d('0x75')},'hrsqty':{'en':_0xef7d('0x76'),'it':_0xef7d('0x77')},'unitprice':{'en':_0xef7d('0x78'),'it':_0xef7d('0x79')},'subtotal':{'en':_0xef7d('0x7a'),'it':_0xef7d('0x7b')},'discount':{'en':_0xef7d('0x7c'),'it':_0xef7d('0x7d')},'total':{'en':_0xef7d('0x7e'),'it':_0xef7d('0x7f')},'tax':{'en':'Tax','it':'Tasse'},'nettopay':{'en':_0xef7d('0x80'),'it':'Totale'},'sendpayment':{'en':_0xef7d('0x81'),'it':_0xef7d('0x82')},'accountholder':{'en':'Account\x20Holder','it':'Conto\x20intestato\x20a'},'bankname':{'en':_0xef7d('0x83'),'it':_0xef7d('0x84')},'bankaddress':{'en':_0xef7d('0x85'),'it':_0xef7d('0x86')},'abi':{'en':_0xef7d('0x87'),'it':_0xef7d('0x87')},'cab':{'en':_0xef7d('0x88'),'it':'CAB'},'bic':{'en':_0xef7d('0x89'),'it':'BIC'},'swif':{'en':_0xef7d('0x8a'),'it':_0xef7d('0x8a')},'iban':{'en':_0xef7d('0x8b'),'it':_0xef7d('0x8b')},'paypal':{'en':_0xef7d('0x8c'),'it':_0xef7d('0x8d')},'thank1':{'en':_0xef7d('0x8e'),'it':'Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20'},'thank2':{'en':_0xef7d('0x8f'),'it':_0xef7d('0x90')}};var _0x2f77cd='it';if(_0x231e98['creditnote'][_0xef7d('0x91')]!==_0xef7d('0x92')){_0x2f77cd='en';}_0x4af906+=_0xef7d('0x93');_0x4af906+=_0xef7d('0x94')+_0x3bc591+_0xef7d('0x95');_0x4af906+=_0xef7d('0x96');_0x4af906+=util['format'](_0xef7d('0x97'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x99')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9b')]);_0x4af906+=util[_0xef7d('0x52')]('%s',_0x231e98[_0xef7d('0x98')]['issuerPostalCode']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9c'),_0x231e98['creditnote']['issuerCity']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9d'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9e')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9d'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9e')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['phone'][_0x2f77cd]+':\x20%s<br/>',_0x231e98['creditnote']['issuerPhone']);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0x9f')][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98[_0xef7d('0x98')]['issuerFax']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa1')][_0x2f77cd]+_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xa2')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa3')][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xa4')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['cf'][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98['creditnote'][_0xef7d('0xa5')]);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0xa6')][_0x2f77cd]+_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')]['issuerSDICode']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['cs'][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98['creditnote'][_0xef7d('0xa7')]);_0x4af906+=_0xef7d('0xa8');_0x4af906+=_0xef7d('0xa9');_0x4af906+=_0xef7d('0xaa');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xab'),_0x231e98['creditnote'][_0xef7d('0xac')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xad')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xae'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xaf')]);_0x4af906+=util['format'](_0xef7d('0x9a'),_0x231e98['creditnote'][_0xef7d('0xb0')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98['creditnote'][_0xef7d('0x91')]);_0x4af906+=util['format'](_0xef7d('0xb1')+_0x5441a8['cf'][_0x2f77cd]+':\x20%s<br/>',_0x231e98[_0xef7d('0x98')][_0xef7d('0xb2')]);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0xa3')][_0x2f77cd]+':\x20%s<br/>',_0x231e98[_0xef7d('0x98')]['receivingPIVA']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa6')][_0x2f77cd]+':\x20%s<br/>',_0x231e98['creditnote'][_0xef7d('0xb3')]);_0x4af906+=_0xef7d('0xb4');_0x4af906+=_0xef7d('0xb5');_0x4af906+='<tr>';_0x4af906+='<td\x20colspan=\x223\x22>';_0x4af906+=util['format'](_0xef7d('0xb6')+_0x5441a8[_0xef7d('0x98')][_0x2f77cd]+'\x20N.%d</div>',_0x2acafb['id']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xb7'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xb8')]);var _0x4d131e=moment(_0x231e98[_0xef7d('0x98')][_0xef7d('0xb9')])[_0xef7d('0x52')]('DD/MM/YYYY');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xba'),_0x4d131e);var _0x3744d2=moment(_0x231e98[_0xef7d('0x98')]['updatedAt'])['add'](_0x231e98[_0xef7d('0x98')][_0xef7d('0xbb')],'days')[_0xef7d('0x52')](_0xef7d('0xbc'));_0x4af906+=util[_0xef7d('0x52')]('<div\x20class=\x22duedDate\x22>'+_0x5441a8['duedate'][_0x2f77cd]+':\x20%s</div></td>',_0x3744d2);_0x4af906+=_0xef7d('0xb5');_0x4af906+='<tr>';_0x4af906+=_0xef7d('0xbd');_0x4af906+=_0xef7d('0xbe');_0x4af906+='<tr>';_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc0')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc2')][_0x2f77cd]+'</th>';_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc3')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8['unitprice'][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc4')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+='</tr>';var _0x56e6b3=0x0;var _0x3c9734=0x0;for(var _0x352fee=0x0;_0x352fee<_0x231e98[_0xef7d('0x55')][_0xef7d('0x30')];_0x352fee++){var _0x52e713=0x0;var _0x4753ec=0x0;var _0x36f760=0x0;var _0x315dc0=0x0;_0x52e713=_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]-_0x231e98[_0xef7d('0x55')][_0x352fee]['netPrice']/0x64*_0x231e98['details'][_0x352fee][_0xef7d('0xc6')];_0x4753ec=_0x52e713/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc7')];_0x36f760=_0x52e713*_0x231e98['details'][_0x352fee][_0xef7d('0xc8')];_0x315dc0=_0x4753ec*_0x231e98['details'][_0x352fee]['quantity'];_0x4af906+=_0xef7d('0x96');_0x4af906+=util['format'](_0xef7d('0xc9'),_0x231e98['details'][_0x352fee][_0xef7d('0xca')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xc9'),_0x231e98[_0xef7d('0x55')][_0x352fee]['productDescription']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xcb'),_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc8')]);_0x4af906+=_0xef7d('0xcc')+_0x52e713[_0xef7d('0xcd')](0x2)+'\x20&euro;</td>';_0x4af906+=_0xef7d('0xcc')+_0x36f760[_0xef7d('0xcd')](0x2)+_0xef7d('0xce');_0x4af906+=_0xef7d('0xb5');_0x56e6b3+=_0x36f760;_0x3c9734+=_0x315dc0;}_0x4af906+=_0xef7d('0xcf');if(!_[_0xef7d('0xd0')](_0x231e98[_0xef7d('0x98')][_0xef7d('0xc6')])){var _0x166fde=0x0;var _0x4fc44f=0x0;var _0x210a39=_0x231e98[_0xef7d('0x98')]['discount']*0x64/_0x56e6b3;for(var _0x352fee=0x0;_0x352fee<_0x231e98[_0xef7d('0x55')][_0xef7d('0x30')];_0x352fee++){var _0x430630=0x0;var _0x1705b6=0x0;var _0x987301=0x0;_0x52e713=_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]-_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee]['discount'];_0x430630=_0x52e713/0x64*_0x210a39;_0x1705b6=_0x52e713-_0x430630;_0x987301=_0x1705b6*_0x231e98[_0xef7d('0x55')][_0x352fee]['quantity'];_0x166fde+=_0x987301;_0x4fc44f+=_0x987301/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee]['tax'];}}var _0x2ce295=0x0;var _0x579318=0x0;var _0x365bf7=![];var _0x46a3ec=_0x231e98[_0xef7d('0x98')][_0xef7d('0xd1')];if(_0x46a3ec[_0xef7d('0xd2')](_0xef7d('0xd3'))!=-0x1){_0x365bf7=!![];}if(!_[_0xef7d('0xd0')](_0x231e98['creditnote']['discount'])){_0x4af906+=_0xef7d('0x96');if(_0x231e98[_0xef7d('0x98')]['discount']>0x0){_0x4af906+=_0xef7d('0xd4')+_0x5441a8[_0xef7d('0xc6')][_0x2f77cd]+'</td>';_0x4af906+=_0xef7d('0xd5')+_0x231e98['creditnote']['discount'][_0xef7d('0xcd')](0x2)+'\x20&euro;</td>';}_0x4af906+=_0xef7d('0xb5');_0x2ce295=_0x4fc44f;_0x579318=_0x166fde;}else{_0x2ce295=_0x3c9734;_0x579318=_0x56e6b3;}if(_0x2ce295>0x0||_0x231e98['creditnote'][_0xef7d('0xc6')]>0x0){_0x4af906+=_0xef7d('0x96');_0x4af906+=_0xef7d('0xd6')+_0x5441a8['total'][_0x2f77cd]+_0xef7d('0xa8');_0x4af906+=_0xef7d('0xcc')+_0x579318[_0xef7d('0xcd')](0x2)+_0xef7d('0xce');_0x4af906+='</tr>';}if(_0x2ce295>0x0){_0x4af906+='<tr>';_0x4af906+='<td\x20class=\x22itemTotal\x22>'+_0x5441a8['tax'][_0x2f77cd]+_0xef7d('0xa8');_0x4af906+='<td\x20class=\x22numberRight\x22>'+_0x2ce295[_0xef7d('0xcd')](0x2)+'\x20&euro;</td>';_0x4af906+='</tr>';}_0x4af906+=_0xef7d('0x96');var _0x254ca5;if(_0x365bf7){_0x254ca5=_0x579318;}else{_0x254ca5=_0x579318+_0x2ce295;}_0x4af906+=_0xef7d('0xd7')+_0x5441a8['nettopay'][_0x2f77cd]+_0xef7d('0xd8')+_0x254ca5['toFixed'](0x2)+_0xef7d('0xce');_0x4af906+=_0xef7d('0xd9');_0x4af906+=_0xef7d('0xda');_0x4af906+='</table></div><table>';_0x4af906+=_0xef7d('0x96');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xdb'),_0x231e98[_0xef7d('0x98')]['receivingFiscalMessage'][_0xef7d('0xdc')](new RegExp(String['fromCharCode'](0xd),'g'),_0xef7d('0xdd')));_0x4af906+='</tr>';_0x4af906+='<tr>';_0x4af906+=_0xef7d('0xbd');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xdf')][_0x2f77cd]+_0xef7d('0xe0');if(!_[_0xef7d('0xd0')](_0x231e98[_0xef7d('0x98')][_0xef7d('0xe1')])){_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xe2')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe1')]+'</span></div>';_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xe4')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe5')]+_0xef7d('0xe6');_0x4af906+=_0xef7d('0xde')+_0x5441a8['bankaddress'][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xe7')]+',\x20'+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe8')]+_0xef7d('0xe9')+_0x231e98['creditnote']['issuerBankCity']+'\x20('+_0x231e98[_0xef7d('0x98')][_0xef7d('0xea')]+')'+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xec')][_0x2f77cd]+'/'+_0x5441a8[_0xef7d('0xed')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xee')]+'/'+_0x231e98['creditnote'][_0xef7d('0xef')]+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf0')][_0x2f77cd]+'/'+_0x5441a8['swif'][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')]['issuerBankBICSWIFT']+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf1')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')]['issuerBankIBAN']+'</span></div>';}if(!_[_0xef7d('0xd0')](_0x231e98['creditnote']['issuerPayPal'])){_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf2')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xf3')]+'</span></div>';}_0x4af906+='<div\x20class=\x22issuerFiled\x22>'+_0x5441a8[_0xef7d('0xf4')][_0x2f77cd]+_0xef7d('0xf5')+_0x3744d2+_0xef7d('0xf6')+_0x5441a8[_0xef7d('0xf7')][_0x2f77cd]+_0xef7d('0x5c');_0x4af906+=_0xef7d('0xa8');_0x4af906+=_0xef7d('0xb5');_0x4af906+=_0xef7d('0xf8');_0x4af906+=_0xef7d('0xf9');_0x4af906+=_0xef7d('0xfa');return new BPromise(function(_0x66b8f0,_0x3d123b){pdf[_0xef7d('0x44')](_0x4af906,_0x3baac3)[_0xef7d('0xfb')](path['join'](_0x51cdf5,_0xc385ac),function(_0x55a524,_0x58d662){if(_0x55a524)return _0x3d123b(_0x55a524);_0x66b8f0(_0x58d662);});});});}})['then'](function(){if(_0x1d284e){console[_0xef7d('0xfc')](_0xef7d('0xfd'),_0x39af72,_0xc385ac);return _0x3cf151['download'](_0x39af72,_0xc385ac,function(_0x1da70d){if(_0x1da70d){console['log'](_0xef7d('0xfe'),_0x1da70d);}else{console['log']('foldername',_0x51cdf5);rimraf(_0x51cdf5,function(){});}});}else{return _0x3cf151[_0xef7d('0x18')](0xc8);}})[_0xef7d('0x40')](handleError(_0x3cf151,null));};
\ No newline at end of file
+var _0xd51c=['VIRTUAL','field','filter','options','count','include','findAll','rows','catch','show','params','fields','length','includeAll','merge','find','create','body','update','destroy','describe','getCreditnotePDF','toString','join','root','server','files','tmp','logos','images','format','Credinote_%s-%s.pdf','1cm','10mm','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','footer','contents','default','creditnote','</div>','mkdirSync','<head>\x20<style\x20type=\x22text/css\x22>\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}</style></head>','<body>','Phone','Telefono','Fax','Email','P.IVA','Tax\x20code','Codice\x20S.D.I.','Soc.Cap.\x20fp','Invoice','Proforma','Credit\x20note','Scadenza','Articolo','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Subtotal','Imponibile','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Conto\x20intestato\x20a','Bank\x20name','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','receivingCountry','Italy','\x22\x20width=\x22180\x22></td></tr>','<td\x20class=\x22issuerInfo\x22>\x20%s<br/>','issuerName','issuerStreet','issuerPostalCode','\x20%s','-\x20%s\x20<br/>','issuerCountry',':\x20%s<br/>','issuerPhone','fax','email','%s<br/>','issuerEmail','piva','issuerPIVA','issuerFiscalCode','sdi','issuerSDICode','</td>','<td></td>','<td\x20class=\x22receiperInfo\x22>','<div\x20class=\x22receiperCompanyName\x22>%s</div>','companyName','%s\x20-\x20','<div\x20class=\x22reciperFiscalInfo\x22>','receivingPIVA','</div></td>','</tr>','<tr>','<td\x20colspan=\x223\x22>','\x20N.%d</div>','<div\x20class=\x22createdDate\x22>%s,\x20','issuerCity','updatedAt','%s\x20</div>','add','days','DD/MM/YYYY','<div\x20class=\x22duedDate\x22>','duedate',':\x20%s</div></td>','<th\x20class=\x22itemTabTitle\x22>','item','description','</th>','hrsqty','unitprice','subtotal','details','netPrice','discount','tax','quantity','productName','<td>%s</td>','productDescription','<td\x20class=\x22numberCenter\x22>%d</td>','\x20&euro;</td>','toFixed','</tr></table><div\x20class=\x22divTotal\x22><table\x20class=\x22tabTotal\x22>','isNil','receivingFiscalMessage','indexOf','<td\x20>','<td\x20class=\x22itemTotal\x22>','total','<td\x20class=\x22numberRight\x22>','<td\x20class=\x22total\x22>','nettopay','</table>\x20</td>','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','</table></div><table>','<td\x20\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','fromCharCode','issuerBankAccount','<div\x20class=\x22issuerFiled\x22>','</span></div>','bankname',':\x20<span\x20class=\x22issuerData\x22>','issuerBankName','</span>\x20</div>','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','abi','issuerABI','issuerCAB','bic','swif','issuerBankBICSWIFT','iban','issuerBankIBAN','paypal','<span>','</span>','thank2','</body>','</html>','toFile','log','TCL:\x20exports.getCreditnotePDF\x20->\x20saveTo,\x20fileName','err','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','status','index','SACreditNote','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','type','key'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd51c,0x1b0));var _0xcd51=function(_0x3a7eab,_0x5c1bc7){_0x3a7eab=_0x3a7eab-0x0;var _0x6aaba4=_0xd51c[_0x3a7eab];return _0x6aaba4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd51('0x1'));var jsonpatch=require(_0xcd51('0x2'));var rp=require('request-promise');var moment=require(_0xcd51('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcd51('0x4'));var util=require(_0xcd51('0x5'));var path=require(_0xcd51('0x6'));var sox=require('sox');var csv=require(_0xcd51('0x7'));var ejs=require(_0xcd51('0x8'));var fs=require('fs');var _=require(_0xcd51('0x9'));var squel=require(_0xcd51('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd51('0xb'));var toCsv=require(_0xcd51('0x7'));var querystring=require(_0xcd51('0xc'));var Papa=require(_0xcd51('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd51('0xe'));var hardwareService=require(_0xcd51('0xf'));var logger=require(_0xcd51('0x10'))(_0xcd51('0x11'));var utils=require('../../config/utils');var config=require(_0xcd51('0x12'));var db=require(_0xcd51('0x13'))['db'];function respondWithStatusCode(_0x3b5e69,_0x5077f0){_0x5077f0=_0x5077f0||0xcc;return function(_0x387dc8){if(_0x387dc8){return _0x3b5e69[_0xcd51('0x14')](_0x5077f0);}return _0x3b5e69['status'](_0x5077f0)['end']();};}function respondWithResult(_0x3d63c6,_0x93e89a){_0x93e89a=_0x93e89a||0xc8;return function(_0x2e3b92){if(_0x2e3b92){return _0x3d63c6['status'](_0x93e89a)['json'](_0x2e3b92);}};}function respondWithFilteredResult(_0x10adb7,_0x268741){return function(_0x5d7ba7){if(_0x5d7ba7){var _0x40ba3e=_0x5d7ba7['count'],_0x4e8c38=_0x268741[_0xcd51('0x15')],_0x430810=_0x268741['offset']+_0x268741[_0xcd51('0x16')],_0x3580bc;if(_0x430810>=_0x40ba3e){_0x430810=_0x40ba3e;_0x3580bc=0xc8;}else{_0x3580bc=0xce;}_0x10adb7['status'](_0x3580bc);return _0x10adb7[_0xcd51('0x17')](_0xcd51('0x18'),_0x4e8c38+'-'+_0x430810+'/'+_0x40ba3e)['json'](_0x5d7ba7);}return null;};}function patchUpdates(_0x3afed1){return function(_0x16b807){try{jsonpatch[_0xcd51('0x19')](_0x16b807,_0x3afed1,!![]);}catch(_0x182a07){return BPromise[_0xcd51('0x1a')](_0x182a07);}return _0x16b807[_0xcd51('0x1b')]();};}function saveUpdates(_0x8f5567,_0x13449e){return function(_0x4cda02){if(_0x4cda02){return _0x4cda02['update'](_0x8f5567)[_0xcd51('0x1c')](function(_0x2bf16e){return _0x2bf16e;});}return null;};}function removeEntity(_0x53fad7,_0x2e6e37){return function(_0x479a21){if(_0x479a21){return _0x479a21['destroy']()[_0xcd51('0x1c')](function(){_0x53fad7['status'](0xcc)[_0xcd51('0x1d')]();});}};}function handleEntityNotFound(_0x362048,_0x52461e){return function(_0x5b0ce8){if(!_0x5b0ce8){_0x362048[_0xcd51('0x14')](0x194);}return _0x5b0ce8;};}function handleError(_0x5542c2,_0x49bda1){_0x49bda1=_0x49bda1||0x1f4;return function(_0x285402){logger[_0xcd51('0x1e')](_0x285402[_0xcd51('0x1f')]);if(_0x285402['name']){delete _0x285402['name'];}_0x5542c2[_0xcd51('0x20')](_0x49bda1)['send'](_0x285402);};}exports[_0xcd51('0x21')]=function(_0x4253bc,_0x3b3e4d){var _0x1631ae={},_0x3ac3c0={},_0x519173={'count':0x0,'rows':[]};var _0x1759fc=db[_0xcd51('0x22')][_0xcd51('0x23')];_0x3ac3c0[_0xcd51('0x24')]=_[_0xcd51('0x25')](_0x1759fc);_0x3ac3c0['query']=_[_0xcd51('0x25')](_0x4253bc[_0xcd51('0x26')]);_0x3ac3c0[_0xcd51('0x27')]=_[_0xcd51('0x28')](_0x3ac3c0[_0xcd51('0x24')],_0x3ac3c0['query']);_0x1631ae[_0xcd51('0x29')]=_['intersection'](_0x3ac3c0[_0xcd51('0x24')],qs['fields'](_0x4253bc[_0xcd51('0x26')]['fields']));_0x1631ae[_0xcd51('0x29')]=_0x1631ae[_0xcd51('0x29')]['length']?_0x1631ae[_0xcd51('0x29')]:_0x3ac3c0[_0xcd51('0x24')];if(!_0x4253bc[_0xcd51('0x26')][_0xcd51('0x2a')](_0xcd51('0x2b'))){_0x1631ae[_0xcd51('0x16')]=qs['limit'](_0x4253bc['query'][_0xcd51('0x16')]);_0x1631ae[_0xcd51('0x15')]=qs[_0xcd51('0x15')](_0x4253bc[_0xcd51('0x26')]['offset']);}_0x1631ae['order']=qs[_0xcd51('0x2c')](_0x4253bc['query'][_0xcd51('0x2c')]);_0x1631ae['where']=qs[_0xcd51('0x27')](_['pick'](_0x4253bc['query'],_0x3ac3c0[_0xcd51('0x27')]));if(_0x4253bc[_0xcd51('0x26')]['filter']){_0x1631ae[_0xcd51('0x2d')]=_['merge'](_0x1631ae[_0xcd51('0x2d')],{'$or':_['map'](_0x1759fc,function(_0x2fcde){if(_0x2fcde[_0xcd51('0x2e')][_0xcd51('0x2f')]!==_0xcd51('0x30')){var _0x50c202={};_0x50c202[_0x2fcde[_0xcd51('0x31')]]={'$like':'%'+_0x4253bc[_0xcd51('0x26')][_0xcd51('0x32')]+'%'};return _0x50c202;}})});}_0x1631ae=_['merge']({},_0x1631ae,_0x4253bc[_0xcd51('0x33')]);var _0x19c015={'where':_0x1631ae['where']};return db[_0xcd51('0x22')]['count'](_0x19c015)[_0xcd51('0x1c')](function(_0x1a2657){_0x519173[_0xcd51('0x34')]=_0x1a2657;if(_0x4253bc[_0xcd51('0x26')]['includeAll']){_0x1631ae[_0xcd51('0x35')]=[{'all':!![]}];}return db['SACreditNote'][_0xcd51('0x36')](_0x1631ae);})[_0xcd51('0x1c')](function(_0x598528){_0x519173[_0xcd51('0x37')]=_0x598528;return _0x519173;})['then'](respondWithFilteredResult(_0x3b3e4d,_0x1631ae))[_0xcd51('0x38')](handleError(_0x3b3e4d,null));};exports[_0xcd51('0x39')]=function(_0x2e65fd,_0x464b52){var _0xb74946={'raw':![],'where':{'id':_0x2e65fd[_0xcd51('0x3a')]['id']}},_0x4f915e={};_0x4f915e[_0xcd51('0x24')]=_['keys'](db[_0xcd51('0x22')][_0xcd51('0x23')]);_0x4f915e[_0xcd51('0x26')]=_[_0xcd51('0x25')](_0x2e65fd['query']);_0x4f915e[_0xcd51('0x27')]=_[_0xcd51('0x28')](_0x4f915e[_0xcd51('0x24')],_0x4f915e[_0xcd51('0x26')]);_0xb74946[_0xcd51('0x29')]=_['intersection'](_0x4f915e['model'],qs['fields'](_0x2e65fd[_0xcd51('0x26')][_0xcd51('0x3b')]));_0xb74946[_0xcd51('0x29')]=_0xb74946[_0xcd51('0x29')][_0xcd51('0x3c')]?_0xb74946[_0xcd51('0x29')]:_0x4f915e['model'];if(_0x2e65fd[_0xcd51('0x26')][_0xcd51('0x3d')]){_0xb74946[_0xcd51('0x35')]=[{'all':!![]}];}_0xb74946=_[_0xcd51('0x3e')]({},_0xb74946,_0x2e65fd[_0xcd51('0x33')]);return db['SACreditNote'][_0xcd51('0x3f')](_0xb74946)['then'](handleEntityNotFound(_0x464b52,null))[_0xcd51('0x1c')](respondWithResult(_0x464b52,null))[_0xcd51('0x38')](handleError(_0x464b52,null));};exports[_0xcd51('0x40')]=function(_0x359fd7,_0x59f1e3){return db[_0xcd51('0x22')]['create'](_0x359fd7[_0xcd51('0x41')],{})['then'](respondWithResult(_0x59f1e3,0xc9))[_0xcd51('0x38')](handleError(_0x59f1e3,null));};exports[_0xcd51('0x42')]=function(_0x5debd8,_0x3af2f0){if(_0x5debd8[_0xcd51('0x41')]['id']){delete _0x5debd8[_0xcd51('0x41')]['id'];}return db[_0xcd51('0x22')][_0xcd51('0x3f')]({'where':{'id':_0x5debd8[_0xcd51('0x3a')]['id']}})[_0xcd51('0x1c')](handleEntityNotFound(_0x3af2f0,null))[_0xcd51('0x1c')](saveUpdates(_0x5debd8[_0xcd51('0x41')],null))[_0xcd51('0x1c')](respondWithResult(_0x3af2f0,null))[_0xcd51('0x38')](handleError(_0x3af2f0,null));};exports[_0xcd51('0x43')]=function(_0x1ad6a4,_0xbd8fad){return db[_0xcd51('0x22')][_0xcd51('0x3f')]({'where':{'id':_0x1ad6a4[_0xcd51('0x3a')]['id']}})[_0xcd51('0x1c')](handleEntityNotFound(_0xbd8fad,null))[_0xcd51('0x1c')](removeEntity(_0xbd8fad,null))[_0xcd51('0x38')](handleError(_0xbd8fad,null));};exports[_0xcd51('0x44')]=function(_0x2ab527,_0x31c189){return db['SACreditNote'][_0xcd51('0x44')]()[_0xcd51('0x1c')](respondWithResult(_0x31c189,null))[_0xcd51('0x38')](handleError(_0x31c189,null));};exports[_0xcd51('0x45')]=function(_0x5db668,_0x3bd68d){var _0x20143c=moment()['unix']()[_0xcd51('0x46')]();var _0x28f6e4=path[_0xcd51('0x47')](config[_0xcd51('0x48')],_0xcd51('0x49'),_0xcd51('0x4a'),_0xcd51('0x4b'));var _0x2bbc12=path[_0xcd51('0x47')](config[_0xcd51('0x48')],_0xcd51('0x49'),'files','images',_0xcd51('0x4c'),'logo-invoice.png');var _0x45a499=path[_0xcd51('0x47')](config[_0xcd51('0x48')],_0xcd51('0x49'),_0xcd51('0x4a'),_0xcd51('0x4d'),'logos','paid-invoice.png');var _0x4760ae=path['join'](_0x28f6e4,_0x20143c);var _0x14e6c4=util[_0xcd51('0x4e')](_0xcd51('0x4f'),_0x5db668['params']['id'],_0x20143c);var _0x1ac841=path[_0xcd51('0x47')](_0x4760ae,_0x14e6c4);var _0x1ef7d2=![];var _0xc594e2={};return db[_0xcd51('0x22')]['find']({'where':{'id':_0x5db668[_0xcd51('0x3a')]['id']},'raw':!![]})[_0xcd51('0x1c')](handleEntityNotFound(_0x3bd68d,null))[_0xcd51('0x1c')](function(_0x227b52){if(_0x227b52){_0xc594e2['creditnote']=_0x227b52;return db['SACreditNoteDetail'][_0xcd51('0x36')]({'where':{'CreditNoteId':_0x227b52['id']},'raw':!![],'logging':console['log']})[_0xcd51('0x1c')](function(_0x45eea2){_0xc594e2['details']=_0x45eea2;_0x1ef7d2=!![];var _0x3a1393='';var _0x147ff3={'format':'A4','orientation':'portrait','border':_0xcd51('0x50'),'footer':{'height':_0xcd51('0x51'),'contents':{'default':_0xcd51('0x52')}}};_0x147ff3[_0xcd51('0x53')][_0xcd51('0x54')][_0xcd51('0x55')]=_0x147ff3[_0xcd51('0x53')][_0xcd51('0x54')][_0xcd51('0x55')]+'<div\x20class=\x22issuerFiledWeb\x22>'+_0xc594e2[_0xcd51('0x56')]['issuerWeb']+_0xcd51('0x57');fs[_0xcd51('0x58')](_0x4760ae);_0x3a1393='<html>';_0x3a1393+=_0xcd51('0x59');_0x3a1393+=_0xcd51('0x5a');var _0x2d7b9d={'phone':{'en':_0xcd51('0x5b'),'it':_0xcd51('0x5c')},'fax':{'en':_0xcd51('0x5d'),'it':_0xcd51('0x5d')},'email':{'en':_0xcd51('0x5e'),'it':_0xcd51('0x5e')},'piva':{'en':'VAT\x20number','it':_0xcd51('0x5f')},'cf':{'en':_0xcd51('0x60'),'it':'C.F.'},'sdi':{'en':'I.S.\x20code','it':_0xcd51('0x61')},'cs':{'en':_0xcd51('0x62'),'it':'Cap.Soc.\x20iv'},'invoice':{'en':_0xcd51('0x63'),'it':'Fattura'},'proforma':{'en':_0xcd51('0x64'),'it':'Proforma'},'creditnote':{'en':_0xcd51('0x65'),'it':'Nota\x20di\x20credito'},'duedate':{'en':'Due\x20date','it':_0xcd51('0x66')},'item':{'en':'Item','it':_0xcd51('0x67')},'description':{'en':'Description','it':'Descrizione'},'hrsqty':{'en':'Hrs/Qty','it':_0xcd51('0x68')},'unitprice':{'en':_0xcd51('0x69'),'it':_0xcd51('0x6a')},'subtotal':{'en':_0xcd51('0x6b'),'it':_0xcd51('0x6c')},'discount':{'en':'Discount','it':'Sconto'},'total':{'en':_0xcd51('0x6d'),'it':_0xcd51('0x6e')},'tax':{'en':'Tax','it':_0xcd51('0x6f')},'nettopay':{'en':_0xcd51('0x70'),'it':_0xcd51('0x71')},'sendpayment':{'en':_0xcd51('0x72'),'it':_0xcd51('0x73')},'accountholder':{'en':'Account\x20Holder','it':_0xcd51('0x74')},'bankname':{'en':_0xcd51('0x75'),'it':_0xcd51('0x76')},'bankaddress':{'en':_0xcd51('0x77'),'it':_0xcd51('0x78')},'abi':{'en':_0xcd51('0x79'),'it':_0xcd51('0x79')},'cab':{'en':_0xcd51('0x7a'),'it':_0xcd51('0x7a')},'bic':{'en':_0xcd51('0x7b'),'it':_0xcd51('0x7b')},'swif':{'en':_0xcd51('0x7c'),'it':'SWIF'},'iban':{'en':_0xcd51('0x7d'),'it':_0xcd51('0x7d')},'paypal':{'en':_0xcd51('0x7e'),'it':_0xcd51('0x7f')},'thank1':{'en':_0xcd51('0x80'),'it':_0xcd51('0x81')},'thank2':{'en':_0xcd51('0x82'),'it':_0xcd51('0x83')}};var _0xa21fdb='it';if(_0xc594e2[_0xcd51('0x56')][_0xcd51('0x84')]!==_0xcd51('0x85')){_0xa21fdb='en';}_0x3a1393+='<table\x20class=\x22center\x22>';_0x3a1393+='<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://'+_0x2bbc12+_0xcd51('0x86');_0x3a1393+='<tr>';_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x87'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x88')]);_0x3a1393+=util['format']('%s<br/>',_0xc594e2[_0xcd51('0x56')][_0xcd51('0x89')]);_0x3a1393+=util[_0xcd51('0x4e')]('%s',_0xc594e2[_0xcd51('0x56')][_0xcd51('0x8a')]);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x8b'),_0xc594e2[_0xcd51('0x56')]['issuerCity']);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x8c'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x8d')]);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x8c'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x8d')]);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d['phone'][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2['creditnote'][_0xcd51('0x8f')]);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x90')][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2['creditnote']['issuerFax']);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x91')][_0xa21fdb]+_0xcd51('0x92'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x93')]);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x94')][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x95')]);_0x3a1393+=util['format'](_0x2d7b9d['cf'][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2['creditnote'][_0xcd51('0x96')]);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x97')][_0xa21fdb]+'%s<br/>',_0xc594e2[_0xcd51('0x56')][_0xcd51('0x98')]);_0x3a1393+=util['format'](_0x2d7b9d['cs'][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2['creditnote']['issuerSocCap']);_0x3a1393+=_0xcd51('0x99');_0x3a1393+=_0xcd51('0x9a');_0x3a1393+=_0xcd51('0x9b');_0x3a1393+=util['format'](_0xcd51('0x9c'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x9d')]);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x92'),_0xc594e2[_0xcd51('0x56')]['receivingStreet']);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x9e'),_0xc594e2[_0xcd51('0x56')]['receivingPostalCode']);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0x92'),_0xc594e2[_0xcd51('0x56')]['receivingCity']);_0x3a1393+=util['format'](_0xcd51('0x92'),_0xc594e2[_0xcd51('0x56')][_0xcd51('0x84')]);_0x3a1393+=util['format'](_0xcd51('0x9f')+_0x2d7b9d['cf'][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2[_0xcd51('0x56')]['receivingFiscalCode']);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x94')][_0xa21fdb]+':\x20%s<br/>',_0xc594e2['creditnote'][_0xcd51('0xa0')]);_0x3a1393+=util[_0xcd51('0x4e')](_0x2d7b9d[_0xcd51('0x97')][_0xa21fdb]+_0xcd51('0x8e'),_0xc594e2[_0xcd51('0x56')]['receivingSDICode']);_0x3a1393+=_0xcd51('0xa1');_0x3a1393+=_0xcd51('0xa2');_0x3a1393+=_0xcd51('0xa3');_0x3a1393+=_0xcd51('0xa4');_0x3a1393+=util[_0xcd51('0x4e')]('<div\x20class=\x22invoiceNumber\x22>'+_0x2d7b9d[_0xcd51('0x56')][_0xa21fdb]+_0xcd51('0xa5'),_0x227b52['id']);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xa6'),_0xc594e2['creditnote'][_0xcd51('0xa7')]);var _0x1976f4=moment(_0xc594e2['creditnote'][_0xcd51('0xa8')])[_0xcd51('0x4e')]('DD/MM/YYYY');_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xa9'),_0x1976f4);var _0x181576=moment(_0xc594e2['creditnote']['updatedAt'])[_0xcd51('0xaa')](_0xc594e2['creditnote']['saExpiryDay'],_0xcd51('0xab'))[_0xcd51('0x4e')](_0xcd51('0xac'));_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xad')+_0x2d7b9d[_0xcd51('0xae')][_0xa21fdb]+_0xcd51('0xaf'),_0x181576);_0x3a1393+='</tr>';_0x3a1393+=_0xcd51('0xa3');_0x3a1393+=_0xcd51('0xa4');_0x3a1393+='<table\x20class=\x22roundedCorners\x22>';_0x3a1393+=_0xcd51('0xa3');_0x3a1393+=_0xcd51('0xb0')+_0x2d7b9d[_0xcd51('0xb1')][_0xa21fdb]+'</th>';_0x3a1393+=_0xcd51('0xb0')+_0x2d7b9d[_0xcd51('0xb2')][_0xa21fdb]+_0xcd51('0xb3');_0x3a1393+=_0xcd51('0xb0')+_0x2d7b9d[_0xcd51('0xb4')][_0xa21fdb]+_0xcd51('0xb3');_0x3a1393+=_0xcd51('0xb0')+_0x2d7b9d[_0xcd51('0xb5')][_0xa21fdb]+'</th>';_0x3a1393+='<th\x20class=\x22itemTabTitle\x22>'+_0x2d7b9d[_0xcd51('0xb6')][_0xa21fdb]+_0xcd51('0xb3');_0x3a1393+=_0xcd51('0xa2');var _0x230ba0=0x0;var _0xad9bab=0x0;for(var _0x45c8cd=0x0;_0x45c8cd<_0xc594e2[_0xcd51('0xb7')][_0xcd51('0x3c')];_0x45c8cd++){var _0x2313fd=0x0;var _0x27ebfb=0x0;var _0x3f3705=0x0;var _0x5efb0c=0x0;_0x2313fd=_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xb8')]-_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xb8')]/0x64*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xb9')];_0x27ebfb=_0x2313fd/0x64*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xba')];_0x3f3705=_0x2313fd*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xbb')];_0x5efb0c=_0x27ebfb*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xbb')];_0x3a1393+=_0xcd51('0xa3');_0x3a1393+=util['format']('<td>%s</td>',_0xc594e2['details'][_0x45c8cd][_0xcd51('0xbc')]);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xbd'),_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xbe')]);_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xbf'),_0xc594e2[_0xcd51('0xb7')][_0x45c8cd]['quantity']);_0x3a1393+='<td\x20class=\x22numberRight\x22>'+_0x2313fd['toFixed'](0x2)+_0xcd51('0xc0');_0x3a1393+='<td\x20class=\x22numberRight\x22>'+_0x3f3705[_0xcd51('0xc1')](0x2)+_0xcd51('0xc0');_0x3a1393+='</tr>';_0x230ba0+=_0x3f3705;_0xad9bab+=_0x5efb0c;}_0x3a1393+=_0xcd51('0xc2');if(!_[_0xcd51('0xc3')](_0xc594e2[_0xcd51('0x56')][_0xcd51('0xb9')])){var _0x444ab0=0x0;var _0x41f450=0x0;var _0x2f753d=_0xc594e2[_0xcd51('0x56')][_0xcd51('0xb9')]*0x64/_0x230ba0;for(var _0x45c8cd=0x0;_0x45c8cd<_0xc594e2['details']['length'];_0x45c8cd++){var _0x1a427b=0x0;var _0x408511=0x0;var _0x43603a=0x0;_0x2313fd=_0xc594e2[_0xcd51('0xb7')][_0x45c8cd]['netPrice']-_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xb8')]/0x64*_0xc594e2['details'][_0x45c8cd][_0xcd51('0xb9')];_0x1a427b=_0x2313fd/0x64*_0x2f753d;_0x408511=_0x2313fd-_0x1a427b;_0x43603a=_0x408511*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xbb')];_0x444ab0+=_0x43603a;_0x41f450+=_0x43603a/0x64*_0xc594e2[_0xcd51('0xb7')][_0x45c8cd][_0xcd51('0xba')];}}var _0x1e1ee8=0x0;var _0x2ecd01=0x0;var _0x4249d9=![];var _0x4fb2f9=_0xc594e2[_0xcd51('0x56')][_0xcd51('0xc4')];if(_0x4fb2f9[_0xcd51('0xc5')]('split\x20payment')!=-0x1){_0x4249d9=!![];}if(!_['isNil'](_0xc594e2['creditnote']['discount'])){_0x3a1393+='<tr>';if(_0xc594e2[_0xcd51('0x56')][_0xcd51('0xb9')]>0x0){_0x3a1393+=_0xcd51('0xc6')+_0x2d7b9d[_0xcd51('0xb9')][_0xa21fdb]+_0xcd51('0x99');_0x3a1393+='<td\x20class=\x22\x20numberRight\x22>\x20'+_0xc594e2[_0xcd51('0x56')]['discount'][_0xcd51('0xc1')](0x2)+_0xcd51('0xc0');}_0x3a1393+=_0xcd51('0xa2');_0x1e1ee8=_0x41f450;_0x2ecd01=_0x444ab0;}else{_0x1e1ee8=_0xad9bab;_0x2ecd01=_0x230ba0;}if(_0x1e1ee8>0x0||_0xc594e2[_0xcd51('0x56')][_0xcd51('0xb9')]>0x0){_0x3a1393+=_0xcd51('0xa3');_0x3a1393+=_0xcd51('0xc7')+_0x2d7b9d[_0xcd51('0xc8')][_0xa21fdb]+_0xcd51('0x99');_0x3a1393+=_0xcd51('0xc9')+_0x2ecd01[_0xcd51('0xc1')](0x2)+'\x20&euro;</td>';_0x3a1393+=_0xcd51('0xa2');}if(_0x1e1ee8>0x0){_0x3a1393+='<tr>';_0x3a1393+='<td\x20class=\x22itemTotal\x22>'+_0x2d7b9d['tax'][_0xa21fdb]+'</td>';_0x3a1393+=_0xcd51('0xc9')+_0x1e1ee8['toFixed'](0x2)+_0xcd51('0xc0');_0x3a1393+=_0xcd51('0xa2');}_0x3a1393+='<tr>';var _0x86880;if(_0x4249d9){_0x86880=_0x2ecd01;}else{_0x86880=_0x2ecd01+_0x1e1ee8;}_0x3a1393+=_0xcd51('0xca')+_0x2d7b9d[_0xcd51('0xcb')][_0xa21fdb]+'</td><td\x20class=\x22total\x20numberRight\x22>'+_0x86880[_0xcd51('0xc1')](0x2)+_0xcd51('0xc0');_0x3a1393+=_0xcd51('0xcc');_0x3a1393+=_0xcd51('0xcd');_0x3a1393+=_0xcd51('0xce');_0x3a1393+='<tr>';_0x3a1393+=util[_0xcd51('0x4e')](_0xcd51('0xcf'),_0xc594e2['creditnote'][_0xcd51('0xc4')]['replace'](new RegExp(String[_0xcd51('0xd0')](0xd),'g'),'<br\x20/>'));_0x3a1393+=_0xcd51('0xa2');_0x3a1393+='<tr>';_0x3a1393+=_0xcd51('0xa4');_0x3a1393+='<div\x20class=\x22issuerFiled\x22>'+_0x2d7b9d['sendpayment'][_0xa21fdb]+':</div>';if(!_[_0xcd51('0xc3')](_0xc594e2[_0xcd51('0x56')][_0xcd51('0xd1')])){_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d['accountholder'][_0xa21fdb]+':\x20<span\x20class=\x22issuerData\x22>'+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xd1')]+_0xcd51('0xd3');_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xd4')][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2['creditnote'][_0xcd51('0xd6')]+_0xcd51('0xd7');_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xd8')][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xd9')]+',\x20'+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xda')]+_0xcd51('0xdb')+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xdc')]+'\x20('+_0xc594e2['creditnote'][_0xcd51('0xdd')]+')'+_0xcd51('0xd3');_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xde')][_0xa21fdb]+'/'+_0x2d7b9d['cab'][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xdf')]+'/'+_0xc594e2['creditnote'][_0xcd51('0xe0')]+_0xcd51('0xd3');_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xe1')][_0xa21fdb]+'/'+_0x2d7b9d[_0xcd51('0xe2')][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2['creditnote'][_0xcd51('0xe3')]+_0xcd51('0xd3');_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xe4')][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2[_0xcd51('0x56')][_0xcd51('0xe5')]+_0xcd51('0xd3');}if(!_[_0xcd51('0xc3')](_0xc594e2[_0xcd51('0x56')]['issuerPayPal'])){_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d[_0xcd51('0xe6')][_0xa21fdb]+_0xcd51('0xd5')+_0xc594e2[_0xcd51('0x56')]['issuerPayPal']+'</span></div>';}_0x3a1393+=_0xcd51('0xd2')+_0x2d7b9d['thank1'][_0xa21fdb]+_0xcd51('0xe7')+_0x181576+_0xcd51('0xe8')+_0x2d7b9d[_0xcd51('0xe9')][_0xa21fdb]+_0xcd51('0x57');_0x3a1393+=_0xcd51('0x99');_0x3a1393+='</tr>';_0x3a1393+='</table>';_0x3a1393+=_0xcd51('0xea');_0x3a1393+=_0xcd51('0xeb');return new BPromise(function(_0x2875d6,_0x2d39be){pdf[_0xcd51('0x40')](_0x3a1393,_0x147ff3)[_0xcd51('0xec')](path['join'](_0x4760ae,_0x14e6c4),function(_0x15950f,_0x5fd6af){if(_0x15950f)return _0x2d39be(_0x15950f);_0x2875d6(_0x5fd6af);});});});}})[_0xcd51('0x1c')](function(){if(_0x1ef7d2){console[_0xcd51('0xed')](_0xcd51('0xee'),_0x1ac841,_0x14e6c4);return _0x3bd68d['download'](_0x1ac841,_0x14e6c4,function(_0x24774d){if(_0x24774d){console['log'](_0xcd51('0xef'),_0x24774d);}else{console[_0xcd51('0xed')]('foldername',_0x4760ae);rimraf(_0x4760ae,function(){});}});}else{return _0x3bd68d['sendStatus'](0xc8);}})['catch'](handleError(_0x3bd68d,null));};
\ No newline at end of file