diff --git a/FrontendWebApi/ApiControllers/TenantBillController.cs b/FrontendWebApi/ApiControllers/TenantBillController.cs index f98ef55..c5e1593 100644 --- a/FrontendWebApi/ApiControllers/TenantBillController.cs +++ b/FrontendWebApi/ApiControllers/TenantBillController.cs @@ -314,16 +314,14 @@ namespace FrontendWebApi.ApiControllers string checkDataSql = $@"(SELECT sum(sub_result) FROM ( {month} ) combined_result - WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' - GROUP BY device_number) "; + WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') "; var existData = await backendRepository.GetAllAsync(checkDataSql); if (existData.Count != 0) { - result = $@"(SELECT sum(sub_result) + result = $@"(SELECT ROUND(sum(sub_result)) FROM ( {month} ) combined_result - WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' - GROUP BY device_number) "; + WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') "; } sqlString = $@"UPDATE {TenantBilltable} @@ -416,6 +414,7 @@ namespace FrontendWebApi.ApiControllers { t.start_timestamp = tb.start_timestamp; t.end_timestamp = tb.end_timestamp; + t.tableType = t.device_name_tag == "E4" ? "elec": "water"; await UpdateTenantBill(t); } }