Ver Mensaje Individual
  #4  
Antiguo 06-05-2011
Rofocale Rofocale is offline
Miembro
 
Registrado: mar 2010
Posts: 182
Reputación: 17
Rofocale Va por buen camino
Código Delphi [-]
procedure TfrmVentasConsulta.btnBuscarClick(Sender: TObject);
begin
    //if(VerificaDatos) then begin
        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)));
                //SQL.Add('AND fecha <= ''' + txtMesFin.Text + '/' + txtDiaFin.Text + '/' + txtAnioFin.Text + '''');
            end;
            Open;
        end;
        with dmDatos.cdsCliente do begin
            Active := true;

            txtRegistros.text := inttostr(dmDatos.cdsCliente.RecordCount);

            FieldByName('caja').DisplayLabel := 'Caja';
            FieldByName('caja').DisplayWidth := 4;
            FieldByName('numero').DisplayLabel := 'Remisión';
            FieldByName('numero').DisplayWidth := 8;
            FieldByName('fecha').DisplayLabel := 'Fecha';
            FieldByName('fecha').DisplayWidth := 9;
            FieldByName('hora').DisplayLabel := 'Hora';
            FieldByName('hora').DisplayWidth := 11;
            FieldByName('estatus').DisplayLabel := 'Estatus';
            FieldByName('estatus').DisplayWidth := 7;
            FieldByName('subtotal').DisplayLabel := 'Subtotal';
            FieldByName('subtotal').DisplayWidth := 10;
           // (FieldByName('subtotal') as TNumericField).DisplayFormat := '#,##0.00';
            FieldByName('iva').DisplayLabel := 'IGV';
            FieldByName('iva').DisplayWidth := 10;
           // (FieldByName('iva') as TNumericField).DisplayFormat := '#,##0.00';
            FieldByName('total').DisplayLabel := 'Total';
            FieldByName('total').DisplayWidth := 10;
           // (FieldByName('total') as TNumericField).DisplayFormat := '#,##0.00';
            FieldByName('cliente').Visible := false;
          //  FieldByName('usuario').Visible := false;
            FieldByName('clave').Visible := False;
        end;

        if(pgeGeneral.ActivePage = tabBusqueda) then
            grdListado.SetFocus;
    //end;
end;

ese es todo el codigo

y en el stringgrid enlazo en el datasource el correspondiente datasource
Responder Con Cita