//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { PrintLoad(); ChkAdminLevel("sys_unBusiness_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.unBusinessApply bll = new BLL.unBusinessApply(); string result = ""; int success = 0, error = 0; StringBuilder sb = new StringBuilder(); manager = GetAdminInfo(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { result = bll.Delete(Convert.ToInt32(id), manager); if (result == "") { success++; //删除文件 if (Directory.Exists(Server.MapPath("~/uploadPay/2/" + id + "/"))) { Directory.Delete(Server.MapPath("~/uploadPay/2/" + id + "/"), true); } } else { error++; sb.Append(result + "<br/>"); } } } JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), Utils.CombUrlTxt("unBusinessPay_list.aspx", "page={0}&ddlcheck1={1}&ddlcheck2={2}&ddlcheck3={3}&ddlConfirm={4}&txtsforedate={5}&txteforedate={6}&txtsdate={7}&txtedate={8}&ddlarea={9}&ddltype={10}&txtfunction={11}&txtOwner={12}&ddlPayMethod1={13}&ddlsign={14}&txtmoney={15}&txtBankName={16}", "__id__", _check1, _check2, _check3, _payStatus, _sforedate, _eforedate, _sdate, _edate, _area, _type, _function, _owner, _method, _sign, _money, _bankName)); }
private void RptBind(string _strWhere, string _orderby) { if (!this.isSearch) { this.page = DTRequest.GetQueryInt("page", 1); } else { this.page = 1; } BLL.unBusinessApply bll = new BLL.unBusinessApply(); DataTable dt = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, manager, out this.totalCount, out _tmoney).Tables[0]; this.rptList.DataSource = dt; this.rptList.DataBind(); tCount.Text = totalCount.ToString(); pCount.Text = dt.Rows.Count.ToString(); decimal _pmoney = 0; if (dt != null) { foreach (DataRow dr in dt.Rows) { _pmoney += Utils.ObjToDecimal(dr["uba_money"], 0); } } pMoney.Text = _pmoney.ToString(); tMoney.Text = _tmoney.ToString(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = backUrl(); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); ddlchecktype.SelectedValue = this._check; ddlcheck1.SelectedValue = this._check1; ddlcheck2.SelectedValue = this._check2; ddlcheck3.SelectedValue = this._check3; ddlConfirm.SelectedValue = _payStatus; txtsforedate.Text = _sforedate; txteforedate.Text = _eforedate; txtsdate.Text = _sdate; txtedate.Text = _edate; ddlarea.SelectedValue = _area; ddltype.SelectedValue = _type; txtfunction.Text = _function; txtOwner.Text = _owner; ddlsign.SelectedValue = _sign; txtMoney.Text = _money; txtBankName.Text = _bankName; }
private void check_Status(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 //string ids = DTRequest.GetFormString("ids"); //string ctype = DTRequest.GetFormString("ctype"); //string cstatus = DTRequest.GetFormString("cstatus"); //string remark = DTRequest.GetFormString("remark"); //BLL.unBusinessApply bll = new BLL.unBusinessApply(); //string[] idlist = ids.Split(','); //int success = 0, error = 0; //StringBuilder sb = new StringBuilder(); //string reason = ""; //foreach (string id in idlist) //{ // reason = bll.checkStatus(Convert.ToInt32(id), Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), remark, adminModel); // if (string.IsNullOrEmpty(reason)) // { // success++; // } // else // { // error++; // sb.Append(reason + "<br/>"); // } //} //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + " }"); //context.Response.End(); int id = DTRequest.GetFormInt("id"); string ctype = DTRequest.GetFormString("ctype"); string cstatus = DTRequest.GetFormString("cstatus"); string checkMoney = DTRequest.GetFormString("checkMoney"); string remark = DTRequest.GetFormString("remark"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); StringBuilder sb = new StringBuilder(); string reason = bll.checkStatus(id, Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), checkMoney, remark, adminModel); if (string.IsNullOrEmpty(reason)) { context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); } else { context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }"); context.Response.End(); } }
private void confirm_Status(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 //string ids = DTRequest.GetFormString("ids"); //string status = DTRequest.GetFormString("status"); //string date = DTRequest.GetFormString("date"); //int method = Utils.StrToInt(DTRequest.GetFormString("method"), 0); //string methodName = DTRequest.GetFormString("methodName"); //BLL.unBusinessApply bll = new BLL.unBusinessApply(); //string[] idlist = ids.Split(','); //int success = 0, error = 0; //StringBuilder sb = new StringBuilder(); //string reason = ""; //foreach (string id in idlist) //{ // reason = bll.confirmStatus(Convert.ToInt32(id), status, date, method, methodName, adminModel); // if (string.IsNullOrEmpty(reason)) // { // success++; // } // else // { // error++; // sb.Append(reason + "<br/>"); // } //} //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + " }"); //context.Response.End(); int id = DTRequest.GetFormInt("id"); string status = DTRequest.GetFormString("status"); string date = DTRequest.GetFormString("date"); int method = Utils.StrToInt(DTRequest.GetFormString("method"), 0); string methodName = DTRequest.GetFormString("methodName"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); string reason = bll.confirmStatus(id, status, date, method, methodName, adminModel); if (string.IsNullOrEmpty(reason)) { context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); } else { context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }"); context.Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { _ubaid = DTRequest.GetInt("ubaid", 0); if (_ubaid == 0) { JscriptMsg("传输参数不正确!", "back"); return; } DataTable dt = new BLL.unBusinessApply().GetList(0, "uba_id=" + _ubaid + "", "uba_id").Tables[0]; if (dt == null || dt.Rows.Count == 0) { JscriptMsg("数据不存在!", "back"); return; } dr = dt.Rows[0]; manager = GetAdminInfo(); }
private void delete_Unbusiness(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 int id = DTRequest.GetFormInt("id"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); string result = bll.Delete(id, adminModel); if (!string.IsNullOrEmpty(result)) { context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":1 }"); context.Response.End(); } //删除文件 if (Directory.Exists(context.Server.MapPath("~/uploadPay/2/" + id + "/"))) { Directory.Delete(context.Server.MapPath("~/uploadPay/2/" + id + "/"), true); } context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); }
private void ShowInfo(string _oid) { rptEmployee0.Visible = false; liemployee0.Visible = false; BLL.Order bll = new BLL.Order(); DataSet ds = bll.GetList(0, "o_id='" + _oid + "'", "o_addDate desc"); if (ds == null || ds.Tables[0].Rows.Count == 0) { JscriptMsg("订单不存在!", ""); return; } DataRow dr = ds.Tables[0].Rows[0]; labOwner.Text = new MettingSys.BLL.department().getAreaText(dr["op_area"].ToString()) + "," + dr["op_number"] + "," + dr["op_name"]; txtCusName.Text = dr["c_name"].ToString(); hCusId.Value = dr["c_id"].ToString(); List <Model.Contacts> contactlist = new BLL.Contacts().getList("co_cid=" + hCusId.Value + "", " co_flag desc,co_id asc"); if (contactlist != null) { ddlcontact.DataSource = contactlist; ddlcontact.DataTextField = "co_name"; ddlcontact.DataValueField = "co_id"; ddlcontact.DataBind(); } ddlcontact.SelectedValue = dr["o_coid"].ToString(); txtPhone.Text = dr["co_number"].ToString(); ddlcontractPrice.SelectedValue = dr["o_contractPrice"].ToString(); txtsDate.Text = ConvertHelper.toDate(dr["o_sdate"]).Value.ToString("yyyy-MM-dd"); txteDate.Text = ConvertHelper.toDate(dr["o_edate"]).Value.ToString("yyyy-MM-dd"); txtAddress.Text = dr["o_address"].ToString(); txtContent.Text = dr["o_content"].ToString(); txtContract.Text = dr["o_contractContent"].ToString(); txtRemark.Text = dr["o_remarks"].ToString(); ddlfStatus.SelectedValue = dr["o_status"].ToString(); //ddldstatus.SelectedValue = dr["o_dstatus"].ToString(); ddlpushStatus.SelectedValue = dr["o_isPush"].ToString(); labFlag.Text = Common.BusinessDict.checkStatus()[Utils.ObjToByte(dr["o_flag"])]; ddlflag.SelectedValue = dr["o_flag"].ToString(); labLockStatus.Text = Common.BusinessDict.lockStatus()[Utils.ObjToByte(dr["o_lockStatus"])]; labfinanceCost.Text = dr["o_financeCust"].ToString(); txtCost.Text = dr["o_financeCust"].ToString(); finCost = Utils.StrToDecimal(dr["o_financeCust"].ToString(), 0); ddllockstatus.SelectedValue = dr["o_lockStatus"].ToString(); labFinRemarks.Text = dr["o_finRemarks"].ToString(); txtFinRemark.Text = dr["o_finRemarks"].ToString(); labStatusTime.Text = Utils.ObjectToStr(dr["o_statusTime"]) == "" ? "" : Utils.StrToDateTime(Utils.ObjectToStr(dr["o_statusTime"])).ToString("yyyy-MM-dd HH:mm:ss"); #region 归属地 string placeStr = dr["o_place"].ToString(); if (!string.IsNullOrEmpty(placeStr)) { Dictionary <string, string> areaDic = new BLL.department().getAreaDict(); Dictionary <string, string> orderAreaDic = new Dictionary <string, string>(); string[] list = placeStr.Split(','); foreach (string item in list) { if (areaDic.ContainsKey(item)) { orderAreaDic.Add(item, areaDic[item]); } } rptAreaList.DataSource = orderAreaDic; rptAreaList.DataBind(); } #endregion #region 人员 DataTable pdt = bll.GetPersonList(0, "op_oid='" + _oid + "'", "op_id asc").Tables[0]; if (pdt != null && pdt.Rows.Count > 0) { rptEmployee1.DataSource = pdt.Select("op_type=2"); rptEmployee1.DataBind(); rptEmployee2.DataSource = pdt.Select("op_type=3"); rptEmployee2.DataBind(); rptEmployee3.DataSource = pdt.Select("op_type=4"); rptEmployee3.DataBind(); rptEmployee4.DataSource = pdt.Select("op_type=5"); rptEmployee4.DataBind(); liplace.Visible = false; liemployee1.Visible = false; liemployee2.Visible = false; liemployee3.Visible = false; liemployee4.Visible = false; uploadDiv.Visible = false; uploadDiv2.Visible = false; btnSave.Visible = false; btnDstatus.Visible = false; btnFlag.Visible = false; btnLockstatus.Visible = false; btnUpdateCost.Visible = false; btnUnBusinessPay.Visible = false; btnReceiptPay.Visible = false; btnFinRemark.Visible = false; //btnPay.Visible = false; btnInvoince.Visible = false; //btnExcelIn.Visible = false; btnSharing.Visible = false; trFile.Visible = false; #region 根据当前登录账户显示不同按钮 DataRow[] drs1 = pdt.Select("op_type=1 and op_number='" + manager.user_name + "'"); //业务员 DataRow[] drs2 = pdt.Select("op_type=2 and op_number='" + manager.user_name + "'"); //业务报账人员 DataRow[] drs3 = pdt.Select("op_type=3 and op_number='" + manager.user_name + "'"); //业务策划人员 DataRow[] drs4 = pdt.Select("op_type=4 and op_number='" + manager.user_name + "'"); //业务执行人员 DataRow[] drs6 = pdt.Select("op_type=5 and op_number='" + manager.user_name + "'"); //业务设计人员 bool showDetail = false; if (drs4.Length > 0) { isExecutiver = true; showDetail = true; uploadDiv.Visible = true; btnUnBusinessPay.Visible = true; btnReceiptPay.Visible = true; //btnPay.Visible = true; btnInvoince.Visible = true; //btnExcelIn.Visible = true; } if (drs3.Length > 0 || drs6.Length > 0) { showDetail = true; uploadDiv.Visible = true; uploadDiv2.Visible = true; btnDstatus.Visible = true; trFile.Visible = true; if (drs3.Length > 0) { ddldstatus.SelectedValue = drs3[0]["op_dstatus"].ToString(); } else if (drs6.Length > 0) { ddldstatus.SelectedValue = drs6[0]["op_dstatus"].ToString(); } } if (drs2.Length > 0) { isExecutiver = false; showDetail = true; liplace.Visible = true; liemployee2.Visible = true; liemployee3.Visible = true; liemployee4.Visible = true; uploadDiv.Visible = true; uploadDiv2.Visible = true; btnUnBusinessPay.Visible = true; btnReceiptPay.Visible = true; btnSave.Visible = true; //btnPay.Visible = true; btnInvoince.Visible = true; //btnExcelIn.Visible = true; trFile.Visible = true; } if (drs1.Length > 0) { isExecutiver = false; showDetail = true; liplace.Visible = true; liemployee1.Visible = true; liemployee2.Visible = true; liemployee3.Visible = true; liemployee4.Visible = true; uploadDiv.Visible = true; uploadDiv2.Visible = true; btnSave.Visible = true; btnUnBusinessPay.Visible = true; btnReceiptPay.Visible = true; //btnPay.Visible = true; btnInvoince.Visible = true; //btnExcelIn.Visible = true; trFile.Visible = true; } DataRow[] drs5 = pdt.Select("op_type=1"); //判断是否含有查看本区域数据的权限 if (new BLL.permission().checkHasPermission(manager, "0602") && (drs5[0]["op_area"].ToString() == manager.area || Utils.ObjectToStr(dr["o_place"]).IndexOf(manager.area) > -1)) { showDetail = true; trFile.Visible = true; } string groupArea = new BLL.department().getGroupArea();//总部 //判断是否是本区域,且含有财务基本权限 if ((drs5[0]["op_area"].ToString() == manager.area || groupArea == manager.area) && new BLL.permission().checkHasPermission(manager, "0401")) { showDetail = true; trFile.Visible = true; btnUnBusinessPay.Visible = true; btnReceiptPay.Visible = true; uploadDiv2.Visible = true; //btnPay.Visible = true; btnInvoince.Visible = true; //btnExcelIn.Visible = true; } //判断是否含有查看本区域审批权限 if (drs5[0]["op_area"].ToString() == manager.area && new BLL.permission().checkHasPermission(manager, "0603")) { trFile.Visible = true; showDetail = true; btnFlag.Visible = true; } // if (groupArea == manager.area) { if (new BLL.permission().checkHasPermission(manager, "0401")) { showDetail = true; trFile.Visible = true; } if (new BLL.permission().checkHasPermission(manager, "0405")) { showDetail = true; btnLockstatus.Visible = true; btnUpdateCost.Visible = true; trFile.Visible = true; } } if (new BLL.permission().checkHasPermission(manager, "0401")) { btnFinRemark.Visible = true; if (!Utils.StrToBool(dr["o_lockStatus"].ToString(), false)) { btnSharing.Visible = true; } } //以上都没有权限的,不能查看订单详细 if (!showDetail) { string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\")"; Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>"); Response.End(); } #endregion } #endregion if (dr["o_lockStatus"].ToString() == "1") { liplace.Visible = false; liemployee1.Visible = false; liemployee2.Visible = false; liemployee3.Visible = false; liemployee4.Visible = false; uploadDiv.Visible = false; uploadDiv2.Visible = false; btnSave.Visible = false; btnDstatus.Visible = false; btnFlag.Visible = false; btnUpdateCost.Visible = false; btnUnBusinessPay.Visible = false; btnReceiptPay.Visible = false; //btnPay.Visible = false; btnInvoince.Visible = true; //btnExcelIn.Visible = false; } #region 活动文件 DataTable fdt = bll.GetFileList(0, "f_oid='" + _oid + "'", "f_addDate asc,f_id asc").Tables[0]; if (fdt != null && fdt.Rows.Count > 0) { rptAlbumList.DataSource = fdt.Select("f_type=1"); rptAlbumList.DataBind(); rptAlbumList2.DataSource = fdt.Select("f_type=2"); rptAlbumList2.DataBind(); } #endregion string sqlwhere = ""; #region 执行备用金借款明细 if (isExecutiver) { sqlwhere = " and uba_PersonNum='" + manager.user_name + "'"; } DataSet unBusinessData = new BLL.unBusinessApply().GetList(0, "uba_oid='" + _oid + "' " + sqlwhere + "", "uba_addDate desc,uba_id desc"); if (unBusinessData != null && unBusinessData.Tables[0].Rows.Count > 0) { rptunBusinessList.DataSource = unBusinessData; rptunBusinessList.DataBind(); } #endregion #region 应收付 DataTable natureData = new BLL.finance().getNature(_oid, isExecutiver ? manager.user_name : ""); if (natureData != null && natureData.Rows.Count > 0) { rptNature.DataSource = natureData; rptNature.DataBind(); } #endregion #region 发票 if (isExecutiver) { sqlwhere = " and inv_personNum='" + manager.user_name + "'"; } DataTable invoiceData = new BLL.invoices().GetList(0, "inv_oid='" + _oid + "' " + sqlwhere + "", "inv_addDate desc,inv_id desc").Tables[0]; if (invoiceData != null && invoiceData.Rows.Count > 0) { foreach (DataRow inv in invoiceData.Rows) { if (inv["inv_flag1"].ToString() != "1" && inv["inv_flag2"].ToString() != "1" && inv["inv_flag3"].ToString() != "1") { requestMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0); } if (Utils.StrToBool(inv["inv_isConfirm"].ToString(), false)) { confirmMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0); } } rptInvoiceList.DataSource = invoiceData; rptInvoiceList.DataBind(); } #endregion #region 已收付款 if (isExecutiver) { sqlwhere = " and rpd_personNum='" + manager.user_name + "'"; } DataTable rpData = new BLL.ReceiptPayDetail().GetList(0, "rpd_oid='" + _oid + "'", "rpd_type desc,rpd_adddate desc,rpd_id desc").Tables[0]; if (rpData != null && rpData.Rows.Count > 0) { rptList.DataSource = rpData; rptList.DataBind(); } #endregion #region 结算汇总 if (!isExecutiver)//执行人员不可查看 { DataTable collectData = bll.getOrderCollect(_oid); if (collectData != null && collectData.Rows.Count > 0) { foreach (DataRow inv in collectData.Rows) { finProfit += Utils.StrToDecimal(inv["profit"].ToString(), 0); if (inv["fin_type"].ToString() == "True") { fin1 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0); } else { fin0 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0); } } rptCollect.DataSource = collectData; rptCollect.DataBind(); } } #endregion }
private string DoEdit(int _id) { BLL.unBusinessApply bll = new BLL.unBusinessApply(); Model.unBusinessApply model = bll.GetModel(_id); string _content = string.Empty; manager = GetAdminInfo(); //支付用途 if (model.uba_type == 0) { if (model.uba_function != ddlfunction.SelectedValue) { _content += "支付用途:" + model.uba_function + "→<font color='red'>" + ddlfunction.SelectedValue + "</font><br/>"; } model.uba_function = ddlfunction.SelectedValue; } else { if (model.uba_function != txtfunction.Text.Trim()) { _content += "支付用途:" + model.uba_function + "→<font color='red'>" + txtfunction.Text.Trim() + "</font><br/>"; } model.uba_function = txtfunction.Text.Trim(); } //用途说明 if (model.uba_instruction != txtinstruction.Text.Trim()) { _content += "用途说明:" + model.uba_instruction + "→<font color='red'>" + txtinstruction.Text.Trim() + "</font><br/>"; } model.uba_instruction = txtinstruction.Text.Trim(); //收款银行 if (model.uba_receiveBank != txtbank.Text.Trim()) { _content += "收款银行:" + model.uba_receiveBank + "→<font color='red'>" + txtbank.Text.Trim() + "</font><br/>"; } model.uba_receiveBank = txtbank.Text.Trim(); //账户名称 if (model.uba_receiveBankName != txtbankname.Text.Trim()) { _content += "账户名称:" + model.uba_receiveBankName + "→<font color='red'>" + txtbankname.Text.Trim() + "</font><br/>"; } model.uba_receiveBankName = txtbankname.Text.Trim(); //收款账号 if (model.uba_receiveBankNum != txtbanknum.Text.Trim()) { _content += "收款账号:" + model.uba_receiveBankNum + "→<font color='red'>" + txtbanknum.Text.Trim() + "</font><br/>"; } model.uba_receiveBankNum = txtbanknum.Text.Trim(); //金额 if (model.uba_money != Convert.ToDecimal(txtmoney.Text)) { _content += "金额:" + model.uba_money + "→<font color='red'>" + txtmoney.Text.Trim() + "</font><br/>"; } model.uba_money = Convert.ToDecimal(txtmoney.Text); //预付日期 if (model.uba_foreDate != ConvertHelper.toDate(txtforedate.Text.Trim())) { _content += "预付日期:" + model.uba_foreDate.Value.ToString("yyyy-MM-dd") + "→<font color='red'>" + txtforedate.Text.Trim() + "</font><br/>"; } model.uba_foreDate = ConvertHelper.toDate(txtforedate.Text.Trim()); //备注 if (model.uba_remark != txtRemark.Text.Trim()) { _content += "备注:" + model.uba_remark + "→<font color='red'>" + txtRemark.Text.Trim() + "</font><br/>"; } model.uba_remark = txtRemark.Text.Trim(); return(bll.Update(model, _content.ToString(), manager)); }
private string DoAdd(out int id) { id = 0; Model.unBusinessApply model = new Model.unBusinessApply(); BLL.unBusinessApply bll = new BLL.unBusinessApply(); manager = GetAdminInfo(); model.uba_type = Utils.ObjToByte(ddltype.SelectedValue); if (string.IsNullOrWhiteSpace(fromOrder)) { if (model.uba_type == 0) { model.uba_function = ddlfunction.SelectedValue; } else { model.uba_function = txtfunction.Text.Trim(); } } else { model.uba_function = ddlfunction.SelectedValue; } if (model.uba_type == 0) { model.uba_oid = oID; } model.uba_instruction = txtinstruction.Text.Trim(); model.uba_receiveBank = txtbank.Text.Trim(); model.uba_receiveBankName = txtbankname.Text.Trim(); model.uba_receiveBankNum = txtbanknum.Text.Trim(); decimal _money = 0; if (!Decimal.TryParse(txtmoney.Text.Trim(), out _money)) { return("金额格式有误"); } model.uba_money = _money; model.uba_foreDate = ConvertHelper.toDate(txtforedate.Text.Trim()); model.uba_remark = txtRemark.Text.Trim(); model.uba_PersonNum = manager.user_name; model.uba_personName = manager.real_name; model.uba_area = manager.area; if (fileUp.HasFile) { string fileext = ""; for (int i = 0; i < fileUp.PostedFiles.Count; i++) { fileext = System.IO.Path.GetExtension(fileUp.PostedFiles[i].FileName).TrimStart('.');//jpg,jpge,png,gif //检查文件扩展名是否合法 if (!CheckFileExt(fileext)) { return("不允许上传" + fileext + "类型的文件"); } byte[] byteData = FileHelper.ConvertStreamToByteBuffer(fileUp.PostedFiles[i].InputStream); //获取文件流 //检查文件大小是否合法 if (!CheckFileSize(fileext, byteData.Length)) { return("文件超过限制的大小"); } } } return(bll.Add(model, manager, out id)); }
private void ShowInfo(int _id) { BLL.unBusinessApply bll = new BLL.unBusinessApply(); Model.unBusinessApply model = bll.GetModel(_id); manager = GetAdminInfo(); //ddltype.SelectedValue = model.uba_type.ToString(); ddltype.Visible = false; ddlfunction.Visible = false; txtfunction.Visible = false; btnAudit.Visible = false; labtype.Text = BusinessDict.unBusinessNature()[model.uba_type.Value]; if (model.uba_type == 0) { ddlfunction.Visible = true; if (model.uba_function == "业务活动执行备用金借款") { isShowCheckMoney = true; InitData(0); } else { InitData(1); } ddlfunction.SelectedValue = model.uba_function; } else { txtfunction.Visible = true; txtfunction.Text = model.uba_function; } txtinstruction.Text = model.uba_instruction; txtbank.Text = model.uba_receiveBank; txtbankname.Text = model.uba_receiveBankName; txtbanknum.Text = model.uba_receiveBankNum; txtmoney.Text = model.uba_money.ToString(); txtforedate.Text = model.uba_foreDate.Value.ToString("yyyy-MM-dd"); txtRemark.Text = model.uba_remark; rptAlbumList.DataSource = new BLL.payPic().GetList(2, "pp_type=2 and pp_rid=" + _id + "", "pp_addDate desc"); rptAlbumList.DataBind(); if ((manager.area == model.uba_area && new BLL.permission().checkHasPermission(manager, "0603")) || new 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, "0603"))//部门审批 { ddlchecktype.SelectedValue = "1"; ddlflag.SelectedValue = model.uba_flag1.ToString(); txtCheckRemark.Text = model.uba_checkRemark1; } else if (new BLL.permission().checkHasPermission(manager, "0402"))//财务审批 { ddlchecktype.SelectedValue = "2"; ddlflag.SelectedValue = model.uba_flag2.ToString(); txtCheckRemark.Text = model.uba_checkRemark2; } else if (new BLL.permission().checkHasPermission(manager, "0601"))//总经理审批 { ddlchecktype.SelectedValue = "3"; ddlflag.SelectedValue = model.uba_flag3.ToString(); txtCheckRemark.Text = model.uba_checkRemark3; } } }
protected void btnExcel_Click(object sender, EventArgs e) { _check = DTRequest.GetFormString("check"); _check1 = DTRequest.GetFormString("ddlcheck1"); _check2 = DTRequest.GetFormString("ddlcheck2"); _check3 = DTRequest.GetFormString("ddlcheck3"); _payStatus = DTRequest.GetFormString("ddlConfirm"); _sforedate = DTRequest.GetFormString("txtsforedate"); _eforedate = DTRequest.GetFormString("txteforedate"); _sdate = DTRequest.GetFormString("txtsdate"); _edate = DTRequest.GetFormString("txtedate"); _area = DTRequest.GetFormString("ddlarea"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); DataTable dt = bll.GetList(this.pageSize, this.page, "uba_id>0" + CombSqlTxt(), "isnull(uba_date,'3000-01-01') desc,isnull(pm_sort,-1) asc,uba_id desc", manager, out this.totalCount, out _tmoney, 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.CreateCell(13).SetCellValue("财务审批"); headRow.CreateCell(14).SetCellValue("总经理审批"); headRow.CreateCell(15).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; headRow.GetCell(13).CellStyle = titleCellStyle; headRow.GetCell(14).CellStyle = titleCellStyle; headRow.GetCell(15).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, 15 * 256); sheet.SetColumnWidth(11, 20 * 256); sheet.SetColumnWidth(12, 20 * 256); sheet.SetColumnWidth(13, 20 * 256); sheet.SetColumnWidth(14, 20 * 256); sheet.SetColumnWidth(15, 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(BusinessDict.unBusinessNature()[Utils.ObjToByte(dt.Rows[i]["uba_type"])]); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_function"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_oid"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_instruction"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBankName"])); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBankNum"])); row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBank"])); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_money"])); row.CreateCell(8).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["uba_foreDate"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(9).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["uba_Date"]) == null?"":ConvertHelper.toDate(dt.Rows[i]["uba_Date"]).Value.ToString("yyyy-MM-dd")); row.CreateCell(10).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"])); row.CreateCell(11).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_personName"])); row.CreateCell(12).SetCellValue(dt.Rows[i]["uba_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag1"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(13).SetCellValue(dt.Rows[i]["uba_flag2"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag2"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(14).SetCellValue(dt.Rows[i]["uba_flag3"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag3"].ToString() == "1" ? "审批未通过" : "审批通过"); row.CreateCell(15).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["uba_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; row.GetCell(13).CellStyle = cellStyle; row.GetCell(14).CellStyle = cellStyle; row.GetCell(15).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }