private void ShowInfo(int _id) { BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataSet ds = bll.GetList(0, "rp_id=" + _id + "", ""); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; txtCusName.Text = dr["c_name"].ToString(); hCusId.Value = dr["rp_cid"].ToString(); txtMoney.Text = dr["rp_money"].ToString(); if (Utils.StrToFloat(dr["rp_money"].ToString(), 0) < 0) { isFushu = true; } if (dr["rp_foredate"] != null) { txtforedate.Text = Convert.ToDateTime(dr["rp_foredate"]).ToString("yyyy-MM-dd"); } txtBank.Text = Utils.ObjectToStr(dr["cb_bank"]) + "(" + Utils.ObjectToStr(dr["cb_bankName"]) + "/" + Utils.ObjectToStr(dr["cb_bankNum"]) + ")"; hBankId.Value = Utils.ObjectToStr(dr["rp_cbid"]); ddlmethod.SelectedValue = dr["rp_method"].ToString(); txtContent.Text = dr["rp_content"].ToString(); if (dr["pm_type"].ToString() == "True") { isChongzhang = true; //dlceDate.Visible = true; //dlceNum.Visible = true; txtCenum.Text = dr["ce_num"].ToString(); txtCedate.Text = Utils.ObjectToDateTime(dr["ce_date"]).ToString("yyyy-MM-dd"); } } }
private void RptBind(string _strWhere, string _orderby) { if (!this.isSearch) { this.page = DTRequest.GetQueryInt("page", 1); } else { this.page = 1; } BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataTable dt = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount, out _tmoney, out _tunmoney).Tables[0]; this.rptList.DataSource = dt; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = backUrl(); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); pCount.Text = dt.Rows.Count.ToString(); decimal _pmoney = 0, _punmoney = 0; if (dt != null) { foreach (DataRow dr in dt.Rows) { _pmoney += Utils.ObjToDecimal(dr["rp_money"], 0); _punmoney += Utils.ObjToDecimal(dr["undistribute"], 0); } } pMoney.Text = _pmoney.ToString(); pUnMoney.Text = _punmoney.ToString(); tCount.Text = totalCount.ToString(); tMoney.Text = _tmoney.ToString(); tUnMoney.Text = _tunmoney.ToString(); txtCusName.Text = _cusName; hCusId.Value = _cid; ddlmethod.SelectedValue = _method; ddlcheck.SelectedValue = _check; ddlcheck2.SelectedValue = _check2; ddlisConfirm.SelectedValue = _isconfirm; txtsforedate.Text = _sforedate; txteforedate.Text = _eforedate; txtsdate.Text = _sdate; txtedate.Text = _edate; txtNum.Text = _num; txtChk.Text = _chk; txtNumDate.Text = _numdate; ddlsign.SelectedValue = _sign; txtMoney.Text = _money; ddlmoneyType.SelectedValue = _moneyType; ddlchecktype.SelectedValue = _flag; txtAddPerson.Text = _addperson; }
private void ShowInfo(int _id) { btnAudit.Visible = false; BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataSet ds = bll.GetList(0, "rp_id=" + _id + "", ""); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; txtCusName.Text = dr["c_name"].ToString(); hCusId.Value = dr["rp_cid"].ToString(); txtBank.Text = Utils.ObjectToStr(dr["cb_bank"]) + "(" + Utils.ObjectToStr(dr["cb_bankName"]) + "/" + Utils.ObjectToStr(dr["cb_bankNum"]) + ")"; hBankId.Value = Utils.ObjectToStr(dr["rp_cbid"]); txtMoney.Text = dr["rp_money"].ToString(); if (dr["rp_foredate"] != null) { txtforedate.Text = Convert.ToDateTime(dr["rp_foredate"]).ToString("yyyy-MM-dd"); } ddlmethod.SelectedValue = dr["rp_method"].ToString(); txtContent.Text = dr["rp_content"].ToString(); if (Utils.ObjToInt(dr["rp_method"], 0) > 0 && new BLL.payMethod().GetModel(Utils.ObjToInt(dr["rp_method"], 0)).pm_type.Value) { isChongzhang = true; //dlceDate.Visible = true; //dlceNum.Visible = true; //dlBank.Visible = false; txtCenum.Text = Utils.ObjectToStr(dr["ce_num"]); txtCedate.Text = ConvertHelper.toDate(dr["ce_date"]).Value.ToString("yyyy-MM-dd"); } if (new MettingSys.BLL.permission().checkHasPermission(manager, "0402,0601")) { btnAudit.Visible = true; ddlflag.DataSource = Common.BusinessDict.checkStatus(); ddlflag.DataTextField = "value"; ddlflag.DataValueField = "key"; ddlflag.DataBind(); ddlflag.Items.Insert(0, new ListItem("请选择", "")); if (new BLL.permission().checkHasPermission(manager, "0402"))//财务审批 { ddlchecktype.SelectedValue = "1"; ddlflag.SelectedValue = dr["rp_flag"].ToString(); txtCheckRemark.Text = dr["rp_checkRemark"].ToString(); } else if (new BLL.permission().checkHasPermission(manager, "0601"))//总经理审批 { ddlchecktype.SelectedValue = "2"; ddlflag.SelectedValue = dr["rp_flag1"].ToString(); txtCheckRemark.Text = dr["rp_checkRemark1"].ToString(); } } } }
private void RptBind(string _strWhere, string _orderby) { if (!this.isSearch) { this.page = DTRequest.GetQueryInt("page", 1); } else { this.page = 1; } BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataTable dt = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount, out _tmoney, out _tunmoney).Tables[0]; this.rptList.DataSource = dt; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("selfReceipt_list.aspx", "page={0}&ddlmethod={1}&ddlisConfirm={2}&txtsforedate={3}&txteforedate={4}&txtsdate={5}&txtedate={6}&txtNum={7}&txtCusName={8}&hCusId={9}&txtChk={10}&txtNumDate={11}", "__id__", _method, _isconfirm, _sforedate, _eforedate, _sdate, _edate, _num, _cusName, _cid, _chk, _numdate); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); pCount.Text = dt.Rows.Count.ToString(); decimal _pmoney = 0, _punmoney = 0; if (dt != null) { foreach (DataRow dr in dt.Rows) { _pmoney += Utils.ObjToDecimal(dr["rp_money"], 0); _punmoney += Utils.ObjToDecimal(dr["undistribute"], 0); } } pMoney.Text = _pmoney.ToString(); pUnMoney.Text = _punmoney.ToString(); tCount.Text = totalCount.ToString(); tMoney.Text = _tmoney.ToString(); tUnMoney.Text = _tunmoney.ToString(); txtCusName.Text = _cusName; hCusId.Value = _cid; ddlmethod.SelectedValue = _method; ddlisConfirm.SelectedValue = _isconfirm; txtsforedate.Text = _sforedate; txteforedate.Text = _eforedate; txtsdate.Text = _sdate; txtedate.Text = _edate; txtNum.Text = _num; txtChk.Text = _chk; txtNumDate.Text = _numdate; }
protected void btnExcel_Click(object sender, EventArgs e) { _cusName = DTRequest.GetString("txtCusName"); _cid = DTRequest.GetString("hCusId"); _method = DTRequest.GetFormString("ddlmethod"); _check = DTRequest.GetFormString("ddlcheck"); _check2 = DTRequest.GetFormString("ddlcheck2"); _isconfirm = DTRequest.GetFormString("ddlisConfirm"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _num = DTRequest.GetFormString("txtNum"); _chk = DTRequest.GetFormString("txtChk"); _numdate = DTRequest.GetFormString("txtNumDate"); _sign = DTRequest.GetFormString("ddlsign"); _money = DTRequest.GetFormString("txtMoney"); _moneyType = DTRequest.GetFormString("ddlmoneyType"); _type = DTRequest.GetFormString("ddlType"); _addperson = DTRequest.GetFormString("txtAddPerson"); BLL.ReceiptPay bll = new BLL.ReceiptPay(); DataTable dt = bll.GetList(this.pageSize, this.page, "rp_type=0 " + CombSqlTxt(), "isnull(rp_date,'3000-01-01') desc,isnull(pm_sort,-1) asc,rp_id desc", out this.totalCount, out _tmoney, out _tunmoney, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=付款通知列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("付款对象"); headRow.CreateCell(1).SetCellValue("凭证"); headRow.CreateCell(2).SetCellValue("付款内容"); headRow.CreateCell(3).SetCellValue("客户银行账号"); headRow.CreateCell(4).SetCellValue("付款金额"); headRow.CreateCell(5).SetCellValue("未分配金额"); headRow.CreateCell(6).SetCellValue("预付日期"); headRow.CreateCell(7).SetCellValue("付款方式"); headRow.CreateCell(8).SetCellValue("实付日期"); headRow.CreateCell(9).SetCellValue("申请人"); headRow.CreateCell(10).SetCellValue("财务审批"); headRow.CreateCell(11).SetCellValue("总经理审批"); headRow.CreateCell(12).SetCellValue("确认收款"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; headRow.GetCell(9).CellStyle = titleCellStyle; headRow.GetCell(10).CellStyle = titleCellStyle; headRow.GetCell(11).CellStyle = titleCellStyle; headRow.GetCell(12).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 15 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); sheet.SetColumnWidth(9, 20 * 256); sheet.SetColumnWidth(10, 20 * 256); sheet.SetColumnWidth(11, 20 * 256); sheet.SetColumnWidth(12, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["c_name"].ToString() + (Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isExpect"]), false) ? "[预]" : "")); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["ce_num"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_content"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bankName"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bankNum"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bank"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_money"])); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["undistribute"])); row.CreateCell(6).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_foredate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"])); row.CreateCell(8).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_date"]) == null ? "" : ConvertHelper.toDate(dt.Rows[i]["rp_date"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(9).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_personName"])); row.CreateCell(10).SetCellValue(dt.Rows[i]["rp_flag"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(11).SetCellValue(dt.Rows[i]["rp_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag1"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(12).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isConfirm"]), false) ? "已收款" : "待收款"); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; row.GetCell(9).CellStyle = cellStyle; row.GetCell(10).CellStyle = cellStyle; row.GetCell(11).CellStyle = cellStyle; row.GetCell(12).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }