miércoles, 8 de mayo de 2013
Fixed Assets
-- select * from vw_activos_fijos af;
-- drop view vw_activos_fijos
CREATE VIEW vw_activos_fijos AS
SELECT a.ad_client_id,
o.ad_org_id AS id_centro_costo,
o.name AS centro_costo,
a.u_activo_id AS id_activo,
a.codigo AS cod_activo,
a.nombre AS activo,
a.descripcion,
a.serialno,
ma.nic_marca_id AS id_marca,
ma.name AS marca,
mo.nic_modelo_id AS id_modelo,
mo.name AS modelo,
ga.u_grupoactivo_id AS id_grupo,
ga.codigo AS cod_grupo,
ga.nombre AS grupo,
og.ad_org_id AS grupo_org_id,
og.name AS grupo_org,
vc.c_validcombination_id AS id_combinacion,
vc.combination AS combinacion,
vc.description AS desc_combinacion,
ca.u_claseactivo_id AS id_clase,
ca.codigo AS cod_clase,
ca.nombre AS clase,
ca.descripcion AS desc_clase,
a.area_terreno,
a.registro_catastral,
a.registro_publico,
a.num_factura,
bp.c_bpartner_id AS id_comprador,
bp.value AS cod_comprador,
bp.name AS comprador,
a.num_chasis,
a.num_placa,
a.bueno,
a.regular,
a.depreciado,
a.baja,
a.fechacompra,
a.fechabaja,
a.totalmeses,
a.valoractual,
a.valordepreciado,
a.valorinicial,
a.periodofinal,
a.periodoinicial
FROM u_activo a
JOIN ad_org o ON a.ad_org_id = o.ad_org_id
LEFT OUTER JOIN nic_marca ma ON a.nic_marca_id = ma.nic_marca_id
LEFT OUTER JOIN nic_modelo mo ON a.nic_modelo_id = mo.nic_modelo_id
JOIN u_grupoactivo ga ON a.u_grupoactivo_id = ga.u_grupoactivo_id
JOIN ad_org og ON ga.ad_org_id = og.ad_org_id
LEFT OUTER JOIN c_validcombination vc ON ga.c_validcombination_id = vc.c_validcombination_id
JOIN u_claseactivo ca ON ga.u_claseactivo_id = ca.u_claseactivo_id
LEFT OUTER JOIN c_bpartner bp ON a.c_bpartner_id = bp.c_bpartner_id
WHERE a.ad_client_id = 1000001
AND a.isactive = 'Y';
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario