CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx
@@ -294,6 +294,16 @@ window.open('/Pages/business/DeliverPlanFujianShow.aspx?Keyid=' + keyid + '&AttachmentType=' + AttachmentType, '_blank', 'height=750,width=900,top=' + t + ',left=' + l + ',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no'); } function showProgress() { document.getElementById('progressBar').style.display = 'block'; setTimeout(function () { document.getElementById('progressBar').style.display = 'none'; }, 2000); // 10000毫秒等于10秒 } /* 打印送货单 */ @@ -390,7 +400,10 @@ <asp:button id="btn_Search" text="查询" runat="server" padding="0px" OnClick="btn_Search_Click" /> <input type="button" value='重置' onclick='document.body.innerHTML="";window.location=window.location;' /> <asp:Button ID="Button1" Text="导出" OnClientClick="showProgress();return true;" runat="server" OnClick="btn_Daochu_Click" /> <div id="progressBar" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);border:1px solid black;height:50px;background-color:azure;"> 正在导出Excel文件,请稍候... </div> </td> </tr> @@ -406,7 +419,7 @@ <tr> <th width="25"> 顺序 编号 </th> <th width="60"> 车辆 CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs
@@ -18,6 +18,9 @@ using CY.SQLDAL; using System.Data.SqlClient; using CY.Infrastructure.Logging; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using System.IO; namespace CY.WebForm.Pages.business { @@ -231,6 +234,100 @@ //查询事件 protected void btn_Daochu_Click(object src, EventArgs e) { byte[] fileBytes = ExportToExcel(); if (fileBytes != null) { Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AppendHeader("Content-Disposition", "attachment; filename=打卡导出.xlsx"); Response.BinaryWrite(fileBytes); Response.End(); } else { // 处理导出失败的情况 Response.Write("导出失败,请稍后重试!"); } } public byte[] ExportToExcel() { byte[] bt = null; try { Pagination pa = new Pagination(); pa.PageSize = 1000; pa.PageIndex = 1; IEnumerable<OA_DriverRecord> results = _oA_DriverRecordBLL.SelectModelPage(pa, this.txtCreatTimestart.Value, this.txtCreatTimeend.Value, this.selCarId.Value, this.txtCreater.Value, this.selClockType.Value ); // 创建工作簿 IWorkbook workbook = new XSSFWorkbook(); ISheet sheet = workbook.CreateSheet("导出数据"); // 创建表头 IRow headerRow = sheet.CreateRow(0); headerRow.CreateCell(0).SetCellValue("编号"); headerRow.CreateCell(1).SetCellValue("车辆"); headerRow.CreateCell(2).SetCellValue("驾驶员"); headerRow.CreateCell(3).SetCellValue("打卡时间"); headerRow.CreateCell(4).SetCellValue("打卡类型"); headerRow.CreateCell(5).SetCellValue("未装货情况"); headerRow.CreateCell(6).SetCellValue("车况"); headerRow.CreateCell(7).SetCellValue("备注"); headerRow.CreateCell(8).SetCellValue("里程(公里)"); // 添加数据 int rowIndex = 1; foreach (var oA_DriverRecord in results) { IRow row = sheet.CreateRow(rowIndex++); row.CreateCell(0).SetCellValue((rowIndex - 1).ToString()); row.CreateCell(1).SetCellValue(oA_DriverRecord.CarName); row.CreateCell(2).SetCellValue(oA_DriverRecord.Creater); row.CreateCell(3).SetCellValue(oA_DriverRecord.CreatTime.ToString("yyyy-MM-dd")); row.CreateCell(4).SetCellValue(oA_DriverRecord.ClockTypeName); row.CreateCell(5).SetCellValue(oA_DriverRecord.EmptyCause); row.CreateCell(6).SetCellValue(oA_DriverRecord.CarCondition); row.CreateCell(7).SetCellValue(oA_DriverRecord.Remark); row.CreateCell(8).SetCellValue(oA_DriverRecord.Mileage.ToString()); } // 将工作簿写入内存流 using (var ms = new MemoryStream()) { workbook.Write(ms); bt = ms.ToArray(); } } catch (Exception e) { bt = null; // 记录日志 } return bt; } } } CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.designer.cs
@@ -96,6 +96,15 @@ protected global::System.Web.UI.WebControls.Button btn_Search; /// <summary> /// Button1 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.Button Button1; /// <summary> /// RepClientList 控件。 /// </summary> /// <remarks> CY_ECommercePlatform/CY.WebForm/Pages/business/InvoicingConfirm.aspx
@@ -158,7 +158,15 @@ }); } function showProgress() { document.getElementById('progressBar').style.display = 'block'; setTimeout(function () { document.getElementById('progressBar').style.display = 'none'; }, 2000); // 10000毫秒等于10秒 } $(function () { var value_NowPageAllMoney = 0; @@ -285,7 +293,10 @@ </td> <td > <asp:button id="btn_Search" text="查询" runat="server" /> <input type="button" value='重置' onclick='document.body.innerHTML="";window.location=window.location;' /> <asp:Button ID="Button1" Text="导出" OnClientClick="showProgress();return true;" runat="server" OnClick="btn_Daochu_Click" /> <div id="progressBar" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);border:1px solid black;height:50px;background-color:azure;"> 正在导出Excel文件,请稍候... </div> </td> </tr> </table> CY_ECommercePlatform/CY.WebForm/Pages/business/InvoicingConfirm.aspx.cs
@@ -29,6 +29,10 @@ using CY.BLL; using CY.WebForm.Pages.common; using System.Transactions; using CY.Infrastructure.Query; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using System.IO; namespace CY.WebForm.Pages.business { @@ -720,6 +724,103 @@ UCPager1.AspNetPager.RecordCount = pagination.RecordCount; } //查询事件 protected void btn_Daochu_Click(object src, EventArgs e) { byte[] fileBytes = ExportToExcel(); if (fileBytes != null) { Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AppendHeader("Content-Disposition", "attachment; filename=开票管理导出.xlsx"); Response.BinaryWrite(fileBytes); Response.End(); } else { // 处理导出失败的情况 Response.Write("导出失败,请稍后重试!"); } } public byte[] ExportToExcel() { byte[] bt = null; try { Pagination pa = new Pagination(); pa.PageSize = 1000; pa.PageIndex = 1; IEnumerable<OA_Kaipiaoshenqing> results = oA_KaipiaoshenqingBLL.SelectModelPage(pa, CurrentUser.MemberId, this.txtSQBeginDate.Value, this.txtSQEndDate.Value, this.selKaipiaoshenqing.Value, this.selKehuqianshou.Value, this.selBusinessManager.Value, this.txtCustormerName.Value, this.selPayStates.Value, this.selHuikuanStates.Value); // 创建工作簿 IWorkbook workbook = new XSSFWorkbook(); ISheet sheet = workbook.CreateSheet("导出数据"); // 创建表头 IRow headerRow = sheet.CreateRow(0); headerRow.CreateCell(0).SetCellValue("编号"); headerRow.CreateCell(1).SetCellValue("申请开票时间"); headerRow.CreateCell(2).SetCellValue("申请类型"); headerRow.CreateCell(3).SetCellValue("业务经理"); headerRow.CreateCell(4).SetCellValue("客户名称"); headerRow.CreateCell(5).SetCellValue("发票号码"); headerRow.CreateCell(6).SetCellValue("订单数量"); headerRow.CreateCell(7).SetCellValue("金额"); headerRow.CreateCell(8).SetCellValue("增减金额"); headerRow.CreateCell(9).SetCellValue("回款金额"); headerRow.CreateCell(10).SetCellValue("最近催款"); headerRow.CreateCell(11).SetCellValue("开票状态"); // 添加数据 int rowIndex = 1; foreach (var oA_Kaipiaoshenqing in results) { IRow row = sheet.CreateRow(rowIndex++); row.CreateCell(0).SetCellValue((rowIndex - 1).ToString()); row.CreateCell(1).SetCellValue(oA_Kaipiaoshenqing.CreateTime.Value.ToString("yyyy-MM-dd")); row.CreateCell(2).SetCellValue(oA_Kaipiaoshenqing.Shenqingleixing); row.CreateCell(3).SetCellValue(oA_Kaipiaoshenqing.BusinessManager); row.CreateCell(4).SetCellValue(oA_Kaipiaoshenqing.BuyerName); row.CreateCell(5).SetCellValue(oA_Kaipiaoshenqing.Fapiaohao); row.CreateCell(6).SetCellValue(oA_Kaipiaoshenqing.Dingdanshu.HasValue? oA_Kaipiaoshenqing.Dingdanshu.Value.ToString():""); row.CreateCell(7).SetCellValue(oA_Kaipiaoshenqing.kpmoney.HasValue ? oA_Kaipiaoshenqing.kpmoney.Value.ToString() : "0"); row.CreateCell(8).SetCellValue(oA_Kaipiaoshenqing.Zengjianmoney.HasValue ? oA_Kaipiaoshenqing.Zengjianmoney.Value.ToString() : "0"); row.CreateCell(9).SetCellValue(oA_Kaipiaoshenqing.Huikuanmoney.HasValue ? oA_Kaipiaoshenqing.Huikuanmoney.Value.ToString() : "0"); row.CreateCell(10).SetCellValue(oA_Kaipiaoshenqing.ShoukuanTime.HasValue? oA_Kaipiaoshenqing.ShoukuanTime.Value.ToString("MM-dd HH:mm") : ""); row.CreateCell(11).SetCellValue(oA_Kaipiaoshenqing.KaipiaoshenqingName); } // 将工作簿写入内存流 using (var ms = new MemoryStream()) { workbook.Write(ms); bt = ms.ToArray(); } } catch (Exception e) { bt = null; // 记录日志 } return bt; } /// <summary> /// 查询参数 /// </summary> CY_ECommercePlatform/CY.WebForm/Pages/business/InvoicingConfirm.aspx.designer.cs
@@ -123,6 +123,15 @@ protected global::System.Web.UI.WebControls.Button btn_Search; /// <summary> /// Button1 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.Button Button1; /// <summary> /// rptData 控件。 /// </summary> /// <remarks>