SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE @startDate DATETIME
  2. DECLARE @endDate DATETIME
  3. DECLARE @idTerminal VARCHAR(4)
  4. SET @startDate = '2019-12- 00:00:00.000'
  5. SET @endDate = '2019-12- 23:59:59.999'
  6. SET @idTerminal = '%'
  7.  
  8. select cast(date_created as date),sum(bruto_pstv-bruto_ngtv) venta
  9. from venta
  10. where date_created between @startDate and @endDate
  11. and cod_terminal like @idTerminal
  12. and id_tipo_transac in ('0','20')
  13. group by cast(date_created as date)
  14. order by cast(date_created as date)
  15.  
  16.  
  17. select cast(date_created as date),sum(valor_venta) ventas_articulo
  18. from ventas_articulo
  19. where date_created between @startDate and @endDate
  20. and cod_terminal like @idTerminal
  21. group by cast(date_created as date)
  22. order by cast(date_created as date)
  23.  
  24. select cast(vmp.date_created as date),sum(valor) ventas_medios_pago
  25. from venta v inner join ventas_medios_pago vmp
  26. on vmp.id_venta = v.id_venta
  27. where v.date_created between @startDate and @endDate
  28. and id_terminal like @idTerminal
  29. and v.id_tipo_transac in ('0','20')
  30. group by cast(vmp.date_created as date)
  31. order by cast(vmp.date_created as date)
  32.  
  33.  
  34. select cast(date_created as date), sum(total) totales_medio_pago
  35.  from totales_medio_pago
  36.  where date_created between @startDate and @endDate and
  37. id_registro_venta in (select id_registro_venta from registro_venta where date_created between @startDate and @endDate and cod_terminal like  @idTerminal)
  38. group by cast(date_created as date)
  39. order by cast(date_created as date)
  40.  
  41. select cast(date_created as date),sum(bruto_pstv-bruto_ngtv) registro_venta
  42. from registro_venta
  43. where date_created between @startDate and @endDate
  44. and cod_terminal like @idTerminal
  45. group by cast(date_created as date)
  46. order by cast(date_created as date)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top