Procedure

TResponses.SetControl

Module

fODBase

Last Modified

7/15/2014 3:26:40 PM

Comments

Sets the value of a control, uses ID string & instance to find the right response entry

Visibility

Public

Owner

TResponses

Declaration

procedure SetControl(AControl: TControl; const APromptID: string; AnInstance: Integer);

Calls Hierarchy


TResponses.SetControl
 ├TResponses.FindResponseByName
 └AssignBPText
   ├DisplayGroupToLinkType
   │ └DisplayGroupByName
   ├TResponses.EValueFor
   ├GetServiceIEN
   ├TResponses.IValueFor
   ├GetProcedureIEN
   ├ExpandOrderObjects
   │ ├TdmodShared.BoilerplateOK
   │ │ ├ErrCount
   │ │ ├AddErr
   │ │ └TdmodShared.LoadTIUObjects
   │ │   └GetObjectList
   │ └GetTemplateText
   │   └TEncounter.GetVisitStr
   │     └TEncounter.GetVisitCategory
   ├SetTemplateDialogCanceled
   ├CheckBoilerplate4Fields
   ├ExecuteTemplateOrBoilerPlate
   └WasTemplateDialogCanceled

Called-By Hierarchy


                      TResponses.SetControl
                   TfrmODMisc.SetupDialog┤ 
                    TfrmODGen.SetupDialog┤ 
                  TfrmODMedIn.SetupDialog┤ 
          TfrmODMedIn.cboMedicationSelect┤ 
               TfrmODMedIn.CheckFormAlt┘ │ 
          TfrmODMedIn.cboDispenseExit┤   │ 
    TfrmODMedIn.cboDispenseMouseClick┘   │ 
 TfrmODMedIn.cboMedicationSelect...┘     │ 
                 TfrmODMedOut.SetupDialog┤ 
         TfrmODMedOut.cboMedicationSelect┤ 
              TfrmODMedOut.CheckFormAlt┘ │ 
         TfrmODMedOut.cboDispenseExit┤   │ 
   TfrmODMedOut.cboDispenseMouseClick┘   │ 
TfrmODMedOut.cboMedicationSelect...┘     │ 
             TfrmODMedOut.SetInstructions┤ 
               TfrmODMedOut.SetupDialog┤ │ 
    TfrmODMedOut.cboMedicationSelect...┤ │ 
           TfrmODMedOut.cmdComplexClick┘ │ 
                   TfrmODText.SetupDialog┤ 
                   TfrmODProc.SetupDialog┤ 
                 TfrmODProc.cboProcSelect┤ 
                   TfrmODCslt.SetupDialog┤ 
              TfrmODCslt.treServiceChange┤ 
           TfrmODCslt.treServiceKeyDown┘ │ 
              TfrmODCslt.cboServiceSelect┤ 
              TfrmODCslt.cboServiceExit┘ │ 
                    TfrmODRad.SetupDialog┤ 
             TfrmODRad.cboProcedureSelect┤ 
             TfrmODRad.cboProcedureExit┘ │ 
                    TfrmODLab.SetupDialog┤ 
             TfrmODLab.cboAvailTestSelect┤ 
                  TfrmODLab.SetupDialog┤ │ 
             TfrmODLab.cboAvailTestExit┘ │ 
                  TfrmODBBank.SetupDialog┤ 
              TfrmODBBank.SetOnQuickOrder┤ 
              TfrmODBBank.cboQuickClick┘ │ 
       TfrmODMedIV.SetValuesFromResponses┤ 
                TfrmODMedIV.SetupDialog┤ │ 
      TfrmODMedIV.cboSolutionMouseClick┘ │ 
          TfrmODMedIV.cboSolutionExit┘   │ 
                 TfrmODVitals.SetupDialog┤ 
             TfrmODMedNVA.SetOnQuickOrder┤ 
               TfrmODMedNVA.SetupDialog┤ │ 
            TfrmODMedNVA.btnSelectClick┘ │ 
            TfrmODMedNVA.UMDelayClick┘   │ 
               TfrmODMeds.SetOnQuickOrder┤ 
                 TfrmODMeds.SetupDialog┤ │ 
              TfrmODMeds.btnSelectClick┘ │ 
              TfrmODMeds.UMDelayClick┘   │ 
      TfrmODDiet.SetValuesFromResponsesDO┤ 
                 TfrmODDiet.SetupDialog┤ │ 
      TfrmODDiet.cboDietAvailMouseClick┘ │ 
          TfrmODDiet.cboDietAvailExit┘   │ 
      TfrmODDiet.SetValuesFromResponsesTF┤ 
                 TfrmODDiet.SetupDialog┤ │ 
        TfrmODDiet.cboProductMouseClick┘ │ 
            TfrmODDiet.cboProductExit┘   │ 
      TfrmODDiet.SetValuesFromResponsesEL┤ 
                 TfrmODDiet.SetupDialog┘ │ 
      TfrmODDiet.SetValuesFromResponsesIP┤ 
                 TfrmODDiet.SetupDialog┘ │ 
      TfrmODDiet.SetValuesFromResponsesAO┤ 
                 TfrmODDiet.SetupDialog┘ │ 
      TfrmODDiet.SetValuesFromResponsesOP┤ 
                 TfrmODDiet.SetupDialog┤ │ 
    TfrmODDiet.cboOPDietAvailMouseClick┘ │ 
             TfrmODDiet.nbkDietChange┤   │ 
              TfrmODDiet.InitDialog┤ │   │ 
             TfrmODDiet.SetupDialog┤ │   │ 
                          ..(rec)..┘ │   │ 
        TfrmODDiet.cboOPDietAvailExit┤   │ 
     TfrmODDiet.cboOPDietAvailKeyDown┘   │ 
                TfrmODAllergy.SetupDialog┤ 
           TfrmODAllergy.lstAllergySelect┘ 
              TfrmODAllergy.SetupDialog┤   
                              ..(rec)..┘   

Calls

Name Declaration Comments
AssignBPText procedure AssignBPText(List: TStrings; const Value: string); -
TResponses.FindResponseByName function FindResponseByName(const APromptID: string; AnInstance: Integer): TResponse; -

Called-By

Name Declaration Comments
TfrmODLab.cboAvailTestSelect procedure cboAvailTestSelect(Sender: TObject); -
TfrmODMedIn.cboMedicationSelect procedure cboMedicationSelect(Sender: TObject); -
TfrmODMedOut.cboMedicationSelect procedure cboMedicationSelect(Sender: TObject); -
TfrmODRad.cboProcedureSelect procedure cboProcedureSelect(Sender: TObject); -
TfrmODProc.cboProcSelect procedure cboProcSelect(Sender: TObject); -
TfrmODCslt.cboServiceSelect procedure cboServiceSelect(Sender: TObject); -
TfrmODAllergy.lstAllergySelect procedure lstAllergySelect(Sender: TObject); -
TfrmODMedOut.SetInstructions procedure SetInstructions; -
TfrmODBBank.SetOnQuickOrder procedure SetOnQuickOrder; -
TfrmODMedNVA.SetOnQuickOrder procedure SetOnQuickOrder; -
TfrmODMeds.SetOnQuickOrder procedure SetOnQuickOrder; -
TfrmODMisc.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODGen.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODMedIn.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODMedOut.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODText.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODProc.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODCslt.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODRad.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODLab.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODBBank.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODVitals.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODAllergy.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -
TfrmODMedIV.SetValuesFromResponses procedure SetValuesFromResponses; -
TfrmODDiet.SetValuesFromResponsesAO procedure SetValuesFromResponsesAO; -
TfrmODDiet.SetValuesFromResponsesDO procedure SetValuesFromResponsesDO; -
TfrmODDiet.SetValuesFromResponsesEL procedure SetValuesFromResponsesEL; -
TfrmODDiet.SetValuesFromResponsesIP procedure SetValuesFromResponsesIP; -
TfrmODDiet.SetValuesFromResponsesOP procedure SetValuesFromResponsesOP; -
TfrmODDiet.SetValuesFromResponsesTF procedure SetValuesFromResponsesTF; -
TfrmODCslt.treServiceChange procedure treServiceChange(Sender: TObject; Node: TTreeNode); -


Source

1129  procedure TResponses.SetControl(AControl: TControl; const APromptID: string; AnInstance: Integer);
1130  { sets the value of a control, uses ID string & instance to find the right response entry }
1131  var
1132    i: Integer;
1133    AResponse: TResponse;
1134    IEN: integer;
1135    HasObjects: boolean;
1136  
1137    procedure AssignBPText(List: TStrings; const Value: string);
1138    var
1139      tmp, cptn, DocInfo: string;
1140      LType: TTemplateLinkType;
1141  
1142    begin
1143      DocInfo := '';
1144      LType := DisplayGroupToLinkType(DisplayGroup);
1145      cptn := 'Reason for Request: ' + EValueFor('ORDERABLE', 1);
1146      tmp := Value;
1147      case LType of
1148        ltConsult:   IEN := StrToIntDef(GetServiceIEN(IValueFor('ORDERABLE', 1)),0);
1149        ltProcedure: IEN := StrToIntDef(GetProcedureIEN(IValueFor('ORDERABLE', 1)),0);
1150        else         IEN := 0;
1151      end;
1152      ExpandOrderObjects(tmp, HasObjects);
1153      FOrderContainsObjects := FOrderContainsObjects or HasObjects;
1154      
1155      if frmODBase.FAbortOrder then
1156      begin
1157        SetTemplateDialogCanceled(FALSE);
1158        Exit;
1159      end;
1160  
1161      if IEN <> 0 then
1162        begin
1163          // template will execute on copy order if commented out  (tried to eliminate for CSV v22, RV)
1164          //
1165          //if (Length(tmp) > 0) and (not HasTemplateField(tmp)) then
1166          //  CheckBoilerplate4Fields(tmp, cptn)
1167          //else
1168  
1169          // CQ #11669 - changing an existing order shouldn't restart template - JM
1170            if assigned(frmODBase) and (frmODBase.FOrderAction = ORDER_EDIT) then
1171              CheckBoilerplate4Fields(tmp, cptn)
1172            else
1173              ExecuteTemplateOrBoilerPlate(tmp, IEN, LType, nil, cptn, DocInfo);
1174        end
1175      else
1176        CheckBoilerplate4Fields(tmp, cptn);
1177      List.Text := tmp;
1178      if WasTemplateDialogCanceled then frmODBase.FAbortOrder := True;
1179  
1180    end;
1181  
1182  begin
1183    AResponse := FindResponseByName(APromptID, AnInstance);
1184    if AResponse = nil then Exit;
1185    if AControl is TLabel then with TLabel(AControl) do Caption := AResponse.EValue
1186    else if AControl is TStaticText then with TStaticText(AControl) do Caption := AResponse.EValue
1187    else if AControl is TButton then with TButton(AControl) do Caption := AResponse.EValue
1188    else if AControl is TEdit then with TEdit(AControl) do Text := AResponse.EValue
1189    else if AControl is TMaskEdit then with TMaskEdit(AControl) do Text := AResponse.EValue
1190    else if AControl is TCheckBox then with TCheckBox(AControl) do
1191      Checked := (StrToIntDef(AResponse.IValue,0) > 0) or
1192                 (UpperCase(AResponse.IValue) = 'Y')
1193    else if AControl is TMemo then with TMemo(AControl) do AssignBPText(Lines, AResponse.EValue)
1194    else if AControl is TRichEdit then with TRichEdit(AControl) do AssignBPText(Lines, AResponse.EValue)
1195    else if AControl is TORListBox then with TORListBox(AControl) do
1196    begin
1197      for i := 0 to Items.Count - 1 do
1198        if Piece(Items[i], U, 1) = AResponse.IValue then ItemIndex := i;
1199    end
1200    else if AControl is TListBox then with TListBox(AControl) do
1201    begin
1202      for i := 0 to Items.Count - 1 do
1203        if Items[i] = AResponse.EValue then ItemIndex := i;
1204    end
1205    else if AControl is TComboBox then with TComboBox(AControl) do
1206    begin
1207      for i := 0 to Items.Count - 1 do
1208        if Items[i] = AResponse.EValue then ItemIndex := i;
1209      Text := AResponse.EValue;
1210    end
1211    else if AControl is TORComboBox then with TORComboBox(AControl) do
1212    begin
1213      if LongList then InitLongList(AResponse.EValue);
1214      SelectByID(AResponse.IValue);
1215      if (not LongList) and (ItemIndex < 0) then Text := AResponse.EValue;
1216    end;
1217  end;