Ver Mensaje Individual
  #4  
Antiguo 26-02-2004
dannymunuera dannymunuera is offline
Registrado
 
Registrado: feb 2004
Posts: 8
Reputación: 0
dannymunuera Va por buen camino
Thumbs up consulta de tiempo

Aquí pienso que te doy respuesta, es un procedimiento que realiza hace tiempo, lo mando completo y cojan lo que les sirva.

Var
Str1:String;
var1 :Variant;
WPuesto :Boolean;
begin
{filtrado de la base de datos }
OldEvento :=CBoxEventos.ItemIndex;
OldResp :=CBoxResponsable.ItemIndex;
WPuesto :=False;
With ModuloDatos do
Begin
MyQuery.Active :=False;
MyQuery.SQL.Clear;
MyQuery.SQL.Add('Select * from AcInd a');
If CBResponsable.Checked And ( CBoxResponsable.Text <> '' ) Then
Begin
var1 :=CBoxResponsable.text;
Str1 :='Where a.RESP =''' + VarToStr( Var1 ) + '''';
MyQuery.SQL.Add( Str1 );
WPuesto :=True;
End;
If CBEventos.Checked And ( CBoxEventos.Text <> '' ) Then
Begin
var1 :=CBoxEventos.text;
If Not WPuesto Then
Begin
Str1 :='Where a.EVENTOE =''' + VarToStr( Var1 ) + '''';
WPuesto :=True;
End
Else
Str1 :='And a.EVENTOE =''' + VarToStr( Var1 ) + '''';
MyQuery.SQL.Add( Str1 );
End;
If CBEstado.Checked And ( CBoxEstado.Text <> '' ) Then
Begin
var1 :=CBoxEstado.text;
If Not WPuesto Then
Begin
Str1 :='Where a.ESTADO =''' + VarToStr( Var1 ) + '''';
WPuesto :=True;
End
Else
Str1 :='And a.ESTADO =''' + VarToStr( Var1 ) + '''';
MyQuery.SQL.Add( Str1 );
End;
If FSelecc.ItemIndex = 0 Then
Begin
If CBFinicial.Checked Then
Begin
MyQuery.Params.CreateParam(ftdate, 'FromDate', ptInputOutput);
MyQuery.Params.ParambyName('FromDate').AsDate :=FechaInicial.Date;
If Not WPuesto Then
Begin
Str1 :='Where ( a.FECHAE >= :FromDate )';
WPuesto :=True;
End
Else
Str1 :='And ( a.FECHAE >= :FromDate )';
MyQuery.SQL.Add( Str1 );
End;
If CBFFinal.Checked Then
Begin
MyQuery.Params.CreateParam(ftInteger, 'ToDate', ptInputOutput);
MyQuery.Params.ParamByName('ToDate').AsDate :=FechaFinal.Date;
If Not WPuesto Then
Begin
Str1 :='Where ( a.FECHAE <= :ToDate )';
WPuesto :=True;
End
Else
Str1 :='And ( a.FECHAE <= :ToDate )';
MyQuery.SQL.Add( Str1 );
End;
End
Else
Begin
If CBFinicial.Checked Then
Begin
MyQuery.Params.CreateParam(ftdate, 'FromDate', ptInputOutput);
MyQuery.Params.ParambyName('FromDate').AsDate :=FechaInicial.Date;
If Not WPuesto Then
Begin
Str1 :='Where ( a.FECHAC >= :FromDate )';
WPuesto :=True;
End
Else
Str1 :='And ( a.FECHAC >= :FromDate )';
MyQuery.SQL.Add( Str1 );
End;
If CBFFinal.Checked Then
Begin
MyQuery.Params.CreateParam(ftInteger, 'ToDate', ptInputOutput);
MyQuery.Params.ParamByName('ToDate').AsDate :=FechaFinal.Date;
If Not WPuesto Then
Begin
Str1 :='Where ( a.FECHAC <= :ToDate )';
WPuesto :=True;
End
Else
Str1 :='And ( a.FECHAC <= :ToDate )';
MyQuery.SQL.Add( Str1 );
End;
End;
MyQuery.SQL.Add('Order by a.COD, a.RESP, a.EVENTOE, a.ESTADO');
MyQuery.Active :=True;
LbCant.Caption :=IntToStr( MyQuery.RecordCount );
End;

Cualquier aclaración tratare de darle respuesta, siempre que sea específico

Responder Con Cita