@measurequick/measurequick-report-generator 1.0.57 → 1.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,12 +3,13 @@ import * as templates from "../templates/js/templates.js";
|
|
|
3
3
|
import * as request from "../templates/js/request.js";
|
|
4
4
|
|
|
5
5
|
let jsPDF = require("jspdf");
|
|
6
|
-
let doc
|
|
6
|
+
let doc;
|
|
7
7
|
let reportData;
|
|
8
8
|
let currentSnapshot;
|
|
9
9
|
|
|
10
10
|
export function generateReport(reportType, payload) {
|
|
11
11
|
try {
|
|
12
|
+
doc = new jsPDF(templates.docOptions);
|
|
12
13
|
reportData = JSON.parse(JSON.stringify(payload));
|
|
13
14
|
let testNumber = 0;
|
|
14
15
|
for (currentSnapshot in reportData.snapshots) {
|
|
@@ -225,7 +226,7 @@ function printDiagnosticPage() {
|
|
|
225
226
|
doc.addPage();
|
|
226
227
|
printBoilerPlateDiagnostic();
|
|
227
228
|
printSubsystemReview();
|
|
228
|
-
|
|
229
|
+
printSystemDiagnostics();
|
|
229
230
|
printCorrectiveActions();
|
|
230
231
|
}
|
|
231
232
|
|
|
@@ -269,13 +270,13 @@ function printCorrectiveActions() {
|
|
|
269
270
|
let actionKey = Object.keys(ca[sectionKey])[j];
|
|
270
271
|
let action = ca[sectionKey][actionKey];
|
|
271
272
|
if (actionKey == "header") {
|
|
272
|
-
doc.setFontSize(
|
|
273
|
+
doc.setFontSize(9);
|
|
273
274
|
doc.setFontStyle("bold");
|
|
274
|
-
doc.text(
|
|
275
|
+
doc.text(action, .25, y);
|
|
275
276
|
} else {
|
|
276
277
|
doc.setFontSize(8);
|
|
277
278
|
doc.setFontStyle("normal");
|
|
278
|
-
doc.text(actionKey, .25, y);
|
|
279
|
+
doc.text(getPhotoSectionNameFromTag(actionKey), .25, y);
|
|
279
280
|
}
|
|
280
281
|
y += .18;
|
|
281
282
|
}
|
|
@@ -460,10 +461,6 @@ function getRangeIcon(key, actualValue, currentSnapshot) {
|
|
|
460
461
|
return rangeIconRef;
|
|
461
462
|
}
|
|
462
463
|
|
|
463
|
-
function getTextFromAction(action) {
|
|
464
|
-
return action;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
464
|
function alignRight(text, rightAlign, fontSize) {
|
|
468
465
|
return rightAlign - doc.getStringUnitWidth(text) * fontSize / 72;
|
|
469
466
|
}
|
|
@@ -2,6 +2,7 @@ import { PDFDocument } from 'pdf-lib';
|
|
|
2
2
|
import * as base64 from './graphics.js';
|
|
3
3
|
|
|
4
4
|
export async function generateReport(payload) {
|
|
5
|
+
|
|
5
6
|
// fetch and load form
|
|
6
7
|
const formPdfBytes = _base64ToArrayBuffer(base64.systemVitalsPdfTemplate)
|
|
7
8
|
const pdfDoc = await PDFDocument.load(formPdfBytes);
|
|
@@ -93,7 +94,7 @@ export async function generateReport(payload) {
|
|
|
93
94
|
form.getTextField('Subcooling').setText(`${textFields.subcooling} °${payload.units.temperature}`);
|
|
94
95
|
form.getTextField('CondenserApproach').setText(`${textFields.approach} °${payload.units.temperature}`);
|
|
95
96
|
form.getTextField('TemperatureSplit').setText(`${textFields.tempSplit} °${payload.units.temperature}`);
|
|
96
|
-
form.getTextField('TotalExternalStaticPressure').setText(`${textFields.tesp}
|
|
97
|
+
form.getTextField('TotalExternalStaticPressure').setText(`${textFields.tesp} "WC`);
|
|
97
98
|
form.getTextField('FilterFaceVelocity').setText(`${textFields.fltrFace} FPM`);
|
|
98
99
|
|
|
99
100
|
// print targets and range icons
|
|
@@ -108,7 +109,7 @@ export async function generateReport(payload) {
|
|
|
108
109
|
let high = +payload.test.targets[`${targetKeys[i]}_ideal_high`];
|
|
109
110
|
low = mid - low;
|
|
110
111
|
high = mid + high;
|
|
111
|
-
if (targetKeys[i] == "pressure_static_total_external") high =
|
|
112
|
+
if (targetKeys[i] == "pressure_static_total_external") high = mid * 1.4;
|
|
112
113
|
else if (targetKeys[i] == "velocity_face_filter1") high = 500;
|
|
113
114
|
if (actual < low && targetKeys[i] != "velocity_face_filter1") iconPlacement = "Low";
|
|
114
115
|
else if (actual > high) iconPlacement = "High";
|