Procedure

TfrmODDiet.cboDietAvailMouseClick

Module

fODDiet

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public/Published

Owner

TfrmODDiet

Declaration

procedure cboDietAvailMouseClick(Sender: TObject);

Calls Hierarchy


TfrmODDiet.cboDietAvailMouseClick
 ├TResponses.SetQuickOrder
 │ ├TResponses.Clear
 │ └LoadResponses
 │   └ExtractToResponses
 │     └ExpandOrderObjects
 │       ├TdmodShared.BoilerplateOK
 │       │ ├ErrCount
 │       │ ├AddErr
 │       │ └TdmodShared.LoadTIUObjects
 │       │   └GetObjectList
 │       └GetTemplateText
 │         └TEncounter.GetVisitStr
 │           └TEncounter.GetVisitCategory
 ├TfrmODDiet.SetValuesFromResponsesDO
 │ ├TfrmODDiet.ResetControlsDO
 │ ├TResponses.NextInstance
 │ ├TResponses.FindResponseByName
 │ ├DietAttributes
 │ ├TResponses.SetControl
 │ │ ├TResponses.FindResponseByName
 │ │ └AssignBPText
 │ │   ├DisplayGroupToLinkType
 │ │   │ └DisplayGroupByName
 │ │   ├TResponses.EValueFor
 │ │   ├GetServiceIEN
 │ │   ├TResponses.IValueFor
 │ │   ├GetProcedureIEN
 │ │   ├ExpandOrderObjects...
 │ │   ├SetTemplateDialogCanceled
 │ │   ├CheckBoilerplate4Fields
 │ │   ├ExecuteTemplateOrBoilerPlate
 │ │   └WasTemplateDialogCanceled
 │ ├TfrmODDiet.DietCheckForNPO
 │ ├TfrmODDiet.DietCheckForTF
 │ │ └TextForOrder
 │ └TfrmODDiet.DietChange
 │   ├TResponses.Clear
 │   ├TResponses.Update
 │   │ ├TResponses.FindResponseByName
 │   │ └TResponses.IENForPrompt
 │   └TResponses.GetOrderText
 │     ├TResponses.NextInstance
 │     ├TResponses.FindResponseByName
 │     ├TResponses.FormatResponse
 │     │ └TResponses.FindResponseByIEN
 │     └TResponses.AppendChildren
 │       ├TResponses.FindPromptByIEN
 │       ├TResponses.FindResponseByIEN
 │       └TResponses.FormatResponse...
 ├SetError
 ├DietAttributes
 ├TfrmODDiet.DietCheckForNPO
 ├TfrmODDiet.DietCheckForTF...
 ├TfrmODBase.OrderMessage
 │ └TfrmODBase.ShowOrderMessage
 ├OIMessage
 └TfrmODDiet.DietChange...

Called-By Hierarchy


TfrmODDiet.cboDietAvailMouseClick
    TfrmODDiet.cboDietAvailExit┘ 

Calls

Name Declaration Comments
DietAttributes function DietAttributes(OI: Integer): string; -
TfrmODDiet.DietChange procedure DietChange(Sender: TObject); -
TfrmODDiet.DietCheckForNPO procedure DietCheckForNPO; -
TfrmODDiet.DietCheckForTF procedure DietCheckForTF; -
OIMessage function OIMessage(IEN: Integer): string; -
TfrmODBase.OrderMessage procedure OrderMessage(const AMessage: string); -
SetError procedure SetError(const AnError: string); -
TResponses.SetQuickOrder procedure SetQuickOrder(AnIEN: Integer); -
TfrmODDiet.SetValuesFromResponsesDO procedure SetValuesFromResponsesDO; -

Called-By

Name Declaration Comments
TfrmODDiet.cboDietAvailExit procedure cboDietAvailExit(Sender: TObject); -


Source

1065  procedure TfrmODDiet.cboDietAvailMouseClick(Sender: TObject);
1066  var
1067    NewDiet, ErrMsg: string;
1068    DupDiet: Boolean;
1069    i: Integer;
1070  
1071    procedure SetError(const AnError: string);
1072    begin
1073      if Length(ErrMsg) > 0 then Exit;
1074      ErrMsg := AnError;
1075    end;
1076  
1077  begin
1078    inherited;
1079    if CharAt(cboDietAvail.ItemID, 1) = 'Q' then              // setup quick order
1080    begin
1081      Responses.QuickOrder := ExtractInteger(cboDietAvail.ItemID);
1082      SetValuesFromResponsesDO;
1083      cboDietAvail.ItemIndex := -1;
1084      Exit;
1085    end;
1086    if cboDietAvail.ItemIEN > 0 then with lstDietSelect do
1087    begin
1088      ErrMsg := '';
1089      if Items.Count > 0 then  // disallow other diets with Regular & NPO
1090      begin
1091        if cboDietAvail.ItemIEN = uDietParams.RegIEN then SetError(TX_DIET_REG);
1092        if GetIEN(0) = uDietParams.RegIEN            then SetError(TX_DIET_REG);
1093        if cboDietAvail.ItemIEN = uDietParams.NPOIEN then SetError(TX_DIET_NPO);
1094        if GetIEN(0) = uDietParams.NPOIEN            then SetError(TX_DIET_NPO);
1095      end;
1096      if Items.Count = 5 then SetError(TX_DIET_LIM);    // maximum of 5 diet modifications
1097      DupDiet := False;
1098      for i := 0 to Items.Count - 1 do if cboDietAvail.ItemIEN = GetIEN(i) then DupDiet := True;
1099      if DupDiet         then SetError(TX_DIET_DUP);    // each diet mod must be unique
1100      NewDiet := DietAttributes(cboDietAvail.ItemIEN);
1101      if Piece(NewDiet,'^',1)='0' then
1102      begin
1103        InfoBox(Piece(NewDiet,'^',2),TC_DIET_ERR, MB_OK);
1104        cboDietAvail.ItemIndex := -1;
1105        Exit;
1106      end;
1107      for i := 0 to Items.Count - 1 do                  // check to make sure unique precedence
1108        if Piece(Items[i], U, 4) = Piece(NewDiet, U, 4)
1109          then SetError(TX_DIET_PRC + Piece(Items[i], U, 2));
1110      if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TC_DIET_ERR, MB_OK) else
1111      begin
1112        lstDietSelect.Items.Add(NewDiet);
1113        DietCheckForNPO;
1114        DietCheckForTF;
1115        OrderMessage(OIMessage(StrToIntDef(Piece(NewDiet, U, 1), 0)));
1116        DietChange(Sender);
1117      end; {else of if Length}
1118    end; {if cboDietAvail}
1119    cboDietAvail.ItemIndex := -1;
1120  end;