source: cprs/trunk/CPRS-Chart/uGraphs.pas@ 1798

Last change on this file since 1798 was 1679, checked in by healthsevak, 10 years ago

Updating the working copy to CPRS version 28

File size: 11.9 KB
Line 
1unit uGraphs;
2
3interface
4
5uses
6 SysUtils, Classes, Graphics, ORFn;
7
8type
9 TGraphSetting = class
10 public
11 ClearBackground: boolean;
12 DateRangeInpatient: string;
13 DateRangeOutpatient: string;
14 Dates: boolean;
15 FixedDateRange: boolean;
16 FMStartDate: double;
17 FMStopDate: double;
18 Gradient: boolean;
19 HighTime: TDateTime;
20 Hints: boolean;
21 HorizontalZoom: boolean;
22 ItemsDisplayed: TStrings;
23 ItemsForDisplay: TStrings;
24 Legend: boolean;
25 Lines: boolean;
26 LowTime: TDateTime;
27 MaxGraphs: integer;
28 MaxSelect: integer;
29 MaxSelectMin: integer;
30 MaxSelectMax: integer;
31 MinGraphHeight: integer;
32 OptionSettings: string; // only used for storage
33 Points: boolean;
34 SortByType: boolean;
35 SortColumn: integer;
36 Sources: TStrings;
37 StayOnTop: boolean;
38 Turbo: boolean;
39 Values: boolean;
40 VerticalZoom: boolean;
41 View3D: boolean;
42 end;
43
44 TGraphActivity = class
45 public
46 CurrentSetting: string;
47 OldDFN: string;
48 PublicSetting: string;
49 PersonalSetting: string;
50 PublicEditor: boolean;
51 Status: string;
52 TurboOn: boolean;
53 Cache: boolean;
54 end;
55
56const
57 BIG_NUMBER = 9999999;
58 BIG_SPACES = ' ';
59 FM_START_DATE = 2500101;
60 FM_STOP_DATE = 3500101;
61 MAX_ITEM_DISCLAIMER = 10;
62 NUM_COLORS = 16;
63 PROB_HEIGHT = 2;
64 RX_HEIGHT_IN = 12;
65 RX_HEIGHT_NVA = 9;
66 RX_HEIGHT_OUT = 15;
67 ZOOM_PERCENT = 95;
68 GRAPH_FLOAT = 'F';
69 GRAPH_REPORT = 'R';
70 POINT_PADDING = 0.03; // assume a point height of 3%
71 LLS_FRONT = '^____[';
72 LLS_BACK = ']___________________________________________________________________________________________________________';
73
74
75 // settings use single character
76 SETTING_3D = 'A';
77 SETTING_CLEAR = 'B';
78 SETTING_DATES = 'C';
79 SETTING_GRADIENT = 'D';
80 SETTING_HINTS = 'E';
81 SETTING_LEGEND = 'F';
82 SETTING_LINES = 'G';
83 SETTING_SORT = 'H';
84 SETTING_TOP = 'I';
85 SETTING_VALUES = 'J';
86 SETTING_HZOOM = 'K';
87 SETTING_VZOOM = 'L';
88 SETTING_FIXED = 'M';
89 SETTING_TURBO = 'N';
90
91 // keypress flags
92 KEYPRESS_ON = 'YES';
93 KEYPRESS_OFF = 'NO';
94
95 // format date/time axis
96 DFORMAT_MDY = 'm/d/yyyy';
97 DFORMAT_MYY = 'm/yy';
98 DFORMAT_YY = 'yy';
99 DWIDTH_MDY = 66;
100 DWIDTH_MYY = 30;
101 DWIDTH_YY = 18;
102
103 // text messages
104 TXT_COMMENTS = '** comments';
105 TXT_COPY_DISCLAIMER = 'Note: Graphs display limited data, view details for more information.';
106 TXT_DISCLAIMER = 'Due to number of items and size restrictions on your display, '
107 + 'all items may not be visible.';
108 TXT_INFO = 'Select multiple items using Ctrl-click or Shift-click.';
109 TXT_NONNUMERICS = 'free-text values:';
110 TXT_NOGRAPHING = 'CPRS is not configured for graphing.';
111 TXT_PRINTING = 'Graphs are being printed';
112 TXT_REPORT_DISCLAIMER = 'Note: Listing displays limited data, view details for more information.';
113 TXT_VIEW_DEFINITION = 'View Definition';
114 TXT_WARNING = 'Warning: You are using graph settings with a Special Function.';
115 TXT_WARNING_SAME_TIME = 'Warning: Items have multiple occurrences at the same time.';
116 TXT_ZOOMED = 'Zoomed Date Range: ';
117
118 // views
119 VIEW_CURRENT = '-999';
120 VIEW_LABS = '-3';
121 VIEW_PERSONAL = '-1';
122 VIEW_PUBLIC = '-2';
123 VIEW_TEMPORARY = '-888';
124
125 COLOR_INFO = clCream;
126 COLOR_PRINTING = clMoneyGreen; //$CCFFFF; $CCCCFF; $CCFFCC; $FFCCCC; $FFCCFF; $FFFFCC;
127 COLOR_WARNING = clCream; //clFuchsia;
128 COLOR_ZOOM = clCream; //clSkyBlue;
129
130 // hint messages for view definition
131 HINT_PAT_SOURCE = 'Only items where the patient has data are displayed.'
132 + #13 + 'Use this for selecting items to display on the graph.';
133 HINT_ALL_SOURCE = 'All possible items are displayed.'
134 + #13 + 'Use this for defining items to be displayed/saved as Views.'
135 + #13 + 'Note: For easy use, select Views for graphing.';
136 HINT_SELECTION_INFO = 'This form is primarily used for defining views.'
137 + #13 + 'Usually selection is done by selecting Views or Items to graph.'
138 + #13 + 'This form defines views.'
139 + #13 + 'The Settings form defines items that are always selectable for graphing.';
140 HINT_SOURCE = 'These are the different types of data.'
141 + #13 + 'Types are followed by a section showing your Personal Views, then Public Views.'
142 + #13 + 'Click a type and then select individual items'
143 + #13 + 'Double-click a type to select all items of this type - <any>';
144 HINT_OTHER_SOURCE = 'These are Views and Lab Groups of other users.'
145 + #13 + 'Use these for defining items to be displayed/saved as Views.'
146 + #13 + 'Note: Select a Person to display their views and lab groups.';
147 HINT_OTHERS = 'Select other users to see their views or lab groups.'
148 + #13 + 'Use these for defining items to be displayed/saved as Views.';
149 HINT_BTN_DEFINITION = 'Click to display the definitions of all selections.'
150 + #13 + 'Definitions show the items that make up a view or lab group.'
151 + #13 + 'This includes views and lab groups of another user you have selected.';
152 HINT_SELECTION = 'Select specific items and move them to the right.'
153 + #13 + 'Use the arrow buttons or double click.'
154 + #13 + 'Selecting a type <any> will use all patients for that type.';
155 HINT_DISPLAY = 'This is the list of items, types, and/or views that compose the View that will be graphed.'
156 + #13 + 'You can save this as a personal view by clicking the Save Personal button.';
157 HINT_BTN_ADDALL = 'Click to add all items for display.';
158 HINT_BTN_ADD1 = 'Click to add this item for display (or double-click item).';
159 HINT_BTN_REMOVE1 = 'Click to remove this item from display (or double-click item).';
160 HINT_BTN_REMOVEALL = 'Click to remove all items from display.';
161 HINT_BTN_CLEAR = 'Click to clear the Items and Items for Graphing lists.';
162 HINT_BTN_DELETE = 'Click to delete the selected view.';
163 HINT_BTN_RENAME = 'Click to rename the selected view.';
164 HINT_BTN_SAVE = 'Click to save your view.'
165 + #13 + 'You will give this view a name that can be selected from the graph.';
166 HINT_BTN_SAVE_PUB = 'Click to save a public view (available to editors only).'
167 + #13 + 'Public views can be selected by all users.';
168 HINT_APPLY = 'Select the section you where you want to display the graph.';
169 HINT_BTN_CLOSE = 'Click to display items for graphing.'
170 + #13 + 'Note: If you are using this from the Options menu, '
171 + #13 + 'items are not displayed (multiple graphs may be in use).'
172 + #13 + 'You should save any view definitions before closing this form.';
173
174 // hint messages for settings
175 SHINT_SOURCES = 'This is a list of all the types of data that can be graphed.'
176 + #13 + 'Check the types you wish to be selectable on the graph.'
177 + #13 + 'It is best to only check the types that you frequently use.'
178 + #13 + 'If you select a view on the graph that has types defined that are not checked,'
179 + #13 + 'that type of data will become automatically checked.'
180 + #13 + 'Note: Data is only selectable if the patient has that type of data';
181 SHINT_OPTIONS = 'Check options to change the appearance and behavior of the graph.'
182 + #13 + 'Common options are also available on the graph''s right-click menu';
183 SHINT_MAX = 'Enter the maximum number of graphs to appear on the screen.'
184 + #13 + 'This is used when individual graphs are displayed and'
185 + #13 + 'applies to both the top and bottom sections.'
186 + #13 + 'When the number of graphs exceeds this limited, the graphs are available by scrolling.';
187 SHINT_MIN = 'Enter the minimum height of a graph (this is in pixels).'
188 + #13 + 'This will depend on the size of your display.'
189 + #13 + 'This setting assures that at least this amount of height will appear on the graph.'
190 + #13 + 'Use in combination with Max Graphs in Display.';
191 SHINT_MAX_ITEMS = 'Enter the maximum number of items that can be graphed at one time.'
192 + #13 + 'This setting prevents you from mistakenly selecting a large number of items.';
193 SHINT_OUTPT = 'Select the default date range when initially opening graphs.'
194 + #13 + 'This setting is used if the patient is currently an outpatient.';
195 SHINT_INPT = 'Select the default date range when initially opening graphs.'
196 + #13 + 'This setting is used if the patient is currently an inpatient.';
197 SHINT_FUNCTIONS = 'These functions are restricted to editors for evaluation.';
198 SHINT_BTN_SHOW = 'Click these buttons to display default settings.';
199 SHINT_BTN_PER = 'Click to display your personal settings.';
200 SHINT_BTN_PUB = 'Click to display the default settings.'
201 + #13 + 'These settings are used when you have not saved a personal setting.';
202 SHINT_BTN_SAVE = 'Click these buttons to save default settings.';
203 SHINT_BTN_PERSAVE = 'Click to save your personal defaults';
204 SHINT_BTN_PUBSAVE = 'Click to save the public default (available to editors only).';
205 SHINT_BTN_ALL = 'Click to check all sources.';
206 SHINT_BTN_CLEAR = 'Click to uncheck all sources.';
207 SHINT_BTN_CLOSE = 'Click to display these settings for graphing.'
208 + #13 + 'To cancel any unsaved changes you''ve made, click the upper-right x box.'
209 + #13 + 'Note: If you are using this from the Options menu, '
210 + #13 + 'settings will not change your display (multiple graphs may be in use).'
211 + #13 + 'You should save any settings before closing this form.';
212
213function GraphSettingsInit(settings: string): TGraphSetting;
214
215implementation
216
217function GraphSettingsInit(settings: string): TGraphSetting;
218var
219 FGraphSetting: TGraphSetting;
220begin
221 FGraphSetting := TGraphSetting.Create;
222 with FGraphSetting do
223 begin
224 OptionSettings := Piece(settings, '|', 2);
225 SortColumn := strtointdef(Piece(settings, '|', 3), 0);
226 MaxGraphs := strtointdef(Piece(settings, '|', 4), 5);
227 MinGraphHeight := strtointdef(Piece(settings, '|', 5), 90);
228 MaxSelect := strtointdef(Piece(settings, '|', 7), 100);
229 MaxSelectMin := 1;
230 MaxSelectMax := strtointdef(Piece(settings, '|', 8), 1000);
231 Values := Pos(SETTING_VALUES, OptionSettings) > 0;
232 VerticalZoom := Pos(SETTING_VZOOM, OptionSettings) > 0;
233 HorizontalZoom := Pos(SETTING_HZOOM, OptionSettings) > 0;
234 View3D := Pos(SETTING_3D, OptionSettings) > 0;
235 Legend := Pos(SETTING_LEGEND, OptionSettings) > 0;
236 Dates := Pos(SETTING_DATES, OptionSettings) > 0;
237 Lines := Pos(SETTING_LINES, OptionSettings) > 0;
238 StayOnTop := Pos(SETTING_TOP, OptionSettings) > 0;
239 SortByType := Pos(SETTING_SORT, OptionSettings) > 0;
240 ClearBackground := Pos(SETTING_CLEAR, OptionSettings) > 0;
241 Gradient := Pos(SETTING_GRADIENT, OptionSettings) > 0;
242 Hints := Pos(SETTING_HINTS, OptionSettings) > 0;
243 FixedDateRange := Pos(SETTING_FIXED, OptionSettings) > 0;
244 HighTime := 0;
245 LowTime := BIG_NUMBER;
246 FMStartDate := FM_START_DATE;
247 FMStopDate := FM_STOP_DATE;
248 if SortByType then SortColumn := 1 else SortColumn := 0;
249 DateRangeOutpatient := Piece(settings, '|', 9);
250 if DateRangeOutpatient = '' then DateRangeOutpatient := '8';
251 DateRangeInpatient := Piece(settings, '|', 10);
252 if DateRangeInpatient = '' then DateRangeInpatient := '8';
253 Turbo := Pos(SETTING_TURBO, OptionSettings) > 0;
254 if Piece(settings, '|', 6) = '0' then Turbo := false; // a 0 in 6th piece shuts down turbo for everyone
255 end;
256 Result := FGraphSetting;
257end;
258
259end.
Note: See TracBrowser for help on using the repository browser.