Procedure

TfrmOrders.NotifyOrder

Directives

Override

Module

fOrders

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public

Overrides

TfrmPage.NotifyOrder

Owner

TfrmOrders

Declaration

procedure NotifyOrder(OrderAction: Integer; AnOrder: TOrder); override;

Calls Hierarchy


TfrmOrders.NotifyOrder
 ├TOrder.Assign
 ├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
 ├TfrmOrders.PositionTopOrder
 │ └SeqOfDGroup...
 ├DCOrder
 │ ├DeleteDCOrdersFromCopiedList
 │ └SetOrderFromResults
 │   └SetOrderFields
 │     ├TOrder.Clear
 │     ├SeqOfDGroup...
 │     └TopNameOfDGroup
 │       └LoadDGroupMap
 ├GetREQReason
 ├TChanges.Add
 │ └TChangeItem.Create
 ├TfrmOrders.SynchListToOrders
 │ └TfrmOrders.GetPlainText...
 ├IsComplexOrder
 ├TfrmOrders.RedrawOrderList
 │ └TfrmOrders.GetPlainText...
 ├GetChildrenOfComplexOrder
 ├RemoveFromOrderList
 ├TfrmOrders.GetPlainText...
 └TfrmOrders.SaveSignOrders
   ├TfrmPage.GetPatientViewed
   └TfrmOrders.RefreshOrderList...

Called-By Hierarchy


TfrmOrders.NotifyOrder
TfrmFrame.UMNewOrder┘ 

Calls

Name Declaration Comments
TChanges.Add procedure Add(ItemType: Integer; const AnID, ItemText, GroupName: string; SignState: Integer; AParentID: string = ''; User: int64 = 0; OrderDG: String = ''; DCOrder: Boolean = False; Delay: Boolean = False; ProblemAdded: Boolean = False); -
TOrder.Assign procedure Assign(Source: TOrder); -
DCOrder procedure DCOrder(AnOrder: TOrder; AReason: Integer; NewOrder: boolean; var DCType: Integer); -
GetChildrenOfComplexOrder procedure GetChildrenOfComplexOrder(AnParentID,CurrAct: string; var ChildList: TStringList); -
TfrmOrders.GetPlainText function GetPlainText(AnOrder: TOrder; index: integer):string; -
GetREQReason function GetREQReason: Integer; -
IsComplexOrder function IsComplexOrder(AnOrderID: string): boolean; -
TfrmOrders.PositionTopOrder procedure PositionTopOrder(DGroup: Integer); -
TfrmOrders.RedrawOrderList procedure RedrawOrderList; -
TfrmOrders.RefreshOrderList procedure RefreshOrderList(FromServer: Boolean; APtEvtID: string = ''); -
RemoveFromOrderList procedure RemoveFromOrderList(ChildOrderID: string); -
TfrmOrders.SaveSignOrders procedure SaveSignOrders; -
TfrmOrders.SynchListToOrders procedure SynchListToOrders; -

Called-By

Name Declaration Comments
TfrmFrame.UMNewOrder procedure UMNewOrder(var Message: TMessage); message UM_NEWORDER; -


Source

473   procedure TfrmOrders.NotifyOrder(OrderAction: Integer; AnOrder: TOrder);
474   var
475     OrderForList: TOrder;
476     IndexOfOrder, ReturnedType, CanSign, i: Integer;
477     j: integer;
478     AChildList: TStringlist;
479     CplxOrderID: string;
480     DCNewOrder: boolean;
481     DCChangeItem: TChangeItem;
482   
483     procedure RemoveFromOrderList(ChildOrderID: string);
484     var
485      ij: integer;
486     begin
487       for ij := uOrderList.Count - 1 downto 0 do
488       begin
489         if TOrder(uOrderList[ij]).ID = ChildOrderID then
490           uOrderList.Remove(TOrder(uOrderList[ij]));
491       end;
492     end;
493   
494   begin
495   //  if FCurrentView = nil then                                        {**REV**}
496   //    begin                                                           {**REV**}
497   //      FCurrentView := TOrderView.Create;                            {**REV**}
498   //      with FCurrentView do                                          {**REV**}
499   //       begin                                                        {**REV**}
500   //        InvChrono := True;                                          {**REV**}
501   //        ByService := True;                                          {**REV**}
502   //       end;                                                         {**REV**}
503   //    end;                                                            {**REV**}
504     if FCurrentView = nil then Exit;
505     case OrderAction of
506     ORDER_NEW:  if AnOrder.ID <> '' then
507                 begin
508                   OrderForList := TOrder.Create;
509                   OrderForList.Assign(AnOrder);
510                   uOrderList.Add(OrderForList);
511                   FCompress := True;
512                   RefreshOrderList(FROM_SELF);
513                   //PositionTopOrder(AnOrder.DGroup);
514                   PositionTopOrder(0);  // puts new orders on top
515                   lstOrders.Invalidate;
516                 end;
517     ORDER_DC:   begin
518                   IndexOfOrder := -1;
519                   with lstOrders do for i := 0 to Items.Count - 1 do
520                     if TOrder(Items.Objects[i]).ID = AnOrder.ID then IndexOfOrder := i;
521                   if IndexOfOrder > -1
522                     then OrderForList := TOrder(lstOrders.Items.Objects[IndexOfOrder])
523                     else OrderForList := AnOrder;
524                   if (Encounter.Provider = User.DUZ) and User.CanSignOrders
525                     then CanSign := CH_SIGN_YES
526                     else CanSign := CH_SIGN_NA;
527                   DCNEwOrder := false;
528                   if Changes.Orders.Count > 0 then
529                     begin
530                       for j := 0 to Changes.Orders.Count - 1 do
531                         begin
532                           DCChangeItem := TChangeItem(Changes.Orders.Items[j]);
533                           if DCChangeItem.ID = OrderForList.ID then
534                             begin
535                               if (Pos('DC', OrderForList.ActionOn) = 0) then
536                               DCNewOrder := True;
537                               //else DCNewOrder := False;
538                             end;
539                         end;
540                     end;
541                   DCOrder(OrderForList, GetREQReason, DCNewOrder, ReturnedType);
542                   Changes.Add(CH_ORD, OrderForList.ID, OrderForList.Text, '', CanSign);
543                   FCompress := True;
544                   SynchListToOrders;
545                 end;
546     ORDER_EDIT: with lstOrders do
547                 begin
548                   IndexOfOrder := -1;
549                   for i := 0 to Items.Count - 1 do
550                     if TOrder(Items.Objects[i]).ID = AnOrder.EditOf then IndexOfOrder := i;
551                   if IndexOfOrder > -1 then
552                   begin
553                     TOrder(Items.Objects[IndexOfOrder]).Assign(AnOrder);
554                   end; {if IndexOfOrder}
555                   //RedrawOrderList;  {redraw here appears to clear selected}
556                 end; {with lstOrders}
557     ORDER_ACT:  begin
558                   if IsComplexOrder(AnOrder.ID) then
559                   begin
560                     RefreshOrderList(FROM_SERVER);
561                     exit;
562                   end;
563                   with lstOrders do
564                   begin
565                     IndexOfOrder := -1;
566                     for i := 0 to Items.Count - 1 do
567                       if TOrder(Items.Objects[i]).ID = Piece(AnOrder.ActionOn, '=', 1) then IndexOfOrder := i;
568                     if (IndexOfOrder > -1) and (AnOrder <> Items.Objects[IndexOfOrder]) then
569                     begin
570                       TOrder(Items.Objects[IndexOfOrder]).Assign(AnOrder);
571                     end; {if IndexOfOrder}
572                     FCompress := True;
573                     RedrawOrderList;
574                   end; {with lstOrders}
575                 end; //PSI-COMPLEX
576     ORDER_CPLXRN: begin
577                     AChildList := TStringList.Create;
578                     CplxOrderID := Piece(AnOrder.ActionOn,'=',1);
579                     GetChildrenOfComplexOrder(CplxOrderID, Piece(CplxOrderID,';',2), AChildList);
580                     with lstOrders do
581                     begin
582                       for i := Items.Count-1 downto 0 do
583                       begin
584                         for j := 0 to AChildList.Count - 1 do
585                         begin
586                           if TOrder(Items.Objects[i]).ID = AChildList[j] then
587                           begin
588                             RemoveFromOrderList(AChildList[j]);
589                             Items.Objects[i].Free;
590                             Items.Delete(i);
591                             Break;
592                           end;
593                         end;
594                       end;
595                       Items.InsertObject(0,AnOrder.Text,AnOrder);
596                       Items[0] := GetPlainText(AnOrder,0);
597                       uOrderList.Insert(0,AnOrder);
598                     end;
599                     FCompress := True;
600                     RedrawOrderList;
601                     AChildList.Clear;
602                     AChildList.Free;
603                   end;
604     ORDER_SIGN: begin
605                   FCompress := True;
606                   SaveSignOrders;  // sent when orders signed, AnOrder=nil
607                 end;
608     end; {case}
609   end;