Index: cprs/trunk/CPRS-Chart/BA/UBACore.pas
===================================================================
--- cprs/trunk/CPRS-Chart/BA/UBACore.pas	(revision 456)
+++ cprs/trunk/CPRS-Chart/BA/UBACore.pas	(revision 829)
@@ -112,10 +112,10 @@
   end;
 
-   BAOrderList.Assign(holdOrderList); //assign signable orders to BAOrderList for further processing
+   FastAssign(holdOrderList, BAOrderList); //assign signable orders to BAOrderList for further processing
    holdOrderList.Clear; // CQ5025
 
     //call with passList determine if LRMP
      if rpcOrderRequiresDx(passList) then
-      BAOrderList.Assign(updatedBAOrderList);
+      FastAssign(updatedBAOrderList, BAOrderList);
 
     // check of all orders dx columns are flagged with N/A.....
@@ -165,5 +165,5 @@
     end
     else
-       updatedList.Assign(pList);
+       FastAssign(pList, updatedList);
 
     // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0
@@ -213,5 +213,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.IsOrderBillable()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.IsOrderBillable()');{$endif}
         raise;
         end;
@@ -334,4 +334,5 @@
         begin
            // Verify Patient is Insured
+           // OR Switch = 2 ask questions for all patients.
            if  rpcIsPatientInsured(pPatientDFN)  then
               BILLING_AWARE := TRUE;
@@ -407,5 +408,5 @@
        on EListError do
        begin
-         {$ifdef debug}ShowMessage('EListError in UBACore.rpcSaveBillingDxEntered()');{$endif}
+         {$ifdef debug}Show508Message('EListError in UBACore.rpcSaveBillingDxEntered()');{$endif}
          raise;
      end;
@@ -419,4 +420,9 @@
 procedure rpcGetSC4Orders;
 begin
+//  ****** RPC Logic returning SC/TF codes for COPAY  ********
+//     if (CIDC is ON) and (PatientInsured is True) then
+//        return SC/TF for OutPatient Meds, Labs, Prosthetics, Imaging.
+//     else
+//       return SC/TF for Outpatient Meds only. 
    RPCBrokerV.Param[0].PType := literal;
    RPCBrokerV.Param[0].Value := Patient.DFN;
@@ -434,5 +440,5 @@
     uDxLst.Clear;
     tCallV(tmplst, 'ORWDBA2 GETDUDC', [ProviderIEN, PatientIEN]);
-    UBACore.UDxLst.Assign(tmplst);
+    FastAssign(tmplst, UBACore.UDxLst);
     tmplst.clear;
 end;
@@ -511,5 +517,5 @@
 function  rpcIsPatientInsured(pPatientDFN: string):boolean;
 begin
-   Result := (sCallV('ORWDBA7 ISWITCH',[pPatientDFN]) = '1');
+   Result := (sCallV('ORWDBA7 ISWITCH',[pPatientDFN]) > '0');
      
 end;
@@ -552,5 +558,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.OrdersHaveDx()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.OrdersHaveDx()');{$endif}
         raise;
         end;
@@ -634,5 +640,6 @@
    UBAGlobals.MST := Copy(x,5,1);
    UBAGlobals.HNC := Copy(x,6,1);
-   UBAGlobals.CV :=  Copy(x,7,1);
+   UBAGlobals.CV  := Copy(x,7,1);
+   UBAGlobals.SHD := Copy(x,8,1);
 end;
 
@@ -693,6 +700,10 @@
              UBAGlobals.HNC := 'C';
 
+       if UBAGlobals.SHD <> 'N' then
+          if StrPos(PChar(strTFactors),PChar(SHIPBOARD_HAZARD_DEFENSE)) <> nil then
+             UBAGlobals.SHD := 'C';
+
        //  Build Treatment Factor List to be passed to fOrdersSign form
-       strFlagsOut := (SC + AO + IR + EC + MST + HNC + CV);
+       strFlagsOut := (SC + AO + IR + EC + MST + HNC + CV + SHD);
        UBAGlobals.BAFlagsOUT.Add(IDX + '^' + strFlagsOut );
      end;
@@ -724,5 +735,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.AddProviderPatientDaysDx()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.AddProviderPatientDaysDx()');{$endif}
         raise;
         end;
@@ -751,5 +762,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.OrderRequiresSCEI()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.OrderRequiresSCEI()');{$endif}
         raise;
         end;
@@ -875,5 +886,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.CompleteUnsignedBillingInfo()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.CompleteUnsignedBillingInfo()');{$endif}
         raise;
         end;
@@ -898,5 +909,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.GetUnsignedOrderFlags()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.GetUnsignedOrderFlags()');{$endif}
         raise;
         end;
@@ -972,14 +983,22 @@
                  if piece(x,U,1) = COMBAT_VETERAN then
                  begin
-                  if piece(x,U,2) = '1' then
-                     UBAGlobals.BAFactorsRec.FBAFactorCV := Piece(x,U,3)
-                  else
-                     UBAGlobals.BAFactorsRec.FBAFactorCV := (UBAGlobals.BAFactorsRec.FBAFactorCV + CRLF + Piece(x,U,3) );
-               end;
-         end;
+                   if piece(x,U,2) = '1' then
+                      UBAGlobals.BAFactorsRec.FBAFactorCV := Piece(x,U,3)
+                   else
+                      UBAGlobals.BAFactorsRec.FBAFactorCV := (UBAGlobals.BAFactorsRec.FBAFactorCV + CRLF + Piece(x,U,3) );
+                 end
+                 else
+                    if piece(x,U,1) = SHIPBOARD_HAZARD_DEFENSE then
+                    begin
+                       if piece(x,U,2) = '1' then
+                          UBAGlobals.BAFactorsRec.FBAFactorSHAD := Piece(x,U,3)
+                      else
+                         UBAGlobals.BAFactorsRec.FBAFactorSHAD := (UBAGlobals.BAFactorsRec.FBAFactorSHAD + CRLF + Piece(x,U,3) );
+                  end;
+            end;
   except
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.BuileTFHintRec()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.BuileTFHintRec()');{$endif}
         raise;
         end;
@@ -1047,5 +1066,5 @@
      on EListError do
         begin
-           {$ifdef debug}ShowMessage('EListError in UBACore.ClearSelectedORdersDiagnoses()');{$endif}
+           {$ifdef debug}Show508Message('EListError in UBACore.ClearSelectedORdersDiagnoses()');{$endif}
            raise;
         end;
@@ -1133,5 +1152,5 @@
      on EListError do
         begin
-        {$ifdef debug}ShowMessage('EListError in UBACore.LoadConsultOrderRec()');{$endif}
+        {$ifdef debug}Show508Message('EListError in UBACore.LoadConsultOrderRec()');{$endif}
         raise;
         end;
@@ -1153,5 +1172,5 @@
      with thisRetVal do
      begin
-        FBAOrderID := pOrderID;
+        FBAOrderID    := pOrderID;
         FBAEligible   := pEligible;
         FBATFactors   := pTFactors;
@@ -1166,5 +1185,5 @@
   tmpOrderList: TStringList;
 begin
-    orderList := TStringList.Create;
+    orderList    := TStringList.Create;
     tmpOrderList := TStringList.Create;
     orderList.Clear;
@@ -1241,6 +1260,6 @@
     strTFactors   :=  pPLFactors;  // value selected from problem list
     strFlagsOut   := '';   // flags updated with selected values from problem list
-    x := strFlagsAsIs;
-    Result := '';
+    x             := strFlagsAsIs;
+    Result        := '';
 
     UBAGlobals.SC  := Copy(x,1,1);
@@ -1250,5 +1269,6 @@
     UBAGlobals.MST := Copy(x,5,1);
     UBAGlobals.HNC := Copy(x,6,1);
-    UBAGlobals.CV :=  Copy(x,7,1); // load factors to global vars;
+    UBAGlobals.CV  :=  Copy(x,7,1); // load factors to global vars;
+    UBAGlobals.SHD := Copy(x,8,1);
 
   if UBAGlobals.SC  <> 'N' then
@@ -1284,7 +1304,11 @@
           UBAGlobals.CV := 'C';
 
+    if UBAGlobals.SHD <> 'N' then
+       if StrPos(PChar(strTFactors),PChar(SHIPBOARD_HAZARD_DEFENSE)) <> nil then
+          UBAGlobals.SHD := 'C';
+
      strFlagsOut := (UBAGlobals.SC + UBAGlobals.AO + UBAGlobals.IR +
                      UBAGlobals.EC + UBAGlobals.MST + UBAGlobals.HNC +
-                     UBAGlobals.CV);
+                     UBAGlobals.CV + UBAGlobals.SHD);
   Result := strFlagsOut;
 end;
@@ -1385,5 +1409,5 @@
    holdList := TStringList.Create;
    holdList.Clear;
-   holdList.Assign(UBAGlobals.BACopiedOrderFlags);
+   FastAssign(UBAGlobals.BACopiedOrderFlags, holdList);
    UBAGlobals.BACopiedOrderFlags.Clear;
    for i := 0 to holdList.Count-1 do
@@ -1412,5 +1436,5 @@
       holdList := TStringList.Create;
       holdList.Clear;
-      holdList.Assign(UBAGlobals.BAConsultPLFlags);
+      FastAssign(UBAGlobals.BAConsultPLFlags, holdList);
       UBAGlobals.BAConsultPLFlags.Clear;
       for i := 0 to holdList.Count-1 do
