報表查詢: 修正報表不顯示問題(資料有null,加判斷)

This commit is contained in:
wanling040@gmail.com 2022-08-11 18:25:44 +08:00
parent bc33b47ce1
commit 71a0be260f

View File

@ -1024,12 +1024,12 @@
sta += "<td>" + toThousands(Number(inverter[i]).toFixed(2)) + "</td>";
}
});
sta += "<td>" + toThousands(Number(inverter.hourKWH).toFixed(2)) + "</td>";
sta += "<td>" + toThousands(Number(inverter.hourKWHp).toFixed(2)) + "</td>";
sta += "<td>" + toThousands(Number(inverter.irrDayHour).toFixed(2)) + "</td>"; // body 小時平均日照度 irradiance
sta += "<td>" + toThousands(Number(inverter.temperature).toFixed(2)) + "</td>"; //body 小時平均模組溫度
sta += "<td>" + ((inverter.hourKWH == null) ? 0 : toThousands(Number(inverter.hourKWH).toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.hourKWHp == null) ? 0 : toThousands(Number(inverter.hourKWHp).toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.irrDayHour == null) ? 0 : toThousands(Number(inverter.irrDayHour).toFixed(2))) + "</td>"; // body 小時平均日照度 irradiance
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(Number(inverter.temperature).toFixed(2))) + "</td>";//body 小時平均模組溫度
if (showmoney == 1) {
sta += "<td>" + toThousands((Number(inverter.hourmoney).toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.hourmoney == null) ? 0 : toThousands(Number(inverter.hourmoney).toFixed(2))) + "</td>";
}
sta += "</tr>";
if (index < rel.data.length - 1) {
@ -1100,15 +1100,15 @@
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
}
});
sta += "<td>" + toThousands(inverter.dayKWH.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
sta += "<td>" + inverter.tothour.toFixed(2) + "</td>";
sta += "<td>" + toThousands(inverter.KWHKWP.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + "</td>";
sta += "<td>" + inverter.temperature.toFixed(2) + "</td>";
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
if (showmoney == 1) {
sta += "<td>" + toThousands(inverter.soldmoney.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
}
sta += "</tr>";
if (index < rel.data.length - 1) {
@ -1236,15 +1236,15 @@
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
}
});
sta += "<td>" + toThousands(inverter.dayKWH.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.dayKWHp.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.tothour.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.KWHKWP.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.PR.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.irradiance.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.temperature.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.irradiance == null) ? 0 : toThousands(inverter.irradiance.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
if (showmoney == 1) {
sta += "<td>" + toThousands(inverter.soldmoney.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
}
sta += "</tr>";
avghour += inverter.tothour ? inverter.tothour : 0;
@ -1370,15 +1370,15 @@
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
}
});
sta += "<td>" + toThousands(inverter.dayKWH.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
sta += "<td>" + toThousands(inverter.tothour.toFixed(2)) + "</td>";
sta += "<td>" + toThousands(inverter.KWHKWP.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + "</td>";
sta += "<td>" + toThousands(inverter.temperature.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
if (showmoney == 1) {
sta += "<td>" + toThousands(inverter.soldmoney.toFixed(2)) + "</td>";
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
}
sta += "</tr>";
avghour += inverter.tothour ? inverter.tothour : 0;