Procedure

TfrmVisitType.UpdateProviderButtons

Module

fVisitType

Last Modified

7/15/2014 3:26:36 PM

Comments

Procedure TfrmVisitType.SynchEncounterProvider;
// add the Encounter.Provider if this note is for the current encounter
var
  ProviderFound, PrimaryFound: Boolean;
  i: Integer;
  AProvider: TPCEProvider;
begin
  if (FloatToStrF(uEncPCEData.DateTime, ffFixed, 15, 4) =      // compensate rounding errors
      FloatToStrF(Encounter.DateTime,   ffFixed, 15, 4)) and
     (uEncPCEData.Location = Encounter.Location) and
     (Encounter.Provider > 0) then
  begin
    ProviderFound := False;
    PrimaryFound := False;
    for i := 0 to ProviderLst.Count - 1 do
    begin
      AProvider := TPCEProvider(ProviderLst.Items[i]);
      if AProvider.IEN = Encounter.Provider then ProviderFound := True;
      if AProvider.Primary = '1' then PrimaryFound := True;
    end;
    if not ProviderFound then
    begin
      AProvider := TPCEProvider.Create;
      AProvider.IEN := Encounter.Provider;
      AProvider.Name := ExternalName(Encounter.Provider, FN_NEW_PERSON);
      if not PrimaryFound then
      begin
        AProvider.Primary := '1';
        uProvider := Encounter.Provider;
      end
      else AProvider.Primary := '0';
      AProvider.Delete := False;
      ProviderLst.Add(AProvider);
    end;
  end;
end;

Visibility

Private

Owner

TfrmVisitType

Declaration

procedure UpdateProviderButtons;

Called-By Hierarchy


      TfrmVisitType.UpdateProviderButtons
         TfrmVisitType.RefreshProviders┤ 
             TfrmVisitType.FormCreate┤ │ 
            TfrmVisitType.btnAddClick┤ │ 
TfrmVisitType.cboPtProviderDblClick┘ │ │ 
         TfrmVisitType.btnDeleteClick┤ │ 
  TfrmVisitType.lbProvidersDblClick┘ │ │ 
        TfrmVisitType.btnPrimaryClick┘ │ 
      TfrmVisitType.cboPtProviderChange┤ 
        TfrmVisitType.lbProvidersChange┘ 

Called-By

Name Declaration Comments
TfrmVisitType.cboPtProviderChange procedure cboPtProviderChange(Sender: TObject); -
TfrmVisitType.lbProvidersChange procedure lbProvidersChange(Sender: TObject); -
TfrmVisitType.RefreshProviders procedure RefreshProviders; -


Source

248   procedure TfrmVisitType.UpdateProviderButtons;
249   var
250     ok: boolean;
251   
252   begin
253     ok := (lbProviders.ItemIndex >= 0);
254     btnDelete.Enabled := ok;
255     btnPrimary.Enabled := ok;
256     btnAdd.Enabled := (cboPtProvider.ItemIEN <> 0);
257   end;