SG_L;Estoque por Lojas;sys_tbbrow; 3;1;23;75;x;;
:SKEL

*:TBFO
*Str(Z_NLOJAS,2)+"ljs";
*Transform( Z_TEST, "@E 999,999");
*Transform( z_tcust,"@E 99999,999");
*Transform( Z_TVENDA,"@E 99,999,999");
*Transform( if(Z_TVENDA>0,100*(Z_TVENDA-Z_TCUST)/Z_TVENDA,0) ,"@E 999.9")+"%" ;
*Transform( if(Z_TEST>0,Z_TVENDA/Z_TEST,0),"@E 9999.99");
*;
*;
*;
*;
*;
*;
*;
*;
*;
*;

VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL W_footSEP = "="

VARIAVEL z_nil = log_si_proc("TOTREF","VIEW")
VARIAVEL Z_NLOJAS=0
VARIAVEL Z_TEST = 0
VARIAVEL Z_TCUST = 0
VARIAVEL Z_TVENDA = 0
VARIAVEL Z_TVista = 0
VARIAVEL Z_MEDMES = 0
COMANDO ANTES #TEXTO_FONTE
dbgotop()
while .not. eof()
   if peatual>0
      z_nlojas = z_nlojas + 1
      z_test = z_test + peatual
      z_tcust = z_tcust + pvluven3
      z_tvenda = z_tvenda + pvluvenda
      z_tvista = z_tvista + pvluvista
      z_medmes = z_medmes + ss01
   endif
   dbskip()
enddo
dbgotop()
#FIM_TEXTO_FONTE
:TBMT
 13;Cibrow("SG_RL",,"SG_LR");Enter-Marcas ;
 32;Cibrow("SG_LT",,"SG_LT");Barra-Tipos ;
 79;tb_index(D_OB);O-Ordena ;
:TBFI
Loja;PLOJA;N;99;4;N;
Estoq;PEATUAL;N;@E 9999,999;  8;;
Val_Custo;PVLUVEN3;N;@E 99999,999;10;;
Val_Prazo;PVLUVENDA;N;99,999,999;11;;
Val_Vista;PVLUVista;N;99,999,999;11;;
%MkUp;if(Pvluven3>0,100*Pvluvista/Pvluven3-100,0);N;@E 999.9%;6;;
%PzVis;if(Pvluvista>0,100*Pvluvenda/Pvluvista-100,0);N;@E 999.9%;6;;
PmVen;if(peatual>0,PVLUVENDA/Peatual,0);N;@E 9999.99;7;;
Nmeses;Str(if(SS_12m>0,Peatual/(SS_12m/12),9999),4,1)+if(SS_0ano<SS_ano,"+","-");C;XXXXX;5;;
AcumAno;SS_ano;N;@E 999,999;7;;
DifAcum;SS_ano-SS_0anom;N;@E 999,999;7;;
MesAnt;SS_ultmes;N;@E 999,999;7;;
MesAtu;SS_mes;N;@E 999,999;7;;
DfM_Ant;SS_ultmes-SS_0ultmes;N;@E 999,999;7;;
Vnd2002;ss_0ano;N;@E 999,999;7;;
Vnd12mF;SS_12m;N;@E 999,999;7;;
Dif_12m;SS_12m-SS_0ano;N;@E 999,999;7;;
:TBFO
Str(Z_NLOJAS,2)+"ljs";
Transform( Z_TEST, "@E 9999,999");
Transform( z_tcust,"@E 99,999,999");
Transform( Z_TVENDA,"@E 999,999,999");
Transform( Z_TVista,"@E 999,999,999");
Transform( if(Z_Tcust>0,100*Z_TVista/Z_TCUST-100,0) ,"@E 999.9")+"%" ;
Transform( if(Z_Tvista>0,100*Z_TVENDA/Z_Tvista-100,0) ,"@E 999.9")+"%" ;
Transform( if(Z_TEST>0,Z_TVENDA/Z_TEST,0),"@E 9999.99");
"";
"";
"";
"";
"";
"";
"";
"";
"";
"";
