Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set ANSI_NULLS ON
- set QUOTED_IDENTIFIER ON
- go
- ALTER Procedure [dbo].[planchev_registrados_obtener](
- @filtrarPorRecibirCuota bit= null,
- @soloConCuponesPendientes bit= null
- )
- as
- begin
- /* VARIABLES */
- Declare @FechaArg DateTime
- /* la fecha actual de argentina es la UTC - 3 */
- Select @FechaArg = dateAdd(hour, -3, getutcdate())
- select registrados.*
- from planchev_registrados registrados
- where
- ( isnull(@filtrarPorRecibirCuota, 0)= 0
- or ( isnull(@filtrarPorRecibirCuota, 0)<> 0
- and isnull(registrados.recibir_cuota, 0)<> 0
- )
- )
- and ( isnull(@soloConCuponesPendientes, 0)= 0
- or ( isnull(@soloConCuponesPendientes, 0)<> 0
- and exists ( select 1
- from planChevCupones cupones
- inner join planChevCodigosBarra codigos on cupones.idCupon= codigos.idCupon
- where datediff(day, @FechaArg, codigos.FechaValidezPago) > 0
- )
- )
- )
- end
Add Comment
Please, Sign In to add comment