viernes, 31 de mayo de 2013
Comprobante de diario en Adempiere
drop view if exists vw_comprobante_diario;
create view vw_comprobante_diario as
select
o.ad_org_id as id_centro,
o.value as cod_centro,
o.name as centro_costo,
ev.c_elementvalue_id as id_cuenta,
ev.value as cod_cuenta,
ev.name as cuenta,
ev.accountsign as id_naturaleza,
case ev.accountsign
when 'N' then 'Natural'
when 'D' then 'Debito'
when 'C' then 'Credito'
end as naturaleza,
ev.accounttype as id_tipo_cuenta,
case ev.accounttype
when 'A' then 'Activo'
when 'L' then 'Pasivo'
when 'O' then 'Capital'
when 'R' then 'Ingresos'
when 'E' then 'Gastos'
when 'M' then 'Memo'
end as tipo_cuenta,
f.fact_acct_id as id_contable,
f.dateacct as fecha_contable,
p.c_period_id as id_periodo,
p.name as periodo,
gb.gl_journalbatch_id as id_lote,
gb.documentno as num_lote,
gb.description as desc_lote,
g.gl_journal_id as id_nota,
g.documentno as num_nota,
g.description as desc_nota,
gl.gl_journalline_id as id_linea,
gl."line" as num_linea,
gl.description as desc_linea,
f.amtacctdr as debito,
f.amtacctcr as credito
from fact_acct f
join ad_org o
on f.ad_org_id = o.ad_org_id
join c_elementvalue ev
on f.account_id = ev.c_elementvalue_id
join c_period p
on f.c_period_id = p.c_period_id
join gl_journal g
on f.record_id = g.gl_journal_id
join gl_journalbatch gb
on g.gl_journalbatch_id = gb.gl_journalbatch_id
join gl_journalline gl
on f.line_id = gl.gl_journalline_id
where f.ad_client_id = 1000001
and f.ad_table_id = 224;
select
cd.*
from vw_comprobante_diario cd
order by
cd.id_periodo,
cd.id_lote,
cd.id_nota,
cd.num_linea
limit 1000;
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario