SP_MOVF;Produtos do Pedido;sys_tbbrow; 8; 0;21;79;sp_movf;;
:SKEL
*Min;pemin;N;99999;5;N;
*Max;pemax;N;99999;5;N;

VARIAVEL z_xBlk = "Z_Sele:=Select(),"
VARIAVEL z_xBlk = z_xBlk + 'if(sele("SE_GREDI")=0,Abra("0",R_SIGA,"SE_GREDI","SE_GREDI","SE_GREDI","Str(pcod,6)+str(pedicao,5)+mfges"),DbSelectArea("SE_GREDI")),'
VARIAVEL z_xBlk = z_xBlk + "if(type('se_prod->pconsig')<>'U'.and.upper(se_prod->pconsig)<>'S',Mensagem('O produto nao tem controle de estoque com compra consignada...',1),Brow_Db('SE_GREDI',.t.)),"
VARIAVEL z_xBlk = z_xBlk + 'Se_GREDI->(DbCloseArea()),'
VARIAVEL z_xBlk = z_xBlk + "DbSelectArea(z_sele)"
VARIAVEL z_BlkEdi = _CreateBlock( z_xBlk )
VARIAVEL z_xBlk = ""

VARIAVEL Z_blk = { |x_pcod,x_pedicao| SE_GREDI->(if(DbSeek(Str(x_pcod,6)+str(x_pedicao,5)+" "),NIL,DbSeek(Str(x_pcod,6)+str(x_pedicao,5)+"S"))), Se_GrEDI->(str(mqatend,5)+" x"+str(peatual,5))}
VARIAVEL Z_pblk = { |x_pcod| SE_Prod->(DbSeek(x_pcod)), Str(Se_Prod->PestCsgRec,6)+" "+Str(Se_Prod->PestConsig,6) }
COMANDO ANTES Abra("0",R_SIGA,"SE_GREDI","SE_GREDI","SE_GREDI","Str(pcod,6)+str(pedicao,5)+mfges")
COMANDO DEPOIS SE_GREDI->(DBCLOSEAREA())
:TBMT
 22;ins_prd(D_oB,"R",.T.,.t.,,.t.);Ins-Inclui_por_Nome ;
 43;ins_prd(D_oB,"R",.f.,.t.,,.t.);+-Inclui_por_Codigo ;
 83;rep_movf();S-Sugestoes ;
  7;tb_del(D_ob);DEL-DELeta ;
 13;pf_DoGet(D_oB,"R");Enter-Altera ;
 73;Lst_alias(D_OB);I-Imprime ;
 80;tb_pesq(D_OB);P-Pesquisa ;
 86;pfvalor(D_oB);V-Valor_Pedido ;
 65;ALTProd();A-Altera_Dic ;
 93;disp_sdse(pcod);]-Demanda ;
 79;tb_index(D_OB);O-Ordena ;
 92;Eval(z_BlkEdi);\-Edicoes ;
:TBFI
Cod;PCOD;N;99999;5;N;
Desc;PDESC;C;@S25; 25;N;
Solic;unid_fech;N;9999;  4;S;
Devol;mqatend;N;9999;  4;S;
APagar;if(unid_fech-mqatend>0,unid_fech-mqatend,0);N;9999;6;N;
Receb  SldCsg;Eval(z_pBlk,pcod);P;999999 999999;13;N;
Frc;pitens;N;999;3;N;
PrTotCst;if(unid_fech-mqatend>0,unid_fech-mqatend,0)*pvluven3;N;99999.99;8;S;
Edic;Pedicao;N;99999;5;N;
Edi Vnd/Rec;Eval(z_Blk,pcod,pedicao);C;99999 x99999;12;N;
PrUnCst;pvluven3;N;9999.99;7;S;
PrUnVen;pvluvenda;N;9999.99;7;S;
PrTotVen;MVALor;N;99999.99;8;S;
Grade;Grade;C;@S!6;6;S;
UndVen;unid_Fech*pitens;N;999999;6;N;
Cod Dic;Pdic;N;99999999;8;N;
