• Sábado 20 de Abril de 2024, 05:20

Autor Tema:  Problema Con Unos Filtros En Un Formulario  (Leído 1105 veces)

jimmyc

  • Nuevo Miembro
  • *
  • Mensajes: 7
    • Ver Perfil
Problema Con Unos Filtros En Un Formulario
« en: Sábado 30 de Diciembre de 2006, 21:31 »
0
****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()
</span>

arielb

  • Moderador
  • ******
  • Mensajes: 771
  • Nacionalidad: pa
    • Ver Perfil
    • http://coder-pa.blogspot.com
Re: Problema Con Unos Filtros En Un Formulario
« Respuesta #1 en: Domingo 31 de Diciembre de 2006, 19:03 »
0
me parece que te falta el cast de la fecha de caracter a fecha en esta linea
Código: Text
  1. FiltroD = &#34;BETWEEN(gyma_a01.fecha, Thisform.Text4.Value, Thisform.Text8.Value)&#34;
  2.  

Ponlo asi
Código: Text
  1. FiltroD = &#34;BETWEEN(gyma_a01.fecha, ctod(Thisform.Text4.Value), ctod(Thisform.Text8.Value))&#34;
  2.  

Tambien depende como estas colocando la fecha si la estas colocando completo el año
usar
Código: Text
  1. set century on
  2.  
Código: Text
  1. set date tipodefecha
  2.  
"Porque de tal manera amó Dios al mundo que dio a su hijo unigénito para que todo aquél que en él crea no se pierda mas tenga vida eterna"
Juan 3:16

http://coder-pa.blogspot.com