Procedure

TfrmODMedNVA.CheckDecimal

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public

Owner

TfrmODMedNVA

Declaration

procedure CheckDecimal(var AStr: string);

Called-By Hierarchy


                TfrmODMedNVA.CheckDecimal
             TfrmODMedNVA.OutpatientSig┘ 
           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.OutpatientSig function OutpatientSig: string; -


Source

2031  procedure TfrmODMedNVA.CheckDecimal(var AStr: string);
2032  var
2033    Number: double;
2034    DUName,TabletNum,tempStr: string;
2035    ToWord: string;
2036    ie,code: integer;
2037  begin
2038    ToWord := '';
2039    tempStr := AStr;
2040    TabletNum := Piece(AStr,' ',1);
2041    if CharAt(TabletNum,1)='.' then
2042    begin
2043      if CharAt(TabletNum,2) in ['0','1','2','3','4','5','6','7','8','9'] then
2044      begin
2045        TabletNum := '0' + TabletNum;
2046        AStr := '0' + AStr;
2047      end;
2048    end;
2049    DUName := Piece(AStr,' ',2);
2050    if Pos('TABLET',upperCase(DUName))= 0 then
2051      Exit;
2052    if (Length(TabletNum)>0) and (Length(DUName)>0) then
2053    begin
2054      if CharAt(TabletNum,1) <> '0' then
2055      begin
2056        Val(TabletNum, ie, code);
2057        if ie = 0 then begin end;
2058        if code <> 0 then
2059          Exit;
2060      end;
2061      try
2062        begin
2063          Number := StrToFloat(TabletNum);
2064          if Number = 0.5 then
2065            ToWord := 'ONE-HALF';
2066          if ( Number >= 0.333 ) and  ( Number <= 0.334 ) then
2067            ToWord := 'ONE-THIRD';
2068          if Number = 0.25 then
2069            ToWord := 'ONE-FOURTH';
2070          if ( Number >= 0.66 ) and ( Number <= 0.67 ) then
2071            ToWord := 'TWO-THIRDS';
2072          if Number = 0.75 then
2073            ToWord := 'THREE-FOURTHS';
2074          if Number = 1 then
2075            ToWord := 'ONE';
2076          if Number = 2 then
2077            ToWord := 'TWO';
2078          if Number = 3 then
2079            ToWord := 'THREE';
2080          if Number = 4 then
2081            ToWord := 'FOUR';
2082          if Number = 5 then
2083            ToWord := 'FIVE';
2084          if Number = 6 then
2085            ToWord := 'SIX';
2086          if (Length(ToWord) > 0) then
2087             AStr :=  ToWord + ' ' + DUName;
2088        end
2089      except
2090        on EConvertError do AStr := tempStr;
2091      end;
2092    end;
2093  end;