Procedure

TfrmOrders.SetOrderView

Module

fOrders

Last Modified

7/15/2014 3:26:42 PM

Comments

Sets up a 'canned' order view, assumes the date range is never restricted

Visibility

Private

Owner

TfrmOrders

Declaration

procedure SetOrderView(AFilter, ADGroup: Integer; const AViewName: string; NotifSort: Boolean);

Calls Hierarchy


TfrmOrders.SetOrderView
 ├TfrmOrders.CanChangeOrderView
 │ └ActiveOrdering
 ├StrToFMDateTime
 ├FMNow
 ├TfrmOrders.UseDefaultSort
 ├ExpiredOrdersStartDT
 └TfrmOrders.RefreshOrderList
   ├LoadOrdersAbbr
   │ ├ClearOrders
   │ ├LoadDGroupMap
   │ ├ExpiredOrdersStartDT
   │ ├FMNow
   │ └SeqOfDGroup
   │   └LoadDGroupMap
   ├ClearOrders
   ├LoadOrdersAbbr
   │ ├LoadDGroupMap
   │ ├FMNow
   │ └SeqOfDGroup...
   ├TfrmOrders.ExpandEventSection
   ├TfrmOrders.CompressEventSection
   ├SortOrders
   │ ├InverseByGroup
   │ │ └TChanges.Exist
   │ ├ForwardByGroup
   │ │ └TChanges.Exist
   │ ├InverseChrono
   │ └ForwardChrono
   ├TfrmOrders.AddToListBox
   │ └TfrmOrders.GetPlainText
   │   └TfrmOrders.GetOrderText
   │     ├LoadFlagReason
   │     ├TfrmOrders.GetStartStopText
   │     └NameOfStatus
   └DGroupAll

Called-By Hierarchy


               TfrmOrders.SetOrderView
       TfrmOrders.mnuViewActiveClick┤ 
      TfrmOrders.mnuViewCurrentClick┤ 
     TfrmOrders.mnuViewExpiringClick┤ 
      TfrmOrders.mnuViewExpiredClick┤ 
     TfrmOrders.mnuViewUnsignedClick┤ 
   TfrmOrders.ProcessNotifications┘ │ 
          TfrmOrders.DisplayPage┘   │ 
        TfrmOrders.ViewAlertedOrders┘ 
TfrmOrders.ProcessNotifications...┘   

Calls

Name Declaration Comments
TfrmOrders.CanChangeOrderView function CanChangeOrderView: Boolean; -
ExpiredOrdersStartDT function ExpiredOrdersStartDT: TFMDateTime; -
FMNow function FMNow: TFMDateTime; -
TfrmOrders.RefreshOrderList procedure RefreshOrderList(FromServer: Boolean; APtEvtID: string = ''); -
StrToFMDateTime function StrToFMDateTime(const AString: string): TFMDateTime; -
TfrmOrders.UseDefaultSort procedure UseDefaultSort; -

Called-By

Name Declaration Comments
TfrmOrders.mnuViewActiveClick procedure mnuViewActiveClick(Sender: TObject); -
TfrmOrders.mnuViewCurrentClick procedure mnuViewCurrentClick(Sender: TObject); -
TfrmOrders.mnuViewExpiredClick procedure mnuViewExpiredClick(Sender: TObject); -
TfrmOrders.mnuViewExpiringClick procedure mnuViewExpiringClick(Sender: TObject); -
TfrmOrders.mnuViewUnsignedClick procedure mnuViewUnsignedClick(Sender: TObject); -
TfrmOrders.ViewAlertedOrders procedure ViewAlertedOrders(OrderIEN: string; Status: integer; DispGrp: string; BySvc, InvDate: boolean; Title: string); -


Source

826   procedure TfrmOrders.SetOrderView(AFilter, ADGroup: Integer; const AViewName: string;
827     NotifSort: Boolean);
828   { sets up a 'canned' order view, assumes the date range is never restricted }
829   var
830     tmpDate: TDateTime;
831   begin
832     if not CanChangeOrderView then Exit;
833     lstSheets.ItemIndex := 0;
834     FCurrentView := TOrderView(lstSheets.Items.Objects[0]);
835     if FCurrentView = nil then
836       FCurrentView := TOrderView.Create;
837     with FCurrentView do
838     begin
839       TimeFrom  := 0;
840       TimeThru  := 0;
841       if NotifSort then
842       begin
843         ByService := False;
844         InvChrono := True;
845         if AFilter = STS_RECENT then
846           begin
847             tmpDate  := Trunc(FMDateTimeToDateTime(StrToFMDateTime(Piece(Piece(Notifications.RecordID, U, 2), ';', 3))));
848             TimeFrom := DateTimeToFMDateTime(tmpDate - 5);
849             TimeThru := FMNow;
850           end;
851         if AFilter = STS_UNVERIFIED then
852           begin
853             if Patient.AdmitTime > 0 then
854               tmpDate := Trunc(FMDateTimeToDateTime(Patient.AdmitTime))
855             else
856               tmpdate := Trunc(FMDateTimeToDateTime(FMNow)) - 30;
857             TimeFrom := DateTimeToFMDateTime(tmpDate);
858             TimeThru := FMNow;
859           end;
860       end
861       else UseDefaultSort;
862       if AFilter = STS_EXPIRED then
863       begin
864         TimeFrom := ExpiredOrdersStartDT;
865         TimeThru := FMNow;
866       end;
867       Filter    := AFilter;
868       DGroup    := ADGroup;
869       CtxtTime  := 0;
870       TextView  := 0;
871       ViewName  := AViewName;
872       lstSheets.Items[0] := 'C;0^' + ViewName;
873       EventDelay.EventType := 'C';
874       EventDelay.Specialty := 0;
875       EventDelay.Effective := 0;
876     end;
877     RefreshOrderList(FROM_SERVER);
878   end;