Programación General > Visual FoxPro

 Problema Con Unos Filtros En Un Formulario

(1/1)

jimmyc:
****Este codigo cuando manda llamar al reporte no hace todas las restriciones ***
*** ustedes cren que sea***

PUBLIC Filtro, cPeriodo

Filtro = ''
cPeriodo = ''
STORE .F. to FilFef, FilFeD,FilFeP
select gyma_a01
SET ORDER TO NOCXP

STORE SPACE(1) TO FiltroF, FiltroD, FiltroP

IF !EMPTY(Thisform.Text2.Value) .and. !EMPTY(Thisform.Text3.Value)
   FiltroF = "BETWEEN(gyma_a01.nocar, allt(Thisform.Text2.Value), allt(Thisform.Text3.Value))"
   FilFeF = .T.
ENDIF

IF !EMPTY(Thisform.Text4.Value) .and. !EMPTY(Thisform.Text8.Value)
   FiltroD = "BETWEEN(gyma_a01.fecha, Thisform.Text4.Value, Thisform.Text8.Value)"
   FilFeD = .T.
   cPeriodo = "Del: " + DTOC(Thisform.Text4.Value) + " al: " + DTOC(Thisform.Text8.Value)
ENDIF


IF !EMPTY(Thisform.Text1.Value) .and. !EMPTY(Thisform.Text5.Value)
   FiltroP = "BETWEEN(gyma_a01.Nocxp, allt(Thisform.Text1.Value),allt(Thisform.Text5.Value))"
   FilFeP= .T.
ENDIF

IF FilFeF
   Filtro = ALLTRIM(FILTROF)
ENDIF

IF FilFeD AND !EMPTY(Filtro)
    Filtro = Filtro + " .and. " + ALLTRIM(FILTROD)
ELSE
   Filtro = ALLTRIM(FiltroD)
ENDIF

IF FilFeP AND !EMPTY(Filtro)      
   Filtro = Filtro  + " .and. " + ALLTRIM(FILTROP)
ELSE
   Filtro = ALLTRIM(FiltroD)
Endif            
      
SET FILTER TO &FILTRO   

GO top

do case
   case thisform.optiongroup1.value=1
      report form f:\gimnasio\informes\gyminfabo preview
   case thisform.optiongroup1.value=2
      report form f:\gimnasio\informes\gyminfabo to print prompt noconsole
   case thisform.optiongroup1.value=3   
      delete file c:\Abonos.xls
      copy to c:\Abonos.xls TYPE XL5
      =Messagebox('Archivo c:\Abonos.xls Creado',48,'Información')      
endcase
thisformset.limpia()

arielb:
me parece que te falta el cast de la fecha de caracter a fecha en esta linea

--- Código: Text ---FiltroD = "BETWEEN(gyma_a01.fecha, Thisform.Text4.Value, Thisform.Text8.Value)" 
Ponlo asi

--- Código: Text ---FiltroD = "BETWEEN(gyma_a01.fecha, ctod(Thisform.Text4.Value), ctod(Thisform.Text8.Value))" 
Tambien depende como estas colocando la fecha si la estas colocando completo el año
usar

--- Código: Text ---set century on 
--- Código: Text ---set date tipodefecha 

Navegación

[0] Índice de Mensajes

Ir a la versión completa