@measurequick/measurequick-report-generator 1.1.24 → 1.1.25
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.
package/package.json
CHANGED
|
@@ -81,51 +81,40 @@ export async function generateReport(payload) { console.log("Measurements Report
|
|
|
81
81
|
return await measurementsDoc1.saveAsBase64({ dataUri: true });
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function
|
|
85
|
-
if (!base64) return "";
|
|
86
|
-
base64 = base64.replace(/^[^,]+,/, '').replace(/\s/g, '');
|
|
87
|
-
var binary_string = window.atob(base64);
|
|
88
|
-
var len = binary_string.length;
|
|
89
|
-
var bytes = new Uint8Array(len);
|
|
90
|
-
for (var i = 0; i < len; i++) {
|
|
91
|
-
bytes[i] = binary_string.charCodeAt(i);
|
|
92
|
-
}
|
|
93
|
-
return bytes.buffer;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function printMeasurementDetailSection(cNums, rowPrinting, section, t1, t2, form, mdFormNum) {
|
|
84
|
+
function printMeasurementDetailSection(cNums, rowPrinting, section, t1, t2, form, page) {
|
|
97
85
|
rowPrinting++;
|
|
98
86
|
for (let rowNum = 0; rowNum < section.length; rowNum++) {
|
|
99
87
|
if (rowPrinting > 35) return rowPrinting;
|
|
100
88
|
let m = section[rowNum];
|
|
89
|
+
console.log(m);
|
|
101
90
|
form.getTextField(`MD${cNums} ${rowPrinting}1`).setText(`${m.label} (${m.units})`);
|
|
102
91
|
if (m.ref) {
|
|
103
92
|
if (t1.data[m.ref]) {
|
|
104
93
|
let v = (+t1.data[m.ref]).toFixed(2);
|
|
105
94
|
form.getTextField(`MD${cNums} ${rowPrinting}2`).setText(`${v}`);
|
|
106
|
-
let rangeIcon = getRangeIcon(t1, m.ref,
|
|
95
|
+
let rangeIcon = getRangeIcon(t1, m.ref, page);
|
|
107
96
|
if (rangeIcon) form.getButton(`MD${cNums} Image ${rowPrinting}2`).setImage(rangeIcon);
|
|
108
|
-
let toolIcon = getToolIcon(t1, m.ref,
|
|
97
|
+
let toolIcon = getToolIcon(t1, m.ref, page);
|
|
109
98
|
if (toolIcon) form.getButton(`MD${cNums} Image ${rowPrinting}2 Tool`).setImage(toolIcon);
|
|
110
99
|
} else form.getTextField(`MD${cNums} ${rowPrinting}2`).setText("--");
|
|
111
|
-
} else form.getTextField(`MD${cNums} ${rowPrinting}2`).setText(m.testInValue);
|
|
100
|
+
} else form.getTextField(`MD${cNums} ${rowPrinting}2`).setText(`${m.testInValue}`);
|
|
112
101
|
if (cNums >= 3) {
|
|
113
102
|
if (m.ref) {
|
|
114
103
|
if (t2.data[m.ref]) {
|
|
115
104
|
let v = (+t2.data[m.ref]).toFixed(2);
|
|
116
105
|
form.getTextField(`MD${cNums} ${rowPrinting}3`).setText(`${v}`);
|
|
117
|
-
let rangeIcon = getRangeIcon(t2, m.ref,
|
|
106
|
+
let rangeIcon = getRangeIcon(t2, m.ref, page);
|
|
118
107
|
if (rangeIcon) form.getButton(`MD${cNums} Image ${rowPrinting}3`).setImage(rangeIcon);
|
|
119
|
-
let toolIcon = getToolIcon(t2, m.ref,
|
|
108
|
+
let toolIcon = getToolIcon(t2, m.ref, page);
|
|
120
109
|
if (toolIcon) form.getButton(`MD${cNums} Image ${rowPrinting}3 Tool`).setImage(toolIcon);
|
|
121
110
|
} else form.getTextField(`MD${cNums} ${rowPrinting}3`).setText("--");
|
|
122
|
-
} else form.getTextField(`MD${cNums} ${rowPrinting}3`).setText(m.testOutValue);
|
|
111
|
+
} else form.getTextField(`MD${cNums} ${rowPrinting}3`).setText(`${m.testOutValue}`);
|
|
123
112
|
}
|
|
124
113
|
if (cNums == 4) {
|
|
125
114
|
if (t1.data[m.ref] && t2.data[m.ref]) {
|
|
126
115
|
let v = ((+t1.data[m.ref]) - (+t2.data[m.ref])).toFixed(2);
|
|
127
116
|
form.getTextField(`MD${cNums} ${rowPrinting}4`).setText(`${v}`);
|
|
128
|
-
let rangeIcon = getRangeIcon(t2, m.ref,
|
|
117
|
+
let rangeIcon = getRangeIcon(t2, m.ref, page);
|
|
129
118
|
if (rangeIcon) form.getButton(`MD${cNums} Image ${rowPrinting}4`).setImage(rangeIcon);
|
|
130
119
|
} else form.getTextField(`MD${cNums} ${rowPrinting}4`).setText("--");
|
|
131
120
|
}
|
|
@@ -134,19 +123,27 @@ function printMeasurementDetailSection(cNums, rowPrinting, section, t1, t2, form
|
|
|
134
123
|
return rowPrinting;
|
|
135
124
|
}
|
|
136
125
|
|
|
137
|
-
function getToolIcon(test, ref,
|
|
126
|
+
function getToolIcon(test, ref, page) {
|
|
138
127
|
let toolIcon;
|
|
139
128
|
switch (test.source[ref]) {
|
|
140
|
-
case "Testo": toolIcon = embeddedIcons[
|
|
141
|
-
case "Fieldpiece": toolIcon = embeddedIcons[
|
|
142
|
-
case "iConnect": toolIcon = embeddedIcons[
|
|
143
|
-
case "iManifold": toolIcon = embeddedIcons[
|
|
144
|
-
|
|
129
|
+
case "Testo": toolIcon = embeddedIcons[page].iconTesto;
|
|
130
|
+
case "Fieldpiece": toolIcon = embeddedIcons[page].iconFieldpiece;
|
|
131
|
+
case "iConnect Model 900C": toolIcon = embeddedIcons[page].iconIconnect;
|
|
132
|
+
case "iManifold Model 900M": toolIcon = embeddedIcons[page].iconImanifold;
|
|
133
|
+
case "UEi HUB": toolIcon = embeddedIcons[page].iconUei;
|
|
134
|
+
case "Sporlan Pro/R": toolIcon = embeddedIcons[page].iconSprolanPro;
|
|
135
|
+
case "Sporlan Legacy": toolIcon = embeddedIcons[page].iconSprolanLegacy;
|
|
136
|
+
case "ComfortGuard": toolIcon = embeddedIcons[page].iconSensi;
|
|
137
|
+
case "BluFlame": toolIcon = embeddedIcons[page].iconBluflame;
|
|
138
|
+
case "iDVM510": toolIcon = embeddedIcons[page].iconRedfish510333;
|
|
139
|
+
case "iDVM510": toolIcon = embeddedIcons[page].iconRedfish510;
|
|
140
|
+
case "iDVM550": toolIcon = embeddedIcons[page].iconRedfish550;
|
|
141
|
+
case "Calculator": toolIcon = embeddedIcons[page].iconCalculator;
|
|
145
142
|
}
|
|
146
143
|
return toolIcon;
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
function getRangeIcon(test, ref,
|
|
146
|
+
function getRangeIcon(test, ref, page) {
|
|
150
147
|
let rangeIcon;
|
|
151
148
|
let offset = 0;
|
|
152
149
|
if (ref === 'temperature_saturation_evaporator')
|
|
@@ -158,9 +155,21 @@ function getRangeIcon(test, ref, mdFormNum) {
|
|
|
158
155
|
high = target + parseFloat(test.targets[`${ref}_ideal_high`]),
|
|
159
156
|
actual = parseFloat(test.data[`${ref}`]);
|
|
160
157
|
if ((target||target<=0) && (low||low<=0) && (high||high<=0) && (actual||actual<=0)) {
|
|
161
|
-
if (actual < low) rangeIcon = embeddedIcons[
|
|
162
|
-
else if (actual > high) rangeIcon = embeddedIcons[
|
|
163
|
-
else rangeIcon = embeddedIcons[
|
|
158
|
+
if (actual < low) rangeIcon = embeddedIcons[page].iconRangeLow;
|
|
159
|
+
else if (actual > high) rangeIcon = embeddedIcons[page].iconRangeHigh;
|
|
160
|
+
else rangeIcon = embeddedIcons[page].iconRangeNormal;
|
|
164
161
|
}
|
|
165
162
|
return rangeIcon;
|
|
166
163
|
}
|
|
164
|
+
|
|
165
|
+
function _base64ToArrayBuffer(base64) {
|
|
166
|
+
if (!base64) return "";
|
|
167
|
+
base64 = base64.replace(/^[^,]+,/, '').replace(/\s/g, '');
|
|
168
|
+
var binary_string = window.atob(base64);
|
|
169
|
+
var len = binary_string.length;
|
|
170
|
+
var bytes = new Uint8Array(len);
|
|
171
|
+
for (var i = 0; i < len; i++) {
|
|
172
|
+
bytes[i] = binary_string.charCodeAt(i);
|
|
173
|
+
}
|
|
174
|
+
return bytes.buffer;
|
|
175
|
+
}
|