on 04-16-2018 9:15 AM
Buenas a todos
Tengo un reporte de faturacion de ventas, en el se muetsran las facturas abiertas y cerradas
pero no encuentro la forma de si la factura esta en dolares, trerme todos los montos en dolares, precio por unidad, IVA, Total del documento y para factura en pesos realizar la misma operacion, este es mi query espero me puedan ayudar, gracias.
select T1.SeriesName [Serie], T0.DocNum [Folio],T0.DocEntry [Liga Documento],T0.LicTradNum [RFC],T0.CardName [Nombre Receptor],
T0.DocDate [Fecha Emision], T0.DocDueDate [Fecha de Vencimiento], T3.SlpName [Vendedor], T2.ItemCode [Producto],
--CASE when T4.BatchNum is null then O else T4.BatchNum end as [Lote]
T5.SalUnitMsr [Presentacion], T2.Price [Precio],
case when T2.ItemCode is null then 1 else T2.Quantity end as [Cantidad],
case when T2.ItemCode is null then T2.Price else T2.Price * T2. Quantity end as [Subtotal],
T2. VatSum [IVA Tras], T2.LineTotal + T2.VatSum [Total], T2.Currency [Moneda]
from OINV T0 left Join
NNM1 T1 on T0.Series = T1.Series left join
INV1 T2 on T0.DocEntry = T2.DocEntry left join
OSLP T3 on T0.SlpCode = T3.SlpCode left join
IBT1 T4 on T2.DocEntry = T4.BaseEntry and T2.ObjType = T4.BaseType and T2.LineNum = T4.BaseLinNum left join
OITM T5 on T2.ItemCode = T5.ItemCode
WHERE T0.[CANCELED] = 'N'
order by T0.DocNum
Hola
tienes dos opciones:
- una, discriminar mediante CASE por el campo de moneda y elegir el valor a mostrar.
- dos, utilizar la cláusula UNION ALL. En este caso deberás crear una consulta para los documentos en pesos y otra idéntica en número de campos y de orden de los mismos para los documentos en dólares. Recuerda que los campos en moneda extranjera terminan en FC.
Un saludo
Agustín
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Enterado muchas gracias Agustin por el apoyo, me funciono con el case.
Saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.