Ver Mensaje Individual
  #4  
Antiguo 07-05-2011
Rofocale Rofocale is offline
Miembro
 
Registrado: mar 2010
Posts: 182
Reputación: 17
Rofocale Va por buen camino
no funciona bueno hize esto pero me suma todo osea al hacer click en el check y poner la fecha me lo filtra normal pero me suma todo sin distinguir que puse la fecha y solo sumar el resultado de acuerdo a la fecha

Nombre total Fecha
Jose 2.5 05/05/2011
Maria 3.5 05/05/2011
Carlos 1.5 06/05/2011

al filtrar para la fecha 5 sale solo jose y maria pero la suma sale 7.5 me suma todo cuando solo deberia de salir 6

Código Delphi [-]
     dmDatos.cdsCliente.Active := false;
        with dmDatos.qryListados do begin
            Close;
            SQL.Clear;
            SQL.Add('SELECT caja, numero, fecha, hora, estatus, total-iva AS subtotal,');
            SQL.Add('iva, total, cliente, clave FROM ventas v WHERE 1 = 1');

            if(chkCliente.Checked) then
                SQL.Add('AND cliente IN (SELECT clave FROM clientes WHERE nombre LIKE ''%' + txtClienteBusq.Text + '%'')');

            if(chkFecha.Checked) then begin
                SQL.Add('AND fecha = ' + quotedstr(datetostr(FechaBusq.date)));

                with dmDatos.qryConsulta do begin
                Close;
                SQL.Clear;
                SQL.Add('SELECT sum(total) AS total FROM ventas');
                Open;
                txtTotalventa.text := floattostr(FieldByName('total').AsFloat);
                end;
            end;
            open;
Responder Con Cita