Index: cprs/branches/foia-cprs/CPRS-Chart/Orders/fOrdersSign.pas
===================================================================
--- cprs/branches/foia-cprs/CPRS-Chart/Orders/fOrdersSign.pas	(revision 459)
+++ cprs/branches/foia-cprs/CPRS-Chart/Orders/fOrdersSign.pas	(revision 460)
@@ -114,5 +114,5 @@
 uses
   Hash, rCore, rOrders, uConst, fOrdersPrint, uCore, uOrders, uSignItems, fOrders,
-  fPCELex, rPCE, fODConsult, fBALocalDiagnoses;
+  fPCELex, rPCE, fODConsult, fBALocalDiagnoses, fClinicWardMeds, fFrame;
 
 const
@@ -208,4 +208,5 @@
   cProvDUZ: Int64;
   OrderText: string;
+  PrintLoc: Integer;
  // tempOrderID: string;
 
@@ -251,6 +252,5 @@
   Result := False;
   DigSigErr := True;
-  DigStoreErr := False;
-  Obj := Nil;
+  PrintLoc := 0;
   if SelectedList.Count = 0 then Exit;
   if BILLING_AWARE then
@@ -418,8 +418,24 @@
           if SignList.Count > 0 then
           begin
+
+          //hds7591  Clinic/Ward movement.  Patient Admission IMO
+          if not frmFrame.TimedOut then
+          begin
+             if IsValidIMOLoc(uCore.TempEncounterLoc,Patient.DFN) then
+                frmClinicWardMeds.ClinicOrWardLocation(SignList, Encounter.Location,uCore.Encounter.LocationName, PrintLoc)
+             else
+                if (IsValidIMOLoc(Encounter.Location,Patient.DFN)) and ((frmClinicWardMeds.rpcIsPatientOnWard(patient.DFN)) and (Patient.Inpatient = false)) then
+                   frmClinicWardMeds.ClinicOrWardLocation(SignList, Encounter.Location,Encounter.LocationName, PrintLoc);
+          end;
+          uCore.TempEncounterLoc := 0;
+          uCore.TempEncounterLocName := '';
+          //hds7591  Clinic/Ward movement  Patient Admission IMO
+
             SigItems.SaveSettings; // Save CoPay FIRST!
             SendOrders(SignList, frmSignOrders.ESCode);
-          end;
-          with SignList do if Count > 0 then for i := 0 to Count - 1 do
+
+        end;
+
+            with SignList do if Count > 0 then for i := 0 to Count - 1 do
             begin
               if Pos('E', Piece(SignList[i], U, 2)) > 0 then
@@ -443,5 +459,5 @@
               if theSts = 10 then  SignList.Delete(cnt);  //signed delayed order should not be printed.
           end;
-          PrintOrdersOnSignRelease(SignList, NO_PROVIDER);
+          PrintOrdersOnSignRelease(SignList, NO_PROVIDER, PrintLoc);
         finally
           SignList.Free;
@@ -505,8 +521,4 @@
 
 procedure TfrmSignOrders.cmdOKClick(Sender: TObject);
-{Begin BillingAware}
-var
-   BABillingRecs: TStringList;
-{End BillingAware}
 const
   TX_NO_CODE  = 'An electronic signature code must be entered to sign orders.';
@@ -519,12 +531,5 @@
 begin
   inherited;
-{Begin BillingAware}
-  if  BILLING_AWARE then
-  begin
-      BABillingRecs := TStringList.Create;
-      BABillingRecs.Clear;
-  end;
-{End BillingAware}
- 
+
   if txtESCode.Visible and (Length(txtESCode.Text) = 0) then
   begin
@@ -545,5 +550,6 @@
   begin
     if SigItems.OK2SaveSettings then
-      if Not BADxEntered then   //  if Dx have been entered and OK is pressed
+   
+      if Not UBACore.BADxEntered then   //  if Dx have been entered and OK is pressed
          begin                     // billing data will be saved. otherwise error message!
             InfoBox(TX_NO_DX, 'Sign Orders', MB_OK);
@@ -781,5 +787,4 @@
     begin
        //Billing Awareness 'flyover' hint includes Dx code(s) when Dx code(s) have been assigned to an order
-           thisRec := TBADxRecord.Create;
            thisOrderID := TChangeItem(fOrdersSign.frmSignOrders.clstOrders.Items.Objects[Itm]).ID;
 
@@ -909,5 +914,4 @@
 {Begin BillingAware}
 
-  numSelected := 0;
   match := false;
   allBlank := false;
@@ -1264,6 +1268,5 @@
   j: integer; //CQ5054
 begin
-   //if BILLING_AWARE then
-    //begin
+
        if FOSTFHintWndActive then
        begin
@@ -1290,6 +1293,4 @@
            //end CQ5054
        end;
-
-    //end  //if BILLING_AWARE
 end;
 
@@ -1315,7 +1316,4 @@
         end;
   end;
-
-   x := 0;
-   y := 0;
 
   try
@@ -1398,13 +1396,10 @@
 begin
    try
-      if BILLING_AWARE then
-         begin
-           if FOSTFhintWndActive then
-              begin
-              FOSTFhintWindow.ReleaseHandle;
-              FOSTFHintWndActive := False;
-              Application.ProcessMessages;
-              end;
-         end;
+      if FOSTFhintWndActive then
+      begin
+         FOSTFhintWindow.ReleaseHandle;
+         FOSTFHintWndActive := False;
+         Application.ProcessMessages;
+      end;
   except
      on E: Exception do
@@ -1518,10 +1513,11 @@
 procedure TfrmSignOrders.FormatListForScreenReader;
 var
-  ListStateOn : boolean;
+  ListStateOn : longbool;
+  Success: longbool;
 begin
   //Determine if a screen reader is currently being used.
-  SystemParametersInfo(SPI_GETSCREENREADER, 0, @ListStateOn,0);
-  if ListStateOn then
-    SetItemTextToState
+  Success := SystemParametersInfo(SPI_GETSCREENREADER, 0, @ListStateOn,0);
+  if Success and ListStateOn then
+    SetItemTextToState;
 end;
 
