private int filldata(DataTable data, string groupname, long rackID, string showmonth, string strBegin, string strEnd, string device_id, string portid, int BillrateType, float Bill_1rate, float Bill_2rate1, float Bill_2rate2, ref double totalKWH, ref double totalFee) { string text = ""; RackInfo rackInfo = null; if (rackID > 0L) { rackInfo = RackInfo.getRackByID(rackID); text = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); } float voltage = DeviceOperation.GetVoltage(device_id, portid); string text2 = "N/A"; string text3 = "N/A"; if ((double)voltage > 0.01) { text2 = voltage.ToString("F2") + "V"; } System.Collections.Generic.List <BillReportInfo> billReportInfo = DBTools.GetBillReportInfo(strBegin, strEnd, device_id, portid); double num = 0.0; double num2 = 0.0; foreach (BillReportInfo current in billReportInfo) { double num3 = (double)current.KWH / 10000.0; double num4 = num3 / (double)current.TIMESPAN_HOUR; if ((double)voltage > 0.01) { text3 = (num4 * 1000.0 / (double)voltage).ToString("F2") + "A"; } if (BillrateType == 0) { float num5 = Bill_1rate; double num6 = num3 * (double)num5; num2 += num6; totalFee += num6; totalKWH += num3; if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } } else { float num5; double num6; string msg; if (current.PERIOD.Equals("PEAK")) { msg = EcoLanguage.getMsg(LangRes.Rpt_BillPEAK, new string[0]); num5 = Bill_2rate1; num6 = num3 * (double)num5; num2 += num6; totalFee += num6; } else { msg = EcoLanguage.getMsg(LangRes.Rpt_BillnonPEAK, new string[0]); num5 = Bill_2rate2; num6 = num3 * (double)num5; num2 += num6; totalFee += num6; } num += num3; totalKWH += num3; if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, msg, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, msg, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } } groupname = ""; showmonth = ""; text = ""; } if (BillrateType == 1 && billReportInfo.Count > 0) { string msg = EcoLanguage.getMsg(LangRes.Rpt_BillALL, new string[0]); if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, msg, "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, msg, "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } } if (billReportInfo.Count > 0) { return(1); } return(0); }