Index: cprs/branches/HealthSevak-CPRS/CPRS-Chart/fGraphSettings.pas
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Chart/fGraphSettings.pas	(revision 1676)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Chart/fGraphSettings.pas	(revision 1693)
@@ -1,4 +1,4 @@
 unit fGraphSettings;
-                                          
+
 interface
 
@@ -86,5 +86,5 @@
 var
   frmGraphSettings: TfrmGraphSettings;
-  
+
   procedure DialogOptionsGraphSettings(topvalue, leftvalue, fontsize: integer;
     var actiontype: boolean);
@@ -100,4 +100,7 @@
   rGraphs, fGraphData, VAUtils;
 
+var
+  FPersonalSettings, FPublicSettings, FCloseSettings: string;
+
 procedure DialogOptionsGraphSettings(topvalue, leftvalue, fontsize: integer;
   var actiontype: boolean);
@@ -144,7 +147,9 @@
   aGraphSetting: TGraphSetting; DisplaySource: TStrings; var conv: integer; var aSettings: string);
 var
+  t1, t2: string;
   aList: TStrings;
   frmGraphSettings: TfrmGraphSettings;
 begin
+  FCloseSettings := '';
   okbutton := false;
   aSettings := '';
@@ -160,6 +165,7 @@
       FastAssign(cboDateRangeOutpatient.Items, cboDateRangeInpatient.Items);
       FastAssign(rpcGetGraphSettings, aList);
-      btnPersonal.Hint := GetPersonalSetting;
-      btnPublic.Hint := GetPublicSetting;
+      t1 := GetPersonalSetting; t2 := GetPublicSetting;   // t1 are personal, t2 public settings
+      FPersonalSettings := t1;
+      FPublicSettings := t2;
       GetTypeList(aList);
       SetSources(aList, DisplaySource);
@@ -177,5 +183,5 @@
       if okbutton then
       begin
-        aSettings := btnClose.Hint;
+        aSettings := FCloseSettings;
         conv := cboConversions.ItemIndex;
         ChangeSources(DisplaySource);
@@ -326,6 +332,6 @@
     spnMaxSelect.Min := MaxSelectMin;
     spnMaxSelect.Max := MaxSelectMax;
-    cboDateRangeOutpatient.SelectByID(GetDefaultOutpatientDate);
-    cboDateRangeInpatient.SelectByID(GetDefaultInpatientDate);
+    cboDateRangeOutpatient.SelectByID(DateRangeOutpatient);
+    cboDateRangeInpatient.SelectByID(DateRangeInpatient);
     if SortByType then SortColumn := 1 else SortColumn := 0;
     lstOptions.Tag := SortColumn;
@@ -333,5 +339,6 @@
       if Pos(SETTING_SORT, OptionSettings) = 0 then
         OptionSettings := OptionSettings + SETTING_SORT;
-    if Turbo then OptionSettings := OptionSettings + SETTING_TURBO;
+    if Turbo then
+      OptionSettings := OptionSettings + SETTING_TURBO;
     if GraphPublicEditor or GraphTurboOn then
     begin
@@ -454,5 +461,5 @@
 begin
   btnClose.Tag := 1; // forces check for changes
-  btnClose.Hint := DisplaySettings;
+  FCloseSettings := DisplaySettings;
   Close;
 end;
@@ -483,7 +490,7 @@
   settings := settings + txtMaxGraphs.Text + '|';
   settings := settings + txtMinGraphHeight.Text + '|';
-  settings := settings + '|';     // not used
+  settings := settings + '|';     // not used - reserved - set by server
   settings := settings + txtMaxSelect.Text + '|';
-  settings := settings + Piece(btnPublic.Hint, '|', 8) + '|';
+  settings := settings + Piece(FPublicSettings, '|', 8) + '|';
   settings := settings + cboDateRangeOutpatient.ItemID + '|';
   settings := settings + cboDateRangeInpatient.ItemID + '|';
@@ -497,7 +504,7 @@
 begin
   if Sender = btnPublic then
-    settings := btnPublic.Hint
+    settings := FPublicSettings
   else
-    settings := btnPersonal.Hint;
+    settings := FPersonalSettings;
   settings1 := Piece(settings, '|', 1);
   settings2 := Piece(settings, '|', 2);  //piece 3 not used
@@ -591,20 +598,11 @@
   begin
     rpcSetGraphSettings(settings, '0');
-    btnPersonal.Hint := settings;
+    FPersonalSettings := settings;
   end;
   if (Sender = btnPublicSave) then
   begin
+    SetPiece(settings, '|', 6, Piece(FPublicSettings, '|', 6));  // retain turbo setting
     rpcSetGraphSettings(settings, '1');
-    btnPublic.Hint := settings;
-  end;
-  if length(btnPersonal.Hint) > 0 then
-  begin
-    SetDefaultInpatientDate(Piece(btnPersonal.Hint, '|', 10));
-    SetDefaultOutpatientDate(Piece(btnPersonal.Hint, '|', 9));
-  end
-  else
-  begin
-    SetDefaultInpatientDate(Piece(btnPublic.Hint, '|', 10));
-    SetDefaultOutpatientDate(Piece(btnPublic.Hint, '|', 9));
+    FPublicSettings := settings;
   end;
 end;
