Module

fODMisc

Path

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

Last Modified

7/15/2014 3:26:42 PM

Units Used in Interface

Name Comments
fODBase -
uConst -

Units Used in Implementation

Name Comments
rODBase -

Classes

Name Comments
TfrmODMisc -

Procedures

Name Owner Declaration Scope Comments
cboCareNeedData TfrmODMisc procedure cboCareNeedData(Sender: TObject; const StartFrom: String; Direction, InsertAt: Integer); Public/Published -
ControlChange TfrmODMisc procedure ControlChange(Sender: TObject); Public/Published -
FormCreate TfrmODMisc procedure FormCreate(Sender: TObject); Public/Published -
InitDialog TfrmODMisc procedure InitDialog; override; Protected -
SetError - procedure SetError(const x: string); Local -
SetupDialog TfrmODMisc procedure SetupDialog(OrderAction: Integer; const ID: string); override; Public -
Validate TfrmODMisc procedure Validate(var AnErrMsg: string); override; Protected -

Global Variables

Name Type Declaration Comments
frmODMisc TfrmODMisc frmODMisc: TfrmODMisc; -

Constants

Name Declaration Scope Comments
TX_BAD_START 'The start date is not valid.' Global -
TX_BAD_STOP 'The stop date is not valid.' Global -
TX_NO_CAREITEM 'A patient care item must be selected.' Global -
TX_STOPSTART 'The stop date must be after the start date.' Global -


Module Source

1     unit fODMisc;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7       fODBase, StdCtrls, ORCtrls, ORDtTm, ComCtrls, ExtCtrls, ORFn, uConst,
8       VA508AccessibilityManager, VA508AccessibilityRouter;
9     
10    type
11      TfrmODMisc = class(TfrmODBase)
12        cboCare: TORComboBox;
13        lblStart: TLabel;
14        calStart: TORDateBox;
15        lblStop: TLabel;
16        calStop: TORDateBox;
17        lblCare: TLabel;
18        lblComment: TLabel;
19        txtComment: TCaptionEdit;
20        procedure ControlChange(Sender: TObject);
21        procedure FormCreate(Sender: TObject);
22        procedure cboCareNeedData(Sender: TObject; const StartFrom: String;
23          Direction, InsertAt: Integer);
24      private
25        { }
26      protected
27        procedure InitDialog; override;
28        procedure Validate(var AnErrMsg: string); override;
29      public
30        procedure SetupDialog(OrderAction: Integer; const ID: string); override;
31      end;
32    
33    var
34      frmODMisc: TfrmODMisc;
35    
36    implementation
37    
38    {$R *.DFM}
39    
40    uses rODBase;
41    
42    const
43      TX_NO_CAREITEM = 'A patient care item must be selected.';
44      TX_BAD_START   = 'The start date is not valid.';
45      TX_BAD_STOP    = 'The stop date is not valid.';
46      TX_STOPSTART   = 'The stop date must be after the start date.';
47    
48    procedure TfrmODMisc.FormCreate(Sender: TObject);
49    begin
50      inherited;
51      FillerID := 'OR';                     // does 'on Display' order check **KCM**
52      StatusText('Loading Dialog Definition');
53      Responses.Dialog := 'OR GXMISC GENERAL';       // loads formatting info
54      StatusText('Loading Default Values');
55      //CtrlInits.LoadDefaults(ODForMisc);           // there are no defaults for OR GXMISC
56      InitDialog;
57      StatusText('');
58      if ScreenReaderSystemActive then memOrder.TabStop := true;
59    end;
60    
61    procedure TfrmODMisc.InitDialog;
62    begin
63      inherited;
64      cboCare.InitLongList('');
65      txtComment.Text := '';
66    end;
67    
68    procedure TfrmODMisc.SetupDialog(OrderAction: Integer; const ID: string);
69    begin
70      inherited;
71      if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
72      begin
73        Changing := True;
74        SetControl(cboCare,    'ORDERABLE', 1);
75        SetControl(txtComment, 'COMMENT',   1);
76        SetControl(calStart,   'START',     1);
77        SetControl(calStop,    'STOP',      1);
78        Changing := False;
79        ControlChange(Self);
80        if not ScreenReaderSystemActive then SetFocusedControl(txtComment);
81      end;
82    end;
83    
84    procedure TfrmODMisc.Validate(var AnErrMsg: string);
85    var
86      ErrMsg: string;
87    
88      procedure SetError(const x: string);
89      begin
90        if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
91        AnErrMsg := AnErrMsg + x;
92      end;
93    
94    begin
95      if cboCare.ItemIEN <= 0 then SetError(TX_NO_CAREITEM);
96      calStart.Validate(ErrMsg);
97      if Length(ErrMsg) > 0   then SetError(TX_BAD_START);
98      with calStop do
99      begin
100       Validate(ErrMsg);
101       if Length(ErrMsg) > 0 then SetError(TX_BAD_STOP);
102       if (Length(Text) > 0) and (FMDateTime <= calStart.FMDateTime)
103                             then SetError(TX_STOPSTART);
104     end; {with calStop}
105   end;
106   
107   procedure TfrmODMisc.cboCareNeedData(Sender: TObject; const StartFrom: string;
108     Direction, InsertAt: Integer);
109   begin
110     inherited;
111     cboCare.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.NURS'));
112   end;
113   
114   procedure TfrmODMisc.ControlChange(Sender: TObject);
115   begin
116     inherited;
117     if Changing then Exit;
118     Responses.Clear;
119     with cboCare    do if ItemIEN > 0      then Responses.Update('ORDERABLE', 1, ItemID, Text);
120     with txtComment do if Length(Text) > 0 then Responses.Update('COMMENT',   1, Text,   Text);
121     with calStart   do if Length(Text) > 0 then Responses.Update('START',     1, Text,   Text);
122     with calStop    do if Length(Text) > 0 then Responses.Update('STOP',      1, Text,   Text);
123     memOrder.Text := Responses.OrderText;
124   end;
125   
126   end.

Module Calls (2 levels)


fODMisc
 ├fODBase
 │ ├fAutoSz
 │ ├uConst
 │ ├rOrders
 │ ├rODBase
 │ ├uCore
 │ ├UBAGlobals
 │ ├UBACore
 │ ├fOCAccept
 │ ├uODBase
 │ ├rCore
 │ ├rMisc
 │ ├fTemplateDialog
 │ ├uEventHooks
 │ ├uTemplates
 │ ├rConsults
 │ ├fOrders
 │ ├uOrders
 │ ├fFrame
 │ ├fODDietLT
 │ └rODDiet
 ├uConst
 └rODBase...

Module Called-By (2 levels)


                     fODMisc
                   uOrders┘ 
                   uCore┤   
                 fODBase┤   
                 rODBase┤   
                  fFrame┤   
                 fOrders┤   
             fOrdersSign┤   
                   fMeds┤   
               fARTAllgy┤   
                  fNotes┤   
               fConsults┤   
         fReminderDialog┤   
                 fReview┤   
            fOrdersRenew┤   
               fOrdersCV┤   
                 fODMeds┤   
                 fOMNavA┤   
         fOrderSaveQuick┤   
                  fOMSet┤   
          fOrdersRelease┤   
                 fOMHTML┤   
               fODMedNVA┤   
fODChangeUnreleasedRenew┤   
          fOrdersOnChart┤   
         fODReleaseEvent┤   
               fODActive┘