Ver Mensaje Individual
  #3  
Antiguo 04-10-2012
edgar_prospero edgar_prospero is offline
Miembro
NULL
 
Registrado: mar 2012
Posts: 202
Reputación: 13
edgar_prospero Va por buen camino
gracias por la respuesta pero sigue marcandome el erro acontinuackion agrego mi codigo a ver si ayuda un poco mas :

Código Delphi [-]
procedure TForm4.codigoKeyPress(Sender: TObject; var Key: Char);
var Total: double;
begin

 if Key = #13 then
  begin


       if codigo.Text='' then
    Messagebox(Handle,PChar('el campo no puedo estar en blanco'),PChar('Atencion!!!'),Mb_ok);

  end
else begin



    query2.Close;
    query2.SQL.Text := 'select * from productos where codigo=:codigo';
    query2.Params[0].Value := codigo.Text;

    query2.Open;


    descripcion.Text := query2.FieldByName('descripcion').asString;
    precio.Text := query2.FieldByName('precio').asString;
   //existencia.Text := query2.FieldByName('existencia').asString;

    form4.clientdataset1.Append;

  form4.clientdataset1['codigo'] := codigo.Text;
  form4.clientdataset1['descripcion'] := descripcion.Text;
  form4.clientdataset1['precio'] := precio.Text;
  form4.clientdataset1['cantidad'] := cantidad.Text;
  form4.clientdataset1['folio'] := folio.Text;
  form4.clientdataset1['fecha'] := fecha.Date;
  form4.clientdataset1['subtotal'] :=  floatToStr( StrTofloat(cantidad.Text) * StrTofloat(precio.Text) );

        form4.clientdataset1.Post;


  query2.Close;
     query2.SQL.Text:='SELECT folio FROM venta ORDER BY folio ASC LIMIT 1';
     query2.Open;
    folio.text := floatToStr( StrTofloat(folio.Text) + StrTofloat(numero.Text)) ;


          ClientDataSet1.First;
   while not ClientDataSet1.eof do begin
      total := total + clientdataset1.FieldByName('subtotal').AsFloat;

      ClientDataSet1.Next;

   end;

      total2.Caption := FormatFloat('###0.00', total);


    begin
      if Key = #13 then
      begin
        Key := #0;
        Perform(WM_NEXTDLGCTL, 0, 0);
        codigo.SetFocus;

      end

    end;

end;

end;
__________________
saludos!!!
Responder Con Cita