@measurequick/measurequick-report-generator 1.0.0
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/README.md +29 -0
- package/assets/graphics.js +74 -0
- package/assets/request.json +240 -0
- package/assets/templates.js +253 -0
- package/index.js +152 -0
- package/package.json +17 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"reportName": "Test Report",
|
|
4
|
+
"reportType": "cooling",
|
|
5
|
+
"reportTheme": "dark",
|
|
6
|
+
"techName": "David Zucco",
|
|
7
|
+
"profilePicturePlacement": "header",
|
|
8
|
+
"companyLogoPlacement": "header"
|
|
9
|
+
},
|
|
10
|
+
"units": {
|
|
11
|
+
"temperature": "F",
|
|
12
|
+
"pressure": "PSIG",
|
|
13
|
+
"airflow": "SCFM"
|
|
14
|
+
},
|
|
15
|
+
"values": {
|
|
16
|
+
"lowSidePressure": "",
|
|
17
|
+
"lowSideTemperature": "",
|
|
18
|
+
"highSidePressure": "",
|
|
19
|
+
"highSideTemperature": "",
|
|
20
|
+
"suctionLineTemperature": "",
|
|
21
|
+
"liquidLineTemperature": "",
|
|
22
|
+
"dischargeLineTemperature": "",
|
|
23
|
+
"outdoorAirTemperature": "",
|
|
24
|
+
"superheatTemperature": "",
|
|
25
|
+
"subcoolingTemperature": "",
|
|
26
|
+
"compressionRatio": "",
|
|
27
|
+
"condenserVoltageL1": "",
|
|
28
|
+
"condenserVoltageL2": "",
|
|
29
|
+
"condenserAmperageL1": "",
|
|
30
|
+
"condenserAmperageL2": "",
|
|
31
|
+
"condenserPowerFactor": "",
|
|
32
|
+
"condenserPower": "",
|
|
33
|
+
"returnTemperature": "",
|
|
34
|
+
"returnRelativeHumidity": "",
|
|
35
|
+
"returnWetBulbTemperature": "",
|
|
36
|
+
"supplyTemperature": "",
|
|
37
|
+
"supplyRelativeHumidity": "",
|
|
38
|
+
"supplyWetBulb": "",
|
|
39
|
+
"airflowEstimated": "",
|
|
40
|
+
"totalExternalStaticPressure": "",
|
|
41
|
+
"airHandlerVoltageL1": "",
|
|
42
|
+
"airHandlerVoltageL2": "",
|
|
43
|
+
"airHandlerAmperageL1": "",
|
|
44
|
+
"airHandlerAmperageL2": "",
|
|
45
|
+
"airHandlerPowerFactor": "",
|
|
46
|
+
"airHandlerPower": "",
|
|
47
|
+
"systemType": "",
|
|
48
|
+
"nominalTonnage": "",
|
|
49
|
+
"refrigerant": "",
|
|
50
|
+
"airflowNominal": "",
|
|
51
|
+
"seer": "",
|
|
52
|
+
"meteringDevice": "",
|
|
53
|
+
"atmosphericPressure": "",
|
|
54
|
+
"elevation": "",
|
|
55
|
+
"temperature": "",
|
|
56
|
+
"humidity": "",
|
|
57
|
+
"dewPoint": "",
|
|
58
|
+
"systemStability": "",
|
|
59
|
+
"capacityNominal": "",
|
|
60
|
+
"capacityNormalized": "",
|
|
61
|
+
"capacityActual": "",
|
|
62
|
+
"capacityActualNormalized": "",
|
|
63
|
+
"capacitySensible": "",
|
|
64
|
+
"capacitySensibleNormalized": "",
|
|
65
|
+
"capacityLatent": "",
|
|
66
|
+
"capacityLatentNormalized": "",
|
|
67
|
+
"sensibleHeatRatio": "",
|
|
68
|
+
"temperatureSplitTarget": "",
|
|
69
|
+
"temperatureSplit": "",
|
|
70
|
+
"dehumidification": "",
|
|
71
|
+
"dehumidificationAlternate": "",
|
|
72
|
+
"fanEfficacy": "",
|
|
73
|
+
"totalPower": "",
|
|
74
|
+
"eer": "",
|
|
75
|
+
"seerApproximate": "",
|
|
76
|
+
"sensibleEfficiency": ""
|
|
77
|
+
},
|
|
78
|
+
"rangeIcons": {
|
|
79
|
+
"lowSidePressure": "",
|
|
80
|
+
"lowSideTemperature": "",
|
|
81
|
+
"highSidePressure": "",
|
|
82
|
+
"highSideTemperature": "",
|
|
83
|
+
"suctionLineTemperature": "",
|
|
84
|
+
"liquidLineTemperature": "",
|
|
85
|
+
"dischargeLineTemperature": "",
|
|
86
|
+
"outdoorAirTemperature": "",
|
|
87
|
+
"superheatTemperature": "",
|
|
88
|
+
"subcoolingTemperature": "",
|
|
89
|
+
"compressionRatio": "",
|
|
90
|
+
"condenserVoltageL1": "",
|
|
91
|
+
"condenserVoltageL2": "",
|
|
92
|
+
"condenserAmperageL1": "",
|
|
93
|
+
"condenserAmperageL2": "",
|
|
94
|
+
"condenserPowerFactor": "",
|
|
95
|
+
"condenserPower": "",
|
|
96
|
+
"returnTemperature": "",
|
|
97
|
+
"returnRelativeHumidity": "",
|
|
98
|
+
"returnWetBulbTemperature": "",
|
|
99
|
+
"supplyTemperature": "",
|
|
100
|
+
"supplyRelativeHumidity": "",
|
|
101
|
+
"supplyWetBulb": "",
|
|
102
|
+
"airflowEstimated": "",
|
|
103
|
+
"totalExternalStaticPressure": "",
|
|
104
|
+
"airHandlerVoltageL1": "",
|
|
105
|
+
"airHandlerVoltageL2": "",
|
|
106
|
+
"airHandlerAmperageL1": "",
|
|
107
|
+
"airHandlerAmperageL2": "",
|
|
108
|
+
"airHandlerPowerFactor": "",
|
|
109
|
+
"airHandlerPower": "",
|
|
110
|
+
"systemType": "",
|
|
111
|
+
"nominalTonnage": "",
|
|
112
|
+
"refrigerant": "",
|
|
113
|
+
"airflowNominal": "",
|
|
114
|
+
"seer": "",
|
|
115
|
+
"meteringDevice": "",
|
|
116
|
+
"atmosphericPressure": "",
|
|
117
|
+
"elevation": "",
|
|
118
|
+
"temperature": "",
|
|
119
|
+
"humidity": "",
|
|
120
|
+
"dewPoint": "",
|
|
121
|
+
"systemStability": "",
|
|
122
|
+
"capacityNominal": "",
|
|
123
|
+
"capacityNormalized": "",
|
|
124
|
+
"capacityActual": "",
|
|
125
|
+
"capacityActualNormalized": "",
|
|
126
|
+
"capacitySensible": "",
|
|
127
|
+
"capacitySensibleNormalized": "",
|
|
128
|
+
"capacityLatent": "",
|
|
129
|
+
"capacityLatentNormalized": "",
|
|
130
|
+
"sensibleHeatRatio": "",
|
|
131
|
+
"temperatureSplitTarget": "",
|
|
132
|
+
"temperatureSplit": "",
|
|
133
|
+
"dehumidification": "",
|
|
134
|
+
"dehumidificationAlternate": "",
|
|
135
|
+
"fanEfficacy": "",
|
|
136
|
+
"totalPower": "",
|
|
137
|
+
"eer": "",
|
|
138
|
+
"seerApproximate": "",
|
|
139
|
+
"sensibleEfficiency": ""
|
|
140
|
+
},
|
|
141
|
+
"toolIcons": {
|
|
142
|
+
"lowSidePressure": "",
|
|
143
|
+
"lowSideTemperature": "",
|
|
144
|
+
"highSidePressure": "",
|
|
145
|
+
"highSideTemperature": "",
|
|
146
|
+
"suctionLineTemperature": "",
|
|
147
|
+
"liquidLineTemperature": "",
|
|
148
|
+
"dischargeLineTemperature": "",
|
|
149
|
+
"outdoorAirTemperature": "",
|
|
150
|
+
"superheatTemperature": "",
|
|
151
|
+
"subcoolingTemperature": "",
|
|
152
|
+
"compressionRatio": "",
|
|
153
|
+
"condenserVoltageL1": "",
|
|
154
|
+
"condenserVoltageL2": "",
|
|
155
|
+
"condenserAmperageL1": "",
|
|
156
|
+
"condenserAmperageL2": "",
|
|
157
|
+
"condenserPowerFactor": "",
|
|
158
|
+
"condenserPower": "",
|
|
159
|
+
"returnTemperature": "",
|
|
160
|
+
"returnRelativeHumidity": "",
|
|
161
|
+
"returnWetBulbTemperature": "",
|
|
162
|
+
"supplyTemperature": "",
|
|
163
|
+
"supplyRelativeHumidity": "",
|
|
164
|
+
"supplyWetBulb": "",
|
|
165
|
+
"airflowEstimated": "",
|
|
166
|
+
"totalExternalStaticPressure": "",
|
|
167
|
+
"airHandlerVoltageL1": "",
|
|
168
|
+
"airHandlerVoltageL2": "",
|
|
169
|
+
"airHandlerAmperageL1": "",
|
|
170
|
+
"airHandlerAmperageL2": "",
|
|
171
|
+
"airHandlerPowerFactor": "",
|
|
172
|
+
"airHandlerPower": "",
|
|
173
|
+
"systemType": "",
|
|
174
|
+
"nominalTonnage": "",
|
|
175
|
+
"refrigerant": "",
|
|
176
|
+
"airflowNominal": "",
|
|
177
|
+
"seer": "",
|
|
178
|
+
"meteringDevice": "",
|
|
179
|
+
"atmosphericPressure": "",
|
|
180
|
+
"elevation": "",
|
|
181
|
+
"temperature": "",
|
|
182
|
+
"humidity": "",
|
|
183
|
+
"dewPoint": "",
|
|
184
|
+
"systemStability": "",
|
|
185
|
+
"capacityNominal": "",
|
|
186
|
+
"capacityNormalized": "",
|
|
187
|
+
"capacityActual": "",
|
|
188
|
+
"capacityActualNormalized": "",
|
|
189
|
+
"capacitySensible": "",
|
|
190
|
+
"capacitySensibleNormalized": "",
|
|
191
|
+
"capacityLatent": "",
|
|
192
|
+
"capacityLatentNormalized": "",
|
|
193
|
+
"sensibleHeatRatio": "",
|
|
194
|
+
"temperatureSplitTarget": "",
|
|
195
|
+
"temperatureSplit": "",
|
|
196
|
+
"dehumidification": "",
|
|
197
|
+
"dehumidificationAlternate": "",
|
|
198
|
+
"fanEfficacy": "",
|
|
199
|
+
"totalPower": "",
|
|
200
|
+
"eer": "",
|
|
201
|
+
"seerApproximate": "",
|
|
202
|
+
"sensibleEfficiency": ""
|
|
203
|
+
},
|
|
204
|
+
"footerData": {
|
|
205
|
+
"customerFirstName": "John"
|
|
206
|
+
"customerLastName": "Doe",
|
|
207
|
+
"customerAddressLine1": "1234 Test Avenue",
|
|
208
|
+
"customerAddressLine2": "Unit 6",
|
|
209
|
+
"customerCity": "Miami",
|
|
210
|
+
"customerState": "Florida",
|
|
211
|
+
"customerZip": "12345",
|
|
212
|
+
"customerEmail": "test@email.com",
|
|
213
|
+
"customerPhone": "123-456-7899",
|
|
214
|
+
"systemNumber": "123456789",
|
|
215
|
+
"systenName": "Test System",
|
|
216
|
+
"systemId": "9999999",
|
|
217
|
+
"systemLat": "13.24534534",
|
|
218
|
+
"systemLng": "87.34563465",
|
|
219
|
+
"systemType": "Split",
|
|
220
|
+
"systemMake": "Goodman",
|
|
221
|
+
"systemModel": "4582384532",
|
|
222
|
+
"systemSerial": "8459296520"
|
|
223
|
+
},
|
|
224
|
+
"photos": {
|
|
225
|
+
"profilePicture": "",
|
|
226
|
+
"companyLogo": "",
|
|
227
|
+
"userDocumented": {
|
|
228
|
+
"project": [
|
|
229
|
+
{
|
|
230
|
+
"tag": "Condenser",
|
|
231
|
+
"base64": ""
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"tag": "Evaporator",
|
|
235
|
+
"base64": ""
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
|
|
2
|
+
export const docOptions = {
|
|
3
|
+
orientation: "portrait",
|
|
4
|
+
unit: "in",
|
|
5
|
+
lineHeight: 1.25,
|
|
6
|
+
format: "letter"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const indoorMeasurements = {
|
|
10
|
+
"return_dry": {
|
|
11
|
+
"label": "Return Temp",
|
|
12
|
+
"units": "°F"
|
|
13
|
+
},
|
|
14
|
+
"return_rh": {
|
|
15
|
+
"label": "Return %RH"
|
|
16
|
+
},
|
|
17
|
+
"return_wet": {
|
|
18
|
+
"label": "Return Wet Bulb",
|
|
19
|
+
"units": "°F"
|
|
20
|
+
},
|
|
21
|
+
"supply_dry": {
|
|
22
|
+
"label": "Supply Temp",
|
|
23
|
+
"units": "°F"
|
|
24
|
+
},
|
|
25
|
+
"supply_rh": {
|
|
26
|
+
"label": "Supply %RH"
|
|
27
|
+
},
|
|
28
|
+
"supply_wet": {
|
|
29
|
+
"label": "Supply Wet Bulb",
|
|
30
|
+
"units": "°F"
|
|
31
|
+
},
|
|
32
|
+
"airflow_est": {
|
|
33
|
+
"label": "Airflow, Estimated",
|
|
34
|
+
"units": "SCFM"
|
|
35
|
+
},
|
|
36
|
+
"tesp": {
|
|
37
|
+
"label": "Total External Static Pres",
|
|
38
|
+
"units": "inH2O"
|
|
39
|
+
},
|
|
40
|
+
"voltage_ahu": {
|
|
41
|
+
"label": "Compression Ratio",
|
|
42
|
+
"secondaryValue": "voltage_ahu"
|
|
43
|
+
},
|
|
44
|
+
"amperage_ahu": {
|
|
45
|
+
"label": "Condenser Voltage",
|
|
46
|
+
"secondaryValue": "amperage_ahu"
|
|
47
|
+
},
|
|
48
|
+
"power_factor_ahu": {
|
|
49
|
+
"label": "Condenser Amperage"
|
|
50
|
+
},
|
|
51
|
+
"power_ahu": {
|
|
52
|
+
"label": "Condenser Power Factor",
|
|
53
|
+
"units": "W"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const outdoorMeasurements = {
|
|
58
|
+
"pressure_evaporator": {
|
|
59
|
+
"label": "Low Pressure",
|
|
60
|
+
"units": ["PSIG", "°F"],
|
|
61
|
+
"secondaryValue": "pressure_evaporator"
|
|
62
|
+
},
|
|
63
|
+
"pressure_condenser": {
|
|
64
|
+
"label": "High Pressure",
|
|
65
|
+
"units": ["PSIG", "°F"],
|
|
66
|
+
"secondaryValue": "pressure_condenser"
|
|
67
|
+
},
|
|
68
|
+
"temperature_suction_line_condenser": {
|
|
69
|
+
"label": "Suction Line Temp",
|
|
70
|
+
"units": "°F"
|
|
71
|
+
},
|
|
72
|
+
"temperature_liquid_line": {
|
|
73
|
+
"label": "Liquid Line Temp",
|
|
74
|
+
"units": "°F"
|
|
75
|
+
},
|
|
76
|
+
"temperature_discharge_line": {
|
|
77
|
+
"label": "Discharge Line Temp",
|
|
78
|
+
"units": "°F"
|
|
79
|
+
},
|
|
80
|
+
"temperature_outdoor_air": {
|
|
81
|
+
"label": "Outdoor Air Temp",
|
|
82
|
+
"units": "°F"
|
|
83
|
+
},
|
|
84
|
+
"superheat": {
|
|
85
|
+
"label": "Superheat",
|
|
86
|
+
"units": "°F"
|
|
87
|
+
},
|
|
88
|
+
"subcooling": {
|
|
89
|
+
"label": "Subcooling",
|
|
90
|
+
"units": "°F"
|
|
91
|
+
},
|
|
92
|
+
"compression_ratio": {
|
|
93
|
+
"label": "Compression Ratio"
|
|
94
|
+
},
|
|
95
|
+
"voltage_l1": {
|
|
96
|
+
"label": "Condenser Voltage",
|
|
97
|
+
"secondaryValue": "voltage_l1"
|
|
98
|
+
},
|
|
99
|
+
"amperage_l1": {
|
|
100
|
+
"label": "Condenser Amperage",
|
|
101
|
+
"secondaryValue": "amperage_l1"
|
|
102
|
+
},
|
|
103
|
+
"power_factor": {
|
|
104
|
+
"label": "Condenser Power Factor"
|
|
105
|
+
},
|
|
106
|
+
"power_condenser": {
|
|
107
|
+
"label": "Condenser Power",
|
|
108
|
+
"units": "W"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const performanceData = {
|
|
113
|
+
|
|
114
|
+
Nominal: 3.0 Tons / 36,000 Btu/h
|
|
115
|
+
Normalized: 2.9 Tons / 34,373 Btu/h
|
|
116
|
+
Actual: 0.9 Tons / 11,391 Btu/h
|
|
117
|
+
(33.1% Normalized)
|
|
118
|
+
Sensible: 0.6 Tons / 7,480 Btu/h
|
|
119
|
+
(82.3% Normalized)
|
|
120
|
+
Latent: 0.3 Tons / 3,910 Btu/h
|
|
121
|
+
(15.5% Normalized)
|
|
122
|
+
Sensible Heat Ratio: 0.66
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
Temp Split Target: 7.0°F
|
|
127
|
+
Temp Split: 8.1°F
|
|
128
|
+
Dehumidification: 3.6 lb/hr
|
|
129
|
+
0.4 gal/hr
|
|
130
|
+
Energy Efficiency:
|
|
131
|
+
Fan Efficacy: 1.16
|
|
132
|
+
Total Power: 3,587
|
|
133
|
+
EER: 3.2
|
|
134
|
+
Approx. SEER: 3.5
|
|
135
|
+
Sensible Efficiency: 82.3%
|
|
136
|
+
|
|
137
|
+
"pressure_evaporator": {
|
|
138
|
+
"label": "Low Pressure",
|
|
139
|
+
"units": ["PSIG", "°F"]
|
|
140
|
+
},
|
|
141
|
+
"pressure_condenser": {
|
|
142
|
+
"label": "High Pressure",
|
|
143
|
+
"units": ["PSIG", "°F"]
|
|
144
|
+
},
|
|
145
|
+
"temperature_suction_line_condenser": {
|
|
146
|
+
"label": "Suction Line Temp",
|
|
147
|
+
"units": "°F"
|
|
148
|
+
},
|
|
149
|
+
"temperature_liquid_line": {
|
|
150
|
+
"label": "Liquid Line Temp",
|
|
151
|
+
"units": "°F"
|
|
152
|
+
},
|
|
153
|
+
"temperature_discharge_line": {
|
|
154
|
+
"label": "Discharge Line Temp",
|
|
155
|
+
"units": "°F"
|
|
156
|
+
},
|
|
157
|
+
"temperature_outdoor_air": {
|
|
158
|
+
"label": "Outdoor Air Temp",
|
|
159
|
+
"units": "°F"
|
|
160
|
+
},
|
|
161
|
+
"superheat": {
|
|
162
|
+
"label": "Superheat",
|
|
163
|
+
"units": "°F"
|
|
164
|
+
},
|
|
165
|
+
"subcooling": {
|
|
166
|
+
"label": "Subcooling",
|
|
167
|
+
"units": "°F"
|
|
168
|
+
},
|
|
169
|
+
"compression_ratio": {
|
|
170
|
+
"label": "Compression Ratio"
|
|
171
|
+
},
|
|
172
|
+
"voltage_l1": {
|
|
173
|
+
"label": "Condenser Voltage"
|
|
174
|
+
},
|
|
175
|
+
"amperage_l1": {
|
|
176
|
+
"label": "Condenser Amperage"
|
|
177
|
+
},
|
|
178
|
+
"power_factor": {
|
|
179
|
+
"label": "Condenser Power Factor"
|
|
180
|
+
},
|
|
181
|
+
"power_condenser": {
|
|
182
|
+
"label": "Condenser Power",
|
|
183
|
+
"units": "W"
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const systemInfo = {
|
|
188
|
+
"system_type": {
|
|
189
|
+
"label": "System Type"
|
|
190
|
+
},
|
|
191
|
+
"tonnage": {
|
|
192
|
+
"label": "Nominal Tonnage"
|
|
193
|
+
},
|
|
194
|
+
"refrigerant": {
|
|
195
|
+
"label": "Refrigerant"
|
|
196
|
+
},
|
|
197
|
+
"airflow": {
|
|
198
|
+
"label": "Nom. Airflow",
|
|
199
|
+
"units": "SCFM/Ton"
|
|
200
|
+
},
|
|
201
|
+
"seer": {
|
|
202
|
+
"label": "SEER"
|
|
203
|
+
},
|
|
204
|
+
"metering_device": {
|
|
205
|
+
"label": "Metering Device"
|
|
206
|
+
},
|
|
207
|
+
"atmospheric_pressure": {
|
|
208
|
+
"label": "Atmospheric Pressure",
|
|
209
|
+
"units": "PSIA"
|
|
210
|
+
},
|
|
211
|
+
"elevation": {
|
|
212
|
+
"label": "Elevation",
|
|
213
|
+
"units": "ft"
|
|
214
|
+
},
|
|
215
|
+
"temperature": {
|
|
216
|
+
"label": "Temperature",
|
|
217
|
+
"units": "°F"
|
|
218
|
+
},
|
|
219
|
+
"humidity": {
|
|
220
|
+
"label": "Humidity",
|
|
221
|
+
"units": "%"
|
|
222
|
+
},
|
|
223
|
+
"dew_point": {
|
|
224
|
+
"label": "Dew Point",
|
|
225
|
+
"units": "°F"
|
|
226
|
+
},
|
|
227
|
+
"stability": {
|
|
228
|
+
"label": "System Stability"
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const footerData = [
|
|
233
|
+
"customerFirstName",
|
|
234
|
+
"customerLastName",
|
|
235
|
+
"customerAddressLine1",
|
|
236
|
+
"customerAddressLine2",
|
|
237
|
+
"customerCity",
|
|
238
|
+
"customerState",
|
|
239
|
+
"customerZip",
|
|
240
|
+
"customerEmail",
|
|
241
|
+
"customerPhone",
|
|
242
|
+
"systemNumber",
|
|
243
|
+
"systenName",
|
|
244
|
+
"systemId",
|
|
245
|
+
"systemLat",
|
|
246
|
+
"systemLng",
|
|
247
|
+
"systemType",
|
|
248
|
+
"systemMake",
|
|
249
|
+
"systemModel",
|
|
250
|
+
"systemSerial"
|
|
251
|
+
];
|
|
252
|
+
|
|
253
|
+
export const disclaimer = `Disclaimer: This report was prepared by your service technician who is solely responsible for its content. This report is provided “as-is” excluding all warranties expressed or implied including without limitation the warranty of merchantability. ©2017-${new Date().getFullYear()} Manifold Cloud Services Ltd.`;
|
package/index.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
|
|
2
|
+
import * as graphics from "./assets/graphics.js";
|
|
3
|
+
import * as templates from "./assets/templates.js";
|
|
4
|
+
import * as request from "./assets/request.json";
|
|
5
|
+
|
|
6
|
+
jsPDF = require("jspdf/dist/jspdf.node.min");
|
|
7
|
+
|
|
8
|
+
var doc = new jsPDF(templates.docOptions);
|
|
9
|
+
|
|
10
|
+
export function getReport(reportData) {
|
|
11
|
+
try {
|
|
12
|
+
printBoilerPlate(reportData.meta.reportTheme);
|
|
13
|
+
|
|
14
|
+
var profilePicture = reportData.meta.profilePicturePlacement == "header" ? reportData.photos.profilePicture : null;
|
|
15
|
+
var companyLogo = reportData.meta.companyLogoPlacement == "header" ? reportData.photos.companyLogo : null;
|
|
16
|
+
printHeaderData(reportData.meta.reportName, reportData.meta.techName, profilePicture, companyLogo);
|
|
17
|
+
|
|
18
|
+
printBodyData();
|
|
19
|
+
|
|
20
|
+
profilePicture = reportData.meta.profilePicturePlacement == "footer" ? reportData.photos.profilePicture : null;
|
|
21
|
+
companyLogo = reportData.meta.companyLogoPlacement == "footer" ? reportData.photos.companyLogo : null;
|
|
22
|
+
printFooterData(reportData.meta.techName, profilePicture, companyLogo);
|
|
23
|
+
|
|
24
|
+
printPhotos(reportData.photos.userDocumented);
|
|
25
|
+
|
|
26
|
+
printInfoPage(reportData.meta.reportType);
|
|
27
|
+
|
|
28
|
+
return doc.output();
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return doc.output();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function printBoilerPlate(theme) {
|
|
35
|
+
doc.addImage(graphics.headerMeasureQuick, "JPEG", 0, 0, 8.5, 1);
|
|
36
|
+
doc.addImage(graphics.companyLogoMeasureQuickLight, "JPEG", .25, 10, 2.15625, .5);
|
|
37
|
+
|
|
38
|
+
doc.setLineWidth(0.025);
|
|
39
|
+
doc.setDrawColor(0);
|
|
40
|
+
doc.setFillColor(242, 242, 242);
|
|
41
|
+
doc.rect(.125, 1.125, 2.667, 3, "F");
|
|
42
|
+
doc.rect(2.917, 1.125, 2.667, 3, "F");
|
|
43
|
+
doc.rect(5.709, 1.125, 2.667, 3, "F");
|
|
44
|
+
doc.rect(.125, 4.25, 4.0625, 3.375, "F");
|
|
45
|
+
|
|
46
|
+
doc.addImage(graphics.iconSunshine, "JPEG", .4585, 1.625, 2, 2);
|
|
47
|
+
doc.addImage(graphics.iconHouse, "JPEG", .4585, 1.625, 2, 2);
|
|
48
|
+
doc.addImage(graphics.iconInfo, "JPEG", .4585, 1.625, 2, 2);
|
|
49
|
+
doc.addImage(graphics.iconPerformance, "JPEG", .4585, 1.625, 2, 2);
|
|
50
|
+
|
|
51
|
+
doc.addImage(graphics.footerMeasureQuick, "JPEG", 0, 7.75, 8.5, 4.5);
|
|
52
|
+
|
|
53
|
+
doc.setFontSize(6.5);
|
|
54
|
+
doc.setFontStyle("bolditalic");
|
|
55
|
+
if (theme == "dark") doc.setTextColor(255, 255, 255);
|
|
56
|
+
disclaimer = doc.splitTextToSize(templates.disclaimer.toUpperCase(), 8);
|
|
57
|
+
doc.text(disclaimer, .125, 10.66);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function printHeaderData(reportName, techName, profilePicture, companyLogo) {
|
|
61
|
+
var x = 0;
|
|
62
|
+
var y = 0;
|
|
63
|
+
var w = 0;
|
|
64
|
+
var h = 0;
|
|
65
|
+
doc.text(reportName, 0.25, .75);
|
|
66
|
+
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
67
|
+
if (companyLogo) printCompanyLogo(companyLogo);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function printBodyData(geolocationMap) {
|
|
71
|
+
printSingleBodySection(templates.outdoorMeasurements, .25, 2.317, 1.55);
|
|
72
|
+
printSingleBodySection(templates.indoorMeasurements, 3.042, 5.109, 1.55);
|
|
73
|
+
printSingleBodySection(templates.systemInfo, 5.834, 7.9, 1.55);
|
|
74
|
+
printSingleBodySection(templates.performanceData, .25, 2, 4.455);
|
|
75
|
+
printMap(geolocationMap);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function printSingleBodySection(dataPoints, xLeft, xRight, y) {
|
|
79
|
+
var s = .2;
|
|
80
|
+
var dataPoint;
|
|
81
|
+
var val;
|
|
82
|
+
var units;
|
|
83
|
+
var text;
|
|
84
|
+
for (let key in dataPoints) {
|
|
85
|
+
dataPoint = dataPoints[key];
|
|
86
|
+
val = reportData.values[key];
|
|
87
|
+
units = Array.isArray(dataPoint.units) ? `${dataPoint.units[0]} / ${dataPoint.units[1]}` : dataPoint.units;
|
|
88
|
+
text = dataPoint.hasOwnProperty("secondaryValue") ? `${val} / ${reportData.values[dataPoint.secondaryValue]}` : val;
|
|
89
|
+
doc.text(`${dataPoint.label} (${units}):`, xLeft, y);
|
|
90
|
+
doc.text(val, alignRight(val, xRight, 8), y);
|
|
91
|
+
doc.addImage(reportData.rangeIcons[key], "JPEG", xRight, y, .2, .2);
|
|
92
|
+
doc.addImage(reportData.toolIcons[key], "JPEG", xRight, y, .2, .2);
|
|
93
|
+
y += s;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function printMap(geolocationMap) {
|
|
98
|
+
doc.addImage(geolocationMap, "JPEG", 4.3125, 4.25, 4.0625, 3.375);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function printProfilePicture(techName, profilePicture) {
|
|
102
|
+
var x = 0;
|
|
103
|
+
var y = 0;
|
|
104
|
+
var w = 0;
|
|
105
|
+
var h = 0;
|
|
106
|
+
doc.addImage(profilePicture, "JPEG", x, y, w, h);
|
|
107
|
+
doc.text(techName, x, y, w, h);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function printCompanyLogo(companyLogo) {
|
|
111
|
+
var x = 0;
|
|
112
|
+
var y = 0;
|
|
113
|
+
var w = 0;
|
|
114
|
+
var h = 0;
|
|
115
|
+
doc.addImage(companyLogo, "JPEG", x, y, w, h);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function printFooterData(techName, profilePicture, companyLogo) {
|
|
119
|
+
var x = 0;
|
|
120
|
+
var y = 0;
|
|
121
|
+
var w = 0;
|
|
122
|
+
var h = 0;
|
|
123
|
+
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
124
|
+
if (companyLogo) printCompanyLogo(companyLogo);
|
|
125
|
+
|
|
126
|
+
var s = .2;
|
|
127
|
+
var x = 0;
|
|
128
|
+
var y = 0;
|
|
129
|
+
templates.footerData.forEach(key => {
|
|
130
|
+
doc.text(reportData.values[key], x, y);
|
|
131
|
+
y += s;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function printPhotos(photoArray) {
|
|
136
|
+
for (let photo in photoArray) {
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function printInfoPage(reportType) {
|
|
142
|
+
// doc.addPage();
|
|
143
|
+
if (reportType == "cooling") {
|
|
144
|
+
// Print info page on cooling subsystem diagnostics
|
|
145
|
+
} else if (reportType == "heating") {
|
|
146
|
+
// Print info page on heating subsystem diagnostics
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function alignRight(text, rightAlign, fontSize) {
|
|
151
|
+
return rightAlign - doc.getStringUnitWidth(text) * fontSize / 72;
|
|
152
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@measurequick/measurequick-report-generator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generates PDF documents for various MeasureQuick applications.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"jspdf": "^1.3.5"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"measurequick"
|
|
14
|
+
],
|
|
15
|
+
"author": "MeasureQuick",
|
|
16
|
+
"license": "ISC"
|
|
17
|
+
}
|