Index: cprs/branches/foia-cprs/CPRS-Chart/fSurgery.pas
===================================================================
--- cprs/branches/foia-cprs/CPRS-Chart/fSurgery.pas	(revision 459)
+++ cprs/branches/foia-cprs/CPRS-Chart/fSurgery.pas	(revision 460)
@@ -131,4 +131,14 @@
     popNoteMemoInsTemplate: TMenuItem;
     popNoteMemoEncounter: TMenuItem;
+    mnuViewInformation: TMenuItem;
+    mnuViewDemo: TMenuItem;
+    mnuViewVisits: TMenuItem;
+    mnuViewPrimaryCare: TMenuItem;
+    mnuViewMyHealtheVet: TMenuItem;
+    mnuInsurance: TMenuItem;
+    mnuViewFlags: TMenuItem;
+    mnuViewReminders: TMenuItem;
+    mnuViewRemoteData: TMenuItem;
+    mnuViewPostings: TMenuItem;
     procedure mnuChartTabClick(Sender: TObject);
     procedure pnlRightResize(Sender: TObject);
@@ -196,4 +206,6 @@
     procedure tvSurgeryAddition(Sender: TObject; Node: TTreeNode);
     procedure tvSurgeryDeletion(Sender: TObject; Node: TTreeNode);
+    procedure ViewInfo(Sender: TObject);
+    procedure mnuViewInformationClick(Sender: TObject);
   private
     FEditingIndex: Integer;                      // index of note being currently edited
@@ -212,5 +224,5 @@
     FDeleted: boolean;
     procedure ClearEditControls;
-    procedure DoAutoSave;
+    procedure DoAutoSave(Suppress: integer = 1);
     function GetTitleText(AnIndex: Integer): string;
     procedure InsertAddendum;
@@ -832,5 +844,5 @@
     begin
       if Title > 0 then CurTitle := Title else CurTitle := DocType;
-      if AskCosignerForTitle(CurTitle, Author) and (Cosigner <= 0) then Result := True;
+      if AskCosignerForTitle(CurTitle, Author, DateTime) and (Cosigner <= 0) then Result := True;
     end;
   end;
@@ -1371,5 +1383,5 @@
 end;
 
-procedure TfrmSurgery.DoAutoSave;
+procedure TfrmSurgery.DoAutoSave(Suppress: integer = 1);
 var
   ErrMsg: string;
@@ -1381,5 +1393,5 @@
     timAutoSave.Enabled := False;
     try
-      SetText(ErrMsg, memNewNote.Lines, lstNotes.GetIEN(EditingIndex),1);
+      SetText(ErrMsg, memNewNote.Lines, lstNotes.GetIEN(EditingIndex), Suppress);
     finally
       timAutoSave.Enabled := True;
@@ -1755,11 +1767,14 @@
 procedure TfrmSurgery.SaveSignItem(const ItemID, ESCode: string);
 { saves and optionally signs a progress note or addendum }
+const
+  SIG_COSIGN = 'COSIGNATURE';
+  SIG_SIGN   = 'SIGNATURE';
 var
   AnIndex, IEN, i: Integer;
   Saved, ContinueSign: Boolean;  {*RAB* 8/26/99}
-  SignSts: TActionRec;
+  ActionSts, SignSts: TActionRec;
   APCEObject: TPCEData;
   OK: boolean;
-
+  ActionType, SignTitle: string;
 begin
   AnIndex := -1;
@@ -1786,5 +1801,20 @@
   if Length(ESCode) > 0 then
   begin
-    if not NoteHasText(IEN) then
+    if CosignDocument(IEN) then
+    begin
+      SignTitle := TX_COSIGN;
+      ActionType := SIG_COSIGN;
+    end else
+    begin
+      SignTitle := TX_SIGN;
+      ActionType := SIG_SIGN;
+    end;
+    ActOnDocument(ActionSts, IEN, ActionType);
+    if not ActionSts.Success then
+      begin
+        InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
+        ContinueSign := False;
+      end
+    else if not NoteHasText(IEN) then
       begin
         InfoBox(TX_EMPTY_NOTE1, TC_EMPTY_NOTE, MB_OK or MB_ICONERROR);
@@ -1929,9 +1959,11 @@
 begin
   inherited;
-  DoAutoSave;
+  DoAutoSave(0);
   timAutoSave.Enabled := False;
   try
     SpellCheckForControl(memNewNote);
   finally
+    FChanged := True;
+    DoAutoSave(0);
     timAutoSave.Enabled := True;
   end;
@@ -1941,9 +1973,11 @@
 begin
   inherited;
-  DoAutoSave;
+  DoAutoSave(0);
   timAutoSave.Enabled := False;
   try
     GrammarCheckForControl(memNewNote);
   finally
+    FChanged := True;
+    DoAutoSave(0);
     timAutoSave.Enabled := True;
   end;
@@ -2019,4 +2053,5 @@
   SigAction: integer;
   SavedDocID: string;
+  ARefDate: TFMDateTime;
 begin
   inherited;
@@ -2051,5 +2086,6 @@
 
   Exclusions := GetCurrentSigners(lstNotes.ItemIEN);
-  SelectAdditionalSigners(Font.Size, lstNotes.ItemIEN, SigAction, Exclusions, SignerList, CT_NOTES);
+  ARefDate := StrToFloat(Piece(lstNotes.Items[lstNotes.ItemIndex], U, 3));
+  SelectAdditionalSigners(Font.Size, lstNotes.ItemIEN, SigAction, Exclusions, SignerList, CT_NOTES, ARefDate);
   with SignerList do
     begin
@@ -2644,4 +2680,24 @@
 end;
 
+procedure TfrmSurgery.ViewInfo(Sender: TObject);
+begin
+  inherited;
+  frmFrame.ViewInfo(Sender);
+end;
+
+procedure TfrmSurgery.mnuViewInformationClick(Sender: TObject);
+begin
+  inherited;
+  mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled;
+  mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled;
+  mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled;
+  mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No');
+  mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No');
+  mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled;
+  mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled;
+  mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled;
+  mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled;
+end;
+
 initialization
   uPCEEdit := TPCEData.Create;
