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/fPatientFlagMulti.pas

    r459 r460  
    88
    99type
    10   TfrmFlags = class(TfrmAutoSz)
     10  {This object holds a List of Notes Linked to a PRF as Returned VIA the RPCBroker}
     11  TPRFNotes = class(TObject)
     12  private
     13    FPRFNoteList : TStringList;
     14  public
     15    //procedure to show the Notes in a ListView, requires a listview parameter
     16    procedure ShowActionsOnList(DisplayList : TCaptionListView);
     17    //procedure to load the notes, this will call the RPC
     18    procedure Load(TitleIEN : Int64; DFN : String);
     19    function getNoteIEN(index: integer): String;
     20    constructor create;
     21    destructor Destroy(); override;
     22  end;
     23
     24  TfrmFlags = class(TForm)
    1125    Splitter1: TSplitter;
    12     Panel1: TPanel;
    13     btnClose: TButton;
    14     Panel2: TPanel;
     26    pnlTop: TORAutoPanel;
    1527    lblFlags: TLabel;
    1628    lstFlags: TORListBox;
    17     memFlags: TCaptionMemo;
     29    memFlags: TRichEdit;
     30    pnlNotes: TPanel;
     31    lvPRF: TCaptionListView;
     32    lblNoteTitle: TLabel;
     33    Splitter2: TSplitter;
     34    pnlBottom: TORAutoPanel;
     35    btnClose: TButton;
    1836    procedure lstFlagsClick(Sender: TObject);
    19     procedure btnCloseClick(Sender: TObject);
    2037    procedure FormKeyDown(Sender: TObject; var Key: Word;
    2138      Shift: TShiftState);
     
    2340    procedure FormCreate(Sender: TObject);
    2441    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     42    procedure FormDestroy(Sender: TObject);
     43    procedure lvPRFClick(Sender: TObject);
     44    procedure lvPRFKeyDown(Sender: TObject; var Key: Word;
     45      Shift: TShiftState);
    2546  private
    2647    FFlagID: integer;
     48    FPRFNotes : TPRFNotes;
     49    FNoteTitle: String;
     50    procedure GetNotes();
    2751  public
    2852    { Public declarations }
    2953  end;
     54const
     55  HIDDEN_COL = 'Press enter or space bar to view this note:';
     56  //TIU GET LINKED PRF NOTES, return position constants
     57  NOTE_IEN_POS = 1;
     58  ACTION_POS = 2;
     59  NOTE_DATE_POS = 3;
     60  AUTHOR_POS = 4;
     61  //TIU GET PRF TITLE, return position constants
     62  NOTE_TITLE_IEN = 1;
     63  NOTE_TITLE = 2;
     64
    3065
    3166procedure ShowFlags(FlagId: integer = 0);
     
    3368implementation
    3469
    35 uses uCore,uOrPtf,ORFn;
     70uses uCore,uOrPtf,ORFn, ORNet, uConst, fRptBox, rCover;
    3671{$R *.dfm}
    3772
     
    4580    if HasFlag then
    4681    begin
    47       SetFormPosition(frmFlags);
     82      //SetFormPosition(frmFlags);
    4883      frmFlags.FFlagID := FlagId;
    4984      frmFlags.lstFlags.Items.Assign(FlagList);
    5085      frmFlags.memFlags.SelStart := 0;
    51       //ResizeFormToFont(TForm(frmFlags));
     86      ResizeFormToFont(TForm(frmFlags));
    5287      frmFlags.ShowModal;
    5388    end
     
    68103      memFlags.Lines.Assign(FlagArray);
    69104    memFlags.SelStart := 0;
    70   end;
    71 end;
    72 
    73 procedure TfrmFlags.btnCloseClick(Sender: TObject);
    74 begin
    75   Close;
     105    GetNotes;
     106  end;
    76107end;
    77108
     
    89120begin
    90121  inherited;
     122  SetFormPosition(Self);
    91123  idx := 0;
    92124  if FFlagID > 0 then idx := lstFlags.SelectByIEN(FFlagId);
     
    94126  lstFlagsClick(Self);
    95127  ActiveControl := memFlags;
     128  GetNotes;
    96129end;
    97130
     
    105138begin
    106139  inherited;
    107   //SaveUserBounds(Self);
    108 end;
    109 
    110 
     140  SaveUserBounds(Self);
     141end;
     142
     143procedure TfrmFlags.GetNotes;
     144var
     145  NoteTitleIEN, FlagID : Int64;
     146begin
     147    if FPRFNotes = nil then
     148      FPRFNotes := TPRFNotes.Create;
     149    FlagID := lstFlags.ItemID;
     150    CallV('TIU GET PRF TITLE', [Patient.DFN,FlagID]);
     151    FNoteTitle := Piece(RPCBrokerV.Results[0],U,NOTE_TITLE);
     152    lblNoteTitle.Caption := 'Signed, Linked Notes of Title: '+ FNoteTitle;
     153    NoteTitleIEN := StrToInt(Piece(RPCBrokerV.Results[0],U,NOTE_TITLE_IEN));
     154    FPRFNotes.Load(NoteTitleIEN,Patient.DFN);
     155    FPRFNotes.ShowActionsOnList(lvPRF);
     156    with lvPRF do begin
     157
     158      Columns.BeginUpdate;
     159      Columns.EndUpdate;
     160    end;
     161end;
     162
     163{ TPRFNotes }
     164
     165constructor TPRFNotes.create;
     166begin
     167  inherited;
     168  FPRFNoteList := TStringList.create;
     169end;
     170
     171destructor TPRFNotes.Destroy;
     172begin
     173  FPRFNoteList.Free;
     174  inherited;
     175end;
     176
     177function TPRFNotes.getNoteIEN(index: integer): String;
     178begin
     179 Result := Piece(FPRFNoteList[index],U,NOTE_IEN_POS);
     180end;
     181
     182procedure TPRFNotes.Load(TitleIEN: Int64; DFN: String);
     183const
     184  REVERSE_CHRONO = 1;
     185begin
     186  CallV('TIU GET LINKED PRF NOTES', [DFN,TitleIEN,REVERSE_CHRONO]);
     187  FPRFNoteList.Assign(RPCBrokerV.Results);
     188end;
     189
     190procedure TPRFNotes.ShowActionsOnList(DisplayList: TCaptionListView);
     191var
     192  i : integer;
     193  ListItem: TListItem;
     194begin
     195  DisplayList.Clear;
     196  for i := 0 to FPRFNoteList.Count-1 do
     197  begin
     198    //Caption="Text for Screen Reader" SubItem1=Flag SubItem2=Date SubItem3=Action SubItem4=Note
     199    ListItem := DisplayList.Items.Add;
     200    ListItem.Caption := HIDDEN_COL; //Screen readers don't read the first column title on a listview.
     201    ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,NOTE_DATE_POS));
     202    ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,ACTION_POS));
     203    ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,AUTHOR_POS));
     204  end;
     205end;
     206
     207procedure TfrmFlags.FormDestroy(Sender: TObject);
     208begin
     209  FPRFNotes.Free;
     210end;
     211
     212procedure TfrmFlags.lvPRFClick(Sender: TObject);
     213begin
     214  if lvPRF.ItemIndex > -1 then
     215  begin
     216    NotifyOtherApps(NAE_REPORT, 'TIU^' + FPRFNotes.getNoteIEN(lvPRF.ItemIndex));
     217    ReportBox(DetailPosting(FPRFNotes.getNoteIEN(lvPRF.ItemIndex)), FNoteTitle, True);
     218  end;
     219end;
     220
     221procedure TfrmFlags.lvPRFKeyDown(Sender: TObject; var Key: Word;
     222  Shift: TShiftState);
     223begin
     224  if (Key = VK_SPACE) or (Key = VK_RETURN) then
     225    lvPRFClick(Sender);
     226end;
    111227
    112228end.
Note: See TracChangeset for help on using the changeset viewer.