SE_PROD;Cadastro de Produtos;sys_tbbrow; 8; 0;18;79;se_prod;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL zrecn:=recn()
VARIAVEL Z_Sele = 0
variavel wpDivisao:=Val(xGetEnv("DIVISAO_PRODUTOS_LOCACAO"))
variavel zbDiv:={|cpDivisao| Se_divis->( DbGoto(Val(Left(cpDivisao,2))), dDesc) }
variavel zbSubd:={|cpDivisao| Se_Subd->( DbSeek(cpDivisao), sdDesc) }
variavel zbPrtLista:={|| Relat('lst_exec("PRLSTPRC")',"nb",,"X") }
VARIAVEL z_BlkItens = #TEXTO_FONTE
   Abra('0',R_SIGA,'SE_GREAT','SE_GREAT','SE_GREAT','Str(pcod,6)+Ptam+Pcor')
   if(se_prod->peatual<=0,Mensagem('O estoque total do produto esta zerado...',1),Brow_Db('SE_GREAT',.t.))
   Se_Great->(DbCloseArea())
   DbSelectArea('se_prod')
   dbgoto(zrecn)
#FIM_TEXTO_FONTE
VARIAVEL z_BlkEdi = #TEXTO_FONTE
   Z_Sele:=Select()
   Abra("0",R_SIGA,"SE_GREDI","SE_GREDI","SE_GREDI","Str(pcod,6)+str(pedicao,15)+mfges")
   if(type('se_prod->pconsig')<>'U'.and.!upper(se_prod->pconsig)$'SGC',Mensagem('O produto nao tem controle de estoque com compra consignada...',1),Brow_Db('SE_GREDI',.t.))
   Se_GREDI->(DbCloseArea())
   DbSelectArea(z_sele)
#FIM_TEXTO_FONTE
VARIAVEL zbOpenAll = #TEXTO_FONTE
   zrecn:=recn()
   if select('se_subd')=0
      Abra ("0NOIDX", r_siga, "se_subd" , 'se_subd', 'seisd_c','sdcod')
   endif
   if select('se_divis')=0
      Abra ("0NOIDX", r_siga, "se_divis", "Se_divis")
   endif
   if select('se_prod')=0
      Abra_Arq('se_prod')
   else
      DbSelectArea('se_prod')
   endif
   DbSetFilter({||Val(Left(pDivisao,2))=wpDivisao},'Val(Left(pDivisao,2))=wpDivisao')
   DbGoTop()
   dbgoto(zrecn)
#FIM_TEXTO_FONTE
variavel znil:=eVal(zbOpenAll)
variavel zbAction:={|bFunction| zrecn:=Recno(), eVal(bFunction), eVal(zbOpenAll), DobRefresh() }

/#Premio;Ppremio;N;999999;6;S;
// 32;Cibrow("SE_PRDLJ",,"SE_PRDL0");Barra-Lojas ;
// 22;upd_prod(1,"PROD_RAPIDA");R-Inclui Registro;
// 91;disp_sdse(se_prod->pref,"R");[-Dem_Ref ;
//Obs;pPedeObs;C;X;  1;;

comando saida if(select('se_subd')>0,  se_subd->(DbCloseArea()), NIL)
comando saida if(select('se_divis')>0, se_divis->(DbCloseArea()), NIL) 

variavel #TEXTO_FONTE
   //ONINIT
      Se_Prod->( DbSetFilter({||Val(Left(pDivisao,2))=wpDivisao},'Val(Left(pDivisao,2))=wpDivisao'), DbGoTop() )
      hwg_TbFi(@D_oB, 'Descricao;PDESC;C;@s35;35;S;')
      hwg_TbFi(@D_oB, 'Un;PUNIDADE;C;xxxxx;  3;;')
      hwg_TbFi(@D_oB, 'Loc_1_DIA;PVALLOCA1D;N;9999.99;9;S;')
      hwg_TbFi(@D_oB, 'Loc30dias;PVALLOCA;N;9999.99;9;S;')
      hwg_TbFi(@D_oB, 'PrIndeniz;PVLUVENDA;N;9999999.99;10;S;')
      hwg_TbFi(@D_oB, '?;PitemProb;C;!;1;S;')
      // hwg_TbFi(@D_oB, 'Divisao;eVal(zbDiv,pDivisao);P;@S15;15;N;')
      hwg_TbFi(@D_oB, 'SubDivisao;eVal(zbSubd,pDivisao);P;@S20;20;N;')
      hwg_TbFi(@D_oB, 'Prc Custo;PVLUVEN3;N;9999999.99;10;S;')
      hwg_TbFi(@D_oB, 'Ref.Fabr;Preffab;C;@S8;8;S;;')
      hwg_TbFi(@D_oB, 'Cod;PCOD;N;99999;5;N;')
      hwg_TbFi(@D_oB, 'EAtual;PEATUAL;N;99999;5;S;')
      hwg_TbFi(@D_oB, 'Div;PDIVISAO;C;9999;4;S;')
      hwg_TbFi(@D_oB, 'Tp;Ptipoitem;C;99;2;S;')
      hwg_TbFi(@D_oB, 'Finalidade;Efd_TipoItem();P;@S13;13;N;')
      hwg_TbFi(@D_oB, 's;pServico;C;X;  1;;')
      hwg_TbFi(@D_oB, 'o;pPedeObs;C;X;  1;;')
      hwg_TbFi(@D_oB, 'CF;pcategoria;C;!!!;2;S;')
      hwg_TbFi(@D_oB, 'Fracao;PITENS;N;9999;  4;;')
      hwg_TbFi(@D_oB, 'Cod Barras;Pdic6;N;99999999999999;14;N;')
      hwg_TbFi(@D_oB, 'NCM;pCodClaFis;N;99999999;8;;')
      hwg_TbFi(@D_oB, 'G;Pgpreco;C;X;  1;;')
      hwg_TbFi(@D_oB, 'CFOP;pcfop;C;9x999;5;S;')
      hwg_TbFi(@D_oB, 'Prc Sug.;PVLUsug;N;99999.99;  8;S;')
      hwg_TbFi(@D_oB, 'DataPrec;Pdataalter;D;;10;N;')
      hwg_TbFi(@D_oB, 'AvalMin;pAvalMin;N;99999.99;  8;S;')
      hwg_TbFi(@D_oB, 'Tipo;Ptipo;C;@S5;5;S;')
      hwg_TbFi(@D_oB, 'Marca/Fabric;Pref;C;@S10;10;S;')
      hwg_TbFi(@D_oB, 'Modelo;pmarcamode;C;@s10;11;S;')
      hwg_TbFi(@D_oB, 'E_Contr;PEATx;N;9999999;  7;;')
      hwg_TbFi(@D_oB, 'EMin;PEMIN;N;999999;  6;;')
      hwg_TbFi(@D_oB, 'Fabr;PPRINCFORN;N;999;  3;;')
      hwg_TbFi(@D_oB, 'E Max;PEMAX;N;999999;  6;;')
      hwg_TbFi(@D_oB, 'CO;PCODORI;N;9;  1;;')
      hwg_TbFi(@D_oB, 'L Prc;PFGLPRE;C;x;  1;;')
      hwg_TbFi(@D_oB, 'Em Prom;PFGPROM;C;x;  1;;')
   //ENDONINIT
   //ONDLGINIT
         oDlg:Maximize()
   //ENDDLGINIT
#FIM_TEXTO_FONTE
:TBMT
43;eval(zbAction,{||StartLocacao("checa_precos_locacao")});+-Checa_Precos ;
22;eval(zbAction,{||upd_prod(1,"PROD_T1")});Ins-Inclui ;
13;eval(zbAction,{||se_doget(D_ob)});Enter-Edita ;
 7;eval(zbAction,{||tb_del(d_ob)});Del-Apaga ;
65;eval(zbAction,{||tb_update(D_OB)});A-Altera ;
69;eval(zbAction,{||ext_screen(pcod,pdatabal)});E-Extrato ;
47;eval(zbAction,{||Eval(z_BlkItens)});/-Subitens ;
93;eval(zbAction,{||disp_sdse(pcod)});]-Demanda ;
71;eval(zbAction,{||DispEnt(pcod)});G-Compras ;
80;tb_pesq(D_OB);P-Pesquisa Chave;
70;tb_filter(d_ob);F-Filtra ;
84;tb_locate(D_oB);T-Busca_Trecho ;
76;tb_locate(D_oB);L-Busca_Iniciais ;
67;tb_locate(D_oB);C-Repete_Busca ;
82;doget(D_ob,,.t.);R-Repete_Edicao ;
79;tb_index(D_OB);O-Ordena ;
73;eval(zbAction,zbPrtLista);I-Imprime ;
61;doget(D_ob,,.t.);=-Repete_Edicao ;