Function

ExecuteSessionOrderChecks

Module

fOCSession

Last Modified

7/15/2014 3:26:40 PM

Comments

Returns True if the Signature process should proceed.
 Clears OrderList If False.

Scope

Interfaced

Declaration

function ExecuteSessionOrderChecks(OrderList: TStringList) : Boolean;

Calls Hierarchy


ExecuteSessionOrderChecks
 ├OrderChecksForSession
 ├TfrmBase508Form.Create
 │ ├TfrmBase508Form.UpdateAccessibilityActions
 │ ├UnfocusableControlEnter
 │ └AdjustControls
 │   ├TfrmBase508Form.ModifyUnfocusableControl
 │   └..(rec)..
 ├IsMonograph
 ├TOCRec.Create
 ├TextForOrder
 ├GetXtraTxt
 ├TfrmOCSession.SetReqJustify
 └TfrmFrame.SetActiveTab
   ├TfrmFrame.PageIDToTab
   └TfrmFrame.tabPageChange
     ├TfrmFrame.TabToPageID
     ├TfrmFrame.SwitchToPage
     └SpeakPatient

Called-By Hierarchy


                                       ExecuteSessionOrderChecks
                                     ExecuteReleaseOrderChecks┤ 
                               TfrmOrders.mnuActReleaseClick┤ │ 
                               TfrmOrders.mnuActOnChartClick┤ │ 
                                  TfrmOrders.mnuActSignClick┘ │ 
                                         TfrmReview.cmdOKClick┘ 
                                               ReviewChanges┘   
                           TfrmFrame.AllowContextChangeAll┤     
                                TfrmFrame.FormCloseQuery┤ │     
                              TfrmFrame.mnuFileNextClick┤ │     
                            TfrmFrame.mnuFileOpenClick┤ │ │     
                                TfrmFrame.UMInitiate┤ │ │ │     
                       TfrmFrame.mnuFileNextClick...┤ │ │ │     
                       TfrmFrame.mnuFileRefreshClick┤ │ │ │     
                       TfrmOrders.CheckOrderStatus┤ │ │ │ │     
                   TfrmOrders.mnuActChgEvntClick┤ │ │ │ │ │     
                      TfrmOrders.mnuActHoldClick┤ │ │ │ │ │     
                    TfrmOrders.mnuActUnholdClick┤ │ │ │ │ │     
                     TfrmOrders.mnuActRenewClick┤ │ │ │ │ │     
                    TfrmOrders.mnuActChangeClick┤ │ │ │ │ │     
                      TfrmOrders.mnuActCopyClick┘ │ │ │ │ │     
                            TfrmMeds.mnuActDCClick┤ │ │ │ │     
                           TfrmMeds.CheckMedStatus┘ │ │ │ │     
                        TfrmMeds.mnuActHoldClick┤   │ │ │ │     
                       TfrmMeds.mnuActRenewClick┤   │ │ │ │     
                      TfrmMeds.mnuActUnholdClick┤   │ │ │ │     
                      TfrmMeds.mnuActChangeClick┤   │ │ │ │     
                        TfrmMeds.mnuActCopyClick┤   │ │ │ │     
                      TfrmMeds.mnuActRefillClick┘   │ │ │ │     
                                  TfrmFrame.ViewInfo┘ │ │ │     
                               TfrmDCSumm.ViewInfo┤   │ │ │     
                             TfrmConsults.ViewInfo┤   │ │ │     
                     TfrmFrame.pnlRemindersMouseUp┤   │ │ │     
                      TfrmFrame.RemindersChanged┘ │   │ │ │     
                          TfrmFrame.FormCreate┘   │   │ │ │     
                            TfrmFrame.pnlCIRNClick┤   │ │ │     
                      TfrmFrame.pnlVistaWebClick┤ │   │ │ │     
                           TfrmFrame.FormKeyDown┘ │   │ │ │     
                         TfrmFrame.pnlPatientClick┤   │ │ │     
                           TfrmFrame.pnlVisitClick┤   │ │ │     
                     TfrmFrame.pnlPrimaryCareClick┤   │ │ │     
                       TfrmFrame.pnlRemindersClick┤   │ │ │     
                        TfrmFrame.pnlPostingsClick┤   │ │ │     
                            TfrmFrame.pnlFlagClick┤   │ │ │     
                              TfrmFrame.laMHVClick┤   │ │ │     
                             TfrmFrame.laVAA2Click┤   │ │ │     
                               TfrmOrders.ViewInfo┤   │ │ │     
                                 TfrmMeds.ViewInfo┤   │ │ │     
                              TfrmSurgery.ViewInfo┤   │ │ │     
                                TfrmNotes.ViewInfo┤   │ │ │     
                             TfrmProblems.ViewInfo┘   │ │ │     
                     TfrmFrame.mnuFileNotifRemoveClick┤ │ │     
                             TfrmFrame.NextButtonClick┘ │ │     
                           TfrmFrame.SetUpNextButton┘   │ │     
                     TfrmFrame.mnuFileOpenClick...┤     │ │     
                              TfrmFrame.FormResize┘     │ │     
                            TfrmFrame.ChangeFont┘       │ │     
                    TfrmFrame.LoadSizesForUser┤         │ │     
               TfrmFrame.LoadUserPreferences┘ │         │ │     
                      TfrmFrame.UMInitiate┘   │         │ │     
                    TfrmFrame.mnuFontSizeClick┘         │ │     
                           TfrmFrame.mnuFileOpenClick...┤ │     
                           TfrmFrame.ctxContextorPending┤ │     
                          TfrmFrame.StartCCOWContextor┘ │ │     
                                TfrmFrame.FormCreate┘   │ │     
                         TfrmFrame.ctxContextorCommitted┤ │     
                       TfrmFrame.StartCCOWContextor...┘ │ │     
                  TfrmFrame.mnuFileResumeContextGetClick┤ │     
                  TfrmFrame.mnuFileResumeContextSetClick┘ │     
                                  TfrmFrame.FormCloseQuery┤     
                              TfrmFrame.mnuFileReviewClick┤     
                                           UpdateEncounter┘     
                         TfrmFrame.mnuFileEncounterClick┤       
                                 TfrmFrame.ViewInfo...┤ │       
                    TfrmODMedIV.SetValuesFromResponses┤ │       
                             TfrmODMedIV.SetupDialog┤ │ │       
                   TfrmODMedIV.cboSolutionMouseClick┘ │ │       
                       TfrmODMedIV.cboSolutionExit┘   │ │       
                  TfrmODMedIV.cboSolutionMouseClick...┤ │       
                     TfrmODMedIV.cboAdditiveMouseClick┤ │       
                         TfrmODMedIV.cboAdditiveExit┘ │ │       
                                TfrmODAuto.SetupDialog┤ │       
                                   ActivateOrderDialog┤ │       
                           TfrmRemDlg.btnFinishClick┤ │ │       
           TfrmConsults.mnuActNewConsultRequestClick┤ │ │       
                   TfrmConsults.cmdNewConsultClick┘ │ │ │       
                TfrmConsults.mnuActNewProcedureClick┤ │ │       
                      TfrmConsults.cmdNewProcClick┘ │ │ │       
                                        ChangeOrders┤ │ │       
                      TfrmOrders.mnuActChangeClick┤ │ │ │       
                        TfrmMeds.mnuActChangeClick┘ │ │ │       
                                     ChangeOrdersEvt┤ │ │       
                                          CopyOrders┤ │ │       
                        TfrmOrders.mnuActCopyClick┤ │ │ │       
                          TfrmMeds.mnuActCopyClick┤ │ │ │       
                           TfrmODActive.btnOKClick┘ │ │ │       
                                      TransferOrders┤ │ │       
                        TfrmOrders.mnuActCopyClick┤ │ │ │       
                          TfrmMeds.mnuActCopyClick┤ │ │ │       
                           TfrmODActive.btnOKClick┘ │ │ │       
                            TfrmOrders.lstWriteClick┤ │ │       
               TfrmOrders.PlaceOrderForDefaultDialog┤ │ │       
                  TfrmOrders.DisplayDefaultDlgList┤ │ │ │       
                       TfrmOrders.ResetOrderPage┘ │ │ │ │       
               TfrmOrders.btnDelayedOrderClick┘   │ │ │ │       
                                 DisplayEvntDialog┤ │ │ │       
                             SetDelayEventForMed┘ │ │ │ │       
                      TfrmMeds.mnuActCopyClick┘   │ │ │ │       
                                 DisplayEvntDialog┤ │ │ │       
                                  SetViewForCopy┘ │ │ │ │       
                    TfrmOrders.mnuActCopyClick┘   │ │ │ │       
                                 DisplayEvntDialog┘ │ │ │       
                                ExecuteChangeEvt┘   │ │ │       
                 TfrmOrders.mnuActChgEvntClick┘     │ │ │       
                             TfrmMeds.mnuActNewClick┤ │ │       
                           TfrmOMNavA.ActivateDialog┤ │ │       
                         TfrmOMNavA.grdMenuKeyDown┤ │ │ │       
                         TfrmOMNavA.grdMenuMouseUp┘ │ │ │       
                                TfrmOMSet.DoNextItem┘ │ │       
                              TfrmOMSet.InsertList┤   │ │       
                               ActivateOrderList┘ │   │ │       
                     TfrmRemDlg.btnFinishClick┤   │   │ │       
                             ActivateOrderHTML┤   │   │ │       
                    TfrmOrders.lstWriteClick┤ │   │   │ │       
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │   │ │       
                              ActivateOrderSet┤   │   │ │       
                   TfrmRemDlg.btnFinishClick┤ │   │   │ │       
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │   │ │       
     TfrmConsults.mnuActNewProcedureClick...┤ │   │   │ │       
                    TfrmOrders.lstWriteClick┤ │   │   │ │       
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │   │ │       
                     TfrmMeds.mnuActNewClick┤ │   │   │ │       
                TfrmOMNavA.ActivateDialog...┤ │   │   │ │       
                     TfrmOMSet.DoNextItem...┘ │   │   │ │       
                       TfrmOMNavA.DoSelectList┘   │   │ │       
                     TfrmOMNavA.grdMenuKeyUp┤     │   │ │       
                   TfrmOMNavA.grdMenuMouseUp┘     │   │ │       
                                        SkipToNext┤   │ │       
                         TfrmOMSet.DoNextItem...┘ │   │ │       
                            TfrmOMSet.UMDelayEvent┘   │ │       
                               TfrmOMSet.InsertList...┤ │       
                                TfrmODMeds.SetupDialog┤ │       
                             TfrmODMeds.btnSelectClick┤ │       
                             TfrmODMeds.UMDelayClick┘ │ │       
                                    ExecuteRenewOrders┘ │       
                         TfrmOrders.mnuActRenewClick┤   │       
                           TfrmMeds.mnuActRenewClick┘   │       
                                        EncounterPresent┤       
                                      ReadyForNewOrder┤ │       
                           TfrmRemDlg.btnFinishClick┤ │ │       
        TfrmConsults.mnuActNewConsultRequestClick...┤ │ │       
             TfrmConsults.mnuActNewProcedureClick...┤ │ │       
                                     ChangeOrders...┤ │ │       
                                     ChangeOrdersEvt┤ │ │       
                                       CopyOrders...┤ │ │       
                                   TransferOrders...┤ │ │       
                            TfrmOrders.lstWriteClick┤ │ │       
                             TfrmMeds.mnuActNewClick┘ │ │       
                                     ReadyForNewOrder1┤ │       
            TfrmOrders.PlaceOrderForDefaultDialog...┘ │ │       
                              TfrmOrders.mnuActDCClick┤ │       
                             TfrmOrders.mnuActRelClick┤ │       
                            TfrmOrders.mnuActHoldClick┤ │       
                          TfrmOrders.mnuActUnholdClick┤ │       
                           TfrmOrders.mnuActRenewClick┤ │       
                         TfrmOrders.mnuActReleaseClick┤ │       
                         TfrmOrders.mnuActOnChartClick┤ │       
                            TfrmOrders.mnuActSignClick┤ │       
                                TfrmMeds.mnuActDCClick┤ │       
                              TfrmMeds.mnuActHoldClick┤ │       
                             TfrmMeds.mnuActRenewClick┤ │       
                            TfrmMeds.mnuActUnholdClick┤ │       
                              TfrmMeds.mnuActCopyClick┤ │       
                            TfrmMeds.mnuActRefillClick┘ │       
                                     EncounterPresentEDO┤       
                                   ReadyForNewOrder...┤ │       
                         TfrmOrders.mnuActChgEvntClick┤ │       
                          TfrmOrders.mnuActChangeClick┤ │       
                            TfrmOrders.mnuActCopyClick┤ │       
                       TfrmOrders.btnDelayedOrderClick┤ │       
                            TfrmMeds.mnuActChangeClick┤ │       
                              TfrmMeds.mnuActCopyClick┘ │       
                                             UpdateVisit┤       
                                           EditPCEData┤ │       
                             TfrmSurgery.cmdPCEClick┤ │ │       
                                 UpdateEncounterInfo┘ │ │       
                             TfrmNotes.cmdPCEClick┘   │ │       
                        TfrmVitals.btnEnterVitalsClick┘ │       
                                             UpdateVisit┤       
                                        EncounterPresent┘       
                         TfrmProblems.lstProbActsClick┘         
                     TfrmProblems.wgProbDataDblClick┤           
                           TfrmProblems.lstViewClick┘           
                   TfrmProblems.HighlightDuplicate┘             
                         TfrmProblems.AddProblem┤               
              TfrmProblems.lstProbActsClick...┤ │               
                 TfrmProblems.lstProbPickClick┤ │               
              TfrmProblems.lstProbPickDblClick┤ │               
              TfrmProblems.edProbEntKeyPress┘ │ │               
                      TfrmProblems.UMPLLexicon┘ │               
                   TfrmdlgProb.bbChangeProbClick┘               

Calls

Name Declaration Comments
TfrmBase508Form.Create constructor Create(AOwner: TComponent); override; -
TOCRec.Create constructor Create(const AnID: string); -
GetXtraTxt procedure GetXtraTxt(OCText: TStringList; x: String; y: String); -
IsMonograph function IsMonograph(): Boolean; procedure DeleteMonograph(); procedure GetMonographList(ListOfMonographs: TStringList); procedure GetMonograph(Monograph: TStringList; x: Integer); procedure GetXtraTxt(OCText: TStringList; x: String; y: String); function FillerIDForDialog(IEN: Integer): string; function OrderChecksEnabled: Boolean; function OrderChecksOnDisplay(const FillerID: string): string; procedure OrderChecksOnAccept(ListOfChecks: TStringList; const FillerID, StartDtTm: string; OIList: TStringList; DupORIFN: string; Renewal: string); procedure OrderChecksOnDelay(ListOfChecks: TStringList; const FillerID, StartDtTm: string; OIList: TStringList); procedure OrderChecksForSession(ListOfChecks, OrderList: TStringList); procedure SaveOrderChecksForSession(const AReason: string; ListOfChecks: TStringList); function DeleteCheckedOrder(const OrderID: string): Boolean; function DataForOrderCheck(const OrderID: string): string; { Copay } procedure GetCoPay4Orders; procedure SaveCoPayStatus(AList: TStrings); {IMO: inpatient medication for outpatient} function IsValidIMOLoc(LocID: integer; PatientID: string): boolean; -
OrderChecksForSession procedure OrderChecksForSession(ListOfChecks, OrderList: TStringList); -
TfrmFrame.SetActiveTab procedure SetActiveTab(PageID: Integer); -
TfrmOCSession.SetReqJustify procedure SetReqJustify; -
TextForOrder function TextForOrder(const ID: string): string; -

Called-By

Name Declaration Comments
TfrmReview.cmdOKClick procedure cmdOKClick(Sender: TObject); -
ExecuteReleaseOrderChecks procedure ExecuteReleaseOrderChecks(SelectList: TList); -


Source

144   function ExecuteSessionOrderChecks(OrderList: TStringList) : Boolean;
145   var
146     i, j, k, l, m, rowcnt: Integer;
147     LastID, NewID, gridtext: string;
148     CheckList,remOC: TStringList;
149     OCRec: TOCRec;
150     frmOCSession: TfrmOCSession;
151     x,substring: string;
152   begin
153     Result := True;
154     CheckList := TStringList.Create;
155     try
156       StatusText('Order Checking...');
157       OrderChecksForSession(CheckList, OrderList);
158       StatusText('');
159       if CheckList.Count > 0 then
160       begin
161         frmOCSession := TfrmOCSession.Create(Application);
162         //frmOCSession.grdchecks.RowCount := frmOCSession.grdchecks.RowCount + 1; *)
163         //rowcnt := frmOCSession.grdchecks.RowCount;
164         //if RowCnt > frmOCSession.grdchecks.RowCount then frmOCSession.grdchecks.RowCount := RowCnt;
165         rowcnt := 1;
166         frmOCSession.grdchecks.canvas.Font.Name := 'Courier New';
167         frmOCSession.grdchecks.Canvas.Font.Size := MainFontSize;
168         frmOCSession.cmdMonograph.Enabled := false;
169         if IsMonograph then frmOCSession.cmdMonograph.Enabled := true;
170         try
171           ResizeFormToFont(TForm(frmOCSession));
172           uCheckedOrders := TList.Create;
173           LastID := '';
174           for i := 0 to CheckList.Count - 1 do
175           begin
176             NewID := Piece(CheckList[i], U, 1);
177             if NewID <> LastID then
178             begin
179               OCRec := TOCRec.Create(NewID);
180               uCheckedOrders.Add(OCRec);
181               LastID := NewID;
182             end; {if NewID}
183           end; {for i}
184           with uCheckedOrders do for i := 0 to Count - 1 do
185           begin
186             OCRec := TOCRec(Items[i]);
187             x := TextForOrder(OCRec.OrderID);
188             OCRec.OrderText := x;
189             frmOCSession.grdchecks.Cells[2,rowcnt] := OCRec.OrderID + '^O^0^';
190             frmOCSession.grdchecks.Cells[1,rowcnt] := OCRec.OrderText;
191             RowCnt := RowCnt + 1;
192             if RowCnt > frmOCSession.grdchecks.RowCount then frmOCSession.grdchecks.RowCount := RowCnt;
193             l := 0;
194             m := 0;
195             for j := 0 to CheckList.Count - 1 do
196               if Piece(CheckList[j], U, 1) = OCRec.OrderID then m := m+1;
197   
198             for j := 0 to CheckList.Count - 1 do
199               if Piece(CheckList[j], U, 1) = OCRec.OrderID then
200               begin
201                 l := l+1;
202                 gridText := '';
203                 substring := Copy(Piece(CheckList[j], U, 4),0,2);
204                 if substring='||' then
205                 begin
206                   remOC := TStringList.Create;
207                   substring := Copy(Piece(CheckList[j], U, 4),3,Length(Piece(CheckList[j], U, 4)));
208                   GetXtraTxt(remOC,Piece(substring,'&',1),Piece(substring,'&',2));
209                   for k := 0 to remOC.Count - 1 do
210                   begin
211                     //add each line to x and OCRec.Checks
212                     if k=remOC.Count-1 then
213                     begin
214                       OCRec.Checks.Add(Pieces(CheckList[j], U, 2, 3)+'^'+'      '+RemOC[k]);
215                       x := x + CRLF + RemOC[k];
216                       if gridText = '' then gridText := RemOC[k]
217                       else gridText := gridText + CRLF + '      ' +RemOC[k];
218                     end
219                     else if k=0 then
220                     begin
221                       OCRec.Checks.Add(Pieces(CheckList[j], U, 2, 3)+'^'+RemOC[k]);
222                       x := x + CRLF + '('+inttostr(l)+' of '+inttostr(m)+')  ' + RemOC[k];
223                       if gridText = '' then gridText := '('+inttostr(l)+' of '+inttostr(m)+')  ' + RemOC[k]
224                       else gridText := gridText + CRLF + RemOC[k];
225                     end
226                     else
227                     begin
228                       OCRec.Checks.Add(Pieces(CheckList[j], U, 2, 3)+'^'+'      '+RemOC[k]);
229                       x := x + CRLF + RemOC[k];
230                       if gridText = '' then gridText := RemOC[k]
231                       else gridText := gridText + CRLF + '      ' + RemOC[k];
232                     end;
233                   end;
234                   x := x + CRLF + '        ';
235                       if gridText = '' then gridText := '      '
236                       else gridText := gridText + CRLF + '      ';
237                   remOC.free;
238                 end
239                 else
240                 begin
241                   OCRec.Checks.Add(Pieces(CheckList[j], U, 2, 4));
242                   x := x + CRLF + '('+inttostr(l)+' of '+inttostr(m)+')  ' + Piece(CheckList[j], U, 4);
243                   gridText := '('+inttostr(l)+' of '+inttostr(m)+')  ' + Piece(CheckList[j], U, 4);
244                 end;
245                if (Piece(CheckList[j], U, 3) = '1') then frmOCSession.grdchecks.Cells[1,rowcnt] := '*Order Check requires Reason for Override' + CRLF +  gridText
246                else frmOCSession.grdchecks.Cells[1,rowcnt] := gridText;
247                 frmOCSession.grdchecks.Cells[2,rowcnt] := OCRec.OrderID + '^I^'+Piece(CheckList[j], U, 3);
248                 //frmOCSession.grdchecks.Objects[2, rowcnt] := OCRec;
249                 rowcnt := rowcnt +1;
250                 if RowCnt > frmOCSession.grdchecks.RowCount then frmOCSession.grdchecks.RowCount := RowCnt;
251               end;
252           end; {with...for i}
253           frmOCSession.FOrderList := OrderList;
254           frmOCSession.FCheckList := CheckList;
255           frmOCSession.SetReqJustify;
256           MessageBeep(MB_ICONASTERISK);
257           if frmOCSession.Visible then frmOCSession.SetFocus;
258           frmOCSession.ShowModal;
259           Result := not frmOCSession.CancelSignProcess;
260           if frmOCSession.CancelSignProcess then begin
261             OrderList.Clear;
262             if Assigned(frmFrame) then
263               frmFrame.SetActiveTab(CT_ORDERS);
264           end
265   		    else
266   		    if frmOCSession.modalresult = mrRetry then Result := False;
267   
268           if ScreenReaderActive = True then
269             begin
270               frmOCSession.lblInstr.TabStop := true;
271               frmOCSession.memNote.TabStop := true;
272               frmOCSession.memNote.TabOrder := 2;
273             end
274           else
275           begin
276             frmOCSession.lblInstr.TabStop := false;
277             frmOCSession.memNote.TabStop := false;
278           end;
279         finally
280           with uCheckedOrders do for i := 0 to Count - 1 do TOCRec(Items[i]).Free;
281           frmOCSession.Free;
282         end; {try}
283       end; {if CheckList}
284     finally
285       CheckList.Free;
286     end;
287   end;