Index: cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.dfm
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.dfm	(revision 1702)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.dfm	(revision 1703)
@@ -4,5 +4,5 @@
   HelpContext = 5000
   Caption = 'Progress Notes Page'
-  ClientHeight = 394
+  ClientHeight = 573
   ClientWidth = 679
   HelpFile = 'overvw'
@@ -12,25 +12,26 @@
   OnShow = FormShow
   ExplicitWidth = 687
-  ExplicitHeight = 440
+  ExplicitHeight = 627
   PixelsPerInch = 96
   TextHeight = 13
   inherited shpPageBottom: TShape
-    Top = 389
+    Top = 568
     Width = 679
-    ExplicitTop = 358
+    ExplicitTop = 408
     ExplicitWidth = 679
   end
   inherited sptHorz: TSplitter
     Left = 64
-    Height = 389
+    Height = 568
     OnCanResize = sptHorzCanResize
     ExplicitLeft = 64
-    ExplicitHeight = 358
+    ExplicitHeight = 408
   end
   inherited pnlLeft: TPanel
     Width = 64
-    Height = 389
+    Height = 568
+    Constraints.MinWidth = 37
     ExplicitWidth = 64
-    ExplicitHeight = 389
+    ExplicitHeight = 548
     object lblNotes: TOROffsetLabel
       Left = 0
@@ -49,5 +50,5 @@
     object lblSpace1: TLabel
       Left = 0
-      Top = 344
+      Top = 523
       Width = 64
       Height = 3
@@ -55,9 +56,9 @@
       AutoSize = False
       Caption = ' '
-      ExplicitTop = 313
+      ExplicitTop = 363
     end
     object cmdNewNote: TORAlignButton
       Left = 0
-      Top = 347
+      Top = 526
       Width = 64
       Height = 21
@@ -67,8 +68,9 @@
       OnClick = cmdNewNoteClick
       OnExit = cmdNewNoteExit
+      ExplicitTop = 506
     end
     object cmdPCE: TORAlignButton
       Left = 0
-      Top = 368
+      Top = 547
       Width = 64
       Height = 21
@@ -79,4 +81,5 @@
       OnClick = cmdPCEClick
       OnExit = cmdPCEExit
+      ExplicitTop = 527
     end
     object pnlDrawers: TPanel
@@ -84,16 +87,17 @@
       Top = 19
       Width = 64
-      Height = 325
+      Height = 504
       Align = alClient
       BevelOuter = bvNone
       TabOrder = 0
+      ExplicitHeight = 484
       object splDrawers: TSplitter
         Left = 0
-        Top = 322
+        Top = 501
         Width = 64
         Height = 3
         Cursor = crVSplit
         Align = alBottom
-        ExplicitTop = 291
+        ExplicitTop = 342
       end
       object lstNotes: TORListBox
@@ -121,5 +125,5 @@
         Top = 0
         Width = 64
-        Height = 322
+        Height = 501
         Align = alClient
         Constraints.MinWidth = 30
@@ -142,4 +146,5 @@
         NodePiece = 0
         ShortNodeCaptions = True
+        ExplicitHeight = 481
       end
     end
@@ -148,20 +153,21 @@
     Left = 68
     Width = 611
-    Height = 389
+    Height = 568
+    Constraints.MinWidth = 30
     ExplicitLeft = 68
     ExplicitWidth = 611
-    ExplicitHeight = 389
+    ExplicitHeight = 548
     object sptVert: TSplitter
       Left = 0
-      Top = 340
+      Top = 519
       Width = 611
       Height = 4
       Cursor = crVSplit
       Align = alBottom
-      ExplicitTop = 309
+      ExplicitTop = 359
     end
     object memPCEShow: TRichEdit
       Left = 0
-      Top = 344
+      Top = 523
       Width = 611
       Height = 45
@@ -175,4 +181,5 @@
       TabOrder = 2
       OnExit = memPCEShowExit
+      ExplicitTop = 503
     end
     object pnlWrite: TPanel
@@ -180,5 +187,5 @@
       Top = 0
       Width = 611
-      Height = 340
+      Height = 519
       Align = alClient
       BevelOuter = bvNone
@@ -186,9 +193,10 @@
       Visible = False
       OnResize = pnlWriteResize
+      ExplicitHeight = 499
       object memNewNote: TRichEdit
         Left = 0
         Top = 67
         Width = 611
-        Height = 273
+        Height = 452
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
@@ -197,4 +205,5 @@
         Font.Name = 'Courier New'
         Font.Style = []
+        MaxLength = 2147483645
         ParentFont = False
         PlainText = True
@@ -207,4 +216,5 @@
         OnKeyPress = memNewNoteKeyPress
         OnKeyUp = memNewNoteKeyUp
+        ExplicitHeight = 432
       end
       object pnlFields: TPanel
@@ -295,5 +305,5 @@
           Font.Charset = DEFAULT_CHARSET
           Font.Color = clWindowText
-          Font.Height = -11
+          Font.Height = -12
           Font.Name = 'MS Sans Serif'
           Font.Style = []
@@ -335,9 +345,10 @@
       Top = 0
       Width = 611
-      Height = 340
+      Height = 519
       Align = alClient
       BevelOuter = bvNone
       TabOrder = 0
       OnExit = pnlReadExit
+      ExplicitHeight = 499
       object lblTitle: TOROffsetLabel
         Left = 0
@@ -354,9 +365,10 @@
       object sptList: TSplitter
         Left = 0
-        Top = 113
+        Top = 19
         Width = 611
         Height = 3
         Cursor = crVSplit
         Align = alTop
+        ExplicitTop = 113
       end
       object memNote: TRichEdit
@@ -364,5 +376,5 @@
         Top = 116
         Width = 611
-        Height = 224
+        Height = 403
         Align = alClient
         Color = clCream
@@ -385,8 +397,9 @@
         TabOrder = 1
         WordWrap = False
+        ExplicitHeight = 383
       end
       object lvNotes: TCaptionListView
         Left = 0
-        Top = 19
+        Top = 22
         Width = 611
         Height = 94
@@ -860,6 +873,11 @@
       OnClick = popNoteMemoGrammarClick
     end
+    object popNoteMemoSpellOpenSource: TMenuItem
+      Caption = 'Chec&k Spelling (OpenSource based)'
+      ShortCut = 118
+      OnClick = popNoteMemoSpellClick
+    end
     object popNoteMemoSpell: TMenuItem
-      Caption = 'C&heck Spelling'
+      Caption = 'C&heck Spelling (MS Office based)'
       OnClick = popNoteMemoSpellClick
     end
Index: cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.pas
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.pas	(revision 1702)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Chart/fNotes.pas	(revision 1703)
@@ -9,5 +9,5 @@
   uPCE, ORClasses, fDrawers, ImgList, rTIU, uTIU, uDocTree, fRptBox, fPrintList,
   fNoteST, ORNet, fNoteSTStop, fBase508Form, VA508AccessibilityManager,
-  VA508ImageListLabeler;
+  VA508ImageListLabeler, RichEdit;
 
 type
@@ -153,4 +153,5 @@
     imgLblNotes: TVA508ImageListLabeler;
     imgLblImages: TVA508ImageListLabeler;
+    popNoteMemoSpellOpenSource: TMenuItem; //WordVisTA@SK_Arora@HealthSevak to implement OpenSource SpellCheck Engine
     procedure mnuChartTabClick(Sender: TObject);
     procedure lstNotesClick(Sender: TObject);
@@ -416,4 +417,5 @@
   uChanging: Boolean;
   uIDNotesActive: Boolean;
+  NoteTotal: string;
 
 
@@ -453,4 +455,14 @@
                  frmRemDlg.btnCancelClick(Self);
                end;
+             //agp fix for a problem with reminders not clearing out when switching patients
+             if WhyNot = '' then
+                begin
+                 frmRemDlg.btnCancelClick(Self);
+                 if assigned(frmRemDlg) then
+                   begin
+                     result := false;
+                     exit;
+                   end;
+                end;
            end;
     end;
@@ -466,5 +478,5 @@
       '0': begin
              if WhyNot = 'COMMIT' then FSilent := True;
-             SaveCurrentNote(Result)
+             SaveCurrentNote(Result);
            end;
     end;
@@ -529,4 +541,5 @@
   uPCEEdit.Clear;
   frmDrawers.ResetTemplates;
+  NoteTotal := sCallV('ORCNOTE GET TOTAL', [Patient.DFN]);
 end;
 
@@ -546,4 +559,5 @@
     FCurrentContext := FDefaultContext;
     popNoteMemoSpell.Visible   := SpellCheckAvailable;
+    popNoteMemoSpellOpenSource.Visible   := SpellCheckAvailable;  //WordVisTA@SK_Arora@HealthSevak to implement OpenSource SpellCheck Engine
     popNoteMemoGrammar.Visible := popNoteMemoSpell.Visible;
     Z11.Visible                := popNoteMemoSpell.Visible;
@@ -592,12 +606,19 @@
 begin
   with AForm.lbIDParents do
-  for i := 0 to Items.Count - 1 do
-  if Selected[i] then
-  begin
-    NoteIEN := StrToInt64def(Piece(Items[i], U, 1), 0);
-    if NoteIEN > 0 then PrintNote(NoteIEN, DisplayText[i], TRUE)
-    else if NoteIEN = 0 then InfoBox(TX_NONOTE, TX_NONOTE_CAP, MB_OK)
-    else InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
-  end;
+  begin
+    for i := 0 to Items.Count - 1 do
+     begin
+       if Selected[i] then
+        begin
+         AForm.lbIDParents.ItemIndex := i;
+         NoteIEN := ItemIEN;  //StrToInt64def(Piece(TStringList(Items.Objects[i])[0],U,1),0);
+         if NoteIEN > 0 then PrintNote(NoteIEN, DisplayText[i], TRUE) else
+         begin
+           if NoteIEN = 0 then InfoBox(TX_NONOTE, TX_NONOTE_CAP, MB_OK);
+           if NoteIEN < 0 then InfoBox(TX_NOPRT_NEW, TX_NOPRT_NEW_CAP, MB_OK);
+         end;
+        end; {if selected}
+     end; {for}
+  end; {with}
 end;
 
@@ -649,5 +670,5 @@
   // clear the editing controls (also clear the new labels?)
   txtSubject.Text := '';
-  //lblNotes.Caption := '';
+  lblNotes.Caption := '';
   SearchTextStopFlag := false;
   if memNewNote <> nil then memNewNote.Clear; //CQ7012 Added test for nil
@@ -703,6 +724,14 @@
           EnableList := [odTemplates]
         else
-          EnableList := [odTemplates, odReminders];
-        ShowList := [odTemplates, odReminders];
+          if FutureEncounter(uPCEEdit) then
+            begin
+              EnableList := [odTemplates];
+              ShowList := [odTemplates];
+            end
+          else
+            begin
+              EnableList := [odTemplates, odReminders];
+              ShowList := [odTemplates, odReminders];
+            end;
       end
       else
@@ -1359,5 +1388,5 @@
   if(assigned(frmReminderTree)) then
     frmReminderTree.EnableActions;
-  DisplayPCE;  
+  DisplayPCE;
   pnlRight.Refresh;
   memNewNote.Repaint;
@@ -1373,5 +1402,5 @@
   inherited;
   mnuActNewClick(Self);
- end;
+end;
 
 procedure TfrmNotes.cmdPCEClick(Sender: TObject);
@@ -1484,5 +1513,6 @@
           if not NoteEmpty then
 //            if not FChanged and (InfoBox(TX_BLR_CLEAR, TC_BLR_CLEAR, MB_YESNO) = ID_YES)
-            if (InfoBox(TX_BLR_CLEAR, TC_BLR_CLEAR, MB_YESNO) = ID_YES)
+            if (InfoBox(TX_BLR_CLEAR, TC_BLR_CLEAR,
+                        MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) = ID_YES)
               then memNewNote.Lines.Clear;
         end;
@@ -1659,5 +1689,5 @@
   NC_SEARCHTEXT: begin;
                    SearchTextStopFlag := False;
-                   SelectSearchText(Font.Size, FCurrentContext.SearchString, SearchCtxt );
+                   SelectSearchText(Font.Size, FCurrentContext.SearchString, SearchCtxt, StringReplace(TMenuItem(Sender).Caption, '&', '', [rfReplaceAll]) );
                    with SearchCtxt do if Changed then
                    begin
@@ -1743,6 +1773,9 @@
     lblNotes.Caption := 'Search for "'+FCurrentContext.SearchString+'" was stopped!';
   end;
+  //Clear the search text. We are done searching
+  FCurrentContext.SearchString := '';
   frmSearchStop.Hide;
   // Text Search CQ: HDS00002856 --------------------
+  lblNotes.Caption := lblNotes.Caption + ' (Total: ' + NoteTotal + ')'; 
   lblNotes.hint := lblNotes.Caption;
   tvNotes.Caption := lblNotes.Caption;
@@ -1984,4 +2017,9 @@
   inherited;
   if lstNotes.ItemIEN = 0 then Exit;
+  if assigned(frmRemDlg) then
+    begin
+       frmRemDlg.btnCancelClick(Self);
+       if assigned(frmRemDlg) then exit;
+    end;
   ActOnDocument(ActionSts, lstNotes.ItemIEN, 'DELETE RECORD');
   if ShowMsgOn(not ActionSts.Success, ActionSts.Reason, TX_IN_AUTH) then Exit;
@@ -2322,4 +2360,5 @@
   begin
     popNoteMemoSpell.Enabled    := True;
+    popNoteMemoSpellOpenSource.Enabled   := True;  //WordVisTA@SK_Arora@HealthSevak to implement OpenSource SpellCheck Engine
     popNoteMemoGrammar.Enabled  := True;
     popNoteMemoReformat.Enabled := True;
@@ -2331,4 +2370,5 @@
   begin
     popNoteMemoSpell.Enabled    := False;
+    popNoteMemoSpellOpenSource.Enabled    := False; //WordVisTA@SK_Arora@HealthSevak to implement OpenSource SpellCheck Engine
     popNoteMemoGrammar.Enabled  := False;
     popNoteMemoReformat.Enabled := False;
@@ -2355,5 +2395,5 @@
 begin
   inherited;
-  FEditCtrl.SelText := Clipboard.AsText; {*KCM*}
+  Sendmessage(FEditCtrl.Handle,EM_PASTESPECIAL,CF_TEXT,0);
   frmNotes.pnlWriteResize(Self);
   //FEditCtrl.PasteFromClipboard;        // use AsText to prevent formatting
@@ -2437,5 +2477,5 @@
   timAutoSave.Enabled := False;
   try
-    SpellCheckForControl(memNewNote);
+    SpellCheckForControl(memNewNote, Sender = popNoteMemoSpellOpenSource);  //WordVisTA@SK_Arora@HealthSevak to implement OpenSource SpellCheck Engine
   finally
     FChanged := True;
@@ -2945,5 +2985,8 @@
               end;
             Dest.Free;
-          end;
+          end else
+          //Reset the caption
+          lblNotes.Caption := SetNoteTreeLabel(FCurrentContext);
+
         // Text Search CQ: HDS00002856 ---------------------------------------
 
