public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { String tmpPrevKey = prevEntityId; int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); ArrayList keepTotal1 = copyTotalArray(entitySums); ArrayList keepTotal2 = copyTotalArray(sums); CRow r = (CRow)rowdef["DATA_LEVEL1"]; CRow nr = r.Clone(); String dt = o.GetFieldValue("DOCUMENT_TYPE"); double amt = CUtil.StringToDouble(o.GetFieldValue("AR_AP_AMT")); o.SetFieldValue("AR_AP_AMT_TEMP", amt.ToString()); if (dt.Equals("3") || dt.Equals("7")) { //Apply Abs() to prevent sign toggling if start new page amt = (-1) * amt; o.SetFieldValue("AR_AP_AMT_TEMP", amt.ToString()); } o.SetFieldValue("DOCUMENT_TYPE_NAME", CUtil.DocumentTypeToText(dt)); double newh = AvailableSpace - nr.GetHeight(); if (newh > 0) { String entityId = o.GetFieldValue(getGroupKey()); if (row == 0) { prevEntityId = entityId; double h = addNewDataRow(rowdef, rpp, "DATA_LEVEL0", "L0", row, o); newh = newh - h; } if (!entityId.Equals(prevEntityId)) { prevEntityId = entityId; double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", entitySums); newh = newh - h; //Reset entitySums = new ArrayList(); h = addNewDataRow(rowdef, rpp, "DATA_LEVEL0", "L0", row, o); newh = newh - h; } ArrayList temps = getColumnDataTexts("L1", row + 1, o); nr.FillColumnsText(temps); rpp.AddReportRow(nr); sums = sumDataTexts("L1", sums, temps); entitySums = sumDataTexts("L1", entitySums, temps); if (row == rowcount - 1) { double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", entitySums); newh = newh - h; h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums); newh = newh - h; } } if (newh < 1) { rpp.IsNewPageRequired = true; //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว entitySums = keepTotal1; sums = keepTotal2; prevEntityId = tmpPrevKey; } else { AvailableSpace = newh; } return(rpp); }