AYUDA LLENADO DE GRILLA
Hola buenos dias me pueden ayudar,
Estoy haciendo una agenda de citas con un SortGrid
Tengo un error por que me muestra asi y deberia mostar
Donde el interval = intervalo del dia que en este caso son 45
Código:
procedure TF_ag.llena;
var
hora : TTime;
fila, interval, cam : Integer;
mensaje : String;
i, j, k, l: Integer;
begin
fila := 1;
interval := intervalo(MC1.Date);
if not(Pro.fieldValues['HORA_INICIAL'] = NULL) then
begin
hora := Pro.fieldValues['HORA_INICIAL'];
cam := Pro.fieldValues['CAMILLA'];
Spro.RowCount := 2;
if intervalo(MC1.Date) > 0 then
begin
ZQagenda.Close;
ZQagenda.SQL.Clear;
ZQagenda.SQL.Add('SELECT P.NOMBRE,. A* FROM PACIENTES P, AGENDA A WHERE P.CEDULA = A.CEDULA AND
A.COD_P ='+QuotedStr(Pro.fieldValues['COD_P']) AND A.FECHA = '+QuotedStr(DateToStr(MC1.Date)) ORDER BY A.HORA ASC');
ZQagenda.Open;
If not(Pro.fieldValues['HORA_INICIAL'] = Pro.fieldValues['HORA_FINAL']) then
begin
while (CompareTime(hora, Pro.fieldValues['HORA_INI']) >= 0) and
(CompareTime(hora, Pro.fieldValues['HORA_FIN']) < 0) do //
begin
if ZQagenda.RecordCount > 0 then
begin
ZQagenda.First;
with SGag do
begin
for j:= 0 to ZQagenda.RecordCount - 1 do
begin
if ((CompareTime(ZQagenda.FieldValues['HORA'],hora) < 0) and
(CompareTime(ZQagenda.FieldValues['HORA'],hora-(interval)) > 0)) or
(CompareTime(ZQagenda.FieldValues['HORA'],hora) = 0) then
begin
Cells[0, fila] := FormatDateTime('hh:nn am/pm',ZQagenda.FieldValues['HORA_INI']);
if not(ZQagenda.FieldValues['CEDULA']= NULL) then
begin
if not(ZQagenda.FieldValues['CEDULA'] = '0') then
Cells[2, fila] := ZQagenda.FieldValues['CEDULA']
else
Cells[2, fila] := '';
end;
if not(ZQagenda.FieldValues['NOMBRE'] = NULL) then
begin
if not(ZQagenda.FieldValues['CEDULA'] = '0') then
Cells[3, fila] := ZQagenda.FieldValues['NOMBRE']
else
Cells[3, fila] := '';
end;
SGag .RowCount := SGag .RowCount + 1;
fila := fila + 1;
end else
begin
for l := 1 to cam do
begin
SGag .Cells[0, fila] := FormatDateTime('hh:nn am/pm',hora);
SGag .Cells[1, fila] := IntToStr(l);
SGag .Cells[2, fila] := '';
SGag .Cells[3, fila] := '';
SGag .RowCount := SGag .RowCount + 1;
fila := fila + 1;
end;
end;
ZQagenda.Next;
end;
end else
begin
for i := 1 to cam
begin
SGag .Cells[0, fila] := FormatDateTime('hh:nn am/pm',hora);
SGag .Cells[1, fila] := IntToStr(i);
SGag .Cells[2, fila] := '';
SGag .Cells[3, fila] := '';
SGag .RowCount := SGag .RowCount + 1;
fila := fila + 1;
end;
end;
hora:= hora+(interval);
end;
end;
end;
end;
end;
Puede publicar nuevos temas en este foro No puede responder a temas en este foro No puede editar sus mensajes en este foro No puede borrar sus mensajes en este foro No puede votar en encuestas en este foro
Visita nuestro nuevo sitio web con programas y contenidos actualizados: Proyecto A