Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / saProforma / saProforma.controller.js
index 5bfe5ea..cd7cdb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eb8=['<div\x20class=\x22issuerFiledWeb\x22>','proforma','issuerWeb','mkdirSync','<html>','<head>\x20<style\x20type=\x22text/css\x22>\x20body{font-family:\x20Roboto,\x20\x27Segoe\x20UI\x27,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2010px;}.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:\x20bolder;\x20padding-bottom:\x2010px;\x20font-size:\x2010px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;,\x20font-size:\x2010px;}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:\x208px;\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:\x208px;}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','Fax','Email','VAT\x20number','P.IVA','Tax\x20code','I.S.\x20code','Codice\x20S.D.I.','Soc.Cap.\x20fp','Cap.Soc.\x20iv','Invoice','Fattura','Proforma','Nota\x20di\x20credito','Scadenza','Item','Articolo','Description','Descrizione','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Imponibile','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Account\x20Holder','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','<table\x20class=\x22center\x22>','<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://','\x22\x20width=\x22180\x22></td></tr>','<tr>','%s<br/>','issuerStreet','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20<br/>','issuerCountry','phone','issuerPhone',':\x20%s<br/>','issuerFax','issuerEmail','issuerPIVA','issuerFiscalCode','issuerSDICode','issuerSocCap','</td>','<td></td>','<td\x20class=\x22receiperInfo\x22>','companyName','receivingCity','<div\x20class=\x22reciperFiscalInfo\x22>','piva','receivingPIVA','sdi','</div></td>','</tr>','\x20N.%d</div>','updatedAt','%s\x20</div>','add','saExpiryDay','days','DD/MM/YYYY','<div\x20class=\x22duedDate\x22>','duedate',':\x20%s</div></td>','<td\x20colspan=\x223\x22>','<th\x20class=\x22itemTabTitle\x22>','item','</th>','description','hrsqty','unitprice','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>','receivingFiscalMessage','indexOf','<td\x20>','<td\x20class=\x22itemTotal\x22>','<td\x20class=\x22total\x22>','nettopay','</td><td\x20class=\x22total\x20numberRight\x22>','</table>\x20</td>','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','</table></div><table>','<td\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','replace','fromCharCode','<br\x20/>','<div\x20class=\x22issuerFiled\x22>','</div>','isNil','issuerBankAccount','accountholder',':\x20<span\x20class=\x22issuerData\x22>','</span></div>','bankname','</span>\x20</div>','bankaddress','issuerBankStreet','issuerBankPostalCode','issuerBankCity','abi','issuerABI','issuerCAB','bic','swif','issuerBankBICSWIFT','iban','issuerPayPal','paypal','thank1','<span>','</span>','thank2','paid','</body>','</html>','toFile','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','log','err','addCloneDetail->>','ProformaId','cloneProforma','cloneProforma\x20req.params.id:','sequelize','result','cloneProforma\x20productsProforma:','WARNING','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','TCL:\x20exports.cloneProforma\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','destroy','then','error','name','send','index','SAProforma','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','describe','getProformaPDF','unix','join','server','files','root','images','logo-invoice.png','paid-invoice.png','format','Proforma_%s-%s.pdf','SAProformaDetail','details','portrait','10mm','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','footer','contents','default'];(function(_0x41ea59,_0x1a0074){var _0x9ad77f=function(_0x13042a){while(--_0x13042a){_0x41ea59['push'](_0x41ea59['shift']());}};_0x9ad77f(++_0x1a0074);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe65ac8,_0x2691be){_0xe65ac8=_0xe65ac8-0x0;var _0x202ba1=_0x5eb8[_0xe65ac8];return _0x202ba1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var hardwareService=require(_0x85eb('0x13'));var logger=require(_0x85eb('0x14'))(_0x85eb('0x15'));var utils=require('../../config/utils');var config=require(_0x85eb('0x16'));var db=require(_0x85eb('0x17'))['db'];function respondWithStatusCode(_0x5c52a4,_0x2af376){_0x2af376=_0x2af376||0xcc;return function(_0x784583){if(_0x784583){return _0x5c52a4[_0x85eb('0x18')](_0x2af376);}return _0x5c52a4[_0x85eb('0x19')](_0x2af376)['end']();};}function respondWithResult(_0x548628,_0x394c74){_0x394c74=_0x394c74||0xc8;return function(_0x5c760a){if(_0x5c760a){return _0x548628[_0x85eb('0x19')](_0x394c74)[_0x85eb('0x1a')](_0x5c760a);}};}function respondWithFilteredResult(_0x600a7f,_0x1604ba){return function(_0x183b0c){if(_0x183b0c){var _0x49efdf=_0x183b0c[_0x85eb('0x1b')],_0x2e5c0a=_0x1604ba[_0x85eb('0x1c')],_0x59237b=_0x1604ba[_0x85eb('0x1c')]+_0x1604ba['limit'],_0x17140b;if(_0x59237b>=_0x49efdf){_0x59237b=_0x49efdf;_0x17140b=0xc8;}else{_0x17140b=0xce;}_0x600a7f['status'](_0x17140b);return _0x600a7f['set'](_0x85eb('0x1d'),_0x2e5c0a+'-'+_0x59237b+'/'+_0x49efdf)[_0x85eb('0x1a')](_0x183b0c);}return null;};}function patchUpdates(_0x10cf2f){return function(_0x2e986c){try{jsonpatch[_0x85eb('0x1e')](_0x2e986c,_0x10cf2f,!![]);}catch(_0x34f875){return BPromise['reject'](_0x34f875);}return _0x2e986c[_0x85eb('0x1f')]();};}function saveUpdates(_0x7244fc,_0xd9f06d){return function(_0x4e8041){if(_0x4e8041){return _0x4e8041['update'](_0x7244fc)['then'](function(_0x55b9e4){return _0x55b9e4;});}return null;};}function removeEntity(_0x244667,_0x3fa785){return function(_0x329fc5){if(_0x329fc5){return _0x329fc5[_0x85eb('0x20')]()[_0x85eb('0x21')](function(){_0x244667[_0x85eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5491d5,_0x5b48d9){return function(_0x298e84){if(!_0x298e84){_0x5491d5[_0x85eb('0x18')](0x194);}return _0x298e84;};}function handleError(_0x3f7a4d,_0x28b87d){_0x28b87d=_0x28b87d||0x1f4;return function(_0x312b3e){logger[_0x85eb('0x22')](_0x312b3e['stack']);if(_0x312b3e[_0x85eb('0x23')]){delete _0x312b3e[_0x85eb('0x23')];}_0x3f7a4d[_0x85eb('0x19')](_0x28b87d)[_0x85eb('0x24')](_0x312b3e);};}exports[_0x85eb('0x25')]=function(_0x57a03c,_0x2e5aa3){var _0x792d3a={},_0x291557={},_0x3e7eb9={'count':0x0,'rows':[]};var _0x40f13e=db[_0x85eb('0x26')]['rawAttributes'];_0x291557['model']=_[_0x85eb('0x27')](_0x40f13e);_0x291557['query']=_[_0x85eb('0x27')](_0x57a03c['query']);_0x291557[_0x85eb('0x28')]=_[_0x85eb('0x29')](_0x291557[_0x85eb('0x2a')],_0x291557[_0x85eb('0x2b')]);_0x792d3a[_0x85eb('0x2c')]=_[_0x85eb('0x29')](_0x291557[_0x85eb('0x2a')],qs['fields'](_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x2d')]));_0x792d3a['attributes']=_0x792d3a[_0x85eb('0x2c')]['length']?_0x792d3a['attributes']:_0x291557[_0x85eb('0x2a')];if(!_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x2e')](_0x85eb('0x2f'))){_0x792d3a[_0x85eb('0x30')]=qs[_0x85eb('0x30')](_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x30')]);_0x792d3a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x57a03c['query'][_0x85eb('0x1c')]);}_0x792d3a[_0x85eb('0x31')]=qs['sort'](_0x57a03c['query'][_0x85eb('0x32')]);_0x792d3a[_0x85eb('0x33')]=qs[_0x85eb('0x28')](_[_0x85eb('0x34')](_0x57a03c[_0x85eb('0x2b')],_0x291557[_0x85eb('0x28')]));if(_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x35')]){_0x792d3a[_0x85eb('0x33')]=_[_0x85eb('0x36')](_0x792d3a[_0x85eb('0x33')],{'$or':_[_0x85eb('0x37')](_0x40f13e,function(_0x317d86){if(_0x317d86[_0x85eb('0x38')]['key']!==_0x85eb('0x39')){var _0x3dfe74={};_0x3dfe74[_0x317d86['field']]={'$like':'%'+_0x57a03c['query'][_0x85eb('0x35')]+'%'};return _0x3dfe74;}})});}_0x792d3a=_[_0x85eb('0x36')]({},_0x792d3a,_0x57a03c['options']);var _0x4317bc={'where':_0x792d3a['where']};return db[_0x85eb('0x26')]['count'](_0x4317bc)[_0x85eb('0x21')](function(_0x5ce7e4){_0x3e7eb9[_0x85eb('0x1b')]=_0x5ce7e4;if(_0x57a03c['query'][_0x85eb('0x3a')]){_0x792d3a[_0x85eb('0x3b')]=[{'all':!![]}];}return db['SAProforma'][_0x85eb('0x3c')](_0x792d3a);})['then'](function(_0x2a6baa){_0x3e7eb9[_0x85eb('0x3d')]=_0x2a6baa;return _0x3e7eb9;})['then'](respondWithFilteredResult(_0x2e5aa3,_0x792d3a))[_0x85eb('0x3e')](handleError(_0x2e5aa3,null));};exports['show']=function(_0x5495cf,_0x1b8a71){var _0x4edb2d={'raw':![],'where':{'id':_0x5495cf[_0x85eb('0x3f')]['id']}},_0x17cc20={};_0x17cc20['model']=_['keys'](db[_0x85eb('0x26')][_0x85eb('0x40')]);_0x17cc20['query']=_['keys'](_0x5495cf[_0x85eb('0x2b')]);_0x17cc20[_0x85eb('0x28')]=_[_0x85eb('0x29')](_0x17cc20[_0x85eb('0x2a')],_0x17cc20[_0x85eb('0x2b')]);_0x4edb2d['attributes']=_[_0x85eb('0x29')](_0x17cc20[_0x85eb('0x2a')],qs[_0x85eb('0x2d')](_0x5495cf[_0x85eb('0x2b')][_0x85eb('0x2d')]));_0x4edb2d[_0x85eb('0x2c')]=_0x4edb2d[_0x85eb('0x2c')][_0x85eb('0x41')]?_0x4edb2d[_0x85eb('0x2c')]:_0x17cc20['model'];if(_0x5495cf[_0x85eb('0x2b')][_0x85eb('0x3a')]){_0x4edb2d['include']=[{'all':!![]}];}_0x4edb2d=_[_0x85eb('0x36')]({},_0x4edb2d,_0x5495cf[_0x85eb('0x42')]);return db[_0x85eb('0x26')][_0x85eb('0x43')](_0x4edb2d)[_0x85eb('0x21')](handleEntityNotFound(_0x1b8a71,null))[_0x85eb('0x21')](respondWithResult(_0x1b8a71,null))['catch'](handleError(_0x1b8a71,null));};exports[_0x85eb('0x44')]=function(_0x1258bc,_0x1ead1d){return db[_0x85eb('0x26')][_0x85eb('0x44')](_0x1258bc[_0x85eb('0x45')],{})[_0x85eb('0x21')](respondWithResult(_0x1ead1d,0xc9))[_0x85eb('0x3e')](handleError(_0x1ead1d,null));};exports['update']=function(_0x1298d4,_0x26b226){if(_0x1298d4[_0x85eb('0x45')]['id']){delete _0x1298d4[_0x85eb('0x45')]['id'];}return db[_0x85eb('0x26')][_0x85eb('0x43')]({'where':{'id':_0x1298d4[_0x85eb('0x3f')]['id']}})[_0x85eb('0x21')](handleEntityNotFound(_0x26b226,null))[_0x85eb('0x21')](saveUpdates(_0x1298d4[_0x85eb('0x45')],null))[_0x85eb('0x21')](respondWithResult(_0x26b226,null))[_0x85eb('0x3e')](handleError(_0x26b226,null));};exports['destroy']=function(_0x11da79,_0x2c951b){return db[_0x85eb('0x26')]['find']({'where':{'id':_0x11da79[_0x85eb('0x3f')]['id']}})[_0x85eb('0x21')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x21')](removeEntity(_0x2c951b,null))[_0x85eb('0x3e')](handleError(_0x2c951b,null));};exports[_0x85eb('0x46')]=function(_0x4a7506,_0x2ef4d1){return db[_0x85eb('0x26')][_0x85eb('0x46')]()['then'](respondWithResult(_0x2ef4d1,null))[_0x85eb('0x3e')](handleError(_0x2ef4d1,null));};exports[_0x85eb('0x47')]=function(_0x1efc6f,_0x4c06ef){var _0x56f510=moment()[_0x85eb('0x48')]()['toString']();var _0x5ed98a=path[_0x85eb('0x49')](config['root'],_0x85eb('0x4a'),_0x85eb('0x4b'),'tmp');var _0x4abe5e=path[_0x85eb('0x49')](config[_0x85eb('0x4c')],_0x85eb('0x4a'),_0x85eb('0x4b'),_0x85eb('0x4d'),'logos',_0x85eb('0x4e'));var _0x30062e=path[_0x85eb('0x49')](config[_0x85eb('0x4c')],_0x85eb('0x4a'),'files',_0x85eb('0x4d'),'logos',_0x85eb('0x4f'));var _0x40d846=path['join'](_0x5ed98a,_0x56f510);var _0x341ddb=util[_0x85eb('0x50')](_0x85eb('0x51'),_0x1efc6f[_0x85eb('0x3f')]['id'],_0x56f510);var _0x214ef7=path[_0x85eb('0x49')](_0x40d846,_0x341ddb);var _0x5a45a0=![];var _0x38d68a={};return db['SAProforma'][_0x85eb('0x43')]({'where':{'id':_0x1efc6f[_0x85eb('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4c06ef,null))[_0x85eb('0x21')](function(_0x2a0f8b){if(_0x2a0f8b){_0x38d68a['proforma']=_0x2a0f8b;return db[_0x85eb('0x52')]['findAll']({'where':{'ProformaId':_0x2a0f8b['id']},'raw':!![]})[_0x85eb('0x21')](function(_0x3f6985){_0x38d68a[_0x85eb('0x53')]=_0x3f6985;_0x5a45a0=!![];var _0x13c0b3='';var _0x45a201={'format':'A4','orientation':_0x85eb('0x54'),'border':'1cm','footer':{'height':_0x85eb('0x55'),'contents':{'default':_0x85eb('0x56')}}};_0x45a201[_0x85eb('0x57')][_0x85eb('0x58')][_0x85eb('0x59')]=_0x45a201[_0x85eb('0x57')][_0x85eb('0x58')][_0x85eb('0x59')]+_0x85eb('0x5a')+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x5c')]+'</div>';fs[_0x85eb('0x5d')](_0x40d846);_0x13c0b3=_0x85eb('0x5e');_0x13c0b3+=_0x85eb('0x5f');_0x13c0b3+=_0x85eb('0x60');var _0x4470b3={'phone':{'en':_0x85eb('0x61'),'it':'Telefono'},'fax':{'en':_0x85eb('0x62'),'it':'Fax'},'email':{'en':_0x85eb('0x63'),'it':_0x85eb('0x63')},'piva':{'en':_0x85eb('0x64'),'it':_0x85eb('0x65')},'cf':{'en':_0x85eb('0x66'),'it':'C.F.'},'sdi':{'en':_0x85eb('0x67'),'it':_0x85eb('0x68')},'cs':{'en':_0x85eb('0x69'),'it':_0x85eb('0x6a')},'invoice':{'en':_0x85eb('0x6b'),'it':_0x85eb('0x6c')},'proforma':{'en':_0x85eb('0x6d'),'it':_0x85eb('0x6d')},'creditnote':{'en':'Credit\x20note','it':_0x85eb('0x6e')},'duedate':{'en':'Due\x20date','it':_0x85eb('0x6f')},'item':{'en':_0x85eb('0x70'),'it':_0x85eb('0x71')},'description':{'en':_0x85eb('0x72'),'it':_0x85eb('0x73')},'hrsqty':{'en':'Hrs/Qty','it':_0x85eb('0x74')},'unitprice':{'en':_0x85eb('0x75'),'it':_0x85eb('0x76')},'subtotal':{'en':_0x85eb('0x77'),'it':_0x85eb('0x78')},'discount':{'en':_0x85eb('0x79'),'it':'Sconto'},'total':{'en':'Subtotal','it':_0x85eb('0x7a')},'tax':{'en':'Tax','it':_0x85eb('0x7b')},'nettopay':{'en':_0x85eb('0x7c'),'it':_0x85eb('0x7d')},'sendpayment':{'en':_0x85eb('0x7e'),'it':_0x85eb('0x7f')},'accountholder':{'en':_0x85eb('0x80'),'it':'Conto\x20intestato\x20a'},'bankname':{'en':_0x85eb('0x81'),'it':_0x85eb('0x82')},'bankaddress':{'en':_0x85eb('0x83'),'it':_0x85eb('0x84')},'abi':{'en':'ABI','it':_0x85eb('0x85')},'cab':{'en':_0x85eb('0x86'),'it':_0x85eb('0x86')},'bic':{'en':_0x85eb('0x87'),'it':'BIC'},'swif':{'en':_0x85eb('0x88'),'it':_0x85eb('0x88')},'iban':{'en':_0x85eb('0x89'),'it':_0x85eb('0x89')},'paypal':{'en':_0x85eb('0x8a'),'it':_0x85eb('0x8b')},'thank1':{'en':_0x85eb('0x8c'),'it':_0x85eb('0x8d')},'thank2':{'en':_0x85eb('0x8e'),'it':_0x85eb('0x8f')}};var _0x170a60='it';if(_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x90')]!==_0x85eb('0x91')){_0x170a60='en';}_0x13c0b3+=_0x85eb('0x92');_0x13c0b3+=_0x85eb('0x93')+_0x4abe5e+_0x85eb('0x94');_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=util[_0x85eb('0x50')]('<td\x20class=\x22issuerInfo\x22>\x20%s<br/>',_0x38d68a[_0x85eb('0x5b')]['issuerName']);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0x96'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x97')]);_0x13c0b3+=util[_0x85eb('0x50')]('%s',_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x98')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0x99'),_0x38d68a['proforma'][_0x85eb('0x9a')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0x9b'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x9c')]);_0x13c0b3+=util['format'](_0x4470b3[_0x85eb('0x9d')][_0x170a60]+':\x20%s<br/>',_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x9e')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3['fax'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xa0')]);_0x13c0b3+=util['format'](_0x4470b3['email'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xa1')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3['piva'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a['proforma'][_0x85eb('0xa2')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3['cf'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xa3')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3['sdi'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a['proforma'][_0x85eb('0xa4')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3['cs'][_0x170a60]+_0x85eb('0x9f'),_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xa5')]);_0x13c0b3+=_0x85eb('0xa6');_0x13c0b3+=_0x85eb('0xa7');_0x13c0b3+=_0x85eb('0xa8');_0x13c0b3+=util[_0x85eb('0x50')]('<div\x20class=\x22receiperCompanyName\x22>%s</div>',_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xa9')]);_0x13c0b3+=util['format']('%s<br/>',_0x38d68a[_0x85eb('0x5b')]['receivingStreet']);_0x13c0b3+=util[_0x85eb('0x50')]('%s\x20-\x20',_0x38d68a[_0x85eb('0x5b')]['receivingPostalCode']);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0x96'),_0x38d68a['proforma'][_0x85eb('0xaa')]);_0x13c0b3+=util[_0x85eb('0x50')]('%s<br/>',_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x90')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0xab')+_0x4470b3['cf'][_0x170a60]+':\x20%s<br/>',_0x38d68a[_0x85eb('0x5b')]['receivingFiscalCode']);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3[_0x85eb('0xac')][_0x170a60]+_0x85eb('0x9f'),_0x38d68a['proforma'][_0x85eb('0xad')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x4470b3[_0x85eb('0xae')][_0x170a60]+':\x20%s<br/>',_0x38d68a[_0x85eb('0x5b')]['receivingSDICode']);_0x13c0b3+=_0x85eb('0xaf');_0x13c0b3+=_0x85eb('0xb0');_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+='<td\x20colspan=\x223\x22>';_0x13c0b3+=util['format']('<div\x20class=\x22invoiceNumber\x22>'+_0x4470b3[_0x85eb('0x5b')][_0x170a60]+_0x85eb('0xb1'),_0x2a0f8b['id']);_0x13c0b3+=util[_0x85eb('0x50')]('<div\x20class=\x22createdDate\x22>%s,\x20',_0x38d68a[_0x85eb('0x5b')][_0x85eb('0x9a')]);var _0x45d6af=moment(_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xb2')])['format']('DD/MM/YYYY');_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0xb3'),_0x45d6af);var _0x5473ec=moment(_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xb2')])[_0x85eb('0xb4')](_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xb5')],_0x85eb('0xb6'))[_0x85eb('0x50')](_0x85eb('0xb7'));_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0xb8')+_0x4470b3[_0x85eb('0xb9')][_0x170a60]+_0x85eb('0xba'),_0x5473ec);_0x13c0b3+=_0x85eb('0xb0');_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=_0x85eb('0xbb');_0x13c0b3+='<table\x20class=\x22roundedCorners\x22>';_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=_0x85eb('0xbc')+_0x4470b3[_0x85eb('0xbd')][_0x170a60]+_0x85eb('0xbe');_0x13c0b3+=_0x85eb('0xbc')+_0x4470b3[_0x85eb('0xbf')][_0x170a60]+_0x85eb('0xbe');_0x13c0b3+=_0x85eb('0xbc')+_0x4470b3[_0x85eb('0xc0')][_0x170a60]+_0x85eb('0xbe');_0x13c0b3+='<th\x20class=\x22itemTabTitle\x22>'+_0x4470b3[_0x85eb('0xc1')][_0x170a60]+_0x85eb('0xbe');_0x13c0b3+=_0x85eb('0xbc')+_0x4470b3[_0x85eb('0xc2')][_0x170a60]+'</th>';_0x13c0b3+=_0x85eb('0xb0');var _0x379b30=0x0;var _0x30ee4e=0x0;for(var _0x819d42=0x0;_0x819d42<_0x38d68a[_0x85eb('0x53')][_0x85eb('0x41')];_0x819d42++){var _0x50a21d=0x0;var _0x2dde05=0x0;var _0x36dbb1=0x0;var _0x12c3be=0x0;_0x50a21d=_0x38d68a['details'][_0x819d42][_0x85eb('0xc3')]-_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc3')]/0x64*_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc4')];_0x2dde05=_0x50a21d/0x64*_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc5')];_0x36dbb1=_0x50a21d*_0x38d68a[_0x85eb('0x53')][_0x819d42]['quantity'];_0x12c3be=_0x2dde05*_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc6')];_0x13c0b3+='<tr>';_0x13c0b3+=util['format'](_0x85eb('0xc7'),_0x38d68a['details'][_0x819d42][_0x85eb('0xc8')]);_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0xc7'),_0x38d68a[_0x85eb('0x53')][_0x819d42]['productDescription']);_0x13c0b3+=util['format'](_0x85eb('0xc9'),_0x38d68a['details'][_0x819d42][_0x85eb('0xc6')]);_0x13c0b3+=_0x85eb('0xca')+_0x50a21d[_0x85eb('0xcb')](0x2)+_0x85eb('0xcc');_0x13c0b3+='<td\x20class=\x22numberRight\x22>'+_0x36dbb1['toFixed'](0x2)+_0x85eb('0xcc');_0x13c0b3+=_0x85eb('0xb0');_0x379b30+=_0x36dbb1;_0x30ee4e+=_0x12c3be;}_0x13c0b3+=_0x85eb('0xcd');if(!_['isNil'](_0x38d68a['proforma'][_0x85eb('0xc4')])){var _0x138316=0x0;var _0x282200=0x0;var _0x20c335=_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xc4')]*0x64/_0x379b30;for(var _0x819d42=0x0;_0x819d42<_0x38d68a[_0x85eb('0x53')][_0x85eb('0x41')];_0x819d42++){var _0x4115ae=0x0;var _0x26c3a7=0x0;var _0x5f0ac1=0x0;_0x50a21d=_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc3')]-_0x38d68a['details'][_0x819d42][_0x85eb('0xc3')]/0x64*_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc4')];_0x4115ae=_0x50a21d/0x64*_0x20c335;_0x26c3a7=_0x50a21d-_0x4115ae;_0x5f0ac1=_0x26c3a7*_0x38d68a[_0x85eb('0x53')][_0x819d42][_0x85eb('0xc6')];_0x138316+=_0x5f0ac1;_0x282200+=_0x5f0ac1/0x64*_0x38d68a[_0x85eb('0x53')][_0x819d42]['tax'];}}var _0x4ba2d3=0x0;var _0x504e83=0x0;var _0x55c697=![];var _0x2f1ff1=_0x38d68a['proforma'][_0x85eb('0xce')];if(_0x2f1ff1[_0x85eb('0xcf')]('split\x20payment')!=-0x1){_0x55c697=!![];}if(!_['isNil'](_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xc4')])){_0x13c0b3+='<tr>';if(_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xc4')]>0x0){_0x13c0b3+=_0x85eb('0xd0')+_0x4470b3['discount'][_0x170a60]+'</td>';_0x13c0b3+=_0x85eb('0xca')+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xc4')][_0x85eb('0xcb')](0x2)+_0x85eb('0xcc');}_0x13c0b3+=_0x85eb('0xb0');_0x4ba2d3=_0x282200;_0x504e83=_0x138316;}else{_0x4ba2d3=_0x30ee4e;_0x504e83=_0x379b30;}if(_0x4ba2d3>0x0||_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xc4')]>0x0){_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=_0x85eb('0xd1')+_0x4470b3['total'][_0x170a60]+_0x85eb('0xa6');_0x13c0b3+='<td\x20class=\x22numberRight\x22>'+_0x504e83[_0x85eb('0xcb')](0x2)+_0x85eb('0xcc');_0x13c0b3+=_0x85eb('0xb0');}if(_0x4ba2d3>0x0){_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=_0x85eb('0xd1')+_0x4470b3['tax'][_0x170a60]+_0x85eb('0xa6');_0x13c0b3+=_0x85eb('0xca')+_0x4ba2d3[_0x85eb('0xcb')](0x2)+'\x20&euro;</td>';_0x13c0b3+=_0x85eb('0xb0');}_0x13c0b3+=_0x85eb('0x95');var _0x323812;if(_0x55c697){_0x323812=_0x504e83;}else{_0x323812=_0x504e83+_0x4ba2d3;}_0x13c0b3+=_0x85eb('0xd2')+_0x4470b3[_0x85eb('0xd3')][_0x170a60]+_0x85eb('0xd4')+_0x323812[_0x85eb('0xcb')](0x2)+_0x85eb('0xcc');_0x13c0b3+=_0x85eb('0xd5');_0x13c0b3+=_0x85eb('0xb0');_0x13c0b3+=_0x85eb('0xd6');_0x13c0b3+=_0x85eb('0xd7');_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=util[_0x85eb('0x50')](_0x85eb('0xd8'),_0x38d68a[_0x85eb('0x5b')]['receivingFiscalMessage'][_0x85eb('0xd9')](new RegExp(String[_0x85eb('0xda')](0xd),'g'),_0x85eb('0xdb')));_0x13c0b3+=_0x85eb('0xb0');_0x13c0b3+=_0x85eb('0x95');_0x13c0b3+=_0x85eb('0xbb');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3['sendpayment'][_0x170a60]+_0x85eb('0xdd');if(!_[_0x85eb('0xde')](_0x38d68a['proforma'][_0x85eb('0xdf')])){_0x13c0b3+='<div\x20class=\x22issuerFiled\x22>'+_0x4470b3[_0x85eb('0xe0')][_0x170a60]+_0x85eb('0xe1')+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xdf')]+_0x85eb('0xe2');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xe3')][_0x170a60]+_0x85eb('0xe1')+_0x38d68a['proforma']['issuerBankName']+_0x85eb('0xe4');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xe5')][_0x170a60]+_0x85eb('0xe1')+_0x38d68a['proforma'][_0x85eb('0xe6')]+',\x20'+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xe7')]+'\x20-\x20'+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xe8')]+'\x20('+_0x38d68a[_0x85eb('0x5b')]['issuerBankCountry']+')'+_0x85eb('0xe2');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xe9')][_0x170a60]+'/'+_0x4470b3['cab'][_0x170a60]+_0x85eb('0xe1')+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xea')]+'/'+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xeb')]+_0x85eb('0xe2');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xec')][_0x170a60]+'/'+_0x4470b3[_0x85eb('0xed')][_0x170a60]+':\x20<span\x20class=\x22issuerData\x22>'+_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xee')]+_0x85eb('0xe2');_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xef')][_0x170a60]+_0x85eb('0xe1')+_0x38d68a['proforma']['issuerBankIBAN']+_0x85eb('0xe2');}if(!_[_0x85eb('0xde')](_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xf0')])){_0x13c0b3+=_0x85eb('0xdc')+_0x4470b3[_0x85eb('0xf1')][_0x170a60]+_0x85eb('0xe1')+_0x38d68a['proforma'][_0x85eb('0xf0')]+_0x85eb('0xe2');}_0x13c0b3+='<div\x20class=\x22issuerFiled\x22>'+_0x4470b3[_0x85eb('0xf2')][_0x170a60]+_0x85eb('0xf3')+_0x5473ec+_0x85eb('0xf4')+_0x4470b3[_0x85eb('0xf5')][_0x170a60]+_0x85eb('0xdd');_0x13c0b3+=_0x85eb('0xa6');_0x13c0b3+=_0x85eb('0xb0');if(_0x38d68a[_0x85eb('0x5b')][_0x85eb('0xf6')]===0x1){_0x13c0b3+='<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://'+_0x30062e+'\x22\x20width=\x22180\x22></td></tr>';}_0x13c0b3+='</table>';_0x13c0b3+=_0x85eb('0xf7');_0x13c0b3+=_0x85eb('0xf8');return new BPromise(function(_0x27fd58,_0x413509){pdf[_0x85eb('0x44')](_0x13c0b3,_0x45a201)[_0x85eb('0xf9')](path[_0x85eb('0x49')](_0x40d846,_0x341ddb),function(_0x384eb8,_0xb14288){if(_0x384eb8)return _0x413509(_0x384eb8);_0x27fd58(_0xb14288);});});});}})[_0x85eb('0x21')](function(){if(_0x5a45a0){console['log'](_0x85eb('0xfa'),_0x214ef7,_0x341ddb);return _0x4c06ef[_0x85eb('0xfb')](_0x214ef7,_0x341ddb,function(_0x5d29b2){if(_0x5d29b2){console[_0x85eb('0xfc')](_0x85eb('0xfd'),_0x5d29b2);}else{console[_0x85eb('0xfc')]('foldername',_0x40d846);rimraf(_0x40d846,function(){});}});}else{return _0x4c06ef[_0x85eb('0x18')](0xc8);}})['catch'](handleError(_0x4c06ef,null));};function addCloneDetail(_0xdef9b5,_0x5b1bca,_0x242735){console[_0x85eb('0xfc')](_0x85eb('0xfe'),_0xdef9b5);_0xdef9b5[_0x85eb('0xff')]=_0x5b1bca;delete _0xdef9b5['id'];return db[_0x85eb('0x52')][_0x85eb('0x44')](_0xdef9b5,{'transaction':_0x242735});}exports[_0x85eb('0x100')]=function(_0x92225b,_0x5bf029,_0x4f6029){var _0x1c0550;if(_0x92225b[_0x85eb('0x45')]['id']){delete _0x92225b[_0x85eb('0x45')]['id'];}console[_0x85eb('0xfc')](_0x85eb('0x101'),_0x92225b['params']['id']);return db[_0x85eb('0x102')]['transaction'](function(_0x5e9b97){return db[_0x85eb('0x26')][_0x85eb('0x44')](_0x92225b['body'],{'transaction':_0x5e9b97,'logging':console[_0x85eb('0xfc')]})[_0x85eb('0x21')](function(_0x7a6e30){console[_0x85eb('0xfc')](_0x85eb('0x103'),_0x7a6e30);_0x1c0550=_0x7a6e30;var _0x490d17=_0x92225b[_0x85eb('0x3f')]['id'];return db[_0x85eb('0x52')][_0x85eb('0x3c')]({'where':{'ProformaId':_0x490d17},'raw':!![]});})[_0x85eb('0x21')](function(_0x2b6f8d){console[_0x85eb('0xfc')](_0x85eb('0x104'),_0x2b6f8d);if(_0x2b6f8d[_0x85eb('0x41')]>0x0){var _0x4033fc=[];for(var _0x32624a=0x0;_0x32624a<_0x2b6f8d['length'];_0x32624a++){_0x4033fc['push'](addCloneDetail(_0x2b6f8d[_0x32624a],_0x1c0550['id'],_0x5e9b97));}return BPromise['all'](_0x4033fc);}else{var _0x2ef966={'errors':[{'type':_0x85eb('0x105'),'message':_0x85eb('0x106')}]};throw _0x2ef966;}});})['then'](function(){return _0x5bf029[_0x85eb('0x18')](0xc8);})[_0x85eb('0x3e')](function(_0x51de1d){console[_0x85eb('0xfc')](_0x85eb('0x107'),_0x51de1d);if(_0x51de1d[_0x85eb('0x23')]===_0x85eb('0x108')){var _0x51de1d={'errors':[{'message':_0x85eb('0x109')}]};}_0x5bf029[_0x85eb('0x19')](0x1f4)[_0x85eb('0x24')](_0x51de1d);});};
\ No newline at end of file
+var _0x4483=['Hrs/Qty','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Subtotal','Imponibile','Tax','Tasse','Total','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Conto\x20intestato\x20a','Bank\x20name','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','receivingCountry','Italy','<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://','<tr>','issuerName','issuerStreet','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20<br/>','issuerCountry','phone',':\x20%s<br/>','issuerEmail','piva','issuerPIVA','issuerFiscalCode','</td>','<td></td>','<div\x20class=\x22receiperCompanyName\x22>%s</div>','%s<br/>','receivingStreet','%s\x20-\x20','<div\x20class=\x22reciperFiscalInfo\x22>','receivingPIVA','receivingSDICode','</div></td>','</tr>','<td\x20colspan=\x223\x22>','<div\x20class=\x22invoiceNumber\x22>','\x20N.%d</div>','<div\x20class=\x22createdDate\x22>%s,\x20','DD/MM/YYYY','%s\x20</div>','add','saExpiryDay','<div\x20class=\x22duedDate\x22>',':\x20%s</div></td>','<table\x20class=\x22roundedCorners\x22>','<th\x20class=\x22itemTabTitle\x22>','</th>','description','hrsqty','unitprice','discount','quantity','<td>%s</td>','productDescription','<td\x20class=\x22numberCenter\x22>%d</td>','<td\x20class=\x22numberRight\x22>','\x20&euro;</td>','</tr></table><div\x20class=\x22divTotal\x22><table\x20class=\x22tabTotal\x22>','isNil','netPrice','tax','receivingFiscalMessage','indexOf','split\x20payment','<td\x20>','toFixed','<td\x20class=\x22itemTotal\x22>','<td\x20class=\x22total\x22>','nettopay','</table>\x20</td>','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','<td\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','replace','fromCharCode','<br\x20/>','<div\x20class=\x22issuerFiled\x22>','sendpayment','issuerBankAccount','</span></div>',':\x20<span\x20class=\x22issuerData\x22>','issuerBankName','</span>\x20</div>','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','abi','cab','issuerABI','issuerCAB','bic','swif','issuerBankBICSWIFT','issuerBankIBAN','issuerPayPal','paypal','thank1','</span>','thank2','paid','\x22\x20width=\x22180\x22></td></tr>','</body>','</html>','toFile','log','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','err','foldername','addCloneDetail->>','ProformaId','SAProformaDetail','cloneProforma','cloneProforma\x20req.params.id:','sequelize','transaction','result','cloneProforma\x20productsProforma:','push','all','WARNING','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','TCL:\x20exports.cloneProforma\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','send','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','error','stack','name','index','SAProforma','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','describe','getProformaPDF','unix','toString','root','server','files','tmp','join','logos','logo-invoice.png','images','paid-invoice.png','format','Proforma_%s-%s.pdf','proforma','details','portrait','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','footer','contents','default','<div\x20class=\x22issuerFiledWeb\x22>','issuerWeb','</div>','mkdirSync','<html>','<head>\x20<style\x20type=\x22text/css\x22>\x20body{font-family:\x20Roboto,\x20\x27Segoe\x20UI\x27,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2010px;}.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:\x20bolder;\x20padding-bottom:\x2010px;\x20font-size:\x2010px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;,\x20font-size:\x2010px;}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:\x208px;\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:\x208px;}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','C.F.','Codice\x20S.D.I.','Soc.Cap.\x20fp','Invoice','Fattura','Credit\x20note','Scadenza','Item','Descrizione'];(function(_0x5c47e8,_0x2ec59d){var _0x2a108d=function(_0x406edc){while(--_0x406edc){_0x5c47e8['push'](_0x5c47e8['shift']());}};_0x2a108d(++_0x2ec59d);}(_0x4483,0x1a3));var _0x3448=function(_0x4182de,_0xe96734){_0x4182de=_0x4182de-0x0;var _0x27f50e=_0x4483[_0x4182de];return _0x27f50e;};'use strict';var pdf=require(_0x3448('0x0'));var emlformat=require(_0x3448('0x1'));var rimraf=require(_0x3448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3448('0x3'));var rp=require(_0x3448('0x4'));var moment=require(_0x3448('0x5'));var BPromise=require(_0x3448('0x6'));var Mustache=require(_0x3448('0x7'));var util=require('util');var path=require(_0x3448('0x8'));var sox=require(_0x3448('0x9'));var csv=require(_0x3448('0xa'));var ejs=require(_0x3448('0xb'));var fs=require('fs');var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var hardwareService=require(_0x3448('0x15'));var logger=require(_0x3448('0x16'))(_0x3448('0x17'));var utils=require(_0x3448('0x18'));var config=require(_0x3448('0x19'));var db=require(_0x3448('0x1a'))['db'];function respondWithStatusCode(_0x481a6f,_0x5bf09e){_0x5bf09e=_0x5bf09e||0xcc;return function(_0x298ae6){if(_0x298ae6){return _0x481a6f[_0x3448('0x1b')](_0x5bf09e);}return _0x481a6f['status'](_0x5bf09e)[_0x3448('0x1c')]();};}function respondWithResult(_0xdfb89d,_0x587db9){_0x587db9=_0x587db9||0xc8;return function(_0x549306){if(_0x549306){return _0xdfb89d[_0x3448('0x1d')](_0x587db9)[_0x3448('0x1e')](_0x549306);}};}function respondWithFilteredResult(_0x4daf3e,_0x2387a3){return function(_0x2c2da6){if(_0x2c2da6){var _0x46784f=_0x2c2da6[_0x3448('0x1f')],_0x4fc70f=_0x2387a3[_0x3448('0x20')],_0x472518=_0x2387a3[_0x3448('0x20')]+_0x2387a3[_0x3448('0x21')],_0x28f5b9;if(_0x472518>=_0x46784f){_0x472518=_0x46784f;_0x28f5b9=0xc8;}else{_0x28f5b9=0xce;}_0x4daf3e[_0x3448('0x1d')](_0x28f5b9);return _0x4daf3e[_0x3448('0x22')]('Content-Range',_0x4fc70f+'-'+_0x472518+'/'+_0x46784f)[_0x3448('0x1e')](_0x2c2da6);}return null;};}function patchUpdates(_0x5b410d){return function(_0x48f94a){try{jsonpatch['apply'](_0x48f94a,_0x5b410d,!![]);}catch(_0x1e9774){return BPromise[_0x3448('0x23')](_0x1e9774);}return _0x48f94a[_0x3448('0x24')]();};}function saveUpdates(_0x5b5e26,_0x3df082){return function(_0x392c8d){if(_0x392c8d){return _0x392c8d[_0x3448('0x25')](_0x5b5e26)[_0x3448('0x26')](function(_0x29a15a){return _0x29a15a;});}return null;};}function removeEntity(_0x715c3,_0x5db78f){return function(_0x54c7ee){if(_0x54c7ee){return _0x54c7ee['destroy']()[_0x3448('0x26')](function(){_0x715c3[_0x3448('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1f7c,_0x2dcd40){return function(_0x4371d6){if(!_0x4371d6){_0x5b1f7c[_0x3448('0x1b')](0x194);}return _0x4371d6;};}function handleError(_0x4368c7,_0xbf2237){_0xbf2237=_0xbf2237||0x1f4;return function(_0x566ff5){logger[_0x3448('0x27')](_0x566ff5[_0x3448('0x28')]);if(_0x566ff5[_0x3448('0x29')]){delete _0x566ff5[_0x3448('0x29')];}_0x4368c7[_0x3448('0x1d')](_0xbf2237)['send'](_0x566ff5);};}exports[_0x3448('0x2a')]=function(_0x393081,_0x52c163){var _0x19a479={},_0x12c22d={},_0x310912={'count':0x0,'rows':[]};var _0x1bd34c=db[_0x3448('0x2b')][_0x3448('0x2c')];_0x12c22d[_0x3448('0x2d')]=_[_0x3448('0x2e')](_0x1bd34c);_0x12c22d['query']=_[_0x3448('0x2e')](_0x393081[_0x3448('0x2f')]);_0x12c22d[_0x3448('0x30')]=_['intersection'](_0x12c22d[_0x3448('0x2d')],_0x12c22d['query']);_0x19a479['attributes']=_['intersection'](_0x12c22d[_0x3448('0x2d')],qs[_0x3448('0x31')](_0x393081['query']['fields']));_0x19a479[_0x3448('0x32')]=_0x19a479[_0x3448('0x32')][_0x3448('0x33')]?_0x19a479[_0x3448('0x32')]:_0x12c22d['model'];if(!_0x393081[_0x3448('0x2f')][_0x3448('0x34')](_0x3448('0x35'))){_0x19a479['limit']=qs[_0x3448('0x21')](_0x393081[_0x3448('0x2f')]['limit']);_0x19a479['offset']=qs[_0x3448('0x20')](_0x393081[_0x3448('0x2f')][_0x3448('0x20')]);}_0x19a479[_0x3448('0x36')]=qs['sort'](_0x393081[_0x3448('0x2f')][_0x3448('0x37')]);_0x19a479[_0x3448('0x38')]=qs[_0x3448('0x30')](_['pick'](_0x393081[_0x3448('0x2f')],_0x12c22d[_0x3448('0x30')]));if(_0x393081['query'][_0x3448('0x39')]){_0x19a479[_0x3448('0x38')]=_[_0x3448('0x3a')](_0x19a479[_0x3448('0x38')],{'$or':_[_0x3448('0x3b')](_0x1bd34c,function(_0x31586a){if(_0x31586a[_0x3448('0x3c')][_0x3448('0x3d')]!==_0x3448('0x3e')){var _0x49c469={};_0x49c469[_0x31586a['field']]={'$like':'%'+_0x393081[_0x3448('0x2f')]['filter']+'%'};return _0x49c469;}})});}_0x19a479=_[_0x3448('0x3a')]({},_0x19a479,_0x393081[_0x3448('0x3f')]);var _0x12f678={'where':_0x19a479[_0x3448('0x38')]};return db['SAProforma'][_0x3448('0x1f')](_0x12f678)[_0x3448('0x26')](function(_0x495d7){_0x310912[_0x3448('0x1f')]=_0x495d7;if(_0x393081[_0x3448('0x2f')][_0x3448('0x40')]){_0x19a479[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2b')][_0x3448('0x42')](_0x19a479);})['then'](function(_0x39b22e){_0x310912[_0x3448('0x43')]=_0x39b22e;return _0x310912;})[_0x3448('0x26')](respondWithFilteredResult(_0x52c163,_0x19a479))[_0x3448('0x44')](handleError(_0x52c163,null));};exports[_0x3448('0x45')]=function(_0x58963d,_0x18b297){var _0x1b7284={'raw':![],'where':{'id':_0x58963d[_0x3448('0x46')]['id']}},_0x4a6e5={};_0x4a6e5[_0x3448('0x2d')]=_[_0x3448('0x2e')](db[_0x3448('0x2b')][_0x3448('0x2c')]);_0x4a6e5['query']=_[_0x3448('0x2e')](_0x58963d[_0x3448('0x2f')]);_0x4a6e5[_0x3448('0x30')]=_['intersection'](_0x4a6e5[_0x3448('0x2d')],_0x4a6e5[_0x3448('0x2f')]);_0x1b7284[_0x3448('0x32')]=_[_0x3448('0x47')](_0x4a6e5[_0x3448('0x2d')],qs[_0x3448('0x31')](_0x58963d[_0x3448('0x2f')]['fields']));_0x1b7284[_0x3448('0x32')]=_0x1b7284[_0x3448('0x32')][_0x3448('0x33')]?_0x1b7284[_0x3448('0x32')]:_0x4a6e5[_0x3448('0x2d')];if(_0x58963d[_0x3448('0x2f')]['includeAll']){_0x1b7284[_0x3448('0x41')]=[{'all':!![]}];}_0x1b7284=_['merge']({},_0x1b7284,_0x58963d['options']);return db[_0x3448('0x2b')][_0x3448('0x48')](_0x1b7284)['then'](handleEntityNotFound(_0x18b297,null))[_0x3448('0x26')](respondWithResult(_0x18b297,null))[_0x3448('0x44')](handleError(_0x18b297,null));};exports['create']=function(_0x4cf807,_0x1372a1){return db['SAProforma'][_0x3448('0x49')](_0x4cf807[_0x3448('0x4a')],{})[_0x3448('0x26')](respondWithResult(_0x1372a1,0xc9))[_0x3448('0x44')](handleError(_0x1372a1,null));};exports[_0x3448('0x25')]=function(_0x3e3208,_0x2cb2af){if(_0x3e3208['body']['id']){delete _0x3e3208['body']['id'];}return db[_0x3448('0x2b')][_0x3448('0x48')]({'where':{'id':_0x3e3208[_0x3448('0x46')]['id']}})[_0x3448('0x26')](handleEntityNotFound(_0x2cb2af,null))['then'](saveUpdates(_0x3e3208[_0x3448('0x4a')],null))[_0x3448('0x26')](respondWithResult(_0x2cb2af,null))[_0x3448('0x44')](handleError(_0x2cb2af,null));};exports[_0x3448('0x4b')]=function(_0x363374,_0x5d942b){return db[_0x3448('0x2b')]['find']({'where':{'id':_0x363374[_0x3448('0x46')]['id']}})[_0x3448('0x26')](handleEntityNotFound(_0x5d942b,null))['then'](removeEntity(_0x5d942b,null))[_0x3448('0x44')](handleError(_0x5d942b,null));};exports[_0x3448('0x4c')]=function(_0x257abb,_0x19c283){return db[_0x3448('0x2b')][_0x3448('0x4c')]()[_0x3448('0x26')](respondWithResult(_0x19c283,null))['catch'](handleError(_0x19c283,null));};exports[_0x3448('0x4d')]=function(_0x9fbee8,_0x5dd19a){var _0x5a81dd=moment()[_0x3448('0x4e')]()[_0x3448('0x4f')]();var _0x4d20ba=path['join'](config[_0x3448('0x50')],_0x3448('0x51'),_0x3448('0x52'),_0x3448('0x53'));var _0x176e60=path[_0x3448('0x54')](config[_0x3448('0x50')],'server','files','images',_0x3448('0x55'),_0x3448('0x56'));var _0x5cf3fe=path[_0x3448('0x54')](config[_0x3448('0x50')],'server',_0x3448('0x52'),_0x3448('0x57'),'logos',_0x3448('0x58'));var _0x456e82=path[_0x3448('0x54')](_0x4d20ba,_0x5a81dd);var _0x363723=util[_0x3448('0x59')](_0x3448('0x5a'),_0x9fbee8[_0x3448('0x46')]['id'],_0x5a81dd);var _0x1b7d87=path[_0x3448('0x54')](_0x456e82,_0x363723);var _0x4926aa=![];var _0x594d83={};return db['SAProforma'][_0x3448('0x48')]({'where':{'id':_0x9fbee8[_0x3448('0x46')]['id']},'raw':!![]})[_0x3448('0x26')](handleEntityNotFound(_0x5dd19a,null))[_0x3448('0x26')](function(_0x1cbeae){if(_0x1cbeae){_0x594d83[_0x3448('0x5b')]=_0x1cbeae;return db['SAProformaDetail'][_0x3448('0x42')]({'where':{'ProformaId':_0x1cbeae['id']},'raw':!![]})['then'](function(_0x15b48b){_0x594d83[_0x3448('0x5c')]=_0x15b48b;_0x4926aa=!![];var _0x3bf4d2='';var _0x5c9320={'format':'A4','orientation':_0x3448('0x5d'),'border':'1cm','footer':{'height':'10mm','contents':{'default':_0x3448('0x5e')}}};_0x5c9320[_0x3448('0x5f')][_0x3448('0x60')]['default']=_0x5c9320[_0x3448('0x5f')][_0x3448('0x60')][_0x3448('0x61')]+_0x3448('0x62')+_0x594d83[_0x3448('0x5b')][_0x3448('0x63')]+_0x3448('0x64');fs[_0x3448('0x65')](_0x456e82);_0x3bf4d2=_0x3448('0x66');_0x3bf4d2+=_0x3448('0x67');_0x3bf4d2+=_0x3448('0x68');var _0x2f0bcc={'phone':{'en':_0x3448('0x69'),'it':_0x3448('0x6a')},'fax':{'en':_0x3448('0x6b'),'it':_0x3448('0x6b')},'email':{'en':_0x3448('0x6c'),'it':_0x3448('0x6c')},'piva':{'en':'VAT\x20number','it':_0x3448('0x6d')},'cf':{'en':'Tax\x20code','it':_0x3448('0x6e')},'sdi':{'en':'I.S.\x20code','it':_0x3448('0x6f')},'cs':{'en':_0x3448('0x70'),'it':'Cap.Soc.\x20iv'},'invoice':{'en':_0x3448('0x71'),'it':_0x3448('0x72')},'proforma':{'en':'Proforma','it':'Proforma'},'creditnote':{'en':_0x3448('0x73'),'it':'Nota\x20di\x20credito'},'duedate':{'en':'Due\x20date','it':_0x3448('0x74')},'item':{'en':_0x3448('0x75'),'it':'Articolo'},'description':{'en':'Description','it':_0x3448('0x76')},'hrsqty':{'en':_0x3448('0x77'),'it':_0x3448('0x78')},'unitprice':{'en':_0x3448('0x79'),'it':_0x3448('0x7a')},'subtotal':{'en':_0x3448('0x7b'),'it':_0x3448('0x7c')},'discount':{'en':_0x3448('0x7d'),'it':_0x3448('0x7e')},'total':{'en':_0x3448('0x7f'),'it':_0x3448('0x80')},'tax':{'en':_0x3448('0x81'),'it':_0x3448('0x82')},'nettopay':{'en':_0x3448('0x83'),'it':'Totale'},'sendpayment':{'en':_0x3448('0x84'),'it':_0x3448('0x85')},'accountholder':{'en':'Account\x20Holder','it':_0x3448('0x86')},'bankname':{'en':_0x3448('0x87'),'it':'Nome\x20banca'},'bankaddress':{'en':_0x3448('0x88'),'it':_0x3448('0x89')},'abi':{'en':_0x3448('0x8a'),'it':'ABI'},'cab':{'en':'CAB','it':_0x3448('0x8b')},'bic':{'en':'BIC','it':_0x3448('0x8c')},'swif':{'en':_0x3448('0x8d'),'it':_0x3448('0x8d')},'iban':{'en':'IBAN','it':_0x3448('0x8e')},'paypal':{'en':_0x3448('0x8f'),'it':_0x3448('0x90')},'thank1':{'en':'Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','it':'Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20'},'thank2':{'en':_0x3448('0x91'),'it':_0x3448('0x92')}};var _0x1ddd54='it';if(_0x594d83[_0x3448('0x5b')][_0x3448('0x93')]!==_0x3448('0x94')){_0x1ddd54='en';}_0x3bf4d2+='<table\x20class=\x22center\x22>';_0x3bf4d2+=_0x3448('0x95')+_0x176e60+'\x22\x20width=\x22180\x22></td></tr>';_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=util[_0x3448('0x59')]('<td\x20class=\x22issuerInfo\x22>\x20%s<br/>',_0x594d83[_0x3448('0x5b')][_0x3448('0x97')]);_0x3bf4d2+=util['format']('%s<br/>',_0x594d83[_0x3448('0x5b')][_0x3448('0x98')]);_0x3bf4d2+=util[_0x3448('0x59')]('%s',_0x594d83[_0x3448('0x5b')][_0x3448('0x99')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0x9a'),_0x594d83[_0x3448('0x5b')][_0x3448('0x9b')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0x9c'),_0x594d83[_0x3448('0x5b')][_0x3448('0x9d')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc[_0x3448('0x9e')][_0x1ddd54]+_0x3448('0x9f'),_0x594d83['proforma']['issuerPhone']);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['fax'][_0x1ddd54]+_0x3448('0x9f'),_0x594d83[_0x3448('0x5b')]['issuerFax']);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['email'][_0x1ddd54]+_0x3448('0x9f'),_0x594d83[_0x3448('0x5b')][_0x3448('0xa0')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc[_0x3448('0xa1')][_0x1ddd54]+':\x20%s<br/>',_0x594d83[_0x3448('0x5b')][_0x3448('0xa2')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['cf'][_0x1ddd54]+':\x20%s<br/>',_0x594d83[_0x3448('0x5b')][_0x3448('0xa3')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['sdi'][_0x1ddd54]+_0x3448('0x9f'),_0x594d83['proforma']['issuerSDICode']);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['cs'][_0x1ddd54]+':\x20%s<br/>',_0x594d83[_0x3448('0x5b')]['issuerSocCap']);_0x3bf4d2+=_0x3448('0xa4');_0x3bf4d2+=_0x3448('0xa5');_0x3bf4d2+='<td\x20class=\x22receiperInfo\x22>';_0x3bf4d2+=util['format'](_0x3448('0xa6'),_0x594d83[_0x3448('0x5b')]['companyName']);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xa7'),_0x594d83['proforma'][_0x3448('0xa8')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xa9'),_0x594d83[_0x3448('0x5b')]['receivingPostalCode']);_0x3bf4d2+=util[_0x3448('0x59')]('%s<br/>',_0x594d83[_0x3448('0x5b')]['receivingCity']);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xa7'),_0x594d83[_0x3448('0x5b')]['receivingCountry']);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xaa')+_0x2f0bcc['cf'][_0x1ddd54]+':\x20%s<br/>',_0x594d83[_0x3448('0x5b')]['receivingFiscalCode']);_0x3bf4d2+=util['format'](_0x2f0bcc[_0x3448('0xa1')][_0x1ddd54]+':\x20%s<br/>',_0x594d83[_0x3448('0x5b')][_0x3448('0xab')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x2f0bcc['sdi'][_0x1ddd54]+_0x3448('0x9f'),_0x594d83[_0x3448('0x5b')][_0x3448('0xac')]);_0x3bf4d2+=_0x3448('0xad');_0x3bf4d2+=_0x3448('0xae');_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=_0x3448('0xaf');_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xb0')+_0x2f0bcc[_0x3448('0x5b')][_0x1ddd54]+_0x3448('0xb1'),_0x1cbeae['id']);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xb2'),_0x594d83['proforma']['issuerCity']);var _0x5ec832=moment(_0x594d83[_0x3448('0x5b')]['updatedAt'])['format'](_0x3448('0xb3'));_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xb4'),_0x5ec832);var _0x94d13f=moment(_0x594d83['proforma']['updatedAt'])[_0x3448('0xb5')](_0x594d83[_0x3448('0x5b')][_0x3448('0xb6')],'days')[_0x3448('0x59')](_0x3448('0xb3'));_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xb7')+_0x2f0bcc['duedate'][_0x1ddd54]+_0x3448('0xb8'),_0x94d13f);_0x3bf4d2+=_0x3448('0xae');_0x3bf4d2+='<tr>';_0x3bf4d2+='<td\x20colspan=\x223\x22>';_0x3bf4d2+=_0x3448('0xb9');_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=_0x3448('0xba')+_0x2f0bcc['item'][_0x1ddd54]+_0x3448('0xbb');_0x3bf4d2+=_0x3448('0xba')+_0x2f0bcc[_0x3448('0xbc')][_0x1ddd54]+_0x3448('0xbb');_0x3bf4d2+='<th\x20class=\x22itemTabTitle\x22>'+_0x2f0bcc[_0x3448('0xbd')][_0x1ddd54]+_0x3448('0xbb');_0x3bf4d2+='<th\x20class=\x22itemTabTitle\x22>'+_0x2f0bcc[_0x3448('0xbe')][_0x1ddd54]+_0x3448('0xbb');_0x3bf4d2+='<th\x20class=\x22itemTabTitle\x22>'+_0x2f0bcc['subtotal'][_0x1ddd54]+_0x3448('0xbb');_0x3bf4d2+=_0x3448('0xae');var _0x3ff2ce=0x0;var _0x258f64=0x0;for(var _0x2f5420=0x0;_0x2f5420<_0x594d83[_0x3448('0x5c')][_0x3448('0x33')];_0x2f5420++){var _0x2e4559=0x0;var _0x1336b6=0x0;var _0x392d92=0x0;var _0x4b4cb6=0x0;_0x2e4559=_0x594d83[_0x3448('0x5c')][_0x2f5420]['netPrice']-_0x594d83[_0x3448('0x5c')][_0x2f5420]['netPrice']/0x64*_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xbf')];_0x1336b6=_0x2e4559/0x64*_0x594d83['details'][_0x2f5420]['tax'];_0x392d92=_0x2e4559*_0x594d83['details'][_0x2f5420][_0x3448('0xc0')];_0x4b4cb6=_0x1336b6*_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc0')];_0x3bf4d2+='<tr>';_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xc1'),_0x594d83['details'][_0x2f5420]['productName']);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xc1'),_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc2')]);_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xc3'),_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc0')]);_0x3bf4d2+=_0x3448('0xc4')+_0x2e4559['toFixed'](0x2)+'\x20&euro;</td>';_0x3bf4d2+=_0x3448('0xc4')+_0x392d92['toFixed'](0x2)+_0x3448('0xc5');_0x3bf4d2+='</tr>';_0x3ff2ce+=_0x392d92;_0x258f64+=_0x4b4cb6;}_0x3bf4d2+=_0x3448('0xc6');if(!_[_0x3448('0xc7')](_0x594d83['proforma'][_0x3448('0xbf')])){var _0xaeef29=0x0;var _0xca3d2=0x0;var _0x1d466f=_0x594d83[_0x3448('0x5b')][_0x3448('0xbf')]*0x64/_0x3ff2ce;for(var _0x2f5420=0x0;_0x2f5420<_0x594d83[_0x3448('0x5c')][_0x3448('0x33')];_0x2f5420++){var _0x29fdd1=0x0;var _0x2b9e07=0x0;var _0x512b64=0x0;_0x2e4559=_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc8')]-_0x594d83[_0x3448('0x5c')][_0x2f5420]['netPrice']/0x64*_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xbf')];_0x29fdd1=_0x2e4559/0x64*_0x1d466f;_0x2b9e07=_0x2e4559-_0x29fdd1;_0x512b64=_0x2b9e07*_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc0')];_0xaeef29+=_0x512b64;_0xca3d2+=_0x512b64/0x64*_0x594d83[_0x3448('0x5c')][_0x2f5420][_0x3448('0xc9')];}}var _0x559022=0x0;var _0x504eee=0x0;var _0x1e2f04=![];var _0x1545f3=_0x594d83[_0x3448('0x5b')][_0x3448('0xca')];if(_0x1545f3[_0x3448('0xcb')](_0x3448('0xcc'))!=-0x1){_0x1e2f04=!![];}if(!_[_0x3448('0xc7')](_0x594d83[_0x3448('0x5b')][_0x3448('0xbf')])){_0x3bf4d2+=_0x3448('0x96');if(_0x594d83[_0x3448('0x5b')][_0x3448('0xbf')]>0x0){_0x3bf4d2+=_0x3448('0xcd')+_0x2f0bcc[_0x3448('0xbf')][_0x1ddd54]+'</td>';_0x3bf4d2+='<td\x20class=\x22numberRight\x22>'+_0x594d83['proforma'][_0x3448('0xbf')][_0x3448('0xce')](0x2)+_0x3448('0xc5');}_0x3bf4d2+=_0x3448('0xae');_0x559022=_0xca3d2;_0x504eee=_0xaeef29;}else{_0x559022=_0x258f64;_0x504eee=_0x3ff2ce;}if(_0x559022>0x0||_0x594d83['proforma'][_0x3448('0xbf')]>0x0){_0x3bf4d2+='<tr>';_0x3bf4d2+=_0x3448('0xcf')+_0x2f0bcc['total'][_0x1ddd54]+_0x3448('0xa4');_0x3bf4d2+='<td\x20class=\x22numberRight\x22>'+_0x504eee[_0x3448('0xce')](0x2)+_0x3448('0xc5');_0x3bf4d2+=_0x3448('0xae');}if(_0x559022>0x0){_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=_0x3448('0xcf')+_0x2f0bcc[_0x3448('0xc9')][_0x1ddd54]+_0x3448('0xa4');_0x3bf4d2+=_0x3448('0xc4')+_0x559022[_0x3448('0xce')](0x2)+'\x20&euro;</td>';_0x3bf4d2+='</tr>';}_0x3bf4d2+=_0x3448('0x96');var _0x23ccbc;if(_0x1e2f04){_0x23ccbc=_0x504eee;}else{_0x23ccbc=_0x504eee+_0x559022;}_0x3bf4d2+=_0x3448('0xd0')+_0x2f0bcc[_0x3448('0xd1')][_0x1ddd54]+'</td><td\x20class=\x22total\x20numberRight\x22>'+_0x23ccbc[_0x3448('0xce')](0x2)+_0x3448('0xc5');_0x3bf4d2+=_0x3448('0xd2');_0x3bf4d2+='</tr>';_0x3bf4d2+=_0x3448('0xd3');_0x3bf4d2+='</table></div><table>';_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=util[_0x3448('0x59')](_0x3448('0xd4'),_0x594d83['proforma'][_0x3448('0xca')][_0x3448('0xd5')](new RegExp(String[_0x3448('0xd6')](0xd),'g'),_0x3448('0xd7')));_0x3bf4d2+=_0x3448('0xae');_0x3bf4d2+=_0x3448('0x96');_0x3bf4d2+=_0x3448('0xaf');_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc[_0x3448('0xd9')][_0x1ddd54]+_0x3448('0x64');if(!_[_0x3448('0xc7')](_0x594d83[_0x3448('0x5b')][_0x3448('0xda')])){_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc['accountholder'][_0x1ddd54]+':\x20<span\x20class=\x22issuerData\x22>'+_0x594d83[_0x3448('0x5b')][_0x3448('0xda')]+_0x3448('0xdb');_0x3bf4d2+='<div\x20class=\x22issuerFiled\x22>'+_0x2f0bcc['bankname'][_0x1ddd54]+_0x3448('0xdc')+_0x594d83[_0x3448('0x5b')][_0x3448('0xdd')]+_0x3448('0xde');_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc[_0x3448('0xdf')][_0x1ddd54]+_0x3448('0xdc')+_0x594d83[_0x3448('0x5b')][_0x3448('0xe0')]+',\x20'+_0x594d83[_0x3448('0x5b')][_0x3448('0xe1')]+_0x3448('0xe2')+_0x594d83['proforma'][_0x3448('0xe3')]+'\x20('+_0x594d83[_0x3448('0x5b')][_0x3448('0xe4')]+')'+_0x3448('0xdb');_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc[_0x3448('0xe5')][_0x1ddd54]+'/'+_0x2f0bcc[_0x3448('0xe6')][_0x1ddd54]+_0x3448('0xdc')+_0x594d83[_0x3448('0x5b')][_0x3448('0xe7')]+'/'+_0x594d83[_0x3448('0x5b')][_0x3448('0xe8')]+'</span></div>';_0x3bf4d2+='<div\x20class=\x22issuerFiled\x22>'+_0x2f0bcc[_0x3448('0xe9')][_0x1ddd54]+'/'+_0x2f0bcc[_0x3448('0xea')][_0x1ddd54]+_0x3448('0xdc')+_0x594d83['proforma'][_0x3448('0xeb')]+_0x3448('0xdb');_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc['iban'][_0x1ddd54]+':\x20<span\x20class=\x22issuerData\x22>'+_0x594d83[_0x3448('0x5b')][_0x3448('0xec')]+_0x3448('0xdb');}if(!_[_0x3448('0xc7')](_0x594d83[_0x3448('0x5b')][_0x3448('0xed')])){_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc[_0x3448('0xee')][_0x1ddd54]+_0x3448('0xdc')+_0x594d83[_0x3448('0x5b')][_0x3448('0xed')]+_0x3448('0xdb');}_0x3bf4d2+=_0x3448('0xd8')+_0x2f0bcc[_0x3448('0xef')][_0x1ddd54]+'<span>'+_0x94d13f+_0x3448('0xf0')+_0x2f0bcc[_0x3448('0xf1')][_0x1ddd54]+'</div>';_0x3bf4d2+=_0x3448('0xa4');_0x3bf4d2+=_0x3448('0xae');if(_0x594d83[_0x3448('0x5b')][_0x3448('0xf2')]===0x1){_0x3bf4d2+=_0x3448('0x95')+_0x5cf3fe+_0x3448('0xf3');}_0x3bf4d2+='</table>';_0x3bf4d2+=_0x3448('0xf4');_0x3bf4d2+=_0x3448('0xf5');return new BPromise(function(_0x21708d,_0x4d9bd3){pdf['create'](_0x3bf4d2,_0x5c9320)[_0x3448('0xf6')](path[_0x3448('0x54')](_0x456e82,_0x363723),function(_0x23123e,_0x44175f){if(_0x23123e)return _0x4d9bd3(_0x23123e);_0x21708d(_0x44175f);});});});}})[_0x3448('0x26')](function(){if(_0x4926aa){console[_0x3448('0xf7')](_0x3448('0xf8'),_0x1b7d87,_0x363723);return _0x5dd19a[_0x3448('0xf9')](_0x1b7d87,_0x363723,function(_0xec238c){if(_0xec238c){console['log'](_0x3448('0xfa'),_0xec238c);}else{console[_0x3448('0xf7')](_0x3448('0xfb'),_0x456e82);rimraf(_0x456e82,function(){});}});}else{return _0x5dd19a[_0x3448('0x1b')](0xc8);}})[_0x3448('0x44')](handleError(_0x5dd19a,null));};function addCloneDetail(_0x56f576,_0x25efb7,_0x2fc6dc){console[_0x3448('0xf7')](_0x3448('0xfc'),_0x56f576);_0x56f576[_0x3448('0xfd')]=_0x25efb7;delete _0x56f576['id'];return db[_0x3448('0xfe')][_0x3448('0x49')](_0x56f576,{'transaction':_0x2fc6dc});}exports[_0x3448('0xff')]=function(_0x3051d9,_0x63bbf7,_0x3fa68f){var _0x1582f0;if(_0x3051d9[_0x3448('0x4a')]['id']){delete _0x3051d9[_0x3448('0x4a')]['id'];}console[_0x3448('0xf7')](_0x3448('0x100'),_0x3051d9[_0x3448('0x46')]['id']);return db[_0x3448('0x101')][_0x3448('0x102')](function(_0xe8908e){return db[_0x3448('0x2b')]['create'](_0x3051d9[_0x3448('0x4a')],{'transaction':_0xe8908e,'logging':console['log']})[_0x3448('0x26')](function(_0x2a4791){console['log'](_0x3448('0x103'),_0x2a4791);_0x1582f0=_0x2a4791;var _0x4ec163=_0x3051d9[_0x3448('0x46')]['id'];return db[_0x3448('0xfe')]['findAll']({'where':{'ProformaId':_0x4ec163},'raw':!![]});})[_0x3448('0x26')](function(_0x258d67){console['log'](_0x3448('0x104'),_0x258d67);if(_0x258d67[_0x3448('0x33')]>0x0){var _0x5e15e0=[];for(var _0x4a22a8=0x0;_0x4a22a8<_0x258d67['length'];_0x4a22a8++){_0x5e15e0[_0x3448('0x105')](addCloneDetail(_0x258d67[_0x4a22a8],_0x1582f0['id'],_0xe8908e));}return BPromise[_0x3448('0x106')](_0x5e15e0);}else{var _0x2272f5={'errors':[{'type':_0x3448('0x107'),'message':_0x3448('0x108')}]};throw _0x2272f5;}});})[_0x3448('0x26')](function(){return _0x63bbf7[_0x3448('0x1b')](0xc8);})[_0x3448('0x44')](function(_0x5dcc5f){console[_0x3448('0xf7')](_0x3448('0x109'),_0x5dcc5f);if(_0x5dcc5f[_0x3448('0x29')]===_0x3448('0x10a')){var _0x5dcc5f={'errors':[{'message':_0x3448('0x10b')}]};}_0x63bbf7[_0x3448('0x1d')](0x1f4)[_0x3448('0x10c')](_0x5dcc5f);});};
\ No newline at end of file