Changeset 542 for cprs/branches/GUI-config/MainU.pas
- Timestamp:
- Aug 12, 2009, 7:34:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/GUI-config/MainU.pas
r493 r542 5 5 (c) 8/2008 Kevin Toppenberg 6 6 Programmed by Kevin Toppenberg, Eddie Hagood 7 7 8 8 Family Physicians of Greeneville, PC 9 9 1410 Tusculum Blvd, Suite 2600 … … 36 36 ipSkinManager, 37 37 {$ENDIF} 38 Trpcb, 38 Trpcb, //needed for .ptype types 39 39 ValEdit; 40 40 … … 201 201 RPCBrokerParams : TTreeNode; 202 202 Devices : TTreeNode; 203 FLastSelectedRow,FLastSelectedCol : integer; 203 FLastSelectedRow,FLastSelectedCol : integer; 204 204 FLoadingGrid: boolean; 205 205 DataForGrid : TStringList; // doesn't own TGridInfo objects … … 208 208 CachedWPField : TStringList; 209 209 FVisibleGridIdx : integer; 210 FINIFileName : string; // 8-12-09 elh 210 211 procedure ShowDebugClick(Sender: TObject); 211 212 function FindParam(Param : string) : string; … … 282 283 283 284 uses 284 frmSplash, {Trpcb,}LookupU, SubfilesU, SetSelU, SelDateTimeU, PostU,285 frmSplash, LookupU, SubfilesU, SetSelU, SelDateTimeU, PostU, 285 286 FMErrorU, AboutU, PleaseWaitU, EditTextU, CreateTemplateU, SkinFormU, 286 BatchAddU, DebugU; 287 BatchAddU, DebugU, 288 inifiles; //8-12-09 elh 287 289 288 290 {$R *.dfm} … … 343 345 if not ORNet.ConnectToServer(RPC_CONTEXT) then begin 344 346 DebugForm.Memo.Lines.Add('Failed connection. Closing.'); 347 messagedlg('Login Failed.',mtError,[mbOK],0); 345 348 Close; 346 349 Exit; … … 1167 1170 Inc(GridRow); 1168 1171 end; 1169 end; 1172 end; 1170 1173 FLoadingGrid := false; 1171 1174 end; … … 1174 1177 procedure TMainForm.GridSelectCell(Sender: TObject; ACol, ARow: Integer; 1175 1178 var CanSelect: Boolean); 1176 (* 1179 (* 1177 1180 For Field def, here is the legend 1178 1181 character meaning 1179 1182 1180 1183 BC The data is Boolean Computed (true or false). 1181 1184 C The data is Computed. … … 1187 1190 Pn The data is a Pointer reference to file "n". 1188 1191 S The data is from a discrete Set of codes. 1189 1190 N The data is Numeric-valued. 1191 1192 1193 N The data is Numeric-valued. 1194 1192 1195 Jn To specify a print length of n characters. 1193 1196 Jn,d To specify printing n characters with decimals. 1194 1197 1195 1198 V The data is a Variable pointer. 1196 1199 W The data is Word processing. 1197 1200 WL The Word processing data is normally printed in Line mode (i.e., without word wrap). 1198 1201 *) 1199 var oneEntry,FieldDef : string; 1202 var oneEntry,FieldDef : string; 1200 1203 date,time: string; 1201 1204 FileNum,FieldNum,SubFileNum : string; … … 1242 1245 IEN := RecordORComboBox.ItemID; //get info from selected record 1243 1246 if IEN > 0 then IENS := InttoStr(IEN) + ','; 1244 end; 1247 end; 1245 1248 if IENS <> '' then begin 1246 1249 SubFileForm := TSubFileForm.Create(self); … … 1250 1253 end else begin 1251 1254 MessageDlg('IENS for File="". Can''t process.',mtInformation,[MBOK],0); 1252 end; 1255 end; 1253 1256 end; 1254 1257 end else if Pos('C',FieldDef)>0 then begin //computed fields. … … 1268 1271 Grid.Cells[ACol,ARow] := date; 1269 1272 end; 1270 CanSelect := true; 1273 CanSelect := true; 1271 1274 end else if Pos('S',FieldDef)>0 then begin //Set of Codes 1272 1275 SetSelForm.PrepForm(Piece(oneEntry,'^',7)); … … 1284 1287 Grid.Cells[ACol,ARow] := FieldLookupForm.ORComboBox.Text; 1285 1288 CanSelect := true; 1286 end; 1289 end; 1287 1290 end; 1288 1291 if CanSelect then begin … … 1290 1293 FLastSelectedCol := ACol; 1291 1294 end; 1292 GridInfo.ApplyBtn.Enabled := true; 1293 GridInfo.RevertBtn.Enabled := true; 1294 end; 1295 1296 1295 GridInfo.ApplyBtn.Enabled := true; 1296 GridInfo.RevertBtn.Enabled := true; 1297 end; 1298 1299 1297 1300 function TMainForm.GetLineInfo(Grid : TStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry; 1298 1301 var fieldNum : string; … … 1302 1305 begin 1303 1306 fieldNum := Grid.Cells[0,ARow]; 1304 gridRow := FindInStrings(fieldNum, CurrentUserData, fileNum); 1307 gridRow := FindInStrings(fieldNum, CurrentUserData, fileNum); 1305 1308 if gridRow > -1 then begin 1306 1309 oneEntry := CurrentUserData.Strings[gridRow]; … … 1310 1313 Result.IENS := Piece(oneEntry,'^',2); 1311 1314 Result.oldValue := Piece(oneEntry,'^',4); 1312 Result.newValue := Grid.Cells[2,ARow]; 1315 Result.newValue := Grid.Cells[2,ARow]; 1313 1316 end else begin 1314 1317 Result.Field := ''; … … 1347 1350 break; 1348 1351 end; 1349 end; 1350 1351 1352 end; 1353 1354 1352 1355 function TMainForm.IsSubFile(FieldDef: string ; var SubFileNum : string) : boolean; 1353 1356 //SubFileNum is OUT parameter … … 1455 1458 FVisibleGridIdx := GetInfoIndexForGrid(Grid); 1456 1459 end; 1457 1458 1460 1461 1459 1462 procedure TMainForm.CompileChanges(Grid : TStringGrid; CurrentUserData,Changes : TStringList); 1460 1463 //Output format: … … 1464 1467 Entry : tFileEntry; 1465 1468 oneEntry : string; 1466 begin 1469 iniFile : TIniFile; // 8-12-09 elh 1470 UCaseOnly : boolean; 1471 begin 1472 FINIFileName := ExtractFilePath(ParamStr(0)) + 'GUI_Config.ini'; 1473 iniFile := TIniFile.Create(FINIFileName); //8-12-09 elh 1474 UCaseOnly := inifile.ReadBool('Settings','UCaseOnly',true); 1475 iniFile.Free; 1467 1476 for row := 1 to Grid.RowCount-1 do begin 1468 1477 Entry := GetLineInfo(Grid,CurrentUserData, row); 1469 if Entry.oldValue <> Entry.newValue then begin 1470 if (Entry.newValue <> CLICK_FOR_SUBS) and 1471 (Entry.newValue <> COMPUTED_FIELD) and 1472 (Entry.newValue <> CLICK_TO_EDIT) then begin 1473 oneEntry := Entry.FileNum + '^' + Entry.IENS + '^' + Entry.Field + '^' + Entry.FieldName; 1474 oneEntry := oneEntry + '^' + Entry.newValue + '^' + Entry.oldValue; 1475 Changes.Add(oneEntry); 1476 end; 1478 //Reject any value containing a "^" 1479 //Do we need an @ here as well? 1480 if (AnsiPos('^',Entry.newvalue) > 0){ or (AnsiPos('@',Entry.newvalue) > 0)} then begin 1481 messagedlg('Invalid value entered for ' + Entry.Fieldname + #13 + #10 1482 + #13 + #10 + 'Invalid Entry: ' + Entry.newvalue + #13 + #10 + 1483 'Ignoring Value.',mtError,[mbOK],0); 1484 end else begin 1485 if Entry.oldValue <> Entry.newValue then begin 1486 if (Entry.newValue <> CLICK_FOR_SUBS) and 1487 (Entry.newValue <> COMPUTED_FIELD) and 1488 (Entry.newValue <> CLICK_TO_EDIT) then begin 1489 oneEntry := Entry.FileNum + '^' + Entry.IENS + '^' + Entry.Field + '^' + Entry.FieldName; 1490 //Test to see if change is an AV Code (2 or 11) or ES Code (20.4) in User File (200) 1491 //If so, make it uppercase. 8/12/09 elh 1492 if Entry.FileNum = '200' then begin 1493 if ((Entry.Field = '2') and (UCaseOnly = true)) or 1494 ((Entry.Field = '11') and (UCaseOnly = true)) or 1495 ((Entry.Field = '20.4') and (UCaseOnly = true)) then begin 1496 messagedlg('Converting ' + Entry.Fieldname + ' to uppercase for VistA interactivity.' +#13 +#10 + 1497 #13 +#10 + 1498 'Old Value: ' + Entry.newvalue + ' ' + 'New Value: ' + Uppercase(Entry.newvalue), 1499 mtinformation,[mbOK],0); 1500 Entry.newValue := Uppercase(Entry.newValue); 1501 end; 1502 end; 1503 oneEntry := oneEntry + '^' + Entry.newValue + '^' + Entry.oldValue; 1504 Changes.Add(oneEntry); 1505 end; 1506 end; 1477 1507 end; 1478 1508 end; 1479 1509 end; 1480 1510 1481 1511 1482 1512 function TMainForm.PostChanges(Grid : TStringGrid) : TModalResult; 1483 1513 //Results: mrNone -- no post done (not needed) … … 1705 1735 SrchStr := FileNum + '^' + FieldNum + '^' + HelpStyle; 1706 1736 Idx := CachedHelpIdx.IndexOf(SrchStr); 1707 if Idx = -1 then begin 1737 if Idx = -1 then begin 1708 1738 RPCBrokerV.remoteprocedure := 'TMG CHANNEL'; 1709 1739 RPCBrokerV.param[0].ptype := list; … … 1718 1748 end else begin 1719 1749 RPCBrokerV.Results.Delete(0); 1720 if RPCBrokerV.Results.Strings[RPCBrokerV.Results.Count-1]='' then begin 1721 RPCBrokerV.Results.Delete(RPCBrokerV.Results.Count-1); 1750 if RPCBrokerV.Results.Count > 0 then begin 1751 if RPCBrokerV.Results.Strings[RPCBrokerV.Results.Count-1]='' then begin 1752 RPCBrokerV.Results.Delete(RPCBrokerV.Results.Count-1); 1753 end; 1722 1754 end; 1723 result := RPCBrokerV.Results.Text; 1755 result := RPCBrokerV.Results.Text; 1756 if result = '' then result := ' '; 1724 1757 //Maybe later replace text with "Enter F1 for more help." 1725 Result := AnsiReplaceText(Result,'Enter ''??'' for more help.',''); 1758 Result := AnsiReplaceText(Result,'Enter ''??'' for more help.',''); 1726 1759 while Result[Length(Result)] in [#10,#13] do begin 1727 1760 Result := AnsiLeftStr(Result,Length(Result)-1); … … 2126 2159 SetPiece(oneEntry,'^',2,IENS); 2127 2160 Data.Add(oneEntry); 2128 end; 2161 end; 2129 2162 end; 2130 2163 end; 2131 2132 2164 2165 2133 2166 procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception); 2134 2167 begin … … 2178 2211 end; 2179 2212 2213 2214 2180 2215 end. 2181 2216
Note:
See TracChangeset
for help on using the changeset viewer.