Module

fNoteBD

Path

C:\CPRS\CPRS30\fNoteBD.pas

Last Modified

7/15/2014 3:26:38 PM

Units Used in Interface

Name Comments
fBase508Form -
uTIU -

Units Used in Implementation

Name Comments
rCore -
rTIU -

Classes

Name Comments
TfrmNotesByDate -

Procedures

Name Owner Declaration Scope Comments
calBeginDateKeyPress TfrmNotesByDate procedure calBeginDateKeyPress(Sender: TObject; var Key: Char); Public/Published -
calEndDateKeyPress TfrmNotesByDate procedure calEndDateKeyPress(Sender: TObject; var Key: Char); Public/Published -
cmdCancelClick TfrmNotesByDate procedure cmdCancelClick(Sender: TObject); Public/Published -
cmdOKClick TfrmNotesByDate procedure cmdOKClick(Sender: TObject); Public/Published -
SelectNoteDateRange - procedure SelectNoteDateRange(FontSize: Integer; CurrentContext: TTIUContext; var NoteDateRange: TNoteDateRange); Interfaced Displays date range select form for progress notes and returns a record of the selection

Constants

Name Declaration Scope Comments
TX_DATE_ERR 'Enter valid beginning and ending dates or press Cancel.' Global -
TX_DATE_ERR_CAP 'Error in Date Range' Global -


Module Source

1     unit fNoteBD;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
7       StdCtrls, ExtCtrls, ORCtrls, ORDtTm, uTIU, fBase508Form,
8       VA508AccessibilityManager;
9     
10    type
11      TfrmNotesByDate = class(TfrmBase508Form)
12        pnlBase: TORAutoPanel;
13        lblBeginDate: TLabel;
14        calBeginDate: TORDateBox;
15        lblEndDate: TLabel;
16        calEndDate: TORDateBox;
17        radSort: TRadioGroup;
18        cmdOK: TButton;
19        cmdCancel: TButton;
20        procedure cmdOKClick(Sender: TObject);
21        procedure cmdCancelClick(Sender: TObject);
22        procedure calBeginDateKeyPress(Sender: TObject; var Key: Char);
23        procedure calEndDateKeyPress(Sender: TObject; var Key: Char);
24      private
25        FChanged: Boolean;
26        FBeginDate: string;
27        FFMBeginDate: TFMDateTime;
28        FEndDate: string;
29        FFMEndDate: TFMDateTime;
30        FAscending: Boolean;
31      end;
32    
33      TNoteDateRange = record
34        Changed: Boolean;
35        BeginDate: string;
36        FMBeginDate: TFMDateTime;
37        EndDate: string;
38        FMEndDate: TFMDateTime;
39        Ascending: Boolean;
40      end;
41    
42    procedure SelectNoteDateRange(FontSize: Integer; CurrentContext: TTIUContext; var NoteDateRange: TNoteDateRange);
43    
44    implementation
45    
46    {$R *.DFM}
47    
48    uses rCore, rTIU;
49    
50    const
51      TX_DATE_ERR = 'Enter valid beginning and ending dates or press Cancel.';
52      TX_DATE_ERR_CAP = 'Error in Date Range';
53    
54    procedure SelectNoteDateRange(FontSize: Integer; CurrentContext: TTIUContext; var NoteDateRange: TNoteDateRange);
55    { displays date range select form for progress notes and returns a record of the selection }
56    var
57      frmNotesByDate: TfrmNotesByDate;
58      W, H: Integer;
59    begin
60      frmNotesByDate := TfrmNotesByDate.Create(Application);
61      try
62        with frmNotesByDate do
63        begin
64          Font.Size := FontSize;
65          W := ClientWidth;
66          H := ClientHeight;
67          ResizeToFont(FontSize, W, H);
68          ClientWidth  := W; pnlBase.Width  := W;
69          ClientHeight := H; pnlBase.Height := W;
70          FChanged := False;
71          calBeginDate.Text := CurrentContext.BeginDate;
72          calEndDate.Text   := CurrentContext.EndDate;
73          if calEndDate.Text = '' then calEndDate.Text := 'TODAY';
74          FAscending := CurrentContext.TreeAscending;
75          with radSort do if FAscending then ItemIndex := 0 else ItemIndex := 1;
76          ShowModal;
77          with NoteDateRange do
78          begin
79            Changed := FChanged;
80            BeginDate := FBeginDate;
81            FMBeginDate := FFMBeginDate;
82            EndDate := FEndDate;
83            FMEndDate := FFMEndDate;
84            Ascending := FAscending;
85          end; {with NoteDateRange}
86        end; {with frmNotesByDate}
87      finally
88        frmNotesByDate.Release;
89      end;
90    end;
91    
92    procedure TfrmNotesByDate.cmdOKClick(Sender: TObject);
93    var
94      bdate, edate: TFMDateTime;
95    begin
96      if calBeginDate.Text <> '' then
97         bdate := StrToFMDateTime(calBeginDate.Text)
98      else
99         bdate := 0 ;
100   
101     if calEndDate.Text <> '' then
102        edate   := StrToFMDateTime(calEndDate.Text)
103     else
104        edate := 0 ;
105   
106     if (bdate <= edate) then
107       begin
108         FChanged := True;
109         FBeginDate := calBeginDate.Text;
110         FFMBeginDate := bdate;
111         FEndDate := calEndDate.Text;
112         FFMEndDate := edate;
113         FAscending := radSort.ItemIndex = 0;
114       end
115     else
116       begin
117         InfoBox(TX_DATE_ERR, TX_DATE_ERR_CAP, MB_OK or MB_ICONWARNING);
118         Exit;
119       end;
120     Close;
121   end;
122   
123   procedure TfrmNotesByDate.cmdCancelClick(Sender: TObject);
124   begin
125     Close;
126   end;
127   
128   procedure TfrmNotesByDate.calBeginDateKeyPress(Sender: TObject;
129     var Key: Char);
130   begin
131     if (Key = #13) then cmdOKClick(Self);
132   end;
133   
134   procedure TfrmNotesByDate.calEndDateKeyPress(Sender: TObject;
135     var Key: Char);
136   begin
137     if (Key = #13) then cmdOKClick(Self);
138   end;
139   
140   end.

Module Calls (2 levels)


fNoteBD
 ├uTIU
 ├fBase508Form
 │ ├uConst
 │ └uHelpManager
 └rCore
   └uCore

Module Called-By (2 levels)


            fNoteBD
           fNotes┤ 
         fFrame┤ │ 
     fPrintList┤ │ 
    fNoteSTStop┤ │ 
      fConsults┤ │ 
fReminderDialog┤ │ 
        fReview┘ │ 
          fDCSumm┘ 
      fFrame...┤   
  fPrintList...┤   
     fReview...┤   
   fAddlSigners┘