Function

TfrmODMeds.TextDosage

Module

fODMeds

Last Modified

7/15/2014 3:26:42 PM

Visibility

Private

Owner

TfrmODMeds

Declaration

function TextDosage(ADosage: string): string;

Called-By Hierarchy


                       TfrmODMeds.TextDosage
                   TfrmODMeds.CheckDecimal┘ 
                TfrmODMeds.OutpatientSig┤   
              TfrmODMeds.ControlChange┘ │   
              TfrmODMeds.SetupDialog┤   │   
                 TfrmODMeds.Validate┤   │   
           TfrmODMeds.btnSelectClick┤   │   
           TfrmODMeds.UMDelayClick┘ │   │   
            TfrmODMeds.tabDoseChange┤   │   
            TfrmODMeds.FormKeyDown┘ │   │   
           TfrmODMeds.cboRouteChange┤   │   
         TfrmODMeds.SetOnMedSelect┘ │   │   
          TfrmODMeds.SetupDialog┤   │   │   
    TfrmODMeds.btnSelectClick...┤   │   │   
     TfrmODMeds.CheckFormAltDose┘   │   │   
     TfrmODMeds.cboDosageClick┘     │   │   
   TfrmODMeds.cboDosageKeyUp┘       │   │   
         TfrmODMeds.popDurationClick┤   │   
          TfrmODMeds.cboXRouteChange┤   │   
           TfrmODMeds.cboXRouteClick┤   │   
          TfrmODMeds.cboXRouteExit┘ │   │   
       TfrmODMeds.txtXDurationChange┤   │   
       TfrmODMeds.popDurationClick┘ │   │   
          TfrmODMeds.btnXRemoveClick┤   │   
        TfrmODMeds.grdDosesKeyDown┘ │   │   
     TfrmODMeds.timCheckChangesTimer┤   │   
          TfrmODMeds.UpdateRelated┘ │   │   
          TfrmODMeds.SetupDialog┤   │   │   
    TfrmODMeds.btnSelectClick...┤   │   │   
    TfrmODMeds.cboDosageClick...┤   │   │   
      TfrmODMeds.cboDosageChange┤   │   │   
        TfrmODMeds.cboDosageExit┤   │   │   
     TfrmODMeds.cboScheduleClick┤   │   │   
     TfrmODMeds.cmdAcceptClick┤ │   │   │   
        TfrmODMeds.chkPRNClick┤ │   │   │   
        TfrmODMeds.txtNSSClick┤ │   │   │   
   TfrmODMeds.cboScheduleEnter┤ │   │   │   
   TfrmODMeds.UMShowNSSBuilder┘ │   │   │   
    TfrmODMeds.cboScheduleChange┤   │   │   
      TfrmODMeds.txtSupplyChange┤   │   │   
    TfrmODMeds.txtQuantityChange┤   │   │   
         TfrmODMeds.grdDosesExit┤   │   │   
     TfrmODMeds.cboXDosageChange┤   │   │   
      TfrmODMeds.cboXDosageClick┤   │   │   
     TfrmODMeds.cboXDosageExit┤ │   │   │   
    TfrmODMeds.cboXDosageKeyUp┘ │   │   │   
       TfrmODMeds.cboXDosageExit┤   │   │   
   TfrmODMeds.cboXScheduleChange┤   │   │   
        TfrmODMeds.txtNSSClick┘ │   │   │   
    TfrmODMeds.cboXScheduleClick┤   │   │   
       TfrmODMeds.chkXPRNClick┤ │   │   │   
   TfrmODMeds.pnlXScheduleExit┘ │   │   │   
     TfrmODMeds.pnlXScheduleExit┤   │   │   
TfrmODMeds.txtXDurationChange...┤   │   │   
     TfrmODMeds.pnlXDurationExit┤   │   │   
          TfrmODMeds.chkPRNClick┤   │   │   
      TfrmODMeds.cboScheduleExit┤   │   │   
       TfrmODMeds.cboDosageKeyUp┤   │   │   
      TfrmODMeds.cboXDosageKeyUp┘   │   │   
       TfrmODMeds.chkPtInstructClick┤   │   
          TfrmODMeds.chkDoseNowClick┤   │   
        TfrmODMeds.SetOnQuickOrder┘ │   │   
          TfrmODMeds.SetupDialog┤   │   │   
    TfrmODMeds.btnSelectClick...┘   │   │   
              TfrmODMeds.chkPRNClick┤   │   
       TfrmODMeds.cboXSequenceChange┤   │   
         TfrmODMeds.txtRefillsChange┘   │   
                 TfrmODMeds.InpatientSig┘   
           TfrmODMeds.ControlChange...┘     

Called-By

Name Declaration Comments
TfrmODMeds.CheckDecimal procedure CheckDecimal(var AStr: string); -


Source

5257  function TfrmODMeds.TextDosage(ADosage: string): string;
5258  var
5259    intS, fltS: string;
5260    iNum: integer;
5261    fNum: double;
5262  begin
5263    intS := '';
5264    fltS := '';
5265    Result := intS + fltS;
5266      try
5267        begin
5268          iNum := StrToIntDef(Piece(ADosage,'.',1),0);
5269          fNum := StrToFloatDef('0.'+Piece(ADosage,'.',2),0);
5270          if fNum = 0.5 then
5271            fltS := 'ONE-HALF';
5272          if ( fNum >= 0.3 ) and ( fNum <= 0.4 ) then
5273            fltS := 'ONE-THIRD';
5274          if fNum = 0.25 then
5275            fltS := 'ONE-FOURTH';
5276          if ( fNum >= 0.6 ) and ( fNum <= 0.7 ) then
5277            fltS := 'TWO-THIRDS';
5278          if fNum = 0.75 then
5279            fltS := 'THREE-FOURTHS';
5280          if (fNum > 0) AND (Length(fltS)<1) then  //SMT Add a default for unaccounted values (Remedy HD396719)
5281            fltS := FloatToStr(fNum);
5282  
5283          Case iNum of
5284            0: intS := '';
5285  		      1: intS := 'ONE';
5286  		      2: intS := 'TWO';
5287  		      3: intS := 'THREE';
5288  		      4: intS := 'FOUR';
5289  		      5: intS := 'FIVE';
5290  		      6: intS := 'SIX';
5291  		      7: intS := 'SEVEN';
5292  		      8: intS := 'EIGHT';
5293  		      9: intS := 'NINE';
5294  		      10: intS := 'TEN';
5295          else intS := IntToStr(iNum);
5296          End;
5297  
5298          if Length(intS) > 0 then
5299          begin
5300            if Length(fltS)>1 then
5301              fltS :=' AND ' + fltS;
5302          end;
5303          Result := intS + fltS;
5304          if Result = '' then
5305            Result := ADosage;
5306        end
5307      except
5308        on EConvertError do Result := '';
5309      end;
5310  end;