unit uVisorProblemasOptSimDis;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ComCtrls, ExtCtrls, urosx, uDataSetGenerico;

type

  { TformVisorProblemasOptSimDis }

  TformVisorProblemasOptSimDis = class(TForm)
    eFechaIni: TEdit;
    eTTrancurrido: TEdit;
    eTRestante: TEdit;
    eNResolvedores: TEdit;
    eMaxResolvedores: TEdit;
    eFechaAct: TEdit;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label2: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    ProgressBar1: TProgressBar;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    nidProblema: string;
    procedure verAvance;
  end;

var
  formVisorProblemasOptSimDis: TformVisorProblemasOptSimDis;

implementation

{$R *.lfm}

{ TformVisorProblemasOptSimDis }

procedure TformVisorProblemasOptSimDis.Timer1Timer(Sender: TObject);
begin
  verAvance;
end;


procedure TformVisorProblemasOptSimDis.verAvance;
var
  ds: TResultadoQuery;
  r: TDataRecord;
begin

 ds:= TResultadoQuery.CreateQuery('SELECT dt_creacion, dt_actualizacion, avance, nSecsToEnd, maxWks FROM clt_problemas WHERE nid = '+nidProblema );
 if ds = nil then
   raise Exception.Create( urosx.ultimoError );

 r:= ds.first;
 eFechaIni.Text := r.GetByNameAsString('dt_creacion');
 eFechaAct.Text := r.GetByNameAsString('dt_actualizacion');
 eTRestante.Text := r.GetByNameAsString('nSecsToEnd');
 eMaxResolvedores.Text := r.GetByNameAsString('maxWks');

 ProgressBar1.Position := round(r.GetByNameAsFloat('avance')*1000);


end;

end.

