on 09-03-2014 4:10 PM
Hola, estoy trabajando en una consulta para descargar a excel todos los asientos contables registrados en un rangos de fecha, apra esto tengo la siguiente consulta:
SELECT je1.TransId ,je.RefDate ,acc.AcctCode ,acc.AcctName ,je.Memo ,je1.Debit ,je1.Credit FROM JDT1 as je1
left join OPRC as prc on je1.ProfitCode = prc.PrcCode
left join OPRC as prc2 on je1.OcrCode2 = prc2.PrcCode
left join OPRC as prc3 on je1.OcrCode3 = prc3.PrcCode
left join OPRC as prc4 on je1.OcrCode4 = prc4.PrcCode
left join OPRC as prc5 on je1.OcrCode5 = prc5.PrcCode
inner join OACT as acc on je1.Account = acc.AcctCode
inner join OJDT as je on je1.TransId = je.TransId
and je.RefDate BETWEEN '20140801' AND '20140830'
GROUP BY je1.TransId ,je.RefDate ,acc.AcctCode ,acc.AcctName ,je.Memo ,je1.Debit ,je1.Credit
Hasta aquí bien, pero no he logrado incorporar el campo abreviado de tipo de documentos en mi query; Por ejemplo:
Abreviatura | Clase de operación |
SI | Saldo inicial |
CB | Saldo final |
AS | Asiento |
NE | Entrega |
DV | Devolución |
FA | Factura de deudores |
FA | Factura de deudor + Pago |
FA | Factura de reserva de clientes |
FA | Nota de débito de clientes |
FA | Factura exenta de deudores |
FA | Boleta |
Agradezco los aportes que contribuyan a la solución de esta consulta.
Puedes agregarlo con un CASE
ej.
Case
WHEN TransType=13 THEN 'RF - Factura de deudores'
WHEN TransType=30 THEN 'AS - Asiento contable'
End 'Tipo de transaccion'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ESTAS TENGO A LA MANO
when 13 then 'VENTAS - FACTURAS'
when 14 then 'VENTAS - NOTAS DE CREDITO'
when 15 then 'VENTAS - ENTREGAS'
when 16 then 'VENTAS - DEVOLUCIONES'
when 17 then 'VENTAS - ORDENES DE VENTA (PEDIDOS)'
when 18 then 'COMPRAS - FACTURAS'
when 19 then 'COMPRAS - NOTAS DE CREDITO'
when 20 then 'COMPRAS - ENTRADAS MERCANCIA'
when 21 then 'COMPRAS - DEVOLUCIONES'
when 22 then 'COMPRAS - ORDENES DE COMPRA'
when 23 then 'VENTAS - COTIZACIONES'
when 59 then 'INVENTARIO - ENTRADAS DE MERCANCIA'
when 60 then 'INVENTARIO - SALIDAS DE MERCANCIA'
when 67 then 'INVENTARIO - TRASLADOS'
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.