汇总表的关键代码 :
public override void Initialize()
{
base.Initialize();
this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
this.ReportProperty.IsGroupSummary = true;
this.ReportProperty.DetailReportId = "PBNI_StoreAgeDetail";
#region 精度控制
this.ReportProperty.DecimalControlFieldList = ReportCommon.GetDecimalControlList("FAMOUNTDIGITS", decimalControl);
#endregion
}
明细表的关键代码:
public override void Initialize()
{
base.Initialize();
#region 精度控制
this.ReportProperty.DecimalControlFieldList = ReportCommon.GetDecimalControlList("FAMOUNTDIGITS", decimalControl);
#endregion
}
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
base.BuilderReportSqlAndTempTable(filter, tableName);
tempTableName = tableName;
tempTables.Add(tableName);
using (new SessionScope())
{
StringBuilder sSQL = new StringBuilder();
StringBuilder sql = new StringBuilder();
StringBuilder where = new StringBuilder();
sql.Append(@"/dialect/ ");
bool srcFilter = false;
Dictionary<string, object> dctCurrRow = new Dictionary<string, object>();
if (!filter.IsRefresh && filter.CustomParams.Count() > 1 && filter.CustomParams.ContainsKey("ParentReportFilter"))
{
dctCurrRow = (Dictionary<string, object>)filter.CustomParams["ParentReportCurrentRow"];
srcFilter = true;
}
if (srcFilter)
{
if (dctCurrRow.ContainsKey("FBEGINDATE") && dctCurrRow["FBEGINDATE"] != null && !string.IsNullOrEmpty(dctCurrRow["FBEGINDATE"].ToString()))
{
where.AppendFormat(" and cardMsg.FOPENDATE>='{0}' ", dctCurrRow["FBEGINDATE"].ToString());
}
if (dctCurrRow.ContainsKey("FENDDATE") && dctCurrRow["FENDDATE"] != null && !string.IsNullOrEmpty(dctCurrRow["FENDDATE"].ToString()))
{
where.AppendFormat(" and cardMsg.FOPENDATE<'{0}' ", dctCurrRow["FENDDATE"].ToString());
}
if (dctCurrRow.ContainsKey("FCARDCLASS") && dctCurrRow["FCARDCLASS"] != null && !string.IsNullOrEmpty(dctCurrRow["FCARDCLASS"].ToString()))
{
where.AppendFormat(" and kll.FNAME='{0}' ", dctCurrRow["FCARDCLASS"].ToString());
}
if (dctCurrRow.ContainsKey("FCARDTYPE") && dctCurrRow["FCARDTYPE"] != null && !string.IsNullOrEmpty(dctCurrRow["FCARDTYPE"].ToString()))
{
where.AppendFormat(" and cypt.FDATAVALUE='{0}' ", dctCurrRow["FCARDTYPE"].ToString());
}
}
var baseObjs = DBUtils.ExecuteDynamicObject(this.Context, string.Format(sql.ToString(), where));
sSQL.AppendLine("select * ,2 FAMOUNTDIGITS,{0} into {1} from #temp ");
sSQL.AppendLine("drop table #temp ");
KSQL_SEQ = string.Format(KSQL_SEQ, " FCARDNUMBER asc ");
string SQL = string.Format(sSQL.ToString(), this.KSQL_SEQ, tableName);
DBUtils.Execute(this.Context, SQL.ToString());
}
}
转载于:https://blog.51cto.com/yataigp/2108720