Module

fOrdersVerify

Path

C:\CPRS\CPRS30\Orders\fOrdersVerify.pas

Last Modified

7/15/2014 3:26:42 PM

Units Used in Interface

Name Comments
fAutoSz -

Units Used in Implementation

Name Comments
rCore -
rOrders -

Classes

Name Comments
TfrmVerifyOrders -

Procedures

Name Owner Declaration Scope Comments
cmdCancelClick TfrmVerifyOrders procedure cmdCancelClick(Sender: TObject); Public/Published -
cmdOKClick TfrmVerifyOrders procedure cmdOKClick(Sender: TObject); Public/Published -
FormCreate TfrmVerifyOrders procedure FormCreate(Sender: TObject); Public/Published -
lstOrdersDrawItem TfrmVerifyOrders procedure lstOrdersDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); Public/Published -
lstOrdersMeasureItem TfrmVerifyOrders procedure lstOrdersMeasureItem(Control: TWinControl; Index: Integer; var AHeight: Integer); Public/Published -
Panel1Resize TfrmVerifyOrders procedure Panel1Resize(Sender: TObject); Public/Published -

Functions

Name Owner Declaration Scope Comments
ExecuteVerifyOrders - function ExecuteVerifyOrders(SelectedList: TList; ChartReview: Boolean): Boolean; Interfaced -

Constants

Name Declaration Scope Comments
TX_CHART_REVIEW 'The following orders will be marked as reviewed -' Global -


Module Source

1     unit fOrdersVerify;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7       fAutoSz, StdCtrls, ORFn, ORCtrls, ExtCtrls, VA508AccessibilityManager;
8     
9     type
10      TfrmVerifyOrders = class(TfrmAutoSz)
11        Panel1: TPanel;
12        lblVerify: TLabel;
13        lstOrders: TCaptionListBox;
14        Panel2: TPanel;
15        lblESCode: TLabel;
16        txtESCode: TCaptionEdit;
17        cmdOK: TButton;
18        cmdCancel: TButton;
19        procedure FormCreate(Sender: TObject);
20        procedure cmdOKClick(Sender: TObject);
21        procedure cmdCancelClick(Sender: TObject);
22        procedure lstOrdersMeasureItem(Control: TWinControl; Index: Integer;
23          var AHeight: Integer);
24        procedure lstOrdersDrawItem(Control: TWinControl; Index: Integer;
25          Rect: TRect; State: TOwnerDrawState);
26        procedure Panel1Resize(Sender: TObject);
27      private
28        OKPressed: Boolean;
29        ESCode: string;
30      end;
31    
32    function ExecuteVerifyOrders(SelectedList: TList; ChartReview: Boolean): Boolean;
33    
34    implementation
35    
36    {$R *.DFM}
37    
38    uses Hash, rCore, rOrders;
39    
40    const
41      TX_CHART_REVIEW = 'The following orders will be marked as reviewed -';
42    
43    function ExecuteVerifyOrders(SelectedList: TList; ChartReview: Boolean): Boolean;
44    var
45      frmVerifyOrders: TfrmVerifyOrders;
46      i: Integer;
47    begin
48      Result := False;
49      if SelectedList.Count = 0 then Exit;
50      frmVerifyOrders := TfrmVerifyOrders.Create(Application);
51      try
52        ResizeFormToFont(TForm(frmVerifyOrders));
53        if ChartReview then
54        begin
55          frmVerifyOrders.lblVerify.Caption := TX_CHART_REVIEW;
56          frmVerifyOrders.Caption := 'Chart Review';
57        end;
58        with SelectedList do for i := 0 to Count - 1 do
59          frmVerifyOrders.lstOrders.Items.Add(TOrder(Items[i]).Text);
60        frmVerifyOrders.ShowModal;
61        if frmVerifyOrders.OKPressed then
62        begin
63          with SelectedList do for i := 0 to Count - 1 do
64          begin
65            if ChartReview
66              then VerifyOrderChartReview(TOrder(Items[i]), frmVerifyOrders.ESCode)
67              else VerifyOrder(TOrder(Items[i]), frmVerifyOrders.ESCode);
68          end;
69          Result := True;
70        end;
71      finally
72        frmVerifyOrders.Release;
73        with SelectedList do for i := 0 to Count - 1 do UnlockOrder(TOrder(Items[i]).ID);
74      end;
75    end;
76    
77    procedure TfrmVerifyOrders.FormCreate(Sender: TObject);
78    begin
79      inherited;
80      OKPressed := False;
81    end;
82    
83    procedure TfrmVerifyOrders.cmdOKClick(Sender: TObject);
84    const
85      TX_NO_CODE  = 'An electronic signature code must be entered to verify orders.';
86      TC_NO_CODE  = 'Electronic Signature Code Required';
87      TX_BAD_CODE = 'The electronic signature code entered is not valid.';
88      TC_BAD_CODE = 'Invalid Electronic Signature Code';
89    begin
90      inherited;
91      if Length(txtESCode.Text) = 0 then
92      begin
93        InfoBox(TX_NO_CODE, TC_NO_CODE, MB_OK);
94        Exit;
95      end;
96      if not ValidESCode(txtESCode.Text) then
97      begin
98        InfoBox(TX_BAD_CODE, TC_BAD_CODE, MB_OK);
99        txtESCode.SetFocus;
100       txtESCode.SelectAll;
101       Exit;
102     end;
103     ESCode := Encrypt(txtESCode.Text);
104     OKPressed := True;
105     Close;
106   end;
107   
108   procedure TfrmVerifyOrders.cmdCancelClick(Sender: TObject);
109   begin
110     inherited;
111     Close;
112   end;
113   
114   
115   
116   procedure TfrmVerifyOrders.lstOrdersMeasureItem(Control: TWinControl;
117     Index: Integer; var AHeight: Integer);
118   var
119     x: string;
120     ARect: TRect;
121   begin
122     inherited;
123     with lstOrders do if Index < Items.Count then
124     begin
125       ARect := ItemRect(Index);
126       Canvas.FillRect(ARect);
127       x := FilteredString(Items[Index]);
128       AHeight := WrappedTextHeightByFont(Canvas, Font, x, ARect);
129       if AHeight <  13 then AHeight := 15;
130     end;
131   end;
132   
133   procedure TfrmVerifyOrders.lstOrdersDrawItem(Control: TWinControl;
134     Index: Integer; Rect: TRect; State: TOwnerDrawState);
135   var
136     x: string;
137     ARect: TRect;
138     SaveColor: TColor;
139   begin
140     inherited;
141     with lstOrders do
142     begin
143       ARect := Rect;
144       ARect.Left := ARect.Left + 2;
145       Canvas.FillRect(ARect);
146       Canvas.Pen.Color := Get508CompliantColor(clSilver);
147       SaveColor := Canvas.Brush.Color;
148       Canvas.MoveTo(ARect.Left, ARect.Bottom - 1);
149       Canvas.LineTo(ARect.Right, ARect.Bottom - 1);
150       if Index < Items.Count then
151       begin
152         x := FilteredString(Items[Index]);
153         DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK);
154         Canvas.Brush.Color := SaveColor;
155         ARect.Right := ARect.Right + 4;
156       end;
157     end;
158   end;
159   
160   procedure TfrmVerifyOrders.Panel1Resize(Sender: TObject);
161   begin
162     inherited;
163     lstOrders.Invalidate;
164   end;
165   
166   end.

Module Calls (2 levels)


fOrdersVerify
 ├fAutoSz
 │ └fBase508Form
 ├rCore
 │ └uCore
 └rOrders
   ├uCore...
   ├rCore...
   ├uConst
   ├UBAGlobals
   └UBACore

Module Called-By (2 levels)


          fOrdersVerify
              fOrders┘ 
            uOrders┤   
            fODBase┤   
             fFrame┤   
              rMisc┤   
            uODBase┤   
              fMeds┤   
          fOrdersDC┤   
          fOrdersCV┤   
            fOMNavA┤   
             fOMSet┤   
 fOrdersEvntRelease┤   
    fODReleaseEvent┤   
         mEvntDelay┤   
          fODActive┤   
        fOrdersCopy┤   
           fMedCopy┤   
fActivateDeactivate┘