select
'13' as IDENTIFICADOR,
cast(procod as text)||lpad(cast(uvecod as text),5,'0') as codProduto,
lp.lpcod as codListaPreco,
uve.uveun as unidade,
uve.uvemult as qtdeEmbalagem,
round(fprbasevl1,2) as valor,
fprbasedesc as percDescontoMaximo,
uve.uvepermitirvendafracionada as permiteVendaFracionaria,
null as promocaoValor,
null as promocaoDataInicio,
null as promocaoDataFim,
null as lancamentoAte,
null as multiplosPermitidosPorEmbalagem,
case when coalesce(estaliqipi,0) > 0 then round((fprbasevl1*estaliqipi)/100,2) else 0 end as valorIpiPorUnidade,
null as opcoesDePrecoPreFixado,
null as precoTravado,
null as codCliente,
uve.uvepesobruto as pesoBruto,
uve.uvepesoliq as pesoLiquido,
null as cubagem,
fprbaseaum as percAcrescimoMaximo,
null as custoReposicao,
uve.uvedes as unidadeEmbalagem,
uve.uvealtura as altura,
uve.uvelargura as largura,
uve.uveprofundidade as comprimento,
null as jsonPrecoPorQuantidade
from preco
join pro on precoprocod = procod
join lp on precolpcod = lpcod
join est on procod=estprocod and estempparcod=lp.lpempparcod and estdispb2b='S'
join uve on uveprocod=procod --and uvedispb2b='S'
join f_preco_base() on fprbaseprocod=procod and fprbaseembcod=uvecod and fprbaselpcod=lpcod
where coalesce(fprbasevl1) > 0
order by lpcod,procod,uvecod
ExecutarScriptSempre
