<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{327,45,1023,660}</property>
    <property name="Name">[hc_retdi.scr]</property>
    <property name="Caption">[Agenda Diaria/Solicitacoes de Clientes]</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">[3 - Maximized]</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 wTipoOs:='T'
//skel VARIAVEL wSitOs:=1
//skel VARIAVEL wPerOs:='T'
//skel VARIAVEL wDiasOs:=0
//skel VARIAVEL zRecnOs := 1
//skel VARIAVEL zProblema_Solucao := ''
//skel VARIAVEL zbOpenAll = #TEXTO_FONTE
//skel    DbCloseAll()
//skel    ABRA("0NOIDX",r_siga,"sccrcli","sccrcli")
//skel    ABRA("0NOIDX",r_siga,"HC_RETDI","HC_RETDI") 
//skel    DbSetFilter({||(wTipoOs='T'.or.wTipoOs=TipoOs).and.(wSitOs=0.or.wSitOs=Situacao).and.(wPerOs='T'.OR.Dt_Previst<=S_dAtual+wDiasOs)},"wTipoOs='T'.or.wTipoOs=TipoOs")
//skel #FIM_TEXTO_FONTE

//skel VARIAVEL zNil:=(EVAL(zbOpenAll),DBGOBOTTOM(),DBSKIP(-8))
//skel VARIAVEL zbCli:={|nCod|sccrcli->(dbgoto(nCod), cr_nome)}
//skel variavel zbAction:={|bFunction|zRecnCli:=Sccrcli->(Recno()),zRecnOs:=Recno(),eVal(bFunction),eVal(zbOpenAll),SccrCli->(DbGoTo(zRecnCli)),DbGoTo(zRecnOs),DobRefresh()}
//skel variavel zbPrtOs:={|| Relat('lst_exec("HC_OS0")',"nb",,"X") }
//skel variavel zbPrtLista:={|| Relat('lst_exec("HC_RETDI")',"nb",,"X") }
//skel comando saida if(select('sccrcli')>0, sccrcli->(DbCloseArea()), NIL)

d_ob:lEditable = .t. 

oContextMenu:=Hwg_ContextMenu()
hwg_Btn(oToolbar,5,5,64,64)
hwg_TbMt(oToolbar,'22;eval(zbAction,{||tb_insert(D_oB,"HC_RECTV")});Ins-Inclui ;Ins-Inclui;cadastrar.ico;;;;;Inclui;;;')
// hwg_TbMt(oToolbar,'65;eval(zbAction,{||tb_update(D_OB)});A-Altera ;A-Altera;alterar.ico;;;;;&A-Altera;;;')
hwg_TbMt(oToolbar,' 7;eval(zbAction,{||tb_del(d_ob)});Del-Apaga ;Del-Deleta;deletar.ico;;;;;Deleta;;;')
hwg_TbMt(oToolbar,'80;tb_pesq(D_OB);P-Pesquisa Chave;P-Pesquisa na coluna do cursor;pesquisa.ico;;;;;&P-Pesquisa;;;')
hwg_TbMt(oToolbar,'79;tb_index(D_OB);O-Ordena ;O-Ordena a coluna do cursor;ordenar.ico;;;;;&O-Ordena;;;')
hwg_TbMt(oToolbar,'73;eval(zbAction,zbPrtLista);I-Imprime ;I - Imprime;impressora.jpg;;;Lucida Bright;-11;&I-Imprime;;;')

//hwg_TbMt(oToolbar,'65;eval(zbAction,{||if(TipoOs="C",QuitaCupons(cr_cod_cli,"ONLY_GET_DUPS_PRODS"),tb_update(D_OB))});A-Altera ;A-Altera;alterar.ico;;;;;&A-Altera;;;')

hwg_Btn(oToolbar,10,544+50,70,24)

hwg_TbMt(oToolbar,'13;eval(zbAction,{||if(TipoOs="C",QuitaCupons(cr_cod_cli, "ONLY_GET_DUPS_PRODS"),tb_update(D_OB))});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
hwg_TbMt(oToolbar,'73;eval(zbAction,zbPrtOs);I-ImprimeOs ;I-Imprime OS resumida ou Detalhada;sembitmap;;;Lucida Bright;-11;&I-ImprimeOS;;6;')

hwg_TbMt(oToolbar,'70;tb_filter(d_ob);F-Filtra ;F-Filtra Cursor;sembitmap;;;Lucida Bright;-11;&F-Filtra;;6;')

//hwg_TbMt(oToolbar,'82;doget(D_ob,,.t.);R-Repete_Edicao ;R - Repete_Edicao;sembitmap;;;Lucida Bright;-11;&R-Repete_Edicao;;6;')
//hwg_TbMt(oToolbar,'61;doget(D_ob,,.t.);=-Repete_Edicao ;= - Repete_Edicao;sembitmap;;;Lucida Bright;-11;&=-Repete_Edicao;;6;')
//hwg_TbMt(oToolbar,'76;tb_locate(D_oB);L-Busca_Iniciais ;L-Busca pelas Iniciais na coluna do cursor;sembitmap;;;Lucida Bright;-11;&L-Iniciais;;6;')
hwg_TbMt(oToolbar,'84;tb_locate(D_oB);T-Busca_Trecho ;T-Pesquisa Trecho na coluna do cursor;sembitmap;;;Lucida Bright;-11;&T-Trecho;;6;')
hwg_TbMt(oToolbar,'67;tb_locate(D_oB);C-Repete_Busca ;C-Repete Busca na coluna do cursor;sembitmap;;;Lucida Bright;-11;&C-Continua;;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()

zProblema_Solucao := hc_retdi->( ALLTRIM(cr_obs)+CHR(13)+Chr(10)+AllTrim(solucao) )
oProblema_Solucao:Refresh()

oDlg:Maximize()

// hwg_TbMt(oToolbar,'13;eval(zbAction,{||doget(D_ob)});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
//hwg_TbMt(oToolbar,'13;eval(zbAction,{||if(TipoOs="C",agc_dirigida(D_ob,cr_cod_cli),tb_update(D_OB))});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
//hwg_TbMt(oToolbar,'13;eval(zbAction,{||if(TipoOs="C",eVal(zbExecXml),tb_update(D_OB))});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
//hwg_TbMt(oToolbar,'13;eval(zbAction,{||if(TipoOs="C",(ExecutaXml("HC_RETDI_COB"),D_oB:bPosChanged:=zbPosChanged),tb_update(D_OB))});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
//hwg_TbMt(oToolbar,'13;eval(zbAction,{||if(TipoOs="C",tb_update(D_OB,"HC_RETDI_COB"),tb_update(D_OB))});Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="browse">
    <style>
      <property name="Geometry">{10,77,1000,351}</property>
      <property name="Name">[D_oB]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Lucida Sans Unicode" 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[zProblema_Solucao := hc_retdi->( ALLTRIM(cr_obs)+CHR(13)+Chr(10)+AllTrim(solucao) )
oProblema_Solucao:Refresh()]]>
    </method>
    <method name="onInit">
      <![CDATA[      hwg_TbFi(@D_oB, 'Numero;idos;N;999999;6;;')
      hwg_TbFi(@D_oB, 'DtRetPrev;Dt_Previst;D;;8;;')
      hwg_TbFi(@D_oB, 'Situacao;if(situacao=1,"Aberta",if(situacao=2,"Fechada","SolicFecha"));P;@S10;10;;')
      hwg_TbFi(@D_oB, 'CodCli;CR_COD_CLI;N;999999;  6;;')
      hwg_TbFi(@D_oB, 'Nome_Cli;eval(zbCli,cr_cod_cli);P;@s30;30;N;')
      hwg_TbFi(@D_oB, 'Solicitante;CR_NOME;C;@s12;12;;')
      hwg_TbFi(@D_oB, 'Data;DATA;D;;8;;')
      hwg_TbFi(@D_oB, 'Hora;HORA;C;xx:xx;5;;')
      hwg_TbFi(@D_oB, 'Assunto/Motivo;Assunto;C;@S60;60;;')
      hwg_TbFi(@D_oB, 'DataFech;DATARET;D;;8;;')
      hwg_TbFi(@D_oB, 'HoraFech;HORARET;C;xx:xx;5;;')
      hwg_TbFi(@D_oB, 'Providencias;solucao;C;@S30;30;;')
      hwg_TbFi(@D_oB, 'Atend;fvendedor;N;999;3;;')
      hwg_TbFi(@D_oB, 'Retorn;fvendretor;N;999;3;;')
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.,"HC_RETDI",.F.,.T.,{||.T.} }
d_ob:bEdit := {|D_oB| nKey:=13,eval(zbAction,{||doget(D_ob)})}
sHwgKeyEdit:=82
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{594,2,281,47}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Agendamentos]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Arial" width="0" height="-37" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">5</property>
    </style>
  </part>
  <part class="radiogroup">
    <style>
      <property name="Geometry">{393,0,208,75}</property>
      <property name="Name">[oRadiogroup1]</property>
      <property name="varName">[vRadiogroup1]</property>
      <property name="Caption">[Tipo]</property>
      <property name="Anchor">3</property>
      <property name="TextColor">16711680</property>
      <property name="TabIndex">11</property>
    </style>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{402,18,63,22}</property>
        <property name="Name">[oRadiobutton1]</property>
        <property name="Caption">[Todas]</property>
        <property name="Anchor">3</property>
        <property name="TabIndex">91</property>
      </style>
      <method name="onClick">
        <![CDATA[wTipoOs:='T'
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{492,18,104,22}</property>
        <property name="Name">[oRadiobutton2]</property>
        <property name="Caption">[Solicitacoes]</property>
        <property name="Anchor">3</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wTipoOs:=' '
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{402,42,101,22}</property>
        <property name="Name">[oRadiobutton3]</property>
        <property name="Caption">[Televendas]</property>
        <property name="Anchor">3</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wTipoOs:='V'
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{510,43,86,22}</property>
        <property name="Name">[oRadiobutton4]</property>
        <property name="Caption">[Cobranca]</property>
        <property name="Anchor">3</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wTipoOs:='C'
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
  </part>
  <part class="radiogroup">
    <style>
      <property name="Geometry">{802,522,208,75}</property>
      <property name="Name">[oRadiogroup2]</property>
      <property name="varName">[vRadiogroup2]</property>
      <property name="Caption">[Periodo]</property>
      <property name="Anchor">12</property>
      <property name="TextColor">16711680</property>
      <property name="TabIndex">11</property>
    </style>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{806,538,63,22}</property>
        <property name="Name">[oRadiobutton5]</property>
        <property name="Caption">[Todas]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">91</property>
      </style>
      <method name="onClick">
        <![CDATA[wPerOs:='T'
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{907,538,79,22}</property>
        <property name="Name">[oRadiobutton6]</property>
        <property name="Caption">[p/ HOJE]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wPerOs:='D'
wDiasOs:=0
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{806,563,95,22}</property>
        <property name="Name">[oRadiobutton7]</property>
        <property name="Caption">[da Semana]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wPerOs:='S'
wDiasOs:=7
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{913,562,73,22}</property>
        <property name="Name">[oRadiobutton8]</property>
        <property name="Caption">[do Mes]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wPerOs:='M'
wDiasOs:=30
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
  </part>
  <part class="radiogroup">
    <style>
      <property name="Geometry">{802,439,208,75}</property>
      <property name="Name">[oRadiogroup3]</property>
      <property name="varName">[vRadiogroup3]</property>
      <property name="Caption">[Situacao]</property>
      <property name="Anchor">12</property>
      <property name="TextColor">16711680</property>
      <property name="TabIndex">11</property>
    </style>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{811,454,63,22}</property>
        <property name="Name">[oRadiobutton9]</property>
        <property name="Caption">[Todas]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">91</property>
      </style>
      <method name="onClick">
        <![CDATA[wSitOs:=0
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{921,453,79,22}</property>
        <property name="Name">[oRadiobutton10]</property>
        <property name="Caption">[Abertas]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wSitOs:=1
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{810,480,87,22}</property>
        <property name="Name">[oRadiobutton11]</property>
        <property name="Caption">[Fechadas]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wSitOs:=2
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{914,480,87,22}</property>
        <property name="Name">[oRadiobutton12]</property>
        <property name="Caption">[Atrasadas]</property>
        <property name="Anchor">12</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[wSitOs:=3
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{21,433,771,155}</property>
      <property name="Name">[oProblema_Solucao]</property>
      <property name="varName">[zProblema_Solucao]</property>
      <property name="Anchor">14</property>
      <property name="Multiline">.T.</property>
      <property name="AutoHScroll">.T.</property>
      <property name="ReadOnly">.T.</property>
      <property name="TabIndex">101</property>
    </style>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{604,50,15,22}</property>
      <property name="Name">[oButtonex1]</property>
      <property name="Caption">[*]</property>
      <property name="TabIndex">102</property>
    </style>
    <method name="onClick">
      <![CDATA[//ExecutaXml("HC_RETDI_COB_SETUP")
Agc_Redist()]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{631,50,15,22}</property>
      <property name="Name">[oButtonex2]</property>
      <property name="Caption">[?]</property>
      <property name="TabIndex">102</property>
    </style>
    <method name="onClick">
      <![CDATA[EVAL(zbAction,{||Agc_ChecaRetornos()})
]]>
    </method>
  </part>
</part>
