Procedure

TfrmODMeds.SetOnMedSelect

Module

fODMeds

Last Modified

7/15/2014 3:26:42 PM

Visibility

Private

Owner

TfrmODMeds

Declaration

procedure SetOnMedSelect;

Calls Hierarchy


TfrmODMeds.SetOnMedSelect
 ├GetPKISite
 ├TCtrlInits.LoadOrderItem
 │ ├TCtrlInits.ClearOI
 │ └TCtrlInits.ExtractInits
 │   └TCtrlInit.Create
 ├OIForMed
 ├TCtrlInits.SetControl
 │ ├ClearControl
 │ └TCtrlInits.FindInitByName
 ├TfrmODMeds.cboRouteChange
 │ └TfrmODMeds.ControlChange
 │   ├TResponses.Clear
 │   ├TResponses.Update
 │   │ ├TResponses.FindResponseByName
 │   │ └TResponses.IENForPrompt
 │   ├TfrmODMeds.FindCommonDrug
 │   │ ├TfrmODMeds.FindDoseFields
 │   │ ├SaveDrug
 │   │ └KillDrug
 │   ├TfrmODMeds.ConstructedDoseFields
 │   ├TfrmODMeds.ValueOf
 │   │ ├GetSingleDoseSchedule
 │   │ ├GetSingleDoseScheduleEX
 │   │ ├TfrmODMeds.FieldsForDose
 │   │ │ └TfrmODMeds.ConstructedDoseFields
 │   │ ├TfrmODMeds.FieldsForDrug
 │   │ ├GetComplexDoseSchedule
 │   │ │ └TfrmODMeds.ValFor
 │   │ └GetComplexDoseScheduleEX
 │   │   └TfrmODMeds.ValFor
 │   ├TfrmODMeds.lblAdminSchGetText
 │   ├TfrmODMeds.ValFor
 │   ├TfrmODMeds.InpatientSig
 │   │ ├TfrmODMeds.ValueOf...
 │   │ └TfrmODMeds.CheckDecimal
 │   │   └TfrmODMeds.TextDosage
 │   ├TfrmODMeds.OutpatientSig
 │   │ ├TfrmODMeds.ValueOf...
 │   │ └TfrmODMeds.CheckDecimal...
 │   └TResponses.GetOrderText
 │     ├TResponses.NextInstance
 │     ├TResponses.FindResponseByName
 │     ├TResponses.FormatResponse
 │     │ └TResponses.FindResponseByIEN
 │     └TResponses.AppendChildren
 │       ├TResponses.FindPromptByIEN
 │       ├TResponses.FindResponseByIEN
 │       └TResponses.FormatResponse...
 ├TCtrlInits.DefaultText
 │ └TCtrlInits.FindInitByName
 ├TResponses.FindResponseByName
 ├TfrmODMeds.SetSchedule
 ├TfrmODMeds.ValueOf...
 ├TCtrlInits.TextOf
 │ └TCtrlInits.FindInitByName
 ├TfrmODMeds.lblAdminSchSetText
 ├TfrmODMeds.SetPickup
 └TfrmODMeds.DispOrderMessage

Called-By Hierarchy


      TfrmODMeds.SetOnMedSelect
       TfrmODMeds.SetupDialog┤ 
    TfrmODMeds.btnSelectClick┤ 
    TfrmODMeds.UMDelayClick┘ │ 
  TfrmODMeds.CheckFormAltDose┘ 
  TfrmODMeds.cboDosageClick┘   
TfrmODMeds.cboDosageKeyUp┘     

Calls

Name Declaration Comments
TfrmODMeds.cboRouteChange procedure cboRouteChange(Sender: TObject); -
TCtrlInits.DefaultText function DefaultText(const ASection: string): string; -
TfrmODMeds.DispOrderMessage procedure DispOrderMessage(const AMessage: string); -
TResponses.FindResponseByName function FindResponseByName(const APromptID: string; AnInstance: Integer): TResponse; -
GetPKISite function GetPKISite: Boolean; -
TfrmODMeds.lblAdminSchSetText procedure lblAdminSchSetText(str: string); -
TCtrlInits.LoadOrderItem procedure LoadOrderItem(Src: TStrings); -
OIForMed function OIForMed(AnIEN: Integer; ForInpatient: Boolean; HavePI: boolean = True; PKIActive: Boolean = False): TStrings; -
TCtrlInits.SetControl procedure SetControl(AControl: TControl; const ASection: string); -
TfrmODMeds.SetPickup procedure SetPickup(const x: string); -
TfrmODMeds.SetSchedule procedure SetSchedule(const x: string); -
TCtrlInits.TextOf function TextOf(const ASection: string): string; -
TfrmODMeds.ValueOf function ValueOf(FieldID: Integer; ARow: Integer = -1): string; -

Called-By

Name Declaration Comments
TfrmODMeds.btnSelectClick procedure btnSelectClick(Sender: TObject); -
TfrmODMeds.CheckFormAltDose procedure CheckFormAltDose(DispDrug: Integer); -
TfrmODMeds.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -


Source

1701  procedure TfrmODMeds.SetOnMedSelect;
1702  var
1703    i,j: Integer;
1704    temp,x: string;
1705    QOPiUnChk: boolean;
1706    PKIEnviron: boolean;
1707    AResponse: TResponse;
1708  begin
1709    // clear controls?
1710    cboDosage.Tag := -1;
1711    txtSupply.Tag := 0;
1712    txtQuantity.Tag := 0;
1713    spnQuantity.Tag := 0;
1714     QOPiUnChk := False;
1715    PKIEnviron := False;
1716    if GetPKISite then PKIEnviron := True;
1717    with CtrlInits do
1718    begin
1719      // set up CtrlInits for orderable item
1720      LoadOrderItem(OIForMed(txtMed.Tag, FInptDlg, IncludeOIPI, PKIEnviron));
1721      // set up lists & initial values based on orderable item
1722      SetControl(txtMed,       'Medication');
1723          if (self.MedName <> '') then
1724         begin
1725           if (txtMed.Text <> self.MedName) then
1726             begin
1727               temp := self.MedName;
1728               self.MedName := txtMed.Text;
1729               txtMed.Text := temp;
1730             end
1731           else MedName := '';
1732         end;
1733      SetControl(cboDosage,    'Dosage');
1734      SetControl(cboRoute,     'Route');
1735      if cboRoute.Items.Count = 1 then cboRoute.ItemIndex := 0;
1736      cboRouteChange(Self);
1737      x := DefaultText('Schedule');
1738      //AGP Change 27.72 trying to centralized the schedule setting code
1739      AResponse := Responses.FindResponseByName('SCHEDULE',1);
1740      if (AResponse <> nil) and (AResponse.EValue <> '') then  x := AResponse.EValue;
1741      SetSchedule(UpperCase(x));
1742     (* if x <> '' then
1743      begin
1744        cboSchedule.SelectByID(x);
1745        if cboSchedule.ItemIndex > -1 then
1746          AdminTime := Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,4);
1747        if (cboSchedule.ItemIndex < 0) and (RightStr(x,3) = 'PRN')  then
1748          begin
1749            self.chkPRN.Checked := true;
1750            x := Copy(x,1,(Length(x)-3));
1751            if RightStr(X,1) = ' ' then x := Copy(x,1,(Length(x)-1))
1752          end;
1753        cboSchedule.Text := x;
1754      end; *)
1755      if Length(ValueOf(FLD_QTYDISP))>10 then
1756      begin
1757        lblQuantity.Caption := Copy(ValueOf(FLD_QTYDISP),0,7) + '...';
1758        lblQuantity.Hint := ValueOf(FLD_QTYDISP);
1759      end;
1760      FAllDoses.Text := TextOf('AllDoses');
1761      FAllDrugs.Text := TextOf('Dispense');
1762      FGuideline.Text := TextOf('Guideline');
1763      case FGuideline.Count of
1764      0: lblGuideline.Visible := False;
1765      1:   begin
1766             lblGuideline.Caption := FGuideline[0];
1767             lblGuideline.Visible := TRUE;
1768           end;
1769      else begin
1770             lblGuideline.Caption := 'Display Restrictions/Guidelines';
1771             lblGuideline.Visible := TRUE;
1772           end;
1773      end;
1774      if FInptDlg then
1775      begin
1776        if not FResizedAlready then
1777        begin
1778          pnlBottom.Height := pnlBottom.Height - lblDays.Height -  txtSupply.Height
1779            - stcPi.Height - memPi.Height + 6;
1780          FResizedAlready := True;
1781        end;
1782        pnlTop.Height := pnlFields.Height - pnlBottom.Height;
1783        chkDoseNow.Top := memComment.Top + memComment.Height + 1;
1784        lblPriority.Top := memcomment.Top + memComment.Height + 1;
1785        cboPriority.Top := lblPriority.Top + lblPriority.Height;
1786        lblAdminSch.Left := chkDoseNow.Left;
1787        lblAdminSch.Top := chkDoseNow.Top + chkDoseNow.Height - 1;
1788        lblAdminSch.Height := (MainFontHeight * 3) + 3;
1789        lblAdminSch.Width := cboPriority.Left - lblAdminSch.Left - 5;
1790        lblAdminTime.Left := lblAdminSch.Left;
1791        lblAdminTime.top := lblAdminSch.Top + lblAdminSch.Height -1;
1792        if self.tabDose.TabIndex = TI_Dose then lblAdminSchSetText('')
1793        else
1794          begin
1795            if FAdminTimeText = 'Not defined for Clinic Locations' then lblAdminSchSetText('Admin. Time: ' + FAdminTimeText)
1796            else self.lblAdminSch.Visible := False;
1797          end;
1798      end else
1799      begin
1800        DEASig := '';
1801        if GetPKISite then DEASig := DefaultText('DEASchedule');
1802        FSIGVerb := DefaultText('Verb');
1803        if Length(FSIGVerb) = 0 then FSIGVerb := TX_TAKE;
1804        FSIGPrep := DefaultText('Preposition');
1805        if FLastPickup <> '' then SetPickup(FLastPickup) else SetPickup(DefaultText('Pickup'));
1806        SetControl(txtRefills, 'Refills');
1807        for j := 0 to Responses.TheList.Count - 1 do
1808        begin
1809          if (TResponse(Responses.theList[j]).PromptID = 'PI') and (TResponse(Responses.theList[j]).EValue = ' ') then
1810            QOPiUnChk := True;
1811        end;
1812        //if Length(FPtInstruct) = 0 then
1813        if FPtInstruct = '' then FPtInstruct := TextOf('PtInstr');
1814        for i := 1 to Length(FPtInstruct) do if Ord(FPtInstruct[i]) < 32 then FPtInstruct[i] := ' ';
1815        FPtInstruct := TrimRight(FPtInstruct);
1816        if Length(FPtInstruct) > 0 then
1817        begin
1818          //chkPtInstruct.Caption := FPtInstruct;
1819          if memPI.Lines.Count > 0 then
1820            memPI.Lines.Clear;
1821          memPI.Lines.Add(FPtInstruct);
1822          chkPtInstruct.Visible := True;
1823          chkPtInstruct.Checked := True;
1824          stcPI.Visible := True;
1825          memPI.Visible := True;
1826          if FShrinked then
1827          begin
1828            pnlBottom.Height := pnlBottom.Height + memPi.Height + stcPI.Height + 2;
1829            FShrinked := False;
1830          end;
1831          if QOPiUnChk then
1832            chkPtInstruct.Checked := False;
1833        end else
1834        begin
1835          chkPtInstruct.Visible := False;
1836          chkPtInstruct.Checked := False;
1837          stcPI.Visible := False;
1838          memPI.Visible := False;
1839          if not FShrinked then
1840          begin
1841            pnlBottom.Height := pnlBottom.Height - stcPI.Height - memPI.Height - 2;
1842            FShrinked := True;
1843          end;
1844        end;
1845      end;
1846      pnlMessage.TabOrder := cboDosage.TabOrder + 1;
1847      DispOrderMessage(TextOf('Message'));
1848    end;
1849  end;