Ignore:
Timestamp:
Jul 6, 2008, 8:20:14 PM (16 years ago)
Author:
Kevin Toppenberg
Message:

Uploading from OR_30_258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/foia-cprs/CPRS-Chart/fPtSel.pas

    r459 r460  
    33
    44{$OPTIMIZATION OFF}                              // REMOVE AFTER UNIT IS DEBUGGED
     5
     6{$define VAA}
    57
    68interface
     
    7779    FsortAscending: boolean;
    7880    FLastPt: string;
     81    FsortDirection: string;
     82    FUserCancelled: boolean;
    7983    procedure AdjustFormSize(ShowNotif: Boolean; FontSize: Integer);
    8084    procedure ClearIDInfo;
     
    8589    procedure RPLDisplay;
    8690    procedure AlertList;
     91    procedure ReformatAlertDateTime;
    8792  public
    8893    procedure Loaded; override;
    8994  end;
    9095
    91 procedure SelectPatient(ShowNotif: Boolean; FontSize: Integer);
     96procedure SelectPatient(ShowNotif: Boolean; FontSize: Integer; var UserCancelled: boolean);
    9297
    9398var
     
    114119  AliasString = ' -- ALIAS';
    115120
    116 procedure SelectPatient(ShowNotif: Boolean; FontSize: Integer);
     121procedure SelectPatient(ShowNotif: Boolean; FontSize: Integer; var UserCancelled: boolean);
    117122{ displays patient selection dialog (with optional notifications), updates Patient object }
    118123var
     
    137142        end;
    138143      Notifications.Clear;
     144      FsortCol := -1;
    139145      AlertList;
    140146      ClearIDInfo;
    141147      if (IsRPL = '1') then                          // Deal with restricted patient list users.
    142148        RPLDisplay;                                  // Removes unnecessary components from view.
     149      FUserCancelled := FALSE;
    143150      ShowModal;
     151      UserCancelled := FUserCancelled;
    144152    end;
    145153  finally
     
    539547  if User.IsProvider then Encounter.Provider := User.DUZ;
    540548
    541   GetBAStatus(Encounter.Provider,Encounter.Location);
     549  GetBAStatus(Encounter.Provider,Patient.DFN);
    542550  //HDS00005025
    543    if BILLING_AWARE then
    544      if Assigned(UBAGLOBALS.BAOrderList) then UBAGLOBALS.BAOrderList.Clear;
     551  if BILLING_AWARE then
     552    if Assigned(UBAGLOBALS.BAOrderList) then UBAGLOBALS.BAOrderList.Clear;
     553  FUserCancelled := FALSE;
    545554  Close;
    546555end;
     
    549558begin
    550559  // Leave Patient object unchanged
     560  FUserCancelled := TRUE;
    551561  Close;
    552562end;
     
    633643        lstvAlerts.Clear;
    634644        AlertList;
     645        //display alerts sorted according to parameter settings:
     646        FsortCol := -1;     //CA - display alerts in correct sort
     647        FormShow(Sender);
    635648      end;
    636649    if Items.Count = 0 then ShowButts(False);
    637650    if SelCount <= 0 then ShowButts(False);
    638651  end;
    639   GetBAStatus(User.DUZ,Encounter.Location);
     652  GetBAStatus(User.DUZ,Patient.DFN);
    640653end;
    641654
     
    723736  lstvAlerts.Clear;
    724737  AlertList;
    725   FsortCol := 0;     //CA - display alerts in correct sort
     738  FsortCol := -1;     //CA - display alerts in correct sort
    726739  FormShow(Sender);  //CA - display alerts in correct sort
    727740  if lstvAlerts.Items.Count = 0 then ShowButts(False);
     
    805818function ConvertDate(var thisList: TStringList; listIndex: integer) : string;
    806819{
    807  CQ1075: Convert date portion from yyyy/mm/dd to mm/dd/yyyy
     820 Convert date portion from yyyy/mm/dd to mm/dd/yyyy
    808821}
    809822var
     
    887900     for I := 0 to List.Count - 1 do
    888901       begin
    889        //CQ1075: Convert date portion from yyyy/mm/dd to mm/dd/yyyy
    890        List[i] := ConvertDate(List, i);
     902    //   List[i] := ConvertDate(List, i);  //cla commented out 8/9/04 CQ #4749
    891903
    892904         if Piece(List[I], U, 1) <> 'Forwarded by: ' then
     
    929941
    930942  if ((FsortCol = Column.Index) and (not SortViaKeyboard)) then
    931         FsortAscending := not FsortAscending
     943     FsortAscending := not FsortAscending;
     944
     945  if FsortAscending then
     946     FsortDirection := 'F'
    932947  else
    933      if Column.Index = 4 then
    934         FsortAscending := false
    935      else
    936         FsortAscending := true;
     948     FsortDirection := 'R';
    937949
    938950  FsortCol := Column.Index;
    939   lstvAlerts.AlphaSort;
     951
     952  if FsortCol = 4 then
     953    ReformatAlertDateTime //  hds7397- ge 2/6/6 sort and display date/time column correctly - as requested
     954  else
     955     lstvAlerts.AlphaSort;
    940956  SortViaKeyboard := false;
     957
    941958
    942959  //Set the Notifications sort method to last-used sort-type
    943960  //ie., user clicked on which column header last use of CPRS?
    944961  case Column.Index of
    945      0: rCore.SetSortMethod('I');
    946      1: rCore.SetSortMethod('P');
    947      2: rCore.SetSortMethod('L');
    948      3: rCore.SetSortMethod('U');
    949      4: rCore.SetSortMethod('D');
    950      5: rCore.SetSortMethod('M');
    951      6: rCore.SetSortMethod('F');
     962     0: rCore.SetSortMethod('I', FsortDirection);
     963     1: rCore.SetSortMethod('P', FsortDirection);
     964     2: rCore.SetSortMethod('L', FsortDirection);
     965     3: rCore.SetSortMethod('U', FsortDirection);
     966     4: rCore.SetSortMethod('D', FsortDirection);
     967     5: rCore.SetSortMethod('M', FsortDirection);
     968     6: rCore.SetSortMethod('F', FsortDirection);
    952969  end;
    953970end;
     
    10221039//    pnlPrf.Visible := True;
    10231040  end
    1024 //  else pnlPrf.Visible := False;
     1041  //else pnlPrf.Visible := False;
    10251042end;
    10261043
     
    10431060  if lstvAlerts.SelCount <= 0 then ShowButts(False)
    10441061  else ShowButts(True);
    1045   GetBAStatus(User.DUZ,Encounter.Location);
     1062  GetBAStatus(User.DUZ,Patient.DFN);
    10461063end;
    10471064
     
    11001117}
    11011118var
     1119  sortResult: string;
    11021120  sortMethod: string;
    11031121begin
    1104   sortMethod := rCore.GetSortMethod;
     1122  sortResult := rCore.GetSortMethod;
     1123  sortMethod := Piece(sortResult, U, 1);
     1124  FsortDirection := Piece(sortResult, U, 2);
     1125  if FsortDirection = 'F' then
     1126     FsortAscending := true
     1127  else
     1128     FsortAscending := false;
    11051129
    11061130  case sortMethod[1] of
     
    11151139end;
    11161140
     1141//hds7397- ge 2/6/6 sort and display date/time column correctly - as requested
     1142procedure  TfrmPtSel.ReformatAlertDateTime;
     1143var
     1144  I,J: Integer;
     1145  inDateStr, holdDayTime,srtDate: String;
     1146begin
     1147  // convert date to yyyy/mm/dd prior to sort.
     1148 for J := 0 to lstvAlerts.items.count -1 do
     1149  begin
     1150    inDateStr := '';
     1151    srtDate := '';
     1152    holdDayTime := '';
     1153    inDateStr := lstvAlerts.Items[j].SubItems[3];
     1154    srtDate := ( (Piece( Piece(inDateStr,'/',3), '@',1)) + '/' + Piece(inDateStr,'/',1) + '/' + Piece(inDateStr,'/',2) +'@'+ Piece(inDateStr, '@',2) );
     1155    lstvAlerts.Items[j].SubItems[3] := srtDate;
     1156  end;
     1157   //sort the listview records by date
     1158  lstvAlerts.AlphaSort;
     1159 // loop thru lstvAlerts change date to yyyy/mm/dd
     1160 // sort list
     1161 // change alert date/time back to mm/dd/yyyy@time for display
     1162  for I := 0 to lstvAlerts.items.Count -1 do
     1163   begin
     1164     inDateStr := '';
     1165     srtDate := '';
     1166     holdDayTime := '';
     1167     inDateStr :=   lstvAlerts.Items[i].SubItems[3];
     1168     holdDayTime := Piece(inDateStr,'/',3);  // dd@time
     1169     lstvAlerts.Items[i].SubItems[3] := (Piece(inDateStr, '/', 2) + '/' + Piece(holdDayTime, '@',1) +'/'
     1170                                            + Piece(inDateStr,'/',1) + '@' + Piece(holdDayTime,'@',2) );
     1171  end;
     1172end;
     1173
    11171174Initialization
    11181175  SortViaKeyboard := false;
Note: See TracChangeset for help on using the changeset viewer.