miércoles, 20 de marzo de 2019

Get Movement Type in iDempiere


-- select * from fnt_get_movementtype('I+');

create or replace function fnt_get_movementtype(p_movementtype_id char(2))
returns varchar
as $$
begin
    return
    (
        case p_movementtype_id
            when 'C-' then 'Embarque a Clientes'
            when 'C+' then 'Devolucion a Cliente'
            when 'I-' then 'Salida de Inventario'
            when 'I+' then 'Entrada de Inventario'
            when 'M-' then 'Movimiento Desde'
            when 'M+' then 'Movimiento Hacia'
            when 'P-' then 'Produccion -'
            when 'P+' then 'Produccion +'
            when 'V-' then 'Devolucion a Proveedor'
            when 'V+' then 'Recibos de Proveedor'
            when 'W-' then 'Orden de Trabajo -'
            when 'W+' then 'Orden de Trabajo +'
        end
    );
end;
$$ language plpgsql;

1 comentario:

  1. Saludos, buenos dia, Jose, he revisado tu codigo, la funcion que desarrollaste la utilizas a nivel de reportes, ventanas?, te comento una experiencia que he trabajado con esta data Gestion de Inventarios o Materiales en Idempiere, usando la Referencia!

    SELECT mp.Value, mp.Name, SUM(rt.MovementQty), AD_Ref_List_Trl.name
    FROM M_Transaction rt
    JOIN AD_Ref_List arl ON arl.value = rt.MovementType AND arl.AD_Reference_ID = 189
    JOIN AD_Ref_List_Trl USING(AD_Ref_List_ID)
    JOIN M_Product mp ON rt.M_Product_ID = mp.M_Product_ID
    WHERE rt.AD_Client_ID = 11
    GROUP BY mp.Value, mp.Name, rt.MovementType, AD_Ref_List_Trl.name

    Ejecuta la Sentencia SQL para la Company "GardenWorld", AD_Client_ID = 11

    Estoy Usando la Referencia (AD_Reference_ID=189), M_Transaction Movement Type, configurada con Tipo de validacion: Lista de Validación, puedes usar el resultado que retorna para un Reporte que agrupe cantidades por Tipo de Movimientos.

    Te dejo mi contacto: alvaro.kastro@gmail.com, para conversar sobre temas tecnicos y funcionales de Idempiere!

    ResponderEliminar