using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DSWeb.Areas.Account.Models.Chfee_do_detail; using DSWeb.Areas.Account.DAL.Chfee_Payapplication; using DSWeb.Areas.Mobile.Models.Common; using System.Text; using DSWeb.Areas.Mobile.DAL; using Microsoft.Practices.EnterpriseLibrary.Data; using System.Data; using DSWeb.Areas.Mobile.Models.Login; using DSWeb.Areas.Account.Models.Chfee_Payapplication; using DSWeb.Areas.Account.Models.Chfee_payapplication; using DSWeb.Areas.Account.DAL.Chfee_payapplication; namespace DSWeb.Areas.Mobile.Views.Approval { /// /// 付费审批-审批页面 /// public partial class FFSPDetails : System.Web.Mvc.ViewPage { public PageContentModel model = new PageContentModel(); public string _MAINSTR = ""; public string _BILLNO = ""; public int _BILLSTATUS = 0; public string _BILLSTATUSNAME = ""; public User _User; protected void Page_Load ( object sender, EventArgs e ) { string billno = Request.QueryString["billno"]; _BILLNO = billno; if (billno != "") { SetBillStatus(); SetupHtml(); } hdbillno.Value = _BILLNO; hduid.Value = _User.uid; hdbillstatus.Value = _BILLSTATUS.ToString(); } private void SetupHtml () { //获取用户信息 string openid = Request.QueryString["openid"] != null ? Request.QueryString["openid"] : ""; _User = LoginDAL.GetUserWithOpenId(openid); //获取当前审核人userid List mapdata = FlowMapDal.GetMap(_BILLNO); //获取审批人的UserID List listUid = new List(); foreach (FlowMapModel flow in mapdata) { foreach (FlowMapActionModel fa in flow.Acts) { if (fa.IsCurr == 1 && fa.UserID != "" && fa.OperOpenId != "") { //需要发送用户的openid集合 listUid.Add(fa.OperOpenId); } } } //设置头部 string statusStr = ""; if (_BILLSTATUSNAME!="") { statusStr=" 【"+_BILLSTATUSNAME+"】"; } model.header = "付费审批:" + _BILLNO + statusStr; //获取审批主数据 string conditionM = "i.BILLNO = '"+_BILLNO+"'"; var dataList = ChpayapplicationDAL.GetAuditDataList(conditionM, _User.uid, "", _User.codename, _User.comid); DBLog.Log("获取审批主数据", "dataList.count", dataList.Count.ToString()); DBLog.Log("获取审批主数据", "_User", _User.uid+_User.codename+_User.comid); StringBuilder sbMain = new StringBuilder(); if (dataList.Count>0) { ChPayapplication cp = dataList[0]; //申请单号 sbMain.Append("
  • 申请单号:"+cp.BILLNO+"
  • "); //结算单位 sbMain.Append("
  • 结算单位:"+cp.CUSTOMERNAME+"
  • "); //RMB sbMain.Append("
  • RMB:"+cp.AMOUNTRMB+"
  • "); //USD sbMain.Append("
  • USD:"+cp.AMOUNTUSD+"
  • "); //其他 sbMain.Append("
  • 其他:"+cp.AMOUNTOT+"
  • "); //申请日期 sbMain.Append("
  • 申请日期:"+cp.APPLYTIME+"
  • "); //申请人 sbMain.Append("
  • 申请人:"+cp.APPLICANTNAME+"
  • "); //申请支付日期 sbMain.Append("
  • 申请支付日期:"+cp.PAYABLETIME+"
  • "); //委托单位 sbMain.Append("
  • 委托单位:"+cp.BS_CUSTOMERNAME+"
  • "); //备注 sbMain.Append("
  • 备注:"+cp.REMARK+"
  • "); } else { sbMain.Append("没有权限!"); model.header = sbMain.ToString(); model.content = ""; model.footer = "
  • 返回
  • "; return; } _MAINSTR = sbMain.ToString(); //获取审批的明细 string condition = "BILLNO = '" + _BILLNO + "'"; List list = new List(); list= ChpayapplicationDAL.GetBodyAuditList(0,50,condition); StringBuilder sb = new StringBuilder(); foreach (Chfee_do_detail fee in list) { //费用名称 sb.Append("
  • "); sb.Append(fee.FEENAME); sb.Append("
  • "); //主提单号 sb.Append("
  • "); sb.Append("主提单号:"+fee.MBLNO); sb.Append("
  • "); //委托单位 sb.Append("
  • "); sb.Append("委托单位:"+fee.CUSTOMERNAME); sb.Append("
  • "); //核销金额 sb.Append("
  • "); sb.Append("核销金额:"+fee.AMOUNT); sb.Append("
  • "); //原始金额 sb.Append("
  • "); sb.Append("原始金额:"+fee.ORIGAMOUNT); sb.Append("
  • "); //原始币别 sb.Append("
  • "); sb.Append("原始币别:" + fee.ORIGCURRENCY); sb.Append("
  • "); //原始汇率 sb.Append("
  • "); sb.Append("原始汇率:"+fee.ORIGEXCHANGERATE); sb.Append("
  • "); //开船日期 sb.Append("
  • "); sb.Append("开船日期:" + fee.ETD); sb.Append("
  • "); } model.content = sb.ToString(); //页脚按钮 StringBuilder sbFooter = new StringBuilder(); //提交审核状态 if (_BILLSTATUS==2) { sbFooter.Append("
  • 返回
  • "); //判断当前登录用户是否是当前流程审批的用户 if (listUid.Contains(_User.openid)) { sbFooter.Append("
  • 通过
  • "); sbFooter.Append("
  • 驳回
  • "); } } //驳回状态 else if (_BILLSTATUS == 6) { sbFooter.Append("
  • 返回
  • "); } //审核通过状态 else if (_BILLSTATUS == 0) { sbFooter.Append("
  • 返回
  • "); sbFooter.Append("
  • 驳回
  • "); } //其他状态 else { sbFooter.Append("
  • 返回
  • "); } model.footer = sbFooter.ToString(); } private void SetBillStatus ( ) { string sql = @" select cf.BILLSTATUS,ev.EnumValueName from ch_fee_payapplication cf LEFT JOIN tSysEnumValue ev ON cf.BILLSTATUS = ev.EnumValueID AND ev.EnumTypeID = 99024 WHERE cf.billno = '"+_BILLNO+"'"; Database db = DatabaseFactory.CreateDatabase(); var rst = db.ExecuteReader(CommandType.Text, sql); int status = 0; string statusName = ""; using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql)) { while (reader.Read()) { var statusRst = reader["BILLSTATUS"]; if (statusRst!=null&&statusRst!=DBNull.Value) { status = Convert.ToInt32(statusRst); } var statusNameRst = reader["EnumValueName"]; if (statusNameRst != null && statusNameRst != DBNull.Value) { statusName = statusNameRst.ToString(); } } } _BILLSTATUS= status; _BILLSTATUSNAME = statusName; } } }