public static void UpdateFinMonth(FinMonth finMon) { string connectionString = DataManager.OraConnString(); string query = "update gl_fin_month set fin_mon='" + finMon.FinMon + "',fin_year='" + finMon.FinYear + "', " + " month_sl=" + finMon.MonthSl + ",quarter='" + finMon.Quarter + "',mon_start_dt=convert(datetime,case '" + finMon.MonStartDt + "' when '' then null else '" + finMon.MonStartDt + "' end,103), " + " mon_end_dt=convert(datetime,case '" + finMon.MonEndDt + "' when '' then null else '" + finMon.MonEndDt + "' end,103),year_flag='" + finMon.YearFlag + "' where fin_mon='" + finMon.FinMon + "' "; DataManager.ExecuteNonQuery(connectionString, query); }
public static void CreateFinMonth(FinMonth finMon) { string connectionString = DataManager.OraConnString(); string query = "insert into gl_fin_month(book_name,fin_mon,fin_year,month_sl,quarter,mon_start_dt, " + " mon_end_dt,year_flag) values('" + finMon.BookName + "', '" + finMon.FinMon + "', '" + finMon.FinYear + "'," + " '" + finMon.MonthSl + "', '" + finMon.Quarter + "', convert(datetime,case '" + finMon.MonStartDt + "' when '' then null else '" + finMon.MonStartDt + "' end,103), convert(datetime,case '" + finMon.MonEndDt + "' when '' then null else '" + finMon.MonEndDt + "' end,103)," + " '" + finMon.YearFlag + "' )"; DataManager.ExecuteNonQuery(connectionString, query); }
/// <summary> /// 下载Excel月度经营报告 /// </summary> /// <param name="templetePath">模板路径</param> /// <param name="templeteName">模板名称</param> /// <param name="fileName">下载文件名称</param> /// <param name="sytemID">系统ID</param> /// <param name="Year">年度</param> /// <param name="Month">月份</param> /// <param name="IsLatestVersion">是否包含审批中</param> public void DownExcelMonthReportSummary(string templetePath, string templeteName, string fileName, Guid sytemID, int Year, int Month, bool IsLatestVersion) { ExcelEngine excel = new ExcelEngine(); string str = HttpContext.Current.Server.MapPath("../"); string Title = FinYear.ToString() + "年" + FinMonth + "月"; List <DictionaryVmodel> listDVM = null; if (rpt != null) { listDVM = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false); // .GetSummaryRptDataSource(out strs, false); //判断当前系统是否有自己的模板 if (!string.IsNullOrEmpty(listDVM[2].HtmlTemplate)) { string[] strHtmlTemplates = listDVM[2].HtmlTemplate.Split(','); if (!string.IsNullOrEmpty(strHtmlTemplates[2])) { templeteName = strHtmlTemplates[2]; } } } List <MonthReportSummaryViewModel> list = (List <MonthReportSummaryViewModel>)listDVM[2].ObjValue; if (sytemID != ConfigurationManager.AppSettings["MonthSG"].ToGuid()) { list.ForEach(p => { double temp = 0; if (double.TryParse(p.MeasureRate, out temp)) { p.MeasureRate1 = Convert.ToDouble(p.MeasureRate); } }); } else { list.ForEach(p => { //因租金收缴率使用String类型,将其余几个项目也如此赋值。 if (p.TargetID != ConfigurationManager.AppSettings["MonthSGRent"].ToGuid()) { p.NPlanStr = string.Format("{0:N2}", p.NPlanAmmount); p.NActualStr = string.Format("{0:N2}", p.NActualAmmount); p.NAccumulativePlanStr = string.Format("{0:N2}", p.NAccumulativePlanAmmount); p.NAccumulativeActualStr = string.Format("{0:N2}", p.NAccumulativeActualAmmount); p.NDifferStr = string.Format("{0:N2}", p.NDifference); p.NAccDiffereStr = string.Format("{0:N2}", p.NAccumulativeDifference); double temp = 0; if (double.TryParse(p.MeasureRate, out temp)) { p.MeasureRate1 = Convert.ToDouble(p.MeasureRate); } p.MeasureRate = string.Format("{0:N2}", p.MeasureRate1); } else if (p.TargetID == ConfigurationManager.AppSettings["MonthSGRent"].ToGuid()) { if (p.NDifference == 0) { p.NDifferStr = string.Format("{0:N0}", p.NDifference) + "\r\n (无欠收)"; } else { p.NDifferStr = string.Format("{0:N2}", p.NDifference) + "\r\n (当月欠收)"; } if (p.NAccumulativeDifference == 0) { p.NAccDiffereStr = string.Format("{0:N0}", p.NAccumulativeDifference) + "\r\n (无欠收)"; } else { p.NAccDiffereStr = string.Format("{0:N2}", p.NAccumulativeDifference) + "\r\n (累计欠收)"; } } }); } MemoryStream stream = ExportExcel(list, "MonthReportSummary", templetePath, templeteName, rpt); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Charset = "utf-8"; string dateNow = DateTime.Now.ToString("HHmmss"); HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(rpt._System.SystemName + fileName, System.Text.Encoding.UTF8) + FinYear.ToString() + FinMonth.ToString("D2") + "_" + dateNow + ".xls"); HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.ContentType = "application/ms-excel"; HttpContext.Current.Response.BinaryWrite(stream.ToArray()); HttpContext.Current.Response.End(); }