Ver Mensaje Individual
  #4  
Antiguo 16-05-2011
Rofocale Rofocale is offline
Miembro
 
Registrado: mar 2010
Posts: 182
Reputación: 17
Rofocale Va por buen camino
Código Delphi [-]
procedure TfrmArticulos.RecuperaDatosBusq;
var
    sCateg, sUnis: String;

begin
    iClave := dmDatos.cdsArticulos.FieldByName('Clave').AsInteger;

    with dmDatos.qryConsulta do begin
        Close;
        SQL.Clear;
        SQL.Add('SELECT o.codigo, a.desc_corta, a.desc_larga, a.precio1,');
        SQL.Add('a.existencia, a.clave,a.minimo, a.maximo,');
        SQL.Add('a.categoria,a.unidades, a.fecha_cap,');
        SQL.Add('a.estatus,a.fotosart, c.nombre AS categorias,');
        SQL.Add('d.nombre AS unidades FROM articulos a ');
        SQL.Add('LEFT JOIN codigos o ON a.clave = o.articulo AND o.tipo = ''P''');
        SQL.Add('LEFT JOIN categorias c ON a.categoria = c.clave ');
        SQL.Add('LEFT JOIN unidades d ON a.unidades = d.clave ');
        SQL.Add('WHERE a.clave = ' + IntToStr(iClave));
        Open;
        if(not Eof) then begin
            pgeGeneral.ActivePage := tabDatos;
            txtCodigo.Text := Trim(FieldByName('codigo').AsString);
            txtDescripCorta.Text := Trim(FieldByName('desc_corta').AsString);
            txtDescripLarga.Text := Trim(FieldByName('desc_larga').AsString);
            txtFechaCap.Text := FormatDateTime('dd/mm/yyyy',FieldByName('fecha_cap').AsDateTime);
            txtPrecio1.text  := FormatFloat('#,##0.00',FieldByName('precio1').AsFloat);
            txtExis.text := floattostr(FieldByName('existencia').AsFloat);
            txtMax.text := floattostr(FieldByName('maximo').AsFloat);
            txtmin.text := floattostr(FieldByName('minimo').AsFloat);

            if FieldByName('estatus').AsString ='A' then
                cmbEstatus.ItemIndex := 0
            else
                cmbEstatus.ItemIndex := 1;

            sUnis := BuscaNombre(FieldByName('unidades').AsInteger, 'unidades');
            sCateg := BuscaNombre(FieldByName('categoria').AsInteger, 'categorias');
            cmbUnidadTipo.ItemIndex := cmbUnidadTipo.Items.IndexOf(Trim(sUnis));
            cmbCategorias.ItemIndex := cmbCategorias.Items.IndexOf(Trim(sCateg));

            MaxMin;

        end;
    end;
end;

Código Delphi [-]
function TfrmArticulos.BuscaNombre(iValor:Integer; sTabla:string):String;
begin
     with dmDatos.qryModifica do begin
        Close;
        SQL.Clear;
        SQL.Add('SELECT nombre FROM ' + sTabla + ' WHERE clave = ' + IntToStr(iValor));
        Open;
        Result := FieldByName('nombre').AsString;
        Close;
     end;
end;

con esto recuperaba los edits y combobox..
ahora con el filtrado se recupera todos los edits normal pero los combobox no se muestra lo recuperado solo salen limpios.. como para seleccionar y elegir de nuevo.. aunque claro las posiciones estan guardadas solo que no se muestran..
si le quito el filtrado si se muestran normal
Responder Con Cita