on 11-14-2014 7:12 PM
Hola a todos como están? tengo este código : pero no recuerdo como le digo a SQL "hoy menos 30 dias"
if @object_type = 17 and @transaction_type = 'A'
begin
if exists(select T0.cardcode from OCRD T0 inner join OINV T1 on T1.cardcode = T0.cardcode
where T1.canceled ='N' and T1.docstatus = 'O' and T1.doctotal > T1.paidtodate and T1.docduedate < ("hoy menos 30 días")
select @error = 6009, @error_message = 'Cliente con alguna factura vencida mas de 30 dias'
Saludos
Gerardo,
En lugar de T1.DocDueDate < ("hoymenos30días") usa esto:
datediff(dd,T1.DocDueDate,getdate()) > 30
Saludos,
JC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gerardo:
Prueba con lo adjunto y me cuentas.
if @object_type = 17 and @transaction_type IN ('A', 'U')
begin
declare @mayor varchar (20)
set @mayor = 0
SET @mayor = (select COUNT(*) from INV1 T0 inner join OINV T1 on T1.DocEntry = @list_of_cols_val_tab_del
where T1.canceled ='N' and T1.doctotal > T1.paidtodate and datediff(dd,T1.DocDueDate,getdate()) > 30 )
end
if @mayor > 0
begin
SET @error = 7
SET @error_message = 'Facturas Impagas'
end
Saludos,
Manuel Díaz G.
Hola Manuel, si , esta funcionando excelentemente bien, muchas gracias. Por cierto Tienes algo que envie alertas a X usuario cuando se crea un documento, por ejemplo crear una alerta cuando se crea algún pedido, estoy batallando un poco con este ultimo, subiré un código que no me funciono, saludos.
User | Count |
---|---|
87 | |
7 | |
6 | |
4 | |
3 | |
3 | |
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.