Procedure

SaveDrug

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Scope

Local

Local subprogram to

FindCommonDrug

Declaration

procedure SaveDrug(const ADrug: string; UnitsPerDose: Extended);

Called-By Hierarchy


                                 SaveDrug
            TfrmODMedNVA.FindCommonDrug┘ 
           TfrmODMedNVA.ControlChange┘   
           TfrmODMedNVA.SetupDialog┤     
              TfrmODMedNVA.Validate┤     
        TfrmODMedNVA.btnSelectClick┤     
        TfrmODMedNVA.UMDelayClick┘ │     
         TfrmODMedNVA.tabDoseChange┤     
        TfrmODMedNVA.cboRouteChange┤     
      TfrmODMedNVA.SetOnMedSelect┘ │     
       TfrmODMedNVA.SetupDialog┤   │     
 TfrmODMedNVA.btnSelectClick...┤   │     
  TfrmODMedNVA.CheckFormAltDose┘   │     
  TfrmODMedNVA.cboDosageClick┘     │     
 TfrmODMedNVA.cboDosageExit┘       │     
  TfrmODMedNVA.timCheckChangesTimer┤     
       TfrmODMedNVA.UpdateRelated┘ │     
       TfrmODMedNVA.SetupDialog┤   │     
 TfrmODMedNVA.btnSelectClick...┤   │     
 TfrmODMedNVA.cboDosageClick...┤   │     
   TfrmODMedNVA.cboDosageChange┤   │     
  TfrmODMedNVA.cboScheduleClick┤   │     
 TfrmODMedNVA.cboScheduleChange┤   │     
      TfrmODMedNVA.grdDosesExit┘   │     
           TfrmODMedNVA.chkPRNClick┤     
TfrmODMedNVA.lbStatementsClickCheck┘     

Called-By

Name Declaration Comments
TfrmODMedNVA.FindCommonDrug function FindCommonDrug(DoseList: TStringList): string; -


Source

1535  procedure SaveDrug(const ADrug: string; UnitsPerDose: Extended);
1536  var
1537    i, DrugIndex: Integer;
1538    CurUnits: Extended;
1539  begin
1540    DrugIndex := -1;
1541    for i := 0 to Pred(FoundDrugs.Count) do
1542      if AnsiSameText(Piece(FoundDrugs[i], U, 1), ADrug) then DrugIndex := i;
1543    if DrugIndex = -1 then FoundDrugs.Add(ADrug + U + FloatToStr(UnitsPerDose)) else
1544    begin
1545      CurUnits := StrToFloatDef(Piece(FoundDrugs[DrugIndex], U, 2), 0);
1546      if UnitsPerDose > CurUnits
1547        then FoundDrugs[DrugIndex] := ADrug + U + FloatToStr(UnitsPerDose);
1548    end;
1549  end;