select  
	se.nome as nome_empresa,
	i.codigo as codigo_item,
	i.denominacao as denominacao_item,
     uf.sigla,
    cf.codigo as codigo_ncm,
    ibpt.aliq_nacional_federal,
    ibpt.aliq_importado_federal,
    ibpt.aliq_estadual,
    ibpt.aliq_municipal,
    ibpt.fim_vigencia

	from item as i
    inner join categoria_item as ci on ci.id_categoria_item = i.id_categoria_item
    inner join codigo_fiscal as cf on cf.id_codigo_fiscal = i.id_codigo_fiscal
    inner join item_empresa as ie on ie.id_item = i.id_item
    inner join sis_empresa as se on se.id_empresa = ie.id_empresa
    inner join pessoa as pe on pe.codigo = se.codigo
    inner join municipio as mu on mu.id_municipio = pe.id_municipio
    inner join uf on uf.id_uf = mu.id_uf
    inner join ibptax as ibpt on ibpt.codigo = cf.codigo
    
    where
    ci.id_categoria_item = 399
    and	se.id_empresa = :IdEmpresaObrigatorio
    and mu.id_uf = ibpt.id_uf
    and ibpt.ex = ''

	group by
        se.nome,
		i.codigo, 
		i.denominacao,
        uf.sigla,
        cf.codigo,
        ibpt.aliq_nacional_federal,
        ibpt.aliq_nacional_federal,
        ibpt.aliq_importado_federal,
        ibpt.aliq_estadual,
        ibpt.aliq_municipal,
        ibpt.fim_vigencia

	order by
		i.codigo