Procedure

TfrmODCslt.SetupDialog

Directives

Override

Module

fODConsult

Last Modified

7/15/2014 3:26:34 PM

Visibility

Public

Overrides

TfrmODBase.SetupDialog

Owner

TfrmODCslt

Declaration

procedure SetupDialog(OrderAction: Integer; const ID: string); override;

Calls Hierarchy


TfrmODCslt.SetupDialog
 ├TfrmODCslt.ReadServerVariables
 │ ├TfrmODCslt.SetProvDiagPromptingMode
 │ │ ├GetProvDxMode
 │ │ └TfrmODCslt.ControlChange
 │ │   ├TResponses.Update
 │ │   │ ├TResponses.FindResponseByName
 │ │   │ └TResponses.IENForPrompt
 │ │   └TResponses.GetOrderText
 │ │     ├TResponses.NextInstance
 │ │     ├TResponses.FindResponseByName
 │ │     ├TResponses.FormatResponse
 │ │     │ └TResponses.FindResponseByIEN
 │ │     └TResponses.AppendChildren
 │ │       ├TResponses.FindPromptByIEN
 │ │       ├TResponses.FindResponseByIEN
 │ │       └TResponses.FormatResponse...
 │ └TfrmODBase.GetKeyVariable
 ├TResponses.FindResponseByName
 ├GetServiceIEN
 ├TResponses.SetControl
 │ ├TResponses.FindResponseByName
 │ └AssignBPText
 │   ├DisplayGroupToLinkType
 │   │ └DisplayGroupByName
 │   ├TResponses.EValueFor
 │   ├GetServiceIEN
 │   ├TResponses.IValueFor
 │   ├GetProcedureIEN
 │   ├ExpandOrderObjects
 │   │ ├TdmodShared.BoilerplateOK
 │   │ │ ├ErrCount
 │   │ │ ├AddErr
 │   │ │ └TdmodShared.LoadTIUObjects
 │   │ │   └GetObjectList
 │   │ └GetTemplateText
 │   │   └TEncounter.GetVisitStr
 │   │     └TEncounter.GetVisitCategory
 │   ├SetTemplateDialogCanceled
 │   ├CheckBoilerplate4Fields
 │   ├ExecuteTemplateOrBoilerPlate
 │   └WasTemplateDialogCanceled
 ├TfrmODCslt.SetUpEarliestDate
 │ ├IsProstheticsService
 │ └TResponses.Update...
 ├TfrmODCslt.setup508Label
 ├TfrmODCslt.ShowPrerequisites
 │ ├GetServicePrerequisites
 │ └DisplayPrerequisites
 │   └CreateReportBox
 │     └TfrmBase508Form.Create
 │       ├TfrmBase508Form.UpdateAccessibilityActions
 │       ├UnfocusableControlEnter
 │       └AdjustControls
 │         ├TfrmBase508Form.ModifyUnfocusableControl
 │         └..(rec)..
 ├TfrmODCslt.SetProvDiagPromptingMode...
 ├TfrmODCslt.GetProvDxandValidateCode
 │ ├TResponses.FindResponseByName
 │ ├IsActiveICDCode
 │ │ └IsActiveCode
 │ └TfrmODCslt.SetUpCopyConsultDiagnoses
 │   ├IsOrderBillable
 │   │ └PrepOrderID
 │   └rpcRetrieveSelectedOrderInfo
 ├SetTemplateDialogCanceled
 ├WasTemplateDialogCanceled
 ├TfrmODCslt.SetupReasonForRequest
 │ ├TfrmODCslt.DefaultReasonForRequest
 │ │ ├GetDefaultReasonForRequest
 │ │ ├ExpandOrderObjects...
 │ │ ├WasTemplateDialogCanceled
 │ │ ├TemplateBPHasObjects
 │ │ └FastAssignWith508Msg
 │ │   └SpeakTextInserted
 │ ├ReasonForRequestEditable
 │ ├EnableReason
 │ └DisableReason
 ├TfrmODCslt.ControlChange...
 ├TfrmODCslt.BuildQuickTree
 ├BuildServiceTree
 ├TfrmODCslt.NotinIndex
 ├TfrmODCslt.DefaultReasonForRequest...
 └TfrmODBase.PreserveControl

Calls

Name Declaration Comments
TfrmODCslt.BuildQuickTree procedure BuildQuickTree(QuickList: TStrings; const Parent: string; Node: TTreeNode); -
BuildServiceTree procedure BuildServiceTree(Tree: TORTreeView; SvcList: TStrings; const Parent: string; Node: TORTreeNode); -
TfrmODCslt.ControlChange procedure ControlChange(Sender: TObject); -
TfrmODCslt.DefaultReasonForRequest function DefaultReasonForRequest(Service: string; Resolve: Boolean): TStrings; -
TResponses.FindResponseByName function FindResponseByName(const APromptID: string; AnInstance: Integer): TResponse; -
TfrmODCslt.GetProvDxandValidateCode procedure GetProvDxandValidateCode(AResponses: TResponses); -
GetServiceIEN function GetServiceIEN(ORIEN: string): string; -
TfrmODCslt.NotinIndex function NotinIndex(AList: TStringList; i: integer): boolean; -
TfrmODBase.PreserveControl procedure PreserveControl(AControl: TControl); -
TfrmODCslt.ReadServerVariables procedure ReadServerVariables; -
TResponses.SetControl procedure SetControl(AControl: TControl; const APromptID: string; AnInstance: Integer); -
TfrmODCslt.SetProvDiagPromptingMode procedure SetProvDiagPromptingMode; -
SetTemplateDialogCanceled procedure SetTemplateDialogCanceled(value: Boolean); -
TfrmODCslt.setup508Label procedure setup508Label(lbl: TVA508StaticText; ctrl: TORComboBox); -
TfrmODCslt.SetUpEarliestDate procedure SetUpEarliestDate; -
TfrmODCslt.SetupReasonForRequest procedure SetupReasonForRequest(OrderAction: integer); -
TfrmODCslt.ShowPrerequisites function ShowPrerequisites: boolean; -
WasTemplateDialogCanceled function WasTemplateDialogCanceled: Boolean; -


Source

305   procedure TfrmODCslt.SetupDialog(OrderAction: Integer; const ID: string);
306   const
307     TX_INACTIVE_SVC = 'This consult service is currently inactive and not receiving requests.' + CRLF +
308                       'Please contact your Clinical Coordinator/IRM staff to fix this order.';
309     TX_INACTIVE_SVC_CAP = 'Inactive Service';
310     TX_NO_SVC = 'The order or quick order you have selected does not specify a consult service.' + CRLF +
311                 'Please contact your Clinical Coordinator/IRM staff to fix this order.';
312     TC_NO_SVC = 'No service specified';
313   var
314    i:integer;
315    AList: TStringList;
316    tmpResp: TResponse;
317    SvcIEN: string;
318   begin
319     inherited;
320     LLS_LINE_INDEX := -1;
321     ReadServerVariables;
322     AList := TStringList.Create;
323     try
324       if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
325       begin
326         Changing := True;
327         tmpResp := TResponse(FindResponseByName('ORDERABLE',1));
328         if tmpResp <> nil then
329           SvcIEN := GetServiceIEN(tmpResp.IValue)
330         else
331           begin
332             InfoBox(TX_NO_SVC, TC_NO_SVC, MB_ICONERROR or MB_OK);
333             AbortOrder := True;
334             Close;
335             Exit;
336           end;
337         if SvcIEN = '-1' then
338           begin
339             InfoBox(TX_INACTIVE_SVC, TX_INACTIVE_SVC_CAP, MB_OK);
340             AbortOrder := True;
341             Close;
342             Exit;
343           end;
344   
345         cboService.Items.Add(SvcIEN + U + tmpResp.EValue + '^^^^' + tmpResp.IValue);
346         cboService.SelectByID(SvcIEN);
347         tmpResp := TResponse(FindResponseByName('CLASS',1));
348         cboCategory.SelectByID(tmpResp.IValue);
349         if tmpResp.IValue = 'I' then
350           radInpatient.Checked := True
351         else
352           radOutpatient.Checked := True ;
353         SetControl(cboUrgency,    'URGENCY',   1);
354         SetControl(cboPlace,      'PLACE',     1);
355         SetControl(txtAttn,       'PROVIDER',  1);
356         SetControl(calEarliest,   'EARLIEST',  1);
357         SetUpEarliestDate;   //wat v28
358         cboService.Enabled := False;
359         setup508Label(servicelbl508, cboService);
360         cboService.Font.Color := clGrayText;
361         btnServiceTree.Enabled := False;
362         pnlServiceTreeButton.Enabled := False;
363         if (OrderAction in [ORDER_COPY, ORDER_QUICK]) and (not ShowPrerequisites) then
364           begin
365             Close;
366             Exit;
367           end;
368         SetProvDiagPromptingMode;
369         GetProvDxandValidateCode(Responses);
370         SetTemplateDialogCanceled(FALSE);
371         SetControl(memReason,     'COMMENT',   1);
372         if WasTemplateDialogCanceled then
373         begin
374           AbortOrder := True;
375   		SetTemplateDialogCanceled(FALSE);
376           Close;
377           Exit;
378         end;
379         SetTemplateDialogCanceled(FALSE);
380         SetupReasonForRequest(OrderAction);
381         if WasTemplateDialogCanceled then
382         begin
383           AbortOrder := True;
384   		SetTemplateDialogCanceled(FALSE);
385           Close;
386           Exit;
387         end;
388         Changing := False;
389         ControlChange(Self);
390       end
391       else
392       begin
393         if QuickList.Count > 0 then BuildQuickTree(QuickList, '0', nil) ;
394         FastAssign(LoadServiceListWithSynonyms(CN_SVC_LIST_ORD), SvcList);           {RV}
395         FastAssign(SvcList, AList);
396         SortByPiece(AList, U, 2);
397         BuildServiceTree(treService, SvcList, '0', nil) ;
398         with treService do
399           begin
400             for i:=0 to Items.Count-1 do
401               if Items[i].Level > 0 then Items[i].Expanded := False else Items[i].Expanded := True;
402             TopItem  := Items[LastNode] ;
403             Changing := True;
404             Selected := Items[LastNode] ;
405             Changing := False;
406             SendMessage(Handle, WM_HSCROLL, SB_THUMBTRACK, 0);
407           end ;
408         if QuickList.Count > 0 then with cboService do
409           begin
410             FastAssign(QuickList, cboService.Items);
411             Items.Add(LLS_LINE);
412             LLS_LINE_INDEX := Items.IndexOf(Trim(Piece(LLS_LINE, U, 2))); {TP - HDS00015782: Used to determine if QO}
413             Items.Add(LLS_SPACE);
414           end;
415         Changing := True;
416         for i := 0 to AList.Count - 1 do
417           //if (cboService.Items.IndexOf(Trim(Piece(AList.Strings[i], U, 2))) = -1) and   {RV}
418           if (NotinIndex(AList,i)) and   {TP - HDS00015782: Check if service is already in index (not including QO)}
419           //if (cboService.SelectByID(Piece(AList.Strings[i], U, 1)) = -1) and
420              (Piece(AList.Strings[i], U, 5) <> '1') then
421             cboService.Items.Add(AList.Strings[i]);
422         cboService.ItemIndex := 0;
423         Changing := False;
424         if treService.Selected <> nil then
425           begin
426             if (TORTreeNode(treService.Selected).StringData <> '') and
427                (Piece(TORTreeNode(treService.Selected).StringData, U, 5) <> '1') then
428               cboService.ItemIndex := cboService.Items.IndexOf(Trim(Piece(TORTreeNode(treService.Selected).StringData, U, 2)))
429               //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))
430             else
431               cboService.ItemIndex := -1;
432           end
433         else
434           cboService.ItemIndex := -1;
435         if cboService.ItemIEN > 0 then
436           begin
437             if not ShowPrerequisites then
438               begin
439                 Close;
440                 Exit;
441               end;
442             QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
443           end;
444         PreserveControl(treService);
445         PreserveControl(cboService);
446       end;
447     finally
448       AList.Free;
449     end;
450   end;