Ver Mensaje Individual
  #10  
Antiguo 04-08-2011
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
Estoy seguro que el problema esta en el filtro, prueba esto:
Código Delphi [-]
procedure Tfrm_cortedecaja.DateTimePicker1Change(Sender: TObject);
 var
 Filtro : String;
 begin
 adotable1.Active:=true;
 if Adotable1.Locate('fecha',lbl_fecha.Caption,[]) = True then
 begin
 AdoTable1.Filtered := False;
 Filtro := 'fecha = '+DateToStr(DateTimePicker1.date);
 AdoTable1.Filter := Filtro;
 AdoTable1.Filtered := True;
 AdoTable1.Open;
 Showmessage(AdoTable1.Fields[0].AsString); // aqui revisas que informacion te trae
 //en caso de encontrar productos vendidos realiza la suma
 AdoQuery1.SQL.Text := 'Select sum(importe) as total from caja '+
                       ' where fecha = :Fec '; // aqui esta tu semicolon
 AdoQuery1.Parameters[0].Value:=  DateToStr(DateTimePicker1.date);
 AdoQuery1.Active := true;
 txt_total.Text := AdoQuery1.Fields[0].AsString;
 end;
end;
O esto:
Código Delphi [-]
procedure Tfrm_cortedecaja.DateTimePicker1Change(Sender: TObject);
 var
 Filtro : String;
 begin
 {adotable1.Active:=true;
 if Adotable1.Locate('fecha',lbl_fecha.Caption,[]) = True then
 begin
 AdoTable1.Filtered := False;
 Filtro := 'fecha = '+DateToStr(DateTimePicker1.date);
 AdoTable1.Filter := Filtro;
 AdoTable1.Filtered := True;
 AdoTable1.Open;
 Showmessage(AdoTable1.Fields[0].AsString); // aqui revisas que informacion te trae }
 //en caso de encontrar productos vendidos realiza la suma
 AdoQuery1.SQL.Text := 'Select sum(importe) as total from caja '+
                       ' where fecha = :Fec '; // aqui esta tu semicolon
 AdoQuery1.Parameters[0].Value:=  DateToStr(DateTimePicker1.date);
 AdoQuery1.Active := true;
 txt_total.Text := AdoQuery1.Fields[0].AsString;
 end;
end;
Me cuentas como te va.
Saludos
__________________
Siempre Novato
Responder Con Cita