Incio em 22/09/2023 12:46:58
iCount_GET=29, iCount_POST=0
psFileDDS=dd_files/erp_EDI_Fin_MontagemLotesEDI.dda
sSearch=
jGetPost=0, psTipo=0, psFileDDS=dd_files/erp_EDI_Fin_MontagemLotesEDI.dda, psTagDDS=Padrao_1, psAncestrais=1, psIrmasTias=, psLogin=3979, psTDoc=
psMnemTDoc=EDI_Fin_MontaLotesEDI, psRecsPage=100, psPage=0, psOOpLogin=253, psRoot=1, sSearch=, psId=0, psCalendario=
psSlim=0, iDesenvolvedor=1, psCiaLogin=0, psMarcados=/, sInMarcados=0,0, psMarcadosPai=/, sInMarcadosPai=0,0, psVarTmp=, psCliPasta=desenvolvimento, piTimeLogin=1695396848494
sGlobal_pUNeg=, ioCaller_ChaveAtual=0, piSss=5, plMobile=0, plEchoJson=0, plEchoUtf8=0
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']=
psQry=
psQrySum=
psQrySum2=
psVars=
psEscId=
psEscIdIrma1=
iDeepGrid=1
psFileDDS=dd_files/erp_EDI_Fin_MontagemLotesEDI.dda
sTxt 1
sTxt=<Padrao_1>   
   sTagMnemTDoc     = FIN_Titulos
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1
   sTagCpo          = Cpo1
   sTagSql = Sql1
   sTagMainTable    = FIN_Titulos
   sTagMenu         = Menu1
   sTagNr0          = Nr01
   sTagTipoNr0      = TipoNr01
   sTagToolsBar     = Incluir,Excluir,Alterar,Zoom,Pesquisar
   sTagMarcacao     = true
   sTagRAc          = false
   sTagPesquisar    = Pesquisar1
   sTagDbToVars     = DbToVars1
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1
   sTagVarsToServer = VarsToServer1
   sTagVarsToDb     = VarsToDb1
   sTagServerVal    = ServerValids1
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagSubGrid      = 1,2,3,4,5
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
</Padrao_1>
<Tit1>Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao</Tit1>
<CpoTit1>
[Id]-s-10
</CpoTit1>
<Cpo1>
   $aLin["PPID"]
   $aLin["PPID"]
</Cpo1>
<colA>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 50px_">
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PPID"] . '</td>
     </tr>
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><b>Capa(*)</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PCAPA"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Ordem</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PORDEM"]==0 ? '' : $aLin["PORDEM"])  . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>PreNF</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PPRENF"]==0 ? '' : $aLin["PPRENF"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["LPREVISAO"]==1 ? ($aLin["PNFE"]==0 ? '' : $aLin["PNFE"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Transf</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTRANSF"]==0 ? '' : $aLin["PTRANSF"]) . '</td>
     </tr>
    </table>'
</colA>
<colB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
    </table>'
</colB>
<colBB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTFINORIG"]==0 ? '' : $aLin["PTFINORIG"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
     </tr>
    </table>'
</colBB>
<colC>
   ((date('Ymd',strtotime($aLin["TVENC"])) < date('Ymd') && ($aLin["TPGMTO"]== ''))
   ? '<font color=#BB0000>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td><td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
            <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
   </font>' :
   '<font color=blue>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').'</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
          <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
    </font>')
</colC>
<colD>
   ($aLin["DCANC"]<>''
   ?
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
       <tr>
          <td style="text-align: left"><b>Agendando</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Pagamento</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Valor</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
       </tr>
    </table>'
   :
   ($aLin["TPGMTO"]== ''
   ?
   '<font color=#BB0000>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendando</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
   </font>' :
   '<font color=blue>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendado</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
    </font>'))
</colD>
<colE>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 380px_">
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Nr.Conta</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCC"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Dg</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDAC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Agncia</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGE"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Nr.Ag</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGENR"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDESBANCO"] . '</td>
      <td style="text-align: left_ width:  5px_"><b>Cod.Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCODBANCO"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Tipo Cob</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td colspan="2" style="text-align: left_             ">' . $aLin["STIPOCOB"] . '</td>
     </tr>
   </table>'
</colE>
<colF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . ' [' .($aLin["LAGENCIASACADO"]==1 ? $aLin["SAGENCIASACADO"] : ($aLin["SCNPJSACADO"]!='' ? $aLin["SCNPJSACADO"] : $aLin["SCPFSACADO"])) . ']' . '</td>
     </tr>
    </table>'
</colF>
<colFF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . ' [' .($aLin["LAGENCIACEDENTE"]==1 ? $aLin["SAGENCIACEDENTE"] : ($aLin["SCNPJCEDENTE"]!='' ? $aLin["SCNPJCEDENTE"] : $aLin["SCPFCEDENTE"])) . ']' . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . '</td>
     </tr>
    </table>'
</colFF>
<Sql1>
select a.sDoc,
                   a.jTipo,
                   a.pCedente,
                   a.pSacado,
                   a.tEmissao,
                   a.tEnvCnab,
                   a.tEnvBol,
                   a.tIn0,
                   a.tRestr,
                   a.tLibRestr,
                   b.sCoringa sCedente,
                   b.sCNPJ    sCNPJCedente,
                   b.sCPF     sCPFCedente,
                   b.sAgencia    sAgenciaCedente,
                   b.lAgencia    lAgenciaCedente,
                   c.sCoringa sSacado,
                   c.sCNPJ    sCNPJSacado,
                   c.sCPF     sCPFSacado, 
                   c.sAgencia    sAgenciaSacado,
                   c.lAgencia    lAgenciaSacado,
                   a.pCapa,
                   a.lCapa,
                   a.tVenc,
                   a.tVenc0,
                   a.nVenc,
                   a.tCanc  dCanc,
                   a.jOri,
                   a.tPgmto,
                   a.nPgmto,
                   a.lPrevisao,
                   a.tAgend,
                   a.iIde_nNF,
                   a.pOrdem,
                   a.pNFe,
                   a.pPreNF,
                   a.pTransf,
                   a.pContr,
                   a.iPrest,
                   a.iNrPrest,
                   a.pTOper,
                   d.sDescricao sTOper,
                   d.sCodigo    sCodTOper,
                   a.iNfNFs,
                   a.pCC,
                   g.sCC        sCC,
                   g.sDac       sDac,
                   h.sAgencia   sAgeNr,
                   h.sCoringa   sAge,
                   h.pBanco     pBanco,
                   h.fBanco     fBanco,
                   i.sCodigo    sCodBanco,
                   i.sDescricao sDesBanco,
                   c.pCliGrupo,
                   l.sGrupo sCliGrupo,
                   a.pTipoCob,
                   e.sDescricao  sTipoCob,
                   e.sCodigo     sCodTipoCob,
                   a.fTipoCob,
                   b.pForGrupo,
                   j.sGrupo sForGrupo,
                   r.tConf      tOrdemConf,
                   a.pTFinOrig,
                   a.lOrcNA,
                   a.pPId 
            from FIN_Titulos a      join CUP            b on a.pCedente  = b.pPId and b.iVer = b.iVAt
                                    join CUP            c on a.pSacado   = c.pPId and c.iVer = c.iVAt
                               left join TOper          d on a.pTOper    = d.pPId and d.iVer = d.iVAt
                               left join CC             g on a.pCC       = g.pPid and g.iVer = g.iVAt
                               left join CUP            h on g.pAgencia  = h.pPid and h.iVer = h.iVAt
                               left join Banco          i on h.pBanco    = i.pPid and i.iVer = i.iVAt
                               left join Tipo_Cobrancas e on a.pTipoCob  = e.pPId and e.iVer = e.iVAt
                               left join Ordens         r on a.pOrdem    = r.pPId and r.iVer = r.iVAt and r.tCanc is null 
                               left join GrupoCUP       j on b.pForGrupo = j.pPId and j.iVer = j.iVAt
                               left join GrupoCUP       l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt
            where a.iVer = a.iVAt
              and a.lExc = 0
              and cast(a.tEmissao as date)>= '2023-06-01'
and cast(a.tEmissao as date)<= '2023-09-21'
and a.pSacado  = 5
and a.pCC = 1227
            order by a.iIde_nNF,a.pOrdem</Sql1>
<SqlSumRange2>
   select '','','A Pagar / Pago / Total ++ ',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '','',''
   from FIN_Titulos a left join TOper d on a.pTOper = d.pPId and  d.iVer = d.iVAt
                       left join CC         g on a.pCC      = g.pPid and g.iVer = g.iVAt
                       left join CUP        h on g.pAgencia = h.pPid and h.iVer = h.iVAt
                       left join Banco      i on h.pBanco   = i.pPid and i.iVer = i.iVAt
                      left join Tipo_Cobrancas    e on a.pTipoCob = e.pPId and e.iVer = e.iVAt
                       left join Ordens            r on a.pOrdem   = r.pPId and r.iVer = r.iVAt,
        CUP         b left join GrupoCUP         j on b.pForGrupo   = j.pPId and j.iVer=j.iVAt, 
        CUP         c left join GrupoCUP         l on c.pCliGrupo   = l.pPId and l.iVer=l.iVAt  
 where a.iVer = a.iVAt
     and a.pCedente = b.pPId and b.iVer = b.iVAt
     and a.pSacado  = c.pPId and c.iVer = c.iVAt
     and a.lExc = 0
     and a.jTipo = 1
     and {VarsRange}
</SqlSumRange2>
<SqlSum2_1>
   select '',
          '',
          'Marcados',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          '',
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '',
          ''
   from FIN_Titulos  a
 where a.iVer     = a.iVAt
     and a.lExc   = 0
     and a.pPId in ({sInMarcados})
     and a.jTipo  = 1
</SqlSum2_1>
<SumFormat1>
s-0
s-0
s-0
n-12-2
n-12-2
n-12-2
s-0
i-0                 
</SumFormat1>
<Pesquisar1>
   (
    (a.iIde_nNF          like '%{p0}%')
 or (a.pPId              like '%{p0}%')
 or (a.pOrdem            like '%{p0}%')
 or (a.pPreNF            like '%{p0}%')
 or (a.pTransf           like '%{p0}%')
 or (a.pNFe              like '%{p0}%')
 or (upper(d.sCodigo)    like '%{p0}%')
 or (upper(d.sDescricao) like '%{p0}%')
 or (upper(a.sDoc)       like '%{p0}%')
 or (upper(b.sCoringa)   like '%{p0}%')
 or (upper(c.sCoringa)   like '%{p0}%')
 or (upper(a.sDadoDoc)   like '%{p0}%')   
   )
</Pesquisar1>
<Nr01>alert("Qtux-Dialog\n\nNada a relacionar ...")</Nr01>
<Nr02>oGrid.flGridInc()</Nr02>
<TipoNr01>0</TipoNr01>
<TipoNr02>1</TipoNr02>
<TelaTit1>
   Ficha do Ttulo
</TelaTit1>
<DbToVars1>
   select a.tInc                      ,
          a.iVer                      ,
          a.iVAt                      ,
          a.sVer                      ,
          a.pPId,
          a.tIn0  dIn0,
          a.tEnvBol dEnvBol,
          a.jOri                      ,
          a.pCapa,
          a.lCapa,
          a.jTipo                     ,
          a.sDoc                      ,
          a.nQtMoe                    ,
          a.sDescricao                ,
          a.sObs                      ,
          a.nBruto                    ,
          a.tVenc    dVenc            ,
          a.tVenc,
          a.nVenc                     ,
          a.tPgmto  dPgmto           ,
          a.nPgmto                    ,
          a.tEmissao dEmissao         ,
          a.tProc    dProc            ,
          a.iCartBc                   ,
          a.sCartCod                  ,
          a.sEspecie                  ,
          a.lAceite                   ,
          a.nVMDAtraso                ,
          a.nDesc                     ,
          a.nAbat                     ,
          a.nAcr                      ,
          a.nMora                     ,
          a.nJur                      ,
          a.nMulta                    ,
          a.nIOF                      ,
          a.iDAviso                   ,
          a.pCedente                  ,
          a.fCedente                  ,
          b.sCoringa    sCedente      ,
          b.sCNPJ  sCedCNPJ,
          b.sCPF   sCedCPF,
          b.sFanta  sCedFanta,
          a.pSacado                   ,
          a.fSacado                   ,
          j.sCoringa sSacado          ,
          j.sCoringa sSacado1         ,
          j.sCNPJ  sSacCNPJ,
          j.sCPF   sSacCPF,
          j.sFanta,
          j.sPassaporte,
          a.pMoe                      ,
          kk.sDescricao   sDescMoe    ,
          a.fMoe                      ,
          a.lMEstrang                 ,
          a.pCam                      ,
          a.fCam                      ,
          d.nCam                      ,
          d.tCam                      ,
          k.sCodigo      sMoeCambio   ,
          a.pFPgmto                   ,
          a.fFPgmto                   ,
          e.sDescricao   sFPgmto      ,
          e.jFPmgto,
          a.pAcordo,
          a.lPrevisao,
          a.pOrdem,
          a.pPreNF,
          a.pNFe,
          a.iIde_nNF,
          a.pCC,
          a.fCC,
          g.pAgencia,
          g.fAgencia,
          g.sDescricao  sDesCC,
          g.sCC        sCC,
          g.sDac       sDac,
          h.sAgencia   sAgeNr,
          h.sCoringa   sAge,
          h.pBanco     pBanco,
          h.fBanco     fBanco,
          i.sCodigo    sCodBanco,
          i.sDescricao sDesBanco,
          j1.sCoringa   sCorrentista1,
          j1.sCNPJ      sCNPJCor1,
          j1.sCPF       sCPFCor1,
          a.pCCCUP,
          a.fCCCUP,
          gg.sDescricao  sDesCCCUP,
          gg.pAgencia   pAgenciaCUP,
          gg.fAgencia   fAgenciaCUP,
          gg.sCC        sCCCUP,
          gg.sDac       sDacCUP,
          gg.jTpPix     jTpPixCUP,
          gg.sChavePix  sChavePixCUP,
          hh.sAgencia   sAgeNrCUP,
          hh.sCoringa   sAgeCUP,
          hh.pBanco     pBancoCUP,
          hh.fBanco     fBancoCUP,
          ii.sCodigo    sCodBancoCUP,
          ii.sDescricao sDesBancoCUP,
          jj.sCoringa   sCorrentistaCUP,
          jj.sCNPJ      sCNPJCor,
          jj.sCPF       sCPFCor,
          a.pContr,
          f.sDescricao sDesContr,
          f.sCodigo    sCodContr,
          a.fContr,
          a.nIRRF,
          a.nPCC,
          a.iPrest,
          a.iNrPrest,
          a.pTipoCob,
          c.sDescricao  sTipoCob,
          c.sCodigo     sCodTipoCob,
          a.fTipoCob,
          a.pAgend,
          l.sCoringa sAgend,
          a.tAgend dAgend,
          a.pCanc,
          m.sCoringa sCanc,
          a.tCanc    dCanc,
          a.sMotivo,
          a.pDescanc,
          n.sCoringa sDescanc,
          a.tCanc    dDescanc,
          a.sDescMotivo,
          a.pEmissor,
          o.sCoringa sEmissor,
          z.sCoringa,
          zz.sCoringa  sCoringaIn0,
          r.tBaixCanh dBaixCanh,
          r.tEntReal  dEntReal,
          a.pEnvBol,
          pp.sCoringa sEnvBol,
          a.tRestr dRestr,
          a.pRestr,
          a.tLibRestr dLibRestr,
          a.pLibRestr,
          p1.sCoringa sLibRestr,
          p2.sCoringa sRestr,
          a.pTransf,
          a.fTransf,
          a.tProrrog dProrrog,
          a.nDescCTR,
          a.tVenc0 dVenc0,
          a.lComissao,
          a.pPFinHold_Linha,
          a.pPFinHold,
          a.pHold,
          a.fPFinHold_Linha,
          a.fPFinHold,
          a.fHold,
          a.lOrcNA,
          l1.sCoringa sHold,
          a.tOrcNA       dOrcNA,
          a.pOrcNA,
          t.sCoringa sOrcNA,
          a.lOrcNA,
          p.tIde_Emi dIde_Emi,
          a.jCCDefault,
          a.lAut3,
          a.pAut3,
          a.jFPmgtoCUP,
         r3.sCoringa   sAut3,
         g3.pAgencia   pAgencia3,
         g3.fAgencia   fAgencia3,
         g3.sCC        sCC3,
         g3.sDac       sDac3,
         g3.jTpPix     jTpPix3,
         g3.sChavePix  sChavePix3,
         h3.sAgencia   sAgeNr3,
         h3.sCoringa   sAge3,
         h3.pBanco     pBanco3,
         h3.fBanco     fBanco3,
         i3.sCodigo    sCodBanco3,
         i3.sDescricao sDesBanco3,
         j3.sCoringa   sCorrentista3
   from   FIN_Titulos  a       join CUP              b on  a.pCedente     =  b.pPId and  b.iVer =  b.iVat
                               join CUP              j on  a.pSacado      =  j.pPId and  j.iVer =  j.iVat
                               join CUP              z on  a.pInc         =  z.pPId and  z.iVer =  z.iVat
                               join CUP             zz on  a.pIn0         = zz.pPId and zz.iVer = zz.iVat
                          left join Cambio           d on  a.pCam         =  d.pPid and  d.iVer =  a.fCam
                          left join Moeda            k on  d.pMoe2        =  k.pPId and  k.iVer =  k.iVAt
                          left join FPgmto           e on  a.pFPgmto      =  e.pPId and  e.iVer =  e.iVat
                          left join Moeda           kk on  a.pMoe         = kk.pPId and kk.iVer = kk.iVAt 
                          left join PreNF            r on  a.pPreNF       =  r.pPId and  r.iVer =  r.iVat
                          left join CC               g on  a.pCC          =  g.pPid and  g.iVer =  g.iVAt
                          left join CUP             j1 on  g.pCUP         = j1.pPId and j1.iVer = j1.iVAt
                          left join CUP              h on  g.pAgencia     =  h.pPid and  h.iVer =  h.iVAt
                          left join Banco            i on  h.pBanco       =  i.pPid and  i.iVer =  i.iVAt
                          left join CC              gg on  a.pCCCUP       = gg.pPid and gg.iVer = gg.iVAt
                          left join CUP             jj on gg.pCUP         = jj.pPId and jj.iVer = jj.iVAt
                          left join CUP             hh on gg.pAgencia     = hh.pPid and hh.iVer = hh.iVAt
                          left join Banco           ii on hh.pBanco       = ii.pPid and ii.iVer = ii.iVAt
                          left join ConComSerIns     f on  a.pContr       =  f.pPId and  f.iVer =  f.iVAt
                          left join Tipo_Cobrancas   c on  a.pTipoCob     =  c.pPId and  c.iVer =  c.iVAt
                          left join CUP              l on  a.pAgend       =  l.pPid and  l.iVer =  l.iVAt
                          left join CUP              m on  a.pCanc        =  m.pPid and  m.iVer =  m.iVAt
                          left join CUP              n on  a.pDescanc     =  n.pPid and  n.iVer =  n.iVAt
                          left join CUP              o on  a.pEmissor     =  o.pPid and  o.iVer =  o.iVAt
                          left join NFCapa           p on  a.pNFe         =  p.pPid and  p.iVer =  p.iVAt
                          left join CUP             pp on  a.pEnvBol      = pp.pPid and pp.iVer = pp.iVAt
                          left join CUP             p1 on  a.pLibRestr    = p1.pPid and p1.iVer = p1.iVAt
                          left join CUP             p2 on  a.pRestr       = p2.pPid and p2.iVer = p2.iVAt
                          left join CUP             l1 on  a.pHold        = l1.pPid and l1.iVer = l1.iVAt
                          left join CUP              t on  a.pOrcNA       =  t.pPid and  t.iVer =  t.iVAt
                          left join CUP     r3 on  a.pAut3     = r3.pPId and r3.iVer = r3.iVAt
                          left join CC      g3 on r3.pCC       = g3.pPId and g3.iVer = g3.iVAt
                          left join CUP     j3 on g3.pCUP      = j3.pPId and j3.iVer = j3.iVAt
                          left join CUP     h3 on g3.pAgencia  = h3.pPid and h3.iVer = h3.iVAt
                          left join Banco   i3 on h3.pBanco    = i3.pPid and i3.iVer = i3.iVAt
   where  a.pPId = {pId}
     and  a.iVer = {a.iVer}
</DbToVars1>
<1>
   select a.pPId       pFIN_Titulos_CCusto_i,
          b.pPId       pCCusto_i,
          a.fCCusto    fCCusto_i,
          b.sCCUsto    sCCusto_i,
          a.nValPCCus  nValPCCus_i,
          cast(a.nValPCCus/100*c.nVenc as numeric(15,2)) nValMCCus_i
   from FIN_Titulos_CCusto a,
        CCusto             b,
        FIN_Titulos        c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pCCusto = b.pPId
     and b.iVer    = b.iVAt
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
   order by b.sCCUsto
</1>
<2>  
   select a.pPId          pFIN_Titulos_CCorrCred_i,
          g.pPId          pCCorrCred_i,
          a.fCC           fCCorrCred_i,
          g.pAgencia      pAgeCred_i,
          g.fAgencia      fAgeCred_i,
          g.sCC           sCCCred_i,
          g.sDac          sDacCred_i,
          h.sAgencia      sAgeCredNr_i,
          h.sCoringa      sAgeCred_i,
          h.pBanco        pBancoCred_i,
          h.fBanco        fBancoCred_i,
          i.sCodigo       sCodCred_i,
          i.sDescricao    sDesCred_i,
          a.nValPCCred    nValPCCred_i,
          a.nValMCCred    nValMCCred_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC          =  g.pPid  and  g.iVer  =  g.iVAt
                         left join CUP        h  on  g.pAgencia     =  h.pPid  and  h.iVer  =  h.iVAt
                         left join Banco      i  on  h.pBanco       =  i.pPid  and  i.iVer  =  i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by i.sDescricao,h.sAgencia,h.sAgencia
</2>
<3>  
   select a.pPId         pFIN_Titulos_CCorrDeb_i,
          g.pPId         pCCorrDeb_i,
          a.fCC          fCCorrDeb_i,
          g.pAgencia     pAgeDeb_i,
          g.fAgencia     fAgeDeb_i,
          g.sCC          sCCDeb_i,
          g.sDac         sDacDeb_i,
          h.sAgencia     sAgeDebNr_i,
          h.sCoringa     sAgeDeb_i,
          h.pBanco       pBancoDeb_i,
          h.fBanco       fBancoDeb_i,
          i.sCodigo      sCodDeb_i,
          i.sDescricao   sDesDeb_i,
          a.nValPCCDeb   nValPCCDeb_i,
          a.nValMCCDeb   nValMCCDeb_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC         =  g.pPid  and  g.iVer  = g.iVAt
                         left join CUP        h  on  g.pAgencia    =  h.pPid  and  h.iVer  = h.iVAt
                         left join Banco      i  on  h.pBanco      =  i.pPid  and  i.iVer  = i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by i.sDescricao,h.sAgencia,h.sAgencia
</3>
<4>
   select a.pPId          pFIN_Titulos_CContCred_i,
          e.pPId          pCContCred_i,
          a.fCPla         fCContCred_i,
          e.sCodigo       sCodCredPla_i,
          e.sDescricao    sDesCredPla_i,
          a.nValPCContC   nValPCContC_i,
          cast(a.nValPCContC/100*c.nVenc as numeric(15,2)) nValMCContC_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by e.sCodigo,e.sDescricao
</4>
<5>
   select a.pPId         pFIN_Titulos_CContDeb_i,
          e.pPId         pCContDeb_i,
          a.fCPla        fCContDeb_i,
          e.sCodigo      sCodDebPla_i,
          e.sDescricao   sDesDebPla_i,
          a.nValPCContD  nValPCContD_i,
          cast(a.nValPCContD/100*c.nVenc as numeric(15,2)) nValMCContD_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by e.sCodigo,e.sDescricao
</5>
<VarsDefault1>   
   sVerVAt   = {iVer+'/'+iVAt}
   sRastro   = {sVerVAt+', '+sCoringa+', '+tInc}
   aOri      = Manual, Automatica, Transferencia
   jTipo     = 1   
   aTipo     = Crdito & Cobrana , Pagamento
   mObs      = {sObs}
   mMotivo   = {sMotivo}
   mDescMotivo = {sDescMotivo}
   iContr    = {pContr  ==0 ? '' : pContr  }
   iOrdem    = {pOrdem  ==0 ? '' : pOrdem  }
   iPreNF    = {pPreNF  ==0 ? '' : pPreNF  }
   iNFe      = {pNFe    ==0 ? '' : pNFe    }
   iTransf   = {pTransf ==0 ? '' : pTransf }
   iIde_nNF2 = {iIde_nNF==0 ? '' : iIde_nNF}
   sCodSac   = {pSacado==0 ? '' : pSacado}
   dEmissao  = {flDiaDeHj()} ;
   aTpPix    = Telefone,CPF/CNPJ,Email,Chave Aleatria
   aCCDef    = Beneficirio,Terceiro
   aFPmgto   = Indefinido,Boleto Bancario,Cred em CC/DOC/TED/PIX-(se houver),Tributo Com Cod Barras,Tributo Sem Cod Barras,Concessionria
</VarsDefault1>
<ScriptForm1>   
   Rastreabilidade       ; sRastro-100   ; fontweight='bold' ; editable=false ; visible=(iDDFChamada>0)
   Verso                ; sVer-60       ; editable=false ; fieldborder=0
   Identificao         ;               ; fontweight='bold'
   Origem                        ; aOri[jOri]      ; identlabel=5 ; editable=false ;
   Tipo                          ; aTipo[jTipo]    ; identlabel=5 ; editable=false
   Previso                      ; lPrevisao-5    ; identlabel=5  ; editable=lComissao==1
   ;
   Id Titulo                     ; pPId-10               ; identlabel=5 ; editable=false 
   Id Ordem                      ; iOrdem-10             ; identlabel=5 ; editable=false 
   Id PreNF                      ; iPreNF-10             ; identlabel=5 ; editable=false 
   Id Nota                       ; iNFe-10               ; identlabel=5 ; editable=false 
   Id Transferencia              ; iTransf-10            ; identlabel=5 ; editable=false 
   Nr.Doc.Origem                 ; sDoc-20               ; identlabel=5 ; valid=((sDoc!=''),'O Nmero do Documento deve ser informado') ; editable=(dPgmto=='')
   Nr.Prest / Total Prest        ; iPrest-3,iNrPrest-3   ; identlabel=5 ; 
   Nr.Nota                       ; iIde_nNF2-8           ; identlabel=5 ; 
   ;
   Dados da Emisso   ;  ; fontweight='bold'
   Data de Emisso do Ttulo     ; dEmissao        ; identlabel=5 ; editable=((jOri==0)&&(dPgmto==''))
   Data de Emisso NFe           ; dIde_Emi        ; identlabel=5 ; editable=false
   ;
   Dados Cedente/Sacado   ;  ; fontweight='bold'
   Cedente  (quem recebe)        ; sCedente-50     ; identlabel=5 ;  editable=((jOri==0)&&(dPgmto=='')) ;  esc=('dd_files/CUP.dda','Esc_Padrao_7','sCedente','pCedente,sCedente,stmp,sCedCPF,stmp,stmp,sCedCNPJ,stmp,stmp,fCedente,pCCCUP,fCCCUP,pAgenciaCUP,fAgenciaCUP,sAgeNrCUP,sAgeCUP,sCCCUP,sDacCUP,pBancoCUP,fBancoCUP,sCodBancoCUP,sDesBancoCUP,sCorrentistaCUP,pCUP,sCNPJCor,sCPFCor,sCedFanta,pMoe,sDescMoe,fMoe,pTipoCob,fTipoCob,sTipoCob,sCodTipoCob,pFPgmto,fFPgmto,sFPgmto,sDescricao,mObs,pTmp1_{1},pCCusto_{1},fCCusto_{1},sCCusto_{1},nValPCCus_{1},pTmp5_{5},pCContDeb_{5},fCContDeb_{5},sCodDebPla_{5},sDesDebPla_{5},nValPCContD_{5}') ; editable=(dPgmto=='')
   Nome Fantasia                 ; sCedFanta-50    ; identlabel=5 ; visible=(sCedFanta!='') ; editable=false ;
   CNPJ                          ; sCedCNPJ-15     ; identlabel=5 ; visible=(sCedCNPJ!='')  ; editable=false ;
   CPF                           ; sCedCPF-15      ; identlabel=5 ; visible=(sCedCPF!='')   ; editable=false ;
   Sacado   (quem paga)          ; sSacado-50      ; identlabel=5 ;  editable=(dPgmto=='')  ; esc=('dd_files/UNeg.dda','Esc_Padrao_1','sSacado' ,'pSacado,sSacado,fSacado,stmp,stmp,stmp,pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge')
   ;
   Descrio da Conta            ; sDescricao-50   ; identlabel=5 ; 
   Observaes                   ; mObs-50-5-2500   ; identlabel=5 ; editable=(dPgmto=='')
   ;
   Dados do Vencimento           ;                 ; fontweight='bold'
   Agendado                      ; dAgend-20     ; identlabel=5 ;  visible=(dAgend!='') ;  editable=false 
   Agendado por                  ; sAgend-60     ; identlabel=5 ;  visible=(pAgend>0)   ;  editable=false
   ; ;  visible=(pAgend	>0)
   Data de Vencimento de Origem  ; dVenc0          ; identlabel=5 ; editable=false 
   Data de Vencimento            ; dVenc           ; identlabel=5 ; editable=(((jOri==0)&&(dPgmto=='')&&(tVenc=='')) || (pAcordo>0))
   ;
   Moeda                         ; sDescMoe-18    ; identlabel=5 ;esc=('dd_files/erp_Moeda.dda','Esc_Padrao_1','sDescMoe','pMoe,sCodMoe,sDescMoe,fMoe') ; editable=(dPgmto=='')
   ;
   IRRF  (Rec.)                        ; nIRRF-18-2      ; identlabel=5 ; visible=(pSacado==160) ; editable=(dPgmto=='')
   PCC   (Rec.)                       ; nPCC-18-2      ; identlabel=5  ; visible=(pSacado==160) ; editable=(dPgmto=='')
   ; ; visible=(pSacado==160)
   Valor Bruto                   ; nBruto-18-2      ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(((jOri==0)&&(dPgmto=='')) || (pAcordo>0))
   Valor do Desconto             ; nDesc-18-2       ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Acrscimo            ; nAcr-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor da Mora                 ; nMora-18-2      ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Juros                ; nJur-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')          
   Valor da Multa                ; nMulta-18-2     ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do IOF                  ; nIOF-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor a Pagar                 ; nVenc-18-2      ; identlabel=5  ; editable=false
   ;
   Dados do Pagamento            ;                 ; fontweight='bold'
   Data                          ; dPgmto          ; identlabel=5 ; editable=false
   Valor Pago                    ; nPgmto-18-2     ; identlabel=5 ; editable=false
   ;
   Regras de pagamentos ;; fontweight='bold' ; colspan=true
   Tipo Pagamento Oper Eletronica CUP ; aFPmgto[jFPmgtoCUP] ; identlabel=5 ; 
   ;
   Formas de pagamentos               ; sFPgmto-50      ; identlabel=5 ;esc=('dd_files/erp_FPgmto.dda','Esc_Padrao_1','sFPgmto','pFPgmto,sFPgmto,fFPgmto,jFPmgto') ; editable=(dPgmto=='')
   Tipo Pagamento Oper Eletronica Pol ; aFPmgto[jFPmgto] ; identlabel=5 ; editable=false
   ;
   Tipo de Cobrana     ; sTipoCob-50   ; identlabel=5 ; esc=('dd_files/erp_Tipo_Cobrancas.dda','Esc_Padrao_2','sTipoCob,pSacado','pTipoCob,sCodTipoCob,sTipoCob,fTipoCob') ; editable=(dPgmto=='')
                        ; sCodTipoCob-30      ; identlabel=5 ;  editable=false ; visible=(pTipoCob>0)
   ;
   Conta corrente do Cedente para Titulos de pagamento ;; fontweight='bold' ; colspan=true
      Nmero da Conta                 ; sCCCUP-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2f','sCCCUP,pCedente','pCCCUP,sAgeNrCUP,sCCCUP,sDacCUP,pBancoCUP,sCodBancoCUP,sDesBancoCUP,fCCCUP,sAgeCUP,sCorrentistaCUP,pCUP,SDESCC,LBANCARIA,sCNPJCor,sCPFCor,jTpPixCUP,sChavePixCUP') 
      Dgito                          ; sDacCUP-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNrCUP-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAgeCUP-50              ; identlabel=10 ; editable=false 
      Correntista                     ; sCorrentistaCUP-50      ; identlabel=10 ; editable=false 
      CNPJ                            ; sCNPJCor-15             ; identlabel=10 ; visible=(sCNPJCor!='') ; editable=false ;
      CPF                             ; sCPFCor-15              ; identlabel=10 ; visible=(sCPFCor!='')  ; editable=false ;
      Codigo do Banco                 ; sCodBancoCUP-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBancoCUP-50         ; identlabel=10 ; editable=false 
      Tipo PIX                        ; aTpPix[jTpPixCUP]       ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
      Chave PIX                       ; sChavePixCUP-50         ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
   ;
   CC DEFAULT para pagamento ;; fontweight='bold' ; colspan=true ; 
   Default                         ; aCCDef[jCCDefault]   ; identlabel=10 ;  
   ;
   Dados de Terceiro para pagamento ;; fontweight='bold' ; colspan=true
   Autorizao                     ; lAut3                ; identlabel=10 ; 
   Terceiro                        ; sAut3-50             ; identlabel=10 ; esc=('dd_files/CUP.dda','Esc_Padrao_1a','sAut3','pAut3,sAut3,jTipo3,sCPF3,sRG3,sOE3,sCNPJ3,sIE3,sIM3,iVer3,pCC3,fCC3,pAgencia3,fAgencia3,sAgeNr3,sAge3,sCC3,sDac3,pBanco3,fBanco3,sCodBanco3,sDesBanco3,sCorrentista3,pCUP3,sCNPJCor3,sCPFCor3,sFanta3,jTpPix3,sChavePix3')
   Nmero da Conta                 ; sCC3-8               ; identlabel=10 ; editable=false ; 
   Dgito                          ; sDac3-1              ; identlabel=10 ; editable=false ; 
   Nr da Agncia                   ; sAgeNr3-30           ; identlabel=10 ; editable=false ; 
   Nome da Agncia                 ; sAge3-50             ; identlabel=10 ; editable=false ; 
   Correntista                     ; sCorrentista3-50     ; identlabel=10 ; editable=false ; 
   Codigo do Banco                 ; sCodBanco3-50        ; identlabel=10 ; editable=false ; 
   Nome do Banco                   ; sDesBanco3-50        ; identlabel=10 ; editable=false ; 
   Tipo PIX                        ; aTpPix[jTpPix3]      ; identlabel=10 ; editable=false ; 
   Chave PIX                       ; sChavePix3-50        ; identlabel=10 ; editable=false ; 
   ;
   Conta Corrente Sacado             ;; fontweight='bold'; 
      Nmero da Conta                 ; sCC-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2b','sCC,pSacado','pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge') ; editable=(dPgmto=='')
      Dgito                          ; sDac-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNr-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAge-50              ; identlabel=10 ; editable=false 
      Codigo do Banco                 ; sCodBanco-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBanco-50         ; identlabel=10 ; editable=false 
;
Dados da Restrio Oramento       ;                 ; fontweight='bold' ; 
   Em Restrio                   ; dRestr-20   ; identlabel=5 ; editable=false
   Restrito por                   ; sRestr-50 ; identlabel=5 ; editable=false
   ;
   Data da Liberao              ; dLibRestr-20  ; identlabel=5 ; editable=false
   Liberado por                   ; sLibRestr-50 ; identlabel=5 ; editable=false
   ;
Nivel de Aviso de Oramento           ;              ; fontweight='bold'; edtzoom=true ; visible=(jTipo==1)
   Excedeu Oramento                  ; lOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=(jTipo==1)
   Liberado em                        ; dOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(dOrcNA!=''))
   Liberado por                       ; sOrcNA-60    ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(pOrcNA>0))
Cancelado                 ;                 ; fontweight='bold' ; visible=(pCanc>0)
   Cancelado                     ; dCanc-20        ; identlabel=5 ;  visible=(dCanc!='') ; editable=false
   Cancelado por                 ; sCanc-20        ; identlabel=5 ;  visible=(pCanc>0)  ; editable=false
   Motivo                        ; mMotivo-50-5-2500  ; identlabel=5 ;  visible=(mMotivo!='') ; editable=false
   ; ; visible=(pCanc>0)
Descancelado                 ;                 ; fontweight='bold' ; visible=(pDescanc>0)
   Descancelado                     ; dDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Descancelado por                 ; sDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Motivo                           ; mDescMotivo-50-5-2500  ; identlabel=5 ;  visible=(mDescMotivo!='') ; editable=false
   ; ; visible=(pDescanc>0)
;
;
Os campos abaixo so para RATEAR o valor do Ttulo. Para fazer isso  necessrio ler as regras abaixo. ;; colspan=true ; fontcolor='#FF0000'
1) Para cada grupos de rateio voce devera distribui as porcentagens(%)                                      ;; colspan=true ; fontcolor='#FF0000' 
2) A soma do rateio em porcentagens deve ser 100(%)                                                    ;; colspan=true ; fontcolor='#FF0000'
;
Centros de Custos ;; fontweight='bold';
   SubGrid-1 {
      (i)) Centro de Custo ; sCCusto_i-50     ; identlabel=5 ; esc=('dd_files/erp_CCusto.dda','Esc_Padrao_1','sCCusto_i','pCCusto_i,sTmp,sCCusto_i,fCCusto_i') ; visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em (%)        ; nValPCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em ($)       ; nValMCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=false
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(1,"pCCusto")_'>Incluir novo Centro de Custo</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
Contas Contabil de DBITO;; fontweight='bold';
   SubGrid-5 {
     (i)) Plano de Contas DBITO        ; sCodDebPla_i-10     ; identlabel=5 ; esc=('dd_files/erp_PlaConta.dda','Esc_Padrao_1','sCodDebPla_i','pCContDeb_i,sCodDebPla_i,sDesDebPla_i,fCContDeb_i') ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5))	; editable=(dPgmto=='')
     Descrio                          ; sDesDebPla_i-30     ; identlabel=5 ; visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
     Rateio em (%)                      ; nValPCContD_i-18-5   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=(dPgmto=='')
     Rateio em ($)                      ; nValMCContD_i-18-2   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
      ;   ; visible=(((i))<=(iTotLinSubGridPreenchidos_5))
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(5,"pCContDeb")_'>Incluir nova Conta Contabil de Dbito</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
</ScriptForm1>
<VarsToServer1>
   iIde_nNF = iIde_nNF2
   pCedente
   fCedente
   pSacado  
   fSacado   
   tEmissao = dEmissao
   tProrrog = dProrrog
   nDescCTR
   nBruto
   pEmissor
   pCC
   fCC
   pCCCUP
   fCCCUP
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pContr
   fContr
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs = mObs
   tVenc  = dVenc
   tVenc0 = dVenc0=='' ? dVenc : dVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso   
   pFPgmto
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   iVer
   pFIN_Titulos_CCusto_{i}
   pCCusto_{i}
   fCCusto_{i}
   nValPCCus_{i}
   nValMCCus_{i}
   lExc_{i} = pCCusto_{i}==0 ? 1 : 0
   pFIN_Titulos_CCorrCred_{i}
   pCCorrCred_{i}
   fCCorrCred_{i}
   nValPCCred_{i}
   nValMCCred_{i}
   pFIN_Titulos_CCorrDeb_{i}
   pCCorrDeb_{i}
   fCCorrDeb_{i}
   nValPCCDeb_{i}
   nValMCCDeb_{i}
   pFIN_Titulos_CContCred_{i}
   pCContCred_{i}
   fCContCred_{i}
   nValPCContC_{i}
   nValMCContC_{i}
   lExc_{i} = pCContCred_{i}==0 ? 1 : 0
   pFIN_Titulos_CContDeb_{i}
   pCContDeb_{i}
   fCContDeb_{i}
   nValPCContD_{i}
   nValMCContD_{i}
   lExc_{i} = pCContDeb_{i}==0 ? 1 : 0
</VarsToServer1>
<VarsToDb1>
   sDDFTabela = FIN_Titulos
   iIde_nNF
   pCedente
   fCedente
   pSacado  
   fSacado 
   tEmissao 
   pEmissor 
   tProrrog
   nDescCTR
   pCC
   fCC
   pCCCUP
   fCCCUP
   pContr
   fContr
   nBruto
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs       
   tVenc      
   tVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   tLimDesc  
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso  
   pFPgmto 
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   sDDFSubTabela = FIN_Titulos_CCusto
   pSubPId     = $_POST[pFIN_Titulos_CCusto_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCCusto     = $_POST[pCCusto_{i}]
   fCCusto     = $_POST[fCCusto_{i}]
   nValPCCus   = $_POST[nValPCCus_{i}]
   nValMCCus   = $_POST[nValMCCus_{i}]
   lExc        = $_POST[pCCusto_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrCred_{i}]
   fCC         = $_POST[fCCorrCred_{i}]
   lDeb        = 0
   nValPCCred  = $_POST[nValPCCred_{i}]
   nValMCCred  = $_POST[nValMCCred_{i}]
   lExc        = $_POST[pCCorrCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrDeb_{i}]
   fCC         = $_POST[fCCorrDeb_{i}]
   lDeb        = 1
   nValPCCDeb  = $_POST[nValPCCDeb_{i}]
   nValMCCDeb  = $_POST[nValMCCDeb_{i}]
   lExc        = $_POST[pCCorrDeb_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCPla       = $_POST[pCContCred_{i}]
   fCPla       = $_POST[fCContCred_{i}]
   lDeb        = 0
   nValPCContC = $_POST[nValPCContC_{i}]
   nValMCContC = $_POST[nValMCContC_{i}]
   lExc        = $_POST[pCContCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]
   pCPla       = $_POST[pCContDeb_{i}]
   fCPla       = $_POST[fCContDeb_{i}]
   lDeb        = 1
   nValPCContD = $_POST[nValPCContD_{i}]
   nValMCContD = $_POST[nValMCContD_{i}]
   lExc        = $_POST[pCContDeb_{i}]==0 ? 1 : 0
</VarsToDb1>
<ServerValids1>
   pCedente   ;  $_POST[.]>0   ; O Cedente deve ser preenchido
   pSacado    ;  $_POST[.]>0   ; O Sacado deve ser preenchido
   sDoc       ;  $_POST[.]!='' ; O Nmero do Documento deve ser informado
   pMoe       ;  $_POST[.]>0   ; A Moeda deve ser informada
   pTipoCob   ;  $_POST[.]>0   ; O Tipo de Cobrana deve ser informado
   pFPgmto    ;  $_POST[.]>0   ; A Forma de Pagamento de ser informada 
   tVenc      ;  strlen($_POST[.])>0 ; A Data de Vencimento deve ser informada   
   tEmissao   ;  strlen($_POST[.])>0 ; A Data da Emisso deve ser informada   
   tEmissao   ;  strtotime($_POST[.]) <= strtotime('now') ; A Data da Emisso deve ser menor que data e hora de agora.  
</ServerValids1>
<PodeIncluir1>
</PodeIncluir1>
<PodeExcluir1>
   select count(*) from FIN_Titulos where pPId={ChaveAtual_0} and iVer=iVAt and tPgmto is null and lPrevisao=0; Essa conta no pode ser excluida porque j foi paga ou  uma previso
</PodeExcluir1>
<PodeAlterar1>
</PodeAlterar1>
al_Get_fsLoad_include.php-inicio
fsLoadTag
fsLoadBloco
fsLoadFTag
fsLoadFBloco
al_Get_fsLoad_include.php-fim-sTxt=<Padrao_1>   
   sTagMnemTDoc     = FIN_Titulos
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1
   sTagCpo          = Cpo1
   sTagSql = Sql1
   sTagMainTable    = FIN_Titulos
   sTagMenu         = Menu1
   sTagNr0          = Nr01
   sTagTipoNr0      = TipoNr01
   sTagToolsBar     = Incluir,Excluir,Alterar,Zoom,Pesquisar
   sTagMarcacao     = true
   sTagRAc          = false
   sTagPesquisar    = Pesquisar1
   sTagDbToVars     = DbToVars1
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1
   sTagVarsToServer = VarsToServer1
   sTagVarsToDb     = VarsToDb1
   sTagServerVal    = ServerValids1
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagSubGrid      = 1,2,3,4,5
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
</Padrao_1>
<Tit1>Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao</Tit1>
<CpoTit1>
[Id]-s-10
</CpoTit1>
<Cpo1>
   $aLin["PPID"]
   $aLin["PPID"]
</Cpo1>
<colA>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 50px_">
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PPID"] . '</td>
     </tr>
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><b>Capa(*)</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PCAPA"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Ordem</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PORDEM"]==0 ? '' : $aLin["PORDEM"])  . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>PreNF</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PPRENF"]==0 ? '' : $aLin["PPRENF"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["LPREVISAO"]==1 ? ($aLin["PNFE"]==0 ? '' : $aLin["PNFE"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Transf</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTRANSF"]==0 ? '' : $aLin["PTRANSF"]) . '</td>
     </tr>
    </table>'
</colA>
<colB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
    </table>'
</colB>
<colBB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTFINORIG"]==0 ? '' : $aLin["PTFINORIG"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
     </tr>
    </table>'
</colBB>
<colC>
   ((date('Ymd',strtotime($aLin["TVENC"])) < date('Ymd') && ($aLin["TPGMTO"]== ''))
   ? '<font color=#BB0000>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td><td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
            <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
   </font>' :
   '<font color=blue>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').'</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
          <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
    </font>')
</colC>
<colD>
   ($aLin["DCANC"]<>''
   ?
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
       <tr>
          <td style="text-align: left"><b>Agendando</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Pagamento</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Valor</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
       </tr>
    </table>'
   :
   ($aLin["TPGMTO"]== ''
   ?
   '<font color=#BB0000>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendando</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
   </font>' :
   '<font color=blue>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendado</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
    </font>'))
</colD>
<colE>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 380px_">
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Nr.Conta</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCC"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Dg</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDAC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Agncia</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGE"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Nr.Ag</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGENR"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDESBANCO"] . '</td>
      <td style="text-align: left_ width:  5px_"><b>Cod.Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCODBANCO"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Tipo Cob</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td colspan="2" style="text-align: left_             ">' . $aLin["STIPOCOB"] . '</td>
     </tr>
   </table>'
</colE>
<colF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . ' [' .($aLin["LAGENCIASACADO"]==1 ? $aLin["SAGENCIASACADO"] : ($aLin["SCNPJSACADO"]!='' ? $aLin["SCNPJSACADO"] : $aLin["SCPFSACADO"])) . ']' . '</td>
     </tr>
    </table>'
</colF>
<colFF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . ' [' .($aLin["LAGENCIACEDENTE"]==1 ? $aLin["SAGENCIACEDENTE"] : ($aLin["SCNPJCEDENTE"]!='' ? $aLin["SCNPJCEDENTE"] : $aLin["SCPFCEDENTE"])) . ']' . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . '</td>
     </tr>
    </table>'
</colFF>
<Sql1>
select a.sDoc,
                   a.jTipo,
                   a.pCedente,
                   a.pSacado,
                   a.tEmissao,
                   a.tEnvCnab,
                   a.tEnvBol,
                   a.tIn0,
                   a.tRestr,
                   a.tLibRestr,
                   b.sCoringa sCedente,
                   b.sCNPJ    sCNPJCedente,
                   b.sCPF     sCPFCedente,
                   b.sAgencia    sAgenciaCedente,
                   b.lAgencia    lAgenciaCedente,
                   c.sCoringa sSacado,
                   c.sCNPJ    sCNPJSacado,
                   c.sCPF     sCPFSacado, 
                   c.sAgencia    sAgenciaSacado,
                   c.lAgencia    lAgenciaSacado,
                   a.pCapa,
                   a.lCapa,
                   a.tVenc,
                   a.tVenc0,
                   a.nVenc,
                   a.tCanc  dCanc,
                   a.jOri,
                   a.tPgmto,
                   a.nPgmto,
                   a.lPrevisao,
                   a.tAgend,
                   a.iIde_nNF,
                   a.pOrdem,
                   a.pNFe,
                   a.pPreNF,
                   a.pTransf,
                   a.pContr,
                   a.iPrest,
                   a.iNrPrest,
                   a.pTOper,
                   d.sDescricao sTOper,
                   d.sCodigo    sCodTOper,
                   a.iNfNFs,
                   a.pCC,
                   g.sCC        sCC,
                   g.sDac       sDac,
                   h.sAgencia   sAgeNr,
                   h.sCoringa   sAge,
                   h.pBanco     pBanco,
                   h.fBanco     fBanco,
                   i.sCodigo    sCodBanco,
                   i.sDescricao sDesBanco,
                   c.pCliGrupo,
                   l.sGrupo sCliGrupo,
                   a.pTipoCob,
                   e.sDescricao  sTipoCob,
                   e.sCodigo     sCodTipoCob,
                   a.fTipoCob,
                   b.pForGrupo,
                   j.sGrupo sForGrupo,
                   r.tConf      tOrdemConf,
                   a.pTFinOrig,
                   a.lOrcNA,
                   a.pPId 
            from FIN_Titulos a      join CUP            b on a.pCedente  = b.pPId and b.iVer = b.iVAt
                                    join CUP            c on a.pSacado   = c.pPId and c.iVer = c.iVAt
                               left join TOper          d on a.pTOper    = d.pPId and d.iVer = d.iVAt
                               left join CC             g on a.pCC       = g.pPid and g.iVer = g.iVAt
                               left join CUP            h on g.pAgencia  = h.pPid and h.iVer = h.iVAt
                               left join Banco          i on h.pBanco    = i.pPid and i.iVer = i.iVAt
                               left join Tipo_Cobrancas e on a.pTipoCob  = e.pPId and e.iVer = e.iVAt
                               left join Ordens         r on a.pOrdem    = r.pPId and r.iVer = r.iVAt and r.tCanc is null 
                               left join GrupoCUP       j on b.pForGrupo = j.pPId and j.iVer = j.iVAt
                               left join GrupoCUP       l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt
            where a.iVer = a.iVAt
              and a.lExc = 0
              and cast(a.tEmissao as date)>= '2023-06-01'
and cast(a.tEmissao as date)<= '2023-09-21'
and a.pSacado  = 5
and a.pCC = 1227
            order by a.iIde_nNF,a.pOrdem</Sql1>
<SqlSumRange2>
   select '','','A Pagar / Pago / Total ++ ',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '','',''
   from FIN_Titulos a left join TOper d on a.pTOper = d.pPId and  d.iVer = d.iVAt
                       left join CC         g on a.pCC      = g.pPid and g.iVer = g.iVAt
                       left join CUP        h on g.pAgencia = h.pPid and h.iVer = h.iVAt
                       left join Banco      i on h.pBanco   = i.pPid and i.iVer = i.iVAt
                      left join Tipo_Cobrancas    e on a.pTipoCob = e.pPId and e.iVer = e.iVAt
                       left join Ordens            r on a.pOrdem   = r.pPId and r.iVer = r.iVAt,
        CUP         b left join GrupoCUP         j on b.pForGrupo   = j.pPId and j.iVer=j.iVAt, 
        CUP         c left join GrupoCUP         l on c.pCliGrupo   = l.pPId and l.iVer=l.iVAt  
 where a.iVer = a.iVAt
     and a.pCedente = b.pPId and b.iVer = b.iVAt
     and a.pSacado  = c.pPId and c.iVer = c.iVAt
     and a.lExc = 0
     and a.jTipo = 1
     and {VarsRange}
</SqlSumRange2>
<SqlSum2_1>
   select '',
          '',
          'Marcados',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          '',
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '',
          ''
   from FIN_Titulos  a
 where a.iVer     = a.iVAt
     and a.lExc   = 0
     and a.pPId in ({sInMarcados})
     and a.jTipo  = 1
</SqlSum2_1>
<SumFormat1>
s-0
s-0
s-0
n-12-2
n-12-2
n-12-2
s-0
i-0                 
</SumFormat1>
<Pesquisar1>
   (
    (a.iIde_nNF          like '%{p0}%')
 or (a.pPId              like '%{p0}%')
 or (a.pOrdem            like '%{p0}%')
 or (a.pPreNF            like '%{p0}%')
 or (a.pTransf           like '%{p0}%')
 or (a.pNFe              like '%{p0}%')
 or (upper(d.sCodigo)    like '%{p0}%')
 or (upper(d.sDescricao) like '%{p0}%')
 or (upper(a.sDoc)       like '%{p0}%')
 or (upper(b.sCoringa)   like '%{p0}%')
 or (upper(c.sCoringa)   like '%{p0}%')
 or (upper(a.sDadoDoc)   like '%{p0}%')   
   )
</Pesquisar1>
<Nr01>alert("Qtux-Dialog\n\nNada a relacionar ...")</Nr01>
<Nr02>oGrid.flGridInc()</Nr02>
<TipoNr01>0</TipoNr01>
<TipoNr02>1</TipoNr02>
<TelaTit1>
   Ficha do Ttulo
</TelaTit1>
<DbToVars1>
   select a.tInc                      ,
          a.iVer                      ,
          a.iVAt                      ,
          a.sVer                      ,
          a.pPId,
          a.tIn0  dIn0,
          a.tEnvBol dEnvBol,
          a.jOri                      ,
          a.pCapa,
          a.lCapa,
          a.jTipo                     ,
          a.sDoc                      ,
          a.nQtMoe                    ,
          a.sDescricao                ,
          a.sObs                      ,
          a.nBruto                    ,
          a.tVenc    dVenc            ,
          a.tVenc,
          a.nVenc                     ,
          a.tPgmto  dPgmto           ,
          a.nPgmto                    ,
          a.tEmissao dEmissao         ,
          a.tProc    dProc            ,
          a.iCartBc                   ,
          a.sCartCod                  ,
          a.sEspecie                  ,
          a.lAceite                   ,
          a.nVMDAtraso                ,
          a.nDesc                     ,
          a.nAbat                     ,
          a.nAcr                      ,
          a.nMora                     ,
          a.nJur                      ,
          a.nMulta                    ,
          a.nIOF                      ,
          a.iDAviso                   ,
          a.pCedente                  ,
          a.fCedente                  ,
          b.sCoringa    sCedente      ,
          b.sCNPJ  sCedCNPJ,
          b.sCPF   sCedCPF,
          b.sFanta  sCedFanta,
          a.pSacado                   ,
          a.fSacado                   ,
          j.sCoringa sSacado          ,
          j.sCoringa sSacado1         ,
          j.sCNPJ  sSacCNPJ,
          j.sCPF   sSacCPF,
          j.sFanta,
          j.sPassaporte,
          a.pMoe                      ,
          kk.sDescricao   sDescMoe    ,
          a.fMoe                      ,
          a.lMEstrang                 ,
          a.pCam                      ,
          a.fCam                      ,
          d.nCam                      ,
          d.tCam                      ,
          k.sCodigo      sMoeCambio   ,
          a.pFPgmto                   ,
          a.fFPgmto                   ,
          e.sDescricao   sFPgmto      ,
          e.jFPmgto,
          a.pAcordo,
          a.lPrevisao,
          a.pOrdem,
          a.pPreNF,
          a.pNFe,
          a.iIde_nNF,
          a.pCC,
          a.fCC,
          g.pAgencia,
          g.fAgencia,
          g.sDescricao  sDesCC,
          g.sCC        sCC,
          g.sDac       sDac,
          h.sAgencia   sAgeNr,
          h.sCoringa   sAge,
          h.pBanco     pBanco,
          h.fBanco     fBanco,
          i.sCodigo    sCodBanco,
          i.sDescricao sDesBanco,
          j1.sCoringa   sCorrentista1,
          j1.sCNPJ      sCNPJCor1,
          j1.sCPF       sCPFCor1,
          a.pCCCUP,
          a.fCCCUP,
          gg.sDescricao  sDesCCCUP,
          gg.pAgencia   pAgenciaCUP,
          gg.fAgencia   fAgenciaCUP,
          gg.sCC        sCCCUP,
          gg.sDac       sDacCUP,
          gg.jTpPix     jTpPixCUP,
          gg.sChavePix  sChavePixCUP,
          hh.sAgencia   sAgeNrCUP,
          hh.sCoringa   sAgeCUP,
          hh.pBanco     pBancoCUP,
          hh.fBanco     fBancoCUP,
          ii.sCodigo    sCodBancoCUP,
          ii.sDescricao sDesBancoCUP,
          jj.sCoringa   sCorrentistaCUP,
          jj.sCNPJ      sCNPJCor,
          jj.sCPF       sCPFCor,
          a.pContr,
          f.sDescricao sDesContr,
          f.sCodigo    sCodContr,
          a.fContr,
          a.nIRRF,
          a.nPCC,
          a.iPrest,
          a.iNrPrest,
          a.pTipoCob,
          c.sDescricao  sTipoCob,
          c.sCodigo     sCodTipoCob,
          a.fTipoCob,
          a.pAgend,
          l.sCoringa sAgend,
          a.tAgend dAgend,
          a.pCanc,
          m.sCoringa sCanc,
          a.tCanc    dCanc,
          a.sMotivo,
          a.pDescanc,
          n.sCoringa sDescanc,
          a.tCanc    dDescanc,
          a.sDescMotivo,
          a.pEmissor,
          o.sCoringa sEmissor,
          z.sCoringa,
          zz.sCoringa  sCoringaIn0,
          r.tBaixCanh dBaixCanh,
          r.tEntReal  dEntReal,
          a.pEnvBol,
          pp.sCoringa sEnvBol,
          a.tRestr dRestr,
          a.pRestr,
          a.tLibRestr dLibRestr,
          a.pLibRestr,
          p1.sCoringa sLibRestr,
          p2.sCoringa sRestr,
          a.pTransf,
          a.fTransf,
          a.tProrrog dProrrog,
          a.nDescCTR,
          a.tVenc0 dVenc0,
          a.lComissao,
          a.pPFinHold_Linha,
          a.pPFinHold,
          a.pHold,
          a.fPFinHold_Linha,
          a.fPFinHold,
          a.fHold,
          a.lOrcNA,
          l1.sCoringa sHold,
          a.tOrcNA       dOrcNA,
          a.pOrcNA,
          t.sCoringa sOrcNA,
          a.lOrcNA,
          p.tIde_Emi dIde_Emi,
          a.jCCDefault,
          a.lAut3,
          a.pAut3,
          a.jFPmgtoCUP,
         r3.sCoringa   sAut3,
         g3.pAgencia   pAgencia3,
         g3.fAgencia   fAgencia3,
         g3.sCC        sCC3,
         g3.sDac       sDac3,
         g3.jTpPix     jTpPix3,
         g3.sChavePix  sChavePix3,
         h3.sAgencia   sAgeNr3,
         h3.sCoringa   sAge3,
         h3.pBanco     pBanco3,
         h3.fBanco     fBanco3,
         i3.sCodigo    sCodBanco3,
         i3.sDescricao sDesBanco3,
         j3.sCoringa   sCorrentista3
   from   FIN_Titulos  a       join CUP              b on  a.pCedente     =  b.pPId and  b.iVer =  b.iVat
                               join CUP              j on  a.pSacado      =  j.pPId and  j.iVer =  j.iVat
                               join CUP              z on  a.pInc         =  z.pPId and  z.iVer =  z.iVat
                               join CUP             zz on  a.pIn0         = zz.pPId and zz.iVer = zz.iVat
                          left join Cambio           d on  a.pCam         =  d.pPid and  d.iVer =  a.fCam
                          left join Moeda            k on  d.pMoe2        =  k.pPId and  k.iVer =  k.iVAt
                          left join FPgmto           e on  a.pFPgmto      =  e.pPId and  e.iVer =  e.iVat
                          left join Moeda           kk on  a.pMoe         = kk.pPId and kk.iVer = kk.iVAt 
                          left join PreNF            r on  a.pPreNF       =  r.pPId and  r.iVer =  r.iVat
                          left join CC               g on  a.pCC          =  g.pPid and  g.iVer =  g.iVAt
                          left join CUP             j1 on  g.pCUP         = j1.pPId and j1.iVer = j1.iVAt
                          left join CUP              h on  g.pAgencia     =  h.pPid and  h.iVer =  h.iVAt
                          left join Banco            i on  h.pBanco       =  i.pPid and  i.iVer =  i.iVAt
                          left join CC              gg on  a.pCCCUP       = gg.pPid and gg.iVer = gg.iVAt
                          left join CUP             jj on gg.pCUP         = jj.pPId and jj.iVer = jj.iVAt
                          left join CUP             hh on gg.pAgencia     = hh.pPid and hh.iVer = hh.iVAt
                          left join Banco           ii on hh.pBanco       = ii.pPid and ii.iVer = ii.iVAt
                          left join ConComSerIns     f on  a.pContr       =  f.pPId and  f.iVer =  f.iVAt
                          left join Tipo_Cobrancas   c on  a.pTipoCob     =  c.pPId and  c.iVer =  c.iVAt
                          left join CUP              l on  a.pAgend       =  l.pPid and  l.iVer =  l.iVAt
                          left join CUP              m on  a.pCanc        =  m.pPid and  m.iVer =  m.iVAt
                          left join CUP              n on  a.pDescanc     =  n.pPid and  n.iVer =  n.iVAt
                          left join CUP              o on  a.pEmissor     =  o.pPid and  o.iVer =  o.iVAt
                          left join NFCapa           p on  a.pNFe         =  p.pPid and  p.iVer =  p.iVAt
                          left join CUP             pp on  a.pEnvBol      = pp.pPid and pp.iVer = pp.iVAt
                          left join CUP             p1 on  a.pLibRestr    = p1.pPid and p1.iVer = p1.iVAt
                          left join CUP             p2 on  a.pRestr       = p2.pPid and p2.iVer = p2.iVAt
                          left join CUP             l1 on  a.pHold        = l1.pPid and l1.iVer = l1.iVAt
                          left join CUP              t on  a.pOrcNA       =  t.pPid and  t.iVer =  t.iVAt
                          left join CUP     r3 on  a.pAut3     = r3.pPId and r3.iVer = r3.iVAt
                          left join CC      g3 on r3.pCC       = g3.pPId and g3.iVer = g3.iVAt
                          left join CUP     j3 on g3.pCUP      = j3.pPId and j3.iVer = j3.iVAt
                          left join CUP     h3 on g3.pAgencia  = h3.pPid and h3.iVer = h3.iVAt
                          left join Banco   i3 on h3.pBanco    = i3.pPid and i3.iVer = i3.iVAt
   where  a.pPId = {pId}
     and  a.iVer = {a.iVer}
</DbToVars1>
<1>
   select a.pPId       pFIN_Titulos_CCusto_i,
          b.pPId       pCCusto_i,
          a.fCCusto    fCCusto_i,
          b.sCCUsto    sCCusto_i,
          a.nValPCCus  nValPCCus_i,
          cast(a.nValPCCus/100*c.nVenc as numeric(15,2)) nValMCCus_i
   from FIN_Titulos_CCusto a,
        CCusto             b,
        FIN_Titulos        c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pCCusto = b.pPId
     and b.iVer    = b.iVAt
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
   order by b.sCCUsto
</1>
<2>  
   select a.pPId          pFIN_Titulos_CCorrCred_i,
          g.pPId          pCCorrCred_i,
          a.fCC           fCCorrCred_i,
          g.pAgencia      pAgeCred_i,
          g.fAgencia      fAgeCred_i,
          g.sCC           sCCCred_i,
          g.sDac          sDacCred_i,
          h.sAgencia      sAgeCredNr_i,
          h.sCoringa      sAgeCred_i,
          h.pBanco        pBancoCred_i,
          h.fBanco        fBancoCred_i,
          i.sCodigo       sCodCred_i,
          i.sDescricao    sDesCred_i,
          a.nValPCCred    nValPCCred_i,
          a.nValMCCred    nValMCCred_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC          =  g.pPid  and  g.iVer  =  g.iVAt
                         left join CUP        h  on  g.pAgencia     =  h.pPid  and  h.iVer  =  h.iVAt
                         left join Banco      i  on  h.pBanco       =  i.pPid  and  i.iVer  =  i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by i.sDescricao,h.sAgencia,h.sAgencia
</2>
<3>  
   select a.pPId         pFIN_Titulos_CCorrDeb_i,
          g.pPId         pCCorrDeb_i,
          a.fCC          fCCorrDeb_i,
          g.pAgencia     pAgeDeb_i,
          g.fAgencia     fAgeDeb_i,
          g.sCC          sCCDeb_i,
          g.sDac         sDacDeb_i,
          h.sAgencia     sAgeDebNr_i,
          h.sCoringa     sAgeDeb_i,
          h.pBanco       pBancoDeb_i,
          h.fBanco       fBancoDeb_i,
          i.sCodigo      sCodDeb_i,
          i.sDescricao   sDesDeb_i,
          a.nValPCCDeb   nValPCCDeb_i,
          a.nValMCCDeb   nValMCCDeb_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC         =  g.pPid  and  g.iVer  = g.iVAt
                         left join CUP        h  on  g.pAgencia    =  h.pPid  and  h.iVer  = h.iVAt
                         left join Banco      i  on  h.pBanco      =  i.pPid  and  i.iVer  = i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by i.sDescricao,h.sAgencia,h.sAgencia
</3>
<4>
   select a.pPId          pFIN_Titulos_CContCred_i,
          e.pPId          pCContCred_i,
          a.fCPla         fCContCred_i,
          e.sCodigo       sCodCredPla_i,
          e.sDescricao    sDesCredPla_i,
          a.nValPCContC   nValPCContC_i,
          cast(a.nValPCContC/100*c.nVenc as numeric(15,2)) nValMCContC_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by e.sCodigo,e.sDescricao
</4>
<5>
   select a.pPId         pFIN_Titulos_CContDeb_i,
          e.pPId         pCContDeb_i,
          a.fCPla        fCContDeb_i,
          e.sCodigo      sCodDebPla_i,
          e.sDescricao   sDesDebPla_i,
          a.nValPCContD  nValPCContD_i,
          cast(a.nValPCContD/100*c.nVenc as numeric(15,2)) nValMCContD_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by e.sCodigo,e.sDescricao
</5>
<VarsDefault1>   
   sVerVAt   = {iVer+'/'+iVAt}
   sRastro   = {sVerVAt+', '+sCoringa+', '+tInc}
   aOri      = Manual, Automatica, Transferencia
   jTipo     = 1   
   aTipo     = Crdito & Cobrana , Pagamento
   mObs      = {sObs}
   mMotivo   = {sMotivo}
   mDescMotivo = {sDescMotivo}
   iContr    = {pContr  ==0 ? '' : pContr  }
   iOrdem    = {pOrdem  ==0 ? '' : pOrdem  }
   iPreNF    = {pPreNF  ==0 ? '' : pPreNF  }
   iNFe      = {pNFe    ==0 ? '' : pNFe    }
   iTransf   = {pTransf ==0 ? '' : pTransf }
   iIde_nNF2 = {iIde_nNF==0 ? '' : iIde_nNF}
   sCodSac   = {pSacado==0 ? '' : pSacado}
   dEmissao  = {flDiaDeHj()} ;
   aTpPix    = Telefone,CPF/CNPJ,Email,Chave Aleatria
   aCCDef    = Beneficirio,Terceiro
   aFPmgto   = Indefinido,Boleto Bancario,Cred em CC/DOC/TED/PIX-(se houver),Tributo Com Cod Barras,Tributo Sem Cod Barras,Concessionria
</VarsDefault1>
<ScriptForm1>   
   Rastreabilidade       ; sRastro-100   ; fontweight='bold' ; editable=false ; visible=(iDDFChamada>0)
   Verso                ; sVer-60       ; editable=false ; fieldborder=0
   Identificao         ;               ; fontweight='bold'
   Origem                        ; aOri[jOri]      ; identlabel=5 ; editable=false ;
   Tipo                          ; aTipo[jTipo]    ; identlabel=5 ; editable=false
   Previso                      ; lPrevisao-5    ; identlabel=5  ; editable=lComissao==1
   ;
   Id Titulo                     ; pPId-10               ; identlabel=5 ; editable=false 
   Id Ordem                      ; iOrdem-10             ; identlabel=5 ; editable=false 
   Id PreNF                      ; iPreNF-10             ; identlabel=5 ; editable=false 
   Id Nota                       ; iNFe-10               ; identlabel=5 ; editable=false 
   Id Transferencia              ; iTransf-10            ; identlabel=5 ; editable=false 
   Nr.Doc.Origem                 ; sDoc-20               ; identlabel=5 ; valid=((sDoc!=''),'O Nmero do Documento deve ser informado') ; editable=(dPgmto=='')
   Nr.Prest / Total Prest        ; iPrest-3,iNrPrest-3   ; identlabel=5 ; 
   Nr.Nota                       ; iIde_nNF2-8           ; identlabel=5 ; 
   ;
   Dados da Emisso   ;  ; fontweight='bold'
   Data de Emisso do Ttulo     ; dEmissao        ; identlabel=5 ; editable=((jOri==0)&&(dPgmto==''))
   Data de Emisso NFe           ; dIde_Emi        ; identlabel=5 ; editable=false
   ;
   Dados Cedente/Sacado   ;  ; fontweight='bold'
   Cedente  (quem recebe)        ; sCedente-50     ; identlabel=5 ;  editable=((jOri==0)&&(dPgmto=='')) ;  esc=('dd_files/CUP.dda','Esc_Padrao_7','sCedente','pCedente,sCedente,stmp,sCedCPF,stmp,stmp,sCedCNPJ,stmp,stmp,fCedente,pCCCUP,fCCCUP,pAgenciaCUP,fAgenciaCUP,sAgeNrCUP,sAgeCUP,sCCCUP,sDacCUP,pBancoCUP,fBancoCUP,sCodBancoCUP,sDesBancoCUP,sCorrentistaCUP,pCUP,sCNPJCor,sCPFCor,sCedFanta,pMoe,sDescMoe,fMoe,pTipoCob,fTipoCob,sTipoCob,sCodTipoCob,pFPgmto,fFPgmto,sFPgmto,sDescricao,mObs,pTmp1_{1},pCCusto_{1},fCCusto_{1},sCCusto_{1},nValPCCus_{1},pTmp5_{5},pCContDeb_{5},fCContDeb_{5},sCodDebPla_{5},sDesDebPla_{5},nValPCContD_{5}') ; editable=(dPgmto=='')
   Nome Fantasia                 ; sCedFanta-50    ; identlabel=5 ; visible=(sCedFanta!='') ; editable=false ;
   CNPJ                          ; sCedCNPJ-15     ; identlabel=5 ; visible=(sCedCNPJ!='')  ; editable=false ;
   CPF                           ; sCedCPF-15      ; identlabel=5 ; visible=(sCedCPF!='')   ; editable=false ;
   Sacado   (quem paga)          ; sSacado-50      ; identlabel=5 ;  editable=(dPgmto=='')  ; esc=('dd_files/UNeg.dda','Esc_Padrao_1','sSacado' ,'pSacado,sSacado,fSacado,stmp,stmp,stmp,pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge')
   ;
   Descrio da Conta            ; sDescricao-50   ; identlabel=5 ; 
   Observaes                   ; mObs-50-5-2500   ; identlabel=5 ; editable=(dPgmto=='')
   ;
   Dados do Vencimento           ;                 ; fontweight='bold'
   Agendado                      ; dAgend-20     ; identlabel=5 ;  visible=(dAgend!='') ;  editable=false 
   Agendado por                  ; sAgend-60     ; identlabel=5 ;  visible=(pAgend>0)   ;  editable=false
   ; ;  visible=(pAgend	>0)
   Data de Vencimento de Origem  ; dVenc0          ; identlabel=5 ; editable=false 
   Data de Vencimento            ; dVenc           ; identlabel=5 ; editable=(((jOri==0)&&(dPgmto=='')&&(tVenc=='')) || (pAcordo>0))
   ;
   Moeda                         ; sDescMoe-18    ; identlabel=5 ;esc=('dd_files/erp_Moeda.dda','Esc_Padrao_1','sDescMoe','pMoe,sCodMoe,sDescMoe,fMoe') ; editable=(dPgmto=='')
   ;
   IRRF  (Rec.)                        ; nIRRF-18-2      ; identlabel=5 ; visible=(pSacado==160) ; editable=(dPgmto=='')
   PCC   (Rec.)                       ; nPCC-18-2      ; identlabel=5  ; visible=(pSacado==160) ; editable=(dPgmto=='')
   ; ; visible=(pSacado==160)
   Valor Bruto                   ; nBruto-18-2      ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(((jOri==0)&&(dPgmto=='')) || (pAcordo>0))
   Valor do Desconto             ; nDesc-18-2       ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Acrscimo            ; nAcr-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor da Mora                 ; nMora-18-2      ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Juros                ; nJur-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')          
   Valor da Multa                ; nMulta-18-2     ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do IOF                  ; nIOF-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor a Pagar                 ; nVenc-18-2      ; identlabel=5  ; editable=false
   ;
   Dados do Pagamento            ;                 ; fontweight='bold'
   Data                          ; dPgmto          ; identlabel=5 ; editable=false
   Valor Pago                    ; nPgmto-18-2     ; identlabel=5 ; editable=false
   ;
   Regras de pagamentos ;; fontweight='bold' ; colspan=true
   Tipo Pagamento Oper Eletronica CUP ; aFPmgto[jFPmgtoCUP] ; identlabel=5 ; 
   ;
   Formas de pagamentos               ; sFPgmto-50      ; identlabel=5 ;esc=('dd_files/erp_FPgmto.dda','Esc_Padrao_1','sFPgmto','pFPgmto,sFPgmto,fFPgmto,jFPmgto') ; editable=(dPgmto=='')
   Tipo Pagamento Oper Eletronica Pol ; aFPmgto[jFPmgto] ; identlabel=5 ; editable=false
   ;
   Tipo de Cobrana     ; sTipoCob-50   ; identlabel=5 ; esc=('dd_files/erp_Tipo_Cobrancas.dda','Esc_Padrao_2','sTipoCob,pSacado','pTipoCob,sCodTipoCob,sTipoCob,fTipoCob') ; editable=(dPgmto=='')
                        ; sCodTipoCob-30      ; identlabel=5 ;  editable=false ; visible=(pTipoCob>0)
   ;
   Conta corrente do Cedente para Titulos de pagamento ;; fontweight='bold' ; colspan=true
      Nmero da Conta                 ; sCCCUP-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2f','sCCCUP,pCedente','pCCCUP,sAgeNrCUP,sCCCUP,sDacCUP,pBancoCUP,sCodBancoCUP,sDesBancoCUP,fCCCUP,sAgeCUP,sCorrentistaCUP,pCUP,SDESCC,LBANCARIA,sCNPJCor,sCPFCor,jTpPixCUP,sChavePixCUP') 
      Dgito                          ; sDacCUP-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNrCUP-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAgeCUP-50              ; identlabel=10 ; editable=false 
      Correntista                     ; sCorrentistaCUP-50      ; identlabel=10 ; editable=false 
      CNPJ                            ; sCNPJCor-15             ; identlabel=10 ; visible=(sCNPJCor!='') ; editable=false ;
      CPF                             ; sCPFCor-15              ; identlabel=10 ; visible=(sCPFCor!='')  ; editable=false ;
      Codigo do Banco                 ; sCodBancoCUP-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBancoCUP-50         ; identlabel=10 ; editable=false 
      Tipo PIX                        ; aTpPix[jTpPixCUP]       ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
      Chave PIX                       ; sChavePixCUP-50         ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
   ;
   CC DEFAULT para pagamento ;; fontweight='bold' ; colspan=true ; 
   Default                         ; aCCDef[jCCDefault]   ; identlabel=10 ;  
   ;
   Dados de Terceiro para pagamento ;; fontweight='bold' ; colspan=true
   Autorizao                     ; lAut3                ; identlabel=10 ; 
   Terceiro                        ; sAut3-50             ; identlabel=10 ; esc=('dd_files/CUP.dda','Esc_Padrao_1a','sAut3','pAut3,sAut3,jTipo3,sCPF3,sRG3,sOE3,sCNPJ3,sIE3,sIM3,iVer3,pCC3,fCC3,pAgencia3,fAgencia3,sAgeNr3,sAge3,sCC3,sDac3,pBanco3,fBanco3,sCodBanco3,sDesBanco3,sCorrentista3,pCUP3,sCNPJCor3,sCPFCor3,sFanta3,jTpPix3,sChavePix3')
   Nmero da Conta                 ; sCC3-8               ; identlabel=10 ; editable=false ; 
   Dgito                          ; sDac3-1              ; identlabel=10 ; editable=false ; 
   Nr da Agncia                   ; sAgeNr3-30           ; identlabel=10 ; editable=false ; 
   Nome da Agncia                 ; sAge3-50             ; identlabel=10 ; editable=false ; 
   Correntista                     ; sCorrentista3-50     ; identlabel=10 ; editable=false ; 
   Codigo do Banco                 ; sCodBanco3-50        ; identlabel=10 ; editable=false ; 
   Nome do Banco                   ; sDesBanco3-50        ; identlabel=10 ; editable=false ; 
   Tipo PIX                        ; aTpPix[jTpPix3]      ; identlabel=10 ; editable=false ; 
   Chave PIX                       ; sChavePix3-50        ; identlabel=10 ; editable=false ; 
   ;
   Conta Corrente Sacado             ;; fontweight='bold'; 
      Nmero da Conta                 ; sCC-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2b','sCC,pSacado','pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge') ; editable=(dPgmto=='')
      Dgito                          ; sDac-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNr-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAge-50              ; identlabel=10 ; editable=false 
      Codigo do Banco                 ; sCodBanco-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBanco-50         ; identlabel=10 ; editable=false 
;
Dados da Restrio Oramento       ;                 ; fontweight='bold' ; 
   Em Restrio                   ; dRestr-20   ; identlabel=5 ; editable=false
   Restrito por                   ; sRestr-50 ; identlabel=5 ; editable=false
   ;
   Data da Liberao              ; dLibRestr-20  ; identlabel=5 ; editable=false
   Liberado por                   ; sLibRestr-50 ; identlabel=5 ; editable=false
   ;
Nivel de Aviso de Oramento           ;              ; fontweight='bold'; edtzoom=true ; visible=(jTipo==1)
   Excedeu Oramento                  ; lOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=(jTipo==1)
   Liberado em                        ; dOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(dOrcNA!=''))
   Liberado por                       ; sOrcNA-60    ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(pOrcNA>0))
Cancelado                 ;                 ; fontweight='bold' ; visible=(pCanc>0)
   Cancelado                     ; dCanc-20        ; identlabel=5 ;  visible=(dCanc!='') ; editable=false
   Cancelado por                 ; sCanc-20        ; identlabel=5 ;  visible=(pCanc>0)  ; editable=false
   Motivo                        ; mMotivo-50-5-2500  ; identlabel=5 ;  visible=(mMotivo!='') ; editable=false
   ; ; visible=(pCanc>0)
Descancelado                 ;                 ; fontweight='bold' ; visible=(pDescanc>0)
   Descancelado                     ; dDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Descancelado por                 ; sDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Motivo                           ; mDescMotivo-50-5-2500  ; identlabel=5 ;  visible=(mDescMotivo!='') ; editable=false
   ; ; visible=(pDescanc>0)
;
;
Os campos abaixo so para RATEAR o valor do Ttulo. Para fazer isso  necessrio ler as regras abaixo. ;; colspan=true ; fontcolor='#FF0000'
1) Para cada grupos de rateio voce devera distribui as porcentagens(%)                                      ;; colspan=true ; fontcolor='#FF0000' 
2) A soma do rateio em porcentagens deve ser 100(%)                                                    ;; colspan=true ; fontcolor='#FF0000'
;
Centros de Custos ;; fontweight='bold';
   SubGrid-1 {
      (i)) Centro de Custo ; sCCusto_i-50     ; identlabel=5 ; esc=('dd_files/erp_CCusto.dda','Esc_Padrao_1','sCCusto_i','pCCusto_i,sTmp,sCCusto_i,fCCusto_i') ; visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em (%)        ; nValPCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em ($)       ; nValMCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=false
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(1,"pCCusto")_'>Incluir novo Centro de Custo</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
Contas Contabil de DBITO;; fontweight='bold';
   SubGrid-5 {
     (i)) Plano de Contas DBITO        ; sCodDebPla_i-10     ; identlabel=5 ; esc=('dd_files/erp_PlaConta.dda','Esc_Padrao_1','sCodDebPla_i','pCContDeb_i,sCodDebPla_i,sDesDebPla_i,fCContDeb_i') ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5))	; editable=(dPgmto=='')
     Descrio                          ; sDesDebPla_i-30     ; identlabel=5 ; visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
     Rateio em (%)                      ; nValPCContD_i-18-5   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=(dPgmto=='')
     Rateio em ($)                      ; nValMCContD_i-18-2   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
      ;   ; visible=(((i))<=(iTotLinSubGridPreenchidos_5))
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(5,"pCContDeb")_'>Incluir nova Conta Contabil de Dbito</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
</ScriptForm1>
<VarsToServer1>
   iIde_nNF = iIde_nNF2
   pCedente
   fCedente
   pSacado  
   fSacado   
   tEmissao = dEmissao
   tProrrog = dProrrog
   nDescCTR
   nBruto
   pEmissor
   pCC
   fCC
   pCCCUP
   fCCCUP
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pContr
   fContr
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs = mObs
   tVenc  = dVenc
   tVenc0 = dVenc0=='' ? dVenc : dVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso   
   pFPgmto
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   iVer
   pFIN_Titulos_CCusto_{i}
   pCCusto_{i}
   fCCusto_{i}
   nValPCCus_{i}
   nValMCCus_{i}
   lExc_{i} = pCCusto_{i}==0 ? 1 : 0
   pFIN_Titulos_CCorrCred_{i}
   pCCorrCred_{i}
   fCCorrCred_{i}
   nValPCCred_{i}
   nValMCCred_{i}
   pFIN_Titulos_CCorrDeb_{i}
   pCCorrDeb_{i}
   fCCorrDeb_{i}
   nValPCCDeb_{i}
   nValMCCDeb_{i}
   pFIN_Titulos_CContCred_{i}
   pCContCred_{i}
   fCContCred_{i}
   nValPCContC_{i}
   nValMCContC_{i}
   lExc_{i} = pCContCred_{i}==0 ? 1 : 0
   pFIN_Titulos_CContDeb_{i}
   pCContDeb_{i}
   fCContDeb_{i}
   nValPCContD_{i}
   nValMCContD_{i}
   lExc_{i} = pCContDeb_{i}==0 ? 1 : 0
</VarsToServer1>
<VarsToDb1>
   sDDFTabela = FIN_Titulos
   iIde_nNF
   pCedente
   fCedente
   pSacado  
   fSacado 
   tEmissao 
   pEmissor 
   tProrrog
   nDescCTR
   pCC
   fCC
   pCCCUP
   fCCCUP
   pContr
   fContr
   nBruto
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs       
   tVenc      
   tVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   tLimDesc  
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso  
   pFPgmto 
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   sDDFSubTabela = FIN_Titulos_CCusto
   pSubPId     = $_POST[pFIN_Titulos_CCusto_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCCusto     = $_POST[pCCusto_{i}]
   fCCusto     = $_POST[fCCusto_{i}]
   nValPCCus   = $_POST[nValPCCus_{i}]
   nValMCCus   = $_POST[nValMCCus_{i}]
   lExc        = $_POST[pCCusto_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrCred_{i}]
   fCC         = $_POST[fCCorrCred_{i}]
   lDeb        = 0
   nValPCCred  = $_POST[nValPCCred_{i}]
   nValMCCred  = $_POST[nValMCCred_{i}]
   lExc        = $_POST[pCCorrCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrDeb_{i}]
   fCC         = $_POST[fCCorrDeb_{i}]
   lDeb        = 1
   nValPCCDeb  = $_POST[nValPCCDeb_{i}]
   nValMCCDeb  = $_POST[nValMCCDeb_{i}]
   lExc        = $_POST[pCCorrDeb_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCPla       = $_POST[pCContCred_{i}]
   fCPla       = $_POST[fCContCred_{i}]
   lDeb        = 0
   nValPCContC = $_POST[nValPCContC_{i}]
   nValMCContC = $_POST[nValMCContC_{i}]
   lExc        = $_POST[pCContCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]
   pCPla       = $_POST[pCContDeb_{i}]
   fCPla       = $_POST[fCContDeb_{i}]
   lDeb        = 1
   nValPCContD = $_POST[nValPCContD_{i}]
   nValMCContD = $_POST[nValMCContD_{i}]
   lExc        = $_POST[pCContDeb_{i}]==0 ? 1 : 0
</VarsToDb1>
<ServerValids1>
   pCedente   ;  $_POST[.]>0   ; O Cedente deve ser preenchido
   pSacado    ;  $_POST[.]>0   ; O Sacado deve ser preenchido
   sDoc       ;  $_POST[.]!='' ; O Nmero do Documento deve ser informado
   pMoe       ;  $_POST[.]>0   ; A Moeda deve ser informada
   pTipoCob   ;  $_POST[.]>0   ; O Tipo de Cobrana deve ser informado
   pFPgmto    ;  $_POST[.]>0   ; A Forma de Pagamento de ser informada 
   tVenc      ;  strlen($_POST[.])>0 ; A Data de Vencimento deve ser informada   
   tEmissao   ;  strlen($_POST[.])>0 ; A Data da Emisso deve ser informada   
   tEmissao   ;  strtotime($_POST[.]) <= strtotime('now') ; A Data da Emisso deve ser menor que data e hora de agora.  
</ServerValids1>
<PodeIncluir1>
</PodeIncluir1>
<PodeExcluir1>
   select count(*) from FIN_Titulos where pPId={ChaveAtual_0} and iVer=iVAt and tPgmto is null and lPrevisao=0; Essa conta no pode ser excluida porque j foi paga ou  uma previso
</PodeExcluir1>
<PodeAlterar1>
</PodeAlterar1>
psTagDDS=Padrao_1
fsTratarIncAltSeq-inicio
fsTratarIncAltSeq-fim
psVarTmp=
iTmp=0
psVarTmp no  um JSON
explode
sVarsDDA=$sTagMnemTDoc = 'FIN_Titulos';
$sTagTit = 'Tit1';
$sTagCpoTit = 'CpoTit1';
$sTagCpo = 'Cpo1';
$sTagSql = 'Sql1';
$sTagMainTable = 'FIN_Titulos';
$sTagMenu = 'Menu1';
$sTagNr0 = 'Nr01';
$sTagTipoNr0 = 'TipoNr01';
$sTagToolsBar = 'Incluir,Excluir,Alterar,Zoom,Pesquisar';
$sTagMarcacao = 'true';
$sTagRAc = 'false';
$sTagPesquisar = 'Pesquisar1';
$sTagDbToVars = 'DbToVars1';
$sTagVarsDef = 'VarsDefault1';
$sTagScript = 'ScriptForm1';
$sTagVarsToServer = 'VarsToServer1';
$sTagVarsToDb = 'VarsToDb1';
$sTagServerVal = 'ServerValids1';
$sTagTitulo = 'TelaTit1';
$sLabelsAlign = 'Left';
$sTagSubGrid = '1,2,3,4,5';
$sTagPodeIncluir = 'PodeIncluir1';
$sTagPodeExcluir = 'PodeExcluir1';
$sTagPodeAlterar = 'PodeAlterar1';

sTagMainTable=FIN_Titulos
sTagTit=Tit1
1) sTitGrid=Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao
---dd_files/erp_EDI_Fin_MontagemLotesEDI.dda / Padrao_1
sCpo=$aLin["PPID"]
2)sAlias=
sCpo=$aLin["PPID"]
2)sAlias=
sAliasColunas=~
x) sTagSql=Sql1
sQry=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
sTxt=<Padrao_1>   
   sTagMnemTDoc     = FIN_Titulos
   sTagTit          = Tit1
   sTagCpoTit       = CpoTit1
   sTagCpo          = Cpo1
   sTagSql = Sql1
   sTagMainTable    = FIN_Titulos
   sTagMenu         = Menu1
   sTagNr0          = Nr01
   sTagTipoNr0      = TipoNr01
   sTagToolsBar     = Incluir,Excluir,Alterar,Zoom,Pesquisar
   sTagMarcacao     = true
   sTagRAc          = false
   sTagPesquisar    = Pesquisar1
   sTagDbToVars     = DbToVars1
   sTagVarsDef      = VarsDefault1
   sTagScript       = ScriptForm1
   sTagVarsToServer = VarsToServer1
   sTagVarsToDb     = VarsToDb1
   sTagServerVal    = ServerValids1
   sTagTitulo       = TelaTit1
   sLabelsAlign     = Left
   sTagSubGrid      = 1,2,3,4,5
   sTagPodeIncluir  = PodeIncluir1
   sTagPodeExcluir  = PodeExcluir1
   sTagPodeAlterar  = PodeAlterar1
</Padrao_1>
<Tit1>Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao</Tit1>
<CpoTit1>
[Id]-s-10
</CpoTit1>
<Cpo1>
   $aLin["PPID"]
   $aLin["PPID"]
</Cpo1>
<colA>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 50px_">
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PPID"] . '</td>
     </tr>
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><b>Capa(*)</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["PCAPA"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Ordem</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PORDEM"]==0 ? '' : $aLin["PORDEM"])  . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>PreNF</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PPRENF"]==0 ? '' : $aLin["PPRENF"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["LPREVISAO"]==1 ? ($aLin["PNFE"]==0 ? '' : $aLin["PNFE"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Transf</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTRANSF"]==0 ? '' : $aLin["PTRANSF"]) . '</td>
     </tr>
    </table>'
</colA>
<colB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
    </table>'
</colB>
<colBB>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 200px_">
     <tr style="display: '.(($aLin["PCAPA"]>0)? '': 'none').'">
      <td style="text-align: left_ width: 25px_"><i>Detalhe</i></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">&nbsp_</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Doc.Orig</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDOC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Prest</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . $aLin["IPREST"] . '/' . $aLin["INRPREST"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Nr.Nota</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["LPREVISAO"]==0 ? ($aLin["IIDE_NNF"]==0 ? '' : $aLin["IIDE_NNF"]) : '') . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_<br></td>
      <td style="text-align: left_             ">' . ($aLin["JORI"]==0 ? 'Man' : ($aLin["JORI"]==1 ? 'Aut' : 'Transf')) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 25px_"><b>Titulo Orig</b><br></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTFINORIG"]==0 ? '' : $aLin["PTFINORIG"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
     </tr>
    </table>'
</colBB>
<colC>
   ((date('Ymd',strtotime($aLin["TVENC"])) < date('Ymd') && ($aLin["TPGMTO"]== ''))
   ? '<font color=#BB0000>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td><td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
            <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
   </font>' :
   '<font color=blue>
      <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
         <tr>
            <td>'.($aLin["LPREVISAO"]==0 ? '' : '[Previso]').'</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Emisso</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TEMISSAO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TEMISSAO"]))) . '</td>
         </tr>
         <tr>
            <td>'.($aLin["TVENC"]!=$aLin["TVENC0"] ? '[Prorrogado/Antecipado]' : ' ').' </td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Vencimento</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . ($aLin["TVENC"]=='' ? '' : date('d-m-Y',strtotime($aLin["TVENC"]))) . '</td>
         </tr>
         <tr>
            <td style="text-align: left"><b>Valor</b></td>
            <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
            <td>' . number_format($aLin["NVENC"],2,',','.') . '</td>
         </tr>
         <tr>
          <td colspan="7" style="text-align: left_" >' .($aLin["LORCNA"]==0 ? '' : '<font color=#BB0000>'.'Retido por NA de oramento'.'</font>') . '</td>
         </tr>
      </table>
    </font>')
</colC>
<colD>
   ($aLin["DCANC"]<>''
   ?
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
       <tr>
          <td style="text-align: left"><b>Agendando</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Pagamento</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
       </tr>
       <tr>
          <td style="text-align: left"><b>Valor</b></td>
          <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
          <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
       </tr>
    </table>'
   :
   ($aLin["TPGMTO"]== ''
   ?
   '<font color=#BB0000>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendando</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
   </font>' :
   '<font color=blue>
       <table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 100px_">
          <tr>
             <td style="text-align: left"><b>Agendado</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TAGEND"]=='' ? '' : date('d-m-Y',strtotime($aLin["TAGEND"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Pagamento</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . ($aLin["TPGMTO"]=='' ? '' : date('d-m-Y',strtotime($aLin["TPGMTO"]))). '</td>
          </tr>
          <tr>
             <td style="text-align: left"><b>Valor</b></td>
             <td>&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
             <td>' . number_format($aLin["NPGMTO"],2,',','.')  . '</td>
          </tr>
       </table>
    </font>'))
</colD>
<colE>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt_ font-family: verdana_ font-size: 10px_ color: inherit_ width: 380px_">
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Nr.Conta</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCC"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Dg</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDAC"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 50px_"><b>Agncia</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGE"] . '</td>
      <td style="text-align: left_ width: 5px_"><b>Nr.Ag</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SAGENR"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SDESBANCO"] . '</td>
      <td style="text-align: left_ width:  5px_"><b>Cod.Banco</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_             ">' . $aLin["SCODBANCO"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width:  50px_"><b>Tipo Cob</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td colspan="2" style="text-align: left_             ">' . $aLin["STIPOCOB"] . '</td>
     </tr>
   </table>'
</colE>
<colF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . ' [' .($aLin["LAGENCIASACADO"]==1 ? $aLin["SAGENCIASACADO"] : ($aLin["SCNPJSACADO"]!='' ? $aLin["SCNPJSACADO"] : $aLin["SCPFSACADO"])) . ']' . '</td>
     </tr>
    </table>'
</colF>
<colFF>
   '<table cellspacing="0" cellpadding="0" cellmargin="0" style="margin:5pt; font-family: verdana_ font-size: 10px_ color: inherit_ width: 600px_">
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Tipo Oper.</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . ($aLin["PTOPER"]==0 ? '' : '['.$aLin["SCODTOPER"].']'.' - '.$aLin["STOPER"]) . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Cedente</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SCEDENTE"] . ' [' .($aLin["LAGENCIACEDENTE"]==1 ? $aLin["SAGENCIACEDENTE"] : ($aLin["SCNPJCEDENTE"]!='' ? $aLin["SCNPJCEDENTE"] : $aLin["SCPFCEDENTE"])) . ']' . '</td>
     </tr>
     <tr>
      <td style="text-align: left_ width: 70px_"><b>Sacado</b></td>
      <td style="text-align: left_ width:  5px_">&nbsp_&nbsp_&nbsp_-&nbsp_&nbsp_&nbsp_</td>
      <td style="text-align: left_" >' . $aLin["SSACADO"] . '</td>
     </tr>
    </table>'
</colFF>
<Sql1>
select a.sDoc,
                   a.jTipo,
                   a.pCedente,
                   a.pSacado,
                   a.tEmissao,
                   a.tEnvCnab,
                   a.tEnvBol,
                   a.tIn0,
                   a.tRestr,
                   a.tLibRestr,
                   b.sCoringa sCedente,
                   b.sCNPJ    sCNPJCedente,
                   b.sCPF     sCPFCedente,
                   b.sAgencia    sAgenciaCedente,
                   b.lAgencia    lAgenciaCedente,
                   c.sCoringa sSacado,
                   c.sCNPJ    sCNPJSacado,
                   c.sCPF     sCPFSacado, 
                   c.sAgencia    sAgenciaSacado,
                   c.lAgencia    lAgenciaSacado,
                   a.pCapa,
                   a.lCapa,
                   a.tVenc,
                   a.tVenc0,
                   a.nVenc,
                   a.tCanc  dCanc,
                   a.jOri,
                   a.tPgmto,
                   a.nPgmto,
                   a.lPrevisao,
                   a.tAgend,
                   a.iIde_nNF,
                   a.pOrdem,
                   a.pNFe,
                   a.pPreNF,
                   a.pTransf,
                   a.pContr,
                   a.iPrest,
                   a.iNrPrest,
                   a.pTOper,
                   d.sDescricao sTOper,
                   d.sCodigo    sCodTOper,
                   a.iNfNFs,
                   a.pCC,
                   g.sCC        sCC,
                   g.sDac       sDac,
                   h.sAgencia   sAgeNr,
                   h.sCoringa   sAge,
                   h.pBanco     pBanco,
                   h.fBanco     fBanco,
                   i.sCodigo    sCodBanco,
                   i.sDescricao sDesBanco,
                   c.pCliGrupo,
                   l.sGrupo sCliGrupo,
                   a.pTipoCob,
                   e.sDescricao  sTipoCob,
                   e.sCodigo     sCodTipoCob,
                   a.fTipoCob,
                   b.pForGrupo,
                   j.sGrupo sForGrupo,
                   r.tConf      tOrdemConf,
                   a.pTFinOrig,
                   a.lOrcNA,
                   a.pPId 
            from FIN_Titulos a      join CUP            b on a.pCedente  = b.pPId and b.iVer = b.iVAt
                                    join CUP            c on a.pSacado   = c.pPId and c.iVer = c.iVAt
                               left join TOper          d on a.pTOper    = d.pPId and d.iVer = d.iVAt
                               left join CC             g on a.pCC       = g.pPid and g.iVer = g.iVAt
                               left join CUP            h on g.pAgencia  = h.pPid and h.iVer = h.iVAt
                               left join Banco          i on h.pBanco    = i.pPid and i.iVer = i.iVAt
                               left join Tipo_Cobrancas e on a.pTipoCob  = e.pPId and e.iVer = e.iVAt
                               left join Ordens         r on a.pOrdem    = r.pPId and r.iVer = r.iVAt and r.tCanc is null 
                               left join GrupoCUP       j on b.pForGrupo = j.pPId and j.iVer = j.iVAt
                               left join GrupoCUP       l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt
            where a.iVer = a.iVAt
              and a.lExc = 0
              and cast(a.tEmissao as date)>= '2023-06-01'
and cast(a.tEmissao as date)<= '2023-09-21'
and a.pSacado  = 5
and a.pCC = 1227
            order by a.iIde_nNF,a.pOrdem</Sql1>
<SqlSumRange2>
   select '','','A Pagar / Pago / Total ++ ',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nPgmto) AS NUMERIC(15,2)),
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '','',''
   from FIN_Titulos a left join TOper d on a.pTOper = d.pPId and  d.iVer = d.iVAt
                       left join CC         g on a.pCC      = g.pPid and g.iVer = g.iVAt
                       left join CUP        h on g.pAgencia = h.pPid and h.iVer = h.iVAt
                       left join Banco      i on h.pBanco   = i.pPid and i.iVer = i.iVAt
                      left join Tipo_Cobrancas    e on a.pTipoCob = e.pPId and e.iVer = e.iVAt
                       left join Ordens            r on a.pOrdem   = r.pPId and r.iVer = r.iVAt,
        CUP         b left join GrupoCUP         j on b.pForGrupo   = j.pPId and j.iVer=j.iVAt, 
        CUP         c left join GrupoCUP         l on c.pCliGrupo   = l.pPId and l.iVer=l.iVAt  
 where a.iVer = a.iVAt
     and a.pCedente = b.pPId and b.iVer = b.iVAt
     and a.pSacado  = c.pPId and c.iVer = c.iVAt
     and a.lExc = 0
     and a.jTipo = 1
     and {VarsRange}
</SqlSumRange2>
<SqlSum2_1>
   select '',
          '',
          'Marcados',
          cast(sum(a.nVenc-a.nPgmto) AS NUMERIC(15,2)),
          '',
          cast(sum(a.nVenc) AS NUMERIC(15,2)),
          '',
          ''
   from FIN_Titulos  a
 where a.iVer     = a.iVAt
     and a.lExc   = 0
     and a.pPId in ({sInMarcados})
     and a.jTipo  = 1
</SqlSum2_1>
<SumFormat1>
s-0
s-0
s-0
n-12-2
n-12-2
n-12-2
s-0
i-0                 
</SumFormat1>
<Pesquisar1>
   (
    (a.iIde_nNF          like '%{p0}%')
 or (a.pPId              like '%{p0}%')
 or (a.pOrdem            like '%{p0}%')
 or (a.pPreNF            like '%{p0}%')
 or (a.pTransf           like '%{p0}%')
 or (a.pNFe              like '%{p0}%')
 or (upper(d.sCodigo)    like '%{p0}%')
 or (upper(d.sDescricao) like '%{p0}%')
 or (upper(a.sDoc)       like '%{p0}%')
 or (upper(b.sCoringa)   like '%{p0}%')
 or (upper(c.sCoringa)   like '%{p0}%')
 or (upper(a.sDadoDoc)   like '%{p0}%')   
   )
</Pesquisar1>
<Nr01>alert("Qtux-Dialog\n\nNada a relacionar ...")</Nr01>
<Nr02>oGrid.flGridInc()</Nr02>
<TipoNr01>0</TipoNr01>
<TipoNr02>1</TipoNr02>
<TelaTit1>
   Ficha do Ttulo
</TelaTit1>
<DbToVars1>
   select a.tInc                      ,
          a.iVer                      ,
          a.iVAt                      ,
          a.sVer                      ,
          a.pPId,
          a.tIn0  dIn0,
          a.tEnvBol dEnvBol,
          a.jOri                      ,
          a.pCapa,
          a.lCapa,
          a.jTipo                     ,
          a.sDoc                      ,
          a.nQtMoe                    ,
          a.sDescricao                ,
          a.sObs                      ,
          a.nBruto                    ,
          a.tVenc    dVenc            ,
          a.tVenc,
          a.nVenc                     ,
          a.tPgmto  dPgmto           ,
          a.nPgmto                    ,
          a.tEmissao dEmissao         ,
          a.tProc    dProc            ,
          a.iCartBc                   ,
          a.sCartCod                  ,
          a.sEspecie                  ,
          a.lAceite                   ,
          a.nVMDAtraso                ,
          a.nDesc                     ,
          a.nAbat                     ,
          a.nAcr                      ,
          a.nMora                     ,
          a.nJur                      ,
          a.nMulta                    ,
          a.nIOF                      ,
          a.iDAviso                   ,
          a.pCedente                  ,
          a.fCedente                  ,
          b.sCoringa    sCedente      ,
          b.sCNPJ  sCedCNPJ,
          b.sCPF   sCedCPF,
          b.sFanta  sCedFanta,
          a.pSacado                   ,
          a.fSacado                   ,
          j.sCoringa sSacado          ,
          j.sCoringa sSacado1         ,
          j.sCNPJ  sSacCNPJ,
          j.sCPF   sSacCPF,
          j.sFanta,
          j.sPassaporte,
          a.pMoe                      ,
          kk.sDescricao   sDescMoe    ,
          a.fMoe                      ,
          a.lMEstrang                 ,
          a.pCam                      ,
          a.fCam                      ,
          d.nCam                      ,
          d.tCam                      ,
          k.sCodigo      sMoeCambio   ,
          a.pFPgmto                   ,
          a.fFPgmto                   ,
          e.sDescricao   sFPgmto      ,
          e.jFPmgto,
          a.pAcordo,
          a.lPrevisao,
          a.pOrdem,
          a.pPreNF,
          a.pNFe,
          a.iIde_nNF,
          a.pCC,
          a.fCC,
          g.pAgencia,
          g.fAgencia,
          g.sDescricao  sDesCC,
          g.sCC        sCC,
          g.sDac       sDac,
          h.sAgencia   sAgeNr,
          h.sCoringa   sAge,
          h.pBanco     pBanco,
          h.fBanco     fBanco,
          i.sCodigo    sCodBanco,
          i.sDescricao sDesBanco,
          j1.sCoringa   sCorrentista1,
          j1.sCNPJ      sCNPJCor1,
          j1.sCPF       sCPFCor1,
          a.pCCCUP,
          a.fCCCUP,
          gg.sDescricao  sDesCCCUP,
          gg.pAgencia   pAgenciaCUP,
          gg.fAgencia   fAgenciaCUP,
          gg.sCC        sCCCUP,
          gg.sDac       sDacCUP,
          gg.jTpPix     jTpPixCUP,
          gg.sChavePix  sChavePixCUP,
          hh.sAgencia   sAgeNrCUP,
          hh.sCoringa   sAgeCUP,
          hh.pBanco     pBancoCUP,
          hh.fBanco     fBancoCUP,
          ii.sCodigo    sCodBancoCUP,
          ii.sDescricao sDesBancoCUP,
          jj.sCoringa   sCorrentistaCUP,
          jj.sCNPJ      sCNPJCor,
          jj.sCPF       sCPFCor,
          a.pContr,
          f.sDescricao sDesContr,
          f.sCodigo    sCodContr,
          a.fContr,
          a.nIRRF,
          a.nPCC,
          a.iPrest,
          a.iNrPrest,
          a.pTipoCob,
          c.sDescricao  sTipoCob,
          c.sCodigo     sCodTipoCob,
          a.fTipoCob,
          a.pAgend,
          l.sCoringa sAgend,
          a.tAgend dAgend,
          a.pCanc,
          m.sCoringa sCanc,
          a.tCanc    dCanc,
          a.sMotivo,
          a.pDescanc,
          n.sCoringa sDescanc,
          a.tCanc    dDescanc,
          a.sDescMotivo,
          a.pEmissor,
          o.sCoringa sEmissor,
          z.sCoringa,
          zz.sCoringa  sCoringaIn0,
          r.tBaixCanh dBaixCanh,
          r.tEntReal  dEntReal,
          a.pEnvBol,
          pp.sCoringa sEnvBol,
          a.tRestr dRestr,
          a.pRestr,
          a.tLibRestr dLibRestr,
          a.pLibRestr,
          p1.sCoringa sLibRestr,
          p2.sCoringa sRestr,
          a.pTransf,
          a.fTransf,
          a.tProrrog dProrrog,
          a.nDescCTR,
          a.tVenc0 dVenc0,
          a.lComissao,
          a.pPFinHold_Linha,
          a.pPFinHold,
          a.pHold,
          a.fPFinHold_Linha,
          a.fPFinHold,
          a.fHold,
          a.lOrcNA,
          l1.sCoringa sHold,
          a.tOrcNA       dOrcNA,
          a.pOrcNA,
          t.sCoringa sOrcNA,
          a.lOrcNA,
          p.tIde_Emi dIde_Emi,
          a.jCCDefault,
          a.lAut3,
          a.pAut3,
          a.jFPmgtoCUP,
         r3.sCoringa   sAut3,
         g3.pAgencia   pAgencia3,
         g3.fAgencia   fAgencia3,
         g3.sCC        sCC3,
         g3.sDac       sDac3,
         g3.jTpPix     jTpPix3,
         g3.sChavePix  sChavePix3,
         h3.sAgencia   sAgeNr3,
         h3.sCoringa   sAge3,
         h3.pBanco     pBanco3,
         h3.fBanco     fBanco3,
         i3.sCodigo    sCodBanco3,
         i3.sDescricao sDesBanco3,
         j3.sCoringa   sCorrentista3
   from   FIN_Titulos  a       join CUP              b on  a.pCedente     =  b.pPId and  b.iVer =  b.iVat
                               join CUP              j on  a.pSacado      =  j.pPId and  j.iVer =  j.iVat
                               join CUP              z on  a.pInc         =  z.pPId and  z.iVer =  z.iVat
                               join CUP             zz on  a.pIn0         = zz.pPId and zz.iVer = zz.iVat
                          left join Cambio           d on  a.pCam         =  d.pPid and  d.iVer =  a.fCam
                          left join Moeda            k on  d.pMoe2        =  k.pPId and  k.iVer =  k.iVAt
                          left join FPgmto           e on  a.pFPgmto      =  e.pPId and  e.iVer =  e.iVat
                          left join Moeda           kk on  a.pMoe         = kk.pPId and kk.iVer = kk.iVAt 
                          left join PreNF            r on  a.pPreNF       =  r.pPId and  r.iVer =  r.iVat
                          left join CC               g on  a.pCC          =  g.pPid and  g.iVer =  g.iVAt
                          left join CUP             j1 on  g.pCUP         = j1.pPId and j1.iVer = j1.iVAt
                          left join CUP              h on  g.pAgencia     =  h.pPid and  h.iVer =  h.iVAt
                          left join Banco            i on  h.pBanco       =  i.pPid and  i.iVer =  i.iVAt
                          left join CC              gg on  a.pCCCUP       = gg.pPid and gg.iVer = gg.iVAt
                          left join CUP             jj on gg.pCUP         = jj.pPId and jj.iVer = jj.iVAt
                          left join CUP             hh on gg.pAgencia     = hh.pPid and hh.iVer = hh.iVAt
                          left join Banco           ii on hh.pBanco       = ii.pPid and ii.iVer = ii.iVAt
                          left join ConComSerIns     f on  a.pContr       =  f.pPId and  f.iVer =  f.iVAt
                          left join Tipo_Cobrancas   c on  a.pTipoCob     =  c.pPId and  c.iVer =  c.iVAt
                          left join CUP              l on  a.pAgend       =  l.pPid and  l.iVer =  l.iVAt
                          left join CUP              m on  a.pCanc        =  m.pPid and  m.iVer =  m.iVAt
                          left join CUP              n on  a.pDescanc     =  n.pPid and  n.iVer =  n.iVAt
                          left join CUP              o on  a.pEmissor     =  o.pPid and  o.iVer =  o.iVAt
                          left join NFCapa           p on  a.pNFe         =  p.pPid and  p.iVer =  p.iVAt
                          left join CUP             pp on  a.pEnvBol      = pp.pPid and pp.iVer = pp.iVAt
                          left join CUP             p1 on  a.pLibRestr    = p1.pPid and p1.iVer = p1.iVAt
                          left join CUP             p2 on  a.pRestr       = p2.pPid and p2.iVer = p2.iVAt
                          left join CUP             l1 on  a.pHold        = l1.pPid and l1.iVer = l1.iVAt
                          left join CUP              t on  a.pOrcNA       =  t.pPid and  t.iVer =  t.iVAt
                          left join CUP     r3 on  a.pAut3     = r3.pPId and r3.iVer = r3.iVAt
                          left join CC      g3 on r3.pCC       = g3.pPId and g3.iVer = g3.iVAt
                          left join CUP     j3 on g3.pCUP      = j3.pPId and j3.iVer = j3.iVAt
                          left join CUP     h3 on g3.pAgencia  = h3.pPid and h3.iVer = h3.iVAt
                          left join Banco   i3 on h3.pBanco    = i3.pPid and i3.iVer = i3.iVAt
   where  a.pPId = {pId}
     and  a.iVer = {a.iVer}
</DbToVars1>
<1>
   select a.pPId       pFIN_Titulos_CCusto_i,
          b.pPId       pCCusto_i,
          a.fCCusto    fCCusto_i,
          b.sCCUsto    sCCusto_i,
          a.nValPCCus  nValPCCus_i,
          cast(a.nValPCCus/100*c.nVenc as numeric(15,2)) nValMCCus_i
   from FIN_Titulos_CCusto a,
        CCusto             b,
        FIN_Titulos        c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pCCusto = b.pPId
     and b.iVer    = b.iVAt
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
   order by b.sCCUsto
</1>
<2>  
   select a.pPId          pFIN_Titulos_CCorrCred_i,
          g.pPId          pCCorrCred_i,
          a.fCC           fCCorrCred_i,
          g.pAgencia      pAgeCred_i,
          g.fAgencia      fAgeCred_i,
          g.sCC           sCCCred_i,
          g.sDac          sDacCred_i,
          h.sAgencia      sAgeCredNr_i,
          h.sCoringa      sAgeCred_i,
          h.pBanco        pBancoCred_i,
          h.fBanco        fBancoCred_i,
          i.sCodigo       sCodCred_i,
          i.sDescricao    sDesCred_i,
          a.nValPCCred    nValPCCred_i,
          a.nValMCCred    nValMCCred_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC          =  g.pPid  and  g.iVer  =  g.iVAt
                         left join CUP        h  on  g.pAgencia     =  h.pPid  and  h.iVer  =  h.iVAt
                         left join Banco      i  on  h.pBanco       =  i.pPid  and  i.iVer  =  i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by i.sDescricao,h.sAgencia,h.sAgencia
</2>
<3>  
   select a.pPId         pFIN_Titulos_CCorrDeb_i,
          g.pPId         pCCorrDeb_i,
          a.fCC          fCCorrDeb_i,
          g.pAgencia     pAgeDeb_i,
          g.fAgencia     fAgeDeb_i,
          g.sCC          sCCDeb_i,
          g.sDac         sDacDeb_i,
          h.sAgencia     sAgeDebNr_i,
          h.sCoringa     sAgeDeb_i,
          h.pBanco       pBancoDeb_i,
          h.fBanco       fBancoDeb_i,
          i.sCodigo      sCodDeb_i,
          i.sDescricao   sDesDeb_i,
          a.nValPCCDeb   nValPCCDeb_i,
          a.nValMCCDeb   nValMCCDeb_i
   from FIN_Titulos_CC a left join CC         g  on  a.pCC         =  g.pPid  and  g.iVer  = g.iVAt
                         left join CUP        h  on  g.pAgencia    =  h.pPid  and  h.iVer  = h.iVAt
                         left join Banco      i  on  h.pBanco      =  i.pPid  and  i.iVer  = i.iVAt
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by i.sDescricao,h.sAgencia,h.sAgencia
</3>
<4>
   select a.pPId          pFIN_Titulos_CContCred_i,
          e.pPId          pCContCred_i,
          a.fCPla         fCContCred_i,
          e.sCodigo       sCodCredPla_i,
          e.sDescricao    sDesCredPla_i,
          a.nValPCContC   nValPCContC_i,
          cast(a.nValPCContC/100*c.nVenc as numeric(15,2)) nValMCContC_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 0
   order by e.sCodigo,e.sDescricao
</4>
<5>
   select a.pPId         pFIN_Titulos_CContDeb_i,
          e.pPId         pCContDeb_i,
          a.fCPla        fCContDeb_i,
          e.sCodigo      sCodDebPla_i,
          e.sDescricao   sDesDebPla_i,
          a.nValPCContD  nValPCContD_i,
          cast(a.nValPCContD/100*c.nVenc as numeric(15,2)) nValMCContD_i
   from FIN_Titulos_CContabil  a left join PlaConta   e on a.pCPla = e.pPid and e.iVer = a.fCPla,
        FIN_Titulos            c
   where a.iVer    = a.iVAt
     and a.lExc    = 0
     and a.pTFin   = c.pPId
     and c.iVer    = c.iVAt
     and a.pTFin   = {ChaveAtual_0}
     and a.lDeb    = 1
   order by e.sCodigo,e.sDescricao
</5>
<VarsDefault1>   
   sVerVAt   = {iVer+'/'+iVAt}
   sRastro   = {sVerVAt+', '+sCoringa+', '+tInc}
   aOri      = Manual, Automatica, Transferencia
   jTipo     = 1   
   aTipo     = Crdito & Cobrana , Pagamento
   mObs      = {sObs}
   mMotivo   = {sMotivo}
   mDescMotivo = {sDescMotivo}
   iContr    = {pContr  ==0 ? '' : pContr  }
   iOrdem    = {pOrdem  ==0 ? '' : pOrdem  }
   iPreNF    = {pPreNF  ==0 ? '' : pPreNF  }
   iNFe      = {pNFe    ==0 ? '' : pNFe    }
   iTransf   = {pTransf ==0 ? '' : pTransf }
   iIde_nNF2 = {iIde_nNF==0 ? '' : iIde_nNF}
   sCodSac   = {pSacado==0 ? '' : pSacado}
   dEmissao  = {flDiaDeHj()} ;
   aTpPix    = Telefone,CPF/CNPJ,Email,Chave Aleatria
   aCCDef    = Beneficirio,Terceiro
   aFPmgto   = Indefinido,Boleto Bancario,Cred em CC/DOC/TED/PIX-(se houver),Tributo Com Cod Barras,Tributo Sem Cod Barras,Concessionria
</VarsDefault1>
<ScriptForm1>   
   Rastreabilidade       ; sRastro-100   ; fontweight='bold' ; editable=false ; visible=(iDDFChamada>0)
   Verso                ; sVer-60       ; editable=false ; fieldborder=0
   Identificao         ;               ; fontweight='bold'
   Origem                        ; aOri[jOri]      ; identlabel=5 ; editable=false ;
   Tipo                          ; aTipo[jTipo]    ; identlabel=5 ; editable=false
   Previso                      ; lPrevisao-5    ; identlabel=5  ; editable=lComissao==1
   ;
   Id Titulo                     ; pPId-10               ; identlabel=5 ; editable=false 
   Id Ordem                      ; iOrdem-10             ; identlabel=5 ; editable=false 
   Id PreNF                      ; iPreNF-10             ; identlabel=5 ; editable=false 
   Id Nota                       ; iNFe-10               ; identlabel=5 ; editable=false 
   Id Transferencia              ; iTransf-10            ; identlabel=5 ; editable=false 
   Nr.Doc.Origem                 ; sDoc-20               ; identlabel=5 ; valid=((sDoc!=''),'O Nmero do Documento deve ser informado') ; editable=(dPgmto=='')
   Nr.Prest / Total Prest        ; iPrest-3,iNrPrest-3   ; identlabel=5 ; 
   Nr.Nota                       ; iIde_nNF2-8           ; identlabel=5 ; 
   ;
   Dados da Emisso   ;  ; fontweight='bold'
   Data de Emisso do Ttulo     ; dEmissao        ; identlabel=5 ; editable=((jOri==0)&&(dPgmto==''))
   Data de Emisso NFe           ; dIde_Emi        ; identlabel=5 ; editable=false
   ;
   Dados Cedente/Sacado   ;  ; fontweight='bold'
   Cedente  (quem recebe)        ; sCedente-50     ; identlabel=5 ;  editable=((jOri==0)&&(dPgmto=='')) ;  esc=('dd_files/CUP.dda','Esc_Padrao_7','sCedente','pCedente,sCedente,stmp,sCedCPF,stmp,stmp,sCedCNPJ,stmp,stmp,fCedente,pCCCUP,fCCCUP,pAgenciaCUP,fAgenciaCUP,sAgeNrCUP,sAgeCUP,sCCCUP,sDacCUP,pBancoCUP,fBancoCUP,sCodBancoCUP,sDesBancoCUP,sCorrentistaCUP,pCUP,sCNPJCor,sCPFCor,sCedFanta,pMoe,sDescMoe,fMoe,pTipoCob,fTipoCob,sTipoCob,sCodTipoCob,pFPgmto,fFPgmto,sFPgmto,sDescricao,mObs,pTmp1_{1},pCCusto_{1},fCCusto_{1},sCCusto_{1},nValPCCus_{1},pTmp5_{5},pCContDeb_{5},fCContDeb_{5},sCodDebPla_{5},sDesDebPla_{5},nValPCContD_{5}') ; editable=(dPgmto=='')
   Nome Fantasia                 ; sCedFanta-50    ; identlabel=5 ; visible=(sCedFanta!='') ; editable=false ;
   CNPJ                          ; sCedCNPJ-15     ; identlabel=5 ; visible=(sCedCNPJ!='')  ; editable=false ;
   CPF                           ; sCedCPF-15      ; identlabel=5 ; visible=(sCedCPF!='')   ; editable=false ;
   Sacado   (quem paga)          ; sSacado-50      ; identlabel=5 ;  editable=(dPgmto=='')  ; esc=('dd_files/UNeg.dda','Esc_Padrao_1','sSacado' ,'pSacado,sSacado,fSacado,stmp,stmp,stmp,pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge')
   ;
   Descrio da Conta            ; sDescricao-50   ; identlabel=5 ; 
   Observaes                   ; mObs-50-5-2500   ; identlabel=5 ; editable=(dPgmto=='')
   ;
   Dados do Vencimento           ;                 ; fontweight='bold'
   Agendado                      ; dAgend-20     ; identlabel=5 ;  visible=(dAgend!='') ;  editable=false 
   Agendado por                  ; sAgend-60     ; identlabel=5 ;  visible=(pAgend>0)   ;  editable=false
   ; ;  visible=(pAgend	>0)
   Data de Vencimento de Origem  ; dVenc0          ; identlabel=5 ; editable=false 
   Data de Vencimento            ; dVenc           ; identlabel=5 ; editable=(((jOri==0)&&(dPgmto=='')&&(tVenc=='')) || (pAcordo>0))
   ;
   Moeda                         ; sDescMoe-18    ; identlabel=5 ;esc=('dd_files/erp_Moeda.dda','Esc_Padrao_1','sDescMoe','pMoe,sCodMoe,sDescMoe,fMoe') ; editable=(dPgmto=='')
   ;
   IRRF  (Rec.)                        ; nIRRF-18-2      ; identlabel=5 ; visible=(pSacado==160) ; editable=(dPgmto=='')
   PCC   (Rec.)                       ; nPCC-18-2      ; identlabel=5  ; visible=(pSacado==160) ; editable=(dPgmto=='')
   ; ; visible=(pSacado==160)
   Valor Bruto                   ; nBruto-18-2      ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(((jOri==0)&&(dPgmto=='')) || (pAcordo>0))
   Valor do Desconto             ; nDesc-18-2       ; identlabel=5 ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Acrscimo            ; nAcr-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor da Mora                 ; nMora-18-2      ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do Juros                ; nJur-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')          
   Valor da Multa                ; nMulta-18-2     ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor do IOF                  ; nIOF-18-2       ; identlabel=5  ; exec=FIN_Titulos_versaoA_dda(this) ; editable=(dPgmto=='')
   Valor a Pagar                 ; nVenc-18-2      ; identlabel=5  ; editable=false
   ;
   Dados do Pagamento            ;                 ; fontweight='bold'
   Data                          ; dPgmto          ; identlabel=5 ; editable=false
   Valor Pago                    ; nPgmto-18-2     ; identlabel=5 ; editable=false
   ;
   Regras de pagamentos ;; fontweight='bold' ; colspan=true
   Tipo Pagamento Oper Eletronica CUP ; aFPmgto[jFPmgtoCUP] ; identlabel=5 ; 
   ;
   Formas de pagamentos               ; sFPgmto-50      ; identlabel=5 ;esc=('dd_files/erp_FPgmto.dda','Esc_Padrao_1','sFPgmto','pFPgmto,sFPgmto,fFPgmto,jFPmgto') ; editable=(dPgmto=='')
   Tipo Pagamento Oper Eletronica Pol ; aFPmgto[jFPmgto] ; identlabel=5 ; editable=false
   ;
   Tipo de Cobrana     ; sTipoCob-50   ; identlabel=5 ; esc=('dd_files/erp_Tipo_Cobrancas.dda','Esc_Padrao_2','sTipoCob,pSacado','pTipoCob,sCodTipoCob,sTipoCob,fTipoCob') ; editable=(dPgmto=='')
                        ; sCodTipoCob-30      ; identlabel=5 ;  editable=false ; visible=(pTipoCob>0)
   ;
   Conta corrente do Cedente para Titulos de pagamento ;; fontweight='bold' ; colspan=true
      Nmero da Conta                 ; sCCCUP-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2f','sCCCUP,pCedente','pCCCUP,sAgeNrCUP,sCCCUP,sDacCUP,pBancoCUP,sCodBancoCUP,sDesBancoCUP,fCCCUP,sAgeCUP,sCorrentistaCUP,pCUP,SDESCC,LBANCARIA,sCNPJCor,sCPFCor,jTpPixCUP,sChavePixCUP') 
      Dgito                          ; sDacCUP-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNrCUP-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAgeCUP-50              ; identlabel=10 ; editable=false 
      Correntista                     ; sCorrentistaCUP-50      ; identlabel=10 ; editable=false 
      CNPJ                            ; sCNPJCor-15             ; identlabel=10 ; visible=(sCNPJCor!='') ; editable=false ;
      CPF                             ; sCPFCor-15              ; identlabel=10 ; visible=(sCPFCor!='')  ; editable=false ;
      Codigo do Banco                 ; sCodBancoCUP-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBancoCUP-50         ; identlabel=10 ; editable=false 
      Tipo PIX                        ; aTpPix[jTpPixCUP]       ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
      Chave PIX                       ; sChavePixCUP-50         ; identlabel=10 ; editable=false ; visible=(sChavePixCUP!='')
   ;
   CC DEFAULT para pagamento ;; fontweight='bold' ; colspan=true ; 
   Default                         ; aCCDef[jCCDefault]   ; identlabel=10 ;  
   ;
   Dados de Terceiro para pagamento ;; fontweight='bold' ; colspan=true
   Autorizao                     ; lAut3                ; identlabel=10 ; 
   Terceiro                        ; sAut3-50             ; identlabel=10 ; esc=('dd_files/CUP.dda','Esc_Padrao_1a','sAut3','pAut3,sAut3,jTipo3,sCPF3,sRG3,sOE3,sCNPJ3,sIE3,sIM3,iVer3,pCC3,fCC3,pAgencia3,fAgencia3,sAgeNr3,sAge3,sCC3,sDac3,pBanco3,fBanco3,sCodBanco3,sDesBanco3,sCorrentista3,pCUP3,sCNPJCor3,sCPFCor3,sFanta3,jTpPix3,sChavePix3')
   Nmero da Conta                 ; sCC3-8               ; identlabel=10 ; editable=false ; 
   Dgito                          ; sDac3-1              ; identlabel=10 ; editable=false ; 
   Nr da Agncia                   ; sAgeNr3-30           ; identlabel=10 ; editable=false ; 
   Nome da Agncia                 ; sAge3-50             ; identlabel=10 ; editable=false ; 
   Correntista                     ; sCorrentista3-50     ; identlabel=10 ; editable=false ; 
   Codigo do Banco                 ; sCodBanco3-50        ; identlabel=10 ; editable=false ; 
   Nome do Banco                   ; sDesBanco3-50        ; identlabel=10 ; editable=false ; 
   Tipo PIX                        ; aTpPix[jTpPix3]      ; identlabel=10 ; editable=false ; 
   Chave PIX                       ; sChavePix3-50        ; identlabel=10 ; editable=false ; 
   ;
   Conta Corrente Sacado             ;; fontweight='bold'; 
      Nmero da Conta                 ; sCC-8                ; identlabel=10 ; esc=('dd_files/erp_CC.dda','Esc_Padrao_2b','sCC,pSacado','pCC,sAgeNr,sCC,sDac,pBanco,sCodBanco,sDesBanco,fCC,sAge') ; editable=(dPgmto=='')
      Dgito                          ; sDac-1               ; identlabel=10 ; editable=false 
      Nr da Agncia                   ; sAgeNr-30            ; identlabel=10 ; editable=false 
      Nome da Agncia                 ; sAge-50              ; identlabel=10 ; editable=false 
      Codigo do Banco                 ; sCodBanco-50         ; identlabel=10 ; editable=false 
      Nome do Banco                   ; sDesBanco-50         ; identlabel=10 ; editable=false 
;
Dados da Restrio Oramento       ;                 ; fontweight='bold' ; 
   Em Restrio                   ; dRestr-20   ; identlabel=5 ; editable=false
   Restrito por                   ; sRestr-50 ; identlabel=5 ; editable=false
   ;
   Data da Liberao              ; dLibRestr-20  ; identlabel=5 ; editable=false
   Liberado por                   ; sLibRestr-50 ; identlabel=5 ; editable=false
   ;
Nivel de Aviso de Oramento           ;              ; fontweight='bold'; edtzoom=true ; visible=(jTipo==1)
   Excedeu Oramento                  ; lOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=(jTipo==1)
   Liberado em                        ; dOrcNA       ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(dOrcNA!=''))
   Liberado por                       ; sOrcNA-60    ; editable=false ; fieldborder=0 ; identlabel=10 ; visible=((jTipo==1)&&(pOrcNA>0))
Cancelado                 ;                 ; fontweight='bold' ; visible=(pCanc>0)
   Cancelado                     ; dCanc-20        ; identlabel=5 ;  visible=(dCanc!='') ; editable=false
   Cancelado por                 ; sCanc-20        ; identlabel=5 ;  visible=(pCanc>0)  ; editable=false
   Motivo                        ; mMotivo-50-5-2500  ; identlabel=5 ;  visible=(mMotivo!='') ; editable=false
   ; ; visible=(pCanc>0)
Descancelado                 ;                 ; fontweight='bold' ; visible=(pDescanc>0)
   Descancelado                     ; dDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Descancelado por                 ; sDescanc-20           ; identlabel=5 ;  visible=(pDescanc>0) ; editable=false
   Motivo                           ; mDescMotivo-50-5-2500  ; identlabel=5 ;  visible=(mDescMotivo!='') ; editable=false
   ; ; visible=(pDescanc>0)
;
;
Os campos abaixo so para RATEAR o valor do Ttulo. Para fazer isso  necessrio ler as regras abaixo. ;; colspan=true ; fontcolor='#FF0000'
1) Para cada grupos de rateio voce devera distribui as porcentagens(%)                                      ;; colspan=true ; fontcolor='#FF0000' 
2) A soma do rateio em porcentagens deve ser 100(%)                                                    ;; colspan=true ; fontcolor='#FF0000'
;
Centros de Custos ;; fontweight='bold';
   SubGrid-1 {
      (i)) Centro de Custo ; sCCusto_i-50     ; identlabel=5 ; esc=('dd_files/erp_CCusto.dda','Esc_Padrao_1','sCCusto_i','pCCusto_i,sTmp,sCCusto_i,fCCusto_i') ; visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em (%)        ; nValPCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=(dPgmto=='')
      Rateio em ($)       ; nValMCCus_i-18-2 ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_1)) ; editable=false
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(1,"pCCusto")_'>Incluir novo Centro de Custo</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
Contas Contabil de DBITO;; fontweight='bold';
   SubGrid-5 {
     (i)) Plano de Contas DBITO        ; sCodDebPla_i-10     ; identlabel=5 ; esc=('dd_files/erp_PlaConta.dda','Esc_Padrao_1','sCodDebPla_i','pCContDeb_i,sCodDebPla_i,sDesDebPla_i,fCContDeb_i') ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5))	; editable=(dPgmto=='')
     Descrio                          ; sDesDebPla_i-30     ; identlabel=5 ; visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
     Rateio em (%)                      ; nValPCContD_i-18-5   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=(dPgmto=='')
     Rateio em ($)                      ; nValMCContD_i-18-2   ; identlabel=8 ;  visible=(((i))<=(iTotLinSubGridPreenchidos_5)) ; editable=false
      ;   ; visible=(((i))<=(iTotLinSubGridPreenchidos_5))
   }
   <span style='color: #00AA00_ text-decoration: underline_ cursor: pointer_' onclick='oTelaDefault.flIncSubGrid(5,"pCContDeb")_'>Incluir nova Conta Contabil de Dbito</span> ; ; identlabel=10; visible=(iDDFChamada<2)
;
</ScriptForm1>
<VarsToServer1>
   iIde_nNF = iIde_nNF2
   pCedente
   fCedente
   pSacado  
   fSacado   
   tEmissao = dEmissao
   tProrrog = dProrrog
   nDescCTR
   nBruto
   pEmissor
   pCC
   fCC
   pCCCUP
   fCCCUP
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pContr
   fContr
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs = mObs
   tVenc  = dVenc
   tVenc0 = dVenc0=='' ? dVenc : dVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso   
   pFPgmto
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   iVer
   pFIN_Titulos_CCusto_{i}
   pCCusto_{i}
   fCCusto_{i}
   nValPCCus_{i}
   nValMCCus_{i}
   lExc_{i} = pCCusto_{i}==0 ? 1 : 0
   pFIN_Titulos_CCorrCred_{i}
   pCCorrCred_{i}
   fCCorrCred_{i}
   nValPCCred_{i}
   nValMCCred_{i}
   pFIN_Titulos_CCorrDeb_{i}
   pCCorrDeb_{i}
   fCCorrDeb_{i}
   nValPCCDeb_{i}
   nValMCCDeb_{i}
   pFIN_Titulos_CContCred_{i}
   pCContCred_{i}
   fCContCred_{i}
   nValPCContC_{i}
   nValMCContC_{i}
   lExc_{i} = pCContCred_{i}==0 ? 1 : 0
   pFIN_Titulos_CContDeb_{i}
   pCContDeb_{i}
   fCContDeb_{i}
   nValPCContD_{i}
   nValMCContD_{i}
   lExc_{i} = pCContDeb_{i}==0 ? 1 : 0
</VarsToServer1>
<VarsToDb1>
   sDDFTabela = FIN_Titulos
   iIde_nNF
   pCedente
   fCedente
   pSacado  
   fSacado 
   tEmissao 
   pEmissor 
   tProrrog
   nDescCTR
   pCC
   fCC
   pCCCUP
   fCCCUP
   pContr
   fContr
   nBruto
   nIRRF
   nPCC
   pTipoCob
   fTipoCob
   iPrest
   iNrPrest
   jOri       
   jTipo      
   sDoc       
   nQtMoe     
   pMoe       
   fMoe       
   pCam       
   fCam       
   sDescricao 
   sObs       
   tVenc      
   tVenc0
   nVenc      
   iCartBc   
   sCartCod  
   sEspecie  
   lAceite   
   nVMDAtraso
   tLimDesc  
   nDesc     
   nAbat     
   nAcr      
   nMora     
   nJur      
   nMulta    
   nIOF      
   iDAviso  
   pFPgmto 
   fFPgmto
   lPrevisao
   jCCDefault
   lAut3
   pAut3
   jFPmgtoCUP
   sDDFSubTabela = FIN_Titulos_CCusto
   pSubPId     = $_POST[pFIN_Titulos_CCusto_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCCusto     = $_POST[pCCusto_{i}]
   fCCusto     = $_POST[fCCusto_{i}]
   nValPCCus   = $_POST[nValPCCus_{i}]
   nValMCCus   = $_POST[nValMCCus_{i}]
   lExc        = $_POST[pCCusto_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrCred_{i}]
   fCC         = $_POST[fCCorrCred_{i}]
   lDeb        = 0
   nValPCCred  = $_POST[nValPCCred_{i}]
   nValMCCred  = $_POST[nValMCCred_{i}]
   lExc        = $_POST[pCCorrCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CC
   pSubPId     = $_POST[pFIN_Titulos_CCorrDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCC         = $_POST[pCCorrDeb_{i}]
   fCC         = $_POST[fCCorrDeb_{i}]
   lDeb        = 1
   nValPCCDeb  = $_POST[nValPCCDeb_{i}]
   nValMCCDeb  = $_POST[nValMCCDeb_{i}]
   lExc        = $_POST[pCCorrDeb_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContCred_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]       
   pCPla       = $_POST[pCContCred_{i}]
   fCPla       = $_POST[fCContCred_{i}]
   lDeb        = 0
   nValPCContC = $_POST[nValPCContC_{i}]
   nValMCContC = $_POST[nValMCContC_{i}]
   lExc        = $_POST[pCContCred_{i}]==0 ? 1 : 0
   sDDFSubTabela = FIN_Titulos_CContabil
   pSubPId     = $_POST[pFIN_Titulos_CContDeb_{i}]
   pTFin       = {ChaveAtual_0}
   fTFin       = $_POST[iVer]
   pCPla       = $_POST[pCContDeb_{i}]
   fCPla       = $_POST[fCContDeb_{i}]
   lDeb        = 1
   nValPCContD = $_POST[nValPCContD_{i}]
   nValMCContD = $_POST[nValMCContD_{i}]
   lExc        = $_POST[pCContDeb_{i}]==0 ? 1 : 0
</VarsToDb1>
<ServerValids1>
   pCedente   ;  $_POST[.]>0   ; O Cedente deve ser preenchido
   pSacado    ;  $_POST[.]>0   ; O Sacado deve ser preenchido
   sDoc       ;  $_POST[.]!='' ; O Nmero do Documento deve ser informado
   pMoe       ;  $_POST[.]>0   ; A Moeda deve ser informada
   pTipoCob   ;  $_POST[.]>0   ; O Tipo de Cobrana deve ser informado
   pFPgmto    ;  $_POST[.]>0   ; A Forma de Pagamento de ser informada 
   tVenc      ;  strlen($_POST[.])>0 ; A Data de Vencimento deve ser informada   
   tEmissao   ;  strlen($_POST[.])>0 ; A Data da Emisso deve ser informada   
   tEmissao   ;  strtotime($_POST[.]) <= strtotime('now') ; A Data da Emisso deve ser menor que data e hora de agora.  
</ServerValids1>
<PodeIncluir1>
</PodeIncluir1>
<PodeExcluir1>
   select count(*) from FIN_Titulos where pPId={ChaveAtual_0} and iVer=iVAt and tPgmto is null and lPrevisao=0; Essa conta no pode ser excluida porque j foi paga ou  uma previso
</PodeExcluir1>
<PodeAlterar1>
</PodeAlterar1>
a) sQry=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
A) psVarTmp=
pChaveAtual_1=1, pChaveAtual_2=0, pChaveAtual_3=0, pPaizao=1, iCountAncestrais=1, iCountIrmasTias=0
psIrmasTias=
antes da troca da ChaveIrma, sQry=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
aps a troca da ChaveIrma, sQry=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
sQryEscSemLikeP0=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
psVars=
---
psEscId=, psEscIdIrma1=
iPagAtrasado = 0, sToolsBar = Incluir,Excluir,Alterar,Zoom,Pesquisar
sEntrarIncluindo=
psPesquisarFull=
sOnLoadExe=
psQry=select current_transaction from rdb$database
durao 0, iDb=1
fhDBConnect - Transaction ID=9196 , hBase=Resource id #73, hTr=Resource id #74, ghBase=Resource id #73
conexo -> hBase=Resource id #74
0) pChaveDinamica=0
sTagIncludeOnLoadGrid=
sTagIncludeOnLoadGridNoRefresh=
sSqlMarcados=
funo retorna a qry 2-sQry=select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
psTipo=0
nao eh um group by
sGlobal_pUNeg=, sTagMainTable=FIN_Titulos
1XXX) sQryCount_UNeg=select count(*) from FIN_Titulos  a join CUP b on a.pCedente = b.pPId and b.iVer = b.iVAt join CUP c on a.pSacado = c.pPId and c.iVer = c.iVAt left join TOper d on a.pTOper = d.pPId and d.iVer = d.iVAt left join CC g on a.pCC = g.pPid and g.iVer = g.iVAt left join CUP h on g.pAgencia = h.pPid and h.iVer = h.iVAt left join Banco i on h.pBanco = i.pPid and i.iVer = i.iVAt left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt left join Ordens r on a.pOrdem = r.pPId and r.iVer = r.iVAt and r.tCanc is null left join GrupoCUP j on b.pForGrupo = j.pPId and j.iVer = j.iVAt left join GrupoCUP l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt where a.iVer = a.iVAt and a.lExc = 0 and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227
sQryCount_UNeg=select count(*) from FIN_Titulos  a join CUP b on a.pCedente = b.pPId and b.iVer = b.iVAt join CUP c on a.pSacado = c.pPId and c.iVer = c.iVAt left join TOper d on a.pTOper = d.pPId and d.iVer = d.iVAt left join CC g on a.pCC = g.pPid and g.iVer = g.iVAt left join CUP h on g.pAgencia = h.pPid and h.iVer = h.iVAt left join Banco i on h.pBanco = i.pPid and i.iVer = i.iVAt left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt left join Ordens r on a.pOrdem = r.pPId and r.iVer = r.iVAt and r.tCanc is null left join GrupoCUP j on b.pForGrupo = j.pPId and j.iVer = j.iVAt left join GrupoCUP l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt where a.iVer = a.iVAt and a.lExc = 0 and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227
sGlobal_pUNeg=, sTagMainTable=FIN_Titulos
2XXX) sQry=select first 100 skip 0 a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
sQry_UNeg=select first 100 skip 0 a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem
iLinAtual=1, k=1, i=0
sCpo=$aLin["PPID"], iLinAtual=1
sExp=3709395
sCpo=$aLin["PPID"], iLinAtual=1
sExp=3709395
iLinAtual=2, k=2, i=0
sCpo=$aLin["PPID"], iLinAtual=2
sExp=3791465
sCpo=$aLin["PPID"], iLinAtual=2
sExp=3791465
iLinAtual=3, k=3, i=0
sCpo=$aLin["PPID"], iLinAtual=3
sExp=3725986
sCpo=$aLin["PPID"], iLinAtual=3
sExp=3725986
iLinAtual=4, k=4, i=0
sCpo=$aLin["PPID"], iLinAtual=4
sExp=3725976
sCpo=$aLin["PPID"], iLinAtual=4
sExp=3725976
iLinAtual=5, k=5, i=0
sCpo=$aLin["PPID"], iLinAtual=5
sExp=3703373
sCpo=$aLin["PPID"], iLinAtual=5
sExp=3703373
iLinAtual=6, k=6, i=0
sCpo=$aLin["PPID"], iLinAtual=6
sExp=3728865
sCpo=$aLin["PPID"], iLinAtual=6
sExp=3728865
iLinAtual=7, k=7, i=0
sCpo=$aLin["PPID"], iLinAtual=7
sExp=3703072
sCpo=$aLin["PPID"], iLinAtual=7
sExp=3703072
iLinAtual=8, k=8, i=0
sCpo=$aLin["PPID"], iLinAtual=8
sExp=3734504
sCpo=$aLin["PPID"], iLinAtual=8
sExp=3734504
iLinAtual=9, k=9, i=0
sCpo=$aLin["PPID"], iLinAtual=9
sExp=3696867
sCpo=$aLin["PPID"], iLinAtual=9
sExp=3696867
iLinAtual=10, k=10, i=0
sCpo=$aLin["PPID"], iLinAtual=10
sExp=3715340
sCpo=$aLin["PPID"], iLinAtual=10
sExp=3715340
iLinAtual=11, k=11, i=0
sCpo=$aLin["PPID"], iLinAtual=11
sExp=3457053
sCpo=$aLin["PPID"], iLinAtual=11
sExp=3457053
iLinAtual=12, k=12, i=0
sCpo=$aLin["PPID"], iLinAtual=12
sExp=3695316
sCpo=$aLin["PPID"], iLinAtual=12
sExp=3695316
iLinAtual=13, k=13, i=0
sCpo=$aLin["PPID"], iLinAtual=13
sExp=3724264
sCpo=$aLin["PPID"], iLinAtual=13
sExp=3724264
iLinAtual=14, k=14, i=0
sCpo=$aLin["PPID"], iLinAtual=14
sExp=3787239
sCpo=$aLin["PPID"], iLinAtual=14
sExp=3787239
iLinAtual=15, k=15, i=0
sCpo=$aLin["PPID"], iLinAtual=15
sExp=3793907
sCpo=$aLin["PPID"], iLinAtual=15
sExp=3793907
iLinAtual=16, k=16, i=0
sCpo=$aLin["PPID"], iLinAtual=16
sExp=3736171
sCpo=$aLin["PPID"], iLinAtual=16
sExp=3736171
iLinAtual=17, k=17, i=0
sCpo=$aLin["PPID"], iLinAtual=17
sExp=3736181
sCpo=$aLin["PPID"], iLinAtual=17
sExp=3736181
iLinAtual=18, k=18, i=0
sCpo=$aLin["PPID"], iLinAtual=18
sExp=3736178
sCpo=$aLin["PPID"], iLinAtual=18
sExp=3736178
iLinAtual=19, k=19, i=0
sCpo=$aLin["PPID"], iLinAtual=19
sExp=3700193
sCpo=$aLin["PPID"], iLinAtual=19
sExp=3700193
iLinAtual=20, k=20, i=0
sCpo=$aLin["PPID"], iLinAtual=20
sExp=3732807
sCpo=$aLin["PPID"], iLinAtual=20
sExp=3732807
iLinAtual=21, k=21, i=0
sCpo=$aLin["PPID"], iLinAtual=21
sExp=3765666
sCpo=$aLin["PPID"], iLinAtual=21
sExp=3765666
iLinAtual=22, k=22, i=0
sCpo=$aLin["PPID"], iLinAtual=22
sExp=3735884
sCpo=$aLin["PPID"], iLinAtual=22
sExp=3735884
iLinAtual=23, k=23, i=0
sCpo=$aLin["PPID"], iLinAtual=23
sExp=3738579
sCpo=$aLin["PPID"], iLinAtual=23
sExp=3738579
iLinAtual=24, k=24, i=0
sCpo=$aLin["PPID"], iLinAtual=24
sExp=3741584
sCpo=$aLin["PPID"], iLinAtual=24
sExp=3741584
iLinAtual=25, k=25, i=0
sCpo=$aLin["PPID"], iLinAtual=25
sExp=3743175
sCpo=$aLin["PPID"], iLinAtual=25
sExp=3743175
iLinAtual=26, k=26, i=0
sCpo=$aLin["PPID"], iLinAtual=26
sExp=3789011
sCpo=$aLin["PPID"], iLinAtual=26
sExp=3789011
iLinAtual=27, k=27, i=0
sCpo=$aLin["PPID"], iLinAtual=27
sExp=3776042
sCpo=$aLin["PPID"], iLinAtual=27
sExp=3776042
iLinAtual=28, k=28, i=0
sCpo=$aLin["PPID"], iLinAtual=28
sExp=3771454
sCpo=$aLin["PPID"], iLinAtual=28
sExp=3771454
iLinAtual=29, k=29, i=0
sCpo=$aLin["PPID"], iLinAtual=29
sExp=3774108
sCpo=$aLin["PPID"], iLinAtual=29
sExp=3774108
iLinAtual=30, k=30, i=0
sCpo=$aLin["PPID"], iLinAtual=30
sExp=3791441
sCpo=$aLin["PPID"], iLinAtual=30
sExp=3791441
iLinAtual=31, k=31, i=0
sCpo=$aLin["PPID"], iLinAtual=31
sExp=3732809
sCpo=$aLin["PPID"], iLinAtual=31
sExp=3732809
iLinAtual=32, k=32, i=0
sCpo=$aLin["PPID"], iLinAtual=32
sExp=3700189
sCpo=$aLin["PPID"], iLinAtual=32
sExp=3700189
iLinAtual=33, k=33, i=0
sCpo=$aLin["PPID"], iLinAtual=33
sExp=3702009
sCpo=$aLin["PPID"], iLinAtual=33
sExp=3702009
iLinAtual=34, k=34, i=0
sCpo=$aLin["PPID"], iLinAtual=34
sExp=3703928
sCpo=$aLin["PPID"], iLinAtual=34
sExp=3703928
iLinAtual=35, k=35, i=0
sCpo=$aLin["PPID"], iLinAtual=35
sExp=3705546
sCpo=$aLin["PPID"], iLinAtual=35
sExp=3705546
iLinAtual=36, k=36, i=0
sCpo=$aLin["PPID"], iLinAtual=36
sExp=3707260
sCpo=$aLin["PPID"], iLinAtual=36
sExp=3707260
iLinAtual=37, k=37, i=0
sCpo=$aLin["PPID"], iLinAtual=37
sExp=3708990
sCpo=$aLin["PPID"], iLinAtual=37
sExp=3708990
iLinAtual=38, k=38, i=0
sCpo=$aLin["PPID"], iLinAtual=38
sExp=3713961
sCpo=$aLin["PPID"], iLinAtual=38
sExp=3713961
iLinAtual=39, k=39, i=0
sCpo=$aLin["PPID"], iLinAtual=39
sExp=3717405
sCpo=$aLin["PPID"], iLinAtual=39
sExp=3717405
iLinAtual=40, k=40, i=0
sCpo=$aLin["PPID"], iLinAtual=40
sExp=3719351
sCpo=$aLin["PPID"], iLinAtual=40
sExp=3719351
iLinAtual=41, k=41, i=0
sCpo=$aLin["PPID"], iLinAtual=41
sExp=3721108
sCpo=$aLin["PPID"], iLinAtual=41
sExp=3721108
iLinAtual=42, k=42, i=0
sCpo=$aLin["PPID"], iLinAtual=42
sExp=3724983
sCpo=$aLin["PPID"], iLinAtual=42
sExp=3724983
h4=22-09-2023 12:46:59
4) sTitGrid=Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao - 42
5) sTitGrid=Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao - 42 [dd&#95_files/erp&#95_EDI&#95_Fin&#95_MontagemLotesEDI.dda/Padrao&#95_1]
RAcs ERP - Inicio - iDesenvolvedor=1, iGlobalKeyUser=0
RAcs ERP - Fim
commit
hBase=Resource id #74, ghBase=Resource id #73
flDBDisconnect - phBase=Resource id #74, ghBase=Resource id #73
0 -iInd_aGrid             = 51             
1 -psFileDDS              = dd_files/erp_EDI_Fin_MontagemLotesEDI.dda              
2 -psTagDDS               = Padrao_1               
3 -sQry                   = select first 100 skip 0 a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem                   
4 -sQryOriginal           = select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem           
5 -sQrySum                =                 
6 -sQrySum2Original       =        
7 -sTitGrid               = Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao - 42 [dd&#95_files/erp&#95_EDI&#95_Fin&#95_MontagemLotesEDI.dda/Padrao&#95_1]               
8 -sCpoTit                = [Id]-s-10                
9 -sMenu                  =                   
10-sNr0                   = alert("Qtux-Dialog\n\nNada a relacionar ...")                   
11-sTipoNr0               = 0               
12-sCursor0               =                
13-sToolsBar              = Incluir,Excluir,Alterar,Zoom,Pesquisar              
14-sAutoRefr              =               
15-sMarcacao              = true              
16-sDbMarcados            = /            
17-sTagMnemTDoc           = FIN_Titulos           
18-pTDocAtual             =              
19-iRegs                  = 42                  
20-lInc                   = 1                   
21-sEntrarIncluindo       =        
22-sEntrarAlterando       =        
23-sEntrarNaFicha         =          
24-sPesquisar             =    (
    (a.iIde_nNF          like '%{pPesquisar0}%')
 or (a.pPId              like '%{pPesquisar0}%')
 or (a.pOrdem            like '%{pPesquisar0}%')
 or (a.pPreNF            like '%{pPesquisar0}%')
 or (a.pTransf           like '%{pPesquisar0}%')
 or (a.pNFe              like '%{pPesquisar0}%')
 or (upper(d.sCodigo)    like '%{pPesquisar0}%')
 or (upper(d.sDescricao) like '%{pPesquisar0}%')
 or (upper(a.sDoc)       like '%{pPesquisar0}%')
 or (upper(b.sCoringa)   like '%{pPesquisar0}%')
 or (upper(c.sCoringa)   like '%{pPesquisar0}%')
 or (upper(a.sDadoDoc)   like '%{pPesquisar0}%')   
   )             
25-sOnLoadExe             =              
26-iPages                 = 1                 
27-sIncMsg                =                 
28-sAltMsg                =                 
29-sZooMsg                =                 
30-sExcMsg                =                 
31-sCursorOn              = 1              
32-sTagRefreshGridAoSalvar= 
33-sAliasColunas          = ~          
34-psRecsPage             = 100             
35-sTagNoDblClick         =          
36-sSumFormatSinal        =         
37-pChaveDinamica         = 0         
38-sFuncaoInc             =              
39-sFuncaoAlt             =              
40-sFuncaoZoo             =              
41-sFuncaoExc             =              
42-sNaoPerguntarDesejaIncluirNr0=
43-sTagSetColunas         =          
44-sTagFiltros            =             
45-sTagZebraGrid          =                
46-sTagAlignGrid          =                
47-sTagTitColVisible      =            
48-sTagGrid2D             =                   
49-sTagGrid2DHeight       =             
50-sTagGrid2DWidth        =              
sRet=51^dd_files/erp_EDI_Fin_MontagemLotesEDI.dda^Padrao_1^select first 100 skip 0 a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem^select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem^^^Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao - 42 [dd&#95_files/erp&#95_EDI&#95_Fin&#95_MontagemLotesEDI.dda/Padrao&#95_1]^[Id]-s-10^^alert("Qtux-Dialog\n\nNada a relacionar ...")^0^^Incluir,Excluir,Alterar,Zoom,Pesquisar^^true^/^FIN_Titulos^^42^1^^^^   (
    (a.iIde_nNF          like '%{pPesquisar0}%')
 or (a.pPId              like '%{pPesquisar0}%')
 or (a.pOrdem            like '%{pPesquisar0}%')
 or (a.pPreNF            like '%{pPesquisar0}%')
 or (a.pTransf           like '%{pPesquisar0}%')
 or (a.pNFe              like '%{pPesquisar0}%')
 or (upper(d.sCodigo)    like '%{pPesquisar0}%')
 or (upper(d.sDescricao) like '%{pPesquisar0}%')
 or (upper(a.sDoc)       like '%{pPesquisar0}%')
 or (upper(b.sCoringa)   like '%{pPesquisar0}%')
 or (upper(c.sCoringa)   like '%{pPesquisar0}%')
 or (upper(a.sDadoDoc)   like '%{pPesquisar0}%')   
   )^^1^^^^^1^^~^100^^^0^^^^^^^^^^^^^^
sRes=3709395~3709395^3791465~3791465^3725986~3725986^3725976~3725976^3703373~3703373^3728865~3728865^3703072~3703072^3734504~3734504^3696867~3696867^3715340~3715340^3457053~3457053^3695316~3695316^3724264~3724264^3787239~3787239^3793907~3793907^3736171~3736171^3736181~3736181^3736178~3736178^3700193~3700193^3732807~3732807^3765666~3765666^3735884~3735884^3738579~3738579^3741584~3741584^3743175~3743175^3789011~3789011^3776042~3776042^3771454~3771454^3774108~3774108^3791441~3791441^3732809~3732809^3700189~3700189^3702009~3702009^3703928~3703928^3705546~3705546^3707260~3707260^3708990~3708990^3713961~3713961^3717405~3717405^3719351~3719351^3721108~3721108^3724983~3724983
sEcho=51^dd_files/erp_EDI_Fin_MontagemLotesEDI.dda^Padrao_1^select first 100 skip 0 a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem^select a.sDoc,          a.jTipo,          a.pCedente,          a.pSacado,          a.tEmissao,          a.tEnvCnab,          a.tEnvBol,          a.tIn0,          a.tRestr,          a.tLibRestr,          b.sCoringa sCedente,          b.sCNPJ  sCNPJCedente,          b.sCPF   sCPFCedente,          b.sAgencia  sAgenciaCedente,          b.lAgencia  lAgenciaCedente,          c.sCoringa sSacado,          c.sCNPJ  sCNPJSacado,          c.sCPF   sCPFSacado,          c.sAgencia  sAgenciaSacado,          c.lAgencia  lAgenciaSacado,          a.pCapa,          a.lCapa,          a.tVenc,          a.tVenc0,          a.nVenc,          a.tCanc dCanc,          a.jOri,          a.tPgmto,          a.nPgmto,          a.lPrevisao,          a.tAgend,          a.iIde_nNF,          a.pOrdem,          a.pNFe,          a.pPreNF,          a.pTransf,          a.pContr,          a.iPrest,          a.iNrPrest,          a.pTOper,          d.sDescricao sTOper,          d.sCodigo  sCodTOper,          a.iNfNFs,          a.pCC,          g.sCC    sCC,          g.sDac    sDac,          h.sAgencia  sAgeNr,          h.sCoringa  sAge,          h.pBanco   pBanco,          h.fBanco   fBanco,          i.sCodigo  sCodBanco,          i.sDescricao sDesBanco,          c.pCliGrupo,          l.sGrupo sCliGrupo,          a.pTipoCob,          e.sDescricao sTipoCob,          e.sCodigo   sCodTipoCob,          a.fTipoCob,          b.pForGrupo,          j.sGrupo sForGrupo,          r.tConf   tOrdemConf,          a.pTFinOrig,          a.lOrcNA,          a.pPId       from FIN_Titulos a   join CUP      b on a.pCedente = b.pPId and b.iVer = b.iVAt                  join CUP      c on a.pSacado  = c.pPId and c.iVer = c.iVAt                left join TOper     d on a.pTOper  = d.pPId and d.iVer = d.iVAt                left join CC       g on a.pCC    = g.pPid and g.iVer = g.iVAt                left join CUP      h on g.pAgencia = h.pPid and h.iVer = h.iVAt                left join Banco     i on h.pBanco  = i.pPid and i.iVer = i.iVAt                left join Tipo_Cobrancas e on a.pTipoCob = e.pPId and e.iVer = e.iVAt                left join Ordens     r on a.pOrdem  = r.pPId and r.iVer = r.iVAt and r.tCanc is null                left join GrupoCUP    j on b.pForGrupo = j.pPId and j.iVer = j.iVAt                left join GrupoCUP    l on c.pCliGrupo = l.pPId and l.iVer = l.iVAt      where a.iVer = a.iVAt       and a.lExc = 0       and cast(a.tEmissao as date)>= '2023-06-01'and cast(a.tEmissao as date)<= '2023-09-21'and a.pSacado = 5and a.pCC = 1227      order by a.iIde_nNF,a.pOrdem^^^Seleo Montagens Lotes Pagamentos EDIs / Operaes / Status / Pr-Autorizao - 42 [dd&#95_files/erp&#95_EDI&#95_Fin&#95_MontagemLotesEDI.dda/Padrao&#95_1]^[Id]-s-10^^alert("Qtux-Dialog\n\nNada a relacionar ...")^0^^Incluir,Excluir,Alterar,Zoom,Pesquisar^^true^/^FIN_Titulos^^42^1^^^^   (
    (a.iIde_nNF          like '%{pPesquisar0}%')
 or (a.pPId              like '%{pPesquisar0}%')
 or (a.pOrdem            like '%{pPesquisar0}%')
 or (a.pPreNF            like '%{pPesquisar0}%')
 or (a.pTransf           like '%{pPesquisar0}%')
 or (a.pNFe              like '%{pPesquisar0}%')
 or (upper(d.sCodigo)    like '%{pPesquisar0}%')
 or (upper(d.sDescricao) like '%{pPesquisar0}%')
 or (upper(a.sDoc)       like '%{pPesquisar0}%')
 or (upper(b.sCoringa)   like '%{pPesquisar0}%')
 or (upper(c.sCoringa)   like '%{pPesquisar0}%')
 or (upper(a.sDadoDoc)   like '%{pPesquisar0}%')   
   )^^1^^^^^1^^~^100^^^0^^^^^^^^^^^^^^3709395~3709395^3791465~3791465^3725986~3725986^3725976~3725976^3703373~3703373^3728865~3728865^3703072~3703072^3734504~3734504^3696867~3696867^3715340~3715340^3457053~3457053^3695316~3695316^3724264~3724264^3787239~3787239^3793907~3793907^3736171~3736171^3736181~3736181^3736178~3736178^3700193~3700193^3732807~3732807^3765666~3765666^3735884~3735884^3738579~3738579^3741584~3741584^3743175~3743175^3789011~3789011^3776042~3776042^3771454~3771454^3774108~3774108^3791441~3791441^3732809~3732809^3700189~3700189^3702009~3702009^3703928~3703928^3705546~3705546^3707260~3707260^3708990~3708990^3713961~3713961^3717405~3717405^3719351~3719351^3721108~3721108^3724983~3724983
fim