Function

TfrmODMedNVA.ValueOf

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Comments

Contents of cboDosage
    DrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Drug^DoseText^CostText^MaxRefills
  Contents of grid cells  (Only the first tab piece for each cell is drawn)
    Dosage    <TAB> DosageFields
    RouteText <TAB> IEN^RouteName^Abbreviation
    Schedule  <TAB> (nothing)
    Duration  <TAB> Duration^Units 






 the following functions were created to get rid of a compile warning saying the
 return value may be undefined - too much branching logic in the case statements
 for the compiler to handle

Visibility

Private

Owner

TfrmODMedNVA

Declaration

function ValueOf(FieldID: Integer; ARow: Integer = -1): string;

Calls Hierarchy


TfrmODMedNVA.ValueOf
 ├GetSchedule
 └GetScheduleEX

Called-By Hierarchy


                     TfrmODMedNVA.ValueOf
                TfrmODMedNVA.InitDialog┤ 
              TfrmODMedNVA.FormCreate┘ │ 
            TfrmODMedNVA.SetOnMedSelect┤ 
             TfrmODMedNVA.SetupDialog┤ │ 
          TfrmODMedNVA.btnSelectClick┤ │ 
          TfrmODMedNVA.UMDelayClick┘ │ │ 
        TfrmODMedNVA.CheckFormAltDose┘ │ 
        TfrmODMedNVA.cboDosageClick┘   │ 
       TfrmODMedNVA.cboDosageExit┘     │ 
           TfrmODMedNVA.SetOnQuickOrder┤ 
             TfrmODMedNVA.SetupDialog┤ │ 
       TfrmODMedNVA.btnSelectClick...┘ │ 
         TfrmODMedNVA.cboDosageClick...┤ 
             TfrmODMedNVA.OutpatientSig┤ 
           TfrmODMedNVA.ControlChange┘ │ 
           TfrmODMedNVA.SetupDialog┤   │ 
              TfrmODMedNVA.Validate┤   │ 
     TfrmODMedNVA.btnSelectClick...┤   │ 
         TfrmODMedNVA.tabDoseChange┤   │ 
        TfrmODMedNVA.cboRouteChange┤   │ 
   TfrmODMedNVA.SetOnMedSelect...┘ │   │ 
  TfrmODMedNVA.timCheckChangesTimer┤   │ 
       TfrmODMedNVA.UpdateRelated┘ │   │ 
       TfrmODMedNVA.SetupDialog┤   │   │ 
 TfrmODMedNVA.btnSelectClick...┤   │   │ 
 TfrmODMedNVA.cboDosageClick...┤   │   │ 
   TfrmODMedNVA.cboDosageChange┤   │   │ 
  TfrmODMedNVA.cboScheduleClick┤   │   │ 
 TfrmODMedNVA.cboScheduleChange┤   │   │ 
      TfrmODMedNVA.grdDosesExit┘   │   │ 
           TfrmODMedNVA.chkPRNClick┤   │ 
TfrmODMedNVA.lbStatementsClickCheck┘   │ 
          TfrmODMedNVA.ControlChange...┤ 
   TfrmODMedNVA.timCheckChangesTimer...┘ 

Calls

Name Declaration Comments
GetSchedule function GetSchedule: string; -
GetScheduleEX function GetScheduleEX: string; -

Called-By

Name Declaration Comments
TfrmODMedNVA.cboDosageClick procedure cboDosageClick(Sender: TObject); -
TfrmODMedNVA.ControlChange procedure ControlChange(Sender: TObject); -
TfrmODMedNVA.InitDialog procedure InitDialog; override; -
TfrmODMedNVA.OutpatientSig function OutpatientSig: string; -
TfrmODMedNVA.SetOnMedSelect procedure SetOnMedSelect; -
TfrmODMedNVA.SetOnQuickOrder procedure SetOnQuickOrder; -
TfrmODMedNVA.timCheckChangesTimer procedure timCheckChangesTimer(Sender: TObject); -


Source

1764  function TfrmODMedNVA.ValueOf(FieldID: Integer; ARow: Integer = -1): string;
1765  var
1766    y: string;
1767    stmt: Integer;
1768  { Contents of cboDosage
1769      DrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Drug^DoseText^CostText^MaxRefills
1770    Contents of grid cells  (Only the first tab piece for each cell is drawn)
1771      Dosage    <TAB> DosageFields
1772      RouteText <TAB> IEN^RouteName^Abbreviation
1773      Schedule  <TAB> (nothing)
1774      Duration  <TAB> Duration^Units }
1775  
1776    // the following functions were created to get rid of a compile warning saying the
1777    // return value may be undefined - too much branching logic in the case statements
1778    // for the compiler to handle
1779  
1780    function GetSchedule: string;
1781    begin
1782      Result := UpperCase(cboSchedule.Text);
1783      if chkPRN.Checked then Result := Result + ' PRN';
1784      if UpperCase(Copy(Result, Length(Result) - 6, Length(Result))) = 'PRN PRN'
1785        then Result := Copy(Result, 1, Length(Result) - 4);
1786    end;
1787  
1788    function GetScheduleEX: string;
1789    begin
1790      Result := '';
1791      with cboSchedule do
1792        if ItemIndex > -1 then Result := Piece(Items[ItemIndex], U, 2);
1793      if (Length(Result) > 0) and chkPRN.Checked then Result := Result + ' AS NEEDED';
1794      if UpperCase(Copy(Result, Length(Result) - 18, Length(Result))) = 'AS NEEDED AS NEEDED'
1795        then Result := Copy(Result, 1, Length(Result) - 10);
1796    end;
1797  
1798  begin
1799    Result := '';
1800    if ARow < 0 then                                // use single dose controls
1801    begin
1802      case FieldID of
1803      FLD_DOSETEXT  : with cboDosage do
1804                        if ItemIndex > -1 then Result := Uppercase(Piece(Items[ItemIndex], U, 5))
1805                                          else Result := Uppercase(Text);
1806      FLD_LOCALDOSE : with cboDosage do
1807                        if ItemIndex > -1 then Result := Piece(Piece(Items[ItemIndex], U, 4), '&', 5)
1808                                          else Result := Uppercase(Text);
1809      FLD_STRENGTH  : with cboDosage do
1810                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 2);
1811      FLD_DRUG_ID   : with cboDosage do
1812                       if ItemIndex > -1  then Result := Piece(Piece(Items[ItemIndex], U, 4), '&', 6);
1813      FLD_DRUG_NM   : with cboDosage do
1814                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 1);
1815      FLD_DOSEFLDS  : with cboDosage do
1816                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 4);
1817      FLD_TOTALDOSE : with cboDosage do
1818                        if ItemIndex > -1 then Result := Piece(Piece(Items[ItemIndex], U, 4), '&', 1);
1819      FLD_UNITNOUN  : with cboDosage do
1820                        if ItemIndex > -1 then Result := Piece(Piece(Items[ItemIndex], U, 4), '&', 3) + ' '
1821                                                       + Piece(Piece(Items[ItemIndex], U, 4), '&', 4);
1822      FLD_ROUTE_ID  : with cboRoute do
1823                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 1);
1824      FLD_ROUTE_NM  : with cboRoute do
1825                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 2)
1826                                          else Result := Text;
1827      FLD_ROUTE_AB  : with cboRoute do
1828                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 3);
1829      FLD_ROUTE_EX  : with cboRoute do
1830                       if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 4);
1831      FLD_SCHEDULE  : begin
1832                        Result := GetSchedule;
1833                      end;
1834      FLD_SCHED_EX  : begin
1835                        Result := GetScheduleEX;
1836                      end;
1837      FLD_SCHED_TYP : with cboSchedule do
1838                        if ItemIndex > -1 then Result := Piece(Items[ItemIndex], U, 3);
1839      FLD_QTYDISP   : with cboDosage do
1840                        begin
1841                          if ItemIndex > -1 then Result := Piece(Items[ItemIndex], U, 8);
1842                          if (Result = '') and (Items.Count > 0) then Result := Piece(Items[0], U, 8);
1843                          if Result <> ''
1844                            then Result := 'Qty (' + Result + ')'
1845                            else Result := 'Quantity';
1846                        end;
1847  
1848      FLD_COMMENT   : Result := memComment.Text;
1849  
1850      FLD_START     : Result := FormatFMDateTime('mmm dd,yy',calStart.FMDateTime);
1851  
1852      FLD_STATEMENTS : with lbStatements do
1853                       for stmt := 0 to lbStatements.Items.Count-1 do
1854                       if(lbStatements.Checked[stmt]) then
1855                       begin
1856                          y := #13#10 + lbStatements.Items.Strings[stmt] + '  ';
1857                            Result := Result + y;
1858                       end;
1859  
1860      end; {case FieldID}
1861     end;                          // use complex dose controls
1862  end;