Ignore:
Timestamp:
Jul 7, 2010, 4:31:10 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrade to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Consults/fODConsult.pas

    r456 r829  
    88  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    99  fODBase, StdCtrls, ORCtrls, ExtCtrls, ComCtrls, ORfn, uConst, Buttons,
    10   Menus, UBAGlobals, rOrders, fBALocalDiagnoses, UBAConst, UBACore, ORNet ;
     10  Menus, UBAGlobals, rOrders, fBALocalDiagnoses, UBAConst, UBACore, ORNet,
     11  VA508AccessibilityManager ;
    1112
    1213type
     
    1819    txtAttn: TORComboBox;
    1920    lblService: TLabel;
    20     lblUrgency: TStaticText;
    21     lblPlace: TStaticText;
    22     lblAttn: TStaticText;
    23     lblProvDiag: TStaticText;
     21    lblUrgency: TLabel;
     22    lblPlace: TLabel;
     23    lblAttn: TLabel;
     24    lblProvDiag: TLabel;
    2425    treService: TORTreeView;
    2526    cboCategory: TORComboBox;
     
    8687    procedure cmdQuitClick(Sender: TObject);
    8788    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     89    procedure FormResize(Sender: TObject);
     90    procedure treServiceEnter(Sender: TObject);
    8891
    8992  private
     
    103106    procedure SaveConsultDxForNurse(pDiagnosis: string);  // save the dx entered by nurese if Master BA switch is ON
    104107    procedure SetUpCopyConsultDiagnoses(pOrderID:string);
     108    procedure AdjustMemReasonSize;
    105109  protected
    106110    procedure InitDialog; override;
     
    125129uses
    126130    rODBase, rConsults, uCore, uConsults, rCore, fConsults, fPCELex, rPCE, fPreReq,
    127     ORClasses, clipbrd, uTemplates, fFrame, uODBase;
     131    ORClasses, clipbrd, uTemplates, fFrame, uODBase, uVA508CPRSCompatibility;
    128132
    129133var
     
    153157  TX_INACTIVE_CODE_OPTIONAL = 'If another code is not selected, no code will be saved.';
    154158
     159  TX_SVC_HRCHY = 'services/specialties hierarchy';
     160  TX_VIEW_SVC_HRCHY = 'View services/specialties hierarchically';
     161  TX_CLOSE_SVC_HRCHY = 'Close services/specialties hierarchy tree view';
     162
    155163procedure TfrmODCslt.FormCreate(Sender: TObject);
    156164begin
     
    180188  Responses.Dialog := 'GMRCOR CONSULT';   // loads formatting info
    181189  StatusText('Loading Default Values');
    182   Defaults.Assign(ODForConsults);  // ODForConsults returns TStrings with defaults
     190  FastAssign(ODForConsults, Defaults);  // ODForConsults returns TStrings with defaults
    183191  CtrlInits.LoadDefaults(Defaults);
    184192  txtAttn.InitLongList('') ;
     
    229237  btnServiceTree.Enabled := True;
    230238  pnlServiceTreeButton.Enabled := True;
    231   ActiveControl := cboService;
    232239  SetProvDiagPromptingMode;
     240  ActiveControl := cboService; // set after call to SetProvDiagPromptingMode
    233241  Changing := False;
    234242  StatusText('');
     
    240248                    'Please contact your Clinical Coordinator/IRM staff to fix this order.';
    241249  TX_INACTIVE_SVC_CAP = 'Inactive Service';
     250  TX_NO_SVC = 'The order or quick order you have selected does not specify a consult service.' + CRLF +
     251              'Please contact your Clinical Coordinator/IRM staff to fix this order.';
     252  TC_NO_SVC = 'No service specified';
    242253var
    243254 i:integer;
     
    254265      Changing := True;
    255266      tmpResp := TResponse(FindResponseByName('ORDERABLE',1));
    256       SvcIEN := GetServiceIEN(tmpResp.IValue);
     267      if tmpResp <> nil then
     268        SvcIEN := GetServiceIEN(tmpResp.IValue)
     269      else
     270        begin
     271          InfoBox(TX_NO_SVC, TC_NO_SVC, MB_ICONERROR or MB_OK);
     272          AbortOrder := True;
     273          Close;
     274          Exit;
     275        end;
    257276      if SvcIEN = '-1' then
    258277        begin
     
    284303      SetProvDiagPromptingMode;
    285304      GetProvDxandValidateCode(Responses);
     305      SetTemplateDialogCanceled(FALSE);
    286306      SetControl(memReason,     'COMMENT',   1);
     307      if WasTemplateDialogCanceled then
     308      begin
     309        AbortOrder := True;
     310        Close;
     311        Exit;
     312      end;
     313      SetTemplateDialogCanceled(FALSE);
    287314      SetupReasonForRequest(OrderAction);
     315      if WasTemplateDialogCanceled then
     316      begin
     317        AbortOrder := True;
     318        Close;
     319        Exit;
     320      end;
    288321      Changing := False;
    289322      ControlChange(Self);
     
    292325    begin
    293326      if QuickList.Count > 0 then BuildQuickTree(QuickList, '0', nil) ;
    294       SvcList.Assign(LoadServiceListWithSynonyms(CN_SVC_LIST_ORD));           {RV}
    295       AList.Assign(SvcList);
     327      FastAssign(LoadServiceListWithSynonyms(CN_SVC_LIST_ORD), SvcList);           {RV}
     328      FastAssign(SvcList, AList);
    296329      SortByPiece(AList, U, 2);
    297330      BuildServiceTree(treService, SvcList, '0', nil) ;
     
    308341      if QuickList.Count > 0 then with cboService do
    309342        begin
    310           Items.Assign(QuickList);
     343          FastAssign(QuickList, cboService.Items);
    311344          Items.Add(LLS_LINE);
    312345          Items.Add(LLS_SPACE);
     
    338371              Exit;
    339372            end;
    340           memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     373          QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    341374        end;
    342375      PreserveControl(treService);
     
    555588      SetControl(cboPlace,      'PLACE',     1);
    556589      SetControl(txtAttn,       'PROVIDER',  1);
     590      SetTemplateDialogCanceled(FALSE);
    557591      SetControl(memReason,     'COMMENT',   1);
     592      if WasTemplateDialogCanceled and OrderContainsObjects then
     593      begin
     594        AbortOrder := TRUE;
     595        Close;
     596        Exit;
     597      end;
    558598      if ((cboService.ItemIEN > 0) and (Length(memReason.Text) = 0)) then
    559         memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     599        QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    560600      SetupReasonForRequest(ORDER_QUICK);
    561601      GetProvDxandValidateCode(Responses);
     
    571611              Exit;
    572612            end;
    573           memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     613          QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    574614          SetupReasonForRequest(ORDER_NEW);
    575615        end;
     
    620660end;
    621661
     662procedure TfrmODCslt.treServiceEnter(Sender: TObject);
     663begin
     664  inherited;
     665  cmdQuit.Cancel := FALSE;
     666end;
     667
    622668procedure TfrmODCslt.treServiceExit(Sender: TObject);
    623669begin
    624670  inherited;
     671  cmdQuit.Cancel := TRUE;
    625672  with cboService do
    626673  begin
     
    688735  AStringList := TStringList.Create;
    689736  try
    690     AStringList.Assign(memReason.Lines);
     737    //QuickCopy(memReason, AStringList);
     738    AStringList.Text := memReason.Text;
    691739    LimitStringLength(AStringList, 74);
    692     memReason.Lines.Assign(AstringList);
     740    //QuickCopy(AstringList, memReason);
     741    memReason.Text := AStringList.Text;
    693742    ControlChange(Self);
    694743  finally
     
    762811              SetControl(cboPlace,      'PLACE',     1);
    763812              SetControl(txtAttn,       'PROVIDER',  1);
     813              SetTemplateDialogCanceled(FALSE);
    764814              SetControl(memReason,     'COMMENT',   1);
     815              if WasTemplateDialogCanceled and OrderContainsObjects then
     816              begin
     817                AbortOrder := TRUE;
     818                Close;
     819                Exit;
     820              end;
    765821//              if ((cboService.ItemIEN > 0) and (Length(memReason.Text) = 0)) then
    766 //                memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     822//                QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    767823              SetupReasonForRequest(ORDER_QUICK);
    768824              GetProvDxandValidateCode(Responses);
     
    779835                      Exit;
    780836                    end;
    781                   memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     837                  QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    782838                  SetupReasonForRequest(ORDER_NEW);
    783839                  Changing := False;
     
    824880  if treService.Visible then
    825881  begin
     882  // for some reason screen reader is reading caption when tree view is not visible
     883    treService.Caption := TX_SVC_HRCHY;
     884    pnlServiceTreeButton.Caption := TX_CLOSE_SVC_HRCHY;
     885    btnServiceTree.Hint := TX_CLOSE_SVC_HRCHY;
    826886    treService.SetFocus;
    827887    with treService do for i := 0 to Items.Count-1 do
     
    834894        end;
    835895    end;
     896  end
     897  else
     898  begin
     899    treService.Caption := '';
     900    pnlServiceTreeButton.Caption := TX_VIEW_SVC_HRCHY;
     901    btnServiceTree.Hint := TX_VIEW_SVC_HRCHY;
     902    pnlServiceTreeButton.SetFocus;
    836903  end;
    837904  Changing := False;
     
    863930      txtProvDiag.Enabled    := False;
    864931      txtProvDiag.Font.Color := clGrayText;
    865       lblProvDiag.Enabled    := False;
    866932      txtProvDiag.ReadOnly   := True;
    867933      txtProvDiag.Color      := clBtnFace;
     
    9401006  txtProvDiag.Color      := clBtnFace;
    9411007  txtProvDiag.Font.Color := clBtnText;
    942   lblProvDiag.Enabled    := False;
    9431008  txtProvDiag.Hint       := '';
    9441009  if cboService.ItemIEN = 0 then Exit;
     
    9621027      txtProvDiag.Color      := clBtnFace;
    9631028      txtProvDiag.Font.Color := clBtnText;
    964       lblProvDiag.Enabled    := False;
    9651029    end
    9661030  else
     
    9721036              txtProvDiag.Color      := clWindow;
    9731037              txtProvDiag.Font.Color := clWindowText;
    974               lblProvDiag.Enabled    := True;
    9751038            end;
    9761039      'L':  begin
     
    9891052              txtProvDiag.Color      := clInfoBk;
    9901053              txtProvDiag.Font.Color := clInfoText;
    991               lblProvDiag.Enabled    := True;
    9921054           end;
    9931055    end;
     
    10371099begin
    10381100  if ((OrderAction = ORDER_QUICK) and (cboService.ItemID <> '') and (Length(memReason.Text) = 0)) then
    1039     memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
     1101    QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
    10401102  EditReason := GMRCREAF;
    10411103  if EditReason = '' then EditReason := ReasonForRequestEditable(cboService.ItemID + CSLT_PTR);
     
    10651127      if ItemIEN > 0 then
    10661128        begin
    1067           Alist.Assign(GetServicePrerequisites(ItemID + CSLT_PTR));
     1129          FastAssign(GetServicePrerequisites(ItemID + CSLT_PTR), Alist);
    10681130          if AList.Count > 0 then
    10691131            begin
     
    11541216  try
    11551217    Result := GetDefaultReasonForRequest(Service + CSLT_PTR, Resolve);
    1156     TmpSL.Assign(Result);
     1218    FastAssign(Result, TmpSL);
    11571219    x := TmpSL.Text;
    11581220    ExpandOrderObjects(x, HasObjects);
     
    11601222    Responses.OrderContainsObjects := HasObjects;
    11611223    ExecuteTemplateOrBoilerPlate(TmpSL, cboService.ItemIEN , ltConsult, nil, 'Reason for Request: ' + cboService.DisplayText[cboService.ItemIndex], DocInfo);
    1162     if TmpSL.Text <> x then Responses.OrderContainsObjects := False;
    1163     Result.Assign(TmpSL);
     1224    AbortOrder := WasTemplateDialogCanceled;
     1225    Responses.OrderContainsObjects := HasObjects or TemplateBPHasObjects;
     1226    if AbortOrder then
     1227    begin
     1228      Result.Text := '';
     1229      Close;
     1230      Exit;
     1231    end
     1232    else
     1233      FastAssignWith508Msg(TmpSL, Result);
    11641234  finally
    11651235    TmpSL.Free;
     
    11901260      treServiceChange(Sender, treService.Selected);
    11911261    end;
     1262  VK_ESCAPE:
     1263    begin
     1264      key := 0;
     1265      btnServiceTreeClick(Self);
     1266    end   
    11921267  else
    11931268    FKeyBoarding := True;
     
    14061481end;
    14071482
     1483procedure TfrmODCslt.FormResize(Sender: TObject);
     1484begin
     1485  inherited;
     1486  AdjustMemReasonSize();
     1487end;
     1488
     1489procedure TfrmODCslt.AdjustMemReasonSize;
     1490const
     1491  PIXEL_SPACE = 3;
     1492begin
     1493  pnlReason.Top := cboService.Top + cboService.Height + PIXEL_SPACE;
     1494  pnlReason.Height := memOrder.Top - pnlReason.Top - PIXEL_SPACE;
     1495end;
     1496
    14081497end.
    14091498
Note: See TracChangeset for help on using the changeset viewer.