Function

TfrmODMedNVA.ConstructedDoseFields

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Visibility

Private

Owner

TfrmODMedNVA

Declaration

function ConstructedDoseFields(const ADose: string; PrependName: Boolean = FALSE): string;

Called-By Hierarchy


     TfrmODMedNVA.ConstructedDoseFields
           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.ControlChange procedure ControlChange(Sender: TObject); -


Source

1477  function TfrmODMedNVA.ConstructedDoseFields(const ADose: string; PrependName: Boolean = FALSE): string;
1478  var
1479    i, DrugIndex: Integer;
1480    UnitsPerDose, Strength: Extended;
1481    Units, Noun, AName: string;
1482  begin
1483    DrugIndex := -1;
1484    for i := 0 to Pred(FAllDrugs.Count) do
1485      if AnsiSameText(Piece(FAllDrugs[i], U, 1), FDrugID) then
1486      begin
1487        DrugIndex := i;
1488        Break;
1489      end;
1490    Strength := StrToFloatDef(Piece(FAllDrugs[DrugIndex], U, 2), 0);
1491    Units    := Piece(FAllDrugs[DrugIndex], U, 3);
1492    AName    := Piece(FAllDrugs[DrugIndex], U, 4);
1493    if FAllDoses.Count > 0
1494      then Noun := Piece(Piece(FAllDoses[0], U, 3), '&', 4)
1495      else Noun := '';
1496    if Strength > 0
1497      then UnitsPerDose := ExtractFloat(ADose) / Strength
1498      else UnitsPerDose := 0;
1499    if (UnitsPerDose > 1) and (Noun <> '') and (CharAt(Noun, Length(Noun)) <> 'S')
1500      then Noun := Noun + 'S';
1501    Result := FloatToStr(ExtractFloat(ADose)) + '&' + Units + '&' + FloatToStr(UnitsPerDose)
1502              + '&' + Noun + '&' + ADose + '&' + FDrugID + '&' + FloatToStr(Strength) + '&'
1503              + Units;
1504    if PrependName then Result := AName + U + FloatToStr(Strength) + Units + U + U +
1505                                  Result + U + ADose;
1506    Result := UpperCase(Result);
1507  end;