SG_RTM;("Modelos de "+alltrim(sg_rt->ptipo)+" "+alltrim(sg_rt->pref));skip_blk(x);3;6;22;79;padrao;;
:SKEL
VARIAVEL W_CHAVE = sg_rt->ptipo+sg_Rt->PREF
VARIAVEL W_MENSAGEM = "Sem mais "+sg_rt->ptipo+sg_rt->pref
VARIAVEL W_BLOCK = { || W_CHAVE <> ptipo+PREF }
COMANDO ANTES Z_NIL = DbClearIndex()
COMANDO ANTES Z_NIL = DbSetIndex(r_siga+"ntx\SG_TRM1")
COMANDO ANTES Z_NIL = DbSetIndex(r_siga+"ntx\SG_TRM")
:TBMT
 13;Cibrow("SE_PROD",,"SG_TRMP");Enter-Refs.Fabr. ;
 32;Cibrow("SG_RTML",,"SG_RTML");Barra-Lojas ;
 47;disp_sdse(pref+ptipo+pmarcamode,"M");/-Demanda ;
 71;Cibrow("SG_GRD_M",,"SG_GRD_M");G-Grade ;
 79;tb_index(D_OB);O-Ordena ;
:TBFI
Modelo;PMARCAMODE;C;@S18; 18;;
Estoq;PEATUAL;N;@E 999,999;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;;
PmVen;if(peatual>0,PVLUVENDA/Peatual,0);N;@E 999.99;6;;
Val_Venda;PVLUVENDA;N;9,999,999;9;;
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;;
Val_Custo;PVLUVEN3;N;@E 99,999,999;10;;
%Marg;if(Pvluvenda>0,100*(Pvluvenda-PVLUVEN3)/Pvluvenda,0);N;@E 999.9%;6;;
Grps;PITENS;N;9999;  4;;
