martes, 23 de octubre de 2018

Get Status Period in iDempiere


-- select * from fnt_is_open_period(1000026);

-- select * from fnt_is_open_period(1000035);

create or replace function fnt_is_open_period(p_period_id numeric(10,0))
returns boolean
as $$
declare
    v_closed_control int = 0;
begin
    v_closed_control =
    (
        select   
            count(pc.c_periodcontrol_id)
        from c_periodcontrol pc
        where pc.c_period_id = p_period_id
            and pc.periodstatus = 'C'
    );
   
    if(v_closed_control > 0)then
        return false;
    else
        return true;
    end if;
end;
$$ language plpgsql;

No hay comentarios:

Publicar un comentario