SELECT	COALESCE(SUM(rme.valor_entrada - rme.valor_saida), 0) AS saldo_estoque_mes_anterior
FROM	resumo_movimento_estoque AS rme
	INNER JOIN local_estoque AS le ON (le.id_local_estoque = rme.id_local_estoque)
WHERE	le.id_empresa IN (:IdEmpresaMultSlc)
AND	le.fornecimento_sob_demanda = 'N'
AND	ano_mes <= ((DATE_PART('YEAR', DATE_TRUNC('MONTH', CAST(:Data AS TIMESTAMP)) - INTERVAL '1 day') * 100) + 
			DATE_PART('MONTH', DATE_TRUNC('MONTH', CAST(:Data AS TIMESTAMP)) - INTERVAL '1 day'))