Index: cprs/trunk/CPRS-Chart/Orders/fOrders.pas
===================================================================
--- cprs/trunk/CPRS-Chart/Orders/fOrders.pas	(revision 829)
+++ cprs/trunk/CPRS-Chart/Orders/fOrders.pas	(revision 1679)
@@ -163,4 +163,5 @@
       Section: THeaderSection);
     procedure sptHorzMoved(Sender: TObject);
+    procedure sptVertMoved(Sender: TObject);
   private
     { Private declarations }
@@ -225,5 +226,5 @@
     function AllowContextChange(var WhyNot: string): Boolean; override;
     function PlaceOrderForDefaultDialog(ADlgInfo: string; IsDefaultDialog: boolean; AEvent: TOrderDelayEvent): boolean;
-    function PtEvtCompleted(APtEvtID: integer; APtEvtName: string; FromMeds: boolean = False): boolean;
+    function PtEvtCompleted(APtEvtID: integer; APtEvtName: string; FromMeds: boolean = False; Signing: boolean = False): boolean;
     procedure RefreshToFirstItem;
     procedure ChangesUpdate(APtEvtID: string);
@@ -1176,5 +1177,7 @@
     FCompress := False;
   end;
-
+  //CQ 18660 Orders for events should be modal. Orders for non-event should not be modal
+  if AnOrderView.EventDelay.EventIFN = 0 then NeedShowModal := False
+  else NeedShowModal := True;
   if (FCurrentView <> nil) and (AnOrderView.EventDelay.EventIFN <> FCurrentView.EventDelay.EventIFN) and (FCurrentView.EventDelay.EventIFN > 0 ) then
   begin
@@ -1398,5 +1401,7 @@
       begin
         result := MixedCase(ProviderName);
-        result := Piece(result, ',', 1) + ',' + Copy(Piece(result, ',', 2), 1, 1);
+//        result := Piece(result, ',', 1) + ',' + Copy(Piece(result, ',', 2), 1, 1);
+// CQ#15915
+        result := Piece(result, ',', 1) + ',' + Piece(result, ',', 2);
       end;
       5: result := VerNurse;
@@ -2350,6 +2355,8 @@
   ALocation: Integer;
   AName: string;
-begin
-  inherited;
+  Delayed: boolean;
+begin
+  inherited;
+  Delayed := False;
   if NoneSelected(TX_NOSEL_SIGN) then Exit;
   if not AuthorizedUser then Exit;
@@ -2375,6 +2382,9 @@
   if not LockedForOrdering then Exit;
 
-  if (FCurrentView.EventDelay.PtEventIFN>0) and (PtEvtCompleted(FCurrentView.EventDelay.PtEventIFN, FCurrentView.EventDelay.EventName)) then
-    Exit;
+  //CQ 18392 and CQ 18121 Made changes to this code, PtEVTComplete function and the finally statement at the end to support the fix for these CQs
+  if (FCurrentView.EventDelay.PtEventIFN>0) then
+      Delayed := (PtEvtCompleted(FCurrentView.EventDelay.PtEventIFN, FCurrentView.EventDelay.EventName, false, true));
+  //if (FCurrentView.EventDelay.PtEventIFN>0) and (PtEvtCompleted(FCurrentView.EventDelay.PtEventIFN, FCurrentView.EventDelay.EventName)) then
+  //  Exit;
 
   SelectedList := TList.Create;
@@ -2413,4 +2423,14 @@
     SelectedList.Free;
     UnlockIfAble;
+    //CQ #17491: Added UpdatePtInfoOnRefresh here to allow for the updating of the patient
+    //status indicator in the header bar if the patient becomes admitted/discharged.
+    frmFrame.UpdatePtInfoOnRefresh;
+    if Delayed = True then
+      begin
+        InitOrderSheetsForEvtDelay;
+        lstSheets.ItemIndex := 0;
+        lstSheetsClick(self);
+        RefreshOrderList(True);
+      end;
   end;
 end;
@@ -3243,5 +3263,5 @@
 end;
 
-function TfrmOrders.PtEvtCompleted(APtEvtID: integer; APtEvtName: string; FromMeds: boolean): boolean;
+function TfrmOrders.PtEvtCompleted(APtEvtID: integer; APtEvtName: string; FromMeds: boolean; Signing: boolean): boolean;
 begin
   Result := False;
@@ -3253,4 +3273,9 @@
       InfoBox('The event "Delayed ' + APtEvtName + '" ' + TX_CMPTEVT, 'Warning', MB_OK or MB_ICONWARNING);
     GroupChangesUpdate('Delayed ' + APtEvtName);
+    if signing = true then
+      begin
+        Result := True;
+        exit;
+      end;
     InitOrderSheetsForEvtDelay;
     lstSheets.ItemIndex := 0;
@@ -3338,4 +3363,5 @@
         hdrOrders.Sections[i].Width := origWidths[i];
       lstOrders.Invalidate;
+      RefreshOrderList(false);
     end;
   end;
@@ -3474,4 +3500,12 @@
 end;
 
+procedure TfrmOrders.sptVertMoved(Sender: TObject);
+begin
+  inherited;
+  if self.sptVert.Top < self.lstSheets.Constraints.MinHeight then
+     self.sptVert.Top := self.lstSheets.Constraints.MinHeight + 1;
+  
+end;
+
 initialization
   SpecifyFormIsNotADialog(TfrmOrders);
