on 12-02-2010 2:39 PM
Hola buenos dias,
tengo una duda
estoy diseñando un reporte de rotacion de cartera para el cual debo de traerme todas las ventas del mes entre el promedio del saldo inicial y saldo final de ese mismo mes.
Mi duda es como le hago para determinar ese saldo inicial y ese saldo final del mes
En mi query yo me traje todos los movimientos filtrado por el mes pero no se con que funcion pueda traerme el saldo del mes anterior y el saldo final.
Agradeceria mucho su ayuda xq ya no se como mas hacerle
Gracias!
ESTE ES MI QUERY, CON ESTE YO SACO TODAS LAS VENTAS POR MES, PERO NO SE COMO DECIRLE QUE ME GUARDE VALORES EN DETERMINADA VARIABLE PARA QUE SEAN LOS SALDOS INICIALES Y FINALES DEL MES
SELECT T0.[DocDate], YEAR(t0.[docdate]) as AÑO, MONTH(T0.[DOCDATE]) AS MES, SUM(T0.[DocTotal]) as TOTALMXP, SUM(T0.[VatSum])as IMPUESTOMXP,SUM( (T0.[DocTotal]-T0.[VatSum])) AS SubtotalMXP, SUM(T0.[DocTotalSy])AS TOTALUSD, SUM(T0.[VatSumSy])AS IMPUESTOUSD,SUM((T0.[DocTotalSy]-T0.[VatSumSy])) as SubtotalUSD FROM OINV T0
GROUP BY T0.[DocDate], YEAR(t0.[docdate]), MONTH(T0.[DOCDATE])
UNION ALL
SELECT T0.[DocDate], YEAR(t0.[docdate]) AS AÑO, MONTH(T0.[DOCDATE]) AS MES, SUM(T0.[DocTotal]-1)as TOTALMXP, SUM(T0.[VatSum]-1) AS IMPUESTOMXP, SUM((T0.[DocTotal]-T0.[VatSum]))-1 AS SubtotalMXP, SUM(T0.[DocTotalSy])-1 AS TOTALUSD, SUM(T0.[VatSumSy])-1 AS IMPUESTO, SUM((T0.[DocTotalSy]-T0.[VatSumSy]))-1 as SubtotalUSD FROM ORIN T0
GROUP BY T0.[DocDate], YEAR(t0.[docdate]), MONTH(T0.[DOCDATE])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola
Como va tu query?
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 |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.