Ver Mensaje Individual
  #44  
Antiguo 16-12-2008
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
1-A mi me muestra (Horarios/Personal) en esa celda, no se por que a ti no.
2-No me sigue dando el error.
3-Para que se actualice el stringgrid hay que actualizar la sentencia sql.
Es exacta a la que uso en el datetimepicker.
Para que la veas asi quedaria el evento Onshow del form Turnos:
Código Delphi [-]

procedure TTurnos.FormShow(Sender: TObject);
begin
with StringGrid1 do
begin
//Título de las Filas
Cells[0, 0] := 'Horario/Profesionales';
Cells[0, 1] := '09:00';
Cells[0, 2] := '09:30';
Cells[0, 3] := '10:00';
Cells[0, 4] := '10:30';
Cells[0, 5] := '11:00';
Cells[0, 6] := '11:30';
Cells[0, 7] := '12:00';
Cells[0, 8] := '12:30';
Cells[0, 9] := '13:00';
Cells[0, 10] := '13:30';
Cells[0, 11] := '14:00';
Cells[0, 12] := '14:30';
Cells[0, 13] := '15:00';
Cells[0, 14] := '15:30';
Cells[0, 15] := '16:00';
Cells[0, 16] := '16:30';
Cells[0, 17] := '17:00';
Cells[0, 18] := '17:30';
Cells[0, 19] := '18:00';
Cells[0, 20] := '18:30';
Cells[0, 21] := '19:00';
Cells[0, 22] := '19:30';


//Titulo de las Columnas
consulta:= 'Select [Apellido_emp], [Nombre_emp] from Personal';
adoquery1.Close;
adoquery1.SQL.Text := consulta;
adoquery1.Open;

i:= 2;
datasource1.DataSet.First;

while not datasource1.DataSet.Eof do
begin
stringgrid1.ColCount := i;
stringgrid1.Cells[(i - 1),0]:= datasource1.DataSet.FieldByName('Apellido_emp').AsString + ' '+ datasource1.DataSet.FieldByName('Nombre_emp').AsString;

inc(i);
datasource1.DataSet.Next;
end;


adoquery2.Close;
adoquery2.SQL.Text := 'Select Nombre, Legajo, Servicio, Pos_col, Pos_fila from Turnos Where Fecha_turno = :Fec';
adoquery2.Parameters[0].Value:= DateToStr(DateTimePicker1.Date);
adoquery2.Open;

while not datasource2.DataSet.Eof do
begin
a:= datasource2.DataSet.FieldByName('Pos_fila').AsInteger;
b:= datasource2.DataSet.FieldByName('Pos_col').AsInteger;
stringgrid1.Cells[(b),(a)]:= datasource2.DataSet.FieldByName('Nombre').AsString + '//'+ datasource2.DataSet.FieldByName('Servicio').AsString;

inc(a);
inc(b);
datasource2.DataSet.Next;

adoquery1.Close;
end;
end;
end;
Revisa el codigo y veras la diferencia.
Es bueno que te empapes del codigo.
Saludos
__________________
Siempre Novato
Responder Con Cita