本文描述了在开发现金流量表时遇到的问题及解决方案。开发者发现后台SQL查询中的临时表名称频繁变动,因此采用新方法处理,包括自定义过滤条件、创建新表和存储过程来存储和运算数据。文中展示了相关C#代码,包括初始化设置、获取过滤条件信息、定义报表头部结构等,还包含了一个私有方法用于获取组织名称。代码使用了Kingdee BOS平台的多个类和接口进行数据库查询和数据处理。
在做一个有关现金流量表的开发,去后台追sql语句发现临时表名称总是变动,所以找到了这样的一个新方法。过滤条件框用的系统标准的也可以自己画一个新的,用标准的话需要自己在代码中把列加上,要不什么数据都没有,我自己就在这里出问题了。我自己创建了一个表和一个存储过程,用于储存过程的数据并加以运算最后展现。好了罗嗦了这么多不如直接上代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS.JSON;
using Kingdee.BOS.WebApi.ServicesStub;
using Kingdee.BOS.ServiceFacade.KDServiceFx;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Core.ReportFilter;
using Kingdee.BOS.Model.CommonFilter;
using Kingdee.BOS.Model.ReportFilter;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.ServiceFacade;
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Data;
using Kingdee.BOS.Util;
public class XJLLBReport : SysReportBaseService
{
//初始化
public override void Initialize()
{
base.Initialize();
// 简单账表类型:普通、树形、分页
this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
this.IsCreateTempTableByPlugin = true;
//是否分组汇总
this.ReportProperty.IsGroupSummary = true;
}
//获取过滤条件信息(构造单据信息)
public override ReportTitles GetReportTitles(IRptParams filter)
{
ReportTitles reportTitles = new ReportTitles();
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
if (customFilter != null)
{
if (filter.FilterParameter.CustomFilter["FINDTYPE"].ToString() == "0")
{
DynamicObject zz = customFilter["ACCTBOOKID"] as DynamicObject;
string zzmc = zz["Name"].ToString();
string F_BJYC_StartYear = (customFilter["STARTYEAR"] == null) ? string.Empty : customFilter["STARTYEAR"].ToString();
string F_BJYC_StartPeriod = (customFilter["STARTPERIOD"] == null) ? string.Empty : customFilter["STARTPERIOD"].ToString();
string F_BJYC_EndYear = (customFilter["ENDYEAR"] == null) ? string.Empty : customFilter["ENDYEAR"].ToString();
string F_BJYC_EndPeriod = (customFilter["ENDPERIOD"] == null) ? string.Empty : customFilter["ENDPERIOD"].ToString();
reportTitles.AddTitle("F_BJYC_ORG", zzmc);
reportTitles.AddTitle("F_BJYC_StartYear", F_BJYC_StartYear);
reportTitles.AddTitle("F_BJYC_StartPeriod", F_BJYC_StartPeriod);
reportTitles.AddTitle("F_BJYC_EndYear", F_BJYC_EndYear);
reportTitles.AddTitle("F_BJYC_EndPeriod", F_BJYC_EndPeriod);
}
else
{
DynamicObject zz = customFilter["ACCTBOOKID"] as DynamicObject;
string zzmc = zz["Name"].ToString();
string F_BJYC_StartDate = (customFilter["STARTDATE"] == null) ? string.Empty : customFilter["STARTDATE"].ToString();
string F_BJYC_EndDate = (customFilter["ENDDATE"] == null) ? string.Empty : customFilter["ENDDATE"].ToString();
reportTitles.AddTitle("F_BJYC_ORG", zzmc);
reportTitles.AddTitle("F_BJYC_StartDate", F_BJYC_StartDate.Substring(0, 10));
reportTitles.AddTitle("F_BJYC_EndDate", F_BJYC_EndDate.Substring(0, 10));
}
}
return reportTitles;
}
public override ReportHeader GetReportHeaders(IRptParams filter)
{
// FID, FEntryId, 编号、状态、物料、数量、单位、单位精度、单价、价税合计
ReportHeader header = new ReportHeader();
// 编号
var status = header.AddChild("F_BJYC_Date", new LocaleValue("日期"));
status.ColIndex = 0;
var billNo = header.AddChild("F_BJYC_OrgName", new LocaleValue("组织"));
billNo.ColIndex = 1;
var q = header.AddChild("F_BJYC_XSSP", new LocaleValue("流入&销售商品、提供劳务流入"));
q.ColIndex = 2;
var qw = header.AddChild("F_BJYC_QTJYLR", new LocaleValue("流入&其他经营流入"));
qw.ColIndex = 3;
var qwe = header.AddChild("F_BJYC_TZCZLR", new LocaleValue("流入&投资筹资流入"));
qwe.ColIndex = 4;
var qwer = header.AddChild("F_BJYC_CGK", new LocaleValue("流出&采购款"));
qwer.ColIndex = 5;
var ery = header.AddChild("F_BJYC_ZJGC", new LocaleValue("流出&在建工程、固定资产、无形资产"));
ery.ColIndex = 6;
var yh = header.AddChild("F_BJYC_RYCB", new LocaleValue("流出&人员成本"));
yh.ColIndex = 7;
var dc = header.AddChild("F_BJYC_SF", new LocaleValue("流出&税费"));
dc.ColIndex = 8;
var vb = header.AddChild("F_BJYC_ZXFW", new LocaleValue("流出&咨询服务、业务宣传、市场推广费"));
vb.ColIndex = 9;
var nm = header.AddChild("F_BJYC_QTJYLC", new LocaleValue("流出&其他经营流出"));
nm.ColIndex = 10;
var io = header.AddChild("F_BJYC_QTTZCZLC", new LocaleValue("流出&其他投资筹资流出"));
io.ColIndex = 11;
var op = header.AddChild("F_BJYC_YE", new LocaleValue("余额"));
op.ColIndex = 12;
var az = header.AddChild("F_BJYC_YSZKYE", new LocaleValue("应收账款余额"));
az.ColIndex = 13;
var sv = header.AddChild("F_BJYC_YYSR", new LocaleValue("营业收入"));
sv.ColIndex = 14;
return header;
}
//组织名称
private string GetMultiOrgnNameValues(string orgIdStrings)
{
List<string> list = new List<string>();
string result = string.Empty;
if (orgIdStrings.Trim().Length > 0)
{
IQueryService service = Kingdee.BOS.Contracts.ServiceFactory.GetService<IQueryService>(base.Context);
QueryBuilderParemeter para = new QueryBuilderParemeter
{
FormId = "ORG_Organizations",
SelectItems = SelectorItemInfo.CreateItems("FNAME"),
FilterClauseWihtKey = string.Format(" FORGID IN ({0}) AND FLOCALEID={1}", orgIdStrings, base.Context.UserLocale.LCID)
};
DynamicObjectCollection dynamicObjectCollection = service.GetDynamicObjectCollection(base.Context, para, null);
foreach (DynamicObject current in dynamicObjectCollection)
{
//list.Add(current["FNAME"].ToString());
result = result + ",'" + current["FNAME"].ToString() + "'";
}
if (result.Length > 0)
{
//result = string.Join(",", list.ToArray());
result = result.Substring(1, result.Length - 1);
}
}
return result;
}
//基础资料名称
private string GetBaseDataNameValue(DynamicObjectCollection dyobj)
{
string name = "";
foreach (DynamicObject dynbj in dyobj)
{
if (dynbj != null || !dynbj.DynamicObjectType.Properties.Contains("Name"))
{
DynamicObject dynbj2 = (DynamicObject)dynbj[2];
name = name + ",'" + dynbj2["Name"].ToString() + "'";
}
}
if (name.Length > 0)
{
name = name.Substring(1, name.Length - 1);
}
return name;
}
//创建临时报表
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
string seqFld = string.Format(base.KSQL_SEQ, OrderColumn(filter));
if (filter.FilterParameter.CustomFilter["FINDTYPE"].ToString() == "0")//期间
{
ISysReportService sysReporSservice = ServiceFactory.GetSysReportService(this.Context);
IPermissionService permissionService = ServiceFactory.GetPermissionService(this.Context);
var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(this.Context);//加载字段比较条件元数据。
var reportMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_Rpt_CashFlow");//加载现金流量表分析表元数据。
var reportFilterMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_Rpt_CashFlowFilter");//加载现金流量表过滤条件元数据。
var reportFilterServiceProvider = reportFilterMetadata.BusinessInfo.GetForm().GetFormServiceProvider();
var model = new SysReportFilterModel();
model.SetContext(this.Context, reportFilterMetadata.BusinessInfo, reportFilterServiceProvider);
model.FormId = reportFilterMetadata.BusinessInfo.GetForm().Id;
model.FilterObject.FilterMetaData = filterMetadata;
model.InitFieldList(reportMetadata, reportFilterMetadata);
model.GetSchemeList();
var entity = model.Load("8a8f732878ea45aa9939b2f444ce2eea");//这里要写用默认的过滤方案的主键值,可通过该SQL语句查询得到:SELECT * FROM T_BAS_FILTERSCHEME
var filter2 = model.GetFilterParameter();
IRptParams p = new RptParams();
p.FormId = reportFilterMetadata.BusinessInfo.GetForm().Id;
p.StartRow = 1;
p.EndRow = int.MaxValue;//StartRow和EndRow是报表数据分页的起始行数和截至行数,一般取所有数据,所以EndRow取int最大值。
p.FilterParameter = filter.FilterParameter;//根据自己的情况,改过滤条件的内容
p.FilterFieldInfo = model.FilterFieldInfo;
string delete = "/*dialect*/delete from xjllb";
DBUtils.ExecuteDataSet(this.Context, delete);
DynamicObject zz = filter.FilterParameter.CustomFilter["ACCTBOOKID"] as DynamicObject;
string zzmc = zz["Name"].ToString();
p.BaseDataTempTable.AddRange(permissionService.GetBaseDataTempTable(this.Context, reportMetadata.BusinessInfo.GetForm().Id));
using (DataTable dt = sysReporSservice.GetData(this.Context, reportMetadata.BusinessInfo, p))
{
DataRowCollection rowColl = dt.Rows;
//dt就是报表数据,接下来就是你发挥的时间。
decimal xssp = 0;
decimal qtjylr = 0;
decimal tzczlr = 0;
decimal cgk = 0;
decimal zjgc = 0;
decimal rycb = 0;
decimal sf = 0;
decimal zxfw = 0;
decimal qtjylc = 0;
decimal qttzczlc = 0;
decimal ye = 0;
decimal yszkye = 0;
decimal yysr = 0;
foreach (DataRow row in rowColl)
{
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_销售商品、提供劳务收到的现金")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_开展医疗服务活动收到的现金(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_省市医保中心新农合回款(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到病人预交款(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到的税费返还")
{
qtjylr = qtjylr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到其他与经营活动有关的现金")
{
qtjylr = qtjylr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流入小计")
{
tzczlr = tzczlr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "筹资活动产生的现金流量_现金流入小计")
{
tzczlr = tzczlr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买商品、接受劳务支付的现金")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买药品支付的现金(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买卫生材料支付的现金(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_退病人预交款(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出_购建固定资产、无形资产和其他长期资产支付的现金")
{
zjgc = zjgc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付给职工以及为职工支付的现金")
{
rycb = rycb + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付的各项税费")
{
sf = sf + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_咨询服务费")
{
zxfw = zxfw + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_业务宣传、市场推广费")
{
zxfw = zxfw + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金")
{
qtjylc = qtjylc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_咨询服务费")
{
qtjylc = qtjylc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_业务宣传、市场推广费")
{
qtjylc = qtjylc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出小计")
{
qttzczlc = qttzczlc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出_购建固定资产、无形资产和其他长期资产支付的现金")
{
qttzczlc = qttzczlc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "筹资活动产生的现金流量_现金流出小计")
{
qttzczlc = qttzczlc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "期末现金及现金等价物余额")
{
ye = ye + Convert.ToDecimal(row.ItemArray[6].ToString());
}
}
//插入期间的数据
string insert = "/*dialect*/insert into xjllb(F_BJYC_Date,F_BJYC_OrgName,F_BJYC_XSSP,F_BJYC_QTJYLR,F_BJYC_TZCZLR,F_BJYC_CGK,F_BJYC_ZJGC,F_BJYC_RYCB,F_BJYC_SF,F_BJYC_ZXFW,F_BJYC_QTJYLC,F_BJYC_QTTZCZLC,F_BJYC_YE,F_BJYC_YSZKYE,F_BJYC_YYSR)values('" + filter.FilterParameter.CustomFilter["STARTYEAR"].ToString() + "年" + filter.FilterParameter.CustomFilter["STARTPERIOD"].ToString() + "月至" + filter.FilterParameter.CustomFilter["ENDYEAR"].ToString() + "年" + filter.FilterParameter.CustomFilter["ENDPERIOD"].ToString()+"月" + "','" + zzmc + "','" + xssp + "','" + qtjylr + "','" + tzczlr + "','" + cgk + "','" + zjgc + "','" + rycb + "','" + sf + "','" + zxfw + "','" + qtjylc + "','" + qttzczlc + "','" + ye + "','" + yszkye + "','" + yysr + "')";
DBUtils.ExecuteDataSet(this.Context, insert);
}
ServiceFactory.CloseService(sysReporSservice);
ServiceFactory.CloseService(permissionService);
string sql = string.Format(@"/*dialect*/exec spyc_ybx_xjllb '{0}','{1}' ", tableName,"期间");
DBUtils.ExecuteDynamicObject(this.Context, sql);
}
else//日期
{
ISysReportService sysReporSservice = ServiceFactory.GetSysReportService(this.Context);
IPermissionService permissionService = ServiceFactory.GetPermissionService(this.Context);
var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(this.Context);//加载字段比较条件元数据。
var reportMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_Rpt_CashFlow");//加载应收款账龄分析表元数据。
var reportFilterMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, "GL_Rpt_CashFlowFilter");//加载应收款账龄分析表过滤条件元数据。
var reportFilterServiceProvider = reportFilterMetadata.BusinessInfo.GetForm().GetFormServiceProvider();
var model = new SysReportFilterModel();
model.SetContext(this.Context, reportFilterMetadata.BusinessInfo, reportFilterServiceProvider);
model.FormId = reportFilterMetadata.BusinessInfo.GetForm().Id;
model.FilterObject.FilterMetaData = filterMetadata;
model.InitFieldList(reportMetadata, reportFilterMetadata);
model.GetSchemeList();
var entity = model.Load("8a8f732878ea45aa9939b2f444ce2eea");//过滤方案的主键值,可通过该SQL语句查询得到:SELECT * FROM T_BAS_FILTERSCHEME
var filter2 = model.GetFilterParameter();
IRptParams p = new RptParams();
p.FormId = reportFilterMetadata.BusinessInfo.GetForm().Id;
p.StartRow = 1;
p.EndRow = int.MaxValue;//StartRow和EndRow是报表数据分页的起始行数和截至行数,一般取所有数据,所以EndRow取int最大值。
DateTime starttime = Convert.ToDateTime(filter.FilterParameter.CustomFilter["STARTDATE"]);
DateTime endtime = Convert.ToDateTime(filter.FilterParameter.CustomFilter["ENDDATE"]);
string delete = "/*dialect*/delete from xjllb";
DBUtils.ExecuteDataSet(this.Context,delete);
DynamicObject zz = filter.FilterParameter.CustomFilter["ACCTBOOKID"] as DynamicObject;
string zzmc = zz["Name"].ToString();
for (; starttime.CompareTo(endtime) <= 0; starttime = starttime.AddDays(1))
{
p.FilterParameter = filter.FilterParameter;
p.FilterParameter.CustomFilter["ENDDATE"] = starttime;
p.FilterFieldInfo = model.FilterFieldInfo;
p.BaseDataTempTable.AddRange(permissionService.GetBaseDataTempTable(this.Context, reportMetadata.BusinessInfo.GetForm().Id));
using (DataTable dt = sysReporSservice.GetData(this.Context, reportMetadata.BusinessInfo, p))
{
DataRowCollection rowColl = dt.Rows;
//dt就是报表数据,接下来就是你发挥的时间。
int k = 0;
decimal xssp = 0;
decimal qtjylr = 0;
decimal tzczlr = 0;
decimal cgk = 0;
decimal zjgc = 0;
decimal rycb = 0;
decimal sf = 0;
decimal zxfw = 0;
decimal qtjylc = 0;
decimal qttzczlc = 0;
decimal ye = 0;
decimal yszkye = 0;
decimal yysr = 0;
foreach (DataRow row in rowColl)
{
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_销售商品、提供劳务收到的现金")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_开展医疗服务活动收到的现金(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_省市医保中心新农合回款(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到病人预交款(医院专用)")
{
xssp = xssp + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到的税费返还")
{
qtjylr = qtjylr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流入_收到其他与经营活动有关的现金")
{
qtjylr = qtjylr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流入小计")
{
tzczlr = tzczlr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "筹资活动产生的现金流量_现金流入小计")
{
tzczlr = tzczlr + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买商品、接受劳务支付的现金")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买药品支付的现金(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_购买卫生材料支付的现金(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_退病人预交款(医院专用)")
{
cgk = cgk + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出_购建固定资产、无形资产和其他长期资产支付的现金")
{
zjgc = zjgc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付给职工以及为职工支付的现金")
{
rycb = rycb + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付的各项税费")
{
sf = sf + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_咨询服务费")
{
zxfw = zxfw + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_业务宣传、市场推广费")
{
zxfw = zxfw + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金")
{
qtjylc = qtjylc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_咨询服务费")
{
qtjylc = qtjylc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "经营活动产生的现金流量_现金流出_支付其他与经营活动有关的现金_业务宣传、市场推广费")
{
qtjylc = qtjylc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出小计")
{
qttzczlc = qttzczlc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "投资活动产生的现金流量_现金流出_购建固定资产、无形资产和其他长期资产支付的现金")
{
qttzczlc = qttzczlc - Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "筹资活动产生的现金流量_现金流出小计")
{
qttzczlc = qttzczlc + Convert.ToDecimal(row.ItemArray[6].ToString());
}
if (row.ItemArray[3].ToString() == "期末现金及现金等价物余额")
{
ye = ye + Convert.ToDecimal(row.ItemArray[6].ToString());
}
}
//插入每天的数据
string insert = "/*dialect*/insert into xjllb(F_BJYC_Date,F_BJYC_OrgName,F_BJYC_XSSP,F_BJYC_QTJYLR,F_BJYC_TZCZLR,F_BJYC_CGK,F_BJYC_ZJGC,F_BJYC_RYCB,F_BJYC_SF,F_BJYC_ZXFW,F_BJYC_QTJYLC,F_BJYC_QTTZCZLC,F_BJYC_YE,F_BJYC_YSZKYE,F_BJYC_YYSR)values('" + starttime + "','" + zzmc + "','" + xssp + "','" + qtjylr + "','" + tzczlr + "','" + cgk + "','" + zjgc + "','" + rycb + "','" + sf + "','" + zxfw + "','" + qtjylc + "','" + qttzczlc + "','" + ye + "','" + yszkye + "','" + yysr + "')";
DBUtils.ExecuteDataSet(this.Context, insert);
}
ServiceFactory.CloseService(sysReporSservice);
ServiceFactory.CloseService(permissionService);
}
//所有数据都插入到xjllb
//将表的内容插入到临时表中
//string sqly = "/*dialect*/select F_BJYC_Date,F_BJYC_OrgName,F_BJYC_XSSP,F_BJYC_QTJYLR,F_BJYC_TZCZLR,F_BJYC_CGK,F_BJYC_ZJGC,F_BJYC_RYCB,F_BJYC_SF,F_BJYC_ZXFW,F_BJYC_QTJYLC,F_BJYC_QTTZCZLC,F_BJYC_YE,F_BJYC_YSZKYE,F_BJYC_YYSR,FIDENTITYID into " + tableName + " from xjllb";
//DBUtils.ExecuteDataSet(this.Context, sqly);
string sql = string.Format(@"/*dialect*/exec spyc_ybx_xjllb '{0}','{1}' ",tableName,"日期");
DBUtils.ExecuteDynamicObject(this.Context, sql);
}
}
/// 设置汇总列信息
public override List<SummaryField> GetSummaryColumnInfo(IRptParams filter)
{
var result = base.GetSummaryColumnInfo(filter);
//result.Add(new SummaryField("FQty", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
//result.Add(new SummaryField("FALLAMOUNT", Kingdee.BOS.Core.Enums.BOSEnums.Enu_SummaryType.SUM));
return result;
}
///排序语句
private string OrderColumn(IRptParams filter)
{
string OrderBy = "";
string datasort = Convert.ToString(filter.FilterParameter.SortString);//排序
if (datasort != "")
{
OrderBy = " " + datasort + " ";
}
else
{
OrderBy = " FID ";
}
return OrderBy;
}
}
推荐阅读