X;Resultados de Conferencia RAPIDA de Balanco;sys_tbbrow;5; 0;20;79;padrao;;
:SKEL
VARIAVEL w_colsep = " "+chr(179)
VARIAVEL zArea0:=lTrim(Str(Select(),3))
VARIAVEL zRecn:=Recno()
VARIAVEL zBlk:={|npCod|se_prod->(dbseek(npCod)),if(day(pdatacont)>0.and.pestcont<>se_prod->peatual,"*RECONTAR*",if(day(pdatacont)>0.and.PCONTAGEM<>se_prod->peatual,"*_Dif_Est_*", Left(Dtoc(PDATACONT),5)+" "+Left(PHORACONT,5) ))}

VARIAVEL zbOpenAll = #TEXTO_FONTE
   DbCloseAll()
   Abra(zArea0+"NOIDX",r_siga,"SE_PRDCC","SE_PRDCC","SE_PRDCC","pdesc","SE_PRDC0","pdic6")
   SE_PRDCC->( Abra("0NOIDX",r_siga,se_prod,"se_prod",seip_c,"pcod") )
   dbgoto(zrecn)
#FIM_TEXTO_FONTE

VARIAVEL zbExcluiZerados = #TEXTO_FONTE
   Private oProgressBar, zFgDeveCommit:=.f.
   DbSelectArea("SE_PRDCC")
   oProgressBar:= myHProgressBar():Create( "Excluindo produtos zerados do Balanco...")
   DbGoTop()
   Do While .not. eof()
      oProgressBar:Step()
      if pContagem=0.and.pConferen=0.and.pEstCont=0.and.pEstConf=0.and.Se_Prod->(DbSeek(SE_PRDCC->pCod).and.peAtual=0)
         RegLock()
         (_field->PDATACONT:=date(), _field->PHORACONT:=time(), _field->pestcont:=se_prod->peatual)
         (_field->PDATACONf:=date(), _field->PHORACONf:=time(), _field->pestconf:=se_prod->peatual)
         (_field->pDataBal:=date(), _field->pEatBal:=0, _field->pEat_Inf:=0)
         Se_Prod->( RegLock(), _field->pDataBal:=date(), _field->pEatBal:=0, _field->pEat_Inf:=0, zFgDeveCommit:=.t.)
      endif
      Skip
   EndDo
   (dbCommit(), dbUnlock())
   se zFgDeveCommit entao se_prod->(dbCommit(), dbUnlock())
   oProgressBar:Close()
   dbgoto(zrecn)
   DobRefresh()
#FIM_TEXTO_FONTE

VARIAVEL zbPrtConferente:= {||Relat('lst_exec("SE_PRDCC")',"nb",,"X") }
VARIAVEL zbAction:={|bFunction| zrecn:=Recno(), eVal(bFunction), eVal(zbOpenAll), DobRefresh() }
VARIAVEL zNil := eval(zbOpenAll)

variavel #TEXTO_FONTE
   //ONINIT
      hwg_TbFi(@D_oB,"Cod;PCOD;N;999999;6;N;")
      hwg_TbFi(@D_oB,"Descricao;PDESC;C;@S25;25;N;")
      hwg_TbFi(@D_oB,"Contag;PCONTAGEM;N;999999;  6;S;")
      hwg_TbFi(@D_oB,"Data CONT;eval(zBlk,pcod);P;@s11;11;N;")
      hwg_TbFi(@D_oB,"Estoq;se_prod->peatual;P;999999;6;N;")
      hwg_TbFi(@D_oB,"Cod Barra;Pdic6;N;9999999999999;13;N;")
      hwg_TbFi(@D_oB,"Posicao;pposicao;C;@S7;7;S;")
      hwg_TbFi(@D_oB,"Tipo;Ptipo;C;@S5;5;N;")
      hwg_TbFi(@D_oB,"Marca;Pref;C;@S15;15;N;")
      hwg_TbFi(@D_oB,"Modelo;Pmarcamode;C;@S20;20;N;")
      hwg_TbFi(@D_oB,"Div;PDIVISAO;C;xxxx;  4;N;")
      hwg_TbFi(@D_oB,"Dt.Bal;pDataBal;D;99.99.9999;10;N;")
      hwg_TbFi(@D_oB,"SaldoBal;pEatBal;N;999999999;10;N;")
      hwg_TbFi(@D_oB,"SaldoInf;pEat_Inf;N;999999999;10;N;")
   //ENDONINIT
   //ONDLGINIT
      // oDlg:Maximize()
   //ENDDLGINIT
#FIM_TEXTO_FONTE

COMANDO SAIDA Se_Prod->(DbCloseArea())
:TBMT
13;Se_doget(D_ob);Enter-Edita ;
69;eval(zbAction,{||npCod:=Se_PrdCC->pCod,se_prod->(dbseek(npCod), ext_screen(npCod,pdatabal))});E-Extrato ;
32;eval(zbAction,{||prd_captaean(D_oB,"CONTRAPIDA","ONHAND")});Barra-Captura_Contagem_Rapida ;
61;eval(zbAction,{||prd_conf_ok("CONFIRMAESTSemReconf")});=-Grava_Estoques_SemReconf ;
80;tb_pesq(D_OB);P-Pesquisa ;
67;tb_locate(D_OB);C-Continua Busca;
84;tb_locate(D_OB);T-Busca_Trecho ;
76;tb_locate(D_OB);L-Busca_Iniciais ;
79;tb_index(D_OB);O-Ordena ;
73;eval(zbAction,zbPrtConferente);I-Imprime ;
90;eval(zbAction,zbExcluiZerados);Z-Exclui_Zerados ;
