Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (10 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

File:
1 edited

Legend:

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

    r829 r1679  
    180180    imgLblImages: TVA508ImageListLabeler;
    181181    imgLblConsults: TVA508ImageListLabeler;
     182    popNoteMemoViewCslt: TMenuItem;   //wat cq 17586
    182183    procedure mnuChartTabClick(Sender: TObject);
    183184    procedure lstConsultsClick(Sender: TObject);
     
    285286    procedure cmdEditResubmitExit(Sender: TObject);
    286287    procedure cmdNewConsultExit(Sender: TObject);
     288    procedure popNoteMemoViewCsltClick(Sender: TObject);   //wat cq 17586
    287289  private
    288290    FocusToRightPanel : Boolean;
     
    348350    function UserIsSigner(NoteIEN: integer): boolean;
    349351  public
     352    function CustomCanFocus(Control: TWinControl): Boolean; //CB
     353    function LinesVisible(richedit: Trichedit): integer; //CB
    350354    function ActiveEditOf(AnIEN: Int64): Boolean;
    351355    function  AllowContextChange(var WhyNot: string): Boolean; override;
     
    364368    property Drawers: TFrmDrawers read GetDrawers; // Keep Drawers published
    365369  end;
     370
    366371
    367372var
     
    638643  CurrNotifIEN := 0;
    639644  EditingIndex := -1;
    640   tvConsults.Enabled := True;
    641   lstConsults.Enabled := True ;
     645  pnlConsultList.Enabled := True; //CQ#15785
     646//  tvConsults.Enabled := True;
     647//  lstConsults.Enabled := True ;
    642648  lstNotes.Enabled := True ;
    643649  pnlRead.BringToFront ;
     
    769775  try
    770776    ClearEditControls;
    771     tvConsults.Enabled := False;
    772     lstConsults.Enabled := False ;
     777    pnlConsultList.Enabled := False; //CQ#15785
     778//    tvConsults.Enabled := False;
     779//    lstConsults.Enabled := False ;
    773780    FillChar(FEditNote, SizeOf(FEditNote), 0);  //v15.7
    774781    with FEditNote do
     
    899906      begin
    900907        ClearEditControls;
    901         lstConsults.Enabled := True;
    902         tvConsults.Enabled := True;
     908        pnlConsultList.Enabled := True; //CQ#15785
     909//        lstConsults.Enabled := True;
     910//        tvConsults.Enabled := True;
    903911      end;
    904912    SetResultMenus ;
     
    930938  AClassName := DCL_CONSULTS;
    931939  ClearEditControls;
    932   lstConsults.Enabled := False ;
    933   tvConsults.Enabled := False;
     940  pnlConsultList.Enabled := False; //CQ#15785
     941//  lstConsults.Enabled := False ;
     942//  tvConsults.Enabled := False;
    934943  with FEditNote do
    935944  begin
     
    10081017      InfoBox(CreatedNote.ErrorText, TX_CREATE_ERR, MB_OK);
    10091018      HaveRequired := False;
    1010       lstConsults.Enabled := True;
    1011       tvConsults.Enabled := True;
     1019      pnlConsultList.Enabled := True; //CQ#15785
     1020//      lstConsults.Enabled := True;
     1021//      tvConsults.Enabled := True;
    10121022    end; {if CreatedNote.IEN}
    10131023  end; {if HaveRequired}
     
    15591569end;
    15601570
     1571//wat cq 17586
     1572procedure TfrmConsults.popNoteMemoViewCsltClick(Sender: TObject);
     1573var
     1574  CsltIEN: integer ;
     1575  ConsultDetail: TStringList;
     1576  x: string;
     1577begin
     1578  inherited;
     1579  if (Screen.ActiveControl <> memResults) or (FEditNote.PkgPtr <> PKG_CONSULTS) then Exit;
     1580  CsltIEN := frmConsults.FEditNote.PkgIEN;
     1581  x := FindConsult(CsltIEN);
     1582  ConsultDetail := TStringList.Create;
     1583  try
     1584    LoadConsultDetail(ConsultDetail, CsltIEN) ;
     1585    ReportBox(ConsultDetail, 'Consult Details: #' + IntToStr(CsltIEN) + ' - ' + Piece(x, U, 4), TRUE);
     1586  finally
     1587    ConsultDetail.Free;
     1588  end;
     1589end;  //END cq 17586
     1590
    15611591procedure TfrmConsults.mnuActAddIDEntryClick(Sender: TObject);
    15621592const
     
    17921822      popNoteMemoEncounter.Visible := FALSE;
    17931823      UpdateList;
    1794       lstConsults.Enabled := True ;
    1795       tvConsults.Enabled := True;
     1824      pnlConsultList.Enabled := True; //CQ#15785
     1825//      lstConsults.Enabled := True ;
     1826//      tvConsults.Enabled := True;
    17961827      with tvConsults do Selected := FindPieceNode(IntToStr(SaveConsult), 1, U, Items.GetFirstNode);
    17971828      tvConsultsClick(Self);
     
    18511882          pnlResults.Visible := False;
    18521883          pnlResults.SendToBack;
    1853           lstConsults.Enabled := True;
    1854           tvConsults.Enabled := True;
     1884          pnlConsultList.Enabled := True; //CQ#15785
     1885//          lstConsults.Enabled := True;
     1886//          tvConsults.Enabled := True;
    18551887          if Notifications.Active then
    18561888            with tvConsults do
     
    19712003          pnlResults.Visible := False;
    19722004          pnlResults.SendToBack;
    1973           lstConsults.Enabled := True;
    1974           tvConsults.Enabled := True;
     2005          pnlConsultList.Enabled := True; //CQ#15785
     2006//          lstConsults.Enabled := True;
     2007//          tvConsults.Enabled := True;
    19752008          if Notifications.Active then
    19762009            with tvConsults do
     
    21822215  ClearEditControls ;
    21832216  lstNotes.Enabled := False ;
    2184   lstConsults.Enabled  := False ;
    2185   tvConsults.Enabled := False;
     2217  pnlConsultList.Enabled := False; //CQ#15785
     2218//  lstConsults.Enabled  := False ;
     2219//  tvConsults.Enabled := False;
    21862220  x := Piece(lstConsults.Items[lstConsults.ItemIndex], U, 12);
    21872221  if x <> '' then
     
    22232257  //UnlockConsultRequest(lstNotes.ItemIEN, lstConsults.ItemIEN);
    22242258  lstNotes.Enabled := True ;
    2225   lstConsults.Enabled := True ;
    2226   tvConsults.Enabled := True;
     2259  pnlConsultList.Enabled := True; //CQ#15785
     2260//  lstConsults.Enabled := True ;
     2261//  tvConsults.Enabled := True;
    22272262end;
    22282263
     
    23962431                                        (MenuAccessRec.UserLevel = UL_UNRESTRICTED))
    23972432                                        and
    2398                                         (ConsultRec.ORStatus=ST_COMPLETE) and
    23992433                                       ((lstNotes.ItemIndex > -1) and
    24002434                                       ((ConsultRec.TIUResultNarrative>0) or
     
    26252659   if ItemIndex = EditingIndex then
    26262660     begin
    2627        lstConsults.Enabled := False ;
    2628        tvConsults.Enabled := False;
     2661       pnlConsultList.Enabled := False; //CQ#15785
     2662//       lstConsults.Enabled := False ;
     2663//       tvConsults.Enabled := False;
    26292664       pnlResults.Visible := True;
    26302665       pnlResults.BringToFront;
     
    26392674       if EditingIndex = -1 then
    26402675         begin
    2641            lstConsults.Enabled := True ;
    2642            tvConsults.Enabled := True;
     2676           pnlConsultList.Enabled := True; //CQ#15785
     2677//           lstConsults.Enabled := True ;
     2678//           tvConsults.Enabled := True;
    26432679         end;
    26442680       lblTitle.Caption := MakeConsultNoteDisplayText(lstNotes.Items[lstNotes.ItemIndex]);
     
    27102746    popNoteMemoPreview.Enabled  := (frmDrawers.TheOpenDrawer = odTemplates) and Assigned(frmDrawers.tvTemplates.Selected);
    27112747    popNoteMemoInsTemplate.Enabled  := (frmDrawers.TheOpenDrawer = odTemplates) and Assigned(frmDrawers.tvTemplates.Selected);
     2748    popNoteMemoViewCslt.Enabled := (FEditNote.PkgPtr = PKG_CONSULTS);  //wat cq 17586
    27122749  end else
    27132750  begin
     
    27182755    popNoteMemoPreview.Enabled  := False;
    27192756    popNoteMemoInsTemplate.Enabled := False;
     2757    popNoteMemoViewCslt.Enabled := FALSE; //wat cq 17586
    27202758  end;
    27212759end;
     
    28382876end;
    28392877
    2840 {for printing multiple notes}
    28412878procedure TfrmConsults.RequestMultiplePrint(AForm: TfrmPrintList);
    28422879var
     
    28442881  i: integer;
    28452882begin
     2883  inherited;
    28462884  with AForm.lbIDParents do
    2847   for i := 0 to Items.Count - 1 do
    2848   if Selected[i] then
    2849   begin
    2850     NoteIEN := StrToInt64def(Piece(Items[i], U, 1), 0);
    2851     if NoteIEN > 0 then PrintSF513(NoteIEN, DisplayText[i])
    2852     else if NoteIEN = 0 then InfoBox(TX_NOCONSULT, TX_NOCSLT_CAP, MB_OK)
    2853     else InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
    2854   end;
     2885  begin
     2886    for i := 0 to Items.Count - 1 do
     2887     begin
     2888       if Selected[i] then
     2889        begin
     2890         NoteIEN := ItemIEN;  //StrToInt64def(Piece(TStringList(Items.Objects[i])[0],U,1),0);
     2891         if NoteIEN > 0 then PrintSF513(NoteIEN, DisplayText[i]) else
     2892          begin
     2893           if NoteIEN = 0 then InfoBox(TX_NOCONSULT, TX_NOCSLT_CAP, MB_OK);
     2894           if NoteIEN < 0 then InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
     2895          end;
     2896        end; {if selected}
     2897     end; {for}
     2898  end; {with}
    28552899end;
    28562900
     
    31043148  AnObject: PDocTreeObject;
    31053149  tmpNode: TORTreeNode;
     3150  I:Integer;
     3151  CommentDate: String;
     3152  Format: CHARFORMAT2;
     3153  VisibleLineCount: integer;
    31063154begin
    31073155  if EditingIndex <> -1 then
     
    31163164  tvConsults.Caption := Notifications.Text;
    31173165  EditingIndex := -1;
    3118   lstConsults.Enabled := True ;
    3119   tvConsults.Enabled := True;
     3166  pnlConsultList.Enabled := True; //CQ#15785
     3167//  lstConsults.Enabled := True ;
     3168//  tvConsults.Enabled := True;
    31203169  lstNotes.Enabled := True ;
    31213170  pnlRead.BringToFront ;
     
    32043253      tvCsltNotesChange(Self, tvCsltNotes.Selected);
    32053254    end
    3206   else if (ConsultRec.ORStatus = ST_COMPLETE) and ((ConsultRec.TIUDocuments.Count + ConsultRec.MedResults.Count) > 0) then
     3255  else if (ConsultRec.ORStatus = ST_COMPLETE) and ((ConsultRec.TIUDocuments.Count + ConsultRec.MedResults.Count) > 0)
     3256  and (Pos(UpperCase('Comment added'), UpperCase(Notifications.Text)) = 0) then //CB
    32073257    mnuActDisplayResultsClick(Self);
    3208    
     3258
     3259  //CB
     3260   If (Notifications.HighLightSection <> '') and (Pos(UpperCase('Comment added'), UpperCase(Notifications.Text)) > 0) then begin
     3261   CommentDate := FormatDateTime('mm/dd/yy hh:mm', StrToDateTime(StringReplace(Notifications.HighLightSection, '@', ' ', [rfReplaceAll])) );
     3262   for I := 0 to memConsult.Lines.Count - 1 do begin
     3263     If (Pos(CommentDate, memConsult.Lines.Strings[i]) > 0) and (Pos(UpperCase('ADDED COMMENT'), UpperCase(memConsult.Lines.Strings[i])) > 0) then begin
     3264      if CustomCanFocus(memconsult) then
     3265        memConsult.SetFocus;
     3266      memConsult.SelStart := memConsult.Perform(EM_LINEINDEX, i,0);
     3267      memConsult.SelLength := Length(memConsult.Lines.Strings[i]);
     3268
     3269      //Set the background color
     3270      Format.cbSize := SizeOf(Format);
     3271      Format.dwMask := CFM_BACKCOLOR;
     3272
     3273      Format.crBackColor := clRed;
     3274      memConsult.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format));
     3275          //Get visible Line Couunt
     3276       VisibleLineCount := LinesVisible(memConsult);
     3277
     3278      if (I + VisibleLineCount)>= memConsult.Lines.Count - 1 then
     3279        memConsult.SelStart := memConsult.Perform(EM_LINEINDEX, memConsult.Lines.Count - 1,0)
     3280      else memConsult.SelStart := memConsult.Perform(EM_LINEINDEX,I + VisibleLineCount - 1,0);
     3281
     3282      memConsult.Perform($00B7, 0, 0);  //EM_SETCARRET DEFINED WRONG in Richedit.pas
     3283      memConsult.SelLength := 0;
     3284      break;
     3285     end;
     3286   end;
     3287  end;
     3288
    32093289  case Notifications.Followup of
    32103290    NF_CONSULT_REQUEST_RESOLUTION   :  Notifications.Delete;
     
    32213301  FNotifPending := False;
    32223302end;
     3303
     3304// *****************************************************************
     3305//                  Delphi's Can Focus has a bug.
     3306//     Source: http://qc.embarcadero.com/wc/qcmain.aspx?d=11229
     3307// *****************************************************************
     3308function TfrmConsults.CustomCanFocus(Control: TWinControl): Boolean;
     3309var
     3310  Form: TCustomForm;
     3311begin
     3312  Result := False;
     3313  Form := GetParentForm(Self);
     3314  if Form <> nil then
     3315  begin
     3316    Control := Self;
     3317    repeat
     3318      if not (Control.Visible and Control.Enabled) then
     3319       Exit;
     3320      Control := Control.Parent;
     3321    until Control = nil;
     3322    Result := True;
     3323  end;
     3324end;
     3325
     3326 function TfrmConsults.LinesVisible(richedit: Trichedit): integer;
     3327    Var
     3328      OldFont : HFont;
     3329      Hand : THandle;
     3330      TM : TTextMetric;
     3331      Rect  : TRect;
     3332      tempint : integer;
     3333    begin
     3334      Hand := GetDC(richedit.Handle);
     3335      try
     3336        OldFont := SelectObject(Hand, richedit.Font.Handle);
     3337        try
     3338          GetTextMetrics(Hand, TM);
     3339          richedit.Perform(EM_GETRECT, 0, longint(@Rect));
     3340          tempint := (Rect.Bottom - Rect.Top) div
     3341             (TM.tmHeight + TM.tmExternalLeading);
     3342        finally
     3343          SelectObject(Hand, OldFont);
     3344        end;
     3345      finally
     3346        ReleaseDC(richedit.Handle, Hand);
     3347      end;
     3348      Result := tempint;
     3349    end;
    32233350
    32243351procedure TfrmConsults.mnuActEditResubmitClick(Sender: TObject);
     
    39484075      if not LockConsultRequest(AConsult) then Exit;
    39494076      lstNotes.Enabled := False ;
    3950       lstConsults.Enabled  := False ;
    3951       tvConsults.Enabled := False;
     4077      pnlConsultList.Enabled := False; //CQ#15785
     4078//      lstConsults.Enabled  := False ;
     4079//      tvConsults.Enabled := False;
    39524080      if ActionType = 'ATTACH' then
    39534081        begin
     
    39804108    end;
    39814109  lstNotes.Enabled := True ;
    3982   lstConsults.Enabled  := True ;
    3983   tvConsults.Enabled := True;
     4110  pnlConsultList.Enabled := True; //CQ#15785
     4111//  lstConsults.Enabled  := True ;
     4112//  tvConsults.Enabled := True;
    39844113  FOrderID := GetConsultOrderIEN(AConsult);
    39854114  UnlockOrderIfAble(FOrderID);
     
    40684197          cmdPCE.Visible := FALSE;
    40694198          popNoteMemoEncounter.Visible := FALSE;
    4070           lstConsults.Enabled := True ;
    4071           tvConsults.Enabled := True;
     4199          pnlConsultList.Enabled := True; //CQ#15785
     4200//          lstConsults.Enabled := True ;
     4201//          tvConsults.Enabled := True;
    40724202          lstNotes.Enabled := True;
    40734203          lblTitle.Caption := '';
     
    44354565      popNoteListExpandSelected.Enabled := Selected.HasChildren;
    44364566      popNoteListCollapseSelected.Enabled := Selected.HasChildren;
    4437       lstConsults.Enabled := True ;
    4438       tvConsults.Enabled := True;
     4567      pnlConsultList.Enabled := True; //CQ#15785
     4568//      lstConsults.Enabled := True ;
     4569//      tvConsults.Enabled := True;
    44394570      lstNotes.Enabled := True;
    44404571      if (Selected.ImageIndex in [IMG_GMRC_TOP_LEVEL, IMG_GMRC_GROUP_OPEN, IMG_GMRC_GROUP_SHUT]) then
     
    44504581          cmdPCE.Visible := FALSE;
    44514582          popNoteMemoEncounter.Visible := FALSE;
    4452           lstConsults.Enabled := True ;
    4453           tvConsults.Enabled := True;
     4583          pnlConsultList.Enabled := True; //CQ#15785
     4584//          lstConsults.Enabled := True ;
     4585//          tvConsults.Enabled := True;
    44544586          KillDocTreeObjects(tvCsltNotes);
    44554587          tvCsltNotes.Items.Clear;
Note: See TracChangeset for help on using the changeset viewer.