Ignore:
Timestamp:
Jul 7, 2010, 4:51:54 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrading to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/uSignItems.pas

    r456 r830  
    1111type
    1212  TSigItemType = (siServiceConnected, siAgentOrange, siIonizingRadiation,
    13                   siEnvironmentalContaminants, siMST, siHeadNeckCancer, siCombatVeteran);
     13                  siEnvironmentalContaminants, siMST, siHeadNeckCancer, siCombatVeteran, siSHAD);
    1414
    1515  TSigItemTagInfo =  record
     
    3333    FcbX: array[TSigItemType] of integer;
    3434    function TagInfo(ASigType: TSigItemType; AIndex: integer): TSigItemTagInfo;
    35     //function ItemToTag(Info: TSigItemTagInfo): integer;
    36     //function TagToItem(ATag: integer): TSigItemTagInfo;
    3735    procedure cbClicked(Sender: TObject);
    3836    procedure cbEnter(Sender: TObject);
     
    4240    function  FindCBValues(ATag: integer): TORCheckBox;
    4341    function  GetTempCkBxState(Index: integer; CBValue:TSigItemType): string;
    44    
     42
    4543  protected
    4644    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
     
    6260    procedure CopyCB(FromIndex, ToIndex: integer); //BAPHII 1.3.1
    6361    procedure SetSigItems(Sender: TObject; sourceOrderID: string); //BAPHII 1.3.1
    64     //procedure SetSigItems(Sender: TObject; itemsList: TStringList; sourceOrderID: string); //BAPHII 1.3.1
    6562    function ItemToTag(Info: TSigItemTagInfo): integer; //CQ5074
    6663    function TagToItem(ATag: integer): TSigItemTagInfo; //CQ5074
     64
    6765  end;
    6866
    6967function SigItems: TSigItems;
    7068function SigItemHeight: integer;
     69function  GetAllBtnLeftPos: integer;
    7170
    7271const
    73 
    74   TC_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered.';
    75 
     72  SIG_ITEM_VERTICAL_PAD = 2;
     73
     74  TC_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered, '+#13+
     75                   'and at least one diagnosis selected for each order that requires a diagnosis.';
    7676
    7777  TX_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered, '+#13+
     
    8686  uSigItems: TSigItems = nil; //BAPHII 1.3.1
    8787
     88
    8889implementation
    8990
    9091uses
    9192  ORFn, ORNet, uConst, TRPCB, rOrders, rPCE, fOrdersSign, fReview,UBAGlobals,
    92   uCore ;
     93  uCore , VAUtils;
    9394
    9495type
     
    101102        { siAgentOrange               }  ('AO',  'Agent Orange Exposure'),
    102103        { siIonizingRadiation         }  ('IR',  'Ionizing Radiation Exposure'),
    103         { siEnvironmentalContaminants }  ('EC',  'Environmental Contaminants'),
     104        { siEnvironmentalContaminants }  ('SWAC','Southwest Asia Conditions'),
    104105        { siMST                       }  ('MST', 'MST'), //'Military Sexual Trauma'
    105106        { siHeadNeckCancer            }  ('HNC', 'Head and/or Neck Cancer'),
    106         { siCombatVeteran             }  ('CV',  'Combat Veteran Related'));
     107        { siCombatVeteran             }  ('CV',  'Combat Veteran Related'),
     108        { siSHAD                      }  ('SHD', 'Shipboard Hazard and Defense'));
    107109
    108110  SigItemDisplayOrder: array[TSigItemType] of TSigItemType =
     
    112114        siIonizingRadiation,
    113115        siEnvironmentalContaminants,
     116        siSHAD,
    114117        siMST,
    115         siHeadNeckCancer );
     118        siHeadNeckCancer);
    116119
    117120  StsChar: array[ItemStatus] of char =
     
    123126  ColIdx = 30000;
    124127  AllIdx = 31000;
    125   NA_FLAGS = 'NNNNNNN';
     128  NA_FLAGS = 'NNNNNNNN';
    126129
    127130var
     
    132135  thisOrderID: string;
    133136  thisChangeItem: TChangeItem;
     137  AllBtnLeft: integer;
    134138
    135139
     
    175179
    176180procedure TSigItems.SetSigItems(Sender: TObject; sourceOrderID: string);
    177 {
    178  BAPHII 1.3.1
    179 }
    180181var
    181182  i: integer;
     
    212213function SigItemHeight: integer;
    213214begin
    214   Result := MainFontHeight + 2;
    215 end;
     215  Result := MainFontHeight + 2 + SIG_ITEM_VERTICAL_PAD;
     216end;
     217
     218function  GetAllBtnLeftPos: integer;
     219 begin
     220  Result := uSignItems.AllBtnLeft;
     221 end;
     222
    216223
    217224{ TSigItems }
     
    264271var
    265272  idx: integer;
    266 
    267273begin
    268274  if ItemType = CH_ORD then
     
    277283var
    278284  i: integer;
    279 
    280285begin
    281286  for i := 0 to FItems.Count-1 do
     
    334339  FirstValidItem: TSigItemType;
    335340  x, y, MaxX, i, btnW, btnH, j, dx, ht, idx, dgrp: integer;
    336   s, id, Code, cType, Flags: string;
     341  s, id, Code, cType, Flags,OrderStatus,CVFlag,ChangedFlags: string;
     342
    337343  StsCode: char;
    338344  sx, si: TSigItemType;
     
    340346  StsUsed: array[TSigItemType] of boolean;
    341347  AResponses : TResponses;
    342   UFlags: string;
     348  UFlags,HoldFlags: string;
    343349  thisCB: TORCheckBox;
    344350  cpFlags: string;
     
    349355
    350356  function CreateCB(AParent: TWinControl): TORCheckBox;
    351      begin
     357  begin
    352358     Result := TORCheckBox.Create(ownr);
    353359     Result.Parent := AParent;
     
    359365     Result.OnEnter := cbEnter;
    360366     Result.OnExit := cbExit;
     367     UpdateColorsFor508Compliance(Result);
    361368     Fcb.Add(Result);
    362      end;
     369  end;
    363370
    364371begin
     
    393400       if idx > 0 then
    394401          begin
    395          if  BILLING_AWARE then
    396               rpcGetSC4Orders // get SC/EIC information for all CIDC TYPE orders
    397           else
    398              GetCoPay4Orders;   // enforces existing NON CIDC CO-PAY rules
    399              for i := 0 to RPCBrokerV.Results.Count-1 do
     402            rpcGetSC4Orders;
     403            for i := 0 to RPCBrokerV.Results.Count-1 do
    400404               begin
    401405                  s := RPCBrokerV.Results[i];
     
    405409                  if (CharAt(piece(s,';',2),1) <> '1') then
    406410                    s := piece(s,U,1);
    407                 end;
    408                  id := piece(s,U,1);
    409                  idx := FItems.IndexOfPiece(id);
    410 
    411                  if idx >= 0 then
    412                     begin
     411                end;  {End BillingAware }
     412                id := piece(s,U,1);
     413                idx := FItems.IndexOfPiece(id);
     414
     415                if idx >= 0 then
     416                begin
    413417                    FItems.SetStrPiece(idx, 3, '1'); // Mark as read from RPC
    414418                    j := 2;
    415419                    Flags := BaseFlags;
    416 
    417                        repeat
     420                     repeat
    418421                         Code := piece(s,U,j);
    419 
     422                         if Code = 'EC' then Code := 'SWAC';  // CQ:15431  ; resolve issue of displaying SWAC vs EC.
    420423                         if Code <> '' then
    421424                            begin
     
    449452                      // new code  if deleted order and ba on then
    450453                      // reset appropriate tf flags to "?".
    451 
    452454
    453455                     if BILLING_AWARE then
     
    489491
    490492    FStsCount := 0;
     493    AllBtnLeft := 0;
    491494
    492495    for si := low(TSigItemType) to high(TSigItemType) do
     
    500503            begin
    501504             s := piece(s, u, 4); // SC/EI
    502              // code added 01/17/2006 - check dc'd nurse orders, originals where requiring CIDC if assigned to patient.
     505            // code added 01/17/2006 - check dc'd nurse orders,
     506            // originals where requiring CIDC if assigned to patient.
    503507             if (BILLING_AWARE) and (not UBACore.IsOrderBillable(Piece(s,U,1))) then
    504508               s :=  NA_FLAGS;
     
    506510            for si := low(TSigItemType) to high(TSigItemType) do
    507511              if (not StsUsed[si]) and (s[ord(si)+1] <> StsChar[isNA]) then
    508                 begin
     512              begin
    509513                StsUsed[si] := TRUE;
    510514                inc(FStsCount);
    511515                if FStsCount >= FlagCount then break;
    512                 end;
     516              end;
    513517            end;
    514518
     
    537541
    538542         for si := low(TSigItemType) to high(TSigItemType) do
    539             begin
     543         begin
    540544            j := lb.Canvas.TextWidth(SigItemDesc[si, sdShort]);
    541545            if btnW < j then
    542546             btnW := j;
    543             end;
     547         end;
    544548
    545549         inc(btnW, 8);
     
    549553
    550554         for si := high(TSigItemType) downto low(TSigItemType) do
    551             begin
     555         begin
    552556            FcbX[si] := x - btnW + dx;
    553557            dec(x, btnW + btnGap);
    554             end;
     558         end;
    555559         
    556560         if FStsCount > 1 then
    557            begin
     561         begin
    558562           FAllCatCheck := FALSE;
    559563           btn := TButton.Create(ownr);
     
    564568           btn.OnClick := cbClicked;
    565569           btn.Left := FcbX[TSigItemType(0)] + lb.Left - dx + 2 - (FcbX[TSigItemType(1)] - FcbX[TSigItemType(0)]);
     570           AllBtnLeft := btn.left;
    566571           btn.Top := lb.Top - btn.height - 2;
    567572           btn.Tag := AllIdx;
     
    569574           btn.Hint := 'Set All Related Entries';
    570575           btn.TabOrder := lb.TabOrder;
     576           UpdateColorsFor508Compliance(btn);
    571577           Fcb.Add(btn);
    572            end;
     578         end;
    573579
    574580         for sx := low(TSigItemType) to high(TSigItemType) do
    575             begin
     581         begin                                                // print buttons on header of columns ie SC,AO,IR, etc....
    576582            si := SigItemDisplayOrder[sx];
    577583            FAllCheck[si] := TRUE;
     
    590596            //tab order before listbox but after previous buttons.
    591597            btn.TabOrder := lb.TabOrder;
     598            UpdateColorsFor508Compliance(btn);
    592599            Fcb.Add(btn);
    593             end;
     600         end;
    594601
    595602            FValidGap := ((FcbX[succ(TSigItemType(0))] - FcbX[TSigItemType(0)] - cbWidth) div 2) + 1;
     
    599606            try
    600607              ht := SigItemHeight;
    601               FDy := ((ht - cbHeight) div 2);
     608              FDy := ((ht - cbHeight) div 2)+1;
    602609              y := lb.TopIndex;
    603610              FOldDrawItemEvent := TExposedListBox(lb).OnDrawItem;
     
    608615              for i := 0 to FItems.Count-1 do
    609616                  begin
    610                   s := FItems[i];
    611                  
     617                    s := FItems[i];
     618                    orderStatus := (Piece(s,u,1));
    612619                  if piece(s,u,3) = '1' then
    613620                     begin
    614                      idx := StrToIntDef(piece(s,U,2),-1);
     621                       idx := StrToIntDef(piece(s,U,2),-1);
    615622
    616623                     if idx >= 0 then
    617                         begin
     624                     begin
    618625                        Flags := piece(s,u,4);
    619                                                  //loop thru treatment factors
     626                          //loop thru treatment factors
    620627                        for sx := low(TSigItemType) to high(TSigItemType) do
    621628                           begin
    622                            si := SigItemDisplayOrder[sx];
    623                            StsCode := Flags[ord(si)+1];
    624                            StsIdx := isNA;
     629                             si := SigItemDisplayOrder[sx];
     630                             StsCode := Flags[ord(si)+1];
     631                             StsIdx := isNA;
    625632
    626633                           for sts := low(ItemStatus) to high(ItemStatus) do
    627634                              if StsCode = StsChar[sts] then
    628635                                 begin
    629                                  StsIdx := sts;
    630                                  Break;
     636                                   StsIdx := sts;
     637                                   Break;
    631638                                 end;
    632639
     
    653660                                     end;
    654661                                 //end CQ3301/3302
    655 
    656                                //PATCH: Added OR_3_215v26_70 11/07/2007 jb
    657                                         // GWOT - CV Default to Yes.
    658                                         if ( (si = siCombatVeteran) and (StsIdx = isUnKnown) ) then
    659                                          begin
    660                                                 StsIdx := isChecked;
    661                                       Flags[7] := 'C';                  // HD200866 default as Combat Related - GWOT mandated Change
    662                                       FItems.SetStrPiece(i, 4, Flags);  // HD200866 default as Combat Related - GWOT mandated Change
    663                                    end;
    664                               //End Patch
    665 
     662                                  if ( (si = siCombatVeteran) and (StsIdx = isUnKnown) ) then
     663                                  begin
     664                                     StsIdx := isChecked;
     665                                     Flags[7] := 'C';                  // HD200866 default as Combat Related - GWOT mandated Change
     666                                     FItems.SetStrPiece(i, 4, Flags);  // HD200866 default as Combat Related - GWOT mandated Change
     667                                  end;
    666668                                 case StsIdx of
    667669                                   isChecked:   cb.State := cbChecked;
     
    691693  on ERangeError do
    692694  begin
    693      ShowMessage('ERangeError in UpdateListBox' + s);
     695     ShowMsg('ERangeError in UpdateListBox' + s);
    694696  raise;
    695697  end;
     
    802804
    803805begin
    804         DrawGrid := (Index < flb.Items.Count);
    805         if DrawGrid and (trim(Flb.Items[Index]) = '') and
    806                         (Index = (flb.Items.Count - 1)) then
    807           DrawGrid := FALSE;
    808         if DrawGrid then
    809           dec(Rect.Bottom);
    810         OldRect := Rect;
    811 
    812         Rect.Right := FlastValidX - 4;
    813       {Begin BillingAware}
    814         if  BILLING_AWARE then Rect.Right := FLastValidX - 55;
    815       {End BillingAware}
    816 
    817         if assigned(FOldDrawItemEvent) then
    818           FOldDrawItemEvent(Control, Index, Rect, State)
    819         else
    820            begin
    821            Flb.Canvas.FillRect(Rect);
    822            if Index < flb.Items.Count then
    823              Flb.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top, FilteredString(Flb.Items[Index]));
    824            end;
    825 
    826         if DrawGrid then
    827            begin
    828              Flb.Canvas.Pen.Color := clBtnFace;
    829              Flb.Canvas.MoveTo(Rect.Left, Rect.Bottom);
    830              Flb.Canvas.LineTo(OldRect.RIght, Rect.Bottom);
    831            end;
    832 
    833         if  BILLING_AWARE then OldRect.Left := Rect.Right + 90
    834         else OldRect.Left := Rect.Right;
    835 
    836        //// SC Column
    837         Flb.Canvas.FillRect(OldRect);
    838         for i := 0 to Fcb.Count-1 do
    839            begin
    840              cb := TORCheckBox(Fcb[i]);
    841 
    842              if TagToItem(cb.Tag).Index = Index then
    843                 begin
    844                   cb.Invalidate;
    845                   cb.Top := Rect.Top + FDy;
    846                 end;
    847            end;
    848 
    849         // EI Columns
    850         if DrawGrid then
    851         begin
    852           for si := low(TSigItemType) to high(TSigItemType) do
     806  DrawGrid := (Index < flb.Items.Count);
     807  if DrawGrid and (trim(Flb.Items[Index]) = '') and
     808                  (Index = (flb.Items.Count - 1)) then
     809    DrawGrid := FALSE;
     810  if DrawGrid then
     811    dec(Rect.Bottom);
     812  OldRect := Rect;
     813
     814  Rect.Right := FlastValidX - 4;
     815{Begin BillingAware}
     816  if  BILLING_AWARE then Rect.Right := FLastValidX - 55;
     817{End BillingAware}
     818
     819  if assigned(FOldDrawItemEvent) then
     820  begin
     821    inc(Rect.Bottom);
     822    FOldDrawItemEvent(Control, Index, Rect, State);
     823    dec(Rect.Bottom);
     824  end
     825  else
     826     begin
     827     Flb.Canvas.FillRect(Rect);
     828     if Index < flb.Items.Count then
     829       Flb.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top, FilteredString(Flb.Items[Index]));
     830     end;
     831
     832  if DrawGrid then
     833     begin
     834       Flb.Canvas.Pen.Color := Get508CompliantColor(clSilver);
     835       Flb.Canvas.MoveTo(Rect.Left, Rect.Bottom);
     836       Flb.Canvas.LineTo(OldRect.RIght, Rect.Bottom);
     837     end;
     838
     839  if  BILLING_AWARE then OldRect.Left := Rect.Right + 90
     840  else OldRect.Left := Rect.Right;
     841
     842 //// SC Column
     843 ///
     844  Flb.Canvas.FillRect(OldRect);
     845  for i := 0 to Fcb.Count-1 do
     846     begin
     847       cb := TORCheckBox(Fcb[i]);
     848
     849       if TagToItem(cb.Tag).Index = Index then
    853850          begin
    854             if FcbX[si] > FLastValidX then
    855             begin
    856               Flb.Canvas.MoveTo(FcbX[si] - FValidGap, Rect.Top);
    857               Flb.Canvas.LineTo(FcbX[si] - FValidGap, Rect.Bottom);
    858             end;
     851            cb.Invalidate;
     852            cb.Top := Rect.Top + FDy;
    859853          end;
    860         end;
    861 
     854     end;
     855
     856  // EI Columns
     857  if DrawGrid then
     858  begin
     859    for si := low(TSigItemType) to high(TSigItemType) do
     860    begin
     861      if FcbX[si] > FLastValidX then
     862      begin
     863        Flb.Canvas.MoveTo(FcbX[si] - FValidGap, Rect.Top);
     864        Flb.Canvas.LineTo(FcbX[si] - FValidGap, Rect.Bottom);
     865      end;
     866    end;
     867  end;
    862868end;
    863869
     
    913919          BAOrderList := TStringList.Create;
    914920          BAOrderList.Clear;
    915     end;
     921       end;
    916922{End BillingAware}
    917923  end;
     
    9991005        Index := StrToInt(Piece(FactorsOut.Strings[y],U,1));
    10001006        CopyCBValues(Index,Index);
    1001         end;
     1007     end;
    10021008end;
    10031009
     
    10291035          end;
    10301036       end; //for
    1031 
    1032 end;
     1037  end;
    10331038
    10341039function TSigItems.FindCBValues(ATag: integer):TORCheckBox;
     
    10711076     on EAccessViolation do
    10721077        begin
    1073         {$ifdef debug}ShowMessage('EAccessViolation in uSignItems.GetTempCkBxState()');{$endif}
     1078        {$ifdef debug}Show508Message('EAccessViolation in uSignItems.GetTempCkBxState()');{$endif}
    10741079        raise;
    10751080        end;
     
    10831088  BaseFlags := StringOfChar(StsChar[isNA], FlagCount);
    10841089  thisChangeItem := TChangeItem.Create; //CQ3301/3302
     1090  AllBtnLeft := 0;
    10851091
    10861092finalization
Note: See TracChangeset for help on using the changeset viewer.