Module

fActivateDeactivate

Path

C:\CPRS\CPRS30\fActivateDeactivate.pas

Last Modified

7/15/2014 3:26:36 PM

Units Used in Interface

Name Comments
fAutoSz -
fMeds -
fOrders -
rCore -
rMeds -
rOrders -
uCore -

Classes

Name Comments
TfrmActivateDeactive -

Procedures

Name Owner Declaration Scope Comments
BuildForm TfrmActivateDeactive procedure BuildForm(Str1: String); Private TfrmActivateDeactive
DCOriginalOrder TfrmActivateDeactive procedure DCOriginalOrder(OrderID: string); Private -
fActivateDeactive TfrmActivateDeactive procedure fActivateDeactive(OrderID: TStringList; AList: TListBox); overload; Public -
fActivateDeactive TfrmActivateDeactive procedure fActivateDeactive(OrderID: TStringList); overload; Public Public declarations
GetOriginalOrders TfrmActivateDeactive procedure GetOriginalOrders(OrderID: TStringList; var OriginalOrder: TORStringList); Private Private declarations
TActivateClick TfrmActivateDeactive procedure TActivateClick(Sender: TObject); Public/Published -
TCancelClick TfrmActivateDeactive procedure TCancelClick(Sender: TObject); Public/Published -
TDeactiveClick TfrmActivateDeactive procedure TDeactiveClick(Sender: TObject); Public/Published -

Functions

Name Owner Declaration Scope Comments
PromptForm TfrmActivateDeactive function PromptForm(Text: String): String; Private -

Global Variables

Name Type Declaration Comments
Act Boolean Act: Boolean; -
CancelProcess Boolean CancelProcess: Boolean; -
Deact Boolean Deact: Boolean; -
frmActivateDeactive TfrmActivateDeactive frmActivateDeactive: TfrmActivateDeactive; -


Module Source

1     unit fActivateDeactivate;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, StrUtils, Variants, Classes, Graphics, Controls, Forms,
7       Dialogs, fAutoSz, StdCtrls, ExtCtrls, ORCtrls,ORFn, rCore, uCore, oRNet, Math, fOrders, ORClasses, rOrders,
8       fMeds, rMeds, VA508AccessibilityManager;
9     
10    type
11      TfrmActivateDeactive = class(TfrmAutoSz)
12        TActivate: TButton;
13        TDeactive: TButton;
14        Memo1: TMemo;
15        TCancel: TButton;
16        procedure TActivateClick(Sender: TObject);
17        procedure TDeactiveClick(Sender: TObject);
18        procedure TCancelClick(Sender: TObject);
19      private
20        { Private declarations }
21        procedure GetOriginalOrders(OrderID: TStringList; var OriginalOrder: TORStringList);
22        procedure DCOriginalOrder(OrderID: string);
23        procedure BuildForm(Str1: String);
24        function PromptForm(Text: String): String;
25      public
26         { Public declarations }
27    
28        procedure fActivateDeactive(OrderID: TStringList); overload;
29        procedure fActivateDeactive(OrderID: TStringList; AList: TListBox); overload;
30      end;
31    
32    var
33      frmActivateDeactive: TfrmActivateDeactive;
34      Act: Boolean;
35      Deact: Boolean;
36      CancelProcess: Boolean;
37    
38    implementation
39    
40    {$R *.dfm}
41    
42    { TfrmActivateDeactive }
43    
44    procedure TfrmActivateDeactive.BuildForm(Str1: String);
45    var
46     str: string;
47    begin
48      with frmActivateDeactive do
49         begin
50            str := 'This order is in a pending status.  If this pending order is discontinued, the original order will still be active.';
51            str := str + CRLF + CRLF + str1;
52            str := str + CRLF + CRLF + 'Click:';
53            str := str + CRLF + '     "DC BOTH" to discontinue both orders ';
54            str := str + CRLF + '     "DC Pending Order" to discontinue only the pending order and return the original order back to an active status ';
55            str := str + CRLF + '     "Cancel - No Action Taken" to stop the discontinue process ';
56            Memo1.ReadOnly := False;
57            Memo1.Text := str;
58            Memo1.ReadOnly := True;
59         end;
60        ResizeAnchoredFormToFont(frmActivateDeactive);
61        frmActivateDeactive.ShowModal;
62        frmActivateDeactive.Release;
63    end;
64    
65    procedure TfrmActivateDeactive.fActivateDeactive(OrderID: TStringList);
66    var
67    i,Pos: integer;
68    tmpArr: TORStringList;
69    ActDeact: string;
70    AnOrder: TOrder;
71    begin
72      //called from order tab
73      tmpArr := TORStringList.Create;
74      GetOriginalOrders(OrderID,tmpArr);
75          with fOrders.frmOrders.lstOrders do for i := 0 to items.Count-1 do if Selected[i] then
76            begin
77              AnOrder := TOrder(Items.Objects[i]);
78              Pos := tmpArr.IndexOfPiece(AnOrder.ID,U,1);
79              if Pos > -1 then
80                begin
81                  ActDeact := PromptForm(AnOrder.Text);
82                  if ActDeact = 'D' then AnOrder.DCOriginalOrder := True;
83                  if ActDeact = 'A' then AnOrder.DCOriginalOrder := False;
84                  if ActDeact = 'C' then Selected[i] := False;
85                end;
86            end;
87    end;
88    
89    procedure TfrmActivateDeactive.fActivateDeactive(OrderID: TStringList; AList: TListBox);
90    var
91    i,Pos: integer;
92    tmpArr: TORStringList;
93    ActDeact: String;
94    AMed: TMedListRec;
95    AnOrder: TOrder;
96    begin
97      //called from Med tab
98      tmpArr := TORStringList.Create;
99      GetOriginalOrders(OrderID,tmpArr);
100     AnOrder := TOrder.Create;
101        with AList do for i := 0 to items.Count-1 do if Selected[i] then
102           begin
103             AMed := TMedListRec(Items.Objects[i]);
104             if AMed = nil then Continue;
105             Pos := tmpArr.IndexOfPiece(AMed.OrderID,U,1);
106             if Pos > -1 then
107               begin
108                 ActDeact := PromptForm(Alist.Items.Strings[i]);
109                 if ActDeact = 'D' then
110                   begin
111                     AnOrder := GetOrderByIFN(Piece(tmpArr.Strings[Pos],U,1));
112                     DCOriginalOrder(AnOrder.ID);
113                     //AnOrder.DCOriginalOrder := True;
114                   end;
115                 if ActDeact = 'A' then AnOrder.DCOriginalOrder := False;
116                 if ActDeact = 'C' then Selected[i] := False;
117               end;
118           end;
119   end;
120   
121   procedure TfrmActivateDeactive.GetOriginalOrders(OrderID: TStringList; var OriginalOrder: TORStringList);
122   var
123   i: integer;
124   begin
125     CallV('ORWDX1 DCREN', [OrderID]);
126     for i := 0 to RPCBrokerV.Results.Count-1 do
127       OriginalOrder.Add(RPCBrokerV.Results.Strings[i]);
128   end;
129   
130   function TfrmActivateDeactive.PromptForm(Text: String): String;
131   begin
132     frmActivateDeactive := TfrmActivateDeactive.Create(Application);
133     BuildForm(Text);
134     if Deact = True then Result := 'D';
135     if Act = True then Result := 'A';
136     if CancelProcess = True then Result := 'C';
137   end;
138   
139   procedure TfrmActivateDeactive.TActivateClick(Sender: TObject);
140   begin
141     inherited;
142      Act := True;
143      Deact := False;
144      CancelProcess := False;
145      frmActivateDeactive.Close;
146   end;
147   
148   procedure TfrmActivateDeactive.TDeactiveClick(Sender: TObject);
149   begin
150     inherited;
151      Act := False;
152      Deact := True;
153      CancelProcess := False;
154      frmActivateDeactive.Close;
155   end;
156   
157   procedure TfrmActivateDeactive.TCancelClick(Sender: TObject);
158   begin
159     inherited;
160     Act := False;
161     Deact := False;
162     CancelProcess := True;
163     frmActivateDeactive.Close;
164   end;
165   
166   procedure TfrmActivateDeactive.DCOriginalOrder(OrderID: string);
167   begin
168    CallV('ORWDX1 DCORIG', [OrderID]);
169   end;
170   
171   end.

Module Calls (2 levels)


fActivateDeactivate
 ├fAutoSz
 │ └fBase508Form
 ├fOrders
 │ ├fHSplit
 │ ├rOrders
 │ ├fODBase
 │ ├uConst
 │ ├uCore
 │ ├uOrders
 │ ├UBACore
 │ ├UBAGlobals
 │ ├fFrame
 │ ├fOrderVw
 │ ├fRptBox
 │ ├fLkUpLocation
 │ ├fOrdersDC
 │ ├fOrdersCV
 │ ├fOrdersHold
 │ ├fOrdersUnhold
 │ ├fOrdersAlert
 │ ├fOrderFlag
 │ ├fOrderUnflag
 │ ├fOrdersSign
 │ ├fOrdersRelease
 │ ├fOrdersOnChart
 │ ├fOrdersEvntRelease
 │ ├fOrdersComplete
 │ ├fOrdersVerify
 │ ├fOrderComment
 │ ├fOrdersRenew
 │ ├fODReleaseEvent
 │ ├rCore
 │ ├fOCSession
 │ ├fOrdersPrint
 │ ├fOrdersTS
 │ ├fEffectDate
 │ ├fODActive
 │ ├fOrdersCopy
 │ ├uODBase
 │ ├rMeds
 │ ├fODValidateAction
 │ ├fMeds
 │ ├uInit
 │ ├fODConsult
 │ ├fClinicWardMeds
 │ ├fActivateDeactivate...
 │ └rODMeds
 ├rOrders...
 └rMeds...

Module Called-By (2 levels)


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