Incio em 25/10/2023 15:56:40
iCount_GET=38, iCount_POST=0
psFileDDS=dd_files/erp_ORDENS_CanalWeb_Mobile_Itens.dda
sSearch=
jGetPost=0, psTipo=1, psFileDDS=dd_files/erp_ORDENS_CanalWeb_Mobile_Itens.dda, psTagDDS=Padrao_2, psAncestrais=1088804, psIrmasTias=1//2023-10-25 00:00:00/1/5/73797/0/0.00/1/0/0/0/0/0/0/0/0/0/1//0//0.00000/SENDAS DISTRIBUIDORA S/A, psLogin=133, psTDoc=
psMnemTDoc=, psRecsPage=25, psPage=0, psOOpLogin=, psRoot=1, sSearch=, psId=0, psCalendario=
psSlim=0, iDesenvolvedor=0, psCiaLogin=0, psMarcados=/, sInMarcados=0,0, psMarcadosPai=/, sInMarcadosPai=0,0, psVarTmp=, psCliPasta=desenvolvimento, piTimeLogin=1698260132616
sGlobal_pUNeg=, ioCaller_ChaveAtual=0, piSss=0, plMobile=1, plEchoJson=1, plEchoUtf8=1
psVerQTUX=, psPesquisarFull=, psFiltrosSet=, ppChaveSalva_1=0
sVarsTxt=$jHisDB = '0';
$iPagAtrasado = '0';
$jIdioma = '0';
$sMnemProp = 'Desenvolvimento';
$jClassUser = '1';
$sProprietario = 'DESENVOLVIMENTO QTUX - Banco TQ';
$sPathDB = '/qtux/database/tq';
$sHost = '127.0.0.1';
$sPathFileSys = '/qtux/database/desenvolvimento/db_file_sys';
$sDB = 'gps_01.gdb';
$sPathAnexos = 'anexos/gps_producao';
$sSairHtml = 'index.php';
$sSubDomain = '/desenvolvimento';
$sLocalServer = '<b>Qtux ERP/GPS - LOCAWEB/SP</b>';
$sIniMailHeader = 'From: gps_master@qtux.com.br';
$sIniMailAdvisor = 'Governance Advisor';
$sPathDBCentral = '/qtux/database/gps_producao/gps_01.gdb';
$sLTokenProd = 'iH1EjVbAieeMNi5rnyCm9q2mSELvD59pJyJDlm61aB';
$sLTokenHomo = 'hL2CAZ3v1bF0Pc7yvTeiFFZcO6BUMJNPe2Fx7Dd39d';
$sIFCUser = 'ifc-TotalQui';
$sIFCPass = 'wYpJ1pd934Fk';
$sConsIFCUser = 'totalquimica';
$sConsIFCPass = 'tQfF2hr504RgC';
$sTokenRecWS = 'c8fceed6762b7df02fc065afe340018f8de2038a7daaa28bc402b728407f52e4';
$iDiasRecWS = '20';
$sNFeCustom = 'Desenvolvimento';
$iTimeSleep = '10';
$iTimeOutSin = '3*60';
$sCanalACBR = 'Desenvolvimento';
$sPathQtux = '/qtux/samba/NFe/sinais/<sPathCia>/';
$sPathACBR = 'F:\qtux\samba\NFe\sinais\<sPathCia>\\';
$sPathEnv = '/qtux/samba/NFe/sinais/NFeEnviadas/<sPathCia>/';
$sPathEnvDesc = '/qtux/samba/NFe/sinais/<sPathCia>/Descarte/';
$sPathCanDesc = '/qtux/samba/NFe/sinais/<sPathCia>/Cancelamento/Descarte/';
$sPathCce = '/qtux/samba/NFe/sinais/<sPathCia>/Cce/';
$sPathACBREnv = 'F:\qtux\samba\NFe\sinais\NFeEnviadas\<sPathCia>\\';
$sImpressoraDanfe = '';
$lNFeAgruparLotes = '1';
$sPathERP = '/qtux/samba/NFe/sinais/QryAEnviar/';
$sPathERPEnv = '/qtux/samba/NFe/sinais/QryEnviadas/';
$sPathERPFalhou = '/qtux/samba/NFe/sinais/QryProblemas/';
$sFileLockGerarXML_Enviar = '/qtux/samba/NFe/sinais/<sPathCia>/GerarXML_Enviar.lock';
$sFileLockRecepcaoACBR = '/qtux/samba/NFe/sinais/<sPathCia>/RecepcaoACBR.lock';
$sFileLockSolicitaACBR = '/qtux/samba/NFe/sinais/<sPathCia>/SolicitaACBR.lock';
$sFileLockQryFromERP = '/qtux/samba/NFe/sinais/<sPathCia>/QryFromERP.lock';
$sPathEDICxEnt = '/qtux/samba/edi/<sCanalEDI>/cx_entrada/';
$sPathEDICxProc = '/qtux/samba/edi/<sCanalEDI>/cx_processadas/';
$sPathEDICxSai = '/qtux/samba/edi/<sCanalEDI>/cx_saida/';
$sPathEDICxProb = '/qtux/samba/edi/<sCanalEDI>/cx_problemas/';
$sPathReports1 = '/qtux/samba/reports/';
$sPathReports2 = '/qtux/samba/reports/AImprimir/';
$sImagemInd = 'logo_ind_desenvolvimento.png';
$sImagemRel = 'logo_rel_desenvolvimento.png';
$ghBase = '0';

psDSN=127.0.0.1:/qtux/database/tq/gps_01.gdb
GET['sQry']=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
psQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
psQrySum=
psQrySum2=
psVars=
psEscId=
psEscIdIrma1=
iDeepGrid=1
psFileDDS=dd_files/erp_ORDENS_CanalWeb_Mobile_Itens.dda
sTxt 1
sTxt=<Padrao_1>   
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1
   sTagCpo          = Cpo1
   sTagSql          = Sql1
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Ordens_Itens
   sTagMenu         = Menu1
   sTagNr0          = Nr03
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Pesquisar
   sTagPesquisar    = Pesquisar1
   sTagDbToVars     = DbToVars1       
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1    
   sTagVarsToServer = VarsToServer1  
   sTagVarsToDb     = VarsToDb1      
   sTagServerVal    = ServerValids1  
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
   sTagPodeReincluir = PodeReincluir1
   sTagOnSave       = flOnSave(56,{ChaveAtual_1})
   sTagSubGrid      = 1,2,3
</Padrao_1>
<Padrao_1a>   
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1a
   sTagCpo          = Cpo1a
   sTagSql          = Sql1
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Ordens_Itens
   sTagMenu         = Menu1
   sTagNr0          = Nr02a
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Incluir   
   sTagPesquisar    = Pesquisar1
   sTagRecsPage     = 100000
   sTagDbToVars     = DbToVars1       
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1    
   sTagVarsToServer = VarsToServer1  
   sTagVarsToDb     = VarsToDb1      
   sTagServerVal    = ServerValids1  
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
   sTagPodeReincluir = PodeReincluir1
   sTagOnSave       = flOnSave(56,{ChaveAtual_1})
   sTagSubGrid      = 1,2,3
</Padrao_1a>
<Padrao_2>   
   sTagTit          = Tit2
   sTagCpoTit       = CpoTit2
   sTagCpo          = Cpo2
   sTagSql          = Sql2
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Itens
   sTagMenu         = Menu2
   sTagNr0          = Nr03
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Pesquisar
   sTagToolsBar     = Incluir,Pesquisar
   sTagPesquisar    = Pesquisar2
   sTagDbToVars     = DbToVars2
   sTagVarsDef      = VarsDefault2
   sTagScript       = ScriptForm2    
   sTagVarsToServer = VarsToServer2  
   sTagVarsToDb     = VarsToDb2      
   sTagServerVal    = ServerValids2  
   sTagTitulo       = TelaTit2
   sLabelsAlign     = Left
</Padrao_2>
<Tit1>Itens do Pedido [{this.oPai.aGrid[this.oPai.iArray][this.oPai.iCol]}]</Tit1>
<Tit2>Itens a Venda</Tit2>
<CpoTit1>
   Item-s-60            ; b.sCodigo
   Qt Ped-n-12-2        ; a.nQt,a.iSerial
   $Bruto-n-12-2
   Pru1-n-12-2
   Pru2-n-12-2
   Pru3-n-12-2
   DescI[UN]-n-12-2
   Total-n-12-2        ; a.nProd_vProd,a.iSerial
   Qt Fat-n-12-2            ; a.nQtFat,a.iSerial
   -s-20
</CpoTit1>
<CpoTit1a>
   Codigo-s-20        
   Item-s-60           ; b.sCodigo
   Qt.Ped-n-12-0       ; a.nQt,a.iSerial
   Pr.Bruto-n-12-2
   DescI.Uni[%]-n-12-2
   DescI.Uni[$]-n-12-2
   Pr. Comer-n-12-2
   Total-n-12-2        ; a.nProd_vProd,a.iSerial
   nPDescTpEDG-12-2
   nPEncFinTpED-12-2
   sCodUni-10
</CpoTit1a>
<Cpo1>
   $aLin["SCODITEM"].' - '. $aLin["SITEM"]
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin["NQTFAT"],2,",",".")
   '<span onclick="this.flClickLin({piLinha});this.flGridAlt();" style="background-color: #c0c0c0; color: inherit_ cursor: pointer_ text-decoration: underline_"><i>alterar</i></span>'
   $aLin["PPID"]
</Cpo1>
<Cpo1a>   
   $aLin["SCODITEM"]   
   $aLin["SITEM"]      
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NPDESCINC"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VUNCOM"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin[strtoupper("nPDescTpEDG")],2,",",".")
   number_format($aLin[strtoupper("nPEncFinTpED")],2,",",".")
   $aLin[strtoupper("sCodUni")]
   $aLin["PPID"]
</Cpo1a>
<Sql1>
   select a.iSerial,
          a.iInLineSerial,
          a.jTipo,
          a.pPId,
          a.nQt,
          a.nQtFat,
          a.nQtEnt,
          a.nQtOP,
          a.nProd_vUnCom,
          a.nProd_vProd,
          a.jProd_indTot,
          a.jOrig,
          a.nPrBruto,
          a.nPrBruto1,
          a.nPrBruto2,
          a.nPrBruto3,
          b.sCodigo     sCodItem,
          b.sDescricao  sItem,
          c.sCodigo    sCodUni,
          c.sUnidade   sDesUni,
          c.jDec,
          a.nProd_vFrete,
          a.nProd_vSeg,
          a.nProd_vOutro,
          a.pMoe,
          k.sDescricao      sMoe,
          a.fMoe,
          a.nQtMoe,
          a.jCam,
          a.pCam,
          a.fCam,
          kk1.sDescricao  sMoeCambio,
          a.nCam,
          a.sCam,
          a.nVDescTpED,
          a.nVDescTpEDG,
          a.nVEncFinTpED,
          a.nPDescInc,
          a.nVDescInc,
          d.jTipo jEntSai,
          e.sCodigo       sDesTab,
          e.sDescricao    sCodTab,
          a.nPDescTpEDG,
          a.nPEncFinTpED
   from Ordens_Itens  a
                                join Ordens          d on a.pOrdem  = d.pPId                                              and d.iVer  = d.iVAt
                                join UnidadeMedida   c on a.pUni    = c.pPId                                              and c.iVer  = c.iVAt
                                join Itens           b on a.pItem   = b.pPId                                              and b.iVer  = a.fItem
                           left join TabPrecos       e on a.pTab    = e.pPId                                              and e.iVer  = e.iVAt
                           left join PerfilPed       g on d.pEmi    = g.pEmi and d.pRepCom = g.pRep                       and g.iVer  = g.iVAt
                           left join PerfilPed_Itens f on f.pPerfP  = g.pPId and a.pItem   = f.pItem                      and f.iVer  = f.iVAt
                           left join Moeda         k   on a.pMoe    = k.pPId   and k.iVer   = k.iVAt
                           left join Cambio        kk  on a.pCam    = kk.pPId  and kk.iVer  = kk.iVAt
                           left join Moeda         kk1 on kk.pMoe2  = kk1.pPId and kk1.iVer = kk1.iVAt
   where a.lExc    = 0
     and a.iVer    = a.iVAt
     and a.pOrdem  = {ChaveAtual_1}
   order by b.sCodigo   
</Sql1>
<SqlSum1>
   select 'Totais',cast(sum(a.nQt)as numeric(15,2)),'','',cast(sum(a.nProd_vProd) as numeric(15,2)),'','' from Ordens_Itens a where a.iVer = a.iVAt and a.pOrdem = {ChaveAtual_1} and a.lExc = 0
</SqlSum1>
<CpoTit2>
   Codigo-s-20
   Item-s-100
   Qtd-n-12-2
   Pr.Unit-n-12-2
   PDesconto-n-12-2
   VDesconto-n-12-2
   Pr.Unit.Com-n-12-2
   Total Item-n-12-2
   nPDescTpEDG-n-12-2
   nPEncFinTpED-n-12-2
   sCodUni-s-10
</CpoTit2>
<Cpo2>   
   $aLin["SCODITEM"]
   $aLin["SITEM"]
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NPDESCINC"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VUNCOM"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin[strtoupper("nDesc")],2,",",".")
   number_format($aLin[strtoupper("nPEncFinTpED")],2,",",".")
   $aLin[strtoupper("sCodUni")]
   $aLin["PPID"]
</Cpo2>
<Sql2>
   select b.pPId,
          b.sCodigo    sCodItem,
          b.sDescricao sItem,
          a.nDesc,                
          a.nPEncFinTpED,
          coalesce(k.nQt,0)               nQt,
          coalesce(k.nPrBruto,0)          nPrBruto,
          coalesce(k.nPDescInc,0)         nPDescInc,
          coalesce(k.nVDescInc,0)         nVDescInc,
          coalesce(k.nProd_vUnCom,0)      nProd_vUnCom,
          coalesce(k.nProd_vProd,0)       nProd_vProd,
          coalesce(g.sCodigo,'')          sCodUni
   from PTOpED_Item a 
                           join PTOpED          c on a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = 36669 and c.lExc=0
                           join Itens           b on a.pItem   = b.pPId and b.iVer=b.iVAt
                      left join NCM             e on b.pNCM    = e.pPId and e.iVer=e.iVAt
                      left join UnidadeMedida   g on a.pUni    = g.pPId and g.iVer=g.iVAt
                      left join Moeda           j on a.pMoe    = j.pPId and j.iVer=j.iVAt
                      left join Ordens_Itens    k on k.pOrdem  = {ChaveAtual_1}   and k.iVer=k.iVAt and k.pItem=a.pItem
   where a.lExc=0 and a.iVer=a.iVAt {sSearch}
   union all
   select b.pPId,
          b.sCodigo    sCodItem,
          b.sDescricao sItem,
          a.nDesc,
          a.nPEncFinTpED,
          coalesce(k.nQt,0)               nQt,
          coalesce(k.nPrBruto,0)          nPrBruto,
          coalesce(k.nPDescInc,0)         nPDescInc,
          coalesce(k.nVDescInc,0)         nVDescInc,
          coalesce(k.nProd_vUnCom,0)      nProd_vUnCom,
          coalesce(k.nProd_vProd,0)       nProd_vProd,
          coalesce(g.sCodigo,'')          sCodUni
   from PTOpED_Item a 
                           join PTOpED          c on a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = {ChaveIrma_1_5} and c.lExc=0
                      left join Itens           b on a.pItem   = b.pPId and b.iVer=b.iVAt
                      left join NCM             e on b.pNCM    = e.pPId and e.iVer=e.iVAt
                      left join UnidadeMedida   g on a.pUni    = g.pPId and g.iVer=g.iVAt
                      left join Moeda           j on a.pMoe    = j.pPId and j.iVer=j.iVAt
                      left join Ordens_Itens    k on k.pOrdem  = {ChaveAtual_1}   and k.iVer=k.iVAt and k.pItem=a.pItem
   where a.lExc=0 and a.iVer=a.iVAt {sSearch}
     and b.pPId not in (select a.pItem from PTOpED_Item a, PTOpED c where a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = 36669 and c.lExc=0)
   order by 2
</Sql2>
<Pesquisar1>
   ((upper(a.iSerial) like '%{p0}%') or (upper(b.sCodigo) like '%{p0}%') or (upper(b.sDescricao) like '%{p0}%'))
</Pesquisar1>
<Pesquisar2>
   ((upper(b.sCodigo) like '%{p0}%') or (upper(b.sDescricao) like '%{p0}%'))
</Pesquisar2>
<Menu1>
</Menu1>
<Nr01>alert("Qtux-Dialog\n\nNada a relacionar ...")</Nr01>
<Nr02>oGrid.flGridInc()</Nr02>
<Nr02a>flGrid123()</Nr02a>
<TipoNr01>0</TipoNr01>
<TipoNr02>1</TipoNr02>
<TipoNr03>2</TipoNr03>
<TelaTit1>
   Ficha da Linha da Ordem 
</TelaTit1>
<DbToVars1> 
   select a.tInc,
          a.iVer,
          a.iVAt,
          a.pPId,
          a.iSerial,
          a.nQt,
          a.nQtRes,
          a.nQtEnt,
          a.nQtLib,
          a.nQtFat,
          (a.nQt-a.nQtEnt) nQtPend,
          a.lBaixa,
          a.pRegFis,
          a.fRegFis,
          a.pNeg,
          a.fNeg,
          a.pTab,
          r.sCodigo     sCodTab,
          r.sDescricao  sDesTab,
          a.fTab,
          a.pTabI,
          a.fTabI,
          a.nProd_vUnCom,
          a.nProd_vProd,
          a.nProd_vFrete,
          a.nVMLE,
          a.nProd_vSeg,
          a.nProd_vDesc,
          a.nProd_vOutro,
          a.jProd_indTot,
          a.sDI_nDI,               
          a.dDI_dDI,                
          a.sDI_xLocDesemb,        
          a.sDI_UFDesemb,           
          a.dDI_dDesemb,             
          a.sDI_cExportador,
          a.iAdi_nAdicao,          
          a.iAdi_nSeqAdic,         
          a.sAdi_cFabricante,      
          a.nAdi_vDescDI,          
          a.sAdi_xPed,             
          a.iAdi_nItemPed,
          a.nCIDE_qBCprod, 
          a.nCIDE_vAliqProd,
          a.nCIDE_vCIDE,
          a.jICMS_GrupoTrib,
          a.jICMS_orig,
          a.jICMS_modBC,
          a.nICMS_vBC,
          a.nICMS_pICMS,
          a.nICMS_vICMS,
          a.jICMS_modBCST,
          a.nICMS_pMVAST,
          a.nICMS_pRedBCST,
          a.nICMS_vBCST,
          a.nICMS_pICMSST,
          a.nICMS_vICMSST,
          a.nICMS_pRedBC,
          a.jICMS_motDesICMS,
          a.nICMS_vBCSTRet,
          a.nICMS_vICMSSTRet,
          a.jICMSPart_orig,
          a.jICMSPart_CST,
          a.jICMSPart_modBC,
          a.nICMSPart_vBC,
          a.nICMSPart_pRedBC,
          a.nICMSPart_pICMS,
          a.nICMSPart_vICMS,
          a.jICMSPart_modBCST,
          a.nICMSPart_pMVAST,
          a.nICMSPart_pRedBCT,
          a.nICMSPart_vBCST,
          a.nICMSPart_pICMSST,
          a.nICMSPart_vICMSST,
          a.nICMSPart_pBCOp,
          a.sICMSPart_UFST,
          a.jICMSST_orig,
          a.jICMSST_CST,
          a.nICMSST_vBCSTRet,
          a.nICMSST_vICMSSTRe,
          a.nICMSST_vBCSTDest,
          a.nICMSST_vICMSSTDes,
          a.jGrupo_simples,    
          a.jICMSSN_Orig,
          a.jICMSSN_CSOSN,
          a.nICMSSN_pCredSN,
          a.nICMSSN_vCredICMSSN,
          a.jICMSSN_modBCST,
          a.nICMSSN_pMVAST,
          a.nICMSSN_pRedBCST,
          a.nICMSSN_vBCST,
          a.nICMSSN_pICMSST,
          a.nICMSSN_vICMSST,
          a.nICMSSN_vBCSTRet,
          a.nICMSSN_vICMSSTRet,
          a.jICMSSN_modBC,
          a.nICMSSN_vBC,
          a.nICMSSN_pRedBC,
          a.nICMSSN_pICMS,
          a.nICMSSN_vICMS,
          a.sIPI_clEnq,
          a.sIPI_CNPJProd,
          a.sIPI_cSelo,
          a.nIPI_qSelo,
          a.sIPI_cEnq,
          a.jIPINT_CST,
          a.nIPITrib_vBC,
          a.nIPITrib_pIPI,
          a.nIPITrib_qUnid,
          a.nIPITrib_vUnid,
          a.nIPITrib_vIPI,
          a.nII_vBC,
          a.nII_vDespAdu,
          a.nII_vII,
          a.nII_vIOF,
          a.jPIS_CST,  
          a.nPIS_vBC,
          a.nPIS_pPIS,
          a.nPIS_vPIS,
          a.nPIS_qBCProd, 
          a.nPIS_vAliqProd, 
          a.nPISST_vBC,
          a.nPISST_pPIS,
          a.nPISST_qBCProd,
          a.nPISST_vAliqProd,
          a.nPISST_vPIS,
          a.jCOFINS_CST,
          a.nCOFINS_vBC,
          a.nCOFINS_pCOFINS,
          a.nCOFINS_vCOFINS,
          a.nCOFINS_qBCProd,
          a.nCOFINS_vAliqProd,
          a.nCOFINSST_vBC,
          a.nCOFINSST_pCOFINS,
          a.nCOFINSST_qBCProd,
          a.nCOFINSST_vAliqProd,
          a.nCOFINSST_vCOFINS,
          a.nISSQN_vBC,
          a.nISSQN_vAliq,
          a.nISSQN_vISSQN,
          a.nISSQN_cMunFG,
          a.nISSQN_cListServ,
          a.jISSQN_cSitTrib,
          a.sInfAdProd,
          a.jTipo,
          a.tEntPla, 
          a.tEmissao,
          a.tSaida,
          a.pItem,
          a.fItem,
          c.sCodigo     sRegCodItem,
          c.sDescricao  sRegDesItem,
          c.sCodigo     sNegCodItem,
          c.sDescricao  sNegDesItem,
          c.sCodigo     sTabCodItem,
          c.sDescricao  sTabDesItem,
          c.sCEST,
          c.fFoto,
          c.sFoto,
          a.pUni,
          a.fUni,
          e.sCodigo      sCodUni,
          e.sUnidade    sUni,
          a.pNCM,   
          a.fNCM,
          g.sCodigo     sCodNCM,
          g.sDescricao  sDesNCM,
          a.pCFO,   
          a.fCFO,
          h.sCodigo     sCodCFO,
          h.sAbrev,
          a.pLote,
          a.fLote,
          a.jFDiasEnt,
          a.iDiasInf,
          a.iDiasCalc,
          a.lInspecao,
          a.nDesc,
          a.pIPIRegFis,
          a.pICMSRegFis,        
          a.pICMSSNRegFis,        
          a.pICMSPartRegFis,        
          a.pICMSSTRetRegFis,
          a.pISSQNRegFis,       
          a.pIRPJRegFis,        
          a.pCofinsRegFis,      
          a.pPISRegFis,         
          a.pCofinsSTRegFis,    
          a.pPISSTRegFis,       
          a.pIIRegFis,
          a.fIIRegFis,
          a.fIPIRegFis,         
          a.fICMSRegFis,        
          a.fICMSSNRegFis,        
          a.fICMSPartRegFis,        
          a.fICMSSTRetRegFis,
          a.fISSQNRegFis,       
          a.fIRPJRegFis,        
          a.fCofinsRegFis,      
          a.fPISRegFis,         
          a.fCofinsSTRegFis,    
          a.fPISSTRegFis,       
          a.pPTOpEDItem,
          a.fPTOpEDItem,
          a.pPTOpEDGrpItem,
          a.fPTOpEDGrpItem,
          a.nPrBruto,
          a.nPrBruto1,
          a.nPrBruto2,
          a.nPrBruto3,
          a.nPrUV1,
          a.nPrUV2,
          a.nPrUV2,
          a.nQtUV1,
          a.nQtUV2,
          a.nQtUV3,
          a.nPDescCP,     
          a.nVDescCP,     
          a.nPDescTpED,   
          a.nVDescTpED,   
          a.nVEncFinTpED,   
          a.nPDescTpEDG,  
          a.nVDescTpEDG,  
          a.nPDescInc,    
          a.nVDescInc,    
          a.nProd_pDesc,  
          a.pMoe,    
          k.sDescricao      sMoe,
          a.fMoe,    
          a.nQtMoe,  
          a.jCam,
          a.pCam,
          a.fCam,    
          kk1.sDescricao  sMoeCambio,
          a.nCam,    
          a.sCam,    
          a.lCCusto,
          a.lCrtlItem,
          a.jOrig,
          a.jBC_II,
          a.jBC_IPI,
          a.jBC_ICMS,
          a.jBC_ICMSST,
          a.jBC_PIS,
          a.jBC_COFINS,
          a.jBC_ISS,
          a.jVl_ICMSST,
          a.jVl_ICMS,
          a.nBC_II,
          a.nBC_IPI,
          a.nBC_ICMS,
          a.nBC_ICMSST,
          a.nBC_PIS,
          a.nBC_COFINS,
          a.nBC_ISS,
          a.nVl_ICMSST,
          a.nVl_ICMS,
          a.nPEncFinTpED,
          a.nQtMin,     
          a.nQtMax,      
          a.nPrecoMin,  
          a.nPrecoMax,   
          a.lContQua,    
          a.lContPreco,  
          a.iCiclo,      
          a.iCicloAtual, 
          a.jTempo,      
          a.lSkipLote,
          a.pRegDepVen,
          a.fRegDepVen,
          b1.pDep,
          bb.pUFis,
          e1.sUFis      sUn1,
          f1.sUFis      sUn2,
          g1.sUFis      sUn3,
          h1.sUFis      sUn4,
          i1.sUFis      sUn5,
          j1.sUFis      sUn6,
          k1.sUFis      sUn7,
          l1.sDescricao sIns,
          c1.sCodigo    sUnidade,
          a.pRegDepRFis,
          a.fRegDepRFis,
          b2.pDep       pDepRFis,
          bbb.pUFis      pUFisRFis,
          e2.sUFis      sUn1RFis,
          f2.sUFis      sUn2RFis,
          g2.sUFis      sUn3RFis,
          h2.sUFis      sUn4RFis,
          i2.sUFis      sUn5RFis,
          j2.sUFis      sUn6RFis,
          k2.sUFis      sUn7RFis,
          l2.sDescricao sInsRFis,
          c2.sCodigo    sUnidadeRFis,
          a.lImport,
          a.lImposImpor,
          a.lAdicoes,
          a.lCIDE,   
          a.lICMS_ST,    
          a.lICMS_P,   
          a.lICMS_RR,   
          a.lICMS_SN,
          a.lIPI,       
          a.lPIS,    
          a.lPIS_ST,    
          a.lCofins, 
          a.lCofins_ST,
          a.lISSQN,
          a.lTranspFiscal,
          a.sFCI,
          a.jFinalidade,
          a.nAliqTranspImport,
          a.nAliqTranspNac,
          a.nTot_vTrib,
          a.jDI_tpViaTransp,
          a.nDI_vAFRMM,
          a.jDI_tpIntermedio,
          a.sDI_CNPJ,
          a.sDI_UFTerceiro,
          a.nImp_vTotTrib,
          a.nICMS_vICMSDeson,
          a.nICMS_vICMSOp,
          a.nICMS_pDif,
          a.nICMS_vICMSDif,
          a.nISSQN_vDeducao,
          a.nISSQN_vOutro,
          a.nISSQN_vDescIncond,
          a.nISSQN_vDescCond,
          a.nISSQN_vISSRet,
          a.jISSQN_indISS,
          a.sISSQN_cServico,
          a.sISSQN_nProcesso,
          a.lISSQN_indIncentivo,
          a.pISSQN_cServico,
          m.sCodigo       sISSQN_cServico,
          m.sDescricao    sISSQN_sServico,
          a.fISSQN_cServico,
          a.pISSQN_cMun,
          j.sCidade   sISSQN_sMun,
          j.iIBGE     sISSQN_cMun,
          a.pISSQN_cPais,
          l.sDescricao  sISSQN_sPais,
          l.sCodigo     sISSQN_cPais,
          a.fISSQN_cMun,
          a.fISSQN_cPais,
          a.nVBCUFDest,
          a.nPFCPUFDest,
          a.nPICMSUFDest,
          a.nPICMSInter,
          a.nPICMSInterPart,
          a.nVFCPUFDest,
          a.nVICMSUFDest,
          a.nVICMSUFRemet,
          a.pTabGrpP,
          a.fTabGrpP,
          a.pTabGrpPI,
          a.fTabGrpPI,
          a.iInLineSerial,
          a.nVDescLog,
          z.sCoringa
   from   Ordens_Itens   a left join Ordens        i   on a.pOrdem           = i.pPId and i.iVer = i.iVAt
                           left join Itens         c   on a.pItem            = c.pPId and c.iVer = c.iVAt 
                           left join UnidadeMedida e   on a.pUni             = e.pPId and ((i.tConf is null and e.iVer = e.iVAt) or (i.tConf is not null and e.iVer=a.fUni)) 
                           left join NCM           g   on a.pNCM             = g.pPId and ((i.tConf is null and g.iVer = g.iVAt) or (i.tConf is not null and g.iVer=a.fNCM))
                           left join CFO           h   on a.pCFO             = h.pPId and ((i.tConf is null and h.iVer = h.iVAt) or (i.tConf is not null and h.iVer=a.fCFO))
                           left join Moeda         k   on a.pMoe             = k.pPId and ((i.tConf is null and k.iVer = k.iVAt) or (i.tConf is not null and k.iVer=a.fMoe))
                           left join Cidades       j   on a.pISSQN_cMun      = j.pPId and ((i.tConf is null and j.iVer = j.iVAt) or (i.tConf is not null and j.iVer=a.fISSQN_cMun))
                           left join Paises        l   on a.pISSQN_cPais     = l.pPId and ((i.tConf is null and l.iVer = l.iVAt) or (i.tConf is not null and l.iVer=a.fISSQN_cPais))
                           left join TipoServico   m   on a.pISSQN_cServico  = m.pPId and ((i.tConf is null and m.iVer = m.iVAt) or (i.tConf is not null and m.iVer=a.fISSQN_cServico))
                           left join TabPrecos     r   on a.pTab             = r.pPId and ((i.tConf is null and r.iVer = r.iVAt) or (i.tConf is not null and r.iVer=a.fTab))
                           left join Cambio        kk  on a.pCam    = kk.pPId  and ((i.tConf is null and kk.iVer = kk.iVAt) or (i.tConf is not null and kk.iVer=a.fCam))
                           left join Moeda         kk1 on kk.pMoe2  = kk1.pPId and ((i.tConf is null and kk1.iVer = kk1.iVAt) or (i.tConf is not null and kk1.iVer=a.fCam))
                           left join EST_RegDepositos   b1 on a.pRegDepVen     = b1.pPId    and ((i.tConf is null and b1.iVer = b1.iVAt) or (i.tConf is not null and  b1.iVer = a.fRegDepVen))
                           left join EST_Depositos      bb on b1.pDep          = bb.pPId    and bb.iVer = bb.iVAt
                           left join UFis               e1 on bb.pUFis         = e1.pPId    and e1.iVer = e1.iVAt
                           left join UFis               f1 on e1.pParent       = f1.pPId    and f1.iVer = f1.iVAt
                           left join UFis               g1 on f1.pParent       = g1.pPId    and g1.iVer = g1.iVAt
                           left join UFis               h1 on g1.pParent       = h1.pPId    and h1.iVer = h1.iVAt
                           left join UFis               i1 on h1.pParent       = i1.pPId    and i1.iVer = i1.iVAt
                           left join UFis               j1 on i1.pParent       = j1.pPId    and j1.iVer = j1.iVAt
                           left join UFis               k1 on j1.pParent       = k1.pPId    and k1.iVer = k1.iVAt
                           left join EST_Instancias     l1 on b1.pIns          = l1.pPId    and l1.iVer = l1.iVAt
                           left join UnidadeMedida      c1 on b1.pUni          = c1.pPId    and c1.iVer = c1.iVAt
                           left join EST_RegDepositos   b2  on a.pRegDepRFis    = b2.pPId    
                           left join EST_Depositos      bbb on b2.pDep          = bbb.pPId   and bbb.iVer = bbb.iVAt
                           left join UFis               e2  on bbb.pUFis        = e2.pPId    and e2.iVer = e2.iVAt
                           left join UFis               f2  on e2.pParent       = f2.pPId    and f2.iVer = f2.iVAt
                           left join UFis               g2  on f2.pParent       = g2.pPId    and g2.iVer = g2.iVAt
                           left join UFis               h2  on g2.pParent       = h2.pPId    and h2.iVer = h2.iVAt
                           left join UFis               i2  on h2.pParent       = i2.pPId    and i2.iVer = i2.iVAt
                           left join UFis               j2  on i2.pParent       = j2.pPId    and j2.iVer = j2.iVAt
                           left join UFis               k2  on j2.pParent       = k2.pPId    and k2.iVer = k2.iVAt
                           left join EST_Instancias     l2  on b2.pIns          = l2.pPId    and l2.iVer = l2.iVAt
                           left join UnidadeMedida      c2  on b2.pUni          = c2.pPId    and c2.iVer = c2.iVAt,
          CUP            z
   where a.pPId = {pId}
     and a.iVer = {a.iVer}
     and a.pInc = z.pPId and z.iVer = z.iVAt
</DbToVars1>
<1>
   select a.pPId       pOrdens_Item_CCusto_i,
          b.pPId       pCCusto_i,
          a.fCCusto    fCCusto_i,
          b.sCCUsto    sCCusto_i,
          a.nRatCCusto nRatCCusto_i
   from Ordens_Item_CCusto a,
        CCusto             b
   where a.iVer       = a.iVAt
     and a.lExc       = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.pCCusto    = b.pPId
     and b.iVer       = b.iVAt
  order by b.sCCUsto
</1>
<2>
   select a.pPId           pOrdens_Item_CContCred_i,
          e.pPId           pCContCred_i,
          a.fCPla          fCContCred_i,
          e.sCodigo        sCodCredPla_i,
          e.sDescricao     sDesCredPla_i,
          a.nRatCredCCont  nRatCredCCont_i
   from Ordens_Item_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = e.iVAt
   where a.iVer  = a.iVAt
     and a.lExc  = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.lDeb  = 0
   order by e.sCodigo,e.sDescricao
</2>
<3>
   select a.pPId          pOrdens_Item_CContDeb_i,
          e.pPId          pCContDeb_i,
          a.fCPla         fCContDeb_i,
          e.sCodigo       sCodDebPla_i,
          e.sDescricao    sDesDebPla_i,
          a.nRatDebCCont  nRatDebCCont_i
   from Ordens_Item_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = e.iVAt
   where a.iVer       = a.iVAt
     and a.lExc       = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.lDeb  = 1
   order by e.sCodigo,e.sDescricao
</3>
<VarsDefault1>
   sVerVAt = {pPId+'-'+iVer+'/'+iVAt}
   sRastro = {sVerVAt+', '+sCoringa+', '+tInc}
   lRastro = 0
   pOrdem      = {ChaveAtual_1}
   pTOper      = {ChaveIrma_1_0}
   sMoeCapa    = {ChaveIrma_1_1}
   dEntPla     = {ChaveIrma_1_2}
   jEntSai     = {ChaveIrma_1_3}
   pEmi        = {ChaveIrma_1_4}
   pDest       = {ChaveIrma_1_5}
   pDestDefault = 36669 
   nDescFin    = {ChaveIrma_1_6} 
   nDFin       = {ChaveIrma_1_7}
   pCapaMoe    = {ChaveIrma_1_8} 
   jBC_PIS     = {ChaveIrma_1_9};
   jBC_COFINS  = {ChaveIrma_1_10};
   jBC_ICMS    = {ChaveIrma_1_11};
   jBC_IPI     = {ChaveIrma_1_12};
   jBC_ICMSST  = {ChaveIrma_1_13};
   jBC_II      = {ChaveIrma_1_14};
   jBC_ISS     = {ChaveIrma_1_15};
   jVl_ICMSST  = {ChaveIrma_1_16};
   jVl_ICMS    = {ChaveIrma_1_17};
   lFinanc     = {ChaveIrma_1_18}
   nPDescLog   = {ChaveIrma_1_22} 
   sDest       = {ChaveIrma_1_23}
   aEntSai = yEntrada (Compra),Sada (Venda),Entrada/Sada,Transferncia
   mInfAdProd = {sInfAdProd}
   aPriori = Muito Baixa,Baixa,Normal,Alta,Muito Alta
   aTipo   = Manual,Negociao,Tabela de Preo,Cotao,Web Net
   aProd_indTot      = 0-Valor item no compe valor total , 1-Valor item compe valor total
   aICMS_GrupoTrib   = 00-Tributada integralmente, 10-Tributada com cobrana ICMS substituio tributria ,20-Com reduo de base de clculo , 30-Isenta/no tributada com cobrana ICMS substituio tributria ,40-Isenta ,41-No Tributada, 50-Suspenso , 51-Diferimento , 60-ICMS cobrado anteriormente por substituio tributria , 70-Com reduo base clculo e cobrana do ICMS substituio tributria , 90-Outros
   aICMS_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMS_modBC       = 0-Margem Valor Agregado(%), 1-Pauta(Valor), 2-Preo Tabelado Mx(Valor), 3-Valor Operao  
   aICMS_modBCST     = 0-Preo Tabelado ou Mximo Sugerido, 1-Lista Negativa(Valor), 2-Lista Positiva(valor), 3-Lista Neutra(valor), 4-Margem Valor Agregado(%), 5-Pauta(valor)  
   aICMSPart_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSPart_CST     = 10-Tributada com cobrana ICMS por substituio, 90-Outros
   aICMSPart_modBC   = 0-Margem Valor Agregado (%), 1-Pauta (Valor), 2-Preo Tabelado Mx (valor) 
   aICMSPart_modBCST = 0 Preo tabelado ou mximo sugerido, 1-Lista Negativa (valor), 2-Lista Positiva (valor), 3-Lista Neutra (valor), 4-Margem Valor Agregado(%), 5-Pauta (valor) 
   aOrig             = 0-Nac exceto as indicadas nos cdigos 3 a 5,1-Est Importao direta- exceto a indicada no cdigo 6,2-Est Adquirida no mercado interno- exceto a indicada no cdigo 7,3-Nac mercadoria ou bem com Contedo de Importao superior a 40%,4-Nac c/ produo feita em conformidade com os processos produtivos bsicos,5-Nac mercadoria/bem c/ Contedo de Importao- inferior ou igual a 40%,6-Est Importao direta- sem similar nacional- constante na Camex,7-Est Adquirida no mercado interno - sem similar nacional-constante na Camex,8-Nacional - mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSST_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSST_CST   = 41=No Tributado,60=cobrado anteriormente por substituio tributria
   aGrupo_simples    = Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=101 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=102 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=103 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=201 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=202 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=203 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=300 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=400 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=500 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=900 
   aICMSSN_Orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSSN_CSOSN     = 101-Tributada com permisso de crdito , 102-Tributada sem permisso de crdito , 103-Iseno para faixa de receita bruta , 201-Tributada com permisso de crdito com cobrana do ICMS por Substituio Tributria , 202-Tributada sem permisso de crdito com cobrana do ICMS por Substituio Tributria , 203-Iseno para faixa de receita bruta com cobrana do ICMS por Substituio Tributria , 300-Imune , 400-No tributada , 500-ICMS cobrado anteriormente por substituio tributria ou por antecipao, 900-Outros
   aICMSSN_modBCST   = 0-Preo Tabelado ou Mximo Sugerido, 1-Lista Negativa(Valor), 2-Lista Positiva(valor), 3-Lista Neutra(valor),4 - Margem Valor Agregado (%),5 - Pauta (valor) (v.2.0)
   aICMSSN_modBC     = 0-Margem Valor Agregado(%), 1-Pauta(Valor), 2-Preo Tabelado Mx(Valor), 3-Valor Operao , 4-Margem Valor Agregado(%), 5-Pauta (valor)
   aIPINT_CST        = 00-Entrada com recuperao de crdito, 01-Entrada tributada com alquota zero, 02-Entrada isenta, 03-Entrada no-tributada, 04-Entrada imune, 05-Entrada com suspenso,49-Outras entradas, 50-Sada tributada, 51-Sada tributada com alquota zero, 52-Sada isenta, 53-Sada no-tributada, 54-Sada imune, 55-Sada com suspenso, 99-Outras sadas
   aPIS_CST          = 01-Operao Tributvel(base de clculo = valor da operao alquota normal(cumulativo/no cumulativo)), 02-Operao Tributvel(base de clculo = valor da operao(alquota diferenciada)), 03 - Operao Tributvel (base de clculo = quantidade vendida x alquota por unidade de produto), 04-Operao Tributvel(tributao monofsica(alquota zero)), 06-Operao Tributvel(alquota zero), 07-Operao Isenta da Contribuio, 08-Operao Sem Incidncia da Contribuio, 09-Operao com Suspenso da Contribuio, 99-Outras Operaes
   aCOFINS_CST       = 01-Operao Tributvel(base de clculo = valor da operao alquota normal(cumulativo/no cumulativo)), 02-Opera Tributvel(base de clculo = valor da operao(alquota diferenciada)), 03-Operao Tributvel (base de clculo = quantidade vendida x alquota por unidade de produto), 04-Operao Tributvel(tributao monofsica(alquota zero)), 06-Operao Tributvel(alquota zero), 07-Operao Isenta da Contribuio, 08-Operao Sem Incidncia da Contribuio, 09-Operao com Suspenso da Contribuio, 99-Outras Operaes                       
   aISSQN_cSitTrib   = N=NORMAL, R=RETIDA, S=SUBSTITUTA, I=ISENTA         
   aFDiasEnt         = Calculado,Informado 
   jProd_indTot      = 1;
   iDesc1            = %
   iDesc2            = Valor
   iDesc3            = VL/UN
   aCam    = 1-Data Emissao da Ordem,2-Data Emisso da NFe,3-Data Emisso da NFe -1
   aBC        = Calculada, Informada
   nVTCI = {nProd_vProd+nProd_vFrete+nProd_vSeg+nII_vII}
   aTempo  = Diario,Semanal,Mensal,Bimestral,Semestral,Anual
   aFinalidade = Outros Fins,Uso e Consumo,Complemento de Impostos
   aDI_tpViaTransp    = 1=Martima,Nota Fiscal eletrnica,2=Fluvial,3=Lacustre,4=Area,5=Postal,6=Ferroviria,7=Rodoviria,8=Conduto / Rede Transmisso,9=Meios Prprios,10=Entrada / Sada ficta,11=Courier,12=Handcarry
   aDI_tpIntermedio   = 1=Importao por conta prpria,2=Importao por conta e ordem,3=Importao por encomenda
   aISSQN_indISS      = 1=Exigvel, 2=No incidncia, 3=Iseno, 4=Exportao, 5=Imunidade, 6=Exigibilidade Suspensa por Deciso Judicial, 7=Exigibilidade Suspensa por Processo Administrativo 
   aICMS_motDesICMS  = 1-Txi, 2-Deficiente Fsico, 3-Produtor Agropecurio, 4-Frotista/Locadora, 5-Diplomtico/Consular, 6-Utilitrios/Motocicletas reas de Livre Comrcio CONTRAN suas alteraes, 7-SUFRAMA, 9-Outros,10=Deficiente Condutor, 11=Deficiente No Condutor
   aICMS_motDesICMS20 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   aICMS_motDesICMS30 = 6=Utilitrios e Motocicletas da Amaznia Ocidental e reas de Livre Comrcio, 7=SUFRAMA, 9=Outros
   aICMS_motDesICMS40 = 1=Txi, 2=Deficiente Fsico *** Eliminado***, 3=Produtor Agropecurio,4=Frotista/Locadora,5=Diplomtico/Consular,6=Utilitrios e Motocicletas da Amaznia Ocidental ereas de Livre Comrcio,7=SUFRAMA, 8=Venda a rgo Pblico, 9=Outros, 10=Deficiente Condutor, 11=Deficiente No Condutor
   aICMS_motDesICMS70 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   aICMS_motDesICMS90 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   iQt = {nQt}
   lRastro = 1
</VarsDefault1>
<ScriptForm1>
   Rastreabilidade                           ; lRastro-5                         ; fontweight='bold' ; edtzoom=true ;  visible=(sDDFTagApl!='Padrao_3')
   Verso                                    ; sRastro-60                        ; identlabel=5      ; editable=false ; visible=((iDDFChamada>0)&&(lRastro==1)&&(sDDFTagApl!='Padrao_3')) ; 
   ;
   <img style='width: 80_ height 80_' src='../{sCliPasta}/FotosItens/imgItem{pItem}-{fFoto}{sFoto}'> ;; identlabel=5 ; colspan=true ; visible=(fFoto>0);
   Item                                      ; sRegCodItem-20                    ; identlabel=5      ; visible=((jTipo==0)||(jTipo==3)||(jTipo==4)) ; esc=fsLoadTag('esc1') ; exec=fsLoadTag('exec2') 
   Qtde Pedida                               ; iQt-10                            ; identlabel=5      ; exec=fsLoadTag('exec5') ; valid=(iQt*nPrBruto>0,'Os campos quantidade e preos devem ser preenchidas') ; valid=(nQt==parseInt(nQt),'A quantidade deve ser um numero inteiro')
   Unidade Medida                            ; sCodUni-10                        ; identlabel=5      ; editable=false     ;
   ;
   Valor [UN] Bruto                          ; nPrBruto-12-5                     ; identlabel=5      ; exec=fsLoadTag('exec10')
   [%] Desconto Incondicional [UN]           ; nPDescInc-12-5                    ; identlabel=5      ; exec=fsLoadTag('exec11a') 
   [$] Desconto Incondicional [UN]           ; nVDescInc-12-5                    ; identlabel=5      ; editable=false ; 
   ;
   Valor [UN] Comercial c/Desconto           ; nProd_vUnCom-12-5                 ; editable=false    ; identlabel=5 ;
   Valor [Total] Comercial                   ; nProd_vProd-12-5                  ; editable=false    ; identlabel=5 
   ;
   Qtde Ult Ped (1),(2),(3)                  ; nQtUV1-7-5,nQtUV2-7-5,nQtUV3-7-5                      ; identlabel=5      ; editable=false ; 
   ;
</ScriptForm1>
<VarsToServer1>
   pPId
   iVer
   pPTOpEDItem
   fPTOpEDItem
   pOrdem   = {ChaveAtual_1}
   nQtMoe
   pCam  
   fCam  
   pMoe  
   fMoe  
   nCam  
   sCam
   jCam
   iInLineSerial = iInLineSerial+1
   nVBCUFDest
   nPFCPUFDest
   nPICMSUFDest
   nPICMSInter
   nPICMSInterPart
   nVFCPUFDest
   nVICMSUFDest
   nVICMSUFRemet
   jDI_tpViaTransp    
   nDI_vAFRMM         
   jDI_tpIntermedio   
   sDI_CNPJ           
   sDI_UFTerceiro     
   nImp_vTotTrib      
   nICMS_vICMSDeson   
   nICMS_vICMSOp      
   nICMS_pDif         
   nICMS_vICMSDif     
   nISSQN_vDeducao    
   nISSQN_vOutro      
   nISSQN_vDescIncond 
   nISSQN_vDescCond   
   nISSQN_vISSRet     
   jISSQN_indISS      
   pISSQN_cServico    
   fISSQN_cServico    
   pISSQN_cMun        
   pISSQN_cPais       
   fISSQN_cMun        
   fISSQN_cPais       
   sISSQN_nProcesso   
   lISSQN_indIncentivo
   jFinalidade
   sFCI
   nVDescLog
   pRegDepVen
   fRegDepVen
   lImport     
   lImposImpor 
   lAdicoes    
   lCIDE       
   lICMS_ST    
   lICMS_P     
   lICMS_RR    
   lICMS_SN    
   lIPI        
   lPIS        
   lPIS_ST     
   lCofins     
   lCofins_ST  
   lISSQN      
   lTranspFiscal
   nTot_vTrib 
   nAliqTranspImport
   nAliqTranspNac   
   pRegDepRFis
   fRegDepRFis
   jBC_PIS
   jBC_COFINS
   jBC_ICMS
   jBC_IPI
   jBC_ICMSST
   jBC_II
   jBC_ISS
   jVl_ICMSST
   jVl_ICMS
   nBC_ICMS
   nBC_COFINS
   nBC_PIS
   nBC_IPI
   nBC_ICMSST
   nBC_II
   nBC_ISS
   nVl_ICMSST
   nVl_ICMS
   nPEncFinTpED
   lCCusto  
   lCrtlItem
   jOrig
   iSerial
   jFDiasEnt
   iDiasInf
   iDiasCalc
   pItem 
   pUni         
   fUni
   pNeg          = jTipo==0 ? 1  : pNeg  
   fNeg          = jTipo==0 ? 1  : fNeg  
   pTab  = 0        
   fTab  = 0        
   pTabI = 0        
   fTabI = 0        
   pTabGrpP = 0
   fTabGrpP = 0
   pTabGrpPI= 0
   fTabGrpPI= 0
   pNCM    
   fNCM    
   pCFO    
   fCFO    
   jTipo
   nQt = iQt
   tEntPla 
   tEmissao
   tSaida
   pItem
   fItem
   nDesc
   nQtMin
   nQtMax
   nPrecoMin
   nPrecoMax
   lContQua
   lContPreco
   iCiclo
   iCicloAtual
   jTempo
   lSkipLote
   nPrBruto
   nPDescCP = nDFin
   nVDescCP
   nPDescTpED = nDescFin
   nVDescTpED
   nVEncFinTpED
   nPDescTpEDG
   nVDescTpEDG
   nPDescInc
   nVDescInc
   nProd_pDesc
   pPTOpEDGrpItem
   fPTOpEDGrpItem
   pLote
   fLote
   nProd_vUnCom
   nProd_vProd
   nProd_vFrete
   nVMLE
   nProd_vSeg
   nProd_vDesc
   nProd_vOutro
   jProd_indTot
   sDI_nDI               
   dDI_dDI               
   sDI_xLocDesemb        
   sDI_UFDesemb          
   dDI_dDesemb           
   sDI_cExportador  
   iAdi_nAdicao          
   iAdi_nSeqAdic         
   sAdi_cFabricante      
   nAdi_vDescDI          
   sAdi_xPed             
   iAdi_nItemPed
   nCIDE_qBCprod
   nCIDE_vAliqProd
   nCIDE_vCIDE
   jICMS_GrupoTrib    
   jICMS_orig
   jICMS_modBC
   nICMS_vBC
   nICMS_pICMS
   nICMS_vICMS
   jICMS_modBCST
   nICMS_pMVAST
   nICMS_pRedBCST
   nICMS_vBCST
   nICMS_pICMSST
   nICMS_vICMSST
   nICMS_pRedBC
   jICMS_motDesICMS
   nICMS_vBCSTRet
   nICMS_vICMSSTRet
   jICMSPart_orig
   jICMSPart_CST
   jICMSPart_modBC
   nICMSPart_vBC
   nICMSPart_pRedBC
   nICMSPart_pICMS
   nICMSPart_vICMS
   jICMSPart_modBCST
   nICMSPart_pMVAST
   nICMSPart_pRedBCT
   nICMSPart_vBCST
   nICMSPart_pICMSST
   nICMSPart_vICMSST
   nICMSPart_pBCOp
   sICMSPart_UFST
   jICMSST_orig
   jICMSST_CST
   nICMSST_vBCSTRet
   nICMSST_vICMSSTRe
   nICMSST_vBCSTDest
   nICMSST_vICMSSTDes
   jGrupo_simples
   jICMSSN_Orig
   jICMSSN_CSOSN
   nICMSSN_pCredSN
   nICMSSN_vCredICMSSN
   jICMSSN_modBCST
   nICMSSN_pMVAST
   nICMSSN_pRedBCST
   nICMSSN_vBCST
   nICMSSN_pICMSST
   nICMSSN_vICMSST
   nICMSSN_vBCSTRet
   nICMSSN_vICMSSTRet
   jICMSSN_modBC
   nICMSSN_vBC
   nICMSSN_pRedBC
   nICMSSN_pICMS
   nICMSSN_vICMS
   sIPI_clEnq
   sIPI_CNPJProd
   sIPI_cSelo   
   nIPI_qSelo   
   sIPI_cEnq    
   jIPINT_CST      
   nIPITrib_vBC 
   nIPITrib_pIPI
   nIPITrib_qUnid
   nIPITrib_vUnid
   nIPITrib_vIPI 
   nII_vBC 
   nII_vDespAdu
   nII_vII     
   nII_vIOF    
   jPIS_CST  
   nPIS_vBC 
   nPIS_pPIS 
   nPIS_vPIS 
   nPIS_qBCProd 
   nPIS_vAliqProd 
   nPISST_vBC 
   nPISST_pPIS
   nPISST_qBCProd 
   nPISST_vAliqProd
   nPISST_vPIS
   jCOFINS_CST  
   nCOFINS_vBC  
   nCOFINS_pCOFINS 
   nCOFINS_vCOFINS 
   nCOFINS_qBCProd
   nCOFINS_vAliqProd
   nCOFINSST_vBC
   nCOFINSST_pCOFINS
   nCOFINSST_qBCProd
   nCOFINSST_vAliqProd
   nCOFINSST_vCOFINS
   nISSQN_vBC
   nISSQN_vAliq
   nISSQN_vISSQN
   nISSQN_cMunFG
   nISSQN_cListServ
   jISSQN_cSitTrib
   sInfAdProd = mInfAdProd
   pOrdens_Item_CCusto_{i}
   pCCusto_{i}
   fCCusto_{i}
   nRatCCusto_{i}
   pOrdens_Item_CContCred_{i}
   pCContCred_{i}
   fCContCred_{i}
   nRatCredCCont_{i}
   pOrdens_Item_CContDeb_{i}
   pCContDeb_{i}
   fCContDeb_{i}
   nRatDebCCont_{i}
</VarsToServer1>
<VarsToDb1>  
   sDDFTabela = Ordens_Itens
   aSerial[]  = 'OSa_{ChaveAtual_1}'
   iSerial    = $aSerial[0]
   pPTOpEDItem
   fPTOpEDItem
   nQtMoe
   pCam  
   fCam 
   pMoe
   fMoe
   nCam
   sCam
   jCam
   nVBCUFDest
   nPFCPUFDest
   nPICMSUFDest
   nPICMSInter
   nPICMSInterPart
   nVFCPUFDest
   nVICMSUFDest
   nVICMSUFRemet
   pRegDepVen
   fRegDepVen
   sFCI
   pRegDepRFis
   fRegDepRFis
   iInLineSerial
   jDI_tpViaTransp    
   nDI_vAFRMM         
   jDI_tpIntermedio   
   sDI_CNPJ           
   sDI_UFTerceiro     
   nImp_vTotTrib      
   nICMS_vICMSDeson   
   nICMS_vICMSOp      
   nICMS_pDif         
   nICMS_vICMSDif     
   nISSQN_vDeducao    
   nISSQN_vOutro      
   nISSQN_vDescIncond 
   nISSQN_vDescCond   
   nISSQN_vISSRet     
   jISSQN_indISS      
   pISSQN_cServico    
   fISSQN_cServico    
   pISSQN_cMun        
   pISSQN_cPais       
   fISSQN_cMun        
   fISSQN_cPais       
   sISSQN_nProcesso   
   lISSQN_indIncentivo
   nVDescLog
   lImport     
   lImposImpor 
   lAdicoes    
   lCIDE       
   lICMS_ST    
   lICMS_P     
   lICMS_RR    
   lICMS_SN    
   lIPI        
   lPIS        
   lPIS_ST     
   lCofins     
   lCofins_ST  
   lISSQN      
   lTranspFiscal
   jBC_PIS
   jBC_COFINS
   jBC_ICMS
   jBC_IPI
   jBC_ICMSST
   jBC_II
   jBC_ISS
   jVl_ICMSST
   jVl_ICMS
   nBC_ICMS
   nBC_COFINS
   nBC_PIS
   nBC_IPI
   nBC_ICMSST
   nBC_II
   nBC_ISS
   nVl_ICMSST
   nVl_ICMS
   nTot_vTrib 
   nAliqTranspImport
   nAliqTranspNac   
   nPEncFinTpED
   jOrig
   jFDiasEnt
   iDiasInf
   iDiasCalc
   pOrdem 
   pItem
   fItem
   pUni
   fUni
   pNeg
   fNeg
   pTab
   fTab
   pTabI
   fTabI
   pTabGrpP
   fTabGrpP
   pTabGrpPI
   fTabGrpPI
   pNCM
   fNCM
   pCFO
   fCFO
   jTipo
   nQt
   tEntPla
   tEmissao
   tSaida
   nDesc
   lCCusto  
   lCrtlItem
   pPTOpEDGrpItem
   fPTOpEDGrpItem
   nQtMin
   nQtMax
   nPrecoMin
   nPrecoMax
   lContQua
   lContPreco
   iCiclo
   iCicloAtual
   jTempo
   lSkipLote
   nPrBruto   
   nPDescCP   
   nVDescCP   
   nPDescTpED 
   nVDescTpED 
   nVEncFinTpED 
   nPDescTpEDG
   nVDescTpEDG
   nPDescInc  
   nVDescInc  
   nProd_pDesc
   pLote
   fLote
   jFinalidade
   nProd_vUnCom
   nProd_vProd
   nProd_vFrete
   nVMLE
   nProd_vSeg
   nProd_vDesc
   nProd_vOutro
   jProd_indTot
   sDI_nDI               
   dDI_dDI               
   sDI_xLocDesemb        
   sDI_UFDesemb          
   dDI_dDesemb           
   sDI_cExportador  
   iAdi_nAdicao          
   iAdi_nSeqAdic         
   sAdi_cFabricante      
   nAdi_vDescDI          
   sAdi_xPed             
   iAdi_nItemPed         
   nCIDE_qBCprod
   nCIDE_vAliqProd
   nCIDE_vCIDE
   jICMS_GrupoTrib
   jICMS_orig 
   jICMS_modBC
   nICMS_vBC
   nICMS_pICMS
   nICMS_vICMS
   jICMS_modBCST
   nICMS_pMVAST
   nICMS_pRedBCST
   nICMS_vBCST
   nICMS_pICMSST
   nICMS_vICMSST
   nICMS_pRedBC
   jICMS_motDesICMS
   nICMS_vBCSTRet
   nICMS_vICMSSTRet
   jICMSPart_orig
   jICMSPart_CST
   jICMSPart_modBC
   nICMSPart_vBC
   nICMSPart_pRedBC
   nICMSPart_pICMS
   nICMSPart_vICMS
   jICMSPart_modBCST
   nICMSPart_pMVAST
   nICMSPart_pRedBCT
   nICMSPart_vBCST
   nICMSPart_pICMSST
   nICMSPart_vICMSST
   nICMSPart_pBCOp
   sICMSPart_UFST
   jICMSST_orig
   jICMSST_CST
   nICMSST_vBCSTRet
   nICMSST_vICMSSTRe
   nICMSST_vBCSTDest
   nICMSST_vICMSSTDes
   jGrupo_simples
   jICMSSN_Orig
   jICMSSN_CSOSN
   nICMSSN_pCredSN
   nICMSSN_vCredICMSSN
   jICMSSN_modBCST
   nICMSSN_pMVAST
   nICMSSN_pRedBCST
   nICMSSN_vBCST
   nICMSSN_pICMSST
   nICMSSN_vICMSST
   nICMSSN_vBCSTRet
   nICMSSN_vICMSSTRet
   jICMSSN_modBC
   nICMSSN_vBC
   nICMSSN_pRedBC
   nICMSSN_pICMS
   nICMSSN_vICMS
   sIPI_clEnq
   sIPI_CNPJProd
   sIPI_cSelo
   nIPI_qSelo
   sIPI_cEnq
   jIPINT_CST
   nIPITrib_vBC
   nIPITrib_pIPI
   nIPITrib_qUnid
   nIPITrib_vUnid
   nIPITrib_vIPI
   nII_vBC
   nII_vDespAdu
   nII_vII
   nII_vIOF
   jPIS_CST  
   nPIS_vBC 
   nPIS_pPIS 
   nPIS_vPIS 
   nPIS_qBCProd 
   nPIS_vAliqProd 
   nPISST_vBC 
   nPISST_pPIS
   nPISST_qBCProd 
   nPISST_vAliqProd
   nPISST_vPIS   
   jCOFINS_CST
   nCOFINS_vBC
   nCOFINS_pCOFINS
   nCOFINS_vCOFINS
   nCOFINS_qBCProd
   nCOFINS_vAliqProd
   nCOFINSST_vBC
   nCOFINSST_pCOFINS
   nCOFINSST_qBCProd
   nCOFINSST_vAliqProd
   nCOFINSST_vCOFINS
   nISSQN_vBC 
   nISSQN_vAliq 
   nISSQN_vISSQN
   nISSQN_cMunFG    
   nISSQN_cListServ 
   jISSQN_cSitTrib
   sInfAdProd   
   sDDFSubTabela = Ordens_Item_CCusto
   pSubPId       = $_POST[pOrdens_Item_CCusto_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCCusto       = $_POST[pCCusto_{i}]
   fCCusto       = $_POST[fCCusto_{i}]
   nRatCCusto    = $_POST[nRatCCusto_{i}]
   lExc          = $_POST[pCCusto_{i}]==0 ? 1 : 0
   sDDFSubTabela = Ordens_Item_CContabil
   pSubPId       = $_POST[pOrdens_Item_CContCred_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCPla         = $_POST[pCContCred_{i}]
   fCPla         = $_POST[fCContCred_{i}]
   nRatCredCCont = $_POST[nRatCredCCont_{i}]
   lDeb          = 0
   lExc          = $_POST[pCContCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = Ordens_Item_CContabil
   pSubPId       = $_POST[pOrdens_Item_CContDeb_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCPla         = $_POST[pCContDeb_{i}]
   fCPla         = $_POST[fCContDeb_{i}]
   nRatDebCCont  = $_POST[nRatDebCCont_{i}]
   lDeb          = 1
   lExc          = $_POST[pCContDeb_{i}]==0 ? 1 : 0
</VarsToDb1>
<ServerValids1>
   pItem        ; $_POST[.]>0 ;  O Item deve ser informado.
   pUni         ; $_POST[.]>0 ;  A unidade da transao deve ser informada.
   nQt          ; $_POST[.]>0 ;  A Qt.Pedida deve ser Preenchida.
   pMoe         ; $_POST[.]>0 ;  A Moeda do Item deve ser informada.
   nQt          ; ($_POST[.]*$_POST[nPrBruto])>0 ; Os campos quantidade e preos devem ser preenchidas.
     pItem        ; flEhUnico("select count(*) from Ordens_Itens a, Ordens b, TOper c where a.pItem=$_POST[.] and a.pPId!=$_POST[pPId] and a.pOrdem=$_POST[pOrdem] and a.pOrdem=b.pPId and b.pTOper = c.pPId and c.lRejOrdemDupl=1  and a.iVer = a.iVAt and b.iVer = b.iVAt and c.iVer = c.iVAt") ; J existe esse Item cadastrado no Item da Ordem, se no encontrar verifique na lixeira.
</ServerValids1>
<PodeIncluir1>
     select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom is null ; Esse Item no pode ser includo porque o Pedido j foi Liberado
</PodeIncluir1>
<PodeExcluir1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser excluido porque o Pedido j foi Liberado
</PodeExcluir1>
<PodeReincluir1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser reincludo porque o Pedido j foi Liberado
</PodeReincluir1>
<PodeAlterar1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser alterado porque o Pedido j foi Liberado
</PodeAlterar1>
<exec1>
(
      this.flSetVar('pItem',0) 
   && this.flSetVar('fItem',0) 
   && this.flSetVar('iQt','') 
   && this.flSetVar('sRegCodItem','') 
   && this.flSetVar('sTabCodItem','') 
   && this.flSetVar('sNegCodItem','') 
   && this.flSetVar('sRegDesItem','') 
   && this.flSetVar('pTab','0') 
   && this.flSetVar('fTab','0') 
   && this.flSetVar('pTabI','0') 
   && this.flSetVar('fTabI','0') 
   && this.flSetVar('sCodTab','') 
   && this.flSetVar('sDesTab','') 
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
   && this.flSetVar('jOrig',0)   
   && this.flSetVar('jICMS_Orig',0)   
   && this.flSetVar('pUni',0)         
   && this.flSetVar('sCodUni','')     
   && this.flSetVar('sUni','')        
   && this.flSetVar('pNCM',0)         
   && this.flSetVar('sCodNCM','')     
   && this.flSetVar('sDesNCM','')     
   && this.flSetVar('pNeg',0)         
   && this.flSetVar('fNeg',0)         
   && this.flSetVar('nPrBruto','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('nPEncFinTpED','0,00000') 
   && this.flSetVar('sMoe','') 
   && this.flSetVar('pMoe',0) 
   && this.flSetVar('fMoe',0) 
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0) 
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('jCam',0) 
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('pRegDepVen',0) 
   && this.flSetVar('pDepVen',0) 
   && this.flSetVar('pUFisVen',0) 
   && this.flSetVar('pUFisVen',0) 
   && this.flSetVar('sUn1Ven','') 
   && this.flSetVar('sUn2Ven','') 
   && this.flSetVar('sUn3Ven','') 
   && this.flSetVar('sUn4Ven','') 
   && this.flSetVar('sUn5Ven','') 
   && this.flSetVar('sUn6Ven','') 
   && this.flSetVar('sUn7Ven','') 
   && this.flSetVar('pRegDepRFis',0) 
   && this.flSetVar('pDepRFis',0) 
   && this.flSetVar('pUFisRFis',0) 
   && this.flSetVar('pUFisRFis',0) 
   && this.flSetVar('sUn1RFis','') 
   && this.flSetVar('sUn2RFis','') 
   && this.flSetVar('sUn3RFis','') 
   && this.flSetVar('sUn4RFis','') 
   && this.flSetVar('sUn5RFis','') 
   && this.flSetVar('sUn6RFis','') 
   && this.flSetVar('sUn7RFis','')  
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','')
   && this.flSetVar('nQtMin','0,00') 
   && this.flSetVar('nQtMax','0,00') 
   && this.flSetVar('nPrecoMin','0,00') 
   && this.flSetVar('nPrecoMax','0,00') 
   && this.flSetVar('lContQua',0) 
   && this.flSetVar('lContPreco',0) 
   && this.flSetVar('iCiclo',0) 
   && this.flSetVar('iCicloAtual',0) 
   && this.flSetVar('jTempo',0) 
   && this.flSetVar('lSkipLote',0) 
)
</exec1>
<exec2>
(
      this.flSetVar('nPrBruto','') 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000')                                                                                   
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','')                             
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('nVDescInc','0,00')
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
)
</exec2>
<exec3>
( 
   ( (pCapaMoe!=pMoe) 
     ? 
     (this.flSetVar('nQtMoe',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nPrBruto','0,00000'))  
     : 
     (this.flSetVar('nPrBruto',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nQtMoe','0,00000')) 
   ) 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec3>
<exec4>
( 
   ( 
     (pCapaMoe!=pMoe) 
     ?  
     (this.flSetVar('nQtMoe',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nPrBruto','0,00000')) 
     : 
     (this.flSetVar('nPrBruto',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nQtMoe','0,00000'))  
   ) 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nPrBruto','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000')
   && this.flSetVar('sCam','')
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec4>
<exec5>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec5>
<exec6>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec6>
<exec7>
(
      this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam','0') 
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('fCam','0') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('nProd_vUnCom','0,00000')
)
</exec7>
<exec8>
(
      this.flSetVar('nPrBruto',fsReplaceDecimalPoint((nQtMoe*nCam),".",",",5)) 
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDescFin),".",",",5)) 
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nQtMoe*nCam)-(nVDescInc+((nQtMoe*nCam)/100*(nDFin))+((nQtMoe*nCam)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nQtMoe*nCam)-(nVDescInc+((nQtMoe*nCam)/100*(nDFin))+((nQtMoe*nCam)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec8>
<exec9>
(
      this.flSetVar('nPrBruto',fsReplaceDecimalPoint((nQtMoe*nCam),".",",",5) ) 
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDescFin),".",",",5))
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint(((nQtMoe*nCam))-(nVDescInc+(((nQtMoe*nCam))/100*(nDFin))+(((nQtMoe*nCam))/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint(((((nQtMoe*nCam))-(nVDescInc+(((nQtMoe*nCam))/100*(nDFin))+(((nQtMoe*nCam))/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
   )
</exec9>
<exec10>
(
      this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint((nPrBruto/100*nDescFin),".",",",5))
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint((nPrBruto/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec10>
<exec11>
(
   this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec11>
<exec11a>
(
   this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec11a>
<exec12>
(
      this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec12>
<exec13>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec13>
<exec14>
(
   this.flSetVar('nVDescLog',fsReplaceDecimalPoint(((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec14>
<esc1>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_1a',
 'sRegCodItem,pTOper,pEmi,pDest,pOrdem,pDestDefault',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pItem,
  fItem,
  sRegCodItem,
  sRegDesItem,
  sEAN,sGTIN,
  jICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  stmp,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  nQtUV1,
  nQtUV2,
  nQtUV3,
  nPrUV1,
  nPrUV2,
  nPrUV3,
  nPrBruto1,
  nPrBruto2,
  nPrBruto3,
  nPrBruto,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)
</esc1>
<esc2>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_2',
 'sNegCodItem,pTOper,pEmi,pDest,pOrdem',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pItem,
  fItem,
  sNegCodItem,
  sRegDesItem,
  sEAN,
  sGTIN,j
  ICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  sTmp,
  nPrBruto,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},
  pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)   
</esc2>
<esc3>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_3',
 'sTabCodItem,pTOper,pEmi,pDest,pOrdem',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pTab,
  fTab,
  pTabI,
  fTabI,
  pItem,
  fItem,
  sTabCodItem,
  sRegDesItem,
  sCodTab,
  sDesTab,
  sEAN,
  sGTIN,
  jICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  sTmp,
  nPrBruto,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},
  pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)
</esc3>

--//--

al_Get_fsLoad_include.php-inicio
fsLoadTag
fsLoadBloco
fsLoadFTag
fsLoadFBloco
al_Get_fsLoad_include.php-fim-sTxt=<Padrao_1>   
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1
   sTagCpo          = Cpo1
   sTagSql          = Sql1
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Ordens_Itens
   sTagMenu         = Menu1
   sTagNr0          = Nr03
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Pesquisar
   sTagPesquisar    = Pesquisar1
   sTagDbToVars     = DbToVars1       
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1    
   sTagVarsToServer = VarsToServer1  
   sTagVarsToDb     = VarsToDb1      
   sTagServerVal    = ServerValids1  
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
   sTagPodeReincluir = PodeReincluir1
   sTagOnSave       = flOnSave(56,{ChaveAtual_1})
   sTagSubGrid      = 1,2,3
</Padrao_1>
<Padrao_1a>   
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1a
   sTagCpo          = Cpo1a
   sTagSql          = Sql1
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Ordens_Itens
   sTagMenu         = Menu1
   sTagNr0          = Nr02a
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Incluir   
   sTagPesquisar    = Pesquisar1
   sTagRecsPage     = 100000
   sTagDbToVars     = DbToVars1       
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1    
   sTagVarsToServer = VarsToServer1  
   sTagVarsToDb     = VarsToDb1      
   sTagServerVal    = ServerValids1  
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
   sTagPodeReincluir = PodeReincluir1
   sTagOnSave       = flOnSave(56,{ChaveAtual_1})
   sTagSubGrid      = 1,2,3
</Padrao_1a>
<Padrao_2>   
   sTagTit          = Tit2
   sTagCpoTit       = CpoTit2
   sTagCpo          = Cpo2
   sTagSql          = Sql2
   sTagSqlSum       = SqlSum1
   sTagMainTable    = Itens
   sTagMenu         = Menu2
   sTagNr0          = Nr03
   sTagTipoNr0      = TipoNr03
   sTagToolsBar     = Pesquisar
   sTagToolsBar     = Incluir,Pesquisar
   sTagPesquisar    = Pesquisar2
   sTagDbToVars     = DbToVars2
   sTagVarsDef      = VarsDefault2
   sTagScript       = ScriptForm2    
   sTagVarsToServer = VarsToServer2  
   sTagVarsToDb     = VarsToDb2      
   sTagServerVal    = ServerValids2  
   sTagTitulo       = TelaTit2
   sLabelsAlign     = Left
</Padrao_2>
<Tit1>Itens do Pedido [{this.oPai.aGrid[this.oPai.iArray][this.oPai.iCol]}]</Tit1>
<Tit2>Itens a Venda</Tit2>
<CpoTit1>
   Item-s-60            ; b.sCodigo
   Qt Ped-n-12-2        ; a.nQt,a.iSerial
   $Bruto-n-12-2
   Pru1-n-12-2
   Pru2-n-12-2
   Pru3-n-12-2
   DescI[UN]-n-12-2
   Total-n-12-2        ; a.nProd_vProd,a.iSerial
   Qt Fat-n-12-2            ; a.nQtFat,a.iSerial
   -s-20
</CpoTit1>
<CpoTit1a>
   Codigo-s-20        
   Item-s-60           ; b.sCodigo
   Qt.Ped-n-12-0       ; a.nQt,a.iSerial
   Pr.Bruto-n-12-2
   DescI.Uni[%]-n-12-2
   DescI.Uni[$]-n-12-2
   Pr. Comer-n-12-2
   Total-n-12-2        ; a.nProd_vProd,a.iSerial
   nPDescTpEDG-12-2
   nPEncFinTpED-12-2
   sCodUni-10
</CpoTit1a>
<Cpo1>
   $aLin["SCODITEM"].' - '. $aLin["SITEM"]
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin["NQTFAT"],2,",",".")
   '<span onclick="this.flClickLin({piLinha});this.flGridAlt();" style="background-color: #c0c0c0; color: inherit_ cursor: pointer_ text-decoration: underline_"><i>alterar</i></span>'
   $aLin["PPID"]
</Cpo1>
<Cpo1a>   
   $aLin["SCODITEM"]   
   $aLin["SITEM"]      
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NPDESCINC"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VUNCOM"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin[strtoupper("nPDescTpEDG")],2,",",".")
   number_format($aLin[strtoupper("nPEncFinTpED")],2,",",".")
   $aLin[strtoupper("sCodUni")]
   $aLin["PPID"]
</Cpo1a>
<Sql1>
   select a.iSerial,
          a.iInLineSerial,
          a.jTipo,
          a.pPId,
          a.nQt,
          a.nQtFat,
          a.nQtEnt,
          a.nQtOP,
          a.nProd_vUnCom,
          a.nProd_vProd,
          a.jProd_indTot,
          a.jOrig,
          a.nPrBruto,
          a.nPrBruto1,
          a.nPrBruto2,
          a.nPrBruto3,
          b.sCodigo     sCodItem,
          b.sDescricao  sItem,
          c.sCodigo    sCodUni,
          c.sUnidade   sDesUni,
          c.jDec,
          a.nProd_vFrete,
          a.nProd_vSeg,
          a.nProd_vOutro,
          a.pMoe,
          k.sDescricao      sMoe,
          a.fMoe,
          a.nQtMoe,
          a.jCam,
          a.pCam,
          a.fCam,
          kk1.sDescricao  sMoeCambio,
          a.nCam,
          a.sCam,
          a.nVDescTpED,
          a.nVDescTpEDG,
          a.nVEncFinTpED,
          a.nPDescInc,
          a.nVDescInc,
          d.jTipo jEntSai,
          e.sCodigo       sDesTab,
          e.sDescricao    sCodTab,
          a.nPDescTpEDG,
          a.nPEncFinTpED
   from Ordens_Itens  a
                                join Ordens          d on a.pOrdem  = d.pPId                                              and d.iVer  = d.iVAt
                                join UnidadeMedida   c on a.pUni    = c.pPId                                              and c.iVer  = c.iVAt
                                join Itens           b on a.pItem   = b.pPId                                              and b.iVer  = a.fItem
                           left join TabPrecos       e on a.pTab    = e.pPId                                              and e.iVer  = e.iVAt
                           left join PerfilPed       g on d.pEmi    = g.pEmi and d.pRepCom = g.pRep                       and g.iVer  = g.iVAt
                           left join PerfilPed_Itens f on f.pPerfP  = g.pPId and a.pItem   = f.pItem                      and f.iVer  = f.iVAt
                           left join Moeda         k   on a.pMoe    = k.pPId   and k.iVer   = k.iVAt
                           left join Cambio        kk  on a.pCam    = kk.pPId  and kk.iVer  = kk.iVAt
                           left join Moeda         kk1 on kk.pMoe2  = kk1.pPId and kk1.iVer = kk1.iVAt
   where a.lExc    = 0
     and a.iVer    = a.iVAt
     and a.pOrdem  = {ChaveAtual_1}
   order by b.sCodigo   
</Sql1>
<SqlSum1>
   select 'Totais',cast(sum(a.nQt)as numeric(15,2)),'','',cast(sum(a.nProd_vProd) as numeric(15,2)),'','' from Ordens_Itens a where a.iVer = a.iVAt and a.pOrdem = {ChaveAtual_1} and a.lExc = 0
</SqlSum1>
<CpoTit2>
   Codigo-s-20
   Item-s-100
   Qtd-n-12-2
   Pr.Unit-n-12-2
   PDesconto-n-12-2
   VDesconto-n-12-2
   Pr.Unit.Com-n-12-2
   Total Item-n-12-2
   nPDescTpEDG-n-12-2
   nPEncFinTpED-n-12-2
   sCodUni-s-10
</CpoTit2>
<Cpo2>   
   $aLin["SCODITEM"]
   $aLin["SITEM"]
   number_format($aLin["NQT"],2,",",".")
   number_format($aLin["NPRBRUTO"],2,",",".")
   number_format($aLin["NPDESCINC"],2,",",".")
   number_format($aLin["NVDESCINC"],2,",",".")
   number_format($aLin["NPROD_VUNCOM"],2,",",".")
   number_format($aLin["NPROD_VPROD"],2,",",".")
   number_format($aLin[strtoupper("nDesc")],2,",",".")
   number_format($aLin[strtoupper("nPEncFinTpED")],2,",",".")
   $aLin[strtoupper("sCodUni")]
   $aLin["PPID"]
</Cpo2>
<Sql2>
   select b.pPId,
          b.sCodigo    sCodItem,
          b.sDescricao sItem,
          a.nDesc,                
          a.nPEncFinTpED,
          coalesce(k.nQt,0)               nQt,
          coalesce(k.nPrBruto,0)          nPrBruto,
          coalesce(k.nPDescInc,0)         nPDescInc,
          coalesce(k.nVDescInc,0)         nVDescInc,
          coalesce(k.nProd_vUnCom,0)      nProd_vUnCom,
          coalesce(k.nProd_vProd,0)       nProd_vProd,
          coalesce(g.sCodigo,'')          sCodUni
   from PTOpED_Item a 
                           join PTOpED          c on a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = 36669 and c.lExc=0
                           join Itens           b on a.pItem   = b.pPId and b.iVer=b.iVAt
                      left join NCM             e on b.pNCM    = e.pPId and e.iVer=e.iVAt
                      left join UnidadeMedida   g on a.pUni    = g.pPId and g.iVer=g.iVAt
                      left join Moeda           j on a.pMoe    = j.pPId and j.iVer=j.iVAt
                      left join Ordens_Itens    k on k.pOrdem  = {ChaveAtual_1}   and k.iVer=k.iVAt and k.pItem=a.pItem
   where a.lExc=0 and a.iVer=a.iVAt {sSearch}
   union all
   select b.pPId,
          b.sCodigo    sCodItem,
          b.sDescricao sItem,
          a.nDesc,
          a.nPEncFinTpED,
          coalesce(k.nQt,0)               nQt,
          coalesce(k.nPrBruto,0)          nPrBruto,
          coalesce(k.nPDescInc,0)         nPDescInc,
          coalesce(k.nVDescInc,0)         nVDescInc,
          coalesce(k.nProd_vUnCom,0)      nProd_vUnCom,
          coalesce(k.nProd_vProd,0)       nProd_vProd,
          coalesce(g.sCodigo,'')          sCodUni
   from PTOpED_Item a 
                           join PTOpED          c on a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = {ChaveIrma_1_5} and c.lExc=0
                      left join Itens           b on a.pItem   = b.pPId and b.iVer=b.iVAt
                      left join NCM             e on b.pNCM    = e.pPId and e.iVer=e.iVAt
                      left join UnidadeMedida   g on a.pUni    = g.pPId and g.iVer=g.iVAt
                      left join Moeda           j on a.pMoe    = j.pPId and j.iVer=j.iVAt
                      left join Ordens_Itens    k on k.pOrdem  = {ChaveAtual_1}   and k.iVer=k.iVAt and k.pItem=a.pItem
   where a.lExc=0 and a.iVer=a.iVAt {sSearch}
     and b.pPId not in (select a.pItem from PTOpED_Item a, PTOpED c where a.pPTOpED = c.pPId and c.iVer=c.iVAt and c.pTOper = {ChaveIrma_1_0} and c.pEmi = {ChaveIrma_1_4} and c.pDest = 36669 and c.lExc=0)
   order by 2
</Sql2>
<Pesquisar1>
   ((upper(a.iSerial) like '%{p0}%') or (upper(b.sCodigo) like '%{p0}%') or (upper(b.sDescricao) like '%{p0}%'))
</Pesquisar1>
<Pesquisar2>
   ((upper(b.sCodigo) like '%{p0}%') or (upper(b.sDescricao) like '%{p0}%'))
</Pesquisar2>
<Menu1>
</Menu1>
<Nr01>alert("Qtux-Dialog\n\nNada a relacionar ...")</Nr01>
<Nr02>oGrid.flGridInc()</Nr02>
<Nr02a>flGrid123()</Nr02a>
<TipoNr01>0</TipoNr01>
<TipoNr02>1</TipoNr02>
<TipoNr03>2</TipoNr03>
<TelaTit1>
   Ficha da Linha da Ordem 
</TelaTit1>
<DbToVars1> 
   select a.tInc,
          a.iVer,
          a.iVAt,
          a.pPId,
          a.iSerial,
          a.nQt,
          a.nQtRes,
          a.nQtEnt,
          a.nQtLib,
          a.nQtFat,
          (a.nQt-a.nQtEnt) nQtPend,
          a.lBaixa,
          a.pRegFis,
          a.fRegFis,
          a.pNeg,
          a.fNeg,
          a.pTab,
          r.sCodigo     sCodTab,
          r.sDescricao  sDesTab,
          a.fTab,
          a.pTabI,
          a.fTabI,
          a.nProd_vUnCom,
          a.nProd_vProd,
          a.nProd_vFrete,
          a.nVMLE,
          a.nProd_vSeg,
          a.nProd_vDesc,
          a.nProd_vOutro,
          a.jProd_indTot,
          a.sDI_nDI,               
          a.dDI_dDI,                
          a.sDI_xLocDesemb,        
          a.sDI_UFDesemb,           
          a.dDI_dDesemb,             
          a.sDI_cExportador,
          a.iAdi_nAdicao,          
          a.iAdi_nSeqAdic,         
          a.sAdi_cFabricante,      
          a.nAdi_vDescDI,          
          a.sAdi_xPed,             
          a.iAdi_nItemPed,
          a.nCIDE_qBCprod, 
          a.nCIDE_vAliqProd,
          a.nCIDE_vCIDE,
          a.jICMS_GrupoTrib,
          a.jICMS_orig,
          a.jICMS_modBC,
          a.nICMS_vBC,
          a.nICMS_pICMS,
          a.nICMS_vICMS,
          a.jICMS_modBCST,
          a.nICMS_pMVAST,
          a.nICMS_pRedBCST,
          a.nICMS_vBCST,
          a.nICMS_pICMSST,
          a.nICMS_vICMSST,
          a.nICMS_pRedBC,
          a.jICMS_motDesICMS,
          a.nICMS_vBCSTRet,
          a.nICMS_vICMSSTRet,
          a.jICMSPart_orig,
          a.jICMSPart_CST,
          a.jICMSPart_modBC,
          a.nICMSPart_vBC,
          a.nICMSPart_pRedBC,
          a.nICMSPart_pICMS,
          a.nICMSPart_vICMS,
          a.jICMSPart_modBCST,
          a.nICMSPart_pMVAST,
          a.nICMSPart_pRedBCT,
          a.nICMSPart_vBCST,
          a.nICMSPart_pICMSST,
          a.nICMSPart_vICMSST,
          a.nICMSPart_pBCOp,
          a.sICMSPart_UFST,
          a.jICMSST_orig,
          a.jICMSST_CST,
          a.nICMSST_vBCSTRet,
          a.nICMSST_vICMSSTRe,
          a.nICMSST_vBCSTDest,
          a.nICMSST_vICMSSTDes,
          a.jGrupo_simples,    
          a.jICMSSN_Orig,
          a.jICMSSN_CSOSN,
          a.nICMSSN_pCredSN,
          a.nICMSSN_vCredICMSSN,
          a.jICMSSN_modBCST,
          a.nICMSSN_pMVAST,
          a.nICMSSN_pRedBCST,
          a.nICMSSN_vBCST,
          a.nICMSSN_pICMSST,
          a.nICMSSN_vICMSST,
          a.nICMSSN_vBCSTRet,
          a.nICMSSN_vICMSSTRet,
          a.jICMSSN_modBC,
          a.nICMSSN_vBC,
          a.nICMSSN_pRedBC,
          a.nICMSSN_pICMS,
          a.nICMSSN_vICMS,
          a.sIPI_clEnq,
          a.sIPI_CNPJProd,
          a.sIPI_cSelo,
          a.nIPI_qSelo,
          a.sIPI_cEnq,
          a.jIPINT_CST,
          a.nIPITrib_vBC,
          a.nIPITrib_pIPI,
          a.nIPITrib_qUnid,
          a.nIPITrib_vUnid,
          a.nIPITrib_vIPI,
          a.nII_vBC,
          a.nII_vDespAdu,
          a.nII_vII,
          a.nII_vIOF,
          a.jPIS_CST,  
          a.nPIS_vBC,
          a.nPIS_pPIS,
          a.nPIS_vPIS,
          a.nPIS_qBCProd, 
          a.nPIS_vAliqProd, 
          a.nPISST_vBC,
          a.nPISST_pPIS,
          a.nPISST_qBCProd,
          a.nPISST_vAliqProd,
          a.nPISST_vPIS,
          a.jCOFINS_CST,
          a.nCOFINS_vBC,
          a.nCOFINS_pCOFINS,
          a.nCOFINS_vCOFINS,
          a.nCOFINS_qBCProd,
          a.nCOFINS_vAliqProd,
          a.nCOFINSST_vBC,
          a.nCOFINSST_pCOFINS,
          a.nCOFINSST_qBCProd,
          a.nCOFINSST_vAliqProd,
          a.nCOFINSST_vCOFINS,
          a.nISSQN_vBC,
          a.nISSQN_vAliq,
          a.nISSQN_vISSQN,
          a.nISSQN_cMunFG,
          a.nISSQN_cListServ,
          a.jISSQN_cSitTrib,
          a.sInfAdProd,
          a.jTipo,
          a.tEntPla, 
          a.tEmissao,
          a.tSaida,
          a.pItem,
          a.fItem,
          c.sCodigo     sRegCodItem,
          c.sDescricao  sRegDesItem,
          c.sCodigo     sNegCodItem,
          c.sDescricao  sNegDesItem,
          c.sCodigo     sTabCodItem,
          c.sDescricao  sTabDesItem,
          c.sCEST,
          c.fFoto,
          c.sFoto,
          a.pUni,
          a.fUni,
          e.sCodigo      sCodUni,
          e.sUnidade    sUni,
          a.pNCM,   
          a.fNCM,
          g.sCodigo     sCodNCM,
          g.sDescricao  sDesNCM,
          a.pCFO,   
          a.fCFO,
          h.sCodigo     sCodCFO,
          h.sAbrev,
          a.pLote,
          a.fLote,
          a.jFDiasEnt,
          a.iDiasInf,
          a.iDiasCalc,
          a.lInspecao,
          a.nDesc,
          a.pIPIRegFis,
          a.pICMSRegFis,        
          a.pICMSSNRegFis,        
          a.pICMSPartRegFis,        
          a.pICMSSTRetRegFis,
          a.pISSQNRegFis,       
          a.pIRPJRegFis,        
          a.pCofinsRegFis,      
          a.pPISRegFis,         
          a.pCofinsSTRegFis,    
          a.pPISSTRegFis,       
          a.pIIRegFis,
          a.fIIRegFis,
          a.fIPIRegFis,         
          a.fICMSRegFis,        
          a.fICMSSNRegFis,        
          a.fICMSPartRegFis,        
          a.fICMSSTRetRegFis,
          a.fISSQNRegFis,       
          a.fIRPJRegFis,        
          a.fCofinsRegFis,      
          a.fPISRegFis,         
          a.fCofinsSTRegFis,    
          a.fPISSTRegFis,       
          a.pPTOpEDItem,
          a.fPTOpEDItem,
          a.pPTOpEDGrpItem,
          a.fPTOpEDGrpItem,
          a.nPrBruto,
          a.nPrBruto1,
          a.nPrBruto2,
          a.nPrBruto3,
          a.nPrUV1,
          a.nPrUV2,
          a.nPrUV2,
          a.nQtUV1,
          a.nQtUV2,
          a.nQtUV3,
          a.nPDescCP,     
          a.nVDescCP,     
          a.nPDescTpED,   
          a.nVDescTpED,   
          a.nVEncFinTpED,   
          a.nPDescTpEDG,  
          a.nVDescTpEDG,  
          a.nPDescInc,    
          a.nVDescInc,    
          a.nProd_pDesc,  
          a.pMoe,    
          k.sDescricao      sMoe,
          a.fMoe,    
          a.nQtMoe,  
          a.jCam,
          a.pCam,
          a.fCam,    
          kk1.sDescricao  sMoeCambio,
          a.nCam,    
          a.sCam,    
          a.lCCusto,
          a.lCrtlItem,
          a.jOrig,
          a.jBC_II,
          a.jBC_IPI,
          a.jBC_ICMS,
          a.jBC_ICMSST,
          a.jBC_PIS,
          a.jBC_COFINS,
          a.jBC_ISS,
          a.jVl_ICMSST,
          a.jVl_ICMS,
          a.nBC_II,
          a.nBC_IPI,
          a.nBC_ICMS,
          a.nBC_ICMSST,
          a.nBC_PIS,
          a.nBC_COFINS,
          a.nBC_ISS,
          a.nVl_ICMSST,
          a.nVl_ICMS,
          a.nPEncFinTpED,
          a.nQtMin,     
          a.nQtMax,      
          a.nPrecoMin,  
          a.nPrecoMax,   
          a.lContQua,    
          a.lContPreco,  
          a.iCiclo,      
          a.iCicloAtual, 
          a.jTempo,      
          a.lSkipLote,
          a.pRegDepVen,
          a.fRegDepVen,
          b1.pDep,
          bb.pUFis,
          e1.sUFis      sUn1,
          f1.sUFis      sUn2,
          g1.sUFis      sUn3,
          h1.sUFis      sUn4,
          i1.sUFis      sUn5,
          j1.sUFis      sUn6,
          k1.sUFis      sUn7,
          l1.sDescricao sIns,
          c1.sCodigo    sUnidade,
          a.pRegDepRFis,
          a.fRegDepRFis,
          b2.pDep       pDepRFis,
          bbb.pUFis      pUFisRFis,
          e2.sUFis      sUn1RFis,
          f2.sUFis      sUn2RFis,
          g2.sUFis      sUn3RFis,
          h2.sUFis      sUn4RFis,
          i2.sUFis      sUn5RFis,
          j2.sUFis      sUn6RFis,
          k2.sUFis      sUn7RFis,
          l2.sDescricao sInsRFis,
          c2.sCodigo    sUnidadeRFis,
          a.lImport,
          a.lImposImpor,
          a.lAdicoes,
          a.lCIDE,   
          a.lICMS_ST,    
          a.lICMS_P,   
          a.lICMS_RR,   
          a.lICMS_SN,
          a.lIPI,       
          a.lPIS,    
          a.lPIS_ST,    
          a.lCofins, 
          a.lCofins_ST,
          a.lISSQN,
          a.lTranspFiscal,
          a.sFCI,
          a.jFinalidade,
          a.nAliqTranspImport,
          a.nAliqTranspNac,
          a.nTot_vTrib,
          a.jDI_tpViaTransp,
          a.nDI_vAFRMM,
          a.jDI_tpIntermedio,
          a.sDI_CNPJ,
          a.sDI_UFTerceiro,
          a.nImp_vTotTrib,
          a.nICMS_vICMSDeson,
          a.nICMS_vICMSOp,
          a.nICMS_pDif,
          a.nICMS_vICMSDif,
          a.nISSQN_vDeducao,
          a.nISSQN_vOutro,
          a.nISSQN_vDescIncond,
          a.nISSQN_vDescCond,
          a.nISSQN_vISSRet,
          a.jISSQN_indISS,
          a.sISSQN_cServico,
          a.sISSQN_nProcesso,
          a.lISSQN_indIncentivo,
          a.pISSQN_cServico,
          m.sCodigo       sISSQN_cServico,
          m.sDescricao    sISSQN_sServico,
          a.fISSQN_cServico,
          a.pISSQN_cMun,
          j.sCidade   sISSQN_sMun,
          j.iIBGE     sISSQN_cMun,
          a.pISSQN_cPais,
          l.sDescricao  sISSQN_sPais,
          l.sCodigo     sISSQN_cPais,
          a.fISSQN_cMun,
          a.fISSQN_cPais,
          a.nVBCUFDest,
          a.nPFCPUFDest,
          a.nPICMSUFDest,
          a.nPICMSInter,
          a.nPICMSInterPart,
          a.nVFCPUFDest,
          a.nVICMSUFDest,
          a.nVICMSUFRemet,
          a.pTabGrpP,
          a.fTabGrpP,
          a.pTabGrpPI,
          a.fTabGrpPI,
          a.iInLineSerial,
          a.nVDescLog,
          z.sCoringa
   from   Ordens_Itens   a left join Ordens        i   on a.pOrdem           = i.pPId and i.iVer = i.iVAt
                           left join Itens         c   on a.pItem            = c.pPId and c.iVer = c.iVAt 
                           left join UnidadeMedida e   on a.pUni             = e.pPId and ((i.tConf is null and e.iVer = e.iVAt) or (i.tConf is not null and e.iVer=a.fUni)) 
                           left join NCM           g   on a.pNCM             = g.pPId and ((i.tConf is null and g.iVer = g.iVAt) or (i.tConf is not null and g.iVer=a.fNCM))
                           left join CFO           h   on a.pCFO             = h.pPId and ((i.tConf is null and h.iVer = h.iVAt) or (i.tConf is not null and h.iVer=a.fCFO))
                           left join Moeda         k   on a.pMoe             = k.pPId and ((i.tConf is null and k.iVer = k.iVAt) or (i.tConf is not null and k.iVer=a.fMoe))
                           left join Cidades       j   on a.pISSQN_cMun      = j.pPId and ((i.tConf is null and j.iVer = j.iVAt) or (i.tConf is not null and j.iVer=a.fISSQN_cMun))
                           left join Paises        l   on a.pISSQN_cPais     = l.pPId and ((i.tConf is null and l.iVer = l.iVAt) or (i.tConf is not null and l.iVer=a.fISSQN_cPais))
                           left join TipoServico   m   on a.pISSQN_cServico  = m.pPId and ((i.tConf is null and m.iVer = m.iVAt) or (i.tConf is not null and m.iVer=a.fISSQN_cServico))
                           left join TabPrecos     r   on a.pTab             = r.pPId and ((i.tConf is null and r.iVer = r.iVAt) or (i.tConf is not null and r.iVer=a.fTab))
                           left join Cambio        kk  on a.pCam    = kk.pPId  and ((i.tConf is null and kk.iVer = kk.iVAt) or (i.tConf is not null and kk.iVer=a.fCam))
                           left join Moeda         kk1 on kk.pMoe2  = kk1.pPId and ((i.tConf is null and kk1.iVer = kk1.iVAt) or (i.tConf is not null and kk1.iVer=a.fCam))
                           left join EST_RegDepositos   b1 on a.pRegDepVen     = b1.pPId    and ((i.tConf is null and b1.iVer = b1.iVAt) or (i.tConf is not null and  b1.iVer = a.fRegDepVen))
                           left join EST_Depositos      bb on b1.pDep          = bb.pPId    and bb.iVer = bb.iVAt
                           left join UFis               e1 on bb.pUFis         = e1.pPId    and e1.iVer = e1.iVAt
                           left join UFis               f1 on e1.pParent       = f1.pPId    and f1.iVer = f1.iVAt
                           left join UFis               g1 on f1.pParent       = g1.pPId    and g1.iVer = g1.iVAt
                           left join UFis               h1 on g1.pParent       = h1.pPId    and h1.iVer = h1.iVAt
                           left join UFis               i1 on h1.pParent       = i1.pPId    and i1.iVer = i1.iVAt
                           left join UFis               j1 on i1.pParent       = j1.pPId    and j1.iVer = j1.iVAt
                           left join UFis               k1 on j1.pParent       = k1.pPId    and k1.iVer = k1.iVAt
                           left join EST_Instancias     l1 on b1.pIns          = l1.pPId    and l1.iVer = l1.iVAt
                           left join UnidadeMedida      c1 on b1.pUni          = c1.pPId    and c1.iVer = c1.iVAt
                           left join EST_RegDepositos   b2  on a.pRegDepRFis    = b2.pPId    
                           left join EST_Depositos      bbb on b2.pDep          = bbb.pPId   and bbb.iVer = bbb.iVAt
                           left join UFis               e2  on bbb.pUFis        = e2.pPId    and e2.iVer = e2.iVAt
                           left join UFis               f2  on e2.pParent       = f2.pPId    and f2.iVer = f2.iVAt
                           left join UFis               g2  on f2.pParent       = g2.pPId    and g2.iVer = g2.iVAt
                           left join UFis               h2  on g2.pParent       = h2.pPId    and h2.iVer = h2.iVAt
                           left join UFis               i2  on h2.pParent       = i2.pPId    and i2.iVer = i2.iVAt
                           left join UFis               j2  on i2.pParent       = j2.pPId    and j2.iVer = j2.iVAt
                           left join UFis               k2  on j2.pParent       = k2.pPId    and k2.iVer = k2.iVAt
                           left join EST_Instancias     l2  on b2.pIns          = l2.pPId    and l2.iVer = l2.iVAt
                           left join UnidadeMedida      c2  on b2.pUni          = c2.pPId    and c2.iVer = c2.iVAt,
          CUP            z
   where a.pPId = {pId}
     and a.iVer = {a.iVer}
     and a.pInc = z.pPId and z.iVer = z.iVAt
</DbToVars1>
<1>
   select a.pPId       pOrdens_Item_CCusto_i,
          b.pPId       pCCusto_i,
          a.fCCusto    fCCusto_i,
          b.sCCUsto    sCCusto_i,
          a.nRatCCusto nRatCCusto_i
   from Ordens_Item_CCusto a,
        CCusto             b
   where a.iVer       = a.iVAt
     and a.lExc       = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.pCCusto    = b.pPId
     and b.iVer       = b.iVAt
  order by b.sCCUsto
</1>
<2>
   select a.pPId           pOrdens_Item_CContCred_i,
          e.pPId           pCContCred_i,
          a.fCPla          fCContCred_i,
          e.sCodigo        sCodCredPla_i,
          e.sDescricao     sDesCredPla_i,
          a.nRatCredCCont  nRatCredCCont_i
   from Ordens_Item_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = e.iVAt
   where a.iVer  = a.iVAt
     and a.lExc  = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.lDeb  = 0
   order by e.sCodigo,e.sDescricao
</2>
<3>
   select a.pPId          pOrdens_Item_CContDeb_i,
          e.pPId          pCContDeb_i,
          a.fCPla         fCContDeb_i,
          e.sCodigo       sCodDebPla_i,
          e.sDescricao    sDesDebPla_i,
          a.nRatDebCCont  nRatDebCCont_i
   from Ordens_Item_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = e.iVAt
   where a.iVer       = a.iVAt
     and a.lExc       = 0
     and a.pOrdemItem = {ChaveAtual_0}
     and a.lDeb  = 1
   order by e.sCodigo,e.sDescricao
</3>
<VarsDefault1>
   sVerVAt = {pPId+'-'+iVer+'/'+iVAt}
   sRastro = {sVerVAt+', '+sCoringa+', '+tInc}
   lRastro = 0
   pOrdem      = {ChaveAtual_1}
   pTOper      = {ChaveIrma_1_0}
   sMoeCapa    = {ChaveIrma_1_1}
   dEntPla     = {ChaveIrma_1_2}
   jEntSai     = {ChaveIrma_1_3}
   pEmi        = {ChaveIrma_1_4}
   pDest       = {ChaveIrma_1_5}
   pDestDefault = 36669 
   nDescFin    = {ChaveIrma_1_6} 
   nDFin       = {ChaveIrma_1_7}
   pCapaMoe    = {ChaveIrma_1_8} 
   jBC_PIS     = {ChaveIrma_1_9};
   jBC_COFINS  = {ChaveIrma_1_10};
   jBC_ICMS    = {ChaveIrma_1_11};
   jBC_IPI     = {ChaveIrma_1_12};
   jBC_ICMSST  = {ChaveIrma_1_13};
   jBC_II      = {ChaveIrma_1_14};
   jBC_ISS     = {ChaveIrma_1_15};
   jVl_ICMSST  = {ChaveIrma_1_16};
   jVl_ICMS    = {ChaveIrma_1_17};
   lFinanc     = {ChaveIrma_1_18}
   nPDescLog   = {ChaveIrma_1_22} 
   sDest       = {ChaveIrma_1_23}
   aEntSai = yEntrada (Compra),Sada (Venda),Entrada/Sada,Transferncia
   mInfAdProd = {sInfAdProd}
   aPriori = Muito Baixa,Baixa,Normal,Alta,Muito Alta
   aTipo   = Manual,Negociao,Tabela de Preo,Cotao,Web Net
   aProd_indTot      = 0-Valor item no compe valor total , 1-Valor item compe valor total
   aICMS_GrupoTrib   = 00-Tributada integralmente, 10-Tributada com cobrana ICMS substituio tributria ,20-Com reduo de base de clculo , 30-Isenta/no tributada com cobrana ICMS substituio tributria ,40-Isenta ,41-No Tributada, 50-Suspenso , 51-Diferimento , 60-ICMS cobrado anteriormente por substituio tributria , 70-Com reduo base clculo e cobrana do ICMS substituio tributria , 90-Outros
   aICMS_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMS_modBC       = 0-Margem Valor Agregado(%), 1-Pauta(Valor), 2-Preo Tabelado Mx(Valor), 3-Valor Operao  
   aICMS_modBCST     = 0-Preo Tabelado ou Mximo Sugerido, 1-Lista Negativa(Valor), 2-Lista Positiva(valor), 3-Lista Neutra(valor), 4-Margem Valor Agregado(%), 5-Pauta(valor)  
   aICMSPart_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSPart_CST     = 10-Tributada com cobrana ICMS por substituio, 90-Outros
   aICMSPart_modBC   = 0-Margem Valor Agregado (%), 1-Pauta (Valor), 2-Preo Tabelado Mx (valor) 
   aICMSPart_modBCST = 0 Preo tabelado ou mximo sugerido, 1-Lista Negativa (valor), 2-Lista Positiva (valor), 3-Lista Neutra (valor), 4-Margem Valor Agregado(%), 5-Pauta (valor) 
   aOrig             = 0-Nac exceto as indicadas nos cdigos 3 a 5,1-Est Importao direta- exceto a indicada no cdigo 6,2-Est Adquirida no mercado interno- exceto a indicada no cdigo 7,3-Nac mercadoria ou bem com Contedo de Importao superior a 40%,4-Nac c/ produo feita em conformidade com os processos produtivos bsicos,5-Nac mercadoria/bem c/ Contedo de Importao- inferior ou igual a 40%,6-Est Importao direta- sem similar nacional- constante na Camex,7-Est Adquirida no mercado interno - sem similar nacional-constante na Camex,8-Nacional - mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSST_orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSST_CST   = 41=No Tributado,60=cobrado anteriormente por substituio tributria
   aGrupo_simples    = Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=101 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=102 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=103 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=201 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=202 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=203 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=300 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=400 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=500 , Tributao do ICMS pelo SIMPLES NACIONAL e CSOSN=900 
   aICMSSN_Orig = 0-Nacional exceto as indicadas nos cdigos 3 4 5 e 8,1-Estrangeira-Importao direta exceto a indicada no cdigo 6,2-Estrangeira-Adquirida mercado interno exceto a indicada no cdigo 7,3-Nacional-mercadoria ou bem com Contedo de Importao superior a 40% e inferior ou igual a 70%,4-Nacional-cuja produo tenha sido feita em conformidade com os processos produtivos bsicos de que tratam as legislaes citadas nos Ajustes,5-Nacional-mercadoria ou bem com Contedo de Importao inferior ou igual a 40%,6-Estrangeira-Importao direta sem similar nacional constante em lista da CAMEX e gs natural,7-Estrangeira-Adquirida no mercado interno sem similar nacional constante lista CAMEX e gs natural.,8-Nacional-mercadoria ou bem com Contedo de Importao superior a 70%
   aICMSSN_CSOSN     = 101-Tributada com permisso de crdito , 102-Tributada sem permisso de crdito , 103-Iseno para faixa de receita bruta , 201-Tributada com permisso de crdito com cobrana do ICMS por Substituio Tributria , 202-Tributada sem permisso de crdito com cobrana do ICMS por Substituio Tributria , 203-Iseno para faixa de receita bruta com cobrana do ICMS por Substituio Tributria , 300-Imune , 400-No tributada , 500-ICMS cobrado anteriormente por substituio tributria ou por antecipao, 900-Outros
   aICMSSN_modBCST   = 0-Preo Tabelado ou Mximo Sugerido, 1-Lista Negativa(Valor), 2-Lista Positiva(valor), 3-Lista Neutra(valor),4 - Margem Valor Agregado (%),5 - Pauta (valor) (v.2.0)
   aICMSSN_modBC     = 0-Margem Valor Agregado(%), 1-Pauta(Valor), 2-Preo Tabelado Mx(Valor), 3-Valor Operao , 4-Margem Valor Agregado(%), 5-Pauta (valor)
   aIPINT_CST        = 00-Entrada com recuperao de crdito, 01-Entrada tributada com alquota zero, 02-Entrada isenta, 03-Entrada no-tributada, 04-Entrada imune, 05-Entrada com suspenso,49-Outras entradas, 50-Sada tributada, 51-Sada tributada com alquota zero, 52-Sada isenta, 53-Sada no-tributada, 54-Sada imune, 55-Sada com suspenso, 99-Outras sadas
   aPIS_CST          = 01-Operao Tributvel(base de clculo = valor da operao alquota normal(cumulativo/no cumulativo)), 02-Operao Tributvel(base de clculo = valor da operao(alquota diferenciada)), 03 - Operao Tributvel (base de clculo = quantidade vendida x alquota por unidade de produto), 04-Operao Tributvel(tributao monofsica(alquota zero)), 06-Operao Tributvel(alquota zero), 07-Operao Isenta da Contribuio, 08-Operao Sem Incidncia da Contribuio, 09-Operao com Suspenso da Contribuio, 99-Outras Operaes
   aCOFINS_CST       = 01-Operao Tributvel(base de clculo = valor da operao alquota normal(cumulativo/no cumulativo)), 02-Opera Tributvel(base de clculo = valor da operao(alquota diferenciada)), 03-Operao Tributvel (base de clculo = quantidade vendida x alquota por unidade de produto), 04-Operao Tributvel(tributao monofsica(alquota zero)), 06-Operao Tributvel(alquota zero), 07-Operao Isenta da Contribuio, 08-Operao Sem Incidncia da Contribuio, 09-Operao com Suspenso da Contribuio, 99-Outras Operaes                       
   aISSQN_cSitTrib   = N=NORMAL, R=RETIDA, S=SUBSTITUTA, I=ISENTA         
   aFDiasEnt         = Calculado,Informado 
   jProd_indTot      = 1;
   iDesc1            = %
   iDesc2            = Valor
   iDesc3            = VL/UN
   aCam    = 1-Data Emissao da Ordem,2-Data Emisso da NFe,3-Data Emisso da NFe -1
   aBC        = Calculada, Informada
   nVTCI = {nProd_vProd+nProd_vFrete+nProd_vSeg+nII_vII}
   aTempo  = Diario,Semanal,Mensal,Bimestral,Semestral,Anual
   aFinalidade = Outros Fins,Uso e Consumo,Complemento de Impostos
   aDI_tpViaTransp    = 1=Martima,Nota Fiscal eletrnica,2=Fluvial,3=Lacustre,4=Area,5=Postal,6=Ferroviria,7=Rodoviria,8=Conduto / Rede Transmisso,9=Meios Prprios,10=Entrada / Sada ficta,11=Courier,12=Handcarry
   aDI_tpIntermedio   = 1=Importao por conta prpria,2=Importao por conta e ordem,3=Importao por encomenda
   aISSQN_indISS      = 1=Exigvel, 2=No incidncia, 3=Iseno, 4=Exportao, 5=Imunidade, 6=Exigibilidade Suspensa por Deciso Judicial, 7=Exigibilidade Suspensa por Processo Administrativo 
   aICMS_motDesICMS  = 1-Txi, 2-Deficiente Fsico, 3-Produtor Agropecurio, 4-Frotista/Locadora, 5-Diplomtico/Consular, 6-Utilitrios/Motocicletas reas de Livre Comrcio CONTRAN suas alteraes, 7-SUFRAMA, 9-Outros,10=Deficiente Condutor, 11=Deficiente No Condutor
   aICMS_motDesICMS20 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   aICMS_motDesICMS30 = 6=Utilitrios e Motocicletas da Amaznia Ocidental e reas de Livre Comrcio, 7=SUFRAMA, 9=Outros
   aICMS_motDesICMS40 = 1=Txi, 2=Deficiente Fsico *** Eliminado***, 3=Produtor Agropecurio,4=Frotista/Locadora,5=Diplomtico/Consular,6=Utilitrios e Motocicletas da Amaznia Ocidental ereas de Livre Comrcio,7=SUFRAMA, 8=Venda a rgo Pblico, 9=Outros, 10=Deficiente Condutor, 11=Deficiente No Condutor
   aICMS_motDesICMS70 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   aICMS_motDesICMS90 = 3=Uso na agropecuria, 9=Outros, 12=rgo de fomento e desenvolvimento agropecurio
   iQt = {nQt}
   lRastro = 1
</VarsDefault1>
<ScriptForm1>
   Rastreabilidade                           ; lRastro-5                         ; fontweight='bold' ; edtzoom=true ;  visible=(sDDFTagApl!='Padrao_3')
   Verso                                    ; sRastro-60                        ; identlabel=5      ; editable=false ; visible=((iDDFChamada>0)&&(lRastro==1)&&(sDDFTagApl!='Padrao_3')) ; 
   ;
   <img style='width: 80_ height 80_' src='../{sCliPasta}/FotosItens/imgItem{pItem}-{fFoto}{sFoto}'> ;; identlabel=5 ; colspan=true ; visible=(fFoto>0);
   Item                                      ; sRegCodItem-20                    ; identlabel=5      ; visible=((jTipo==0)||(jTipo==3)||(jTipo==4)) ; esc=('dd_files/erp_PTOpED_Item.dda','Esc_Padrao_1a','sRegCodItem,pTOper,pEmi,pDest,pOrdem,pDestDefault','pPTOpEDItem,fPTOpEDItem,pItem,fItem,sRegCodItem,sRegDesItem,sEAN,sGTIN,jICMS_Orig,pUni,fUni,sCodUni,sUni,pNCM,fNCM,sCodNCM,sDesNCM,jFDiasEnt,iDiasInf,iDiasCalc,lInspecao,nPDescTpEDG,jCam,sMoe,pMoe,fMoe,lCCusto,lCrtlItem,stmp,nPEncFinTpED,lContQua,nQtMin,nQtMax,lContPreco,nPrecoMin,nPrecoMax,iCiclo,iCicloAtual,lSkipLote,stmp,pRegDepVen,fRegDepVen,pDep,pUFis,sUn1,sUn2,sUn3,sUn4,sUn5,sUn6,sUn7,sIns,pRegDepRFis,fRegDepRFis,pDepRFis,pUFisRFis,sUn1RFis,sUn2RFis,sUn3RFis,sUn4RFis,sUn5RFis,sUn6RFis,sUn7RFis,sInsRFis,jFinalidade,nAliqTranspImport,nAliqTranspNac,sCEST,nQtUV1,nQtUV2,nQtUV3,nPrUV1,nPrUV2,nPrUV3,nPrBruto1,nPrBruto2,nPrBruto3,nPrBruto,pTmp1_{1},pCCusto_{1},fCCusto_{1},sCCusto_{1},nRatCCusto_{1},pTmp2_{2},pCContCred_{2},fCContCred_{2},sCodCredPla_{2},sDesCredPla_{2},nRatCredCCont_{2},pTmp3_{3},pCContDeb_{3},fCContDeb_{3},sCodDebPla_{3},sDesDebPla_{3},nRatDebCCont_{3}') ; exec=(this.flSetVar('nPrBruto','')&& this.flSetVar('iQt','')&& this.flSetVar('nVDescCP','0,00000')&& this.flSetVar('nVDescTpED','0,00000')&& this.flSetVar('nVEncFinED','0,00000')&& this.flSetVar('nVEncFinTpED','0,00000')&& this.flSetVar('nVDescTpEDG','0,00000')&& this.flSetVar('nQtMoe','0,00000')&& this.flSetVar('sMoeCambio','')&& this.flSetVar('pCam',0)&& this.flSetVar('fCam',0)&& this.flSetVar('nCam','0,00000')&& this.flSetVar('sCam','')&& this.flSetVar('nProd_vUnCom','0,00000')&& this.flSetVar('nProd_vFrete','0,00')&& this.flSetVar('nVMLE','0,00')&& this.flSetVar('nProd_vSeg','0,00')&& this.flSetVar('nProd_vDesc','0,00000')&& this.flSetVar('nProd_vProd','0,00')&& this.flSetVar('pCFO',0)&& this.flSetVar('sCodCFO','')&& this.flSetVar('sAbrev','')&& this.flSetVar('fCFO',0)&& this.flSetVar('tEntPla','')&& this.flSetVar('tEmissao','')&& this.flSetVar('tSaida ','')&& this.flSetVar('sDI_nDI','')&& this.flSetVar('dDI_dDI','')&& this.flSetVar('sDI_xLocDesemb','')&& this.flSetVar('sDI_UFDesemb','')&& this.flSetVar('dDI_dDesemb','')&& this.flSetVar('sDI_cExportador','')&& this.flSetVar('nII_vBC','0,00')&& this.flSetVar('nII_vDespAdu','0,00')&& this.flSetVar('nII_vII','0,00')&& this.flSetVar('nII_vIOF','0,00')&& this.flSetVar('iAdi_nAdicao',0)&& this.flSetVar('iAdi_nSeqAdic',0)&& this.flSetVar('sAdi_cFabricante','')&& this.flSetVar('nAdi_vDescDI','0,00000')&& this.flSetVar('sAdi_xPed','')&& this.flSetVar('iAdi_nItemPed',0)&& this.flSetVar('nCIDE_qBCprod','0,00')&& this.flSetVar('nCIDE_vAliqProd','0,00')&& this.flSetVar('nCIDE_vCIDE','0,00')&& this.flSetVar('jICMS_GrupoTrib',0)&& this.flSetVar('jICMS_orig',0)&& this.flSetVar('jICMS_modBC',0)&& this.flSetVar('nICMS_pRedBC','0,00')&& this.flSetVar('nICMS_vBC','0,00')&& this.flSetVar('nICMS_pICMS','0,00')&& this.flSetVar('nICMS_vICMS','0,00')&& this.flSetVar('jICMS_modBCST',0)&& this.flSetVar('nICMS_pMVAST','0,00')&& this.flSetVar('nICMS_pRedBCST','0,00')&& this.flSetVar('nICMS_vBCST','0,00')&& this.flSetVar('nICMS_pICMSST','0,00')&& this.flSetVar('nICMS_vICMSST','0,00')&& this.flSetVar('nICMS_vBCSTRet','0,00')&& this.flSetVar('nICMS_vICMSSTRet','0,00')&& this.flSetVar('jICMS_motDesICMS',0)&& this.flSetVar('jICMSPart_orig',0)&& this.flSetVar('jICMSPart_CST',0)&& this.flSetVar('jICMSPart_modBC',0)&& this.flSetVar('nICMSPart_vBC','0,00')&& this.flSetVar('nICMSPart_pRedBC','0,00')&& this.flSetVar('nICMSPart_pICMS','0,00')&& this.flSetVar('nICMSPart_vICMS','0,00')&& this.flSetVar('jICMSPart_modBCST',0)&& this.flSetVar('nICMSPart_pMVAST','0,00')&& this.flSetVar('nICMSPart_pRedBCT','0,00')&& this.flSetVar('nICMSPart_vBCST','0,00')&& this.flSetVar('nICMSPart_pICMSST','0,00')&& this.flSetVar('nICMSPart_vICMSST','0,00')&& this.flSetVar('nICMSPart_pBCOp','0,00')&& this.flSetVar('sICMSPart_UFST','')&& this.flSetVar('jICMSST_orig',0)&& this.flSetVar('jICMSST_CST',0)&& this.flSetVar('nICMSST_vBCSTRet','0,00')&& this.flSetVar('nICMSST_vICMSSTRe','0,00')&& this.flSetVar('nICMSST_vBCSTDest','0,00')&& this.flSetVar('nICMSST_vICMSSTDes','0,00')&& this.flSetVar('jGrupo_simples',0)&& this.flSetVar('jICMSSN_Orig',0)&& this.flSetVar('jICMSSN_CSOSN',0)&& this.flSetVar('jICMSSN_modBC',0)&& this.flSetVar('nICMSSN_vBC','0,00')&& this.flSetVar('nICMSSN_pRedBC','0,00')&& this.flSetVar('nICMSSN_pICMS','0,00')&& this.flSetVar('nICMSSN_vICMS','0,00')&& this.flSetVar('jICMSSN_modBCST',0)&& this.flSetVar('nICMSSN_pMVAST','0,00')&& this.flSetVar('nICMSSN_pRedBCST','0,00')&& this.flSetVar('nICMSSN_vBCST','0,00')&& this.flSetVar('nICMSSN_pICMSST','0,00')&& this.flSetVar('nICMSSN_vICMSST','0,00')&& this.flSetVar('nICMSSN_pCredSN','0,00')&& this.flSetVar('nICMSSN_vCredICMSSN','0,00')&& this.flSetVar('nICMSSN_vBCSTRet','0,00')&& this.flSetVar('nICMSSN_vICMSSTRet','0,00')&& this.flSetVar('sIPI_clEnq','')&& this.flSetVar('sIPI_CNPJProd','')&& this.flSetVar('sIPI_cSelo','')&& this.flSetVar('nIPI_qSelo','0,00')&& this.flSetVar('sIPI_cEnq','')&& this.flSetVar('jIPINT_CST',0)&& this.flSetVar('nIPITrib_vBC','0,00')&& this.flSetVar('nIPITrib_pIPI','0,00')&& this.flSetVar('nIPITrib_qUnid','0,00')&& this.flSetVar('nIPITrib_vUnid','0,00')&& this.flSetVar('nIPITrib_vIPI','0,00')&& this.flSetVar('jPIS_CST',0)&& this.flSetVar('nPIS_vBC','0,00')&& this.flSetVar('nPIS_pPIS','0,00')&& this.flSetVar('nPIS_qBCProd','0,00')&& this.flSetVar('nPIS_vAliqProd','0,00')&& this.flSetVar('nPIS_vPIS','0,00')&& this.flSetVar('nPISST_vBC','0,00')&& this.flSetVar('nPISST_pPIS','0,00')&& this.flSetVar('nPISST_qBCProd','0,00')&& this.flSetVar('nPISST_vAliqProd','0,00')&& this.flSetVar('nPISST_vPIS','0,00')&& this.flSetVar('jCOFINS_CST',0)&& this.flSetVar('nCOFINS_vBC','0,00')&& this.flSetVar('nCOFINS_pCOFINS','0,00')&& this.flSetVar('nCOFINS_qBCProd','0,00')&& this.flSetVar('nCOFINS_vAliqProd','0,00')&& this.flSetVar('nCOFINS_vCOFINS','0,00')&& this.flSetVar('nCOFINSST_vBC','0,00')&& this.flSetVar('nCOFINSST_pCOFINS','0,00')&& this.flSetVar('nCOFINSST_qBCProd','0,00')&& this.flSetVar('nCOFINSST_vAliqProd','0,00')&& this.flSetVar('nCOFINSST_vCOFINS','0,00')&& this.flSetVar('nISSQN_vBC','0,00')&& this.flSetVar('nISSQN_vAliq','0,00')&& this.flSetVar('nISSQN_vISSQN','0,00')&& this.flSetVar('nISSQN_cMunFG','0,00')&& this.flSetVar('nISSQN_cListServ','0,00')&& this.flSetVar('jISSQN_cSitTrib',0)&& this.flSetVar('mInfAdProd','')&& this.flSetVar('nVDescInc','0,00')&& this.flSetVar('pLote',0)&& this.flSetVar('fLote',0)&& this.flSetVar('sLote','')) 
   Qtde Pedida                               ; iQt-10                            ; identlabel=5      ; exec=(this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))) ; valid=(iQt*nPrBruto>0,'Os campos quantidade e preos devem ser preenchidas') ; valid=(nQt==parseInt(nQt),'A quantidade deve ser um numero inteiro')
   Unidade Medida                            ; sCodUni-10                        ; identlabel=5      ; editable=false     ;
   ;
   Valor [UN] Bruto                          ; nPrBruto-12-5                     ; identlabel=5      ; exec=(this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))&& this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5))&& this.flSetVar('nVDescTpED',fsReplaceDecimalPoint((nPrBruto/100*nDescFin),".",",",5))&& this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint((nPrBruto/100*nPDescTpEDG),".",",",5))&& this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))&& this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))&& this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5)))
   [%] Desconto Incondicional [UN]           ; nPDescInc-12-5                    ; identlabel=5      ; exec=(this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))&& this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5))&& this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))&& this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))&& this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))) 
   [$] Desconto Incondicional [UN]           ; nVDescInc-12-5                    ; identlabel=5      ; editable=false ; 
   ;
   Valor [UN] Comercial c/Desconto           ; nProd_vUnCom-12-5                 ; editable=false    ; identlabel=5 ;
   Valor [Total] Comercial                   ; nProd_vProd-12-5                  ; editable=false    ; identlabel=5 
   ;
   Qtde Ult Ped (1),(2),(3)                  ; nQtUV1-7-5,nQtUV2-7-5,nQtUV3-7-5                      ; identlabel=5      ; editable=false ; 
   ;
</ScriptForm1>
<VarsToServer1>
   pPId
   iVer
   pPTOpEDItem
   fPTOpEDItem
   pOrdem   = {ChaveAtual_1}
   nQtMoe
   pCam  
   fCam  
   pMoe  
   fMoe  
   nCam  
   sCam
   jCam
   iInLineSerial = iInLineSerial+1
   nVBCUFDest
   nPFCPUFDest
   nPICMSUFDest
   nPICMSInter
   nPICMSInterPart
   nVFCPUFDest
   nVICMSUFDest
   nVICMSUFRemet
   jDI_tpViaTransp    
   nDI_vAFRMM         
   jDI_tpIntermedio   
   sDI_CNPJ           
   sDI_UFTerceiro     
   nImp_vTotTrib      
   nICMS_vICMSDeson   
   nICMS_vICMSOp      
   nICMS_pDif         
   nICMS_vICMSDif     
   nISSQN_vDeducao    
   nISSQN_vOutro      
   nISSQN_vDescIncond 
   nISSQN_vDescCond   
   nISSQN_vISSRet     
   jISSQN_indISS      
   pISSQN_cServico    
   fISSQN_cServico    
   pISSQN_cMun        
   pISSQN_cPais       
   fISSQN_cMun        
   fISSQN_cPais       
   sISSQN_nProcesso   
   lISSQN_indIncentivo
   jFinalidade
   sFCI
   nVDescLog
   pRegDepVen
   fRegDepVen
   lImport     
   lImposImpor 
   lAdicoes    
   lCIDE       
   lICMS_ST    
   lICMS_P     
   lICMS_RR    
   lICMS_SN    
   lIPI        
   lPIS        
   lPIS_ST     
   lCofins     
   lCofins_ST  
   lISSQN      
   lTranspFiscal
   nTot_vTrib 
   nAliqTranspImport
   nAliqTranspNac   
   pRegDepRFis
   fRegDepRFis
   jBC_PIS
   jBC_COFINS
   jBC_ICMS
   jBC_IPI
   jBC_ICMSST
   jBC_II
   jBC_ISS
   jVl_ICMSST
   jVl_ICMS
   nBC_ICMS
   nBC_COFINS
   nBC_PIS
   nBC_IPI
   nBC_ICMSST
   nBC_II
   nBC_ISS
   nVl_ICMSST
   nVl_ICMS
   nPEncFinTpED
   lCCusto  
   lCrtlItem
   jOrig
   iSerial
   jFDiasEnt
   iDiasInf
   iDiasCalc
   pItem 
   pUni         
   fUni
   pNeg          = jTipo==0 ? 1  : pNeg  
   fNeg          = jTipo==0 ? 1  : fNeg  
   pTab  = 0        
   fTab  = 0        
   pTabI = 0        
   fTabI = 0        
   pTabGrpP = 0
   fTabGrpP = 0
   pTabGrpPI= 0
   fTabGrpPI= 0
   pNCM    
   fNCM    
   pCFO    
   fCFO    
   jTipo
   nQt = iQt
   tEntPla 
   tEmissao
   tSaida
   pItem
   fItem
   nDesc
   nQtMin
   nQtMax
   nPrecoMin
   nPrecoMax
   lContQua
   lContPreco
   iCiclo
   iCicloAtual
   jTempo
   lSkipLote
   nPrBruto
   nPDescCP = nDFin
   nVDescCP
   nPDescTpED = nDescFin
   nVDescTpED
   nVEncFinTpED
   nPDescTpEDG
   nVDescTpEDG
   nPDescInc
   nVDescInc
   nProd_pDesc
   pPTOpEDGrpItem
   fPTOpEDGrpItem
   pLote
   fLote
   nProd_vUnCom
   nProd_vProd
   nProd_vFrete
   nVMLE
   nProd_vSeg
   nProd_vDesc
   nProd_vOutro
   jProd_indTot
   sDI_nDI               
   dDI_dDI               
   sDI_xLocDesemb        
   sDI_UFDesemb          
   dDI_dDesemb           
   sDI_cExportador  
   iAdi_nAdicao          
   iAdi_nSeqAdic         
   sAdi_cFabricante      
   nAdi_vDescDI          
   sAdi_xPed             
   iAdi_nItemPed
   nCIDE_qBCprod
   nCIDE_vAliqProd
   nCIDE_vCIDE
   jICMS_GrupoTrib    
   jICMS_orig
   jICMS_modBC
   nICMS_vBC
   nICMS_pICMS
   nICMS_vICMS
   jICMS_modBCST
   nICMS_pMVAST
   nICMS_pRedBCST
   nICMS_vBCST
   nICMS_pICMSST
   nICMS_vICMSST
   nICMS_pRedBC
   jICMS_motDesICMS
   nICMS_vBCSTRet
   nICMS_vICMSSTRet
   jICMSPart_orig
   jICMSPart_CST
   jICMSPart_modBC
   nICMSPart_vBC
   nICMSPart_pRedBC
   nICMSPart_pICMS
   nICMSPart_vICMS
   jICMSPart_modBCST
   nICMSPart_pMVAST
   nICMSPart_pRedBCT
   nICMSPart_vBCST
   nICMSPart_pICMSST
   nICMSPart_vICMSST
   nICMSPart_pBCOp
   sICMSPart_UFST
   jICMSST_orig
   jICMSST_CST
   nICMSST_vBCSTRet
   nICMSST_vICMSSTRe
   nICMSST_vBCSTDest
   nICMSST_vICMSSTDes
   jGrupo_simples
   jICMSSN_Orig
   jICMSSN_CSOSN
   nICMSSN_pCredSN
   nICMSSN_vCredICMSSN
   jICMSSN_modBCST
   nICMSSN_pMVAST
   nICMSSN_pRedBCST
   nICMSSN_vBCST
   nICMSSN_pICMSST
   nICMSSN_vICMSST
   nICMSSN_vBCSTRet
   nICMSSN_vICMSSTRet
   jICMSSN_modBC
   nICMSSN_vBC
   nICMSSN_pRedBC
   nICMSSN_pICMS
   nICMSSN_vICMS
   sIPI_clEnq
   sIPI_CNPJProd
   sIPI_cSelo   
   nIPI_qSelo   
   sIPI_cEnq    
   jIPINT_CST      
   nIPITrib_vBC 
   nIPITrib_pIPI
   nIPITrib_qUnid
   nIPITrib_vUnid
   nIPITrib_vIPI 
   nII_vBC 
   nII_vDespAdu
   nII_vII     
   nII_vIOF    
   jPIS_CST  
   nPIS_vBC 
   nPIS_pPIS 
   nPIS_vPIS 
   nPIS_qBCProd 
   nPIS_vAliqProd 
   nPISST_vBC 
   nPISST_pPIS
   nPISST_qBCProd 
   nPISST_vAliqProd
   nPISST_vPIS
   jCOFINS_CST  
   nCOFINS_vBC  
   nCOFINS_pCOFINS 
   nCOFINS_vCOFINS 
   nCOFINS_qBCProd
   nCOFINS_vAliqProd
   nCOFINSST_vBC
   nCOFINSST_pCOFINS
   nCOFINSST_qBCProd
   nCOFINSST_vAliqProd
   nCOFINSST_vCOFINS
   nISSQN_vBC
   nISSQN_vAliq
   nISSQN_vISSQN
   nISSQN_cMunFG
   nISSQN_cListServ
   jISSQN_cSitTrib
   sInfAdProd = mInfAdProd
   pOrdens_Item_CCusto_{i}
   pCCusto_{i}
   fCCusto_{i}
   nRatCCusto_{i}
   pOrdens_Item_CContCred_{i}
   pCContCred_{i}
   fCContCred_{i}
   nRatCredCCont_{i}
   pOrdens_Item_CContDeb_{i}
   pCContDeb_{i}
   fCContDeb_{i}
   nRatDebCCont_{i}
</VarsToServer1>
<VarsToDb1>  
   sDDFTabela = Ordens_Itens
   aSerial[]  = 'OSa_{ChaveAtual_1}'
   iSerial    = $aSerial[0]
   pPTOpEDItem
   fPTOpEDItem
   nQtMoe
   pCam  
   fCam 
   pMoe
   fMoe
   nCam
   sCam
   jCam
   nVBCUFDest
   nPFCPUFDest
   nPICMSUFDest
   nPICMSInter
   nPICMSInterPart
   nVFCPUFDest
   nVICMSUFDest
   nVICMSUFRemet
   pRegDepVen
   fRegDepVen
   sFCI
   pRegDepRFis
   fRegDepRFis
   iInLineSerial
   jDI_tpViaTransp    
   nDI_vAFRMM         
   jDI_tpIntermedio   
   sDI_CNPJ           
   sDI_UFTerceiro     
   nImp_vTotTrib      
   nICMS_vICMSDeson   
   nICMS_vICMSOp      
   nICMS_pDif         
   nICMS_vICMSDif     
   nISSQN_vDeducao    
   nISSQN_vOutro      
   nISSQN_vDescIncond 
   nISSQN_vDescCond   
   nISSQN_vISSRet     
   jISSQN_indISS      
   pISSQN_cServico    
   fISSQN_cServico    
   pISSQN_cMun        
   pISSQN_cPais       
   fISSQN_cMun        
   fISSQN_cPais       
   sISSQN_nProcesso   
   lISSQN_indIncentivo
   nVDescLog
   lImport     
   lImposImpor 
   lAdicoes    
   lCIDE       
   lICMS_ST    
   lICMS_P     
   lICMS_RR    
   lICMS_SN    
   lIPI        
   lPIS        
   lPIS_ST     
   lCofins     
   lCofins_ST  
   lISSQN      
   lTranspFiscal
   jBC_PIS
   jBC_COFINS
   jBC_ICMS
   jBC_IPI
   jBC_ICMSST
   jBC_II
   jBC_ISS
   jVl_ICMSST
   jVl_ICMS
   nBC_ICMS
   nBC_COFINS
   nBC_PIS
   nBC_IPI
   nBC_ICMSST
   nBC_II
   nBC_ISS
   nVl_ICMSST
   nVl_ICMS
   nTot_vTrib 
   nAliqTranspImport
   nAliqTranspNac   
   nPEncFinTpED
   jOrig
   jFDiasEnt
   iDiasInf
   iDiasCalc
   pOrdem 
   pItem
   fItem
   pUni
   fUni
   pNeg
   fNeg
   pTab
   fTab
   pTabI
   fTabI
   pTabGrpP
   fTabGrpP
   pTabGrpPI
   fTabGrpPI
   pNCM
   fNCM
   pCFO
   fCFO
   jTipo
   nQt
   tEntPla
   tEmissao
   tSaida
   nDesc
   lCCusto  
   lCrtlItem
   pPTOpEDGrpItem
   fPTOpEDGrpItem
   nQtMin
   nQtMax
   nPrecoMin
   nPrecoMax
   lContQua
   lContPreco
   iCiclo
   iCicloAtual
   jTempo
   lSkipLote
   nPrBruto   
   nPDescCP   
   nVDescCP   
   nPDescTpED 
   nVDescTpED 
   nVEncFinTpED 
   nPDescTpEDG
   nVDescTpEDG
   nPDescInc  
   nVDescInc  
   nProd_pDesc
   pLote
   fLote
   jFinalidade
   nProd_vUnCom
   nProd_vProd
   nProd_vFrete
   nVMLE
   nProd_vSeg
   nProd_vDesc
   nProd_vOutro
   jProd_indTot
   sDI_nDI               
   dDI_dDI               
   sDI_xLocDesemb        
   sDI_UFDesemb          
   dDI_dDesemb           
   sDI_cExportador  
   iAdi_nAdicao          
   iAdi_nSeqAdic         
   sAdi_cFabricante      
   nAdi_vDescDI          
   sAdi_xPed             
   iAdi_nItemPed         
   nCIDE_qBCprod
   nCIDE_vAliqProd
   nCIDE_vCIDE
   jICMS_GrupoTrib
   jICMS_orig 
   jICMS_modBC
   nICMS_vBC
   nICMS_pICMS
   nICMS_vICMS
   jICMS_modBCST
   nICMS_pMVAST
   nICMS_pRedBCST
   nICMS_vBCST
   nICMS_pICMSST
   nICMS_vICMSST
   nICMS_pRedBC
   jICMS_motDesICMS
   nICMS_vBCSTRet
   nICMS_vICMSSTRet
   jICMSPart_orig
   jICMSPart_CST
   jICMSPart_modBC
   nICMSPart_vBC
   nICMSPart_pRedBC
   nICMSPart_pICMS
   nICMSPart_vICMS
   jICMSPart_modBCST
   nICMSPart_pMVAST
   nICMSPart_pRedBCT
   nICMSPart_vBCST
   nICMSPart_pICMSST
   nICMSPart_vICMSST
   nICMSPart_pBCOp
   sICMSPart_UFST
   jICMSST_orig
   jICMSST_CST
   nICMSST_vBCSTRet
   nICMSST_vICMSSTRe
   nICMSST_vBCSTDest
   nICMSST_vICMSSTDes
   jGrupo_simples
   jICMSSN_Orig
   jICMSSN_CSOSN
   nICMSSN_pCredSN
   nICMSSN_vCredICMSSN
   jICMSSN_modBCST
   nICMSSN_pMVAST
   nICMSSN_pRedBCST
   nICMSSN_vBCST
   nICMSSN_pICMSST
   nICMSSN_vICMSST
   nICMSSN_vBCSTRet
   nICMSSN_vICMSSTRet
   jICMSSN_modBC
   nICMSSN_vBC
   nICMSSN_pRedBC
   nICMSSN_pICMS
   nICMSSN_vICMS
   sIPI_clEnq
   sIPI_CNPJProd
   sIPI_cSelo
   nIPI_qSelo
   sIPI_cEnq
   jIPINT_CST
   nIPITrib_vBC
   nIPITrib_pIPI
   nIPITrib_qUnid
   nIPITrib_vUnid
   nIPITrib_vIPI
   nII_vBC
   nII_vDespAdu
   nII_vII
   nII_vIOF
   jPIS_CST  
   nPIS_vBC 
   nPIS_pPIS 
   nPIS_vPIS 
   nPIS_qBCProd 
   nPIS_vAliqProd 
   nPISST_vBC 
   nPISST_pPIS
   nPISST_qBCProd 
   nPISST_vAliqProd
   nPISST_vPIS   
   jCOFINS_CST
   nCOFINS_vBC
   nCOFINS_pCOFINS
   nCOFINS_vCOFINS
   nCOFINS_qBCProd
   nCOFINS_vAliqProd
   nCOFINSST_vBC
   nCOFINSST_pCOFINS
   nCOFINSST_qBCProd
   nCOFINSST_vAliqProd
   nCOFINSST_vCOFINS
   nISSQN_vBC 
   nISSQN_vAliq 
   nISSQN_vISSQN
   nISSQN_cMunFG    
   nISSQN_cListServ 
   jISSQN_cSitTrib
   sInfAdProd   
   sDDFSubTabela = Ordens_Item_CCusto
   pSubPId       = $_POST[pOrdens_Item_CCusto_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCCusto       = $_POST[pCCusto_{i}]
   fCCusto       = $_POST[fCCusto_{i}]
   nRatCCusto    = $_POST[nRatCCusto_{i}]
   lExc          = $_POST[pCCusto_{i}]==0 ? 1 : 0
   sDDFSubTabela = Ordens_Item_CContabil
   pSubPId       = $_POST[pOrdens_Item_CContCred_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCPla         = $_POST[pCContCred_{i}]
   fCPla         = $_POST[fCContCred_{i}]
   nRatCredCCont = $_POST[nRatCredCCont_{i}]
   lDeb          = 0
   lExc          = $_POST[pCContCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = Ordens_Item_CContabil
   pSubPId       = $_POST[pOrdens_Item_CContDeb_{i}]
   pOrdemItem    = {ChaveAtual_0}
   fOrdemItem    = $_POST[iVer]
   pCPla         = $_POST[pCContDeb_{i}]
   fCPla         = $_POST[fCContDeb_{i}]
   nRatDebCCont  = $_POST[nRatDebCCont_{i}]
   lDeb          = 1
   lExc          = $_POST[pCContDeb_{i}]==0 ? 1 : 0
</VarsToDb1>
<ServerValids1>
   pItem        ; $_POST[.]>0 ;  O Item deve ser informado.
   pUni         ; $_POST[.]>0 ;  A unidade da transao deve ser informada.
   nQt          ; $_POST[.]>0 ;  A Qt.Pedida deve ser Preenchida.
   pMoe         ; $_POST[.]>0 ;  A Moeda do Item deve ser informada.
   nQt          ; ($_POST[.]*$_POST[nPrBruto])>0 ; Os campos quantidade e preos devem ser preenchidas.
     pItem        ; flEhUnico("select count(*) from Ordens_Itens a, Ordens b, TOper c where a.pItem=$_POST[.] and a.pPId!=$_POST[pPId] and a.pOrdem=$_POST[pOrdem] and a.pOrdem=b.pPId and b.pTOper = c.pPId and c.lRejOrdemDupl=1  and a.iVer = a.iVAt and b.iVer = b.iVAt and c.iVer = c.iVAt") ; J existe esse Item cadastrado no Item da Ordem, se no encontrar verifique na lixeira.
</ServerValids1>
<PodeIncluir1>
     select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom is null ; Esse Item no pode ser includo porque o Pedido j foi Liberado
</PodeIncluir1>
<PodeExcluir1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser excluido porque o Pedido j foi Liberado
</PodeExcluir1>
<PodeReincluir1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser reincludo porque o Pedido j foi Liberado
</PodeReincluir1>
<PodeAlterar1>
   select count(*) from Ordens where pPId={ChaveAtual_1} and iVer=iVAt and tLibCom  is null ; Esse Item no pode ser alterado porque o Pedido j foi Liberado
</PodeAlterar1>
<exec1>
(
      this.flSetVar('pItem',0) 
   && this.flSetVar('fItem',0) 
   && this.flSetVar('iQt','') 
   && this.flSetVar('sRegCodItem','') 
   && this.flSetVar('sTabCodItem','') 
   && this.flSetVar('sNegCodItem','') 
   && this.flSetVar('sRegDesItem','') 
   && this.flSetVar('pTab','0') 
   && this.flSetVar('fTab','0') 
   && this.flSetVar('pTabI','0') 
   && this.flSetVar('fTabI','0') 
   && this.flSetVar('sCodTab','') 
   && this.flSetVar('sDesTab','') 
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
   && this.flSetVar('jOrig',0)   
   && this.flSetVar('jICMS_Orig',0)   
   && this.flSetVar('pUni',0)         
   && this.flSetVar('sCodUni','')     
   && this.flSetVar('sUni','')        
   && this.flSetVar('pNCM',0)         
   && this.flSetVar('sCodNCM','')     
   && this.flSetVar('sDesNCM','')     
   && this.flSetVar('pNeg',0)         
   && this.flSetVar('fNeg',0)         
   && this.flSetVar('nPrBruto','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('nPEncFinTpED','0,00000') 
   && this.flSetVar('sMoe','') 
   && this.flSetVar('pMoe',0) 
   && this.flSetVar('fMoe',0) 
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0) 
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('jCam',0) 
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('pRegDepVen',0) 
   && this.flSetVar('pDepVen',0) 
   && this.flSetVar('pUFisVen',0) 
   && this.flSetVar('pUFisVen',0) 
   && this.flSetVar('sUn1Ven','') 
   && this.flSetVar('sUn2Ven','') 
   && this.flSetVar('sUn3Ven','') 
   && this.flSetVar('sUn4Ven','') 
   && this.flSetVar('sUn5Ven','') 
   && this.flSetVar('sUn6Ven','') 
   && this.flSetVar('sUn7Ven','') 
   && this.flSetVar('pRegDepRFis',0) 
   && this.flSetVar('pDepRFis',0) 
   && this.flSetVar('pUFisRFis',0) 
   && this.flSetVar('pUFisRFis',0) 
   && this.flSetVar('sUn1RFis','') 
   && this.flSetVar('sUn2RFis','') 
   && this.flSetVar('sUn3RFis','') 
   && this.flSetVar('sUn4RFis','') 
   && this.flSetVar('sUn5RFis','') 
   && this.flSetVar('sUn6RFis','') 
   && this.flSetVar('sUn7RFis','')  
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','')
   && this.flSetVar('nQtMin','0,00') 
   && this.flSetVar('nQtMax','0,00') 
   && this.flSetVar('nPrecoMin','0,00') 
   && this.flSetVar('nPrecoMax','0,00') 
   && this.flSetVar('lContQua',0) 
   && this.flSetVar('lContPreco',0) 
   && this.flSetVar('iCiclo',0) 
   && this.flSetVar('iCicloAtual',0) 
   && this.flSetVar('jTempo',0) 
   && this.flSetVar('lSkipLote',0) 
)
</exec1>
<exec2>
(
      this.flSetVar('nPrBruto','') 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000')                                                                                   
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','')                             
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('nVDescInc','0,00')
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
)
</exec2>
<exec3>
( 
   ( (pCapaMoe!=pMoe) 
     ? 
     (this.flSetVar('nQtMoe',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nPrBruto','0,00000'))  
     : 
     (this.flSetVar('nPrBruto',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nQtMoe','0,00000')) 
   ) 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('pLote',0) 
   && this.flSetVar('fLote',0) 
   && this.flSetVar('sLote','') 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec3>
<exec4>
( 
   ( 
     (pCapaMoe!=pMoe) 
     ?  
     (this.flSetVar('nQtMoe',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nPrBruto','0,00000')) 
     : 
     (this.flSetVar('nPrBruto',fsReplaceDecimalPoint(nPrBruto,".",",",5)) && this.flSetVar('nQtMoe','0,00000'))  
   ) 
   && this.flSetVar('iQt','') 
   && this.flSetVar('nPrBruto','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam',0) 
   && this.flSetVar('fCam',0)
   && this.flSetVar('nCam','0,00000')
   && this.flSetVar('sCam','')
   && this.flSetVar('nProd_vUnCom','0,00000') 
   && this.flSetVar('nProd_vFrete','0,00') 
   && this.flSetVar('nVMLE','0,00') 
   && this.flSetVar('nProd_vSeg','0,00') 
   && this.flSetVar('nProd_vDesc','0,00000') 
   && this.flSetVar('nProd_vProd','0,00') 
   && this.flSetVar('pCFO',0) 
   && this.flSetVar('sCodCFO','') 
   && this.flSetVar('sAbrev','') 
   && this.flSetVar('fCFO',0) 
   && this.flSetVar('tEntPla','') 
   && this.flSetVar('tEmissao','') 
   && this.flSetVar('tSaida ','') 
   && this.flSetVar('sDI_nDI','') 
   && this.flSetVar('dDI_dDI','') 
   && this.flSetVar('sDI_xLocDesemb','') 
   && this.flSetVar('sDI_UFDesemb','') 
   && this.flSetVar('dDI_dDesemb','') 
   && this.flSetVar('sDI_cExportador','') 
   && this.flSetVar('nII_vBC','0,00') 
   && this.flSetVar('nII_vDespAdu','0,00') 
   && this.flSetVar('nII_vII','0,00') 
   && this.flSetVar('nII_vIOF','0,00') 
   && this.flSetVar('iAdi_nAdicao',0) 
   && this.flSetVar('iAdi_nSeqAdic',0) 
   && this.flSetVar('sAdi_cFabricante','') 
   && this.flSetVar('nAdi_vDescDI','0,00000') 
   && this.flSetVar('sAdi_xPed','') 
   && this.flSetVar('iAdi_nItemPed',0) 
   && this.flSetVar('nCIDE_qBCprod','0,00') 
   && this.flSetVar('nCIDE_vAliqProd','0,00') 
   && this.flSetVar('nCIDE_vCIDE','0,00') 
   && this.flSetVar('jICMS_GrupoTrib',0) 
   && this.flSetVar('jICMS_orig',0) 
   && this.flSetVar('jICMS_modBC',0) 
   && this.flSetVar('nICMS_pRedBC','0,00') 
   && this.flSetVar('nICMS_vBC','0,00') 
   && this.flSetVar('nICMS_pICMS','0,00') 
   && this.flSetVar('nICMS_vICMS','0,00') 
   && this.flSetVar('jICMS_modBCST',0) 
   && this.flSetVar('nICMS_pMVAST','0,00') 
   && this.flSetVar('nICMS_pRedBCST','0,00') 
   && this.flSetVar('nICMS_vBCST','0,00') 
   && this.flSetVar('nICMS_pICMSST','0,00') 
   && this.flSetVar('nICMS_vICMSST','0,00') 
   && this.flSetVar('nICMS_vBCSTRet','0,00') 
   && this.flSetVar('nICMS_vICMSSTRet','0,00') 
   && this.flSetVar('jICMS_motDesICMS',0) 
   && this.flSetVar('jICMSPart_orig',0) 
   && this.flSetVar('jICMSPart_CST',0) 
   && this.flSetVar('jICMSPart_modBC',0) 
   && this.flSetVar('nICMSPart_vBC','0,00') 
   && this.flSetVar('nICMSPart_pRedBC','0,00') 
   && this.flSetVar('nICMSPart_pICMS','0,00') 
   && this.flSetVar('nICMSPart_vICMS','0,00') 
   && this.flSetVar('jICMSPart_modBCST',0) 
   && this.flSetVar('nICMSPart_pMVAST','0,00') 
   && this.flSetVar('nICMSPart_pRedBCT','0,00') 
   && this.flSetVar('nICMSPart_vBCST','0,00') 
   && this.flSetVar('nICMSPart_pICMSST','0,00') 
   && this.flSetVar('nICMSPart_vICMSST','0,00') 
   && this.flSetVar('nICMSPart_pBCOp','0,00') 
   && this.flSetVar('sICMSPart_UFST','') 
   && this.flSetVar('jICMSST_orig',0) 
   && this.flSetVar('jICMSST_CST',0) 
   && this.flSetVar('nICMSST_vBCSTRet','0,00') 
   && this.flSetVar('nICMSST_vICMSSTRe','0,00') 
   && this.flSetVar('nICMSST_vBCSTDest','0,00') 
   && this.flSetVar('nICMSST_vICMSSTDes','0,00') 
   && this.flSetVar('jGrupo_simples',0) 
   && this.flSetVar('jICMSSN_Orig',0) 
   && this.flSetVar('jICMSSN_CSOSN',0) 
   && this.flSetVar('jICMSSN_modBC',0) 
   && this.flSetVar('nICMSSN_vBC','0,00') 
   && this.flSetVar('nICMSSN_pRedBC','0,00') 
   && this.flSetVar('nICMSSN_pICMS','0,00') 
   && this.flSetVar('nICMSSN_vICMS','0,00') 
   && this.flSetVar('jICMSSN_modBCST',0) 
   && this.flSetVar('nICMSSN_pMVAST','0,00') 
   && this.flSetVar('nICMSSN_pRedBCST','0,00') 
   && this.flSetVar('nICMSSN_vBCST','0,00') 
   && this.flSetVar('nICMSSN_pICMSST','0,00') 
   && this.flSetVar('nICMSSN_vICMSST','0,00') 
   && this.flSetVar('nICMSSN_pCredSN','0,00') 
   && this.flSetVar('nICMSSN_vCredICMSSN','0,00') 
   && this.flSetVar('nICMSSN_vBCSTRet','0,00') 
   && this.flSetVar('nICMSSN_vICMSSTRet','0,00') 
   && this.flSetVar('sIPI_clEnq','') 
   && this.flSetVar('sIPI_CNPJProd','') 
   && this.flSetVar('sIPI_cSelo','') 
   && this.flSetVar('nIPI_qSelo','0,00') 
   && this.flSetVar('sIPI_cEnq','') 
   && this.flSetVar('jIPINT_CST',0) 
   && this.flSetVar('nIPITrib_vBC','0,00') 
   && this.flSetVar('nIPITrib_pIPI','0,00') 
   && this.flSetVar('nIPITrib_qUnid','0,00') 
   && this.flSetVar('nIPITrib_vUnid','0,00') 
   && this.flSetVar('nIPITrib_vIPI','0,00') 
   && this.flSetVar('jPIS_CST',0) 
   && this.flSetVar('nPIS_vBC','0,00') 
   && this.flSetVar('nPIS_pPIS','0,00') 
   && this.flSetVar('nPIS_qBCProd','0,00') 
   && this.flSetVar('nPIS_vAliqProd','0,00') 
   && this.flSetVar('nPIS_vPIS','0,00') 
   && this.flSetVar('nPISST_vBC','0,00') 
   && this.flSetVar('nPISST_pPIS','0,00') 
   && this.flSetVar('nPISST_qBCProd','0,00') 
   && this.flSetVar('nPISST_vAliqProd','0,00') 
   && this.flSetVar('nPISST_vPIS','0,00') 
   && this.flSetVar('jCOFINS_CST',0) 
   && this.flSetVar('nCOFINS_vBC','0,00') 
   && this.flSetVar('nCOFINS_pCOFINS','0,00') 
   && this.flSetVar('nCOFINS_qBCProd','0,00') 
   && this.flSetVar('nCOFINS_vAliqProd','0,00') 
   && this.flSetVar('nCOFINS_vCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_vBC','0,00') 
   && this.flSetVar('nCOFINSST_pCOFINS','0,00') 
   && this.flSetVar('nCOFINSST_qBCProd','0,00') 
   && this.flSetVar('nCOFINSST_vAliqProd','0,00') 
   && this.flSetVar('nCOFINSST_vCOFINS','0,00') 
   && this.flSetVar('nISSQN_vBC','0,00') 
   && this.flSetVar('nISSQN_vAliq','0,00') 
   && this.flSetVar('nISSQN_vISSQN','0,00') 
   && this.flSetVar('nISSQN_cMunFG','0,00') 
   && this.flSetVar('nISSQN_cListServ','0,00') 
   && this.flSetVar('jISSQN_cSitTrib',0) 
   && this.flSetVar('mInfAdProd','') 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec4>
<exec5>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec5>
<exec6>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec6>
<exec7>
(
      this.flSetVar('sMoeCambio','') 
   && this.flSetVar('pCam','0') 
   && this.flSetVar('nCam','0,00000') 
   && this.flSetVar('fCam','0') 
   && this.flSetVar('sCam','') 
   && this.flSetVar('nVDescCP','0,00000') 
   && this.flSetVar('nVDescTpED','0,00000') 
   && this.flSetVar('nVEncFinTpED','0,00000') 
   && this.flSetVar('nVDescTpEDG','0,00000') 
   && this.flSetVar('nQtMoe','0,00000') 
   && this.flSetVar('nProd_vUnCom','0,00000')
)
</exec7>
<exec8>
(
      this.flSetVar('nPrBruto',fsReplaceDecimalPoint((nQtMoe*nCam),".",",",5)) 
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDescFin),".",",",5)) 
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nQtMoe*nCam)-(nVDescInc+((nQtMoe*nCam)/100*(nDFin))+((nQtMoe*nCam)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5)) 
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nQtMoe*nCam)-(nVDescInc+((nQtMoe*nCam)/100*(nDFin))+((nQtMoe*nCam)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec8>
<exec9>
(
      this.flSetVar('nPrBruto',fsReplaceDecimalPoint((nQtMoe*nCam),".",",",5) ) 
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nDescFin),".",",",5))
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint(((nQtMoe*nCam)/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint(((nQtMoe*nCam))-(nVDescInc+(((nQtMoe*nCam))/100*(nDFin))+(((nQtMoe*nCam))/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint(((((nQtMoe*nCam))-(nVDescInc+(((nQtMoe*nCam))/100*(nDFin))+(((nQtMoe*nCam))/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
   )
</exec9>
<exec10>
(
      this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescTpED',fsReplaceDecimalPoint((nPrBruto/100*nDescFin),".",",",5))
   && this.flSetVar('nVDescTpEDG',fsReplaceDecimalPoint((nPrBruto/100*nPDescTpEDG),".",",",5)) 
   && this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec10>
<exec11>
(
   this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec11>
<exec11a>
(
   this.flSetVar('nVDescInc',fsReplaceDecimalPoint(((nPrBruto)/100*nPDescInc),".",",",5))
   && this.flSetVar('nVDescCP',fsReplaceDecimalPoint(((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin),".",",",5)) 
   && this.flSetVar('nVDescLog',fsReplaceDecimalPoint((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)/100*nPDescInc)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec11a>
<exec12>
(
      this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec12>
<exec13>
( 
 this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(nVDescInc+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec13>
<exec14>
(
   this.flSetVar('nVDescLog',fsReplaceDecimalPoint(((((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog),".",",",5))
   && this.flSetVar('nProd_vUnCom',fsReplaceDecimalPoint((nPrBruto)-(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))),".",",",5))
   && this.flSetVar('nProd_vProd',fsReplaceDecimalPoint((((nPrBruto)-(((nPrBruto)-((nPrBruto)/100*nPDescInc)-((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin))/100*nPDescLog)+((nPrBruto-((nPrBruto)/100*(nPDescInc)))/100*nDFin)+((nPrBruto)/100*(nPDescTpEDG))-((nPrBruto)/100*(nPEncFinTpED))))*iQt),".",",",5))
)
</exec14>
<esc1>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_1a',
 'sRegCodItem,pTOper,pEmi,pDest,pOrdem,pDestDefault',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pItem,
  fItem,
  sRegCodItem,
  sRegDesItem,
  sEAN,sGTIN,
  jICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  stmp,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  nQtUV1,
  nQtUV2,
  nQtUV3,
  nPrUV1,
  nPrUV2,
  nPrUV3,
  nPrBruto1,
  nPrBruto2,
  nPrBruto3,
  nPrBruto,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)
</esc1>
<esc2>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_2',
 'sNegCodItem,pTOper,pEmi,pDest,pOrdem',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pItem,
  fItem,
  sNegCodItem,
  sRegDesItem,
  sEAN,
  sGTIN,j
  ICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  sTmp,
  nPrBruto,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},
  pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)   
</esc2>
<esc3>
(
 'dd_files/erp_PTOpED_Item.dda',
 'Esc_Padrao_3',
 'sTabCodItem,pTOper,pEmi,pDest,pOrdem',
 '
  pPTOpEDItem,
  fPTOpEDItem,
  pTab,
  fTab,
  pTabI,
  fTabI,
  pItem,
  fItem,
  sTabCodItem,
  sRegDesItem,
  sCodTab,
  sDesTab,
  sEAN,
  sGTIN,
  jICMS_Orig,
  pUni,
  fUni,
  sCodUni,
  sUni,
  pNCM,
  fNCM,
  sCodNCM,
  sDesNCM,
  jFDiasEnt,
  iDiasInf,
  iDiasCalc,
  lInspecao,
  nPDescTpEDG,
  sTmp,
  nPrBruto,
  jCam,
  sMoe,
  pMoe,
  fMoe,
  lCCusto,
  lCrtlItem,
  nPEncFinTpED,
  lContQua,
  nQtMin,
  nQtMax,
  lContPreco,
  nPrecoMin,
  nPrecoMax,
  iCiclo,
  iCicloAtual,
  lSkipLote,
  stmp,
  pRegDepVen,
  fRegDepVen,
  pDep,
  pUFis,
  sUn1,
  sUn2,
  sUn3,
  sUn4,
  sUn5,
  sUn6,
  sUn7,
  sIns,
  pRegDepRFis,
  fRegDepRFis,
  pDepRFis,
  pUFisRFis,
  sUn1RFis,
  sUn2RFis,
  sUn3RFis,
  sUn4RFis,
  sUn5RFis,
  sUn6RFis,
  sUn7RFis,
  sInsRFis,
  jFinalidade,
  nAliqTranspImport,
  nAliqTranspNac,
  sCEST,
  pTmp1_{1},
  pCCusto_{1},
  fCCusto_{1},
  sCCusto_{1},
  nRatCCusto_{1},
  pTmp2_{2},
  pCContCred_{2},
  fCContCred_{2},
  sCodCredPla_{2},
  sDesCredPla_{2},
  nRatCredCCont_{2},
  pTmp3_{3},
  pCContDeb_{3},
  fCContDeb_{3},
  sCodDebPla_{3},
  sDesDebPla_{3},
  nRatDebCCont_{3}
 '
)
</esc3>

--//--

psTagDDS=Padrao_2
fsTratarIncAltSeq-inicio
fsTratarIncAltSeq-fim
psVarTmp=
iTmp=0
psVarTmp no  um JSON
explode
sVarsDDA=$sTagTit = 'Tit2';
$sTagCpoTit = 'CpoTit2';
$sTagCpo = 'Cpo2';
$sTagSql = 'Sql2';
$sTagSqlSum = 'SqlSum1';
$sTagMainTable = 'Itens';
$sTagMenu = 'Menu2';
$sTagNr0 = 'Nr03';
$sTagTipoNr0 = 'TipoNr03';
$sTagToolsBar = 'Pesquisar';
$sTagToolsBar = 'Incluir,Pesquisar';
$sTagPesquisar = 'Pesquisar2';
$sTagDbToVars = 'DbToVars2';
$sTagVarsDef = 'VarsDefault2';
$sTagScript = 'ScriptForm2';
$sTagVarsToServer = 'VarsToServer2';
$sTagVarsToDb = 'VarsToDb2';
$sTagServerVal = 'ServerValids2';
$sTagTitulo = 'TelaTit2';
$sLabelsAlign = 'Left';

sTagMainTable=Itens
sTagTit=Tit2
1) sTitGrid=Itens a Venda
---dd_files/erp_ORDENS_CanalWeb_Mobile_Itens.dda / Padrao_2
sCpo=$aLin["SCODITEM"]
2)sAlias=
sCpo=$aLin["SITEM"]
2)sAlias=
sCpo=number_format($aLin["NQT"],2,",",".")
2)sAlias=
sCpo=number_format($aLin["NPRBRUTO"],2,",",".")
2)sAlias=
sCpo=number_format($aLin["NPDESCINC"],2,",",".")
2)sAlias=
sCpo=number_format($aLin["NVDESCINC"],2,",",".")
2)sAlias=
sCpo=number_format($aLin["NPROD_VUNCOM"],2,",",".")
2)sAlias=
sCpo=number_format($aLin["NPROD_VPROD"],2,",",".")
2)sAlias=
sCpo=number_format($aLin[strtoupper("nDesc")],2,",",".")
2)sAlias=
sCpo=number_format($aLin[strtoupper("nPEncFinTpED")],2,",",".")
2)sAlias=
sCpo=$aLin[strtoupper("sCodUni")]
2)sAlias=
sCpo=$aLin["PPID"]
2)sAlias=
sAliasColunas=~~~~~~~~~~~
a) sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
A) psVarTmp=
pChaveAtual_1=1088804, pChaveAtual_2=0, pChaveAtual_3=0, pPaizao=1088804, iCountAncestrais=1, iCountIrmasTias=1
psIrmasTias=1//2023-10-25 00:00:00/1/5/73797/0/0.00/1/0/0/0/0/0/0/0/0/0/1//0//0.00000/SENDAS DISTRIBUIDORA S/A
antes da troca da ChaveIrma, sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
iCountTmp=25
aps a troca da ChaveIrma, sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
sQryEscSemLikeP0=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
psVars=
---
psEscId=, psEscIdIrma1=
iPagAtrasado = 0, sToolsBar = Incluir,Pesquisar
sSqlMarcados=
sEntrarIncluindo=
psTipo=1, sSearch=
colocando o sSearch na qry
sQryOriginal=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
psPesquisarFull=
sOnLoadExe=
psQry=select current_transaction from rdb$database
durao 0, iDb=1
fhDBConnect - Transaction ID=11187 , hBase=Resource id #99, hTr=Resource id #100, ghBase=Resource id #99
conexo -> hBase=Resource id #100
0) pChaveDinamica=0
sTagIncludeOnLoadGrid=
sSqlMarcados=
hBase ->  um processo ao inves de uma qry - sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
sQry2=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202;
sQry=select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202
psPesquisarFull=
sEval=$xRes =select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202;
a) sVarsRangeProc=, sEval=$xRes =select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20%20%20%20%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20union%20all%20%20select%20b.pPId%2C%20%20%20%20%20b.sCodigo%20%20sCodItem%2C%20%20%20%20%20b.sDescricao%20sItem%2C%20%20%20%20%20a.nDesc%2C%20%20%20%20%20a.nPEncFinTpED%2C%20%20%20%20%20coalesce%28k.nQt%2C0%29%20%20%20%20%20%20%20%20nQt%2C%20%20%20%20%20coalesce%28k.nPrBruto%2C0%29%20%20%20%20%20nPrBruto%2C%20%20%20%20%20coalesce%28k.nPDescInc%2C0%29%20%20%20%20%20nPDescInc%2C%20%20%20%20%20coalesce%28k.nVDescInc%2C0%29%20%20%20%20%20nVDescInc%2C%20%20%20%20%20coalesce%28k.nProd_vUnCom%2C0%29%20%20%20nProd_vUnCom%2C%20%20%20%20%20coalesce%28k.nProd_vProd%2C0%29%20%20%20%20nProd_vProd%2C%20%20%20%20%20coalesce%28g.sCodigo%2C%27%27%29%20%20%20%20%20sCodUni%20%20from%20PTOpED_Item%20a%20%20%20%20%20%20%20%20%20%20%20%20%20%20join%20PTOpED%20%20%20%20%20c%20on%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2073797%20and%20c.lExc%3D0%20%20%20%20%20%20%20%20%20%20%20left%20join%20Itens%20%20%20%20%20%20b%20on%20a.pItem%20%20%3D%20b.pPId%20and%20b.iVer%3Db.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20NCM%20%20%20%20%20%20%20e%20on%20b.pNCM%20%20%3D%20e.pPId%20and%20e.iVer%3De.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20UnidadeMedida%20%20g%20on%20a.pUni%20%20%3D%20g.pPId%20and%20g.iVer%3Dg.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Moeda%20%20%20%20%20%20j%20on%20a.pMoe%20%20%3D%20j.pPId%20and%20j.iVer%3Dj.iVAt%20%20%20%20%20%20%20%20%20%20%20left%20join%20Ordens_Itens%20%20k%20on%20k.pOrdem%20%3D%201088804%20%20and%20k.iVer%3Dk.iVAt%20and%20k.pItem%3Da.pItem%20%20where%20a.lExc%3D0%20and%20a.iVer%3Da.iVAt%20%20%20%20and%20b.pPId%20not%20in%20%28select%20a.pItem%20from%20PTOpED_Item%20a%2C%20PTOpED%20c%20where%20a.pPTOpED%20%3D%20c.pPId%20and%20c.iVer%3Dc.iVAt%20and%20c.pTOper%20%3D%201%20and%20c.pEmi%20%3D%205%20and%20c.pDest%20%3D%2036669%20and%20c.lExc%3D0%29%20%20order%20by%202;