Procedure

TfrmODMedNVA.timCheckChangesTimer

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public/Published

Owner

TfrmODMedNVA

Declaration

procedure timCheckChangesTimer(Sender: TObject);

Calls Hierarchy


TfrmODMedNVA.timCheckChangesTimer
 ├TfrmODMedNVA.ControlChange
 │ ├TResponses.Clear
 │ ├TResponses.Update
 │ │ ├TResponses.FindResponseByName
 │ │ └TResponses.IENForPrompt
 │ ├TfrmODMedNVA.FindCommonDrug
 │ │ ├TfrmODMedNVA.FindDoseFields
 │ │ ├SaveDrug
 │ │ └KillDrug
 │ ├TfrmODMedNVA.ConstructedDoseFields
 │ ├TfrmODMedNVA.ValueOf
 │ │ ├GetSchedule
 │ │ └GetScheduleEX
 │ ├TfrmODMedNVA.OutpatientSig
 │ │ ├TfrmODMedNVA.ValueOf...
 │ │ └TfrmODMedNVA.CheckDecimal
 │ └TResponses.GetOrderText
 │   ├TResponses.NextInstance
 │   ├TResponses.FindResponseByName
 │   ├TResponses.FormatResponse
 │   │ └TResponses.FindResponseByIEN
 │   └TResponses.AppendChildren
 │     ├TResponses.FindPromptByIEN
 │     ├TResponses.FindResponseByIEN
 │     └TResponses.FormatResponse...
 ├TResponses.NextInstance
 ├TfrmODMedNVA.ValueOfResponse
 │ └TResponses.IValueFor
 ├TfrmODMedNVA.ValueOf...
 └TfrmODMedNVA.UpdateStartExpires
   ├LoadAdminInfo
   └FMToday
     └FMNow

Called-By Hierarchy


 TfrmODMedNVA.timCheckChangesTimer
      TfrmODMedNVA.UpdateRelated┘ 
      TfrmODMedNVA.SetupDialog┤   
   TfrmODMedNVA.btnSelectClick┤   
   TfrmODMedNVA.UMDelayClick┘ │   
   TfrmODMedNVA.cboDosageClick┤   
  TfrmODMedNVA.cboDosageExit┘ │   
  TfrmODMedNVA.cboDosageChange┤   
 TfrmODMedNVA.cboScheduleClick┤   
TfrmODMedNVA.cboScheduleChange┤   
     TfrmODMedNVA.grdDosesExit┘   

Calls

Name Declaration Comments
TfrmODMedNVA.ControlChange procedure ControlChange(Sender: TObject); -
TResponses.NextInstance function NextInstance(const APromptID: string; LastInstance: Integer): Integer; -
TfrmODMedNVA.UpdateStartExpires procedure UpdateStartExpires(const CurSchedule: string); -
TfrmODMedNVA.ValueOf function ValueOf(FieldID: Integer; ARow: Integer = -1): string; -
TfrmODMedNVA.ValueOfResponse function ValueOfResponse(FieldID: Integer; AnInstance: Integer = 1): string; -

Called-By

Name Declaration Comments
TfrmODMedNVA.UpdateRelated procedure UpdateRelated(DelayUpdate: Boolean = TRUE); -


Source

1935  procedure TfrmODMedNVA.timCheckChangesTimer(Sender: TObject);
1936  const
1937    UPD_NONE     = 0;
1938    UPD_QUANTITY = 1;
1939    UPD_SUPPLY   = 2;
1940  var
1941    CurUnits, CurSchedule, CurInstruct, CurDispDrug, CurDuration, TmpSchedule, x, x1: string;
1942    CurScheduleIN, CurScheduleOut: string;
1943    CurQuantity, CurSupply, i, pNum, j: Integer;
1944   { LackQtyInfo,} SaveChanging: Boolean;
1945  begin
1946    inherited;
1947    timCheckChanges.Enabled := False;
1948    ControlChange(Self);
1949    SaveChanging := Changing;
1950    Changing := TRUE;
1951    // don't allow Exit procedure so Changing gets reset appropriately
1952    CurUnits    := '';
1953    CurSchedule := '';
1954    CurDuration := '';
1955   // LackQtyInfo := False;
1956    i := Responses.NextInstance('DOSE', 0);
1957    while i > 0 do
1958    begin
1959      x := ValueOfResponse(FLD_DOSEUNIT,  i);
1960   //   if x = '' then LackQtyInfo := TRUE;  //StrToIntDef(x, 0) = 0
1961      CurUnits    := CurUnits   + x  + U;
1962      x := ValueOfResponse(FLD_SCHEDULE,  i);
1963   //   if Length(x) = 0         then LackQtyInfo := TRUE;
1964      CurScheduleOut := CurScheduleOut + x + U;
1965      x1 := ValueOf(FLD_SEQUENCE,i);
1966      if Length(x1)>0 then
1967      begin
1968        X1 := CharAt(X1,1);
1969        CurScheduleIn := CurScheduleIn + x1 + ';' + x + U;
1970      end
1971      else
1972        CurScheduleIn := CurScheduleIn + ';' + x + U;
1973      x := ValueOfResponse(FLD_EXPIRE,    i);
1974      CurDuration := CurDuration + x + '~';
1975      x := ValueOfResponse(FLD_ANDTHEN,   i);
1976      CurDuration := CurDuration + x + U;
1977      x := ValueOfResponse(FLD_DRUG_ID,   i);
1978      CurDispDrug := CurDispDrug + x + U;
1979      x := ValueOfResponse(FLD_INSTRUCT,  i);
1980      CurInstruct := CurInstruct + x + U;
1981      i := Responses.NextInstance('DOSE', i);
1982    end;
1983  
1984    pNum := 1;
1985    while Length( Piece(CurScheduleIn,U,pNum)) > 0 do
1986      pNum := pNum + 1;
1987    if Length(Piece(CurScheduleIn,U,pNum)) < 1 then
1988      for j := 1 to pNum - 1 do
1989      begin
1990        if j = pNum -1 then
1991          TmpSchedule := TmpSchedule + ';' + Piece(Piece(CurScheduleIn,U,j),';',2)
1992        else
1993          TmpSchedule := TmpSchedule + Piece(CurScheduleIn,U,j) + U
1994      end;
1995    CurScheduleIn := TmpSchedule;
1996    CurQuantity := StrToIntDef(ValueOfResponse(FLD_QUANTITY) ,0);
1997    CurSupply   := StrToIntDef(ValueOfResponse(FLD_SUPPLY)   ,0);
1998    if FInptDlg then
1999    begin
2000      CurSchedule := CurScheduleIn;
2001      if Pos('^',CurSchedule)>0 then
2002      begin
2003        if Pos('PRN',Piece(CurSchedule,'^',1))>0 then
2004          if lblAdminTime.Visible then
2005            lblAdminTime.Caption := '';
2006      end;
2007      if CurSchedule <> FLastSchedule then UpdateStartExpires(CurSchedule);
2008      if Responses.EventType in ['A','D','T','M','O'] then lblAdminTime.Visible := False;
2009    end;
2010    if not FInptDlg then
2011    begin
2012      CurSchedule := CurScheduleOut;
2013    end;
2014  
2015    FLastUnits    := CurUnits;
2016    FLastSchedule := CurSchedule;
2017    FLastDispDrug := CurDispDrug;
2018    FLastQuantity := CurQuantity;
2019    FLastSupply   := CurSupply;
2020    if (ActiveControl <> nil) and (ActiveControl.Parent <> cboDosage)
2021      then cboDosage.Text := Piece(cboDosage.Text, TAB, 1);
2022    Changing := SaveChanging;
2023    if FUpdated then ControlChange(Self);
2024  end;