public static inputReceiptReportCollectin GetReportInfo(int PlanId, out string PlanYear) { string str; PlanYear = DateTime.Today.Year.ToString(); inputReceiptReportCollectin collectin = new inputReceiptReportCollectin(); DataTable table = publicDbOpClass.DataTableQuary(string.Format("select * from Prj_IncomeDevotionPlan where MainID={0}", PlanId)); if (table.Rows.Count > 0) { PlanYear = table.Rows[0]["PlanYear"].ToString(); foreach (DataRow row in publicDbOpClass.DataTableQuary(("select sum(IncomeMoney) as IncomeMoney,sum(DevotionMoney) as DevotionMoney,DepartmentName from Prj_IncomeDevotionPlanChild where MainID=" + PlanId.ToString()) + " and DepartmentName not in (select ProjectDepName from Prj_ProjectInfo)" + " group by DepartmentName").Rows) { str = string.Format("select v_bmmc from pt_d_bm where i_bmdm={0}", row["DepartmentName"].ToString()); inputReceiptReportInfo info = new inputReceiptReportInfo(); object obj2 = publicDbOpClass.ExecuteScalar(str); if (obj2 == null) { info.IsProject = true; object obj3 = publicDbOpClass.ExecuteScalar("select prjName from Prj_ProjectInfo where prjCode='" + row["DepartmentName"].ToString() + "'"); if (obj3 != null) { info.PrjName = obj3.ToString(); } } else { info.IsProject = false; info.PrjName = obj2.ToString(); } info.InputAmount = decimal.Parse(row["DevotionMoney"].ToString()); info.ReceiptAmount = decimal.Parse(row["IncomeMoney"].ToString()); str = ("select isnull(sum(ScienceEmpolderMoney),0)/10000 from Prj_ScienceEmpolderDevotion where year(FillTime)=" + PlanYear) + " and prjCode='" + row["DepartmentName"].ToString() + "'"; info.InputCompAmount = decimal.Parse(publicDbOpClass.ExecuteScalar(str).ToString()); str = ("select isnull(sum(ComAuditValue),0)/10000 from Prj_TechnologyAdvancementIncome where year(EndDate)=" + PlanYear) + " and prjCode='" + row["DepartmentName"].ToString() + "'"; info.ReceiptCompAmount = decimal.Parse(publicDbOpClass.ExecuteScalar(str).ToString()); collectin.Add(info); } } table.Dispose(); foreach (DataRow row2 in publicDbOpClass.DataTableQuary(("select isnull(sum(ScienceEmpolderMoney),0)/10000,prjCode from Prj_ScienceEmpolderDevotion where year(FillTime)=" + PlanYear) + " and prjCode not in(select DepartmentName from Prj_IncomeDevotionPlanChild where MainID=" + PlanId.ToString() + ") group by prjCode").Rows) { inputReceiptReportInfo info2 = new inputReceiptReportInfo { InputCompAmount = decimal.Parse(row2[0].ToString()), IsProject = true }; str = ("select isnull(sum(ComAuditValue),0)/10000 from Prj_TechnologyAdvancementIncome where year(EndDate)=" + PlanYear) + " and prjCode='" + row2["prjCode"].ToString() + "'"; info2.ReceiptCompAmount = decimal.Parse(publicDbOpClass.ExecuteScalar(str).ToString()); info2.PrjName = publicDbOpClass.ExecuteScalar("select prjName from Prj_ProjectInfo where prjCode='" + row2["prjCode"].ToString() + "'").ToString(); DataTable table2 = publicDbOpClass.DataTableQuary("select a.PrjName,b.v_bmmc,c.* from Prj_ProjectInfo a,pt_d_bm b,Prj_IncomeDevotionPlanChild c where cast(isnull(a.projectDepName,0) as int)=b.i_bmdm and a.projectDepName=c.DepartmentName and a.PrjCode='" + row2["prjCode"].ToString() + "'"); if (table2.Rows.Count > 0) { info2.InputAmount = decimal.Parse(table2.Rows[0]["DevotionMoney"].ToString()); info2.ReceiptAmount = decimal.Parse(table2.Rows[0]["IncomeMoney"].ToString()); } table2.Dispose(); collectin.Add(info2); } return(collectin); }
private void CreateAllPrjRows(inputReceiptReportCollectin objInfos) { int num = 0; foreach (inputReceiptReportInfo inputReceiptReportInfo in objInfos) { if (inputReceiptReportInfo.IsProject) { num++; this.CreatePrjRow(num, inputReceiptReportInfo); } } this.hidPrjRowCount.Value = num.ToString(); }
private void BindData() { bool flag = false; inputReceiptReportCollectin reportInfo = inputReceiptAction.GetReportInfo(this.PlanNo, out this.PlanYear); this.lbPlanYear.Text = this.PlanYear; foreach (inputReceiptReportInfo inputReceiptReportInfo in reportInfo) { if (!inputReceiptReportInfo.IsProject) { this.CreateDpm(inputReceiptReportInfo, false); } else { if (!flag) { flag = true; this.CreateDpm(new inputReceiptReportInfo { PrjName = "项目经理部", InputAmount = reportInfo.GetPrjInputAmount(), InputCompAmount = reportInfo.GetPrjInputCompAmount(), ReceiptAmount = reportInfo.GetPrjReceiptAmount(), ReceiptCompAmount = reportInfo.GetPrjReceiptCompAmount() }, true); this.CreateAllPrjRows(reportInfo); } } } HtmlTableRow htmlTableRow = new HtmlTableRow(); this.iIndex++; HtmlTableCell htmlTableCell = new HtmlTableCell(); htmlTableCell.ColSpan = 3; htmlTableCell.InnerText = "合计:" + reportInfo.GetAllReceiptAmount().ToString(); htmlTableRow.Style.Add("FONT-WEIGHT", "bold"); htmlTableRow.Cells.Add(htmlTableCell); HtmlTableCell htmlTableCell2 = new HtmlTableCell(); htmlTableCell2.InnerText = reportInfo.GetAllReceiptCompAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell2); HtmlTableCell htmlTableCell3 = new HtmlTableCell(); if (reportInfo.GetAllReceiptAmount() != 0m) { htmlTableCell3.InnerText = Convert.ToString(decimal.Round(reportInfo.GetAllReceiptCompAmount() / reportInfo.GetAllReceiptAmount() * 100m, 2)); } else { htmlTableCell3.InnerText = "0"; } htmlTableRow.Cells.Add(htmlTableCell3); HtmlTableCell htmlTableCell4 = new HtmlTableCell(); htmlTableCell4.InnerText = reportInfo.GetAllInputAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell4); HtmlTableCell htmlTableCell5 = new HtmlTableCell(); htmlTableCell5.InnerText = reportInfo.GetAllInputCompAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell5); HtmlTableCell htmlTableCell6 = new HtmlTableCell(); if (reportInfo.GetAllInputAmount() != 0m) { htmlTableCell6.InnerText = Convert.ToString(decimal.Round(reportInfo.GetAllInputCompAmount() / reportInfo.GetAllInputAmount() * 100m, 2)); } else { htmlTableCell6.InnerText = "0"; } htmlTableRow.Cells.Add(htmlTableCell6); htmlTableRow.Height = "22"; this.tbReport.Rows.Add(htmlTableRow); }