Ver Mensaje Individual
  #7  
Antiguo 29-06-2014
maxi915 maxi915 is offline
Miembro
NULL
 
Registrado: jul 2011
Posts: 63
Reputación: 13
maxi915 Va por buen camino
bien, aca les dejo lo que intento hacer..

procedimiento cargar el turno, pero antes de cargar quiero obtener el ultimo turno cargado (siempre va a haber 1 como minimo) para luego insertar en otra tabla TurnoCliente, inserto el id_turno y id_cliente

Código Delphi [-]
procedure TFormTurnos.btnCargarTurnoClick(Sender: TObject);
var
  queryturnos:TADOQuery;
  queryProfesor:TADOQuery;
  queryTurnoCliente:TADOQuery;
  id_turno:Integer;
  hora:string;
begin
 queryturnos:=FormMenuPrincipal.queryTurnos;
 queryProfesor:=FormMenuPrincipal.queryprofesores;
 queryTurnoCliente:=FormMenuPrincipal.queryTurnocliente;
 //capturar_IdProfesor(queryProfesor,comboboxProfesores.Text,Id);

  If(edtTurnohorario.Text<>'')and(edtTurnoDisponibilidad.Text<>'')
  then
    begin
    Cargar_turno(QueryTurnos,edtTurnohorario.Text,StrToInt(edtTurnoDisponibilidad.Text),comboboxDia.Text  ,comboboxProfesores.text);
   //hasta aca funciona correctamente
    
    // aca necesito capturar el id_turno cargado para insertar en tabla clienteturno

    //capturar_idTurno(queryturnos,hora,id_turno);

 // luego inserto en la tabla TurnoCliente el id_turno (es el ultimo turno obtenido)

    Cargar_TurnoCliente(queryTurnoCliente,id_turno);

    MessageDlg('¡Se ha cargado con exito el nuevo turno!',mtConfirmation,[mbOK],0);
    end
  else
  begin
    MessageDlg('¡Hay campos incompletos!',mtConfirmation,[mbOK],0);
  end;
  edtTurnohorario.Clear;
  edtTurnoDisponibilidad.Clear;
  edtTurnohorario.SetFocus;
end;



procedimiento capturar id_UltimoTurno
Código Delphi [-]
Procedure capturar_IdTurno (Queryturnos:TADOQuery;hora:string; var id:integer);
begin
  with Queryturnos do
   begin
     SQL.Clear;
     SQL.Add('select max(idturno) from turnos);
     Open;
     id:=FieldByName('Id_turno').AsInteger;
   end;
end;


gracias!!!!
Responder Con Cita