-- select * from fnt_get_depreciation_value(255544, 5);
create or replace function fnt_get_depreciation_value(p_asset_value numeric(20,2), p_uselifeyears numeric(10,2))
returns numeric(20,2)
as $$
declare
v_depreciation_value numeric(20,2) = 0.00;
begin
if(p_uselifeyears > 0)then
v_depreciation_value =
coalesce((
p_asset_value / (p_uselifeyears * 12)
), 0.00);
else
v_depreciation_value = 0;
end if;
return v_depreciation_value;
end;
$$ language plpgsql;
No hay comentarios:
Publicar un comentario