Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / saProforma / saProforma.controller.js
index d787c56..3f803a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb688=['length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','describe','getProformaPDF','unix','root','server','files','tmp','logos','logo-invoice.png','images','paid-invoice.png','join','format','proforma','SAProformaDetail','details','portrait','1cm','10mm','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','footer','contents','default','mkdirSync','<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>','Telefono','Fax','Email','VAT\x20number','P.IVA','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','Sub\x20Total','Sub\x20Totale','Imponibile','Tax','Tasse','Total','Totale','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Account\x20Holder','Bank\x20name','ABI','CAB','BIC','SWIF','IBAN','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20','Italy','<table\x20class=\x22center\x22>','<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://','\x22\x20width=\x22180\x22></td></tr>','issuerName','%s<br/>','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20<br/>','issuerCountry',':\x20%s<br/>','issuerPhone','fax','issuerFax','issuerEmail','piva','issuerFiscalCode','issuerSDICode','issuerSocCap','</td>','<td></td>','<div\x20class=\x22receiperCompanyName\x22>%s</div>','companyName','%s\x20-\x20','receivingPostalCode','receivingCity','receivingCountry','receivingFiscalCode','receivingPIVA','sdi','receivingSDICode','</div></td>','</tr>','<div\x20class=\x22invoiceNumber\x22>','\x20N.%d</div>','DD/MM/YYYY','%s\x20</div>','updatedAt','add','days','<div\x20class=\x22duedDate\x22>','duedate','<tr>','<td\x20colspan=\x223\x22>','item','<th\x20class=\x22itemTabTitle\x22>','description','</th>','hrsqty','subtotal','netPrice','discount','tax','quantity','productDescription','<td\x20class=\x22numberCenter\x22>%d</td>','<td\x20class=\x22numberRight\x22>','\x20&euro;</td>','toFixed','</tr></table><div\x20class=\x22divTotal\x22><table\x20class=\x22tabTotal\x22>','isNil','receivingFiscalMessage','indexOf','split\x20payment','<td\x20class=\x22itemTotal\x22>','total','<td\x20class=\x22total\x22>','nettopay','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','<td\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','fromCharCode','<div\x20class=\x22issuerFiled\x22>','sendpayment','</div>','accountholder',':\x20<span\x20class=\x22issuerData\x22>','issuerBankAccount','</span></div>','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','issuerABI','bic','issuerBankBICSWIFT','iban','paypal','issuerPayPal','thank1','<span>','</span>','thank2','paid','</table>','</body>','</html>','toFile','log','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','err','foldername','addCloneDetail->>','ProformaId','cloneProforma','cloneProforma\x20req.params.id:','sequelize','result','cloneProforma\x20productsProforma:','push','WARNING','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','Duplicate\x20entry.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','SAProforma','model','keys','query','filters','intersection','attributes','fields'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb688,0xcf));var _0x8b68=function(_0x139f0d,_0x13829e){_0x139f0d=_0x139f0d-0x0;var _0x387279=_0xb688[_0x139f0d];return _0x387279;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))(_0x8b68('0x17'));var utils=require('../../config/utils');var config=require(_0x8b68('0x18'));var db=require(_0x8b68('0x19'))['db'];function respondWithStatusCode(_0x5e76c,_0x2d8472){_0x2d8472=_0x2d8472||0xcc;return function(_0x1965cf){if(_0x1965cf){return _0x5e76c[_0x8b68('0x1a')](_0x2d8472);}return _0x5e76c[_0x8b68('0x1b')](_0x2d8472)[_0x8b68('0x1c')]();};}function respondWithResult(_0x2686c7,_0x5b4364){_0x5b4364=_0x5b4364||0xc8;return function(_0xb2df35){if(_0xb2df35){return _0x2686c7['status'](_0x5b4364)['json'](_0xb2df35);}};}function respondWithFilteredResult(_0x22f75b,_0x1554d6){return function(_0x27d717){if(_0x27d717){var _0x5d3468=_0x27d717[_0x8b68('0x1d')],_0x5c8d0e=_0x1554d6[_0x8b68('0x1e')],_0x23bd52=_0x1554d6[_0x8b68('0x1e')]+_0x1554d6[_0x8b68('0x1f')],_0x5c1e44;if(_0x23bd52>=_0x5d3468){_0x23bd52=_0x5d3468;_0x5c1e44=0xc8;}else{_0x5c1e44=0xce;}_0x22f75b['status'](_0x5c1e44);return _0x22f75b[_0x8b68('0x20')](_0x8b68('0x21'),_0x5c8d0e+'-'+_0x23bd52+'/'+_0x5d3468)['json'](_0x27d717);}return null;};}function patchUpdates(_0x42b3bd){return function(_0x3c7e5a){try{jsonpatch[_0x8b68('0x22')](_0x3c7e5a,_0x42b3bd,!![]);}catch(_0x17f321){return BPromise[_0x8b68('0x23')](_0x17f321);}return _0x3c7e5a['save']();};}function saveUpdates(_0x7b0b70,_0x4b4b0f){return function(_0x59e9b1){if(_0x59e9b1){return _0x59e9b1[_0x8b68('0x24')](_0x7b0b70)[_0x8b68('0x25')](function(_0x1dbc1d){return _0x1dbc1d;});}return null;};}function removeEntity(_0x5603d4,_0x571adf){return function(_0x23edc1){if(_0x23edc1){return _0x23edc1['destroy']()[_0x8b68('0x25')](function(){_0x5603d4[_0x8b68('0x1b')](0xcc)[_0x8b68('0x1c')]();});}};}function handleEntityNotFound(_0x21ecca,_0x32ddc5){return function(_0x173524){if(!_0x173524){_0x21ecca['sendStatus'](0x194);}return _0x173524;};}function handleError(_0x1a6fe8,_0x46e827){_0x46e827=_0x46e827||0x1f4;return function(_0x4ca77d){logger[_0x8b68('0x26')](_0x4ca77d[_0x8b68('0x27')]);if(_0x4ca77d[_0x8b68('0x28')]){delete _0x4ca77d['name'];}_0x1a6fe8['status'](_0x46e827)['send'](_0x4ca77d);};}exports[_0x8b68('0x29')]=function(_0x448e43,_0x2ba2a3){var _0x583476={},_0x3311c7={},_0x53aaa2={'count':0x0,'rows':[]};var _0x4cf89d=db[_0x8b68('0x2a')]['rawAttributes'];_0x3311c7[_0x8b68('0x2b')]=_[_0x8b68('0x2c')](_0x4cf89d);_0x3311c7['query']=_['keys'](_0x448e43[_0x8b68('0x2d')]);_0x3311c7[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x3311c7[_0x8b68('0x2b')],_0x3311c7[_0x8b68('0x2d')]);_0x583476[_0x8b68('0x30')]=_[_0x8b68('0x2f')](_0x3311c7['model'],qs[_0x8b68('0x31')](_0x448e43['query'][_0x8b68('0x31')]));_0x583476[_0x8b68('0x30')]=_0x583476['attributes'][_0x8b68('0x32')]?_0x583476[_0x8b68('0x30')]:_0x3311c7[_0x8b68('0x2b')];if(!_0x448e43['query']['hasOwnProperty'](_0x8b68('0x33'))){_0x583476[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1f')]);_0x583476[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1e')]);}_0x583476[_0x8b68('0x34')]=qs[_0x8b68('0x35')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x35')]);_0x583476[_0x8b68('0x36')]=qs[_0x8b68('0x2e')](_[_0x8b68('0x37')](_0x448e43[_0x8b68('0x2d')],_0x3311c7[_0x8b68('0x2e')]));if(_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]){_0x583476[_0x8b68('0x36')]=_[_0x8b68('0x39')](_0x583476['where'],{'$or':_['map'](_0x4cf89d,function(_0x24026c){if(_0x24026c[_0x8b68('0x3a')][_0x8b68('0x3b')]!==_0x8b68('0x3c')){var _0xf2154f={};_0xf2154f[_0x24026c[_0x8b68('0x3d')]]={'$like':'%'+_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]+'%'};return _0xf2154f;}})});}_0x583476=_['merge']({},_0x583476,_0x448e43[_0x8b68('0x3e')]);var _0x2c94d0={'where':_0x583476[_0x8b68('0x36')]};return db[_0x8b68('0x2a')][_0x8b68('0x1d')](_0x2c94d0)[_0x8b68('0x25')](function(_0xff4080){_0x53aaa2[_0x8b68('0x1d')]=_0xff4080;if(_0x448e43['query'][_0x8b68('0x3f')]){_0x583476[_0x8b68('0x40')]=[{'all':!![]}];}return db[_0x8b68('0x2a')][_0x8b68('0x41')](_0x583476);})[_0x8b68('0x25')](function(_0x3b3394){_0x53aaa2[_0x8b68('0x42')]=_0x3b3394;return _0x53aaa2;})['then'](respondWithFilteredResult(_0x2ba2a3,_0x583476))[_0x8b68('0x43')](handleError(_0x2ba2a3,null));};exports[_0x8b68('0x44')]=function(_0x48f159,_0x14ec40){var _0x27a717={'raw':![],'where':{'id':_0x48f159['params']['id']}},_0x50b2f1={};_0x50b2f1['model']=_['keys'](db[_0x8b68('0x2a')][_0x8b68('0x45')]);_0x50b2f1['query']=_[_0x8b68('0x2c')](_0x48f159['query']);_0x50b2f1[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x50b2f1['model'],_0x50b2f1[_0x8b68('0x2d')]);_0x27a717['attributes']=_['intersection'](_0x50b2f1['model'],qs[_0x8b68('0x31')](_0x48f159[_0x8b68('0x2d')][_0x8b68('0x31')]));_0x27a717[_0x8b68('0x30')]=_0x27a717['attributes'][_0x8b68('0x32')]?_0x27a717['attributes']:_0x50b2f1[_0x8b68('0x2b')];if(_0x48f159[_0x8b68('0x2d')]['includeAll']){_0x27a717[_0x8b68('0x40')]=[{'all':!![]}];}_0x27a717=_[_0x8b68('0x39')]({},_0x27a717,_0x48f159[_0x8b68('0x3e')]);return db[_0x8b68('0x2a')]['find'](_0x27a717)[_0x8b68('0x25')](handleEntityNotFound(_0x14ec40,null))[_0x8b68('0x25')](respondWithResult(_0x14ec40,null))[_0x8b68('0x43')](handleError(_0x14ec40,null));};exports[_0x8b68('0x46')]=function(_0xae2c2a,_0x1362d3){return db[_0x8b68('0x2a')][_0x8b68('0x46')](_0xae2c2a[_0x8b68('0x47')],{})[_0x8b68('0x25')](respondWithResult(_0x1362d3,0xc9))[_0x8b68('0x43')](handleError(_0x1362d3,null));};exports[_0x8b68('0x24')]=function(_0x1af430,_0x108c8d){if(_0x1af430[_0x8b68('0x47')]['id']){delete _0x1af430[_0x8b68('0x47')]['id'];}return db['SAProforma'][_0x8b68('0x48')]({'where':{'id':_0x1af430[_0x8b68('0x49')]['id']}})['then'](handleEntityNotFound(_0x108c8d,null))[_0x8b68('0x25')](saveUpdates(_0x1af430['body'],null))['then'](respondWithResult(_0x108c8d,null))['catch'](handleError(_0x108c8d,null));};exports[_0x8b68('0x4a')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2a')]['find']({'where':{'id':_0x35874b['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))[_0x8b68('0x25')](removeEntity(_0x34047c,null))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports['describe']=function(_0x3f6e21,_0x431a75){return db['SAProforma'][_0x8b68('0x4b')]()[_0x8b68('0x25')](respondWithResult(_0x431a75,null))['catch'](handleError(_0x431a75,null));};exports[_0x8b68('0x4c')]=function(_0x754bf7,_0x51bf1b){var _0x3f7f89=moment()[_0x8b68('0x4d')]()['toString']();var _0x543d74=path['join'](config[_0x8b68('0x4e')],_0x8b68('0x4f'),_0x8b68('0x50'),_0x8b68('0x51'));var _0x55aad3=path['join'](config[_0x8b68('0x4e')],_0x8b68('0x4f'),_0x8b68('0x50'),'images',_0x8b68('0x52'),_0x8b68('0x53'));var _0x3f9d34=path['join'](config[_0x8b68('0x4e')],'server',_0x8b68('0x50'),_0x8b68('0x54'),'logos',_0x8b68('0x55'));var _0x25842e=path[_0x8b68('0x56')](_0x543d74,_0x3f7f89);var _0xcd88b4=util[_0x8b68('0x57')]('Proforma_%s-%s.pdf',_0x754bf7[_0x8b68('0x49')]['id'],_0x3f7f89);var _0x3f3e43=path[_0x8b68('0x56')](_0x25842e,_0xcd88b4);var _0x31a090=![];var _0xb55358={};return db[_0x8b68('0x2a')][_0x8b68('0x48')]({'where':{'id':_0x754bf7[_0x8b68('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x51bf1b,null))[_0x8b68('0x25')](function(_0x1a85da){if(_0x1a85da){_0xb55358[_0x8b68('0x58')]=_0x1a85da;return db[_0x8b68('0x59')][_0x8b68('0x41')]({'where':{'ProformaId':_0x1a85da['id']},'raw':!![]})[_0x8b68('0x25')](function(_0x3a90ba){_0xb55358[_0x8b68('0x5a')]=_0x3a90ba;_0x31a090=!![];var _0x6d63cb='';var _0x271dbe={'format':'A4','orientation':_0x8b68('0x5b'),'border':_0x8b68('0x5c'),'footer':{'height':_0x8b68('0x5d'),'contents':{'default':_0x8b68('0x5e')}}};_0x271dbe[_0x8b68('0x5f')][_0x8b68('0x60')][_0x8b68('0x61')]=_0x271dbe[_0x8b68('0x5f')][_0x8b68('0x60')][_0x8b68('0x61')]+'<div\x20class=\x22issuerFiledWeb\x22>'+_0xb55358[_0x8b68('0x58')]['issuerWeb']+'</div>';fs[_0x8b68('0x62')](_0x25842e);_0x6d63cb='<html>';_0x6d63cb+=_0x8b68('0x63');_0x6d63cb+=_0x8b68('0x64');var _0x44287f={'phone':{'en':'Phone','it':_0x8b68('0x65')},'fax':{'en':_0x8b68('0x66'),'it':_0x8b68('0x66')},'email':{'en':_0x8b68('0x67'),'it':_0x8b68('0x67')},'piva':{'en':_0x8b68('0x68'),'it':_0x8b68('0x69')},'cf':{'en':'Tax\x20code','it':'C.F.'},'sdi':{'en':_0x8b68('0x6a'),'it':_0x8b68('0x6b')},'cs':{'en':_0x8b68('0x6c'),'it':_0x8b68('0x6d')},'invoice':{'en':_0x8b68('0x6e'),'it':_0x8b68('0x6f')},'proforma':{'en':_0x8b68('0x70'),'it':_0x8b68('0x70')},'creditnote':{'en':_0x8b68('0x71'),'it':_0x8b68('0x72')},'duedate':{'en':_0x8b68('0x73'),'it':_0x8b68('0x74')},'item':{'en':_0x8b68('0x75'),'it':_0x8b68('0x76')},'description':{'en':_0x8b68('0x77'),'it':_0x8b68('0x78')},'hrsqty':{'en':_0x8b68('0x79'),'it':_0x8b68('0x7a')},'unitprice':{'en':'Unit\x20Price','it':'Prezzo\x20Unitario'},'subtotal':{'en':_0x8b68('0x7b'),'it':_0x8b68('0x7c')},'discount':{'en':'Discount','it':'Sconto'},'total':{'en':'Subtotal','it':_0x8b68('0x7d')},'tax':{'en':_0x8b68('0x7e'),'it':_0x8b68('0x7f')},'nettopay':{'en':_0x8b68('0x80'),'it':_0x8b68('0x81')},'sendpayment':{'en':'Please\x20send\x20PAYMENT\x20to','it':_0x8b68('0x82')},'accountholder':{'en':_0x8b68('0x83'),'it':'Conto\x20intestato\x20a'},'bankname':{'en':_0x8b68('0x84'),'it':'Nome\x20banca'},'bankaddress':{'en':'Bank\x20Address','it':'Indirizzo\x20banca'},'abi':{'en':_0x8b68('0x85'),'it':_0x8b68('0x85')},'cab':{'en':_0x8b68('0x86'),'it':_0x8b68('0x86')},'bic':{'en':_0x8b68('0x87'),'it':_0x8b68('0x87')},'swif':{'en':_0x8b68('0x88'),'it':_0x8b68('0x88')},'iban':{'en':_0x8b68('0x89'),'it':_0x8b68('0x89')},'paypal':{'en':'Pay\x20via\x20Paypal','it':_0x8b68('0x8a')},'thank1':{'en':_0x8b68('0x8b'),'it':_0x8b68('0x8c')},'thank2':{'en':',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','it':'\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.'}};var _0x1854a9='it';if(_0xb55358[_0x8b68('0x58')]['receivingCountry']!==_0x8b68('0x8d')){_0x1854a9='en';}_0x6d63cb+=_0x8b68('0x8e');_0x6d63cb+=_0x8b68('0x8f')+_0x55aad3+_0x8b68('0x90');_0x6d63cb+='<tr>';_0x6d63cb+=util[_0x8b68('0x57')]('<td\x20class=\x22issuerInfo\x22>\x20%s<br/>',_0xb55358['proforma'][_0x8b68('0x91')]);_0x6d63cb+=util['format'](_0x8b68('0x92'),_0xb55358[_0x8b68('0x58')]['issuerStreet']);_0x6d63cb+=util[_0x8b68('0x57')]('%s',_0xb55358[_0x8b68('0x58')][_0x8b68('0x93')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x94'),_0xb55358['proforma'][_0x8b68('0x95')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x96'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x97')]);_0x6d63cb+=util['format'](_0x44287f['phone'][_0x1854a9]+_0x8b68('0x98'),_0xb55358['proforma'][_0x8b68('0x99')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0x9a')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x9b')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['email'][_0x1854a9]+_0x8b68('0x98'),_0xb55358['proforma'][_0x8b68('0x9c')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0x9d')][_0x1854a9]+':\x20%s<br/>',_0xb55358[_0x8b68('0x58')]['issuerPIVA']);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['cf'][_0x1854a9]+':\x20%s<br/>',_0xb55358[_0x8b68('0x58')][_0x8b68('0x9e')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['sdi'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x9f')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['cs'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa0')]);_0x6d63cb+=_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xa2');_0x6d63cb+='<td\x20class=\x22receiperInfo\x22>';_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xa3'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa4')]);_0x6d63cb+=util[_0x8b68('0x57')]('%s<br/>',_0xb55358[_0x8b68('0x58')]['receivingStreet']);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xa5'),_0xb55358['proforma'][_0x8b68('0xa6')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x92'),_0xb55358['proforma'][_0x8b68('0xa7')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x92'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa8')]);_0x6d63cb+=util[_0x8b68('0x57')]('<div\x20class=\x22reciperFiscalInfo\x22>'+_0x44287f['cf'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa9')]);_0x6d63cb+=util['format'](_0x44287f[_0x8b68('0x9d')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xaa')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0xab')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xac')]);_0x6d63cb+=_0x8b68('0xad');_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+='<tr>';_0x6d63cb+='<td\x20colspan=\x223\x22>';_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xaf')+_0x44287f[_0x8b68('0x58')][_0x1854a9]+_0x8b68('0xb0'),_0x1a85da['id']);_0x6d63cb+=util[_0x8b68('0x57')]('<div\x20class=\x22createdDate\x22>%s,\x20',_0xb55358[_0x8b68('0x58')][_0x8b68('0x95')]);var _0x23d041=moment(_0xb55358[_0x8b68('0x58')]['updatedAt'])['format'](_0x8b68('0xb1'));_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xb2'),_0x23d041);var _0x1bf8cd=moment(_0xb55358[_0x8b68('0x58')][_0x8b68('0xb3')])[_0x8b68('0xb4')](_0xb55358[_0x8b68('0x58')]['saExpiryDay'],_0x8b68('0xb5'))[_0x8b68('0x57')](_0x8b68('0xb1'));_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xb6')+_0x44287f[_0x8b68('0xb7')][_0x1854a9]+':\x20%s</div></td>',_0x1bf8cd);_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xb9');_0x6d63cb+='<table\x20class=\x22roundedCorners\x22>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+='<th\x20class=\x22itemTabTitle\x22>'+_0x44287f[_0x8b68('0xba')][_0x1854a9]+'</th>';_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbc')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbe')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+='<th\x20class=\x22itemTabTitle\x22>'+_0x44287f['unitprice'][_0x1854a9]+'</th>';_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbf')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+=_0x8b68('0xae');var _0x30db03=0x0;var _0x401229=0x0;for(var _0x333f4f=0x0;_0x333f4f<_0xb55358[_0x8b68('0x5a')][_0x8b68('0x32')];_0x333f4f++){var _0x60f6e5=0x0;var _0x323a2e=0x0;var _0x7df801=0x0;var _0x230676=0x0;_0x60f6e5=_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]-_0xb55358['details'][_0x333f4f]['netPrice']/0x64*_0xb55358['details'][_0x333f4f][_0x8b68('0xc1')];_0x323a2e=_0x60f6e5/0x64*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc2')];_0x7df801=_0x60f6e5*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc3')];_0x230676=_0x323a2e*_0xb55358['details'][_0x333f4f][_0x8b68('0xc3')];_0x6d63cb+='<tr>';_0x6d63cb+=util[_0x8b68('0x57')]('<td>%s</td>',_0xb55358[_0x8b68('0x5a')][_0x333f4f]['productName']);_0x6d63cb+=util[_0x8b68('0x57')]('<td>%s</td>',_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc4')]);_0x6d63cb+=util['format'](_0x8b68('0xc5'),_0xb55358[_0x8b68('0x5a')][_0x333f4f]['quantity']);_0x6d63cb+=_0x8b68('0xc6')+_0x60f6e5['toFixed'](0x2)+_0x8b68('0xc7');_0x6d63cb+='<td\x20class=\x22numberRight\x22>'+_0x7df801[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+=_0x8b68('0xae');_0x30db03+=_0x7df801;_0x401229+=_0x230676;}_0x6d63cb+=_0x8b68('0xc9');if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')])){var _0x4bb3c3=0x0;var _0x19d947=0x0;var _0x2ecedc=_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')]*0x64/_0x30db03;for(var _0x333f4f=0x0;_0x333f4f<_0xb55358[_0x8b68('0x5a')][_0x8b68('0x32')];_0x333f4f++){var _0x19c3e3=0x0;var _0x1c1df3=0x0;var _0x2bd8e4=0x0;_0x60f6e5=_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]-_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]/0x64*_0xb55358['details'][_0x333f4f][_0x8b68('0xc1')];_0x19c3e3=_0x60f6e5/0x64*_0x2ecedc;_0x1c1df3=_0x60f6e5-_0x19c3e3;_0x2bd8e4=_0x1c1df3*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc3')];_0x4bb3c3+=_0x2bd8e4;_0x19d947+=_0x2bd8e4/0x64*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc2')];}}var _0x3bae8f=0x0;var _0x4a8ec0=0x0;var _0x106f3c=![];var _0x2433a5=_0xb55358[_0x8b68('0x58')][_0x8b68('0xcb')];if(_0x2433a5[_0x8b68('0xcc')](_0x8b68('0xcd'))!=-0x1){_0x106f3c=!![];}if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')])){_0x6d63cb+='<tr>';if(_0xb55358[_0x8b68('0x58')]['discount']>0x0){_0x6d63cb+='<td\x20>'+_0x44287f['discount'][_0x1854a9]+_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xc6')+_0xb55358['proforma'][_0x8b68('0xc1')][_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');}_0x6d63cb+=_0x8b68('0xae');_0x3bae8f=_0x19d947;_0x4a8ec0=_0x4bb3c3;}else{_0x3bae8f=_0x401229;_0x4a8ec0=_0x30db03;}if(_0x3bae8f>0x0||_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')]>0x0){_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xce')+_0x44287f[_0x8b68('0xcf')][_0x1854a9]+_0x8b68('0xa1');_0x6d63cb+='<td\x20class=\x22numberRight\x22>'+_0x4a8ec0[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+='</tr>';}if(_0x3bae8f>0x0){_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xce')+_0x44287f['tax'][_0x1854a9]+'</td>';_0x6d63cb+=_0x8b68('0xc6')+_0x3bae8f[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+=_0x8b68('0xae');}_0x6d63cb+=_0x8b68('0xb8');var _0x15897a;if(_0x106f3c){_0x15897a=_0x4a8ec0;}else{_0x15897a=_0x4a8ec0+_0x3bae8f;}_0x6d63cb+=_0x8b68('0xd0')+_0x44287f[_0x8b68('0xd1')][_0x1854a9]+'</td><td\x20class=\x22total\x20numberRight\x22>'+_0x15897a[_0x8b68('0xc8')](0x2)+'\x20&euro;</td>';_0x6d63cb+='</table>\x20</td>';_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+=_0x8b68('0xd2');_0x6d63cb+='</table></div><table>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=util['format'](_0x8b68('0xd3'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xcb')]['replace'](new RegExp(String[_0x8b68('0xd4')](0xd),'g'),'<br\x20/>'));_0x6d63cb+='</tr>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xb9');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xd6')][_0x1854a9]+_0x8b68('0xd7');if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')]['issuerBankAccount'])){_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xd8')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xda')]+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f['bankname'][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')]['issuerBankName']+'</span>\x20</div>';_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xdc')][_0x1854a9]+':\x20<span\x20class=\x22issuerData\x22>'+_0xb55358[_0x8b68('0x58')][_0x8b68('0xdd')]+',\x20'+_0xb55358[_0x8b68('0x58')][_0x8b68('0xde')]+_0x8b68('0xdf')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xe0')]+'\x20('+_0xb55358['proforma'][_0x8b68('0xe1')]+')'+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f['abi'][_0x1854a9]+'/'+_0x44287f['cab'][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xe2')]+'/'+_0xb55358['proforma']['issuerCAB']+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe3')][_0x1854a9]+'/'+_0x44287f['swif'][_0x1854a9]+':\x20<span\x20class=\x22issuerData\x22>'+_0xb55358['proforma'][_0x8b68('0xe4')]+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe5')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358['proforma']['issuerBankIBAN']+_0x8b68('0xdb');}if(!_['isNil'](_0xb55358['proforma']['issuerPayPal'])){_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe6')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358['proforma'][_0x8b68('0xe7')]+'</span></div>';}_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe8')][_0x1854a9]+_0x8b68('0xe9')+_0x1bf8cd+_0x8b68('0xea')+_0x44287f[_0x8b68('0xeb')][_0x1854a9]+_0x8b68('0xd7');_0x6d63cb+=_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xae');if(_0xb55358[_0x8b68('0x58')][_0x8b68('0xec')]===0x1){_0x6d63cb+=_0x8b68('0x8f')+_0x3f9d34+_0x8b68('0x90');}_0x6d63cb+=_0x8b68('0xed');_0x6d63cb+=_0x8b68('0xee');_0x6d63cb+=_0x8b68('0xef');return new BPromise(function(_0x198f36,_0xc9eba4){pdf[_0x8b68('0x46')](_0x6d63cb,_0x271dbe)[_0x8b68('0xf0')](path['join'](_0x25842e,_0xcd88b4),function(_0x1012e6,_0x58d795){if(_0x1012e6)return _0xc9eba4(_0x1012e6);_0x198f36(_0x58d795);});});});}})[_0x8b68('0x25')](function(){if(_0x31a090){console[_0x8b68('0xf1')](_0x8b68('0xf2'),_0x3f3e43,_0xcd88b4);return _0x51bf1b[_0x8b68('0xf3')](_0x3f3e43,_0xcd88b4,function(_0x37ad41){if(_0x37ad41){console[_0x8b68('0xf1')](_0x8b68('0xf4'),_0x37ad41);}else{console[_0x8b68('0xf1')](_0x8b68('0xf5'),_0x25842e);rimraf(_0x25842e,function(){});}});}else{return _0x51bf1b[_0x8b68('0x1a')](0xc8);}})[_0x8b68('0x43')](handleError(_0x51bf1b,null));};function addCloneDetail(_0x477cd1,_0x589372,_0x2d559c){console[_0x8b68('0xf1')](_0x8b68('0xf6'),_0x477cd1);_0x477cd1[_0x8b68('0xf7')]=_0x589372;delete _0x477cd1['id'];return db[_0x8b68('0x59')][_0x8b68('0x46')](_0x477cd1,{'transaction':_0x2d559c});}exports[_0x8b68('0xf8')]=function(_0x45b488,_0x3a3f59,_0x267011){var _0x2ba260;if(_0x45b488['body']['id']){delete _0x45b488[_0x8b68('0x47')]['id'];}console[_0x8b68('0xf1')](_0x8b68('0xf9'),_0x45b488[_0x8b68('0x49')]['id']);return db[_0x8b68('0xfa')]['transaction'](function(_0x4866c3){return db[_0x8b68('0x2a')]['create'](_0x45b488[_0x8b68('0x47')],{'transaction':_0x4866c3,'logging':console[_0x8b68('0xf1')]})['then'](function(_0x5dc878){console[_0x8b68('0xf1')](_0x8b68('0xfb'),_0x5dc878);_0x2ba260=_0x5dc878;var _0x2b4173=_0x45b488[_0x8b68('0x49')]['id'];return db[_0x8b68('0x59')][_0x8b68('0x41')]({'where':{'ProformaId':_0x2b4173},'raw':!![]});})[_0x8b68('0x25')](function(_0x44fa68){console['log'](_0x8b68('0xfc'),_0x44fa68);if(_0x44fa68[_0x8b68('0x32')]>0x0){var _0x2e7e06=[];for(var _0x3fbe11=0x0;_0x3fbe11<_0x44fa68['length'];_0x3fbe11++){_0x2e7e06[_0x8b68('0xfd')](addCloneDetail(_0x44fa68[_0x3fbe11],_0x2ba260['id'],_0x4866c3));}return BPromise['all'](_0x2e7e06);}else{var _0xd5f0d0={'errors':[{'type':_0x8b68('0xfe'),'message':_0x8b68('0xff')}]};throw _0xd5f0d0;}});})[_0x8b68('0x25')](function(){return _0x3a3f59[_0x8b68('0x1a')](0xc8);})[_0x8b68('0x43')](function(_0x525020){console['log']('TCL:\x20exports.cloneProforma\x20->\x20err',_0x525020);if(_0x525020['name']==='SequelizeUniqueConstraintError'){var _0x525020={'errors':[{'message':_0x8b68('0x100')}]};}_0x3a3f59['status'](0x1f4)['send'](_0x525020);});};
\ No newline at end of file
+var _0xb688=['length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','describe','getProformaPDF','unix','root','server','files','tmp','logos','logo-invoice.png','images','paid-invoice.png','join','format','proforma','SAProformaDetail','details','portrait','1cm','10mm','<span\x20style=\x22color:\x20#444;\x22>{{page}}</span>/<span>{{pages}}</span>','footer','contents','default','mkdirSync','<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>','Telefono','Fax','Email','VAT\x20number','P.IVA','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','Sub\x20Total','Sub\x20Totale','Imponibile','Tax','Tasse','Total','Totale','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Account\x20Holder','Bank\x20name','ABI','CAB','BIC','SWIF','IBAN','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20','Italy','<table\x20class=\x22center\x22>','<tr>\x20<td\x20colspan=\x223\x22><img\x20src=\x22file://','\x22\x20width=\x22180\x22></td></tr>','issuerName','%s<br/>','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20<br/>','issuerCountry',':\x20%s<br/>','issuerPhone','fax','issuerFax','issuerEmail','piva','issuerFiscalCode','issuerSDICode','issuerSocCap','</td>','<td></td>','<div\x20class=\x22receiperCompanyName\x22>%s</div>','companyName','%s\x20-\x20','receivingPostalCode','receivingCity','receivingCountry','receivingFiscalCode','receivingPIVA','sdi','receivingSDICode','</div></td>','</tr>','<div\x20class=\x22invoiceNumber\x22>','\x20N.%d</div>','DD/MM/YYYY','%s\x20</div>','updatedAt','add','days','<div\x20class=\x22duedDate\x22>','duedate','<tr>','<td\x20colspan=\x223\x22>','item','<th\x20class=\x22itemTabTitle\x22>','description','</th>','hrsqty','subtotal','netPrice','discount','tax','quantity','productDescription','<td\x20class=\x22numberCenter\x22>%d</td>','<td\x20class=\x22numberRight\x22>','\x20&euro;</td>','toFixed','</tr></table><div\x20class=\x22divTotal\x22><table\x20class=\x22tabTotal\x22>','isNil','receivingFiscalMessage','indexOf','split\x20payment','<td\x20class=\x22itemTotal\x22>','total','<td\x20class=\x22total\x22>','nettopay','<tr><td\x20class=\x22totalEmpty\x22>&nbsp;</td></tr>','<td\x20class=\x22lex\x22\x20colspan=\x222\x22>\x20%s\x20</td>','fromCharCode','<div\x20class=\x22issuerFiled\x22>','sendpayment','</div>','accountholder',':\x20<span\x20class=\x22issuerData\x22>','issuerBankAccount','</span></div>','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','issuerABI','bic','issuerBankBICSWIFT','iban','paypal','issuerPayPal','thank1','<span>','</span>','thank2','paid','</table>','</body>','</html>','toFile','log','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','err','foldername','addCloneDetail->>','ProformaId','cloneProforma','cloneProforma\x20req.params.id:','sequelize','result','cloneProforma\x20productsProforma:','push','WARNING','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','Duplicate\x20entry.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','SAProforma','model','keys','query','filters','intersection','attributes','fields'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb688,0xcf));var _0x8b68=function(_0x353228,_0x52641b){_0x353228=_0x353228-0x0;var _0x33f242=_0xb688[_0x353228];return _0x33f242;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))(_0x8b68('0x17'));var utils=require('../../config/utils');var config=require(_0x8b68('0x18'));var db=require(_0x8b68('0x19'))['db'];function respondWithStatusCode(_0x5e76c,_0x2d8472){_0x2d8472=_0x2d8472||0xcc;return function(_0x1965cf){if(_0x1965cf){return _0x5e76c[_0x8b68('0x1a')](_0x2d8472);}return _0x5e76c[_0x8b68('0x1b')](_0x2d8472)[_0x8b68('0x1c')]();};}function respondWithResult(_0x2686c7,_0x5b4364){_0x5b4364=_0x5b4364||0xc8;return function(_0xb2df35){if(_0xb2df35){return _0x2686c7['status'](_0x5b4364)['json'](_0xb2df35);}};}function respondWithFilteredResult(_0x22f75b,_0x1554d6){return function(_0x27d717){if(_0x27d717){var _0x5d3468=_0x27d717[_0x8b68('0x1d')],_0x5c8d0e=_0x1554d6[_0x8b68('0x1e')],_0x23bd52=_0x1554d6[_0x8b68('0x1e')]+_0x1554d6[_0x8b68('0x1f')],_0x5c1e44;if(_0x23bd52>=_0x5d3468){_0x23bd52=_0x5d3468;_0x5c1e44=0xc8;}else{_0x5c1e44=0xce;}_0x22f75b['status'](_0x5c1e44);return _0x22f75b[_0x8b68('0x20')](_0x8b68('0x21'),_0x5c8d0e+'-'+_0x23bd52+'/'+_0x5d3468)['json'](_0x27d717);}return null;};}function patchUpdates(_0x42b3bd){return function(_0x3c7e5a){try{jsonpatch[_0x8b68('0x22')](_0x3c7e5a,_0x42b3bd,!![]);}catch(_0x17f321){return BPromise[_0x8b68('0x23')](_0x17f321);}return _0x3c7e5a['save']();};}function saveUpdates(_0x7b0b70,_0x4b4b0f){return function(_0x59e9b1){if(_0x59e9b1){return _0x59e9b1[_0x8b68('0x24')](_0x7b0b70)[_0x8b68('0x25')](function(_0x1dbc1d){return _0x1dbc1d;});}return null;};}function removeEntity(_0x5603d4,_0x571adf){return function(_0x23edc1){if(_0x23edc1){return _0x23edc1['destroy']()[_0x8b68('0x25')](function(){_0x5603d4[_0x8b68('0x1b')](0xcc)[_0x8b68('0x1c')]();});}};}function handleEntityNotFound(_0x21ecca,_0x32ddc5){return function(_0x173524){if(!_0x173524){_0x21ecca['sendStatus'](0x194);}return _0x173524;};}function handleError(_0x1a6fe8,_0x46e827){_0x46e827=_0x46e827||0x1f4;return function(_0x4ca77d){logger[_0x8b68('0x26')](_0x4ca77d[_0x8b68('0x27')]);if(_0x4ca77d[_0x8b68('0x28')]){delete _0x4ca77d['name'];}_0x1a6fe8['status'](_0x46e827)['send'](_0x4ca77d);};}exports[_0x8b68('0x29')]=function(_0x448e43,_0x2ba2a3){var _0x583476={},_0x3311c7={},_0x53aaa2={'count':0x0,'rows':[]};var _0x4cf89d=db[_0x8b68('0x2a')]['rawAttributes'];_0x3311c7[_0x8b68('0x2b')]=_[_0x8b68('0x2c')](_0x4cf89d);_0x3311c7['query']=_['keys'](_0x448e43[_0x8b68('0x2d')]);_0x3311c7[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x3311c7[_0x8b68('0x2b')],_0x3311c7[_0x8b68('0x2d')]);_0x583476[_0x8b68('0x30')]=_[_0x8b68('0x2f')](_0x3311c7['model'],qs[_0x8b68('0x31')](_0x448e43['query'][_0x8b68('0x31')]));_0x583476[_0x8b68('0x30')]=_0x583476['attributes'][_0x8b68('0x32')]?_0x583476[_0x8b68('0x30')]:_0x3311c7[_0x8b68('0x2b')];if(!_0x448e43['query']['hasOwnProperty'](_0x8b68('0x33'))){_0x583476[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1f')]);_0x583476[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1e')]);}_0x583476[_0x8b68('0x34')]=qs[_0x8b68('0x35')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x35')]);_0x583476[_0x8b68('0x36')]=qs[_0x8b68('0x2e')](_[_0x8b68('0x37')](_0x448e43[_0x8b68('0x2d')],_0x3311c7[_0x8b68('0x2e')]));if(_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]){_0x583476[_0x8b68('0x36')]=_[_0x8b68('0x39')](_0x583476['where'],{'$or':_['map'](_0x4cf89d,function(_0x24026c){if(_0x24026c[_0x8b68('0x3a')][_0x8b68('0x3b')]!==_0x8b68('0x3c')){var _0xf2154f={};_0xf2154f[_0x24026c[_0x8b68('0x3d')]]={'$like':'%'+_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]+'%'};return _0xf2154f;}})});}_0x583476=_['merge']({},_0x583476,_0x448e43[_0x8b68('0x3e')]);var _0x2c94d0={'where':_0x583476[_0x8b68('0x36')]};return db[_0x8b68('0x2a')][_0x8b68('0x1d')](_0x2c94d0)[_0x8b68('0x25')](function(_0xff4080){_0x53aaa2[_0x8b68('0x1d')]=_0xff4080;if(_0x448e43['query'][_0x8b68('0x3f')]){_0x583476[_0x8b68('0x40')]=[{'all':!![]}];}return db[_0x8b68('0x2a')][_0x8b68('0x41')](_0x583476);})[_0x8b68('0x25')](function(_0x3b3394){_0x53aaa2[_0x8b68('0x42')]=_0x3b3394;return _0x53aaa2;})['then'](respondWithFilteredResult(_0x2ba2a3,_0x583476))[_0x8b68('0x43')](handleError(_0x2ba2a3,null));};exports[_0x8b68('0x44')]=function(_0x48f159,_0x14ec40){var _0x27a717={'raw':![],'where':{'id':_0x48f159['params']['id']}},_0x50b2f1={};_0x50b2f1['model']=_['keys'](db[_0x8b68('0x2a')][_0x8b68('0x45')]);_0x50b2f1['query']=_[_0x8b68('0x2c')](_0x48f159['query']);_0x50b2f1[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x50b2f1['model'],_0x50b2f1[_0x8b68('0x2d')]);_0x27a717['attributes']=_['intersection'](_0x50b2f1['model'],qs[_0x8b68('0x31')](_0x48f159[_0x8b68('0x2d')][_0x8b68('0x31')]));_0x27a717[_0x8b68('0x30')]=_0x27a717['attributes'][_0x8b68('0x32')]?_0x27a717['attributes']:_0x50b2f1[_0x8b68('0x2b')];if(_0x48f159[_0x8b68('0x2d')]['includeAll']){_0x27a717[_0x8b68('0x40')]=[{'all':!![]}];}_0x27a717=_[_0x8b68('0x39')]({},_0x27a717,_0x48f159[_0x8b68('0x3e')]);return db[_0x8b68('0x2a')]['find'](_0x27a717)[_0x8b68('0x25')](handleEntityNotFound(_0x14ec40,null))[_0x8b68('0x25')](respondWithResult(_0x14ec40,null))[_0x8b68('0x43')](handleError(_0x14ec40,null));};exports[_0x8b68('0x46')]=function(_0xae2c2a,_0x1362d3){return db[_0x8b68('0x2a')][_0x8b68('0x46')](_0xae2c2a[_0x8b68('0x47')],{})[_0x8b68('0x25')](respondWithResult(_0x1362d3,0xc9))[_0x8b68('0x43')](handleError(_0x1362d3,null));};exports[_0x8b68('0x24')]=function(_0x1af430,_0x108c8d){if(_0x1af430[_0x8b68('0x47')]['id']){delete _0x1af430[_0x8b68('0x47')]['id'];}return db['SAProforma'][_0x8b68('0x48')]({'where':{'id':_0x1af430[_0x8b68('0x49')]['id']}})['then'](handleEntityNotFound(_0x108c8d,null))[_0x8b68('0x25')](saveUpdates(_0x1af430['body'],null))['then'](respondWithResult(_0x108c8d,null))['catch'](handleError(_0x108c8d,null));};exports[_0x8b68('0x4a')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2a')]['find']({'where':{'id':_0x35874b['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))[_0x8b68('0x25')](removeEntity(_0x34047c,null))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports['describe']=function(_0x3f6e21,_0x431a75){return db['SAProforma'][_0x8b68('0x4b')]()[_0x8b68('0x25')](respondWithResult(_0x431a75,null))['catch'](handleError(_0x431a75,null));};exports[_0x8b68('0x4c')]=function(_0x754bf7,_0x51bf1b){var _0x3f7f89=moment()[_0x8b68('0x4d')]()['toString']();var _0x543d74=path['join'](config[_0x8b68('0x4e')],_0x8b68('0x4f'),_0x8b68('0x50'),_0x8b68('0x51'));var _0x55aad3=path['join'](config[_0x8b68('0x4e')],_0x8b68('0x4f'),_0x8b68('0x50'),'images',_0x8b68('0x52'),_0x8b68('0x53'));var _0x3f9d34=path['join'](config[_0x8b68('0x4e')],'server',_0x8b68('0x50'),_0x8b68('0x54'),'logos',_0x8b68('0x55'));var _0x25842e=path[_0x8b68('0x56')](_0x543d74,_0x3f7f89);var _0xcd88b4=util[_0x8b68('0x57')]('Proforma_%s-%s.pdf',_0x754bf7[_0x8b68('0x49')]['id'],_0x3f7f89);var _0x3f3e43=path[_0x8b68('0x56')](_0x25842e,_0xcd88b4);var _0x31a090=![];var _0xb55358={};return db[_0x8b68('0x2a')][_0x8b68('0x48')]({'where':{'id':_0x754bf7[_0x8b68('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x51bf1b,null))[_0x8b68('0x25')](function(_0x1a85da){if(_0x1a85da){_0xb55358[_0x8b68('0x58')]=_0x1a85da;return db[_0x8b68('0x59')][_0x8b68('0x41')]({'where':{'ProformaId':_0x1a85da['id']},'raw':!![]})[_0x8b68('0x25')](function(_0x3a90ba){_0xb55358[_0x8b68('0x5a')]=_0x3a90ba;_0x31a090=!![];var _0x6d63cb='';var _0x271dbe={'format':'A4','orientation':_0x8b68('0x5b'),'border':_0x8b68('0x5c'),'footer':{'height':_0x8b68('0x5d'),'contents':{'default':_0x8b68('0x5e')}}};_0x271dbe[_0x8b68('0x5f')][_0x8b68('0x60')][_0x8b68('0x61')]=_0x271dbe[_0x8b68('0x5f')][_0x8b68('0x60')][_0x8b68('0x61')]+'<div\x20class=\x22issuerFiledWeb\x22>'+_0xb55358[_0x8b68('0x58')]['issuerWeb']+'</div>';fs[_0x8b68('0x62')](_0x25842e);_0x6d63cb='<html>';_0x6d63cb+=_0x8b68('0x63');_0x6d63cb+=_0x8b68('0x64');var _0x44287f={'phone':{'en':'Phone','it':_0x8b68('0x65')},'fax':{'en':_0x8b68('0x66'),'it':_0x8b68('0x66')},'email':{'en':_0x8b68('0x67'),'it':_0x8b68('0x67')},'piva':{'en':_0x8b68('0x68'),'it':_0x8b68('0x69')},'cf':{'en':'Tax\x20code','it':'C.F.'},'sdi':{'en':_0x8b68('0x6a'),'it':_0x8b68('0x6b')},'cs':{'en':_0x8b68('0x6c'),'it':_0x8b68('0x6d')},'invoice':{'en':_0x8b68('0x6e'),'it':_0x8b68('0x6f')},'proforma':{'en':_0x8b68('0x70'),'it':_0x8b68('0x70')},'creditnote':{'en':_0x8b68('0x71'),'it':_0x8b68('0x72')},'duedate':{'en':_0x8b68('0x73'),'it':_0x8b68('0x74')},'item':{'en':_0x8b68('0x75'),'it':_0x8b68('0x76')},'description':{'en':_0x8b68('0x77'),'it':_0x8b68('0x78')},'hrsqty':{'en':_0x8b68('0x79'),'it':_0x8b68('0x7a')},'unitprice':{'en':'Unit\x20Price','it':'Prezzo\x20Unitario'},'subtotal':{'en':_0x8b68('0x7b'),'it':_0x8b68('0x7c')},'discount':{'en':'Discount','it':'Sconto'},'total':{'en':'Subtotal','it':_0x8b68('0x7d')},'tax':{'en':_0x8b68('0x7e'),'it':_0x8b68('0x7f')},'nettopay':{'en':_0x8b68('0x80'),'it':_0x8b68('0x81')},'sendpayment':{'en':'Please\x20send\x20PAYMENT\x20to','it':_0x8b68('0x82')},'accountholder':{'en':_0x8b68('0x83'),'it':'Conto\x20intestato\x20a'},'bankname':{'en':_0x8b68('0x84'),'it':'Nome\x20banca'},'bankaddress':{'en':'Bank\x20Address','it':'Indirizzo\x20banca'},'abi':{'en':_0x8b68('0x85'),'it':_0x8b68('0x85')},'cab':{'en':_0x8b68('0x86'),'it':_0x8b68('0x86')},'bic':{'en':_0x8b68('0x87'),'it':_0x8b68('0x87')},'swif':{'en':_0x8b68('0x88'),'it':_0x8b68('0x88')},'iban':{'en':_0x8b68('0x89'),'it':_0x8b68('0x89')},'paypal':{'en':'Pay\x20via\x20Paypal','it':_0x8b68('0x8a')},'thank1':{'en':_0x8b68('0x8b'),'it':_0x8b68('0x8c')},'thank2':{'en':',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','it':'\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.'}};var _0x1854a9='it';if(_0xb55358[_0x8b68('0x58')]['receivingCountry']!==_0x8b68('0x8d')){_0x1854a9='en';}_0x6d63cb+=_0x8b68('0x8e');_0x6d63cb+=_0x8b68('0x8f')+_0x55aad3+_0x8b68('0x90');_0x6d63cb+='<tr>';_0x6d63cb+=util[_0x8b68('0x57')]('<td\x20class=\x22issuerInfo\x22>\x20%s<br/>',_0xb55358['proforma'][_0x8b68('0x91')]);_0x6d63cb+=util['format'](_0x8b68('0x92'),_0xb55358[_0x8b68('0x58')]['issuerStreet']);_0x6d63cb+=util[_0x8b68('0x57')]('%s',_0xb55358[_0x8b68('0x58')][_0x8b68('0x93')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x94'),_0xb55358['proforma'][_0x8b68('0x95')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x96'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x97')]);_0x6d63cb+=util['format'](_0x44287f['phone'][_0x1854a9]+_0x8b68('0x98'),_0xb55358['proforma'][_0x8b68('0x99')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0x9a')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x9b')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['email'][_0x1854a9]+_0x8b68('0x98'),_0xb55358['proforma'][_0x8b68('0x9c')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0x9d')][_0x1854a9]+':\x20%s<br/>',_0xb55358[_0x8b68('0x58')]['issuerPIVA']);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['cf'][_0x1854a9]+':\x20%s<br/>',_0xb55358[_0x8b68('0x58')][_0x8b68('0x9e')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['sdi'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0x9f')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f['cs'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa0')]);_0x6d63cb+=_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xa2');_0x6d63cb+='<td\x20class=\x22receiperInfo\x22>';_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xa3'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa4')]);_0x6d63cb+=util[_0x8b68('0x57')]('%s<br/>',_0xb55358[_0x8b68('0x58')]['receivingStreet']);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xa5'),_0xb55358['proforma'][_0x8b68('0xa6')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x92'),_0xb55358['proforma'][_0x8b68('0xa7')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0x92'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa8')]);_0x6d63cb+=util[_0x8b68('0x57')]('<div\x20class=\x22reciperFiscalInfo\x22>'+_0x44287f['cf'][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xa9')]);_0x6d63cb+=util['format'](_0x44287f[_0x8b68('0x9d')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xaa')]);_0x6d63cb+=util[_0x8b68('0x57')](_0x44287f[_0x8b68('0xab')][_0x1854a9]+_0x8b68('0x98'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xac')]);_0x6d63cb+=_0x8b68('0xad');_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+='<tr>';_0x6d63cb+='<td\x20colspan=\x223\x22>';_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xaf')+_0x44287f[_0x8b68('0x58')][_0x1854a9]+_0x8b68('0xb0'),_0x1a85da['id']);_0x6d63cb+=util[_0x8b68('0x57')]('<div\x20class=\x22createdDate\x22>%s,\x20',_0xb55358[_0x8b68('0x58')][_0x8b68('0x95')]);var _0x23d041=moment(_0xb55358[_0x8b68('0x58')]['updatedAt'])['format'](_0x8b68('0xb1'));_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xb2'),_0x23d041);var _0x1bf8cd=moment(_0xb55358[_0x8b68('0x58')][_0x8b68('0xb3')])[_0x8b68('0xb4')](_0xb55358[_0x8b68('0x58')]['saExpiryDay'],_0x8b68('0xb5'))[_0x8b68('0x57')](_0x8b68('0xb1'));_0x6d63cb+=util[_0x8b68('0x57')](_0x8b68('0xb6')+_0x44287f[_0x8b68('0xb7')][_0x1854a9]+':\x20%s</div></td>',_0x1bf8cd);_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xb9');_0x6d63cb+='<table\x20class=\x22roundedCorners\x22>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+='<th\x20class=\x22itemTabTitle\x22>'+_0x44287f[_0x8b68('0xba')][_0x1854a9]+'</th>';_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbc')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbe')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+='<th\x20class=\x22itemTabTitle\x22>'+_0x44287f['unitprice'][_0x1854a9]+'</th>';_0x6d63cb+=_0x8b68('0xbb')+_0x44287f[_0x8b68('0xbf')][_0x1854a9]+_0x8b68('0xbd');_0x6d63cb+=_0x8b68('0xae');var _0x30db03=0x0;var _0x401229=0x0;for(var _0x333f4f=0x0;_0x333f4f<_0xb55358[_0x8b68('0x5a')][_0x8b68('0x32')];_0x333f4f++){var _0x60f6e5=0x0;var _0x323a2e=0x0;var _0x7df801=0x0;var _0x230676=0x0;_0x60f6e5=_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]-_0xb55358['details'][_0x333f4f]['netPrice']/0x64*_0xb55358['details'][_0x333f4f][_0x8b68('0xc1')];_0x323a2e=_0x60f6e5/0x64*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc2')];_0x7df801=_0x60f6e5*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc3')];_0x230676=_0x323a2e*_0xb55358['details'][_0x333f4f][_0x8b68('0xc3')];_0x6d63cb+='<tr>';_0x6d63cb+=util[_0x8b68('0x57')]('<td>%s</td>',_0xb55358[_0x8b68('0x5a')][_0x333f4f]['productName']);_0x6d63cb+=util[_0x8b68('0x57')]('<td>%s</td>',_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc4')]);_0x6d63cb+=util['format'](_0x8b68('0xc5'),_0xb55358[_0x8b68('0x5a')][_0x333f4f]['quantity']);_0x6d63cb+=_0x8b68('0xc6')+_0x60f6e5['toFixed'](0x2)+_0x8b68('0xc7');_0x6d63cb+='<td\x20class=\x22numberRight\x22>'+_0x7df801[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+=_0x8b68('0xae');_0x30db03+=_0x7df801;_0x401229+=_0x230676;}_0x6d63cb+=_0x8b68('0xc9');if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')])){var _0x4bb3c3=0x0;var _0x19d947=0x0;var _0x2ecedc=_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')]*0x64/_0x30db03;for(var _0x333f4f=0x0;_0x333f4f<_0xb55358[_0x8b68('0x5a')][_0x8b68('0x32')];_0x333f4f++){var _0x19c3e3=0x0;var _0x1c1df3=0x0;var _0x2bd8e4=0x0;_0x60f6e5=_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]-_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc0')]/0x64*_0xb55358['details'][_0x333f4f][_0x8b68('0xc1')];_0x19c3e3=_0x60f6e5/0x64*_0x2ecedc;_0x1c1df3=_0x60f6e5-_0x19c3e3;_0x2bd8e4=_0x1c1df3*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc3')];_0x4bb3c3+=_0x2bd8e4;_0x19d947+=_0x2bd8e4/0x64*_0xb55358[_0x8b68('0x5a')][_0x333f4f][_0x8b68('0xc2')];}}var _0x3bae8f=0x0;var _0x4a8ec0=0x0;var _0x106f3c=![];var _0x2433a5=_0xb55358[_0x8b68('0x58')][_0x8b68('0xcb')];if(_0x2433a5[_0x8b68('0xcc')](_0x8b68('0xcd'))!=-0x1){_0x106f3c=!![];}if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')])){_0x6d63cb+='<tr>';if(_0xb55358[_0x8b68('0x58')]['discount']>0x0){_0x6d63cb+='<td\x20>'+_0x44287f['discount'][_0x1854a9]+_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xc6')+_0xb55358['proforma'][_0x8b68('0xc1')][_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');}_0x6d63cb+=_0x8b68('0xae');_0x3bae8f=_0x19d947;_0x4a8ec0=_0x4bb3c3;}else{_0x3bae8f=_0x401229;_0x4a8ec0=_0x30db03;}if(_0x3bae8f>0x0||_0xb55358[_0x8b68('0x58')][_0x8b68('0xc1')]>0x0){_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xce')+_0x44287f[_0x8b68('0xcf')][_0x1854a9]+_0x8b68('0xa1');_0x6d63cb+='<td\x20class=\x22numberRight\x22>'+_0x4a8ec0[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+='</tr>';}if(_0x3bae8f>0x0){_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xce')+_0x44287f['tax'][_0x1854a9]+'</td>';_0x6d63cb+=_0x8b68('0xc6')+_0x3bae8f[_0x8b68('0xc8')](0x2)+_0x8b68('0xc7');_0x6d63cb+=_0x8b68('0xae');}_0x6d63cb+=_0x8b68('0xb8');var _0x15897a;if(_0x106f3c){_0x15897a=_0x4a8ec0;}else{_0x15897a=_0x4a8ec0+_0x3bae8f;}_0x6d63cb+=_0x8b68('0xd0')+_0x44287f[_0x8b68('0xd1')][_0x1854a9]+'</td><td\x20class=\x22total\x20numberRight\x22>'+_0x15897a[_0x8b68('0xc8')](0x2)+'\x20&euro;</td>';_0x6d63cb+='</table>\x20</td>';_0x6d63cb+=_0x8b68('0xae');_0x6d63cb+=_0x8b68('0xd2');_0x6d63cb+='</table></div><table>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=util['format'](_0x8b68('0xd3'),_0xb55358[_0x8b68('0x58')][_0x8b68('0xcb')]['replace'](new RegExp(String[_0x8b68('0xd4')](0xd),'g'),'<br\x20/>'));_0x6d63cb+='</tr>';_0x6d63cb+=_0x8b68('0xb8');_0x6d63cb+=_0x8b68('0xb9');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xd6')][_0x1854a9]+_0x8b68('0xd7');if(!_[_0x8b68('0xca')](_0xb55358[_0x8b68('0x58')]['issuerBankAccount'])){_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xd8')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xda')]+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f['bankname'][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')]['issuerBankName']+'</span>\x20</div>';_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xdc')][_0x1854a9]+':\x20<span\x20class=\x22issuerData\x22>'+_0xb55358[_0x8b68('0x58')][_0x8b68('0xdd')]+',\x20'+_0xb55358[_0x8b68('0x58')][_0x8b68('0xde')]+_0x8b68('0xdf')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xe0')]+'\x20('+_0xb55358['proforma'][_0x8b68('0xe1')]+')'+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f['abi'][_0x1854a9]+'/'+_0x44287f['cab'][_0x1854a9]+_0x8b68('0xd9')+_0xb55358[_0x8b68('0x58')][_0x8b68('0xe2')]+'/'+_0xb55358['proforma']['issuerCAB']+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe3')][_0x1854a9]+'/'+_0x44287f['swif'][_0x1854a9]+':\x20<span\x20class=\x22issuerData\x22>'+_0xb55358['proforma'][_0x8b68('0xe4')]+_0x8b68('0xdb');_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe5')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358['proforma']['issuerBankIBAN']+_0x8b68('0xdb');}if(!_['isNil'](_0xb55358['proforma']['issuerPayPal'])){_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe6')][_0x1854a9]+_0x8b68('0xd9')+_0xb55358['proforma'][_0x8b68('0xe7')]+'</span></div>';}_0x6d63cb+=_0x8b68('0xd5')+_0x44287f[_0x8b68('0xe8')][_0x1854a9]+_0x8b68('0xe9')+_0x1bf8cd+_0x8b68('0xea')+_0x44287f[_0x8b68('0xeb')][_0x1854a9]+_0x8b68('0xd7');_0x6d63cb+=_0x8b68('0xa1');_0x6d63cb+=_0x8b68('0xae');if(_0xb55358[_0x8b68('0x58')][_0x8b68('0xec')]===0x1){_0x6d63cb+=_0x8b68('0x8f')+_0x3f9d34+_0x8b68('0x90');}_0x6d63cb+=_0x8b68('0xed');_0x6d63cb+=_0x8b68('0xee');_0x6d63cb+=_0x8b68('0xef');return new BPromise(function(_0x198f36,_0xc9eba4){pdf[_0x8b68('0x46')](_0x6d63cb,_0x271dbe)[_0x8b68('0xf0')](path['join'](_0x25842e,_0xcd88b4),function(_0x1012e6,_0x58d795){if(_0x1012e6)return _0xc9eba4(_0x1012e6);_0x198f36(_0x58d795);});});});}})[_0x8b68('0x25')](function(){if(_0x31a090){console[_0x8b68('0xf1')](_0x8b68('0xf2'),_0x3f3e43,_0xcd88b4);return _0x51bf1b[_0x8b68('0xf3')](_0x3f3e43,_0xcd88b4,function(_0x37ad41){if(_0x37ad41){console[_0x8b68('0xf1')](_0x8b68('0xf4'),_0x37ad41);}else{console[_0x8b68('0xf1')](_0x8b68('0xf5'),_0x25842e);rimraf(_0x25842e,function(){});}});}else{return _0x51bf1b[_0x8b68('0x1a')](0xc8);}})[_0x8b68('0x43')](handleError(_0x51bf1b,null));};function addCloneDetail(_0x477cd1,_0x589372,_0x2d559c){console[_0x8b68('0xf1')](_0x8b68('0xf6'),_0x477cd1);_0x477cd1[_0x8b68('0xf7')]=_0x589372;delete _0x477cd1['id'];return db[_0x8b68('0x59')][_0x8b68('0x46')](_0x477cd1,{'transaction':_0x2d559c});}exports[_0x8b68('0xf8')]=function(_0x45b488,_0x3a3f59,_0x267011){var _0x2ba260;if(_0x45b488['body']['id']){delete _0x45b488[_0x8b68('0x47')]['id'];}console[_0x8b68('0xf1')](_0x8b68('0xf9'),_0x45b488[_0x8b68('0x49')]['id']);return db[_0x8b68('0xfa')]['transaction'](function(_0x4866c3){return db[_0x8b68('0x2a')]['create'](_0x45b488[_0x8b68('0x47')],{'transaction':_0x4866c3,'logging':console[_0x8b68('0xf1')]})['then'](function(_0x5dc878){console[_0x8b68('0xf1')](_0x8b68('0xfb'),_0x5dc878);_0x2ba260=_0x5dc878;var _0x2b4173=_0x45b488[_0x8b68('0x49')]['id'];return db[_0x8b68('0x59')][_0x8b68('0x41')]({'where':{'ProformaId':_0x2b4173},'raw':!![]});})[_0x8b68('0x25')](function(_0x44fa68){console['log'](_0x8b68('0xfc'),_0x44fa68);if(_0x44fa68[_0x8b68('0x32')]>0x0){var _0x2e7e06=[];for(var _0x3fbe11=0x0;_0x3fbe11<_0x44fa68['length'];_0x3fbe11++){_0x2e7e06[_0x8b68('0xfd')](addCloneDetail(_0x44fa68[_0x3fbe11],_0x2ba260['id'],_0x4866c3));}return BPromise['all'](_0x2e7e06);}else{var _0xd5f0d0={'errors':[{'type':_0x8b68('0xfe'),'message':_0x8b68('0xff')}]};throw _0xd5f0d0;}});})[_0x8b68('0x25')](function(){return _0x3a3f59[_0x8b68('0x1a')](0xc8);})[_0x8b68('0x43')](function(_0x525020){console['log']('TCL:\x20exports.cloneProforma\x20->\x20err',_0x525020);if(_0x525020['name']==='SequelizeUniqueConstraintError'){var _0x525020={'errors':[{'message':_0x8b68('0x100')}]};}_0x3a3f59['status'](0x1f4)['send'](_0x525020);});};
\ No newline at end of file