Index: cprs/branches/foia-cprs/CPRS-Chart/uSignItems.pas
===================================================================
--- cprs/branches/foia-cprs/CPRS-Chart/uSignItems.pas	(revision 459)
+++ cprs/branches/foia-cprs/CPRS-Chart/uSignItems.pas	(revision 460)
@@ -1,3 +1,3 @@
-unit uSignItems;
+      unit uSignItems;
 
 {.$define debug}
@@ -13,5 +13,5 @@
                   siEnvironmentalContaminants, siMST, siHeadNeckCancer, siCombatVeteran);
 
-  TSigItemTagInfo = record
+  TSigItemTagInfo =  record
     SigType: TSigItemType;
     Index: integer;
@@ -42,4 +42,5 @@
     function  FindCBValues(ATag: integer): TORCheckBox;
     function  GetTempCkBxState(Index: integer; CBValue:TSigItemType): string;
+    
   protected
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
@@ -61,4 +62,5 @@
     procedure CopyCB(FromIndex, ToIndex: integer); //BAPHII 1.3.1
     procedure SetSigItems(Sender: TObject; sourceOrderID: string); //BAPHII 1.3.1
+    //procedure SetSigItems(Sender: TObject; itemsList: TStringList; sourceOrderID: string); //BAPHII 1.3.1
     function ItemToTag(Info: TSigItemTagInfo): integer; //CQ5074
     function TagToItem(ATag: integer): TSigItemTagInfo; //CQ5074
@@ -70,6 +72,6 @@
 const
 
-  TC_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered, '+#13+
-                   'and at least one diagnosis selected for each order that requires a diagnosis.';
+  TC_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered.';
+
 
   TX_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered, '+#13+
@@ -128,12 +130,9 @@
   BaseFlags: string;
   tempCkBx: TORCheckBox;
-  thisOrderID: string; //BAPHII 1.3.2
+  thisOrderID: string;
   thisChangeItem: TChangeItem;
 
 
 function TSigItems.GetSigItems : TORStringList;
-{
- BAPHII 1.3.1
-}
 begin
   Result := FItems;
@@ -141,7 +140,4 @@
 
 function TSigItems.FindCB(ATag: integer): TORCheckBox;
-{
- BAPHII 1.3.1
-}
 var
   i: integer;
@@ -161,7 +157,4 @@
 
 procedure TSigItems.CopyCB(FromIndex, ToIndex: integer);
-{
- BAPHII 1.3.1
-}
 var
   si: TSigItemType;
@@ -232,34 +225,10 @@
 var
   idx: integer;
-  i,j: integer;
 begin
   if ItemType = CH_ORD then
   begin
-
     idx := FItems.IndexOfPiece(ID);
-
     if idx < 0 then
       idx := FItems.Add(ID);
-
-      // when an order has not been sent to the server and is deleted
-      // or discontinued the treatment factors remain from the original order,
-      // this will clear the treatment factors, which will be set based on HIMS
-      if BILLING_AWARE then
-      begin
-         if UBAGlobals.BADeltedOrders.Count > 0 then
-         begin
-            for i := 0 to FItems.Count-1 do
-            begin
-               for j := 0 to UBAGlobals.BADeltedOrders.Count-1 do
-               begin
-                  if (Piece(fItems.Strings[i],U,1) = UBAGlobals.BADeltedOrders.Strings[j] ) then
-                  begin
-                     fItems.Strings[i] := UBAGlobals.BADeltedOrders.Strings[j];
-                     UBAGlobals.BADeltedOrders.Clear;
-                  end;
-               end;
-            end;
-         end;
-     end;
     FItems.SetStrPiece(idx, 2, IntToStr(Index));
     FItems.SetStrPiece(idx,5,INIT_STR);    // hds4807 value was being reatained when same order selected in FReview.
@@ -424,10 +393,9 @@
        if idx > 0 then
           begin
-          if  BILLING_AWARE then
-              rpcGetSC4Orders
+         if  BILLING_AWARE then
+              rpcGetSC4Orders // get SC/EIC information for all CIDC TYPE orders
           else
-             GetCoPay4Orders;
-
-            for i := 0 to RPCBrokerV.Results.Count-1 do
+             GetCoPay4Orders;   // enforces existing NON CIDC CO-PAY rules
+             for i := 0 to RPCBrokerV.Results.Count-1 do
                begin
                   s := RPCBrokerV.Results[i];
@@ -479,5 +447,5 @@
 
                      FItems.SetStrPiece(idx, 4, Flags);
-                      // new code  gary  if deleted order and ba on then
+                      // new code  if deleted order and ba on then
                       // reset appropriate tf flags to "?".
 
@@ -524,5 +492,5 @@
     for si := low(TSigItemType) to high(TSigItemType) do
       StsUsed[si] := FALSE;
-
+    //  loop thru orders selected to be signed fReview/fOrdersSign.
     for i := 0 to FItems.Count-1 do
        begin
@@ -531,5 +499,8 @@
          if (piece(s,u,2) <> '-1') and (piece(s,u,3) = '1') then
             begin
-            s := piece(s, u, 4);
+             s := piece(s, u, 4); // SC/EI
+             // code added 01/17/2006 - check dc'd nurse orders, originals where requiring CIDC if assigned to patient.
+             if (BILLING_AWARE) and (not UBACore.IsOrderBillable(Piece(s,U,1))) then
+               s :=  NA_FLAGS;
 
             for si := low(TSigItemType) to high(TSigItemType) do
@@ -646,5 +617,5 @@
                         begin
                         Flags := piece(s,u,4);
-
+                                                 //loop thru treatment factors
                         for sx := low(TSigItemType) to high(TSigItemType) do
                            begin
