[456] | 1 | unit rReports;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses Windows, SysUtils, Classes, ORNet, ORFn, ComCtrls, Chart, graphics;
|
---|
| 6 |
|
---|
| 7 | { Consults }
|
---|
| 8 | procedure ListConsults(Dest: TStrings);
|
---|
| 9 | procedure LoadConsultText(Dest: TStrings; IEN: Integer);
|
---|
| 10 |
|
---|
| 11 | { Reports }
|
---|
| 12 | procedure ListReports(Dest: TStrings);
|
---|
| 13 | procedure ListLabReports(Dest: TStrings);
|
---|
| 14 | procedure ListReportDateRanges(Dest: TStrings);
|
---|
| 15 | procedure ListHealthSummaryTypes(Dest: TStrings);
|
---|
| 16 | procedure ListImagingExams(Dest: TStrings);
|
---|
| 17 | procedure ListProcedures(Dest: TStrings);
|
---|
| 18 | procedure ListNutrAssessments(Dest: TStrings);
|
---|
| 19 | procedure ListSurgeryReports(Dest: TStrings);
|
---|
| 20 | procedure ColumnHeaders(Dest: TStrings; AReportType: String);
|
---|
| 21 | procedure SaveColumnSizes(aColumn: String);
|
---|
| 22 | procedure LoadReportText(Dest: TStrings; ReportType: string; const Qualifier: string; ARpc, AHSTag: string);
|
---|
| 23 | procedure RemoteQueryAbortAll;
|
---|
| 24 | procedure RemoteQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 25 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 26 | procedure DirectQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback,
|
---|
| 27 | AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String);
|
---|
| 28 | function ReportQualifierType(ReportType: Integer): Integer;
|
---|
| 29 | function ImagingParams: String;
|
---|
| 30 | function AutoRDV: String;
|
---|
| 31 | function HDRActive: String;
|
---|
| 32 | procedure PrintReportsToDevice(AReport: string; const Qualifier, Patient,
|
---|
| 33 | ADevice: string; var ErrMsg: string; aComponents: TStringlist;
|
---|
| 34 | ARemoteSiteID, ARemoteQuery, AHSTag: string);
|
---|
| 35 | function HSFileLookup(aFile: String; const StartFrom: string;
|
---|
| 36 | Direction: Integer): TStrings;
|
---|
| 37 | procedure HSComponentFiles(Dest: TStrings; aComponent: String);
|
---|
| 38 | procedure HSSubItems(Dest: TStrings; aItem: String);
|
---|
| 39 | procedure HSReportText(Dest: TStrings; aComponents: TStringlist);
|
---|
| 40 | procedure HSComponents(Dest: TStrings);
|
---|
| 41 | procedure HSABVComponents(Dest: TStrings);
|
---|
| 42 | procedure HSDispComponents(Dest: TStrings);
|
---|
| 43 | procedure HSComponentSubs(Dest: TStrings; aItem: String);
|
---|
| 44 | procedure HealthSummaryCheck(Dest: TStrings; aQualifier: string);
|
---|
| 45 | function GetFormattedReport(AReport: string; const Qualifier, Patient: string;
|
---|
| 46 | aComponents: TStringlist; ARemoteSiteID, ARemoteQuery, AHSTag: string): TStrings;
|
---|
| 47 | procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, ATitle: string;
|
---|
| 48 | var ErrMsg: string);
|
---|
| 49 | function DefaultToWindowsPrinter: Boolean;
|
---|
| 50 | procedure PrintGraph(GraphImage: TChart; PageTitle: string);
|
---|
| 51 | procedure PrintBitmap(Canvas: TCanvas; DestRect: TRect; Bitmap: TBitmap);
|
---|
| 52 | procedure CreatePatientHeader(var HeaderList: TStringList; PageTitle: string);
|
---|
| 53 | procedure SaveDefaultPrinter(DefPrinter: string) ;
|
---|
| 54 | function GetRemoteStatus(aHandle: string): String;
|
---|
| 55 | function GetAdhocLookup: integer;
|
---|
| 56 | procedure SetAdhocLookup(aLookup: integer);
|
---|
| 57 | procedure GetRemoteData(Dest: TStrings; aHandle: string; aItem: PChar);
|
---|
| 58 | procedure ModifyHDRData(Dest: string; aHandle: string; aID: string);
|
---|
| 59 | procedure PrintVReports(Dest, ADevice, AHeader: string; AReport: TStringList);
|
---|
| 60 |
|
---|
| 61 | implementation
|
---|
| 62 |
|
---|
[830] | 63 | uses uCore, rCore, Printers, clipbrd, uReports, fReports
|
---|
| 64 | { TODO -oRV -cWVEHR Long Age : Changed to use long age }
|
---|
| 65 | , rWVEHR;
|
---|
[456] | 66 |
|
---|
| 67 | var
|
---|
| 68 | uTree: TStringList;
|
---|
| 69 | uReportsList: TStringList;
|
---|
| 70 | uLabReports: TStringList;
|
---|
| 71 | uDateRanges: TStringList;
|
---|
| 72 | uHSTypes: TStringList;
|
---|
| 73 |
|
---|
| 74 | { Consults }
|
---|
| 75 |
|
---|
| 76 | procedure ListConsults(Dest: TStrings);
|
---|
| 77 | var
|
---|
| 78 | i: Integer;
|
---|
| 79 | x: string;
|
---|
| 80 | begin
|
---|
| 81 | CallV('ORWCS LIST OF CONSULT REPORTS', [Patient.DFN]);
|
---|
| 82 | with RPCBrokerV do
|
---|
| 83 | begin
|
---|
| 84 | SortByPiece(TStringList(Results), U, 2);
|
---|
| 85 | InvertStringList(TStringList(Results));
|
---|
| 86 | SetListFMDateTime('mmm dd,yy', TStringList(Results), U, 2);
|
---|
| 87 | for i := 0 to Results.Count - 1 do
|
---|
| 88 | begin
|
---|
| 89 | x := Results[i];
|
---|
| 90 | x := Pieces(x, U, 1, 2) + U + Piece(x, U, 3) + ' (' + Piece(x, U, 4) + ')';
|
---|
| 91 | Results[i] := x;
|
---|
| 92 | end;
|
---|
[830] | 93 | FastAssign(Results, Dest);
|
---|
[456] | 94 | end;
|
---|
| 95 | end;
|
---|
| 96 |
|
---|
| 97 | procedure LoadConsultText(Dest: TStrings; IEN: Integer);
|
---|
| 98 | begin
|
---|
| 99 | CallV('ORWCS REPORT TEXT', [Patient.DFN, IEN]);
|
---|
| 100 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 101 | end;
|
---|
| 102 |
|
---|
| 103 | { Reports }
|
---|
| 104 |
|
---|
| 105 | procedure ExtractSection(Dest: TStrings; const Section: string; Mixed: Boolean);
|
---|
| 106 | var
|
---|
| 107 | i: Integer;
|
---|
| 108 | begin
|
---|
| 109 | with RPCBrokerV do
|
---|
| 110 | begin
|
---|
| 111 | i := -1;
|
---|
| 112 | repeat Inc(i) until (i = Results.Count) or (Results[i] = Section);
|
---|
| 113 | Inc(i);
|
---|
| 114 | while (i < Results.Count) and (Results[i] <> '$$END') do
|
---|
| 115 | begin
|
---|
| 116 | {if (Pos('OR_ECS',UpperCase(Results[i]))>0) and (not uECSReport.ECSPermit) then
|
---|
| 117 | begin
|
---|
| 118 | Inc(i);
|
---|
| 119 | Continue;
|
---|
| 120 | end;}
|
---|
| 121 | if Mixed = true then
|
---|
| 122 | Dest.Add(MixedCase(Results[i]))
|
---|
| 123 | else
|
---|
| 124 | Dest.Add(Results[i]);
|
---|
| 125 | Inc(i);
|
---|
| 126 | end;
|
---|
| 127 | end;
|
---|
| 128 | end;
|
---|
| 129 |
|
---|
| 130 | procedure LoadReportLists;
|
---|
| 131 | begin
|
---|
| 132 | CallV('ORWRP REPORT LISTS', [nil]);
|
---|
| 133 | uDateRanges := TStringList.Create;
|
---|
| 134 | uHSTypes := TStringList.Create;
|
---|
| 135 | uReportsList := TStringList.Create;
|
---|
| 136 | ExtractSection(uDateRanges, '[DATE RANGES]', true);
|
---|
| 137 | ExtractSection(uHSTypes, '[HEALTH SUMMARY TYPES]', true);
|
---|
| 138 | ExtractSection(uReportsList, '[REPORT LIST]', true);
|
---|
| 139 | end;
|
---|
| 140 |
|
---|
| 141 | procedure LoadLabReportLists;
|
---|
| 142 | begin
|
---|
| 143 | CallV('ORWRP LAB REPORT LISTS', [nil]);
|
---|
| 144 | uLabReports := TStringList.Create;
|
---|
| 145 | ExtractSection(uLabReports, '[LAB REPORT LIST]', true);
|
---|
| 146 | end;
|
---|
| 147 |
|
---|
[830] | 148 | procedure LoadTree(Tab: String);
|
---|
[456] | 149 | begin
|
---|
[830] | 150 | CallV('ORWRP3 EXPAND COLUMNS', [Tab]);
|
---|
[456] | 151 | uTree := TStringList.Create;
|
---|
| 152 | ExtractSection(uTree, '[REPORT LIST]', false);
|
---|
| 153 | end;
|
---|
| 154 |
|
---|
| 155 | procedure ListReports(Dest: TStrings);
|
---|
| 156 | var
|
---|
| 157 | i: Integer;
|
---|
| 158 | begin
|
---|
| 159 | if uTree = nil
|
---|
[830] | 160 | then LoadTree('REPORTS')
|
---|
[456] | 161 | else
|
---|
| 162 | begin
|
---|
| 163 | uTree.Clear;
|
---|
[830] | 164 | LoadTree('REPORTS');
|
---|
[456] | 165 | end;
|
---|
[830] | 166 | for i := 0 to uTree.Count - 1 do Dest.Add(Pieces(uTree[i], '^', 1, 20));
|
---|
[456] | 167 | end;
|
---|
| 168 |
|
---|
| 169 | procedure ListLabReports(Dest: TStrings);
|
---|
| 170 | var
|
---|
| 171 | i: integer;
|
---|
| 172 | begin
|
---|
[830] | 173 | {if uLabreports = nil then LoadLabReportLists;
|
---|
| 174 | for i := 0 to uLabReports.Count - 1 do Dest.Add(Pieces(uLabReports[i], U, 1, 10)); }
|
---|
| 175 | if uTree = nil
|
---|
| 176 | then LoadTree('LABS')
|
---|
| 177 | else
|
---|
| 178 | begin
|
---|
| 179 | uTree.Clear;
|
---|
| 180 | LoadTree('LABS');
|
---|
| 181 | end;
|
---|
| 182 | for i := 0 to uTree.Count - 1 do Dest.Add(Pieces(uTree[i], '^', 1, 20));
|
---|
[456] | 183 | end;
|
---|
| 184 |
|
---|
| 185 | procedure ListReportDateRanges(Dest: TStrings);
|
---|
| 186 | begin
|
---|
| 187 | if uDateRanges = nil then LoadReportLists;
|
---|
[830] | 188 | FastAssign(uDateRanges, Dest);
|
---|
[456] | 189 | end;
|
---|
| 190 |
|
---|
| 191 | procedure ListHealthSummaryTypes(Dest: TStrings);
|
---|
| 192 | begin
|
---|
| 193 | if uHSTypes = nil then LoadReportLists;
|
---|
| 194 | MixedCaseList(uHSTypes);
|
---|
[830] | 195 | FastAssign(uHSTypes, Dest);
|
---|
[456] | 196 | end;
|
---|
| 197 |
|
---|
| 198 | procedure HealthSummaryCheck(Dest: TStrings; aQualifier: string);
|
---|
| 199 |
|
---|
| 200 | begin
|
---|
| 201 | if aQualifier = '1' then
|
---|
| 202 | begin
|
---|
| 203 | ListHealthSummaryTypes(Dest);
|
---|
| 204 | end;
|
---|
| 205 | end;
|
---|
| 206 |
|
---|
| 207 | procedure ColumnHeaders(Dest: TStrings; AReportType: String);
|
---|
| 208 | begin
|
---|
| 209 | CallV('ORWRP COLUMN HEADERS',[AReportType]);
|
---|
[830] | 210 | FastAssign(RPCBrokerV.Results, Dest);
|
---|
[456] | 211 | end;
|
---|
| 212 |
|
---|
| 213 | procedure SaveColumnSizes(aColumn: String);
|
---|
| 214 | begin
|
---|
| 215 | CallV('ORWCH SAVECOL', [aColumn]);
|
---|
| 216 | end;
|
---|
| 217 |
|
---|
| 218 | procedure ListImagingExams(Dest: TStrings);
|
---|
| 219 | var
|
---|
| 220 | x: string;
|
---|
| 221 | i: Integer;
|
---|
| 222 | begin
|
---|
| 223 | CallV('ORWRA IMAGING EXAMS1', [Patient.DFN]);
|
---|
| 224 | with RPCBrokerV do
|
---|
| 225 | begin
|
---|
| 226 | SetListFMDateTime('mm/dd/yyyy hh:nn', TStringList(Results), U, 3);
|
---|
| 227 | for i := 0 to Results.Count - 1 do
|
---|
| 228 | begin
|
---|
| 229 | x := Results[i];
|
---|
| 230 | if Piece(x,U,7) = 'Y' then SetPiece(x,U,7, ' - Abnormal');
|
---|
| 231 | x := Piece(x,U,1) + U + 'i' + Pieces(x,U,2,3)+ U + Piece(x,U,4)
|
---|
| 232 | + U + Piece(x,U,6) + Piece(x,U,7) + U
|
---|
| 233 | + MixedCase(Piece(Piece(x,U,9),'~',2)) + U + Piece(x,U,5) + U + '[+]'
|
---|
| 234 | + U + Pieces(x, U, 15,17);
|
---|
| 235 | (* x := Piece(x,U,1) + U + 'i' + Pieces(x,U,2,3)+ U + Piece(x,U,4)
|
---|
| 236 | + U + Piece(x,U,6) + Piece(x,U,7) + U + Piece(x,U,5) + U + '[+]' + U + Piece(x, U, 15);*)
|
---|
| 237 | Results[i] := x;
|
---|
| 238 | end;
|
---|
[830] | 239 | FastAssign(Results, Dest);
|
---|
[456] | 240 | end;
|
---|
| 241 | end;
|
---|
| 242 |
|
---|
| 243 | procedure ListProcedures(Dest: TStrings);
|
---|
| 244 | var
|
---|
| 245 | x,sdate: string;
|
---|
| 246 | i: Integer;
|
---|
| 247 | begin
|
---|
| 248 | CallV('ORWMC PATIENT PROCEDURES1', [Patient.DFN]);
|
---|
| 249 | with RPCBrokerV do
|
---|
| 250 | begin
|
---|
| 251 | for i := 0 to Results.Count - 1 do
|
---|
| 252 | begin
|
---|
| 253 | x := Results[i];
|
---|
| 254 | if length(piece(x, U, 8)) > 0 then
|
---|
| 255 | begin
|
---|
| 256 | sdate := ShortDateStrToDate(piece(piece(x, U, 8),'@',1)) + ' ' + piece(piece(x, U, 8),'@',2);
|
---|
| 257 | end;
|
---|
| 258 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 2) + U + sdate + U + Piece(x, U, 3) + U + Piece(x, U, 9) + '^[+]';
|
---|
| 259 | Results[i] := x;
|
---|
| 260 | end;
|
---|
[830] | 261 | FastAssign(Results, Dest);
|
---|
[456] | 262 | end;
|
---|
| 263 | end;
|
---|
| 264 |
|
---|
| 265 | procedure ListNutrAssessments(Dest: TStrings);
|
---|
| 266 | var
|
---|
| 267 | x: string;
|
---|
| 268 | i: Integer;
|
---|
| 269 | begin
|
---|
| 270 | CallV('ORWRP1 LISTNUTR', [Patient.DFN]);
|
---|
| 271 | with RPCBrokerV do
|
---|
| 272 | begin
|
---|
| 273 | for i := 0 to Results.Count - 1 do
|
---|
| 274 | begin
|
---|
| 275 | x := Results[i];
|
---|
| 276 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 3) + U + Piece(x, U, 3);
|
---|
| 277 | Results[i] := x;
|
---|
| 278 | end;
|
---|
[830] | 279 | FastAssign(Results, Dest);
|
---|
[456] | 280 | end;
|
---|
| 281 | end;
|
---|
| 282 |
|
---|
| 283 | procedure ListSurgeryReports(Dest: TStrings);
|
---|
| 284 | { returns a list of surgery cases for a patient, without documents}
|
---|
| 285 | //Facility^Case #^Date/Time of Operation^Operative Procedure^Surgeon name)
|
---|
| 286 | var
|
---|
| 287 | i: integer;
|
---|
| 288 | x, AFormat: string;
|
---|
| 289 | begin
|
---|
| 290 | CallV('ORWSR RPTLIST', [Patient.DFN]);
|
---|
| 291 | with RPCBrokerV do
|
---|
| 292 | begin
|
---|
| 293 | for i := 0 to Results.Count - 1 do
|
---|
| 294 | begin
|
---|
| 295 | x := Results[i];
|
---|
| 296 | if Piece(Piece(x, U, 3), '.', 2) = '' then AFormat := 'mm/dd/yyyy' else AFormat := 'mm/dd/yyyy hh:nn';
|
---|
| 297 | x := Piece(x, U, 1) + U + 'i' + Piece(x, U, 2) + U + FormatFMDateTimeStr(AFormat, Piece(x, U, 3))+ U +
|
---|
| 298 | Piece(x, U, 4)+ U + Piece(x, U, 5);
|
---|
| 299 | if Piece(Results[i], U, 6) = '+' then x := x + '^[+]';
|
---|
| 300 | Results[i] := x;
|
---|
| 301 | end;
|
---|
[830] | 302 | FastAssign(Results, Dest);
|
---|
[456] | 303 | end;
|
---|
| 304 | end;
|
---|
| 305 |
|
---|
| 306 | procedure LoadReportText(Dest: TStrings; ReportType: string; const Qualifier: string; ARpc, AHSTag: string);
|
---|
| 307 | var
|
---|
| 308 | HSType, DaysBack, ExamID, MaxOcc, AReport, x: string;
|
---|
| 309 | Alpha, Omega, Trans: double;
|
---|
| 310 | begin
|
---|
| 311 | HSType := '';
|
---|
| 312 | DaysBack := '';
|
---|
| 313 | ExamID := '';
|
---|
| 314 | Alpha := 0;
|
---|
| 315 | Omega := 0;
|
---|
| 316 | if CharAt(Qualifier, 1) = 'T' then
|
---|
| 317 | begin
|
---|
| 318 | Alpha := StrToFMDateTime(Piece(Qualifier,';',1));
|
---|
| 319 | Omega := StrToFMDateTime(Piece(Qualifier,';',2));
|
---|
| 320 | if Alpha > Omega then
|
---|
| 321 | begin
|
---|
| 322 | Trans := Omega;
|
---|
| 323 | Omega := Alpha;
|
---|
| 324 | Alpha := Trans;
|
---|
| 325 | end;
|
---|
| 326 | MaxOcc := Piece(Qualifier,';',3);
|
---|
| 327 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 328 | end;
|
---|
| 329 | if CharAt(Qualifier, 1) = 'd' then
|
---|
| 330 | begin
|
---|
| 331 | MaxOcc := Piece(Qualifier,';',2);
|
---|
| 332 | SetPiece(AHSTag,';',4,MaxOcc);
|
---|
| 333 | x := Piece(Qualifier,';',1);
|
---|
| 334 | DaysBack := Copy(x, 2, Length(x));
|
---|
| 335 | end;
|
---|
| 336 | if CharAt(Qualifier, 1) = 'h' then HSType := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 337 | if CharAt(Qualifier, 1) = 'i' then ExamID := Copy(Qualifier, 2, Length(Qualifier));
|
---|
| 338 | AReport := ReportType + '~' + AHSTag;
|
---|
| 339 | if Length(ARpc) > 0 then
|
---|
| 340 | begin
|
---|
| 341 | CallV(ARpc, [Patient.DFN, AReport, HSType, DaysBack, ExamID, Alpha, Omega]);
|
---|
| 342 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 343 | end
|
---|
| 344 | else
|
---|
| 345 | begin
|
---|
| 346 | Dest.Add('RPC is missing from report definition (file 101.24).');
|
---|
| 347 | Dest.Add('Please contact Technical Support.');
|
---|
| 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 |
|
---|
| 547 | procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, Atitle: string; var ErrMsg: string);
|
---|
| 548 | var
|
---|
| 549 | i, j, x, y, LineHeight: integer;
|
---|
| 550 | aGoHead: string;
|
---|
| 551 | aHeader: TStringList;
|
---|
| 552 | const
|
---|
| 553 | TX_ERR_CAP = 'Print Error';
|
---|
| 554 | TX_FONT_SIZE = 10;
|
---|
| 555 | TX_FONT_NAME = 'Courier New';
|
---|
| 556 | begin
|
---|
| 557 | aHeader := TStringList.Create;
|
---|
| 558 | aGoHead := '';
|
---|
| 559 | if piece(Atitle,';',2) = '1' then
|
---|
| 560 | begin
|
---|
| 561 | Atitle := piece(Atitle,';',1);
|
---|
| 562 | aGoHead := '1';
|
---|
| 563 | end;
|
---|
| 564 | CreatePatientHeader(aHeader ,ATitle);
|
---|
| 565 | with ARichEdit do
|
---|
| 566 | begin
|
---|
| 567 | (* if Lines[Lines.Count - 1] = APageBreak then // remove trailing form feed
|
---|
| 568 | Lines.Delete(Lines.Count - 1);
|
---|
| 569 | while (Lines[0] = '') or (Lines[0] = APageBreak) do
|
---|
| 570 | Lines.Delete(0); // remove leading blank lines and form feeds*)
|
---|
| 571 |
|
---|
| 572 | {v20.4 - SFC-0602-62899 - RV}
|
---|
| 573 | while (Lines.Count > 0) and ((Lines[Lines.Count - 1] = '') or (Lines[Lines.Count - 1] = APageBreak)) do
|
---|
| 574 | Lines.Delete(Lines.Count - 1); // remove trailing blank lines and form feeds
|
---|
| 575 | while (Lines.Count > 0) and ((Lines[0] = '') or (Lines[0] = APageBreak)) do
|
---|
| 576 | Lines.Delete(0); // remove leading blank lines and form feeds
|
---|
| 577 |
|
---|
| 578 | if Lines.Count > 1 then
|
---|
| 579 | begin
|
---|
| 580 | (* i := Lines.IndexOf(APageBreak);
|
---|
| 581 | if ((i >= 0 ) and (i < Lines.Count - 1)) then // removed in v15.9 (RV)
|
---|
| 582 | begin*)
|
---|
| 583 | Printer.Canvas.Font.Size := TX_FONT_SIZE;
|
---|
| 584 | Printer.Canvas.Font.Name := TX_FONT_NAME;
|
---|
| 585 | Printer.Title := ATitle;
|
---|
| 586 | x := Trunc(Printer.Canvas.TextWidth(StringOfChar('=', TX_FONT_SIZE)) * 0.75);
|
---|
| 587 | LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME);
|
---|
| 588 | y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV)
|
---|
| 589 | Printer.BeginDoc;
|
---|
| 590 | for i := 0 to Lines.Count - 1 do
|
---|
| 591 | begin
|
---|
| 592 | if Lines[i] = APageBreak then
|
---|
| 593 | begin
|
---|
| 594 | Printer.NewPage;
|
---|
| 595 | y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV)
|
---|
| 596 | if aGoHead = '1' then
|
---|
| 597 | begin
|
---|
| 598 | for j := 0 to aHeader.Count - 1 do
|
---|
| 599 | begin
|
---|
| 600 | Printer.Canvas.TextOut(x, y, aHeader[j]);
|
---|
| 601 | y := y + LineHeight;
|
---|
| 602 | end;
|
---|
| 603 | end;
|
---|
| 604 | end
|
---|
| 605 | else
|
---|
| 606 | begin
|
---|
| 607 | Printer.Canvas.TextOut(x, y, Lines[i]);
|
---|
| 608 | y := y + LineHeight;
|
---|
| 609 | end;
|
---|
| 610 | end;
|
---|
| 611 | Printer.EndDoc;
|
---|
| 612 | (* end
|
---|
| 613 | else // removed in v15.9 (RV) TRichEdit.Print no longer used.
|
---|
| 614 | try
|
---|
| 615 | Font.Size := TX_FONT_SIZE;
|
---|
| 616 | Font.Name := TX_FONT_NAME;
|
---|
| 617 | Print(ATitle);
|
---|
| 618 | except
|
---|
| 619 | ErrMsg := TX_ERR_CAP;
|
---|
| 620 | end;*)
|
---|
| 621 | end
|
---|
| 622 | else if ARichEdit.Lines.Count = 1 then
|
---|
| 623 | if Piece(ARichEdit.Lines[0], U, 1) <> '0' then
|
---|
| 624 | ErrMsg := Piece(ARichEdit.Lines[0], U, 2);
|
---|
| 625 | end;
|
---|
| 626 | aHeader.Free;
|
---|
| 627 | end;
|
---|
| 628 |
|
---|
| 629 | procedure CreatePatientHeader(var HeaderList: TStringList; PageTitle: string);
|
---|
| 630 | // standard patient header, from HEAD^ORWRPP
|
---|
| 631 | var
|
---|
| 632 | tmpStr, tmpItem: string;
|
---|
| 633 | begin
|
---|
| 634 | with HeaderList do
|
---|
| 635 | begin
|
---|
| 636 | Add(' ');
|
---|
| 637 | Add(StringOfChar(' ', (74 - Length(PageTitle)) div 2) + PageTitle);
|
---|
| 638 | Add(' ');
|
---|
| 639 | tmpStr := Patient.Name + ' ' + Patient.SSN;
|
---|
| 640 | tmpItem := tmpStr + StringOfChar(' ', 39 - Length(tmpStr)) + Encounter.LocationName;
|
---|
[830] | 641 | { TODO -oRV -cWVEHR Long Age : Changed to use long age }
|
---|
| 642 | //tmpStr := FormatFMDateTime('mmm dd, yyyy', Patient.DOB) + ' (' + IntToStr(Patient.Age) + ')';
|
---|
| 643 | tmpStr := FormatFMDateTime('mmm dd, yyyy', Patient.DOB) + ' (' + GetPatientBriefAge(Patient.DFN) + ')';
|
---|
| 644 | {}
|
---|
[456] | 645 | tmpItem := tmpItem + StringOfChar(' ', 74 - (Length(tmpItem) + Length(tmpStr))) + tmpStr;
|
---|
| 646 | Add(tmpItem);
|
---|
| 647 | Add(StringOfChar('=', 74));
|
---|
| 648 | Add('*** WORK COPY ONLY ***' + StringOfChar(' ', 24) + 'Printed: ' + FormatFMDateTime('mmm dd, yyyy hh:nn', FMNow));
|
---|
| 649 | Add(' ');
|
---|
| 650 | Add(' ');
|
---|
| 651 | end;
|
---|
| 652 | end;
|
---|
| 653 |
|
---|
| 654 | procedure PrintGraph(GraphImage: TChart; PageTitle: string);
|
---|
| 655 | var
|
---|
| 656 | AHeader: TStringList;
|
---|
| 657 | i, y, LineHeight: integer;
|
---|
| 658 | GraphPic: TBitMap;
|
---|
| 659 | Magnif: integer;
|
---|
| 660 | const
|
---|
| 661 | TX_FONT_SIZE = 12;
|
---|
| 662 | TX_FONT_NAME = 'Courier New';
|
---|
| 663 | CF_BITMAP = 2; // from Windows.pas
|
---|
| 664 | begin
|
---|
| 665 | ClipBoard;
|
---|
| 666 | AHeader := TStringList.Create;
|
---|
| 667 | CreatePatientHeader(AHeader, PageTitle);
|
---|
| 668 | GraphPic := TBitMap.Create;
|
---|
| 669 | try
|
---|
| 670 | GraphImage.CopyToClipboardBitMap;
|
---|
| 671 | GraphPic.LoadFromClipBoardFormat(CF_BITMAP, ClipBoard.GetAsHandle(CF_BITMAP), 0);
|
---|
| 672 | with Printer do
|
---|
| 673 | begin
|
---|
| 674 | Canvas.Font.Size := TX_FONT_SIZE;
|
---|
| 675 | Canvas.Font.Name := TX_FONT_NAME;
|
---|
| 676 | Title := PageTitle;
|
---|
| 677 | Magnif := (Canvas.TextWidth(StringOfChar('=', 74)) div GraphImage.Width);
|
---|
| 678 | LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME);
|
---|
| 679 | y := LineHeight;
|
---|
| 680 | BeginDoc;
|
---|
| 681 | try
|
---|
| 682 | for i := 0 to AHeader.Count - 1 do
|
---|
| 683 | begin
|
---|
| 684 | Canvas.TextOut(0, y, AHeader[i]);
|
---|
| 685 | y := y + LineHeight;
|
---|
| 686 | end;
|
---|
| 687 | y := y + (4 * LineHeight);
|
---|
| 688 | //GraphImage.PrintPartial(Rect(0, y, Canvas.TextWidth(StringOfChar('=', 74)), y + (Magnif * GraphImage.Height)));
|
---|
| 689 | PrintBitmap(Canvas, Rect(0, y, Canvas.TextWidth(StringOfChar('=', 74)), y + (Magnif * GraphImage.Height)), GraphPic);
|
---|
| 690 | finally
|
---|
| 691 | EndDoc;
|
---|
| 692 | end;
|
---|
| 693 | end;
|
---|
| 694 | finally
|
---|
| 695 | ClipBoard.Clear;
|
---|
| 696 | GraphPic.Free;
|
---|
| 697 | AHeader.Free;
|
---|
| 698 | end;
|
---|
| 699 | end;
|
---|
| 700 |
|
---|
| 701 | procedure SaveDefaultPrinter(DefPrinter: string) ;
|
---|
| 702 | begin
|
---|
| 703 | CallV('ORWRP SAVE DEFAULT PRINTER', [DefPrinter]);
|
---|
| 704 | end;
|
---|
| 705 |
|
---|
| 706 | function HSFileLookup(aFile: String; const StartFrom: string;
|
---|
| 707 | Direction:Integer): TStrings;
|
---|
| 708 | begin
|
---|
| 709 | CallV('ORWRP2 HS FILE LOOKUP', [aFile, StartFrom, Direction]);
|
---|
| 710 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 711 | Result := RPCBrokerV.Results;
|
---|
| 712 | end;
|
---|
| 713 |
|
---|
| 714 | procedure HSComponentFiles(Dest: TStrings; aComponent: String);
|
---|
| 715 | begin
|
---|
| 716 | CallV('ORWRP2 HS COMP FILES', [aComponent]);
|
---|
| 717 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 718 | end;
|
---|
| 719 |
|
---|
| 720 | procedure HSSubItems(Dest: TStrings; aItem: String);
|
---|
| 721 | begin
|
---|
| 722 | CallV('ORWRP2 HS SUBITEMS', [aItem]);
|
---|
| 723 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 724 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 725 | end;
|
---|
| 726 |
|
---|
| 727 | procedure HSReportText(Dest: TStrings; aComponents: TStringlist);
|
---|
| 728 | begin
|
---|
| 729 | CallV('ORWRP2 HS REPORT TEXT', [aComponents, Patient.DFN]);
|
---|
| 730 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 731 | end;
|
---|
| 732 |
|
---|
| 733 | procedure HSComponents(Dest: TStrings);
|
---|
| 734 | begin
|
---|
| 735 | CallV('ORWRP2 HS COMPONENTS', [nil]);
|
---|
| 736 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 737 | end;
|
---|
| 738 |
|
---|
| 739 | procedure HSABVComponents(Dest: TStrings);
|
---|
| 740 | begin
|
---|
| 741 | CallV('ORWRP2 COMPABV', [nil]);
|
---|
| 742 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 743 | end;
|
---|
| 744 |
|
---|
| 745 | procedure HSDispComponents(Dest: TStrings);
|
---|
| 746 | begin
|
---|
| 747 | CallV('ORWRP2 COMPDISP', [nil]);
|
---|
| 748 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 749 | end;
|
---|
| 750 |
|
---|
| 751 | procedure HSComponentSubs(Dest: TStrings; aItem: String);
|
---|
| 752 | begin
|
---|
| 753 | CallV('ORWRP2 HS COMPONENT SUBS',[aItem]);
|
---|
| 754 | MixedCaseList(RPCBrokerV.Results);
|
---|
| 755 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 756 | end;
|
---|
| 757 |
|
---|
| 758 | function GetRemoteStatus(aHandle: string): String;
|
---|
| 759 | begin
|
---|
| 760 | CallV('XWB REMOTE STATUS CHECK', [aHandle]);
|
---|
| 761 | Result := RPCBrokerV.Results[0];
|
---|
| 762 | end;
|
---|
| 763 |
|
---|
| 764 | function GetAdhocLookup: integer;
|
---|
| 765 | begin
|
---|
| 766 | CallV('ORWRP2 GETLKUP', [nil]);
|
---|
| 767 | if RPCBrokerV.Results.Count > 0 then
|
---|
| 768 | Result := StrToInt(RPCBrokerV.Results[0])
|
---|
| 769 | else
|
---|
| 770 | Result := 0;
|
---|
| 771 | end;
|
---|
| 772 |
|
---|
| 773 | procedure SetAdhocLookup(aLookup: integer);
|
---|
| 774 |
|
---|
| 775 | begin
|
---|
| 776 | CallV('ORWRP2 SAVLKUP', [IntToStr(aLookup)]);
|
---|
| 777 | end;
|
---|
| 778 |
|
---|
| 779 | procedure GetRemoteData(Dest: TStrings; aHandle: string; aItem: PChar);
|
---|
| 780 | begin
|
---|
| 781 | CallV('XWB REMOTE GETDATA', [aHandle]);
|
---|
| 782 | if RPCBrokerV.Results.Count < 1 then
|
---|
| 783 | RPCBrokerV.Results[0] := 'No data found.';
|
---|
| 784 | if (RPCBrokerV.Results.Count < 2) and (RPCBrokerV.Results[0] = '') then
|
---|
| 785 | RPCBrokerV.Results[0] := 'No data found.';
|
---|
| 786 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
| 787 | end;
|
---|
| 788 |
|
---|
| 789 | procedure ModifyHDRData(Dest: string; aHandle: string; aID: string);
|
---|
| 790 | begin
|
---|
| 791 | CallV('ORWRP4 HDR MODIFY', [aHandle, aID]);
|
---|
| 792 | end;
|
---|
| 793 |
|
---|
| 794 | procedure PrintBitmap(Canvas: TCanvas; DestRect: TRect; Bitmap: TBitmap);
|
---|
| 795 | var
|
---|
| 796 | BitmapHeader: pBitmapInfo;
|
---|
| 797 | BitmapImage : POINTER;
|
---|
| 798 | HeaderSize : DWORD; // Use DWORD for D3-D5 compatibility
|
---|
| 799 | ImageSize : DWORD;
|
---|
| 800 | begin
|
---|
| 801 | GetDIBSizes(Bitmap.Handle, HeaderSize, ImageSize);
|
---|
| 802 | GetMem(BitmapHeader, HeaderSize);
|
---|
| 803 | GetMem(BitmapImage, ImageSize);
|
---|
| 804 | try
|
---|
| 805 | GetDIB(Bitmap.Handle, Bitmap.Palette, BitmapHeader^, BitmapImage^);
|
---|
| 806 | StretchDIBits(Canvas.Handle,
|
---|
| 807 | DestRect.Left, DestRect.Top, // Destination Origin
|
---|
| 808 | DestRect.Right - DestRect.Left, // Destination Width
|
---|
| 809 | DestRect.Bottom - DestRect.Top, // Destination Height
|
---|
| 810 | 0, 0, // Source Origin
|
---|
| 811 | Bitmap.Width, Bitmap.Height, // Source Width & Height
|
---|
| 812 | BitmapImage,
|
---|
| 813 | TBitmapInfo(BitmapHeader^),
|
---|
| 814 | DIB_RGB_COLORS,
|
---|
| 815 | SRCCOPY)
|
---|
| 816 | finally
|
---|
| 817 | FreeMem(BitmapHeader);
|
---|
| 818 | FreeMem(BitmapImage)
|
---|
| 819 | end
|
---|
| 820 | end {PrintBitmap};
|
---|
| 821 |
|
---|
| 822 | initialization
|
---|
| 823 | { nothing to initialize }
|
---|
| 824 |
|
---|
| 825 | finalization
|
---|
| 826 | uTree.Free;
|
---|
| 827 | uReportsList.Free;
|
---|
| 828 | uLabReports.Free;
|
---|
| 829 | uDateRanges.Free;
|
---|
| 830 | uHSTypes.Free;
|
---|
| 831 |
|
---|
| 832 | end.
|
---|