Sie sind auf Seite 1von 8

Tabela Substituio Tributria

Para Saber quais Produtos esto Configurados com


determinada Tabela S.T
select fco, fde from esprod where ftcst = '020'

Pesquisa Mostrando Codigo do


Produto Descrio Tributao
Tabela NCM
select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM from xemp_0001.esprod
where ftclt = '4'
and fregativo in ('S','N')
and ftcst = '002'
and ftcti = '0033012990'

Para Saber quais Produtos e Grupos esto


Configurados com determinada Tabela S.T
select esprod.fco as CodigoProduto,
esprod.fde as DescricaoProduto,
fgr as Grupo,
esgrupo.fde as DescricaoGrupo from esprod
inner join esgrupo on esprod.fgr=esgrupo.fco
where ftcst = '020'

select fco, fde, ftcti from xemp_0001. esprod where ftcst = '020'

select * from esprod


where ftcst = '021'

Ver por Grupos


select fgr, fde from esprod where ftcst = '001'

Seleciona pela Tabela e Grupo


select * from esprod
where ftcst = '001'
and fgr = '0005'

Seleciona pela NCM o produto e a


Tabela Substituio Tributria
select fCo, fde,ftcst from xemp_0001.esprod
where ftcti = '3924100000'
AND fregativo = 'S'

Seleciona pela NCM o produto e a Tabela Substituio Tributria


Informando produtos ativos e Inativos
select fCo, fde,ftcst,
case when fregativo = 'S' then 'SIM' else 'NAO' end as ativo
from xemp_0001.esprod
where ftcti = '0015131900'

Altera a tabela Substituio Tributria por NCM


update esprod set ftcst = '046' where ftcti = '99999999' and ftcst = '002'

Alterar da Tabela 002 para tabela


046 todos os produtos independente
da NCM
update esprod set ftcst = '046'
where ftcst = '002'

Seleciona a Tabela Mostrando a NCM


que est com percentual Zero Ou
se trocar o Sinal de = Mostra todos
com Percentual
select
esprod.ftcst as tabelaST,
esprod.ftcti as NCM,
EsClTip.fMvapositiva as positivo,
EsClTip.fMvaNegativa as negativo,
EsClTip.fMvaNeutra as neutra,
EsClTip.fAliqInterna as interna
from
esprod
left join EsClTip on EsClTip.fCo = esprod.ftcti
where esprod.ftcst in ('042','046','047')
and (fMvapositiva = 0 or fMvaNegativa = 0 or fMvaNeutra = 0 or
fAliqInterna= 0 )
group by 1,2,3,4,5,6
order by 1

Listar todos os produtos ativos ou


inativos por Classificao tributaria com
NCM e Tabela S.T.
select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM from xemp_0001.esprod
where ftclt = '4'
and fregativo in ('S','N')

Listar todos os produtos ativos e inativos por Classificao tributaria com


NCM e Tabela S.T.
select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM from xemp_0001.esprod
where ftclt = '4'
and fregativo in ('S')

Listar todos os produtos ativos e inativos por Classificao tributaria e por


Grupo de NCM com NCM e Tabela S.T select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM,
substring(ftcti,1,8) as grupo
from xemp_0001.esprod

where ftclt = '4'


and fregativo in ('S')
and substring(ftcti,1,8) = '00300320'

Listar todos os produtos ativos e inativos por Classificao tributaria e por


NCM e Tabela S.T select fCO as codigo,

select fCO as codigo,


Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM,
substring(ftcti,1,10) as grupo
from xemp_0001.esprod

where ftclt = '4'


and fregativo in ('S')
and substring(ftcti,1,10) = '0030039079'

Listar todos os produtos Tabela Substituio Tributria


select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM,
substring(ftcti,1,10) as grupo
from xemp_0001.esprod
where ftclt = '4'
and ftcst ='015'
and fregativo in ('S')

Seleciona Controle mostra produto e tabela S.T.


Select fanfi.fcontrole,
fanfi.fproduto,
esprod.ftclt,
esprod.ftcst
from xemp_0001.fanfi
left join xemp_0001.esprod on esprod.fco = fanfi.fproduto
where fcontrole = '0000065675'

Listar todos os produtos Tabela Substituio


Tributria mostra o Valor retido
Obs: Consta Valor Calculado que so os tributados que calcula ICMSST e
Mostra Valor retido que so os produtos que j vem com Reteno ICMSST.
Select fanfi.fcontrole,

fanfi.fproduto,
esprod.ftclt,
esprod.ftcst,
fanfi.fbcsub,
fanfi.fvasub,
fanfi.fVaSub,
fanfc.fICMSSubst
from xemp_0001.fanfi
left join xemp_0001.esprod on esprod.fco = fanfi.fproduto
left join xemp_0001.fanfc on fanfc.fcontrole = fanfi.fcontrole
where fanfi.fcontrole = '0000050885'

Alterar Clientes Parametros gerais


Substituio Tributria de Definido para Sim
update xemp_0001.gecad set fsubtrib = 'S', FTABSUBTRI = '' WHERE
fsubtrib= 'D'

Seleciona quais clientes esto configurados


para reter Substituio Tributria
select fsubtrib,FTABSUBTRI,* from XEMP_0001.gecad WHERE fsubtrib= 'N'

Listar todos os produtos ativos ou inativos


pela classificao tributaria- tabela S.T. e NCM
select fCO as codigo,
Fde as descricao,
ftclt as tributacao,
ftcst as tabelaST,
ftcti as NCM from xemp_0001.esprod
where ftclt = '4'

and fregativo in ('S')


and ftcst = '006'
and ftcti = '0096032900'

Seleciona Por controle Informando Produto


Valor ST Tabela ST
select fproduto, ftcst,fvasub
from fanfi
left join esprod on fanfi.fproduto = esprod.fco
where fcontrole ='0000068756'

Seleciona Por controle Informando Produto


Valor ST Tabela ST Valor do IPI
select fproduto, ftcst,fvasub, FVAIPI
from fanfi
left join esprod on fanfi.fproduto = esprod.fco
where fcontrole ='0000071198'
and ftcti = '0033043000'

Seleciona os clientes ou Fornecedores que esto configurados para reter


ICMSST
select fsubtrib,FTABSUBTRI,* from XEMP_0001.gecad WHERE fsubtrib= 'N'
and fcf = 'C'

Altera a Configurao de Clientes ou Fornecedores para reter ou no


ICMSST

update xemp_0001.gecad set fsubtrib = 'S' WHERE fsubtrib= 'N' and fcf =
'F'

Das könnte Ihnen auch gefallen