miércoles, 20 de marzo de 2019

Inventory Transactions in iDempiere


-- select ti.* from vw_transacciones_inv ti;

-- drop view vw_transacciones_inv;

create or replace view vw_transacciones_inv
as
select
    t.m_transaction_id as id_transaccion,
    t.movementtype as id_tipo_movimiento,
    fnt_get_movementtype(t.movementtype) as tipo_movimiento,
    l.m_locator_id as id_ubicacion,
    l.value as ubicacion,
    w.m_warehouse_id as id_almacen,
    w."name" as almacen,
    pc.m_product_category_id as id_categoria,
    pc."name" as categoria,
    p.m_product_id as id_producto,
    p.value as cod_producto,
    p.name as producto,
    u.c_uom_id as id_unidad,
    u."name" as unidad,
    t.movementdate::date as fecha_movimiento,
    t.movementqty as cantidad,
    i.m_inventory_id as id_inventario,
    i.documentno as num_inventario,
    il.m_inventoryline_id as id_det_inventario,
    il.line as linea_inventario,
    m.m_movement_id as id_traslado,
    m.documentno as num_traslado,
    ml.m_movementline_id as id_det_traslado,
    ml.line as linea_traslado,
    pp.m_production_id as id_produccion,
    pp.documentno as num_produccion,
    pl.m_productionline_id as id_det_produccion,
    pl.line as linea_produccion,
    ai.m_attributesetinstance_id as id_atributos,
    ai.description as atributos
from m_transaction t
    join m_locator l
    on t.m_locator_id = l.m_locator_id
    join m_warehouse w
    on l.m_warehouse_id = w.m_warehouse_id
    join m_product p
    on t.m_product_id = p.m_product_id
    join c_uom u
    on p.c_uom_id = u.c_uom_id
    left outer join m_product_category pc
    on p.m_product_category_id = pc.m_product_category_id
    left outer join m_inventoryline il
    on t.m_inventoryline_id = il.m_inventoryline_id
    left outer join m_inventory i
    on il.m_inventory_id = i.m_inventory_id
    left outer join m_movementline ml
    on t.m_movementline_id = ml.m_movementline_id
    left outer join m_movement m
    on ml.m_movement_id = m.m_movement_id
    left outer join m_productionline pl
    on t.m_productionline_id = pl.m_productionline_id
    left outer join m_production pp
    on pl.m_production_id = pp.m_production_id
    join m_attributesetinstance ai
    on t.m_attributesetinstance_id = ai.m_attributesetinstance_id
where t.ad_client_id = 1000000;


No hay comentarios:

Publicar un comentario