SGGL_SHJ/SGGL/FineUIPro.Web/PZHGL/InformationProject/ConstructionMonthReport.asp...

975 lines
54 KiB
C#

using Aspose.Words;
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
namespace FineUIPro.Web.PZHGL.InformationProject
{
public partial class ConstructionMonthReport : PageBase
{
/// <summary>
/// 项目id
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
GetButtonPower();
BindGrid();
}
}
#region
/// <summary>
/// 绑定数据
/// </summary>
public void BindGrid()
{
DataTable tb = ChecklistData();
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
protected DataTable ChecklistData()
{
string strSql = @"select C.ConstructionMonthReportId,C.ProjectId,C.Month,C.CompileDate,C.CompileMan, U.PersonName from ZHGL_ConstructionMonthReport C left join Person_Persons U on U.PersonId = C.CompileMan where 1=1";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " AND C.ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
return tb;
}
#endregion
#region
/// <summary>
/// 添加
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionMonthReportMenuId, BLL.Const.BtnAdd))
{
if (!string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
{
string Month = txtMonth.Text.Trim() + "-01";
if (BLL.ConstructionMonthReportService.GetConstructionMonthReportByMonth(Convert.ToDateTime(Month), this.CurrUser.LoginProjectId) == null)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionMonthReportEdit.aspx?Month={0}", Month, "添加 - ")));
}
else
{
Alert.ShowInTop("该月份月报已存在!", MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
//右键编辑
protected void btnMenuModify_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionMonthReportMenuId, BLL.Const.BtnModify))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionMonthReportEdit.aspx?ConstructionMonthReportId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
}
//双击编辑
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionMonthReportMenuId, BLL.Const.BtnModify))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionMonthReportEdit.aspx?ConstructionMonthReportId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
}
//查看
protected void btnMenuView_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionMonthReportEdit.aspx?see=see&ConstructionMonthReportId={0}", Grid1.SelectedRowID, "查看 - ")));
}
protected void btnMenuDel_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionMonthReportMenuId, BLL.Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
BLL.ConstructionMonthReportMainCostService.DeleteConstructionMonthReportMainCostsByConstructionMonthReportId(rowID);
BLL.ConstructionMonthReportSubCostService.DeleteConstructionMonthReportSubCostsByConstructionMonthReportId(rowID);
BLL.ConstructionMonthReportService.DeleteConstructionMonthReport(rowID);
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditData()
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionMonthReportEdit.aspx?ConstructionMonthReportId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
#endregion
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionMonthReportMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuModify.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDel.Hidden = false;
}
}
}
#endregion
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
protected void btnPrinter_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string ConstructionMonthReportId = this.Grid1.SelectedRowID;
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
Model.ZHGL_ConstructionMonthReport monthReport = ConstructionMonthReportService.GetConstructionMonthReport(ConstructionMonthReportId);
Model.Project_Sys_Set CheckMonthStartDay = BLL.Project_SysSetService.GetSysSetBySetName("月报开始日期", this.CurrUser.LoginProjectId);
Model.Project_Sys_Set CheckMonthEndDay = BLL.Project_SysSetService.GetSysSetBySetName("月报结束日期", this.CurrUser.LoginProjectId);
DateTime startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-25");
DateTime endTime = startTime.AddMonths(1);
if (CheckMonthStartDay != null)
{
if (CheckMonthStartDay.SetValue != "")
{
if (CheckMonthEndDay != null)
{
if (CheckMonthEndDay.SetValue != "")
{
startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-" + CheckMonthStartDay.SetValue);
endTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.Month.ToString() + "-" + CheckMonthEndDay.SetValue);
}
else
{
startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-" + CheckMonthStartDay.SetValue);
endTime = startTime.AddMonths(1);
}
}
else
{
startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-" + CheckMonthStartDay.SetValue);
endTime = startTime.AddMonths(1);
}
}
else
{
if (CheckMonthEndDay != null)
{
if (CheckMonthEndDay.SetValue != "")
{
startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-" + CheckMonthEndDay.SetValue);
endTime = startTime.AddMonths(1);
}
}
}
}
else
{
if (CheckMonthEndDay != null)
{
if (CheckMonthEndDay.SetValue != null)
{
startTime = Convert.ToDateTime(monthReport.Month.Value.AddMonths(-1).Year.ToString() + "-" + monthReport.Month.Value.AddMonths(-1).Month.ToString() + "-" + CheckMonthEndDay.SetValue);
endTime = startTime.AddMonths(1);
}
}
}
initTemplatePath = Const.ConstructionMonthReportTemplateUrl;
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", "(" + string.Format("{0:yyyy-MM}", monthReport.Month) + ").doc");
File.Copy(uploadfilepath, newUrl);
//更新书签内容
Document doc = new Aspose.Words.Document(newUrl);
var project = ProjectService.GetProjectByProjectId(monthReport.ProjectId);
Bookmark bookmarkProjectName1 = doc.Range.Bookmarks["ProjectName1"];
if (bookmarkProjectName1 != null)
{
if (project != null)
{
bookmarkProjectName1.Text = project.ProjectName;
}
}
Bookmark bookmarkMag = doc.Range.Bookmarks["Mag"];
if (bookmarkMag != null)
{
bookmarkMag.Text = endTime.Year.ToString() + "年第" + endTime.Month.ToString() + "期";
}
Bookmark bookmarkTimeSpan = doc.Range.Bookmarks["TimeSpan"];
if (bookmarkTimeSpan != null)
{
bookmarkTimeSpan.Text = startTime.Year + "年" + startTime.Month + "月" + startTime.Day + "日" + "~" + endTime.Year + "年" + endTime.Month + "月" + endTime.Day + "日";
}
Bookmark bookmarkCompileMan = doc.Range.Bookmarks["CompileMan"];
if (bookmarkCompileMan != null)
{
bookmarkCompileMan.Text = Person_PersonsService.GetPersonsNameById(monthReport.CompileMan);
}
Bookmark bookmarkCompileDate = doc.Range.Bookmarks["CompileDate"];
if (bookmarkCompileDate != null)
{
if (monthReport.CompileDate != null)
{
bookmarkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", monthReport.CompileDate);
}
}
Bookmark bookmarkProjectName2 = doc.Range.Bookmarks["ProjectName2"];
if (bookmarkProjectName2 != null)
{
if (project != null)
{
bookmarkProjectName2.Text = project.ProjectName;
}
}
Bookmark bookmarkOwnerName = doc.Range.Bookmarks["OwnerName"];
if (bookmarkOwnerName != null)
{
bookmarkOwnerName.Text = monthReport.OwnerName ?? "";
}
Bookmark bookmarkContractScope = doc.Range.Bookmarks["ContractScope"];
if (bookmarkContractScope != null)
{
bookmarkContractScope.Text = monthReport.ContractScope ?? "";
}
Bookmark bookmarkContractPriceAndPricingModel = doc.Range.Bookmarks["ContractPriceAndPricingModel"];
if (bookmarkContractPriceAndPricingModel != null)
{
bookmarkContractPriceAndPricingModel.Text = monthReport.ContractPriceAndPricingModel ?? "";
}
Bookmark bookmarkStartEndTime = doc.Range.Bookmarks["StartEndTime"];
if (bookmarkStartEndTime != null)
{
string start = string.Empty, end = string.Empty;
if (monthReport.ContractStartDate != null)
{
start = string.Format("{0:yyyy-MM-dd}", monthReport.ContractStartDate);
}
if (monthReport.ContractEndDate != null)
{
end = string.Format("{0:yyyy-MM-dd}", monthReport.ContractEndDate);
}
bookmarkStartEndTime.Text = start + "/" + end;
}
Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
//本月进度完成情况
builder.MoveToBookmark("Table1");
builder.StartTable();
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
builder.Bold = false;
DataTable table = BLL.WorkPackageService.GetAllTreeDataTableConstructionMonthReport(this.CurrUser.LoginProjectId, string.Empty, startTime, endTime);
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 60;
builder.Write("序号");
//工作内容
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 200;
builder.Write("工作内容");
//概算工程量
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("概算工程量");
//计划开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("计划开始时间");
//计划完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("计划完成时间");
//实际开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("实际开始时间");
//实际完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("实际完成时间");
builder.EndRow();
foreach (DataRow row in table.Rows)
{
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 60;
builder.Write(row["Code"].ToString());
//工作内容
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 200;
builder.Write(row["Name"].ToString());
//概算工程量
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
if (row["PlanProjectQuantity"] != System.DBNull.Value)
{
builder.Write(Funs.GetNewDecimalOrZero(row["PlanProjectQuantity"].ToString()).ToString("0.##"));
}
//计划开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string planStartDate = string.Empty;
if (row["PlanStartDate"] != null)
{
planStartDate = string.Format("{0:yyyy-MM-dd}", row["PlanStartDate"]);
}
builder.Write(planStartDate);
//计划完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string planEndDate = string.Empty;
if (row["PlanEndDate"] != null)
{
planEndDate = string.Format("{0:yyyy-MM-dd}", row["PlanEndDate"]);
}
builder.Write(planEndDate);
//实际开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string realStartDate = string.Empty;
if (row["RealStartDate"] != null)
{
realStartDate = string.Format("{0:yyyy-MM-dd}", row["RealStartDate"]);
}
builder.Write(realStartDate);
//实际完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string realEndDate = string.Empty;
if (row["RealEndDate"] != null)
{
realEndDate = string.Format("{0:yyyy-MM-dd}", row["RealEndDate"]);
}
builder.Write(realEndDate);
builder.EndRow();
}
builder.EndTable();
Bookmark bookmarkMainConstructionActivities = doc.Range.Bookmarks["MainConstructionActivities"];
if (bookmarkMainConstructionActivities != null)
{
bookmarkMainConstructionActivities.Text = monthReport.MainConstructionActivities ?? "";
}
Bookmark bookmarkProgressDeviationAndCauseAnalysis = doc.Range.Bookmarks["ProgressDeviationAndCauseAnalysis"];
if (bookmarkProgressDeviationAndCauseAnalysis != null)
{
bookmarkProgressDeviationAndCauseAnalysis.Text = monthReport.ProgressDeviationAndCauseAnalysis ?? "";
}
Bookmark bookmarkKeyDeviationAndCauseAnalysis = doc.Range.Bookmarks["KeyDeviationAndCauseAnalysis"];
if (bookmarkKeyDeviationAndCauseAnalysis != null)
{
bookmarkKeyDeviationAndCauseAnalysis.Text = monthReport.KeyDeviationAndCauseAnalysis ?? "";
}
Bookmark bookmarkTargetedCorrectiveMeasures = doc.Range.Bookmarks["TargetedCorrectiveMeasures"];
if (bookmarkTargetedCorrectiveMeasures != null)
{
bookmarkTargetedCorrectiveMeasures.Text = monthReport.TargetedCorrectiveMeasures ?? "";
}
//总包工程施工请款情况表
builder.MoveToBookmark("Table2");
builder.StartTable();
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
builder.Bold = false;
var list = ConstructionMonthReportMainCostService.getListData(ConstructionMonthReportId);
foreach (var item in list)
{
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 28;
builder.Write("1");
//合同施工费
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 68;
builder.Write(item.ContractConstructionCost.Value.ToString("0.####"));
//本月请款
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 56;
builder.Write(item.ThisRequestCost.Value.ToString("0.####"));
//累计请款
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 80;
builder.Write(item.TotalRequestCost.Value.ToString("0.####"));
//本月收款
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.ThisCollection.Value.ToString("0.####"));
//累计收款
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 76;
builder.Write(item.TotalCollection.Value.ToString("0.####"));
//累计收款百分比
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 68;
builder.Write(item.TotalCollectionRate.Value.ToString("0.##"));
builder.EndRow();
}
builder.EndTable();
//分包工程施工付款情况表
builder.MoveToBookmark("Table3");
builder.StartTable();
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
builder.Bold = false;
var list2 = ConstructionMonthReportSubCostService.getListData(ConstructionMonthReportId);
int i = 1;
foreach (var item in list2)
{
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 33;
builder.Write(i.ToString());
//施工单位
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(BLL.UnitService.GetUnitNameByUnitId(item.UnitId));
//合同金额
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 37;
builder.Write(item.ContractAmount.Value.ToString("0.####"));
//本月应付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.ThisNeedPay.Value.ToString("0.####"));
//本月实付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.ThisRealPay.Value.ToString("0.####"));
//累计应付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.TotalNeedPay.Value.ToString("0.####"));
//累计实付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.TotalRealPay.Value.ToString("0.####"));
//累计付款百分比
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(item.TotalRealPayRate.Value.ToString("0.##"));
builder.EndRow();
i++;
}
//合计
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 33;
builder.Write("合计");
//施工单位
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(string.Empty);
//合同金额
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 37;
builder.Write(list2.Sum(x => x.ContractAmount ?? 0).ToString("0.####"));
//本月应付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(list2.Sum(x => x.ThisNeedPay ?? 0).ToString("0.####"));
//本月实付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(list2.Sum(x => x.ThisRealPay ?? 0).ToString("0.####"));
//累计应付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(list2.Sum(x => x.TotalNeedPay ?? 0).ToString("0.####"));
//累计实付
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
builder.Write(list2.Sum(x => x.TotalRealPay ?? 0).ToString("0.####"));
//累计付款百分比
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 62;
decimal contractAmount = list2.Sum(x => x.ContractAmount ?? 0);
decimal totalRealPay = list2.Sum(x => x.TotalRealPay ?? 0);
decimal totalRealPayRate = 0;
if (contractAmount > 0 && totalRealPay > 0)
{
totalRealPayRate = totalRealPay / contractAmount * 100;
}
builder.Write(totalRealPayRate.ToString("0.##"));
builder.EndRow();
builder.EndTable();
//下月计划完成情况
builder.MoveToBookmark("Table4");
builder.StartTable();
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
builder.Bold = false;
DateTime nextStartTime = startTime.AddMonths(1);
DateTime nextEndTime = endTime.AddMonths(1);
DataTable table2 = BLL.WorkPackageService.GetAllTreeDataTableConstructionMonthReport(this.CurrUser.LoginProjectId, string.Empty, nextStartTime, nextEndTime);
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 60;
builder.Write("序号");
//工作内容
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 200;
builder.Write("工作内容");
//概算工程量
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("概算工程量");
//计划开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("计划开始时间");
//计划完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("计划完成时间");
//实际开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("实际开始时间");
//实际完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
builder.Write("实际完成时间");
builder.EndRow();
foreach (DataRow row in table2.Rows)
{
//序号
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 60;
builder.Write(row["Code"].ToString());
//工作内容
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 200;
builder.Write(row["Name"].ToString());
//概算工程量
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
if (row["PlanProjectQuantity"] != System.DBNull.Value)
{
builder.Write(Funs.GetNewDecimalOrZero(row["PlanProjectQuantity"].ToString()).ToString("0.##"));
}
//计划开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string planStartDate = string.Empty;
if (row["PlanStartDate"] != null)
{
planStartDate = string.Format("{0:yyyy-MM-dd}", row["PlanStartDate"]);
}
builder.Write(planStartDate);
//计划完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string planEndDate = string.Empty;
if (row["PlanEndDate"] != null)
{
planEndDate = string.Format("{0:yyyy-MM-dd}", row["PlanEndDate"]);
}
builder.Write(planEndDate);
//实际开始时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string realStartDate = string.Empty;
if (row["RealStartDate"] != null)
{
realStartDate = string.Format("{0:yyyy-MM-dd}", row["RealStartDate"]);
}
builder.Write(realStartDate);
//实际完成时间
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
string realEndDate = string.Empty;
if (row["RealEndDate"] != null)
{
realEndDate = string.Format("{0:yyyy-MM-dd}", row["RealEndDate"]);
}
builder.Write(realEndDate);
builder.EndRow();
}
builder.EndTable();
Bookmark bookmarkNextMonthWork = doc.Range.Bookmarks["NextMonthWork"];
if (bookmarkNextMonthWork != null)
{
bookmarkNextMonthWork.Text = monthReport.NextMonthWork ?? "";
}
Bookmark bookmarkNeedCoordinateMatter = doc.Range.Bookmarks["NeedCoordinateMatter"];
if (bookmarkNeedCoordinateMatter != null)
{
bookmarkNeedCoordinateMatter.Text = monthReport.NeedCoordinateMatter ?? "";
}
Bookmark bookmarkFile = doc.Range.Bookmarks["Photo"];
if (bookmarkFile != null)
{
builder.MoveToBookmark("Photo");
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
var checkFile = AttachFileService.Getfiles(ConstructionMonthReportId, Const.ConstructionMonthReportMenuId);
if (!string.IsNullOrEmpty(checkFile.AttachUrl))
{
string[] urls = checkFile.AttachUrl.Split(',');
if (urls.Length > 0)
{
foreach (var url in urls)
{
if (!string.IsNullOrWhiteSpace(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
string spliurl = url;
UploadAttachmentService.getJpgSize(rootPath + spliurl, out JpgSize, out Wpx, out Hpx);
float d = 1;
if (JpgSize.Width > 0 && JpgSize.Height > 0)
{
if (JpgSize.Width >= JpgSize.Height)
{
if (JpgSize.Width > 420)
{
d = (float)JpgSize.Width / 420;
}
}
else
{
if (JpgSize.Height > 420)
{
d = (float)JpgSize.Height / 420;
}
}
if (File.Exists(rootPath + spliurl))
{
builder.InsertImage(rootPath + spliurl, Convert.ToDouble(JpgSize.Width / d), Convert.ToDouble(JpgSize.Height / d));
builder.Write(" ");
}
}
}
}
}
//string url = item.AttachUrl.Substring(0, item.AttachUrl.Length - 1);
}
}
doc.Save(newUrl);
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
}
}