Procedure

TfrmODMedNVA.ControlChange

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public/Published

Owner

TfrmODMedNVA

Declaration

procedure ControlChange(Sender: TObject);

Calls Hierarchy


TfrmODMedNVA.ControlChange
 ├TResponses.Clear
 ├TResponses.Update
 │ ├TResponses.FindResponseByName
 │ └TResponses.IENForPrompt
 ├TfrmODMedNVA.FindCommonDrug
 │ ├TfrmODMedNVA.FindDoseFields
 │ ├SaveDrug
 │ └KillDrug
 ├TfrmODMedNVA.ConstructedDoseFields
 ├TfrmODMedNVA.ValueOf
 │ ├GetSchedule
 │ └GetScheduleEX
 ├TfrmODMedNVA.OutpatientSig
 │ ├TfrmODMedNVA.ValueOf...
 │ └TfrmODMedNVA.CheckDecimal
 └TResponses.GetOrderText
   ├TResponses.NextInstance
   ├TResponses.FindResponseByName
   ├TResponses.FormatResponse
   │ └TResponses.FindResponseByIEN
   └TResponses.AppendChildren
     ├TResponses.FindPromptByIEN
     ├TResponses.FindResponseByIEN
     └TResponses.FormatResponse...

Called-By Hierarchy


           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┘ 

Calls

Name Declaration Comments
TResponses.Clear procedure Clear; overload; -
TfrmODMedNVA.ConstructedDoseFields function ConstructedDoseFields(const ADose: string; PrependName: Boolean = FALSE): string; -
TfrmODMedNVA.FindCommonDrug function FindCommonDrug(DoseList: TStringList): string; -
TResponses.GetOrderText function GetOrderText: string; -
TfrmODMedNVA.OutpatientSig function OutpatientSig: string; -
TResponses.Update procedure Update(const APromptID: string; AnInstance: Integer; const AnIValue, AnEValue: string); -
TfrmODMedNVA.ValueOf function ValueOf(FieldID: Integer; ARow: Integer = -1): string; -

Called-By

Name Declaration Comments
TfrmODMedNVA.btnSelectClick procedure btnSelectClick(Sender: TObject); -
TfrmODMedNVA.cboRouteChange procedure cboRouteChange(Sender: TObject); -
TfrmODMedNVA.chkPRNClick procedure chkPRNClick(Sender: TObject); -
TfrmODMedNVA.lbStatementsClickCheck procedure lbStatementsClickCheck(Sender: TObject; Index: Integer); -
TfrmODMedNVA.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODMedNVA.tabDoseChange procedure tabDoseChange(Sender: TObject); -
TfrmODMedNVA.timCheckChangesTimer procedure timCheckChangesTimer(Sender: TObject); -
TfrmODMedNVA.Validate procedure Validate(var AnErrMsg: string); override; -


Source

1644  procedure TfrmODMedNVA.ControlChange(Sender: TObject);
1645  var
1646    x,ADose,AUnit,ADosageText: string;
1647    DoseList: TStringList;
1648  begin
1649    inherited;
1650    if csLoading in ComponentState then Exit;       // to prevent error caused by txtRefills
1651    if Changing then Exit;
1652    if txtMed.Tag = 0 then Exit;
1653    ADose := '';
1654    AUnit := '';
1655    ADosageText := '';
1656    FUpdated := FALSE;
1657    Responses.Clear;
1658    if self.MedName = '' then Responses.Update('ORDERABLE',  1, IntToStr(txtMed.Tag), txtMed.Text)
1659    else Responses.Update('ORDERABLE',  1, IntToStr(txtMed.Tag), self.MedName);
1660    DoseList := TStringList.Create;
1661    case tabDose.TabIndex of
1662    TI_DOSE:
1663      begin
1664        if (cboDosage.ItemIndex < 0) and (Length(cboDosage.Text) > 0) then
1665        begin
1666          // try to resolve freetext dose and add it as a new item to the combobox
1667          ADosageText := cboDosage.Text;
1668          ADose := Piece(ADosageText,' ',1);
1669          Delete(ADosageText,1,Length(ADose)+1);
1670          ADosageText := ADose + Trim(ADosageText);
1671          DoseList.Add(ADosageText);
1672          FDrugID := FindCommonDrug(DoseList);
1673          if FDrugID <> '' then
1674          begin
1675            if ExtractFloat(cboDosage.Text) > 0 then
1676            begin
1677              x := ConstructedDoseFields(cboDosage.Text, TRUE);
1678              FDrugID := '';
1679              with cboDosage do ItemIndex := cboDosage.Items.Add(x);
1680            end;
1681          end;
1682        end;
1683        x := ValueOf(FLD_DOSETEXT);    Responses.Update('INSTR',    1, x,  x);
1684        x := ValueOf(FLD_DRUG_ID);     Responses.Update('DRUG',     1, x, '');
1685        x := ValueOf(FLD_DOSEFLDS);    Responses.Update('DOSE',     1, x, '');
1686        x := ValueOf(FLD_STRENGTH);
1687        // if outpt or inpt order with no total dose (i.e., topical)
1688        if (not FInptDlg) or (ValueOf(FLD_TOTALDOSE) = '')
1689                                  then Responses.Update('STRENGTH', 1, x,  x);
1690        // if no strength for dosage, use dispense drug name
1691        if Length(x) = 0 then
1692        begin
1693          x := ValueOf(FLD_DRUG_NM);
1694          if Length(x) > 0        then Responses.Update('NAME',     1, x,  x);
1695        end;
1696        x := ValueOf(FLD_ROUTE_AB);
1697        if Length(x) = 0 then x := ValueOf(FLD_ROUTE_NM);
1698        if Length(ValueOf(FLD_ROUTE_ID)) > 0
1699                                  then Responses.Update('ROUTE',    1, ValueOf(FLD_ROUTE_ID), x)
1700                                  else Responses.Update('ROUTE',    1, '', x);
1701        x := ValueOf(FLD_SCHEDULE);    Responses.Update('SCHEDULE', 1, x,  x); // CQ:7297, 7534
1702      end;
1703    end; {case TabDose.TabIndex}
1704    DoseList.Free;
1705    Responses.Update('URGENCY',   1, ValueOf(FLD_PRIOR_ID), '');
1706    Responses.Update('COMMENT',   1, TX_WPTYPE, ValueOf(FLD_COMMENT));
1707  
1708    if Length(calStart.Text) > 0 then
1709       Responses.Update('START', 1, calStart.Text, 'Start Date: ' + calStart.Text);  //cla 7-17-03
1710       
1711    x := ValueOf(FLD_STATEMENTS);
1712    Responses.Update('STATEMENTS',1, TX_WPTYPE, x);
1713  
1714  
1715   if FInptDlg then                       // inpatient orders
1716    begin
1717      Responses.Update('NOW',     1, ValueOf(FLD_NOW_ID), ValueOf(FLD_NOW_NM));
1718    end else
1719    begin
1720       x := OutpatientSig;                 Responses.Update('SIG',     1, TX_WPTYPE, x);
1721   end;
1722    memOrder.Text := Responses.OrderText;
1723  end;