[453] | 1 | //kt -- Modified with SourceScanner on 8/20/2007
|
---|
| 2 | unit rReports;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
[541] | 6 | uses
|
---|
| 7 | Windows, SysUtils, Classes, ORNet, ORFn,
|
---|
| 8 | Forms, //kt 8/09
|
---|
| 9 | ComCtrls, Chart, graphics;
|
---|
[453] | 10 |
|
---|
| 11 | { Consults }
|
---|
| 12 | procedure ListConsults(Dest: TStrings);
|
---|
| 13 | procedure LoadConsultText(Dest: TStrings; IEN: Integer);
|
---|
| 14 |
|
---|
| 15 | { Reports }
|
---|
| 16 | procedure ListReports(Dest: TStrings);
|
---|
| 17 | procedure ListLabReports(Dest: TStrings);
|
---|
| 18 | procedure ListReportDateRanges(Dest: TStrings);
|
---|
| 19 | procedure ListHealthSummaryTypes(Dest: TStrings);
|
---|
| 20 | procedure ListImagingExams(Dest: TStrings);
|
---|
| 21 | procedure ListProcedures(Dest: TStrings);
|
---|
| 22 | procedure ListNutrAssessments(Dest: TStrings);
|
---|
| 23 | procedure ListSurgeryReports(Dest: TStrings);
|
---|
| 24 | procedure ColumnHeaders(Dest: TStrings; AReportType: String);
|
---|
| 25 | procedure SaveColumnSizes(aColumn: String);
|
---|
| 26 | procedure LoadReportText(Dest: TStrings; ReportType: string; const Qualifier: string; ARpc, AHSTag: string);
|
---|
| 27 | procedure RemoteQueryAbortAll;
|
---|
| 28 | procedure RemoteQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 29 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 30 | procedure DirectQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 31 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 32 | function ReportQualifierType(ReportType: Integer): Integer;
|
---|
| 33 | function ImagingParams: String;
|
---|
| 34 | function AutoRDV: String;
|
---|
| 35 | function HDRActive: String;
|
---|
| 36 | procedure PrintReportsToDevice(AReport: string; const Qualifier, Patient,
|
---|
| 37 | ADevice: string; var ErrMsg: string; aComponents: TStringlist;
|
---|
| 38 | ARemoteSiteID, ARemoteQuery, AHSTag: string);
|
---|
| 39 | function HSFileLookup(aFile: String; const StartFrom: string;
|
---|
| 40 | Direction: Integer): TStrings;
|
---|
| 41 | procedure HSComponentFiles(Dest: TStrings; aComponent: String);
|
---|
| 42 | procedure HSSubItems(Dest: TStrings; aItem: String);
|
---|
| 43 | procedure HSReportText(Dest: TStrings; aComponents: TStringlist);
|
---|
| 44 | procedure HSComponents(Dest: TStrings);
|
---|
| 45 | procedure HSABVComponents(Dest: TStrings);
|
---|
| 46 | procedure HSDispComponents(Dest: TStrings);
|
---|
| 47 | procedure HSComponentSubs(Dest: TStrings; aItem: String);
|
---|
| 48 | procedure HealthSummaryCheck(Dest: TStrings; aQualifier: string);
|
---|
| 49 | function GetFormattedReport(AReport: string; const Qualifier, Patient: string;
|
---|
| 50 | aComponents: TStringlist; ARemoteSiteID, ARemoteQuery, AHSTag: string): TStrings;
|
---|
| 51 | procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, ATitle: string;
|
---|
[541] | 52 | var ErrMsg: string; Application : TApplication); //kt 8/09 added Application
|
---|
[453] | 53 | function DefaultToWindowsPrinter: Boolean;
|
---|
| 54 | procedure PrintGraph(GraphImage: TChart; PageTitle: string);
|
---|
| 55 | procedure PrintBitmap(Canvas: TCanvas; DestRect: TRect; Bitmap: TBitmap);
|
---|
| 56 | procedure CreatePatientHeader(var HeaderList: TStringList; PageTitle: string);
|
---|
| 57 | procedure SaveDefaultPrinter(DefPrinter: string) ;
|
---|
| 58 | function GetRemoteStatus(aHandle: string): String;
|
---|
| 59 | function GetAdhocLookup: integer;
|
---|
| 60 | procedure SetAdhocLookup(aLookup: integer);
|
---|
| 61 | procedure GetRemoteData(Dest: TStrings; aHandle: string; aItem: PChar);
|
---|
| 62 | procedure ModifyHDRData(Dest: string; aHandle: string; aID: string);
|
---|
| 63 | procedure PrintVReports(Dest, ADevice, AHeader: string; AReport: TStringList);
|
---|
| 64 |
|
---|
| 65 | implementation
|
---|
| 66 |
|
---|
| 67 | uses uCore, rCore, Printers, clipbrd, uReports, fReports,
|
---|
[541] | 68 | rHTMLTools, //kt 8/09
|
---|
[453] | 69 | DKLang //kt
|
---|
| 70 | ;
|
---|
| 71 |
|
---|
| 72 | var
|
---|
| 73 | uTree: TStringList;
|
---|
| 74 | uReportsList: TStringList;
|
---|
| 75 | uLabReports: TStringList;
|
---|
| 76 | uDateRanges: TStringList;
|
---|
| 77 | uHSTypes: TStringList;
|
---|
| 78 |
|
---|
| 79 | { Consults }
|
---|
| 80 |
|
---|
| 81 | procedure ListConsults(Dest: TStrings);
|
---|
| 82 | var
|
---|
| 83 | i: Integer;
|
---|
| 84 | x: string;
|
---|
| 85 | begin
|
---|
| 86 | CallV('ORWCS LIST OF CONSULT REPORTS', [Patient.DFN]);
|
---|
| 87 | with RPCBrokerV do
|
---|
| 88 | begin
|
---|
| 89 | SortByPiece(TStringList(Results), U, 2);
|
---|
| 90 | InvertStringList(TStringList(Results));
|
---|
| 91 | SetListFMDateTime('mmm dd,yy', TStringList(Results), U, 2);
|
---|
| 92 | for i := 0 to Results.Count - 1 do
|
---|
| 93 | begin
|
---|
| 94 | x := Results[i];
|
---|
| 95 | x := Pieces(x, U, 1, 2) + U + Piece(x, U, 3) + ' (' + Piece(x, U, 4) + ')';
|
---|
| 96 | Results[i] := x;
|
---|
| 97 | end;
|
---|
| 98 | Dest.Assign(Results);
|
---|
| 99 | end;
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | procedure LoadConsultText(Dest: TStrings; IEN: Integer);
|
---|
| 103 | begin
|
---|
| 104 | CallV('ORWCS REPORT TEXT', [Patient.DFN, IEN]);
|
---|
| 105 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 106 | end;
|
---|
| 107 |
|
---|
| 108 | { Reports }
|
---|
| 109 |
|
---|
| 110 | procedure ExtractSection(Dest: TStrings; const Section: string; Mixed: Boolean);
|
---|
| 111 | var
|
---|
| 112 | i: Integer;
|
---|
| 113 | begin
|
---|
| 114 | with RPCBrokerV do
|
---|
| 115 | begin
|
---|
| 116 | i := -1;
|
---|
| 117 | repeat Inc(i) until (i = Results.Count) or (Results[i] = Section);
|
---|
| 118 | Inc(i);
|
---|
| 119 | while (i < Results.Count) and (Results[i] <> '$$END') do
|
---|
| 120 | begin
|
---|
| 121 | {if (Pos('OR_ECS',UpperCase(Results[i]))>0) and (not uECSReport.ECSPermit) then
|
---|
| 122 | begin
|
---|
| 123 | Inc(i);
|
---|
| 124 | Continue;
|
---|
| 125 | end;}
|
---|
| 126 | if Mixed = true then
|
---|
| 127 | Dest.Add(MixedCase(Results[i]))
|
---|
| 128 | else
|
---|
| 129 | Dest.Add(Results[i]);
|
---|
| 130 | Inc(i);
|
---|
| 131 | end;
|
---|
| 132 | end;
|
---|
| 133 | end;
|
---|
| 134 |
|
---|
| 135 | procedure LoadReportLists;
|
---|
| 136 | begin
|
---|
| 137 | CallV('ORWRP REPORT LISTS', [nil]);
|
---|
| 138 | uDateRanges := TStringList.Create;
|
---|
| 139 | uHSTypes := TStringList.Create;
|
---|
| 140 | uReportsList := TStringList.Create;
|
---|
| 141 | ExtractSection(uDateRanges, '[DATE RANGES]', true);
|
---|
| 142 | ExtractSection(uHSTypes, '[HEALTH SUMMARY TYPES]', true);
|
---|
| 143 | ExtractSection(uReportsList, '[REPORT LIST]', true);
|
---|
| 144 | end;
|
---|
| 145 |
|
---|
| 146 | procedure LoadLabReportLists;
|
---|
| 147 | begin
|
---|
| 148 | CallV('ORWRP LAB REPORT LISTS', [nil]);
|
---|
| 149 | uLabReports := TStringList.Create;
|
---|
| 150 | ExtractSection(uLabReports, '[LAB REPORT LIST]', true);
|
---|
| 151 | end;
|
---|
| 152 |
|
---|
| 153 | procedure LoadTree;
|
---|
| 154 | begin
|
---|
| 155 | CallV('ORWRP3 EXPAND COLUMNS', [nil]);
|
---|
| 156 | uTree := TStringList.Create;
|
---|
| 157 | ExtractSection(uTree, '[REPORT LIST]', false);
|
---|
| 158 | end;
|
---|
| 159 |
|
---|
| 160 | procedure ListReports(Dest: TStrings);
|
---|
| 161 | var
|
---|
| 162 | i: Integer;
|
---|
| 163 | begin
|
---|
| 164 | if uTree = nil
|
---|
| 165 | then LoadTree
|
---|
| 166 | else
|
---|
| 167 | begin
|
---|
| 168 | uTree.Clear;
|
---|
| 169 | LoadTree;
|
---|
| 170 | end;
|
---|
| 171 | for i := 0 to uTree.Count - 1 do Dest.Add(Pieces(uTree[i], '^', 1, 15));
|
---|
| 172 | end;
|
---|
| 173 |
|
---|
| 174 | procedure ListLabReports(Dest: TStrings);
|
---|
| 175 | var
|
---|
| 176 | i: integer;
|
---|
| 177 | begin
|
---|
| 178 | if uLabreports = nil then LoadLabReportLists;
|
---|
| 179 | for i := 0 to uLabReports.Count - 1 do Dest.Add(Pieces(uLabReports[i], U, 1, 10));
|
---|
| 180 | end;
|
---|
| 181 |
|
---|
| 182 | procedure ListReportDateRanges(Dest: TStrings);
|
---|
| 183 | begin
|
---|
| 184 | if uDateRanges = nil then LoadReportLists;
|
---|
| 185 | Dest.Assign(uDateRanges);
|
---|
| 186 | end;
|
---|
| 187 |
|
---|
| 188 | procedure ListHealthSummaryTypes(Dest: TStrings);
|
---|
| 189 | begin
|
---|
| 190 | if uHSTypes = nil then LoadReportLists;
|
---|
| 191 | MixedCaseList(uHSTypes);
|
---|
| 192 | Dest.Assign(uHSTypes);
|
---|
| 193 | end;
|
---|
| 194 |
|
---|
| 195 | procedure HealthSummaryCheck(Dest: TStrings; aQualifier: string);
|
---|
| 196 |
|
---|
| 197 | begin
|
---|
| 198 | if aQualifier = '1' then
|
---|
| 199 | begin
|
---|
| 200 | ListHealthSummaryTypes(Dest);
|
---|
| 201 | end;
|
---|
| 202 | end;
|
---|
| 203 |
|
---|
| 204 | procedure ColumnHeaders(Dest: TStrings; AReportType: String);
|
---|
| 205 | begin
|
---|
| 206 | CallV('ORWRP COLUMN HEADERS',[AReportType]);
|
---|
| 207 | Dest.Assign(RPCBrokerV.Results);
|
---|
| 208 | end;
|
---|
| 209 |
|
---|
| 210 | procedure SaveColumnSizes(aColumn: String);
|
---|
| 211 | begin
|
---|
| 212 | CallV('ORWCH SAVECOL', [aColumn]);
|
---|
| 213 | end;
|
---|
| 214 |
|
---|
| 215 | procedure ListImagingExams(Dest: TStrings);
|
---|
| 216 | var
|
---|
| 217 | x: string;
|
---|
| 218 | i: Integer;
|
---|
| 219 | begin
|
---|
| 220 | CallV('ORWRA IMAGING EXAMS1', [Patient.DFN]);
|
---|
| 221 | with RPCBrokerV do
|
---|
| 222 | begin
|
---|
| 223 | SetListFMDateTime('mm/dd/yyyy hh:nn', TStringList(Results), U, 3);
|
---|
| 224 | for i := 0 to Results.Count - 1 do
|
---|
| 225 | begin
|
---|
| 226 | x := Results[i];
|
---|
| 227 | // if Piece(x,U,7) = 'Y' then SetPiece(x,U,7, ' - Abnormal'); <-- original line. //kt 8/20/2007
|
---|
| 228 | if Piece(x,U,7) = 'Y' then SetPiece(x,U,7, DKLangConstW('rReports_x_Abnormal')); //kt added 8/20/2007
|
---|
| 229 | x := Piece(x,U,1) + U + 'i' + Pieces(x,U,2,3)+ U + Piece(x,U,4)
|
---|
| 230 | + U + Piece(x,U,6) + Piece(x,U,7) + U
|
---|
| 231 | + MixedCase(Piece(Piece(x,U,9),'~',2)) + U + Piece(x,U,5) + U + '[+]'
|
---|
| 232 | + U + Pieces(x, U, 15,17);
|
---|
| 233 | (* x := Piece(x,U,1) + U + 'i' + Pieces(x,U,2,3)+ U + Piece(x,U,4)
|
---|
| 234 | + U + Piece(x,U,6) + Piece(x,U,7) + U + Piece(x,U,5) + U + '[+]' + U + Piece(x, U, 15);*)
|
---|
| 235 | Results[i] := x;
|
---|
| 236 | end;
|
---|
| 237 | Dest.Assign(Results);
|
---|
| 238 | end;
|
---|
| 239 | end;
|
---|
| 240 |
|
---|
| 241 | procedure ListProcedures(Dest: TStrings);
|
---|
| 242 | var
|
---|
| 243 | x,sdate: string;
|
---|
| 244 | i: Integer;
|
---|
| 245 | begin
|
---|
| 246 | CallV('ORWMC PATIENT PROCEDURES1', [Patient.DFN]);
|
---|
| 247 | with RPCBrokerV do
|
---|
| 248 | begin
|
---|
| 249 | for i := 0 to Results.Count - 1 do
|
---|
| 250 | begin
|
---|
| 251 | x := Results[i];
|
---|
| 252 | if length(piece(x, U, 8)) > 0 then
|
---|
| 253 | begin
|
---|
| 254 | sdate := ShortDateStrToDate(piece(piece(x, U, 8),'@',1)) + ' ' + piece(piece(x, U, 8),'@',2);
|
---|
| 255 | end;
|
---|
| 256 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 2) + U + sdate + U + Piece(x, U, 3) + U + Piece(x, U, 9) + '^[+]';
|
---|
| 257 | Results[i] := x;
|
---|
| 258 | end;
|
---|
| 259 | Dest.Assign(Results);
|
---|
| 260 | end;
|
---|
| 261 | end;
|
---|
| 262 |
|
---|
| 263 | procedure ListNutrAssessments(Dest: TStrings);
|
---|
| 264 | var
|
---|
| 265 | x: string;
|
---|
| 266 | i: Integer;
|
---|
| 267 | begin
|
---|
| 268 | CallV('ORWRP1 LISTNUTR', [Patient.DFN]);
|
---|
| 269 | with RPCBrokerV do
|
---|
| 270 | begin
|
---|
| 271 | for i := 0 to Results.Count - 1 do
|
---|
| 272 | begin
|
---|
| 273 | x := Results[i];
|
---|
| 274 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 3) + U + Piece(x, U, 3);
|
---|
| 275 | Results[i] := x;
|
---|
| 276 | end;
|
---|
| 277 | Dest.Assign(Results);
|
---|
| 278 | end;
|
---|
| 279 | end;
|
---|
| 280 |
|
---|
| 281 | procedure ListSurgeryReports(Dest: TStrings);
|
---|
| 282 | { returns a list of surgery cases for a patient, without documents}
|
---|
| 283 | //Facility^Case #^Date/Time of Operation^Operative Procedure^Surgeon name)
|
---|
| 284 | var
|
---|
| 285 | i: integer;
|
---|
| 286 | x, AFormat: string;
|
---|
| 287 | begin
|
---|
| 288 | CallV('ORWSR RPTLIST', [Patient.DFN]);
|
---|
| 289 | with RPCBrokerV do
|
---|
| 290 | begin
|
---|
| 291 | for i := 0 to Results.Count - 1 do
|
---|
| 292 | begin
|
---|
| 293 | x := Results[i];
|
---|
| 294 | if Piece(Piece(x, U, 3), '.', 2) = '' then AFormat := 'mm/dd/yyyy' else AFormat := 'mm/dd/yyyy hh:nn';
|
---|
| 295 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 2) + U + FormatFMDateTimeStr(AFormat, Piece(x, U, 3))+ U +
|
---|
| 296 | Piece(x, U, 4)+ U + Piece(x, U, 5);
|
---|
| 297 | if Piece(Results[i], U, 6) = '+' then x := x + '^[+]';
|
---|
| 298 | Results[i] := x;
|
---|
| 299 | end;
|
---|
| 300 | Dest.Assign(Results);
|
---|
| 301 | end;
|
---|
| 302 | end;
|
---|
| 303 |
|
---|
| 304 | procedure LoadReportText(Dest: TStrings; ReportType: string; const Qualifier: string; ARpc, AHSTag: string);
|
---|
| 305 | var
|
---|
| 306 | HSType, DaysBack, ExamID, MaxOcc, AReport, x: string;
|
---|
| 307 | Alpha, Omega, Trans: double;
|
---|
| 308 | begin
|
---|
| 309 | HSType := '';
|
---|
| 310 | DaysBack := '';
|
---|
| 311 | ExamID := '';
|
---|
| 312 | Alpha := 0;
|
---|
| 313 | Omega := 0;
|
---|
| 314 | if CharAt(Qualifier, 1) = 'T' then
|
---|
| 315 | begin
|
---|
| 316 | Alpha := StrToFMDateTime(Piece(Qualifier,';',1));
|
---|
| 317 | Omega := StrToFMDateTime(Piece(Qualifier,';',2));
|
---|
| 318 | if Alpha > Omega then
|
---|
| 319 | begin
|
---|
| 320 | Trans := Omega;
|
---|
| 321 | Omega := Alpha;
|
---|
| 322 | Alpha := Trans;
|
---|
| 323 | end;
|
---|
| 324 | MaxOcc := Piece(Qualifier,';',3);
|
---|
| 325 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 326 | end;
|
---|
| 327 | if CharAt(Qualifier, 1) = 'd' then
|
---|
| 328 | begin
|
---|
| 329 | MaxOcc := Piece(Qualifier,';',2);
|
---|
| 330 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 331 | x := Piece(Qualifier,';',1);
|
---|
| 332 | DaysBack := Copy(x, 2, Length(x));
|
---|
| 333 | end;
|
---|
| 334 | if CharAt(Qualifier, 1) = 'h' then HSType := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 335 | if CharAt(Qualifier, 1) = 'i' then ExamID := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 336 | AReport := ReportType + '~' + AHSTag;
|
---|
| 337 | if Length(ARpc) > 0 then
|
---|
| 338 | begin
|
---|
| 339 | CallV(ARpc, [Patient.DFN, AReport, HSType, DaysBack, ExamID, Alpha, Omega]);
|
---|
| 340 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 341 | end
|
---|
| 342 | else
|
---|
| 343 | begin
|
---|
| 344 | // Dest.Add('RPC is missing from report definition (file 101.24).'); <-- original line. //kt 8/20/2007
|
---|
| 345 | Dest.Add(DKLangConstW('rReports_RPC_is_missing_from_report_definition_xfile_101x24xx')); //kt added 8/20/2007
|
---|
| 346 | // Dest.Add('Please contact Technical Support.'); <-- original line. //kt 8/20/2007
|
---|
| 347 | Dest.Add(DKLangConstW('rReports_Please_contact_Technical_Supportx')); //kt added 8/20/2007
|
---|
| 348 | end;
|
---|
| 349 | end;
|
---|
| 350 |
|
---|
| 351 | procedure RemoteQueryAbortAll;
|
---|
| 352 | begin
|
---|
| 353 | CallV('XWB DEFERRED CLEARALL',[nil]);
|
---|
| 354 | end;
|
---|
| 355 |
|
---|
| 356 | procedure RemoteQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 357 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 358 | var
|
---|
| 359 | AReport: string;
|
---|
| 360 | begin
|
---|
| 361 | AReport := AReportType + ';1' + '~' + AHSTag;
|
---|
| 362 | if length(AHSType) > 0 then
|
---|
| 363 | AHSType := piece(AHSType,':',1) + ';' + piece(AHSType,':',2); //format for backward compatibility
|
---|
| 364 | CallV('XWB REMOTE RPC', [ASite, ARemoteRPC, 0, Patient.DFN + ';' + Patient.ICN,
|
---|
| 365 | AReport, AHSType, ADaysBack, AExamID, Alpha, AOmega]);
|
---|
| 366 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 367 | end;
|
---|
| 368 |
|
---|
| 369 | procedure DirectQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 370 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 371 | var
|
---|
| 372 | AReport: string;
|
---|
| 373 | begin
|
---|
| 374 | AReport := AReportType + ';1' + '~' + AHSTag;
|
---|
| 375 | if length(AHSType) > 0 then
|
---|
| 376 | AHSType := piece(AHSType,':',1) + ';' + piece(AHSType,':',2); //format for backward compatibility
|
---|
| 377 | CallV('XWB DIRECT RPC', [ASite, ARemoteRPC, 0, Patient.DFN + ';' + Patient.ICN,
|
---|
| 378 | AReport, AHSType, ADaysBack, AExamID, Alpha, AOmega]);
|
---|
| 379 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 380 | end;
|
---|
| 381 |
|
---|
| 382 | function ReportQualifierType(ReportType: Integer): Integer;
|
---|
| 383 | var
|
---|
| 384 | i: Integer;
|
---|
| 385 | begin
|
---|
| 386 | Result := 0;
|
---|
| 387 | for i := 0 to uReportsList.Count - 1 do
|
---|
| 388 | if StrToIntDef(Piece(uReportsList[i], U, 1), 0) = ReportType
|
---|
| 389 | then Result := StrToIntDef(Piece(uReportsList[i], U, 3), 0);
|
---|
| 390 | end;
|
---|
| 391 |
|
---|
| 392 | function ImagingParams: String;
|
---|
| 393 | begin
|
---|
| 394 | Result := sCallV('ORWTPD GETIMG',[nil]);
|
---|
| 395 | end;
|
---|
| 396 |
|
---|
| 397 | function AutoRDV: String;
|
---|
| 398 | begin
|
---|
| 399 | Result := sCallV('ORWCIRN AUTORDV', [nil]);
|
---|
| 400 | end;
|
---|
| 401 |
|
---|
| 402 | function HDRActive: String;
|
---|
| 403 | begin
|
---|
| 404 | Result := sCallV('ORWCIRN HDRON', [nil]);
|
---|
| 405 | end;
|
---|
| 406 |
|
---|
| 407 | procedure PrintVReports(Dest, ADevice, AHeader: string; AReport: TStringList);
|
---|
| 408 | begin
|
---|
| 409 | CallV('ORWRP PRINT V REPORT', [ADevice, Patient.DFN, AHeader, AReport]);
|
---|
| 410 | end;
|
---|
| 411 |
|
---|
| 412 | procedure PrintReportsToDevice(AReport: string; const Qualifier, Patient, ADevice: string;
|
---|
| 413 | var ErrMsg: string; aComponents: TStringlist; ARemoteSiteID, ARemoteQuery, AHSTag: string);
|
---|
| 414 | { prints a report on the selected device }
|
---|
| 415 | var
|
---|
| 416 | HSType, DaysBack, ExamID, MaxOcc, ARpt, x: string;
|
---|
| 417 | Alpha, Omega: double;
|
---|
| 418 | j: integer;
|
---|
| 419 | RemoteHandle,Report: string;
|
---|
| 420 | aHandles: TStringlist;
|
---|
| 421 | begin
|
---|
| 422 | HSType := '';
|
---|
| 423 | DaysBack := '';
|
---|
| 424 | ExamID := '';
|
---|
| 425 | Alpha := 0;
|
---|
| 426 | Omega := 0;
|
---|
| 427 | aHandles := TStringList.Create;
|
---|
| 428 | if CharAt(Qualifier, 1) = 'T' then
|
---|
| 429 | begin
|
---|
| 430 | Alpha := StrToFMDateTime(Piece(Qualifier,';',1));
|
---|
| 431 | Omega := StrToFMDateTime(Piece(Qualifier,';',2));
|
---|
| 432 | MaxOcc := Piece(Qualifier,';',3);
|
---|
| 433 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 434 | end;
|
---|
| 435 | if CharAt(Qualifier, 1) = 'd' then
|
---|
| 436 | begin
|
---|
| 437 | MaxOcc := Piece(Qualifier,';',2);
|
---|
| 438 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 439 | x := Piece(Qualifier,';',1);
|
---|
| 440 | DaysBack := Copy(x, 2, Length(x));
|
---|
| 441 | end;
|
---|
| 442 | if CharAt(Qualifier, 1) = 'h' then HSType := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 443 | if CharAt(Qualifier, 1) = 'i' then ExamID := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 444 | if Length(ARemoteSiteID) > 0 then
|
---|
| 445 | begin
|
---|
| 446 | RemoteHandle := '';
|
---|
| 447 | for j := 0 to RemoteReports.Count - 1 do
|
---|
| 448 | begin
|
---|
| 449 | Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report;
|
---|
| 450 | if Report = ARemoteQuery then
|
---|
| 451 | begin
|
---|
| 452 | RemoteHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle
|
---|
| 453 | + '^' + Pieces(Report,'^',9,10);
|
---|
| 454 | break;
|
---|
| 455 | end;
|
---|
| 456 | end;
|
---|
| 457 | if Length(RemoteHandle) > 1 then
|
---|
| 458 | with RemoteSites.SiteList do
|
---|
| 459 | aHandles.Add(ARemoteSiteID + '^' + RemoteHandle);
|
---|
| 460 | end;
|
---|
| 461 | ARpt := AReport + '~' + AHSTag;
|
---|
| 462 | if aHandles.Count > 0 then
|
---|
| 463 | begin
|
---|
| 464 | ErrMsg := sCallV('ORWRP PRINT REMOTE REPORT',[ADevice, Patient, ARpt, aHandles]);
|
---|
| 465 | if Piece(ErrMsg, U, 1) = '0' then ErrMsg := '' else ErrMsg := Piece(ErrMsg, U, 2);
|
---|
| 466 | end
|
---|
| 467 | else
|
---|
| 468 | begin
|
---|
| 469 | ErrMsg := sCallV('ORWRP PRINT REPORT',[ADevice, Patient, ARpt, HSType,
|
---|
| 470 | DaysBack, ExamID, aComponents, Alpha, Omega]);
|
---|
| 471 | if Piece(ErrMsg, U, 1) = '0' then ErrMsg := '' else ErrMsg := Piece(ErrMsg, U, 2);
|
---|
| 472 | end;
|
---|
| 473 | aHandles.Clear;
|
---|
| 474 | aHandles.Free;
|
---|
| 475 | end;
|
---|
| 476 |
|
---|
| 477 | function GetFormattedReport(AReport: string; const Qualifier, Patient: string;
|
---|
| 478 | aComponents: TStringlist; ARemoteSiteID, ARemoteQuery, AHSTag: string): TStrings;
|
---|
| 479 | { prints a report on the selected device }
|
---|
| 480 | var
|
---|
| 481 | HSType, DaysBack, ExamID, MaxOcc, ARpt, x: string;
|
---|
| 482 | Alpha, Omega: double;
|
---|
| 483 | j: integer;
|
---|
| 484 | RemoteHandle,Report: string;
|
---|
| 485 | aHandles: TStringlist;
|
---|
| 486 | begin
|
---|
| 487 | HSType := '';
|
---|
| 488 | DaysBack := '';
|
---|
| 489 | ExamID := '';
|
---|
| 490 | Alpha := 0;
|
---|
| 491 | Omega := 0;
|
---|
| 492 | aHandles := TStringList.Create;
|
---|
| 493 | if CharAt(Qualifier, 1) = 'T' then
|
---|
| 494 | begin
|
---|
| 495 | Alpha := StrToFMDateTime(Piece(Qualifier,';',1));
|
---|
| 496 | Omega := StrToFMDateTime(Piece(Qualifier,';',2));
|
---|
| 497 | MaxOcc := Piece(Qualifier,';',3);
|
---|
| 498 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 499 | end;
|
---|
| 500 | if CharAt(Qualifier, 1) = 'd' then
|
---|
| 501 | begin
|
---|
| 502 | MaxOcc := Piece(Qualifier,';',2);
|
---|
| 503 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 504 | x := Piece(Qualifier,';',1);
|
---|
| 505 | DaysBack := Copy(x, 2, Length(x));
|
---|
| 506 | end;
|
---|
| 507 | if CharAt(Qualifier, 1) = 'h' then HSType := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 508 | if CharAt(Qualifier, 1) = 'i' then ExamID := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 509 | if Length(ARemoteSiteID) > 0 then
|
---|
| 510 | begin
|
---|
| 511 | RemoteHandle := '';
|
---|
| 512 | for j := 0 to RemoteReports.Count - 1 do
|
---|
| 513 | begin
|
---|
| 514 | Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report;
|
---|
| 515 | if Report = ARemoteQuery then
|
---|
| 516 | begin
|
---|
| 517 | RemoteHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle
|
---|
| 518 | + '^' + Pieces(Report,'^',9,10);
|
---|
| 519 | break;
|
---|
| 520 | end;
|
---|
| 521 | end;
|
---|
| 522 | if Length(RemoteHandle) > 1 then
|
---|
| 523 | with RemoteSites.SiteList do
|
---|
| 524 | aHandles.Add(ARemoteSiteID + '^' + RemoteHandle);
|
---|
| 525 | end;
|
---|
| 526 | ARpt := AReport + '~' + AHSTag;
|
---|
| 527 | if aHandles.Count > 0 then
|
---|
| 528 | begin
|
---|
| 529 | CallV('ORWRP PRINT WINDOWS REMOTE',[Patient, ARpt, aHandles]);
|
---|
| 530 | Result := RPCBrokerV.Results;
|
---|
| 531 | end
|
---|
| 532 | else
|
---|
| 533 | begin
|
---|
| 534 | CallV('ORWRP PRINT WINDOWS REPORT',[Patient, ARpt, HSType,
|
---|
| 535 | DaysBack, ExamID, aComponents, Alpha, Omega]);
|
---|
| 536 | Result := RPCBrokerV.Results;
|
---|
| 537 | end;
|
---|
| 538 | aHandles.Clear;
|
---|
| 539 | aHandles.Free;
|
---|
| 540 | end;
|
---|
| 541 |
|
---|
| 542 | function DefaultToWindowsPrinter: Boolean;
|
---|
| 543 | begin
|
---|
| 544 | Result := (StrToIntDef(sCallV('ORWRP WINPRINT DEFAULT',[]), 0) > 0);
|
---|
| 545 | end;
|
---|
| 546 |
|
---|
[541] | 547 | procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, Atitle: string;
|
---|
| 548 | var ErrMsg: string;
|
---|
| 549 | Application : TApplication //kt added 8/09
|
---|
| 550 | );
|
---|
[453] | 551 | var
|
---|
| 552 | i, j, x, y, LineHeight: integer;
|
---|
| 553 | aGoHead: string;
|
---|
| 554 | aHeader: TStringList;
|
---|
[541] | 555 | Header,Footer,TempLines: TStringList; //kt added 8/09
|
---|
| 556 | IsHTML : Boolean; //kt added 8/09
|
---|
| 557 |
|
---|
[453] | 558 | const
|
---|
| 559 | //TX_ERR_CAP = 'Print Error'; <-- original line. //kt 8/20/2007
|
---|
| 560 | TX_FONT_SIZE = 10;
|
---|
| 561 | //TX_FONT_NAME = 'Courier New'; <-- original line. //kt 8/20/2007
|
---|
| 562 | var
|
---|
| 563 | TX_ERR_CAP : string; //kt
|
---|
| 564 | TX_FONT_NAME : string ;//kt
|
---|
| 565 |
|
---|
| 566 | begin
|
---|
| 567 | TX_ERR_CAP := DKLangConstW('rReports_Print_Error'); //kt added 8/20/2007
|
---|
| 568 | TX_FONT_NAME := DKLangConstW('rReports_Courier_New'); //kt added 8/20/2007
|
---|
| 569 |
|
---|
| 570 | aHeader := TStringList.Create;
|
---|
| 571 | aGoHead := '';
|
---|
| 572 | if piece(Atitle,';',2) = '1' then
|
---|
| 573 | begin
|
---|
| 574 | Atitle := piece(Atitle,';',1);
|
---|
| 575 | aGoHead := '1';
|
---|
| 576 | end;
|
---|
| 577 | CreatePatientHeader(aHeader ,ATitle);
|
---|
[541] | 578 | IsHTML := rHTMLTools.IsHTML(ARichEdit.Lines); //kt 8/09
|
---|
| 579 | if not IsHTML then begin //kt 8/09
|
---|
| 580 | with ARichEdit do begin
|
---|
| 581 | (* if Lines[Lines.Count - 1] = APageBreak then // remove trailing form feed
|
---|
[453] | 582 | Lines.Delete(Lines.Count - 1);
|
---|
| 583 | while (Lines[0] = '') or (Lines[0] = APageBreak) do
|
---|
| 584 | Lines.Delete(0); // remove leading blank lines and form feeds*)
|
---|
| 585 |
|
---|
[541] | 586 | {v20.4 - SFC-0602-62899 - RV}
|
---|
| 587 | while (Lines.Count > 0) and ((Lines[Lines.Count - 1] = '') or (Lines[Lines.Count - 1] = APageBreak)) do
|
---|
| 588 | Lines.Delete(Lines.Count - 1); // remove trailing blank lines and form feeds
|
---|
| 589 | while (Lines.Count > 0) and ((Lines[0] = '') or (Lines[0] = APageBreak)) do
|
---|
| 590 | Lines.Delete(0); // remove leading blank lines and form feeds
|
---|
[453] | 591 |
|
---|
[541] | 592 | if Lines.Count > 1 then begin
|
---|
| 593 | (* i := Lines.IndexOf(APageBreak);
|
---|
| 594 | if ((i >= 0 ) and (i < Lines.Count - 1)) then // removed in v15.9 (RV)
|
---|
| 595 | begin*)
|
---|
| 596 | Printer.Canvas.Font.Size := TX_FONT_SIZE;
|
---|
| 597 | Printer.Canvas.Font.Name := TX_FONT_NAME;
|
---|
| 598 | Printer.Title := ATitle;
|
---|
| 599 | x := Trunc(Printer.Canvas.TextWidth(StringOfChar('=', TX_FONT_SIZE)) * 0.75);
|
---|
| 600 | LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME);
|
---|
| 601 | y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV)
|
---|
| 602 | Printer.BeginDoc;
|
---|
| 603 | for i := 0 to Lines.Count - 1 do begin
|
---|
| 604 | if Lines[i] = APageBreak then begin
|
---|
| 605 | Printer.NewPage;
|
---|
| 606 | y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV)
|
---|
| 607 | if aGoHead = '1' then begin
|
---|
| 608 | for j := 0 to aHeader.Count - 1 do begin
|
---|
| 609 | Printer.Canvas.TextOut(x, y, aHeader[j]);
|
---|
| 610 | y := y + LineHeight;
|
---|
| 611 | end;
|
---|
| 612 | end;
|
---|
| 613 | end else begin
|
---|
| 614 | Printer.Canvas.TextOut(x, y, Lines[i]);
|
---|
| 615 | y := y + LineHeight;
|
---|
| 616 | end;
|
---|
| 617 | end;
|
---|
| 618 | Printer.EndDoc;
|
---|
| 619 | (* end
|
---|
| 620 | else // removed in v15.9 (RV) TRichEdit.Print no longer used.
|
---|
[453] | 621 | try
|
---|
| 622 | Font.Size := TX_FONT_SIZE;
|
---|
| 623 | Font.Name := TX_FONT_NAME;
|
---|
| 624 | Print(ATitle);
|
---|
| 625 | except
|
---|
| 626 | ErrMsg := TX_ERR_CAP;
|
---|
| 627 | end;*)
|
---|
[541] | 628 | end else if ARichEdit.Lines.Count = 1 then
|
---|
[453] | 629 | if Piece(ARichEdit.Lines[0], U, 1) <> '0' then
|
---|
| 630 | ErrMsg := Piece(ARichEdit.Lines[0], U, 2);
|
---|
| 631 | end;
|
---|
[541] | 632 | end else begin //kt added this entire block. 8/09
|
---|
| 633 | TempLines := TStringList.Create;
|
---|
| 634 | Header := TStringList.Create;
|
---|
| 635 | Footer := TStringList.Create;
|
---|
| 636 | TempLines.Assign(ARichEdit.Lines);
|
---|
| 637 | StripBeforeAfterHTML(TempLines,Header,Footer);
|
---|
| 638 | //LoadDocumentText(TempLines, FNote); //Get document without headers/footers
|
---|
| 639 | PrintHTMLReport(TempLines,ErrMsg,
|
---|
| 640 | Patient.Name,
|
---|
[671] | 641 | FormatFMDateTime('mm/dd/yyyy', Patient.DOB),' ',
|
---|
| 642 | Encounter.LocationName,Application);
|
---|
[541] | 643 | TempLines.Free;
|
---|
| 644 | Header.Free;
|
---|
| 645 | Footer.Free;
|
---|
| 646 | end; //kt end of added block 8/09
|
---|
[453] | 647 | aHeader.Free;
|
---|
| 648 | end;
|
---|
| 649 |
|
---|
| 650 | procedure CreatePatientHeader(var HeaderList: TStringList; PageTitle: string);
|
---|
| 651 | // standard patient header, from HEAD^ORWRPP
|
---|
| 652 | var
|
---|
| 653 | tmpStr, tmpItem: string;
|
---|
| 654 | begin
|
---|
| 655 | with HeaderList do
|
---|
| 656 | begin
|
---|
| 657 | Add(' ');
|
---|
| 658 | Add(StringOfChar(' ', (74 - Length(PageTitle)) div 2) + PageTitle);
|
---|
| 659 | Add(' ');
|
---|
| 660 | tmpStr := Patient.Name + ' ' + Patient.SSN;
|
---|
| 661 | tmpItem := tmpStr + StringOfChar(' ', 39 - Length(tmpStr)) + Encounter.LocationName;
|
---|
| 662 | tmpStr := FormatFMDateTime('mmm dd, yyyy', Patient.DOB) + ' (' + IntToStr(Patient.Age) + ')';
|
---|
| 663 | tmpItem := tmpItem + StringOfChar(' ', 74 - (Length(tmpItem) + Length(tmpStr))) + tmpStr;
|
---|
| 664 | Add(tmpItem);
|
---|
| 665 | Add(StringOfChar('=', 74));
|
---|
| 666 | Add('*** WORK COPY ONLY ***' + StringOfChar(' ', 24) + 'Printed: ' + FormatFMDateTime('mmm dd, yyyy hh:nn', FMNow));
|
---|
| 667 | Add(' ');
|
---|
| 668 | Add(' ');
|
---|
| 669 | end;
|
---|
| 670 | end;
|
---|
| 671 |
|
---|
| 672 | procedure PrintGraph(GraphImage: TChart; PageTitle: string);
|
---|
| 673 | var
|
---|
| 674 | AHeader: TStringList;
|
---|
| 675 | i, y, LineHeight: integer;
|
---|
| 676 | GraphPic: TBitMap;
|
---|
| 677 | Magnif: integer;
|
---|
| 678 | const
|
---|
| 679 | TX_FONT_SIZE = 12;
|
---|
| 680 | //TX_FONT_NAME = 'Courier New'; <-- original line. //kt 8/20/2007
|
---|
| 681 | CF_BITMAP = 2; // from Windows.pas
|
---|
| 682 | var
|
---|
| 683 | TX_FONT_NAME : string; //kt
|
---|
| 684 |
|
---|
| 685 | begin
|
---|
| 686 | TX_FONT_NAME := DKLangConstW('rReports_Courier_New'); //kt added 8/20/2007
|
---|
| 687 | ClipBoard;
|
---|
| 688 | AHeader := TStringList.Create;
|
---|
| 689 | CreatePatientHeader(AHeader, PageTitle);
|
---|
| 690 | GraphPic := TBitMap.Create;
|
---|
| 691 | try
|
---|
| 692 | GraphImage.CopyToClipboardBitMap;
|
---|
| 693 | GraphPic.LoadFromClipBoardFormat(CF_BITMAP, ClipBoard.GetAsHandle(CF_BITMAP), 0);
|
---|
| 694 | with Printer do
|
---|
| 695 | begin
|
---|
| 696 | Canvas.Font.Size := TX_FONT_SIZE;
|
---|
| 697 | Canvas.Font.Name := TX_FONT_NAME;
|
---|
| 698 | Title := PageTitle;
|
---|
| 699 | Magnif := (Canvas.TextWidth(StringOfChar('=', 74)) div GraphImage.Width);
|
---|
| 700 | LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME);
|
---|
| 701 | y := LineHeight;
|
---|
| 702 | BeginDoc;
|
---|
| 703 | try
|
---|
| 704 | for i := 0 to AHeader.Count - 1 do
|
---|
| 705 | begin
|
---|
| 706 | Canvas.TextOut(0, y, AHeader[i]);
|
---|
| 707 | y := y + LineHeight;
|
---|
| 708 | end;
|
---|
| 709 | y := y + (4 * LineHeight);
|
---|
| 710 | //GraphImage.PrintPartial(Rect(0, y, Canvas.TextWidth(StringOfChar('=', 74)), y + (Magnif * GraphImage.Height)));
|
---|
| 711 | PrintBitmap(Canvas, Rect(0, y, Canvas.TextWidth(StringOfChar('=', 74)), y + (Magnif * GraphImage.Height)), GraphPic);
|
---|
| 712 | finally
|
---|
| 713 | EndDoc;
|
---|
| 714 | end;
|
---|
| 715 | end;
|
---|
| 716 | finally
|
---|
| 717 | ClipBoard.Clear;
|
---|
| 718 | GraphPic.Free;
|
---|
| 719 | AHeader.Free;
|
---|
| 720 | end;
|
---|
| 721 | end;
|
---|
| 722 |
|
---|
| 723 | procedure SaveDefaultPrinter(DefPrinter: string) ;
|
---|
| 724 | begin
|
---|
| 725 | CallV('ORWRP SAVE DEFAULT PRINTER', [DefPrinter]);
|
---|
| 726 | end;
|
---|
| 727 |
|
---|
| 728 | function HSFileLookup(aFile: String; const StartFrom: string;
|
---|
| 729 | Direction:Integer): TStrings;
|
---|
| 730 | begin
|
---|
| 731 | CallV('ORWRP2 HS FILE LOOKUP', [aFile, StartFrom, Direction]);
|
---|
| 732 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 733 | Result := RPCBrokerV.Results;
|
---|
| 734 | end;
|
---|
| 735 |
|
---|
| 736 | procedure HSComponentFiles(Dest: TStrings; aComponent: String);
|
---|
| 737 | begin
|
---|
| 738 | CallV('ORWRP2 HS COMP FILES', [aComponent]);
|
---|
| 739 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 740 | end;
|
---|
| 741 |
|
---|
| 742 | procedure HSSubItems(Dest: TStrings; aItem: String);
|
---|
| 743 | begin
|
---|
| 744 | CallV('ORWRP2 HS SUBITEMS', [aItem]);
|
---|
| 745 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 746 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 747 | end;
|
---|
| 748 |
|
---|
| 749 | procedure HSReportText(Dest: TStrings; aComponents: TStringlist);
|
---|
| 750 | begin
|
---|
| 751 | CallV('ORWRP2 HS REPORT TEXT', [aComponents, Patient.DFN]);
|
---|
| 752 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 753 | end;
|
---|
| 754 |
|
---|
| 755 | procedure HSComponents(Dest: TStrings);
|
---|
| 756 | begin
|
---|
| 757 | CallV('ORWRP2 HS COMPONENTS', [nil]);
|
---|
| 758 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 759 | end;
|
---|
| 760 |
|
---|
| 761 | procedure HSABVComponents(Dest: TStrings);
|
---|
| 762 | begin
|
---|
| 763 | CallV('ORWRP2 COMPABV', [nil]);
|
---|
| 764 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 765 | end;
|
---|
| 766 |
|
---|
| 767 | procedure HSDispComponents(Dest: TStrings);
|
---|
| 768 | begin
|
---|
| 769 | CallV('ORWRP2 COMPDISP', [nil]);
|
---|
| 770 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 771 | end;
|
---|
| 772 |
|
---|
| 773 | procedure HSComponentSubs(Dest: TStrings; aItem: String);
|
---|
| 774 | begin
|
---|
| 775 | CallV('ORWRP2 HS COMPONENT SUBS',[aItem]);
|
---|
| 776 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 777 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 778 | end;
|
---|
| 779 |
|
---|
| 780 | function GetRemoteStatus(aHandle: string): String;
|
---|
| 781 | begin
|
---|
| 782 | CallV('XWB REMOTE STATUS CHECK', [aHandle]);
|
---|
| 783 | Result := RPCBrokerV.Results[0];
|
---|
| 784 | end;
|
---|
| 785 |
|
---|
| 786 | function GetAdhocLookup: integer;
|
---|
| 787 | begin
|
---|
| 788 | CallV('ORWRP2 GETLKUP', [nil]);
|
---|
| 789 | if RPCBrokerV.Results.Count > 0 then
|
---|
| 790 | Result := StrToInt(RPCBrokerV.Results[0])
|
---|
| 791 | else
|
---|
| 792 | Result := 0;
|
---|
| 793 | end;
|
---|
| 794 |
|
---|
| 795 | procedure SetAdhocLookup(aLookup: integer);
|
---|
| 796 |
|
---|
| 797 | begin
|
---|
| 798 | CallV('ORWRP2 SAVLKUP', [IntToStr(aLookup)]);
|
---|
| 799 | end;
|
---|
| 800 |
|
---|
| 801 | procedure GetRemoteData(Dest: TStrings; aHandle: string; aItem: PChar);
|
---|
| 802 | begin
|
---|
| 803 | CallV('XWB REMOTE GETDATA', [aHandle]);
|
---|
| 804 | if RPCBrokerV.Results.Count < 1 then
|
---|
| 805 | // RPCBrokerV.Results[0] := 'No data found.'; <-- original line. //kt 8/20/2007
|
---|
| 806 | RPCBrokerV.Results[0] := DKLangConstW('rReports_No_data_foundx'); //kt added 8/20/2007
|
---|
| 807 | if (RPCBrokerV.Results.Count < 2) and (RPCBrokerV.Results[0] = '') then
|
---|
| 808 | // RPCBrokerV.Results[0] := 'No data found.'; <-- original line. //kt 8/20/2007
|
---|
| 809 | RPCBrokerV.Results[0] := DKLangConstW('rReports_No_data_foundx'); //kt added 8/20/2007
|
---|
| 810 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 811 | end;
|
---|
| 812 |
|
---|
| 813 | procedure ModifyHDRData(Dest: string; aHandle: string; aID: string);
|
---|
| 814 | begin
|
---|
| 815 | CallV('ORWRP4 HDR MODIFY', [aHandle, aID]);
|
---|
| 816 | end;
|
---|
| 817 |
|
---|
| 818 | procedure PrintBitmap(Canvas: TCanvas; DestRect: TRect; Bitmap: TBitmap);
|
---|
| 819 | var
|
---|
| 820 | BitmapHeader: pBitmapInfo;
|
---|
| 821 | BitmapImage : POINTER;
|
---|
| 822 | HeaderSize : DWORD; // Use DWORD for D3-D5 compatibility
|
---|
| 823 | ImageSize : DWORD;
|
---|
| 824 | begin
|
---|
| 825 | GetDIBSizes(Bitmap.Handle, HeaderSize, ImageSize);
|
---|
| 826 | GetMem(BitmapHeader, HeaderSize);
|
---|
| 827 | GetMem(BitmapImage, ImageSize);
|
---|
| 828 | try
|
---|
| 829 | GetDIB(Bitmap.Handle, Bitmap.Palette, BitmapHeader^, BitmapImage^);
|
---|
| 830 | StretchDIBits(Canvas.Handle,
|
---|
| 831 | DestRect.Left, DestRect.Top, // Destination Origin
|
---|
| 832 | DestRect.Right - DestRect.Left, // Destination Width
|
---|
| 833 | DestRect.Bottom - DestRect.Top, // Destination Height
|
---|
| 834 | 0, 0, // Source Origin
|
---|
| 835 | Bitmap.Width, Bitmap.Height, // Source Width & Height
|
---|
| 836 | BitmapImage,
|
---|
| 837 | TBitmapInfo(BitmapHeader^),
|
---|
| 838 | DIB_RGB_COLORS,
|
---|
| 839 | SRCCOPY)
|
---|
| 840 | finally
|
---|
| 841 | FreeMem(BitmapHeader);
|
---|
| 842 | FreeMem(BitmapImage)
|
---|
| 843 | end
|
---|
| 844 | end {PrintBitmap};
|
---|
| 845 |
|
---|
| 846 | initialization
|
---|
| 847 | { nothing to initialize }
|
---|
| 848 |
|
---|
| 849 | finalization
|
---|
| 850 | uTree.Free;
|
---|
| 851 | uReportsList.Free;
|
---|
| 852 | uLabReports.Free;
|
---|
| 853 | uDateRanges.Free;
|
---|
| 854 | uHSTypes.Free;
|
---|
| 855 |
|
---|
| 856 | end.
|
---|