<?php

namespace Teknisa\Libs\Util\Repositories;

use Doctrine\ORM\EntityManager;
use Teknisa\Libs\Util\Utilities;

class General {
    /**
     * @param $orgId
     * @return array
     */
    public static function getGeneralParamsByOrganizationId($orgId) {
        $query = <<<SQL
                   SELECT CDPARGERAL AS "CDPARGERAL", NMEMPGER AS "NMEMPGER", NMRSOCEMP AS "NMRSOCEMP", NRCGCEMP AS "NRCGCEMP", NRTELEMP AS "NRTELEMP", NRRAMALEMP AS "NRRAMALEMP", NRFAXEMP AS "NRFAXEMP", DSENDEMP AS "DSENDEMP", NMBAIREMP AS "NMBAIREMP", NRCEPEMP AS "NRCEPEMP", CDIDIOMA AS "CDIDIOMA", CDPICTPROD AS "CDPICTPROD", CDPICTRECE AS "CDPICTRECE", CDPICTSERV AS "CDPICTSERV", CDPICTCFIS AS "CDPICTCFIS", CDPICTCCTB AS "CDPICTCCTB", CDPICTETAPA AS "CDPICTETAPA", DTHRLIMPPVOO AS "DTHRLIMPPVOO", QTDIAATIVOS AS "QTDIAATIVOS", NRINSESTEMP AS "NRINSESTEMP", CDPAIS AS "CDPAIS", SGESTADO AS "SGESTADO", CDMUNICIPIO AS "CDMUNICIPIO", CDPICTPRAT AS "CDPICTPRAT", CDPICTREFE AS "CDPICTREFE", CDPICTDIET AS "CDPICTDIET", CDPICTCFIN AS "CDPICTCFIN", CDPICTINSPEC AS "CDPICTINSPEC", CDPICTSGRU AS "CDPICTSGRU", CDPICTESTAGI AS "CDPICTESTAGI", CDFILIAL AS "CDFILIAL", IDUTRPADCA AS "IDUTRPADCA", CDNVBLPROD AS "CDNVBLPROD", CDNVBLPRAT AS "CDNVBLPRAT", CDNVBLREFE AS "CDNVBLREFE", CDNVBLDIET AS "CDNVBLDIET", CDNDPCAL AS "CDNDPCAL", CDPROTEINA AS "CDPROTEINA", CDCALORIAS AS "CDCALORIAS", VRPEJURATRDI AS "VRPEJURATRDI", QTDIABLOQCAR AS "QTDIABLOQCAR", QTBLOQNESTOP AS "QTBLOQNESTOP", QTLIBENESTOR AS "QTLIBENESTOR", IDCONSMINEFE AS "IDCONSMINEFE", VRPECURVAA AS "VRPECURVAA", VRPECURVAB AS "VRPECURVAB", VRPECURVAC AS "VRPECURVAC", NRHRHOLDBOX AS "NRHRHOLDBOX", NRNIVELRECE AS "NRNIVELRECE", IDTPGERBREAK AS "IDTPGERBREAK", DSPARAMFATGE AS "DSPARAMFATGE", QTHRTROMESA AS "QTHRTROMESA", QTHRTROMESA1 AS "QTHRTROMESA1", CDINDINFLAC AS "CDINDINFLAC", CDSETOR AS "CDSETOR", IDUTCODBARRA AS "IDUTCODBARRA", CDLIPIDIOS AS "CDLIPIDIOS", CDGLICIDIOS AS "CDGLICIDIOS", IDUTILDTPROC AS "IDUTILDTPROC", IDUTCTRLACES AS "IDUTCTRLACES", DTINIANACMP AS "DTINIANACMP", DTFIMANACMP AS "DTFIMANACMP", DTINICOMCMP AS "DTINICOMCMP", DTFIMCOMCMP AS "DTFIMCOMCMP", DTINIATUII AS "DTINIATUII", DTFIMATUII AS "DTFIMATUII", DTINIANTII AS "DTINIANTII", DTFIMANTII AS "DTFIMANTII", DTINIRISL AS "DTINIRISL", DTFIMRISL AS "DTFIMRISL", CDFASETRAM AS "CDFASETRAM", DTINIORCFIN AS "DTINIORCFIN", DTFIMORCFIN AS "DTFIMORCFIN", DTINIENTSAID AS "DTINIENTSAID", DTFIMENTSAID AS "DTFIMENTSAID", DTINIATUCFAT AS "DTINIATUCFAT", DTFIMATUCFAT AS "DTFIMATUCFAT", DTINIANTCFAT AS "DTINIANTCFAT", DTFIMANTCFAT AS "DTFIMANTCFAT", IDEXCLANCTB AS "IDEXCLANCTB", IDSISDOS AS "IDSISDOS", IDLICUSODFS AS "IDLICUSODFS", CDENCADESC AS "CDENCADESC", CDGROPERRESE AS "CDGROPERRESE", CDGROPERREEX AS "CDGROPERREEX", DTVALLANCTO AS "DTVALLANCTO", CDGROPERREPA AS "CDGROPERREPA", IDCONSFISCEN AS "IDCONSFISCEN", IDCONSFISCSA AS "IDCONSFISCSA", VRPECOMICUST AS "VRPECOMICUST", DTULTATUBD AS "DTULTATUBD", VRPETOLEVRAF AS "VRPETOLEVRAF", IDCONDTENTAF AS "IDCONDTENTAF", IDCONVRUNIAF AS "IDCONVRUNIAF", IDCONFORNEAF AS "IDCONFORNEAF", IDCONVENCAF AS "IDCONVENCAF", IDCONQTDEAF AS "IDCONQTDEAF", IDNFOUTRASNF AS "IDNFOUTRASNF", NRDECITOTANF AS "NRDECITOTANF", VRFAIXTOLENF AS "VRFAIXTOLENF", IDAVNFNREPEN AS "IDAVNFNREPEN", IDAVNFNREPSA AS "IDAVNFNREPSA", IDBLOQVENPR AS "IDBLOQVENPR", CDALCOOL AS "CDALCOOL", CDCARBOHIDRA AS "CDCARBOHIDRA", CDPROTANIMAL AS "CDPROTANIMAL", CDPROTVEGETA AS "CDPROTVEGETA", QTDIAAPRHRTR AS "QTDIAAPRHRTR", TXNMARQUREQU AS "TXNMARQUREQU", IDCOFERIBANC AS "IDCOFERIBANC", VRPETOLEQTAF AS "VRPETOLEQTAF", IDBLOQCMPSAF AS "IDBLOQCMPSAF", DTULTATUPGER AS "DTULTATUPGER", CDGROPERPDV AS "CDGROPERPDV", IDTPLANCDESC AS "IDTPLANCDESC", CDGROPERPDV1 AS "CDGROPERPDV1", CDGROPERPROP AS "CDGROPERPROP", IDUTREIMPRNF AS "IDUTREIMPRNF", CDGROPERPROR AS "CDGROPERPROR", CDFATRAMIWEB AS "CDFATRAMIWEB", IDUTAPROVMOD AS "IDUTAPROVMOD", IDEXTFOTOCLI AS "IDEXTFOTOCLI", CDATVPROFTAR AS "CDATVPROFTAR", CDATVPROFSOL AS "CDATVPROFSOL", IDUTLBDCENTR AS "IDUTLBDCENTR", CDGROPERPROB AS "CDGROPERPROB", DSEMAILCLUSO AS "DSEMAILCLUSO", CDTRECHEQPRE AS "CDTRECHEQPRE", IDUTLPROCPAG AS "IDUTLPROCPAG", IDUTLPROCREC AS "IDUTLPROCREC", IDUTLPROCBCO AS "IDUTLPROCBCO", IDTPCABECREL AS "IDTPCABECREL", CDFILIPADRAO AS "CDFILIPADRAO", DSARQLOGOTIP AS "DSARQLOGOTIP", CDTIPCONTURA AS "CDTIPCONTURA", DTALTINDICE AS "DTALTINDICE", CDTIPCONTWEB AS "CDTIPCONTWEB", CDFATRAMENCE AS "CDFATRAMENCE", CDTPINDICE AS "CDTPINDICE", IDPERVALOR AS "IDPERVALOR", CDINDICEMF AS "CDINDICEMF", CDTPINDICE2 AS "CDTPINDICE2", IDPERVALOR2 AS "IDPERVALOR2", CDINDICEMF2 AS "CDINDICEMF2", CDMOTCONTPER AS "CDMOTCONTPER", CDMOTCONTSAC AS "CDMOTCONTSAC", CDMOTCONCHAT AS "CDMOTCONCHAT", CDMOTCONTCRM AS "CDMOTCONTCRM", CDMOTCONTDSC AS "CDMOTCONTDSC", CDMOTCONTCTR AS "CDMOTCONTCTR", IDTPORCAFINA AS "IDTPORCAFINA", IDGERANFDEVO AS "IDGERANFDEVO", CDPICTCFOP AS "CDPICTCFOP", IDAVNFNOCORR AS "IDAVNFNOCORR", DSPARGERFIS AS "DSPARGERFIS", IDMENUPERS AS "IDMENUPERS", CDMOTCONSTAT AS "CDMOTCONSTAT", CDPICTPROCES AS "CDPICTPROCES", CDPICTCCUSTO AS "CDPICTCCUSTO", IDRECREVICOP AS "IDRECREVICOP", CDPICTITTRAB AS "CDPICTITTRAB", IDPERMOVPROD AS "IDPERMOVPROD", IDCADPRODCMP AS "IDCADPRODCMP", NRDIAVALSENH AS "NRDIAVALSENH", CDPICTATIVCL AS "CDPICTATIVCL", CDPICTBEM AS "CDPICTBEM", IDBLOPRATLOC AS "IDBLOPRATLOC", IDCONSVLRMAF AS "IDCONSVLRMAF", IDIMPFOVAZAF AS "IDIMPFOVAZAF", CDFATRAMASSU AS "CDFATRAMASSU", CDCOMPLEXINI AS "CDCOMPLEXINI", IDOCINFORNF AS "IDOCINFORNF", IDBLOQNFAPUR AS "IDBLOQNFAPUR", DSVSSUSER AS "DSVSSUSER", DSVSSPASS AS "DSVSSPASS", DSDIRPATCH AS "DSDIRPATCH", IDBLOQPRADUP AS "IDBLOQPRADUP", CDTABECDIPA AS "CDTABECDIPA", DTGERARQTRAD AS "DTGERARQTRAD", IDUTSPADRFAI AS "IDUTSPADRFAI", IDBLOQEFET AS "IDBLOQEFET", IDUTILINTNFG AS "IDUTILINTNFG", IDBLOQCFOPNF AS "IDBLOQCFOPNF", DSEMAISACVND AS "DSEMAISACVND", DSEMAILAUVND AS "DSEMAILAUVND", CDSENHAUTVND AS "CDSENHAUTVND", DSSMTPAUTVND AS "DSSMTPAUTVND", IDCALPREVREC AS "IDCALPREVREC", IDUTCARDPADR AS "IDUTCARDPADR", IDUTCTREMPEN AS "IDUTCTREMPEN", IDUTILGERLOG AS "IDUTILGERLOG", IDCACHPRODFI AS "IDCACHPRODFI", IDDTBINFDTE AS "IDDTBINFDTE", IDCONSORCFIN AS "IDCONSORCFIN", CDGRUPRODFAT AS "CDGRUPRODFAT", IDUTPROPEMIS AS "IDUTPROPEMIS", IDEXIBDADORC AS "IDEXIBDADORC", IDUTLOGCLIEFILI AS "IDUTLOGCLIEFILI", IDUTLOGCLIESERV AS "IDUTLOGCLIESERV", IDUTLOGLANCAMNF AS "IDUTLOGLANCAMNF", IDUTLOGOPERESTO AS "IDUTLOGOPERESTO", IDUTLOGGERARNF AS "IDUTLOGGERARNF", IDUTLOGCTRLACES AS "IDUTLOGCTRLACES", IDUTLOGPARAMETR AS "IDUTLOGPARAMETR", IDPERALTINSFORN AS "IDPERALTINSFORN", NRMAXDIASIMPAF AS "NRMAXDIASIMPAF", DSPREVCONSPDV AS "DSPREVCONSPDV", IDRESTRFILIOPER AS "IDRESTRFILIOPER", IDUTPADRROP AS "IDUTPADRROP", NRMESHISTCARD AS "NRMESHISTCARD", IDCONSVLRMENAF AS "IDCONSVLRMENAF", IDUTRELACFORNAF AS "IDUTRELACFORNAF", IDPESQPRATNOME AS "IDPESQPRATNOME", CDPESQATEN AS "CDPESQATEN", CDPERGPESQATEN AS "CDPERGPESQATEN", DSDIRSALVCAT AS "DSDIRSALVCAT", IDGRAVATGTABELA AS "IDGRAVATGTABELA", IDPESQCOMPPROD AS "IDPESQCOMPPROD", NRDIASBLOQDTEMI AS "NRDIASBLOQDTEMI", NRDIASAVISDTEMI AS "NRDIASAVISDTEMI", NREXEMEMISSAO AS "NREXEMEMISSAO", IDBLQALTFILCENT AS "IDBLQALTFILCENT", IDEXPORTGRECENT AS "IDEXPORTGRECENT", DSULTPATCHERRO AS "DSULTPATCHERRO", IDINFCPFCNPJDFS AS "IDINFCPFCNPJDFS", IDPEALTCARDSERV AS "IDPEALTCARDSERV", CDPICTCLASSBEM AS "CDPICTCLASSBEM", IDPERCOMENSPRAT AS "IDPERCOMENSPRAT", CDPRODREDZTC AS "CDPRODREDZTC", CDDOCREDZTC AS "CDDOCREDZTC", IDIMPREDZTC AS "IDIMPREDZTC", NRDIASBLOQNF AS "NRDIASBLOQNF", IDUTTABPRECLVDC AS "IDUTTABPRECLVDC", IDUTAPURFILCENT AS "IDUTAPURFILCENT", CDPRODCREDPESTC AS "CDPRODCREDPESTC", CDDOCCREDPESTC AS "CDDOCCREDPESTC", IDIMPCREDPESTC AS "IDIMPCREDPESTC", IDRECUPICMSOL AS "IDRECUPICMSOL", CDACUCARES AS "CDACUCARES", CDACIDGRAXOS AS "CDACIDGRAXOS", IDUTEFETPAH AS "IDUTEFETPAH", IDIMPEFETPAH AS "IDIMPEFETPAH", IDUTBLOQOPAFPG AS "IDUTBLOQOPAFPG", NRORG AS "NRORG", DTINCLUSAO AS "DTINCLUSAO", DTULTATU AS "DTULTATU", NRORGINCLUSAO AS "NRORGINCLUSAO", CDOPERINCLUSAO AS "CDOPERINCLUSAO", NRORGULTATU AS "NRORGULTATU", CDOPERULTATU AS "CDOPERULTATU", CDENCDESCBONDEV AS "CDENCDESCBONDEV", IDCONTAJUDTCOMP AS "IDCONTAJUDTCOMP", IDMANCORCARDALT AS "IDMANCORCARDALT", IDGERENTOLAUT AS "IDGERENTOLAUT", IDSUGMODNF AS "IDSUGMODNF", IDUTENDMODFISC AS "IDUTENDMODFISC", IDGRAVATITABELA AS "IDGRAVATITABELA", IDGERTIARQTXT AS "IDGERTIARQTXT", IDPARAMEMISRE AS "IDPARAMEMISRE", IDOBRIGACLFISPR AS "IDOBRIGACLFISPR", DSENDEMAILPER AS "DSENDEMAILPER", NRTELFAXSUPPER AS "NRTELFAXSUPPER", IDBLOQAPRNFFORN AS "IDBLOQAPRNFFORN", DSARQATUESTR AS "DSARQATUESTR", IDUTINTMERCADUM AS "IDUTINTMERCADUM", DSIPPROXY AS "DSIPPROXY", DSPROXYUSER AS "DSPROXYUSER", DSPROXYPASS AS "DSPROXYPASS", DSURLSOAP AS "DSURLSOAP", IDUTIPPROXY AS "IDUTIPPROXY", IDUTIPROXY AS "IDUTIPROXY", TXHELPNFPSITE AS "TXHELPNFPSITE", TXHELPREFEXSITE AS "TXHELPREFEXSITE", NRPORTAAUTVND AS "NRPORTAAUTVND", IDORDPRIMDFENT AS "IDORDPRIMDFENT", IDORDPRIMDFSAI AS "IDORDPRIMDFSAI", DSDIRDESTARQTC AS "DSDIRDESTARQTC", IDUTDTPROCTNFE AS "IDUTDTPROCTNFE", IDUTSERTPOP AS "IDUTSERTPOP", NRDUPLINFS AS "NRDUPLINFS", IDPERALTCSTFENF AS "IDPERALTCSTFENF", NRORGMCD AS "NRORGMCD", IDOBRCHAVACES AS "IDOBRCHAVACES", IDTPIMPNFE AS "IDTPIMPNFE", QTDIASREQOFFLINE AS "QTDIASREQOFFLINE", DSCDSPATHLOL AS "DSCDSPATHLOL", IDREPLNRDT AS "IDREPLNRDT", IDEMAILBLOQSENH AS "IDEMAILBLOQSENH", DSEMAILBLOQSENH AS "DSEMAILBLOQSENH", IDEMPDESTREPAUT AS "IDEMPDESTREPAUT", IDCALCPESONF AS "IDCALCPESONF", IDUTFILCENTOBR AS "IDUTFILCENTOBR", IDENTRSAIDOPSAID AS "IDENTRSAIDOPSAID", CDOPERDEVOLSAID AS "CDOPERDEVOLSAID", IDENTRSAIDOPESTQ AS "IDENTRSAIDOPESTQ", CDOPERDEVOLESTQ AS "CDOPERDEVOLESTQ", IDENTRSAIDOPENTR AS "IDENTRSAIDOPENTR", CDOPERDEVOLENTR AS "CDOPERDEVOLENTR", IDUTCTRLFISENTR AS "IDUTCTRLFISENTR", IDUTCTRLFISSAID AS "IDUTCTRLFISSAID", IDDTBINFDTESREC AS "IDDTBINFDTESREC", IDBLOQSEMIMP AS "IDBLOQSEMIMP", IDREAUDPARFISC AS "IDREAUDPARFISC", DSINSTALLANGUAGE AS "DSINSTALLANGUAGE", IDPERLANCNFOUFI AS "IDPERLANCNFOUFI", IDUTILNFELANCNF AS "IDUTILNFELANCNF", DIAINIHORVER AS "DIAINIHORVER", MESINIHORVER AS "MESINIHORVER", DIAFIMHORVER AS "DIAFIMHORVER", MESFIMHORVER AS "MESFIMHORVER", IDOBRNCMCADPR AS "IDOBRNCMCADPR", IDPERVISIMPSCRE AS "IDPERVISIMPSCRE", CDVENDEDORDLV AS "CDVENDEDORDLV", IDBLOQALTPROXML AS "IDBLOQALTPROXML", IDDATACUSTOBI AS "IDDATACUSTOBI", IDATIVO AS "IDATIVO", IDUTDTBCDTEMISS AS "IDUTDTBCDTEMISS", IDBLOQITNFAPUR AS "IDBLOQITNFAPUR", IDEXCONSATGER AS "IDEXCONSATGER", IDDTEMISDIFDTBC AS "IDDTEMISDIFDTBC", CDGPOPINUNUM AS "CDGPOPINUNUM", IDVALIDAATEN AS "IDVALIDAATEN", CDGROPALTDTINI AS "CDGROPALTDTINI", IDGERNFIGUALXML AS "IDGERNFIGUALXML", CDLOJAESITEF AS "CDLOJAESITEF", DSEMAILIRREGNFE AS "DSEMAILIRREGNFE", IDNFILTROINSCR AS "IDNFILTROINSCR", IDBLAPRLCTMAPBL AS "IDBLAPRLCTMAPBL", NRORGINTEGRA AS "NRORGINTEGRA", DSENDEINTEGRA AS "DSENDEINTEGRA", FGLOGOTIPO AS "FGLOGOTIPO", IDSUGTPOPER AS "IDSUGTPOPER", IDEXPINFSAP AS "IDEXPINFSAP", IDALERTAATRASO AS "IDALERTAATRASO", DSDIRARQXMLNFCE AS "DSDIRARQXMLNFCE", JOBRUNNERISWIND AS "JOBRUNNERISWIND", DSEMAILNOTIFICATION AS "DSEMAILNOTIFICATION", IDNOTIFYADMINEMAIL AS "IDNOTIFYADMINEMAIL", DSSMTPSERVER AS "DSSMTPSERVER", NRSMTPPORT AS "NRSMTPPORT", IDPROTOCOLCRIPT AS "IDPROTOCOLCRIPT", DSSMTPLOGIN AS "DSSMTPLOGIN", DSSMTPPASS AS "DSSMTPPASS", DSEMAILFROM AS "DSEMAILFROM", REPORTURL AS "REPORTURL", CONSUMERURL AS "CONSUMERURL", JOBRUNNERURL AS "JOBRUNNERURL", IDINTEGRA AS "IDINTEGRA", IDPELANIMPXML AS "IDPELANIMPXML", IDRESLANMANCAIX AS "IDRESLANMANCAIX", IDTPOPERREF AS "IDTPOPERREF", CDTPOPERREF AS "CDTPOPERREF", IDTPOPERPRESER AS "IDTPOPERPRESER", CDTPOPERPRESER AS "CDTPOPERPRESER", IDOBRINFNRFUNMO AS "IDOBRINFNRFUNMO", CDFIBRAS AS "CDFIBRAS", CDSODIO AS "CDSODIO", QTDIASATRASOMSG AS "QTDIASATRASOMSG", QTDIASINATCLI AS "QTDIASINATCLI", QTDIASMSGEMAIL AS "QTDIASMSGEMAIL", DSMSGALERTAFIN AS "DSMSGALERTAFIN", DSMSGALERTAEMAIL AS "DSMSGALERTAEMAIL", CDCLIENTEFD AS "CDCLIENTEFD", CDTIPOCONSFD AS "CDTIPOCONSFD", CDCCUSCLIEFD AS "CDCCUSCLIEFD", CDSENHAAUTVNDWEB AS "CDSENHAAUTVNDWEB", NMLOJASITEF AS "NMLOJASITEF", CDLOJASITEF AS "CDLOJASITEF", DSEMAILCOPINADI AS "DSEMAILCOPINADI", IDPERAPROVNFXML AS "IDPERAPROVNFXML", IDLOJAESITEF AS "IDLOJAESITEF", REPORTPATH AS "REPORTPATH", URLLOGOCLIENTE AS "URLLOGOCLIENTE", IDVISUNMPRCOD AS "IDVISUNMPRCOD", CDGROPERNMNCOD AS "CDGROPERNMNCOD", IDCONSDATAFILDESTOL AS "IDCONSDATAFILDESTOL", IDUTORIGPROD AS "IDUTORIGPROD", DSSMTPCRIPT AS "DSSMTPCRIPT", IDCONTROLARECCONTRATO AS "IDCONTROLARECCONTRATO", CDGROPERRECCONTR AS "CDGROPERRECCONTR", IDINFPRODPRODUZ AS "IDINFPRODPRODUZ", IDUTCLOUD AS "IDUTCLOUD", NMENDWEBSER AS "NMENDWEBSER", CDTPOOPREMESSA AS "CDTPOOPREMESSA", CDTPOOPRETORNO AS "CDTPOOPRETORNO", DSMENSRODAPETAA AS "DSMENSRODAPETAA", IDOBRIGDADOBANCFORN AS "IDOBRIGDADOBANCFORN", IDMODODLV AS "IDMODODLV", IDTPAUTHSMTP AS "IDTPAUTHSMTP", NRPORTFTPOL AS "NRPORTFTPOL", DSSENHAFTPOL AS "DSSENHAFTPOL", DSUSERFTPOL AS "DSUSERFTPOL", DSRAIZEXPORTOL AS "DSRAIZEXPORTOL", CDCLIENTE AS "CDCLIENTE", IDPERREPLICNFOL AS "IDPERREPLICNFOL", VRFAIXTOLENFXML AS "VRFAIXTOLENFXML", IDBLOQLANCNFOPFIL AS "IDBLOQLANCNFOPFIL", DTINIGERAARQXML AS "DTINIGERAARQXML", DSDIRARQXML AS "DSDIRARQXML", DSDIRARQPHPGXML AS "DSDIRARQPHPGXML", DSDIRINSTALAPHP AS "DSDIRINSTALAPHP", IDATUPRODATIVFI AS "IDATUPRODATIVFI", IDUTINSCNFFILORI AS "IDUTINSCNFFILORI", IDCONFISPRFORENT AS "IDCONFISPRFORENT", IDCONFISPRTRAENT AS "IDCONFISPRTRAENT", IDCONFISPRFILENT AS "IDCONFISPRFILENT", CDGRSCONSFISCPRE AS "CDGRSCONSFISCPRE", IDCONFISPRCLSAID AS "IDCONFISPRCLSAID", IDCONFISPRFILSAI AS "IDCONFISPRFILSAI", IDCONFISPRTRASAI AS "IDCONFISPRTRASAI", CDGRSCONSFISCPRS AS "CDGRSCONSFISCPRS", VRMINPEDIDO AS "VRMINPEDIDO", IDPERMALTNFPED AS "IDPERMALTNFPED", DSDIRINSTALPHP AS "DSDIRINSTALPHP", DSDIRARQRECPHP AS "DSDIRARQRECPHP", IDOBTPOPLANCSIMP AS "IDOBTPOPLANCSIMP", IDBAIXAFTOTLANNF AS "IDBAIXAFTOTLANNF", IDUTCTRLACESWEB AS "IDUTCTRLACESWEB", CDGRUPPRODREVRECEITA AS "CDGRUPPRODREVRECEITA", IDPERMRELPRAFNF AS "IDPERMRELPRAFNF", IDUTCNTRENTNFSAI AS "IDUTCNTRENTNFSAI", CDGRUPPROD AS "CDGRUPPROD", IDBLOQRAIZCNPJDI AS "IDBLOQRAIZCNPJDI", NRGLUTEN AS "NRGLUTEN", NRLACTOSE AS "NRLACTOSE", IDOPPRESENDDIF AS "IDOPPRESENDDIF", DSLINKGERARDANFE AS "DSLINKGERARDANFE", IDRECUPPISCOFOL AS "IDRECUPPISCOFOL", DSURLHCM AS "DSURLHCM", DSIDHCM AS "DSIDHCM", DSSECRETHCM AS "DSSECRETHCM", DSTOKENHCM AS "DSTOKENHCM", IDUTCFOPXMLLANNF AS "IDUTCFOPXMLLANNF", CDGLUTEN AS "CDGLUTEN", CDLACTOSE AS "CDLACTOSE", NRMINFOSEXT AS "NRMINFOSEXT", IDVISUREGFISEMPR AS "IDVISUREGFISEMPR", IDBLOQXMLINSDIF AS "IDBLOQXMLINSDIF", FILESERVERURL AS "FILESERVERURL", IDPLATAFORMAPAG AS "IDPLATAFORMAPAG", IDPERMITEPAGRETLOJA AS "IDPERMITEPAGRETLOJA", IDCALCVRTOTANFE AS "IDCALCVRTOTANFE", CDTOKENAUDTAX AS "CDTOKENAUDTAX", CDKEYAUDTAX AS "CDKEYAUDTAX", PROXYAUDTAX AS "PROXYAUDTAX", PORTAUDTAX AS "PORTAUDTAX", IDUTILTRANSAUTO AS "IDUTILTRANSAUTO", DSDIRARQPHPTRANS AS "DSDIRARQPHPTRANS", HRTRANSAUTO AS "HRTRANSAUTO", IDHRTRANSAUTO AS "IDHRTRANSAUTO", CDTIPORECEQRCODE AS "CDTIPORECEQRCODE", IDJUSTALTCOMENS AS "IDJUSTALTCOMENS", DSARQLOGOTIPCLOB AS "DSARQLOGOTIPCLOB", IDGERACDOPERADOR AS "IDGERACDOPERADOR", DSENDSRVJENKINS AS "DSENDSRVJENKINS", IDPERFILJENKINS AS "IDPERFILJENKINS", IDUTLPERFILFILIAL AS "IDUTLPERFILFILIAL", IDHABINTIFO AS "IDHABINTIFO", CDGRPERDESBLXML AS "CDGRPERDESBLXML", IDCENTCUSCLIFOR AS "IDCENTCUSCLIFOR", DSDIRARQAJUPHP AS "DSDIRARQAJUPHP", IDBLOQCDIDCONS AS "IDBLOQCDIDCONS", FILESERVERAPIKEY AS "FILESERVERAPIKEY", CDSENHAOGOSHA512 AS "CDSENHAOGOSHA512", IDREPLICPRODATIV AS "IDREPLICPRODATIV", IDUTILCHECKOP AS "IDUTILCHECKOP", DSDIRARQZERASALD AS "DSDIRARQZERASALD", DSUSERNAMEJENKINS AS "DSUSERNAMEJENKINS", DSAPITOKENJENKINS AS "DSAPITOKENJENKINS", IDUTCUPOMDESC AS "IDUTCUPOMDESC", USUARIOSMTP AS "USUARIOSMTP", IDADICVENDEDOR AS "IDADICVENDEDOR", CDGORDURASATURADA AS "CDGORDURASATURADA", IDUTILTRANSFISCO AS "IDUTILTRANSFISCO", DSDIRARQPHPFISCO AS "DSDIRARQPHPFISCO", HRFISCOAUTO AS "HRFISCOAUTO", IDCPFREQUIRED AS "IDCPFREQUIRED", IDAGRUPPRODAFNF AS "IDAGRUPPRODAFNF", DSMENSAGEMRELAC AS "DSMENSAGEMRELAC", IDOBRIGAFINFXML AS "IDOBRIGAFINFXML", JENKINSINTERFACEURL AS "JENKINSINTERFACEURL", DSDNSCARDOTIMIZADO AS "DSDNSCARDOTIMIZADO", NRCORPRITAA AS "NRCORPRITAA", NRCORSECTAA AS "NRCORSECTAA", IDBLOQNFNUMFORN AS "IDBLOQNFNUMFORN", HTTPNEOLOG AS "HTTPNEOLOG", JENKINSINTERFACETOKEN AS "JENKINSINTERFACETOKEN", CDGRPERMLANMAX AS "CDGRPERMLANMAX", IDPERLANESTAPNF AS "IDPERLANESTAPNF", IDATUPRODADIC AS "IDATUPRODADIC", IDADICNRPEDIDO AS "IDADICNRPEDIDO", IDUTBLOQTPOPCLI AS "IDUTBLOQTPOPCLI", DSARQPOLPRIV AS "DSARQPOLPRIV", DSMSGCUPOMEMAIL AS "DSMSGCUPOMEMAIL", HRENVCUPOMEMAIL AS "HRENVCUPOMEMAIL", DSDIRPROJENVCUP AS "DSDIRPROJENVCUP", CDGRUPPRODOTMCARD AS "CDGRUPPRODOTMCARD", IDUTILELEMENTCTB AS "IDUTILELEMENTCTB", CDLOTESGF AS "CDLOTESGF", DSARQPOLPRIVCLIE AS "DSARQPOLPRIVCLIE", IDEMPRESAMEI AS "IDEMPRESAMEI", CDHISTPADRINSU AS "CDHISTPADRINSU", CDHISTPADRPRODA AS "CDHISTPADRPRODA", DSEMAILCONTAUTOCDP AS "DSEMAILCONTAUTOCDP", IDTPOPSACAIXAGER AS "IDTPOPSACAIXAGER", CDTPOPSACAIXAGER AS "CDTPOPSACAIXAGER", IDTPOPENCAIXAGER AS "IDTPOPENCAIXAGER", CDTPOPENCAIXAGER AS "CDTPOPENCAIXAGER"
                    FROM PARAMGERAL
                   WHERE NRORG = :NRORG
SQL;

        $params = array( 'NRORG' => $orgId );
        $result = Utilities::getEntityManager()->getConnection()->fetchAllAssociative($query, $params);
        return !empty($result) ? $result[0] : $result;
    }

    /**
     * @param $productCode
     * @param $orgId
     * @return array
     */
    public static function getProductByCodeAndOrganizationId($productCode, $orgId) {
        $query = <<<SQL
                   SELECT CDPRODUTO AS "CDPRODUTO", CDNVPRODUTO AS "CDNVPRODUTO", SGUNIDADE AS "SGUNIDADE", NMPRODUTO AS "NMPRODUTO", NMPRODINGLES AS "NMPRODINGLES", NMPRODESPANH AS "NMPRODESPANH", VRPESOUNID AS "VRPESOUNID", VRPEFATOCORR AS "VRPEFATOCORR", CDPRODESTO AS "CDPRODESTO", VRFATOCONV AS "VRFATOCONV", VRARREDREQ AS "VRARREDREQ", VRARREDCMP AS "VRARREDCMP", VRPEFATOCOCC AS "VRPEFATOCOCC", IDINTESAFR AS "IDINTESAFR", CDBARPRODUTO AS "CDBARPRODUTO", CDTPCTRECEB AS "CDTPCTRECEB", CDTPCTPAGAR AS "CDTPCTPAGAR", CDSETOR AS "CDSETOR", IDTPPRODDOS AS "IDTPPRODDOS", CDPRODUTODOS AS "CDPRODUTODOS", VRPREUNIT AS "VRPREUNIT", CDCLASFISC AS "CDCLASFISC", CDCCUSTENTR AS "CDCCUSTENTR", CDCCUSTSAID AS "CDCCUSTSAID", DTULTATUPROD AS "DTULTATUPROD", NRHRMONTPROD AS "NRHRMONTPROD", NRHRCOMPPROD AS "NRHRCOMPPROD", CDPRODINTE AS "CDPRODINTE", DSCOMPLNOME AS "DSCOMPLNOME", CDPRODORIG AS "CDPRODORIG", VRFATACRCMP AS "VRFATACRCMP", VRFATPERDCMP AS "VRFATPERDCMP", NMPRODIMPFIS AS "NMPRODIMPFIS", VRPELIARRCMP AS "VRPELIARRCMP", VRPELSARRCMP AS "VRPELSARRCMP", CDNATUPROD AS "CDNATUPROD", QTCONTRPROVA AS "QTCONTRPROVA", VRDOSEMINIMA AS "VRDOSEMINIMA", VRDOSEMAXIMA AS "VRDOSEMAXIMA", NRDIASVALIDA AS "NRDIASVALIDA", VRDENSIDADE AS "VRDENSIDADE", VRVOLMED AS "VRVOLMED", VRFATSEG AS "VRFATSEG", IDIMPPRODUTO AS "IDIMPPRODUTO", CDGENERO AS "CDGENERO", CDAREACON AS "CDAREACON", CDIDIOM AS "CDIDIOM", CDFABRIC AS "CDFABRIC", DSUNIDCOBR AS "DSUNIDCOBR", CDNASCDESP AS "CDNASCDESP", IDPESAPROD AS "IDPESAPROD", QTTARAPROD AS "QTTARAPROD", CDNACDESHOSP AS "CDNACDESHOSP", VRFATIMPPREC AS "VRFATIMPPREC", CDARVPROD AS "CDARVPROD", IDPRODPROD AS "IDPRODPROD", CDPRODPROD AS "CDPRODPROD", VRFATOCONVPR AS "VRFATOCONVPR", CDVIACESDIET AS "CDVIACESDIET", CDCLATERAP AS "CDCLATERAP", NRREGIPROD AS "NRREGIPROD", NRDIASVALANA AS "NRDIASVALANA", VRPESOBRUTPR AS "VRPESOBRUTPR", VRPESOLIQUPR AS "VRPESOLIQUPR", CDCTBLENTRPR AS "CDCTBLENTRPR", CDCTBLSAIDPR AS "CDCTBLSAIDPR", CDCTBLPRODPR AS "CDCTBLPRODPR", CDCTBLCPROPR AS "CDCTBLCPROPR", CDCTBLAJUSPR AS "CDCTBLAJUSPR", CDCTBLIMPLPR AS "CDCTBLIMPLPR", CDCTBLPRACPR AS "CDCTBLPRACPR", NRDIARESEPRO AS "NRDIARESEPRO", NRDIAEMPRPRO AS "NRDIAEMPRPRO", CDTPINDICE AS "CDTPINDICE", IDPERVALOR AS "IDPERVALOR", CDINDICE AS "CDINDICE", DSREFBIBPROD AS "DSREFBIBPROD", IDPRODATIVPR AS "IDPRODATIVPR", CDPRODNCM AS "CDPRODNCM", CDCIA AS "CDCIA", CDPADSERV AS "CDPADSERV", IDSERVESP AS "IDSERVESP", CDEXTSERV AS "CDEXTSERV", DSEXTSERV AS "DSEXTSERV", TXCOMENTSERV AS "TXCOMENTSERV", IDSERVICO AS "IDSERVICO", IDFATSERV AS "IDFATSERV", IDTPPRECO AS "IDTPPRECO", IDPRODCOMISS AS "IDPRODCOMISS", IDNACPRODUTO AS "IDNACPRODUTO", CDCLASSE AS "CDCLASSE", CDCICLO AS "CDCICLO", CDPRODFATURA AS "CDPRODFATURA", IDCOBTXSERV AS "IDCOBTXSERV", NMFOTOPROD AS "NMFOTOPROD", IDSOLLOCIMP AS "IDSOLLOCIMP", IDDIASVALIDA AS "IDDIASVALIDA", IDCTRVERSAO AS "IDCTRVERSAO", DSDIRBASEVER AS "DSDIRBASEVER", DSDIRVSS AS "DSDIRVSS", VRPEDIFEREXP AS "VRPEDIFEREXP", DSDIRHOMOL AS "DSDIRHOMOL", CDPROTECLADO AS "CDPROTECLADO", DSDIRARQHOMO AS "DSDIRARQHOMO", IDTIPOPROD AS "IDTIPOPROD", DSSUBGRUPROD AS "DSSUBGRUPROD", IDIMPRODUVEZ AS "IDIMPRODUVEZ", CDGRTOTAPROD AS "CDGRTOTAPROD", CDFORMORCA AS "CDFORMORCA", IDTIPOMARKUP AS "IDTIPOMARKUP", VRARREDEMPPR AS "VRARREDEMPPR", CDGENPROD AS "CDGENPROD", IDPRODBLOQ AS "IDPRODBLOQ", CDFILIPEDORC AS "CDFILIPEDORC", CDDEPTPEDORC AS "CDDEPTPEDORC", IDPRCMPATIVO AS "IDPRCMPATIVO", HRLIMPRODORE AS "HRLIMPRODORE", IDIMPPRODORE AS "IDIMPPRODORE", CDEQUIPERESP AS "CDEQUIPERESP", IDSEGMENTOPROD AS "IDSEGMENTOPROD", CDPRODNIVANTE AS "CDPRODNIVANTE", IDTIPOCOMPPROD AS "IDTIPOCOMPPROD", VRYELDRECEPROD AS "VRYELDRECEPROD", QTTEMPRECEPROD AS "QTTEMPRECEPROD", DTINIVGPROMOC AS "DTINIVGPROMOC", DTFINVGPROMOC AS "DTFINVGPROMOC", CDCLASSPROD AS "CDCLASSPROD", VRVOLUMEPROD AS "VRVOLUMEPROD", IDARREDTRUNC AS "IDARREDTRUNC", IDPRODPROPTERC AS "IDPRODPROPTERC", IDSITUPROD AS "IDSITUPROD", IDPRODCONTRSUBV AS "IDPRODCONTRSUBV", DSDIRPREHOMOPR AS "DSDIRPREHOMOPR", DSDIRSUBVHOMOPR AS "DSDIRSUBVHOMOPR", DSDIRBASEVERHOM AS "DSDIRBASEVERHOM", QTDIAVALPRODVND AS "QTDIAVALPRODVND", DSINFADIPRODVND AS "DSINFADIPRODVND", DSDADOSFORNVND AS "DSDADOSFORNVND", QTPORCAOVND AS "QTPORCAOVND", IDUNPORCAOVND AS "IDUNPORCAOVND", IDPADEMEDCASVND AS "IDPADEMEDCASVND", QTMEDCASVND AS "QTMEDCASVND", IDTIPOMEDCASVND AS "IDTIPOMEDCASVND", CDPRODREPLICSVN AS "CDPRODREPLICSVN", DSDIRHOMOLDES AS "DSDIRHOMOLDES", IDORIGPRODPR AS "IDORIGPRODPR", NRORG AS "NRORG", DTINCLUSAO AS "DTINCLUSAO", DTULTATU AS "DTULTATU", NRORGINCLUSAO AS "NRORGINCLUSAO", CDOPERINCLUSAO AS "CDOPERINCLUSAO", NRORGULTATU AS "NRORGULTATU", CDOPERULTATU AS "CDOPERULTATU", CDLIVROMAG AS "CDLIVROMAG", CDTPITEMPROD AS "CDTPITEMPROD", VRPEDESCPRODORC AS "VRPEDESCPRODORC", IDTIPORETIORE AS "IDTIPORETIORE", IDRETISEMESTORE AS "IDRETISEMESTORE", DTATUPRODSUBVER AS "DTATUPRODSUBVER", CDPRODMOVCPC AS "CDPRODMOVCPC", VRFATARREDQTORE AS "VRFATARREDQTORE", VRPEARRINFQTORE AS "VRPEARRINFQTORE", NMFANTPRODUTO AS "NMFANTPRODUTO", IDFATURAPRODORE AS "IDFATURAPRODORE", IDIMCOMPOSPRORE AS "IDIMCOMPOSPRORE", IDTIPOPRODOREV AS "IDTIPOPRODOREV", CDARVPAI AS "CDARVPAI", IDPRODUSOCONS AS "IDPRODUSOCONS", CDCSTDIG1PROD AS "CDCSTDIG1PROD", DSPROPNUTRI AS "DSPROPNUTRI", IDGERREVPROCFA AS "IDGERREVPROCFA", QTVOLUMES AS "QTVOLUMES", QTPROPVOLUME AS "QTPROPVOLUME", IDATIVO AS "IDATIVO", IDGERACOMISOREV AS "IDGERACOMISOREV", DTEXPPRODSAGA AS "DTEXPPRODSAGA", IDTEMNUTRIENTE AS "IDTEMNUTRIENTE", IDALTERANUTR AS "IDALTERANUTR", DTATUALNUTR AS "DTATUALNUTR", DSOBSNUTR AS "DSOBSNUTR", VRCAPEMBALAG AS "VRCAPEMBALAG", VRVALIDPROD AS "VRVALIDPROD", IDGERETIQPROD AS "IDGERETIQPROD", IDGERRELEASEMETA AS "IDGERRELEASEMETA", CDPORIMPPROD AS "CDPORIMPPROD", DTINATIVAPROD AS "DTINATIVAPROD", CDOPERINATPR AS "CDOPERINATPR", VRQTDEMB AS "VRQTDEMB", SGUNIDEMB AS "SGUNIDEMB", CDHISTPADR AS "CDHISTPADR", CDPRATOPROD AS "CDPRATOPROD", CDFILPRATOPROD AS "CDFILPRATOPROD", DTCUSTOREC AS "DTCUSTOREC", IDTPCUSTOREC AS "IDTPCUSTOREC", CDLEANCODE AS "CDLEANCODE", NMFANTPROD AS "NMFANTPROD", CDCEST AS "CDCEST", IDTEOROBRIG AS "IDTEOROBRIG", IDFATVENDADEVOL AS "IDFATVENDADEVOL", CDINFOEXTRA AS "CDINFOEXTRA", IDCONTROLAREFIL AS "IDCONTROLAREFIL", IDVDANALISE AS "IDVDANALISE", DSFORMULAVDANA AS "DSFORMULAVDANA", DSFORMULAVDRANA AS "DSFORMULAVDRANA", CDGGREM AS "CDGGREM", IDPRODCUSFIXO AS "IDPRODCUSFIXO", IDPRODPERIG AS "IDPRODPERIG", DSINFADICPROD AS "DSINFADICPROD", CDFORNPROD AS "CDFORNPROD", IDTPPRODDEBCONS AS "IDTPPRODDEBCONS", VRMINCONSUMODEB AS "VRMINCONSUMODEB", NRSERVICOCIAFILI AS "NRSERVICOCIAFILI", NRSERVICOGEN AS "NRSERVICOGEN", IDANALIZEATIV AS "IDANALIZEATIV", CDINTEGRASAP AS "CDINTEGRASAP", CDFICHAEMER AS "CDFICHAEMER", DSPRODVENDA AS "DSPRODVENDA", VRPESOMOL AS "VRPESOMOL", IDPRODDIMEVAR AS "IDPRODDIMEVAR", VRALTURAPROD AS "VRALTURAPROD", VRCOMPRIPROD AS "VRCOMPRIPROD", IDTPANEXOREGESP AS "IDTPANEXOREGESP", DSENDEIMG AS "DSENDEIMG", DSADICPROD AS "DSADICPROD", CDCBENEF AS "CDCBENEF", VRTARA AS "VRTARA", VRNUTRIPROD AS "VRNUTRIPROD", IDUTILRETPRODACAB AS "IDUTILRETPRODACAB", CDEXTIPI AS "CDEXTIPI", VRFATOCONVUNTRIB AS "VRFATOCONVUNTRIB", CDBARPRODUNTRIB AS "CDBARPRODUNTRIB", PROJECT_ID AS "PROJECT_ID", CDPRODCOMP AS "CDPRODCOMP", CDPRODGRUP AS "CDPRODGRUP", NMPRODVENDA AS "NMPRODVENDA", CDRATEIO AS "CDRATEIO", SGUNIDADETRIB AS "SGUNIDADETRIB", NRQTDMINOBS AS "NRQTDMINOBS", IDCTRLORIGEM AS "IDCTRLORIGEM", DSFORMULAMOL AS "DSFORMULAMOL", IDTIPOPESO AS "IDTIPOPESO", QTPESONOMINAL AS "QTPESONOMINAL", QTPESOMIN AS "QTPESOMIN", QTPESOMAX AS "QTPESOMAX", QTVOLPESAGEM AS "QTVOLPESAGEM", IDPERMOVPROD AS "IDPERMOVPROD", SYSTAX_DTEXPXML AS "SYSTAX_DTEXPXML", IDHABTAA AS "IDHABTAA", IDTAMANHO AS "IDTAMANHO", DSAPELIDOKDS AS "DSAPELIDOKDS", IDIMPQRCODECAT AS "IDIMPQRCODECAT", IDIMPDTEMBALAGEM AS "IDIMPDTEMBALAGEM", IDSALAOCOMPOEPRECO AS "IDSALAOCOMPOEPRECO", QTMAXOBSERV AS "QTMAXOBSERV", VRFRETEPROD AS "VRFRETEPROD", DTEXPXMLPROT AS "DTEXPXMLPROT"
                    FROM PRODUTO
                   WHERE NRORG = :NRORG
                     AND CDPRODUTO = :CDPRODUTO
SQL;

        $params = array( 'NRORG' => $orgId, 'CDPRODUTO' => $productCode );
        $result = Utilities::getEntityManager()->getConnection()->fetchAllAssociative($query, $params);
        return !empty($result) ? $result[0] : $result;
    }
}