Index: cprs/branches/HealthSevak-CPRS/CPRS-Chart/Orders/fODBase.pas
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Chart/Orders/fODBase.pas	(revision 1676)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Chart/Orders/fODBase.pas	(revision 1693)
@@ -44,4 +44,5 @@
   private
     FDialog: string;
+    FDialogDisplayName: string;
     FResponseList: TList;
     FPrompts: TList;
@@ -99,4 +100,5 @@
       const AnIValue, AnEValue: string);
     property Dialog: string            read FDialog         write SetDialog;
+    property DialogDisplayName: string read FDialogDisplayName write FDialogDisplayName;
     property DisplayGroup: Integer     read FDisplayGroup   write FDisplayGroup;
     property CopyOrder:    string      read FCopyOrder      write SetCopyOrder;
@@ -645,21 +647,33 @@
   if CopyOrder <> '' then DupORIFN := CopyOrder;
   //if {(CopyOrder <> '') or} (EditOrder <> '') then Exit;  // only check new orders
-  with FResponseList do for i := 0 to Count - 1 do with TResponse(Items[i]) do
-    if (PromptID = 'ORDERABLE') or (PromptID = 'ADDITIVE') then
-    begin
-      OrderableIEN := IValue;
-      TheInstance := Instance;
-      PkgPart := '';
-      if AFillerID = 'LR' then PkgPart := '^LR^' + IValueFor('SPECIMEN', TheInstance);
-      if (AFillerID = 'PSI') or (AFillerID = 'PSO') or (AFillerID = 'PSH')
-        then PkgPart := U + AFillerID + U + IValueFor('DRUG', TheInstance);
-        // was -- then PkgPart := '^PS^' + IValueFor('DRUG', TheInstance);
-      if AFillerID = 'PSIV' then
+  with FResponseList do
+    for i := 0 to FResponseList.Count - 1 do
       begin
-        if PromptID = 'ORDERABLE' then PkgPart := '^PSIV^B;' + IValueFor('VOLUME', TheInstance);
-        if PromptID = 'ADDITIVE'  then PkgPart := '^PSIV^A';
+        with TResponse(Items[i]) do
+          begin
+            if (PromptID = 'ORDERABLE') or (PromptID = 'ADDITIVE') then
+              begin
+                OrderableIEN := IValue;
+                TheInstance := Instance;
+                PkgPart := '';
+                if AFillerID = 'LR' then PkgPart := '^LR^' + IValueFor('SPECIMEN', TheInstance);
+                if (AFillerID = 'PSI') or (AFillerID = 'PSO') or (AFillerID = 'PSH') or (AFillerID = 'PSNV')
+                  then PkgPart := U + AFillerID + U + IValueFor('DRUG', TheInstance);
+                // was -- then PkgPart := '^PS^' + IValueFor('DRUG', TheInstance);
+                if AFillerID = 'PSIV' then
+                  begin
+                    if PromptID = 'ORDERABLE' then PkgPart := '^PSIV^B;' + IValueFor('VOLUME', TheInstance);
+                    if PromptID = 'ADDITIVE'  then PkgPart := '^PSIV^A';
+                  end;
+                AList.Add(OrderableIEN + PkgPart);
+              end;
+            //AGP IV CHANGES
+            if (AFillerID = 'PSI') or (AFillerID = 'PSO') or (AFillerID = 'PSH') or (AFillerID = 'PSIV') or (AFillerID = 'PSNV') then
+              begin
+                IF PromptID = 'COMMENT' then continue;
+                Alist.Add(AFillerID + U + PromptID + U + InttoStr(Instance) + U + IValueFor(PromptID, Instance) + U + EValueFor(PromptID, Instance));
+              end;
       end;
-      AList.Add(OrderableIEN + PkgPart);
-    end;
+  end;
   AStartDtTm := IValueFor('START', 1);
 end;
@@ -1138,4 +1152,11 @@
     ExpandOrderObjects(tmp, HasObjects);
     FOrderContainsObjects := FOrderContainsObjects or HasObjects;
+    
+    if frmODBase.FAbortOrder then
+    begin
+      SetTemplateDialogCanceled(FALSE);
+      Exit;
+    end;
+
     if IEN <> 0 then
       begin
@@ -1155,4 +1176,6 @@
       CheckBoilerplate4Fields(tmp, cptn);
     List.Text := tmp;
+    if WasTemplateDialogCanceled then frmODBase.FAbortOrder := True;
+
   end;
 
@@ -1301,4 +1324,6 @@
 {Caller needs to set pnlMessage.TabOrder}
 begin
+  //TDP - Added pnlMessage.Caption for screen reader readability
+  pnlMessage.Caption := 'Informational Message.';
   memMessage.Lines.SetText(PChar(AMessage));
   //begin CQ: 2640
@@ -1323,4 +1348,5 @@
   FOrderAction := OrderAction;
   FAbortOrder := False;
+  SetTemplateDialogCanceled(False);   //wat/jh CQ 20061
   case OrderAction of
   ORDER_NEW:   {nothing};
@@ -1468,5 +1494,5 @@
     StatusText('Order Checking...');
     Responses.BuildOCItems(OIList, StartDtTm, FillerID);
-    OrderChecksOnAccept(Responses.OrderChecks, FillerID, StartDtTm, OIList, DupORIFN);
+    OrderChecksOnAccept(Responses.OrderChecks, FillerID, StartDtTm, OIList, DupORIFN,'0');
     DupORIFN := '';
     StatusText('');
@@ -1490,6 +1516,6 @@
 begin
   Result := True;
+  IsDelayOrder := False;
   Validate(ErrMsg);
-  IsDelayOrder := False;
   if Length(ErrMsg) > 0 then
   begin
@@ -1500,4 +1526,10 @@
   if not AcceptOrderChecks then
   begin
+    //added code to shut CPRS down without access violations if the fOCAccept is open when timing out.
+    if frmFrame.TimedOut then
+      begin
+         Result := False;
+         Exit;
+      end;
     if AskAnotherOrder(DialogIEN) then
         InitDialog           // ClearDialogControls is in InitDialog
@@ -1541,6 +1573,7 @@
         else CanSign := CH_SIGN_NA;
       if NewOrder.Signature = OSS_NOT_REQUIRE then CanSign := CH_SIGN_NA;
-      if NewOrder.EventPtr <> '' then IsDelayOrder := True;
-      Changes.Add(CH_ORD, NewOrder.ID, NewOrder.Text, Responses.FViewName, CanSign,'',0, NewOrder.DGroupName, False,IsDelayOrder);
+      if (NewOrder.EventPtr <> '') and (GetEventDefaultDlg(responses.FEventIFN) <> InttoStr(Responses.QuickOrder)) then
+          IsDelayOrder := True;
+      Changes.Add(CH_ORD, NewOrder.ID, NewOrder.Text, Responses.FViewName, CanSign,'',0, NewOrder.DGroupName, False, IsDelayOrder);
 
     UBAGlobals.TargetOrderID := NewOrder.ID;
@@ -1711,5 +1744,9 @@
   //self.Responses.Cancel := False;
   if User.NoOrdering then Exit;
-  if FAbortOrder then exit;
+  if FAbortOrder then
+  begin
+    SetTemplateDialogCanceled(FALSE);
+    exit;
+  end;
   if FOrderAction in [ORDER_EDIT, ORDER_COPY] then Exit;  // don't invoke verify dialog
   if FOrderAction = ORDER_QUICK then Exit;                // should this be here??
