Procedure

TfrmODDiet.grpMealClick

Module

fODDiet

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public/Published

Owner

TfrmODDiet

Declaration

procedure grpMealClick(Sender: TObject);

Calls Hierarchy


TfrmODDiet.grpMealClick
 ├SetMealTimes
 │ └ActivateButton
 ├TfrmODBase.OrderForInpatient
 │ ├OrderEventTypeOnCreate
 │ └IsPassEvt1
 ├TfrmODDiet.PatientHasRecurringMeals
 │ └GetCurrentRecurringOPMeals
 └TfrmODDiet.ELChange
   ├TResponses.Clear
   ├TResponses.Update
   │ ├TResponses.FindResponseByName
   │ └TResponses.IENForPrompt
   ├TfrmODDiet.GetMealTime
   ├TfrmODDiet.IsEarlyTray
   ├TfrmODBase.OrderForInpatient...
   ├TfrmODDiet.GetDaysOfWeek
   └TResponses.GetOrderText
     ├TResponses.NextInstance
     ├TResponses.FindResponseByName
     ├TResponses.FormatResponse
     │ └TResponses.FindResponseByIEN
     └TResponses.AppendChildren
       ├TResponses.FindPromptByIEN
       ├TResponses.FindResponseByIEN
       └TResponses.FormatResponse...

Called-By Hierarchy


              TfrmODDiet.grpMealClick
TfrmODDiet.SetValuesFromResponsesEL┘ 
           TfrmODDiet.SetupDialog┘   

Calls

Name Declaration Comments
TfrmODDiet.ELChange procedure ELChange(Sender: TObject); -
TfrmODBase.OrderForInpatient function OrderForInpatient: Boolean; -
TfrmODDiet.PatientHasRecurringMeals function PatientHasRecurringMeals(var MealList: TStringList; MealType: string = ''): boolean; -
SetMealTimes procedure SetMealTimes(const x: string); -

Called-By

Name Declaration Comments
TfrmODDiet.SetValuesFromResponsesEL procedure SetValuesFromResponsesEL; -


Source

1630  procedure TfrmODDiet.grpMealClick(Sender: TObject);
1631  
1632    procedure SetMealTimes(const x: string);
1633  
1634      procedure ActivateButton( Button: TRadioButton; const MealTime: string;
1635        var MoreActivated: boolean);
1636      var
1637        Activate: boolean;
1638      begin
1639        Button.Caption := MealTime;
1640        Activate := Length(MealTime) > 0;
1641        Button.Visible := Activate;
1642        Button.Checked := Activate and not MoreActivated;
1643        MoreActivated := MoreActivated or Activate;
1644      end;
1645  
1646    var
1647      HasTimes: Boolean;
1648    begin
1649      HasTimes := False;
1650      ActivateButton(radET1, Piece(x, U, 1), HasTimes);
1651      ActivateButton(radET2, Piece(x, U, 2), HasTimes);
1652      ActivateButton(radET3, Piece(x, U, 3), HasTimes);
1653      ActivateButton(radLT1, Piece(x, U, 4), HasTimes);
1654      ActivateButton(radLT2, Piece(x, U, 5), HasTimes);
1655      ActivateButton(radLT3, Piece(x, U, 6), HasTimes);
1656      lblNoTimes.Visible := not HasTimes;
1657    end;
1658  var
1659    AMeal: string;
1660  begin
1661    inherited;
1662    Changing := True;
1663    case grpMeal.ItemIndex of
1664      0: begin
1665           SetMealTimes(uDietParams.BTimes);
1666           AMeal := 'B';
1667         end;
1668      1: begin
1669           SetMealTimes(uDietParams.NTimes);
1670           AMeal := 'N';
1671         end;
1672      2: begin
1673           SetMealTimes(uDietParams.ETimes);
1674           AMeal := 'E';
1675         end;
1676    else
1677      begin
1678        SetMealTimes('');
1679        AMeal := '';
1680      end;
1681    end;
1682    if not OrderForInpatient then
1683      begin
1684        if AMeal = '' then
1685        begin
1686          uRecurringMealList.Clear;
1687          cboOPELRecurringMeals.Clear;
1688        end
1689        else if not PatientHasRecurringMeals(uRecurringMealList, AMeal) then
1690          begin
1691            uRecurringMealList.Clear;
1692            cboOPELRecurringMeals.Clear;
1693            grpMeal.ItemIndex := 3;
1694          end
1695        else
1696          FastAssign(uRecurringMealList, cboOPELRecurringMeals.Items);
1697      end;
1698    Changing := False;
1699    ELChange(grpMeal);
1700  end;