构建动态列
金蝶云社区-云社区用户A5bW2948
云社区用户A5bW2948
2人赞赏了该文章 1,653次浏览 未经作者许可,禁止转载编辑于2017年11月17日 10:44:50

protected ReportHeader BuildRptHeader(IRptParams filter)
{
ReportHeader header = new ReportHeader();
StringBuilder sb = new StringBuilder();

sb.AppendLine("/*dialect*/");
sb.AppendLine(string.Format(" SELECT DISTINCT FNAME AS FNAME FROM T_DLD_FEEOBJECT_L WHERE FLocaleID = {0} ", base.Context.UserLocale.LCID.ToString()));
sb.AppendLine(" UNION ALL ");
sb.AppendLine(" SELECT '合计' AS FNAME ");
this.canViewAmount = this.IsCanViewAmount("e_DLD_StockSettlementRpt");

header.AddChild("FYEAR", new LocaleValue(ResManager.LoadKDString("年", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FMONTH", new LocaleValue(ResManager.LoadKDString("月", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FINSTOCKBILLNO", new LocaleValue(ResManager.LoadKDString("入库单编号", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FOUTSTOCKBILLNO", new LocaleValue(ResManager.LoadKDString("出库单编号", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FSUPPLIERID", new LocaleValue(ResManager.LoadKDString("供应商", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FMATERIALNO", new LocaleValue(ResManager.LoadKDString("物料编码", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FMATERIALID", new LocaleValue(ResManager.LoadKDString("物料名称", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FSTOCKID", new LocaleValue(ResManager.LoadKDString("仓库", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FBASEUNITQTY", new LocaleValue(ResManager.LoadKDString("基本单位数量", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FRECDATE", new LocaleValue(ResManager.LoadKDString("入库日期", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FOUTDATE", new LocaleValue(ResManager.LoadKDString("出库日期", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID));
header.AddChild("FZKTS", new LocaleValue(ResManager.LoadKDString("在库天数", "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID), SqlStorageType.SqlInt, true);

DataTable dt = DBUtils.ExecuteDataSet(this.Context, sb.ToString()).Tables[0];
foreach (DataRow dr in dt.Rows)
{
header.AddChild(dr["FNAME"].ToString(), new LocaleValue(ResManager.LoadKDString(dr["FNAME"].ToString(), "016053000000034", SubSystemType.CY, new object[0]), this.Context.UserLocale.LCID), SqlStorageType.SqlMoney, true);
}

return header;
}