<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{169,17,1022,697}</property>
    <property name="Name">[vb_roman_abertos.scr]</property>
    <property name="Caption">[Relacao de Romaneios]</property>
    <property name="AlwaysOnTop">.F.</property>
    <property name="AutoCenter">.T.</property>
    <property name="Font">
      <font name="Verdana" width="0" height="-13" weight="400"/>
    </property>
    <property name="FormType">[dlgModal]</property>
    <property name="Modal">.F.</property>
    <property name="ScopeVarObj">[Private]</property>
    <property name="lClipper">.T.</property>
    <property name="lExitOnEnter">.F.</property>
    <property name="lExitOnESC">.T.</property>
    <property name="FromStyle">[Center]</property>
    <property name="Clipsiblings">.F.</property>
    <property name="Clipchildren">.F.</property>
    <property name="TitleBar">.T.</property>
    <property name="StyleBorder">[3 - Sizable (Default)]</property>
    <property name="nBackColor">14215660</property>
    <property name="Icon">[]</property>
    <property name="Bitmap">[icon\tela.jpg]</property>
    <property name="NoIcon">.F.</property>
    <property name="SystemMenu">.T.</property>
    <property name="Minimizebox">.F.</property>
    <property name="Maximizebox">.T.</property>
    <property name="AbsAlignment">.T.</property>
    <property name="WindowState">[1 - Normal (Default)]</property>
    <property name="minHeight">-1</property>
    <property name="maxHeight">-1</property>
    <property name="minWidth">-1</property>
    <property name="maxWidth">-1</property>
    <property name="ScrollBars">[0 - None (Default)]</property>
    <property name="DSControl">.F.</property>
  </style>
  <method name="onDlgInit">
    <![CDATA[PARAMETERS oDlg
//skel variavel zBlCli := {|nCli| sccrcli->( if(nCli<>Recno(),DbGoTo(nCli),""), str(nCli,6)+"-"+cr_nome) }
//skel variavel zbIsGed := {|nCli,cTipoEnc,nfNum,nFnumPed|sccrcli->(DbGoTo(nCli),Ged_Files("locacao",if(cTipoEnc="DV","RECIBODEV","ADITIVO"),Cr_Cgc,nfNum,nfNumPed))}
//skel VARIAVEL zbPrt:= {||z_recno:=Recno(), Relat('imp_rom("-'+LTRIM(STR(Romaneio))+'")' ,"nb",,"X") , eVal(zbOpenAll) }
//skel variavel zbSit := {||if(fg_sit="Q","QUITADO",if(fg_sit="R","AGUARDA_QUITACAO","AGUARDANDO_KM_RET")) }
//skel variavel zbEntgd := {|nMotorista|vb_ent->(DbGoTo(nMotorista),Nome)}
//skel variavel zbVeic := {|nCodVeic|vb_motos->(DbGoTo(nCodVeic),desc)}
//skel variavel zbIBGE := {|nIBGE| VB_MUNIC->( DbSeek(nIBGE), UF+" "+Cidade )}
//skel VARIAVEL zBlQ={||if(fMdf>0,(Zini:=s_df_ecfid+"\mc"+StrZero(fMdf,6)+".ini",WaitRun("%comspec% /c notepad "+zini)),Alert("Voce deve primeiramente assinar o MDFe"))}

//skel variavel zbAction:={|bFunction|D_oB:Active:=.f.,zRecnBrw:=Recno(),eVal(bFunction),DbGoTo(zRecnBrw),D_oB:Active:=.t., ci_mdfnf->(DbGoTop()), D_oB:Refresh(.t.), oBrwItens:Refresh(.t.)}

oContextMenu:=Hwg_ContextMenu()
hwg_Btn(oToolbar,5,5,64,64)
// ico_mdfe4.ico  tem o nome MDF com uma tarja
//hwg_TbMt(oToolbar,'66;eVal(zbAction,{|| ci_MDFe("mdfe_CriarRemetente") });CriarMDFe;Cria MDFe referente a NFEs em que sou Remetente;ico_mdfe2.ico;;;Segoe UI Emoji;-11;SouRemetente;;;')
hwg_TbMt(oToolbar,'66;eVal(zbAction,{|| ci_MDFe("mdfe_Criar") });CriarMDFe;Cria MDFe referente a NFEs em que sou Destinatario;ico_mdfe2.ico;;;Segoe UI Emoji;-11;Criar_MDFe;;;')
hwg_TbMt(oToolbar,'66;eVal(zbAction,{|| ci_MDFe("mdfe_Assinar") });Assinar;Cria e Assina XML do MDFe;mdfe_assinar.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'68;eVal(zbAction,{|| ci_MDFe("mdfe_Enviar") });D-Enviar;D - Enviar MDFe;mdfe_enviar.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'68;eVal(zbAction,{|| ci_MDFe("mdfe_Encerrar") });E-Encerrar;E-Encerrar MDFe;mdfe_encerrar.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'0;;;espaco;espaco;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Imprimir") });C-Imprimir;C - Imprimir MDFe;mdfe_imprimir.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Cancelar") });F-Cancelar;F - Cancelar MDFe;mdfe_cancelar.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Consultar") });E-Consultar;E - Consulta Situacao do MDFe no Governo;mdfe_consultar.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Email") });J-Email;J - Enviar Email do MDFe;mdfe_email.ico;;;Segoe UI Emoji;-11;;;;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Editar") });Q-Editar_Ini;Q-Editar_Ini;mdfe_editaINI.ico;;;;')
hwg_TbMt(oToolbar,'67;eVal(zbAction,{|| ci_MDFe("mdfe_Alterar") });A-Alterar MDF;A-Altera dados do MDF;alterar.ico;;;;')

hwg_TbMt(oToolbar,'0;;;espaco;espaco;')

hwg_TbMt(oToolbar,' 79;tb_index(D_OB);O-Ordena ;O-Ordena a coluna do cursor;ordenar.ico;;;;;&O-Ordena;;;')

hwg_Btn(oToolbar,10,625,85,34)
hwg_TbMt(oToolbar,'43;eVal(zbAction,{|| ci_mdfnf->(DbGet("ci_mdfnf",1)) });+ Add_Item;+-Adiciona NFE no MDFe;sembitmap;;;Segoe UI Emoji;-11;+ Add_Item;;6;')
hwg_TbMt(oToolbar,'85;eVal(zbAction,{|| ci_mdfnf->(DbGet("ci_mdfnf",2)) });U Upd_Item;+-Altera Lancamento do MDFe;sembitmap;;;Segoe UI Emoji;-11;U Upd_Item;;6;')
hwg_TbMt(oToolbar,'7;eVal(zbAction,{|| ci_mdfnf->(DbGet("ci_mdfnf",3)) });- Del_Item;+-Retira Lancamento de NFE do MDFe;sembitmap;;;Segoe UI Emoji;-11;- Del_Item;;6;')

hwg_TbMt(oToolbar,'32;doget(D_OB);Barra-Edita ;Barra - Edita;sembitmap;;;Segoe UI Emoji;-11;Edita;;6;')
hwg_TbMt(oToolbar,'82;dbgobottom();P-Fim_do_arquivo ;P - Fim_do_arquivo;sembitmap;;;Segoe UI Emoji;-11;&P-Fim_do_arquivo;;6;')

SetDlgKey(oDlg,8,26,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"UP"))})
SetDlgKey(oDlg,8,28,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"DOWN"))})
Hwg_EndMenu()

DBGOBOTTOM()
DBSKIP(-6)
oBrwItens:Refresh()]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,667,1022,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{608,152,0}</property>
    </style>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{6,71,1005,281}</property>
      <property name="Name">[D_oB]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Segoe UI Emoji" width="0" height="-16" weight="400"/>
      </property>
      <property name="GridLinesSepColor">0</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onPosChange">
      <![CDATA[oBrwItens:Refresh()]]>
    </method>
    <method name="onInit">
      <![CDATA[hwg_TbFi(D_oB, 'MDFe;fMDF;N;999999; 6;S;')
hwg_TbFi(D_oB, 'Data;FDATAEMI;D;99.99.99; 8;S;')
hwg_TbFi(D_oB, 'HoraSaida;FHORA;C;99:99; 8;S;')
hwg_TbFi(D_oB, 'Valor Carga;VCARGA;N;999999999.99; 12;S;')
hwg_TbFi(D_oB, 'Peso Carga;QCARGA;N;999999999; 10;S;')
hwg_TbFi(D_oB, 'Protocolo;NFE_NPROT;C;@S10;10;S;')
hwg_TbFi(D_oB, 'ChaveMDFe;fChaveNfe;C;@S44;44;S;')
hwg_TbFi(D_oB, '*;Fg_Sit;C;!;1;N;')
// hwg_TbFi(D_oB, 'Sit;eVal(zbSit);C;@S20;20;N;')
hwg_TbFi(D_oB, 'Mot;Motorista;N;999;3;S;')
hwg_TbFi(D_oB, 'Nome Motorista;eVal(zbEntgd,Motorista);P;@S10;10;N;')
hwg_TbFi(D_oB, 'cVeic;Veiculo;N;999;  3;S;')
hwg_TbFi(D_oB, 'DescVeic;eVal(zbVeic,Veiculo);P;@S10;10;N;')
hwg_TbFi(D_oB, 'DtRetorno;FDataRet;D;99.99.99; 8;N;')
// hwg_TbFi(D_oB, 'USUARIO;USUARIO;C;@S8;8;N;')
hwg_TbFi(D_oB, 'qNFE;qNFE;N;999;  3;N;')

D_oB:bColorSel:= RGB(3,23,233)
D_oB:tColorSel:= RGB(255,255,255)
D_oB:Alias := alias()
D_oB:lDisableVScrollPos := .t.
D_oB:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
D_oB:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
D_oB:cargo:={.T.,.T.,"ci_mdf",.F.,.T.,{||.T.} }
d_ob:bEdit := {|D_oB| .t.}
sHwgKeyEdit:= 32
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{6,355,1005,247}</property>
      <property name="Name">[oBrwItens]</property>
      <property name="Anchor">6</property>
      <property name="font">
        <font name="Segoe UI Emoji" width="0" height="-16" weight="400"/>
      </property>
      <property name="GridLinesSepColor">0</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'Ci_MdfNF' ) 
oBrwItens:Alias := 'Ci_MdfNF'
oBrwItens:bColorSel:= RGB(3,23,133)
oBrwItens:tColorSel:= RGB(255,255,255)

hwg_TbFi(@oBrwItens,'ChaveNFe;fChaveNfe;C;@S44;44;S;')
hwg_TbFi(@oBrwItens,'Cod.Mun;Cr_Ibge;N;9999999;7;S;')
hwg_TbFi(@oBrwItens,'UF+Municipio;eVal(zbIBGE,Cr_Ibge);P;@S20;20;N;')
hwg_TbFi(@oBrwItens,'Valor;fVal;N;999999999.99;12;S;')
hwg_TbFi(@oBrwItens,'Peso KG;fPesoBr;N;999999999;9;S;')
hwg_TbFi(@oBrwItens,'MDFe;fMDF;N;999999; 6;S;')

oBrwItens:lFilter := .T.
oBrwItens:bFirst := {|| Ci_MdfNF->( DBSEEK( Ci_Mdf->fMDF, .F. ) ) } 
oBrwItens:bLast  := {|| Ci_MdfNF->( DBSEEK( Ci_Mdf->fMDF, .F., .T. ) ) }
oBrwItens:bWhile := {|| Ci_MdfNF->fMDF = Ci_Mdf->fMDF}
oBrwItens:Refresh()
DbSelectArea( 'ci_mdf' )
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{759,4,114,62}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[MDF-e Cadastrados]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-21" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">5</property>
    </style>
  </part>
</part>
