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');
if(chkCliente.Checked) then
begin
SQL.Add('AND cliente IN (SELECT clave FROM clientes WHERE nombre LIKE ''%' + txtClienteBusq.Text + '%'')');
end;
if(chkFecha.Checked) then
begin
with dmDatos.qryConsulta do
begin
if Active then Close;
SQL.Clear;
SQL.Add('SELECT fecha,total,sum(total) AS gtotal FROM ventas WHERE fecha = :fecha GROUP BY fecha,total');
parambyname('fecha').AsDate := FechaBusq.date;
open;
txtTotalventa.text := floattostr(FieldByName('gtotal').AsFloat);
end;
end;
open;
hola esto es lo que hize ahora pero al apretar el check para seleccionar una fecha no filtra por fecha siguen apareciendo todas las fecha y en el edit no suma el sum(total) de todos los campos solo aparece del primer campo de la fecha si en el dia 6 hay 2 campos con un total de 2.5 y 3.5 en ves de salir 6 sale solo 2.5 alguien me da una mano ?
gracias