You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
8.8 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
{
/// <summary>
/// 付费审批-审批页面
/// </summary>
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<FlowMapModel> mapdata = FlowMapDal.GetMap(_BILLNO);
//获取审批人的UserID
List<string> listUid = new List<string>();
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("<li>申请单号:"+cp.BILLNO+"</li>");
//结算单位
sbMain.Append("<li>结算单位:"+cp.CUSTOMERNAME+"</li>");
//RMB
sbMain.Append("<li>RMB"+cp.AMOUNTRMB+"</li>");
//USD
sbMain.Append("<li>USD"+cp.AMOUNTUSD+"</li>");
//其他
sbMain.Append("<li>其他:"+cp.AMOUNTOT+"</li>");
//申请日期
sbMain.Append("<li>申请日期:"+cp.APPLYTIME+"</li>");
//申请人
sbMain.Append("<li>申请人:"+cp.APPLICANTNAME+"</li>");
//申请支付日期
sbMain.Append("<li>申请支付日期:"+cp.PAYABLETIME+"</li>");
//委托单位
sbMain.Append("<li>委托单位:"+cp.BS_CUSTOMERNAME+"</li>");
//备注
sbMain.Append("<li>备注:"+cp.REMARK+"</li>");
}
else
{
sbMain.Append("没有权限!");
model.header = sbMain.ToString();
model.content = "";
model.footer = "<li><a href=\"#\" data-icon=\"minus\" id=\"btnBack\">返回</a></li>";
return;
}
_MAINSTR = sbMain.ToString();
//获取审批的明细
string condition = "BILLNO = '" + _BILLNO + "'";
List<Chfee_do_detail> list = new List<Chfee_do_detail>();
list= ChpayapplicationDAL.GetBodyAuditList(condition,"0");
StringBuilder sb = new StringBuilder();
foreach (Chfee_do_detail fee in list)
{
//费用名称
sb.Append("<li data-role=\"list-divider\" style=\"font-size:18px\">");
sb.Append(fee.FEENAME);
sb.Append("</li>");
//主提单号
sb.Append("<li>");
sb.Append("主提单号:"+fee.MBLNO);
sb.Append("</li>");
//委托单位
sb.Append("<li>");
sb.Append("委托单位:"+fee.CUSTOMERNAME);
sb.Append("</li>");
//核销金额
sb.Append("<li>");
sb.Append("核销金额:"+fee.AMOUNT);
sb.Append("</li>");
//原始金额
sb.Append("<li>");
sb.Append("原始金额:"+fee.ORIGAMOUNT);
sb.Append("</li>");
//原始币别
sb.Append("<li>");
sb.Append("原始币别:" + fee.ORIGCURRENCY);
sb.Append("</li>");
//原始汇率
sb.Append("<li>");
sb.Append("原始汇率:"+fee.ORIGEXCHANGERATE);
sb.Append("</li>");
//开船日期
sb.Append("<li>");
sb.Append("开船日期:" + fee.ETD);
sb.Append("</li>");
}
model.content = sb.ToString();
//页脚按钮
StringBuilder sbFooter = new StringBuilder();
//提交审核状态
if (_BILLSTATUS==2)
{
sbFooter.Append("<li><a href=\"#\" data-icon=\"minus\" id=\"btnBack\">返回</a></li>");
//判断当前登录用户是否是当前流程审批的用户
if (listUid.Contains(_User.openid))
{
sbFooter.Append("<li><a href=\"#pagethree\" data-icon=\"check\" id=\"btnOK\">通过</a></li>");
sbFooter.Append("<li><a href=\"#pagethree\" data-icon=\"delete\" id=\"btnNO\">驳回</a></li>");
}
}
//驳回状态
else if (_BILLSTATUS == 6) {
sbFooter.Append("<li><a href=\"#\" data-icon=\"minus\" id=\"btnBack\">返回</a></li>");
}
//审核通过状态
else if (_BILLSTATUS == 0) {
sbFooter.Append("<li><a href=\"#\" data-icon=\"minus\" id=\"btnBack\">返回</a></li>");
sbFooter.Append("<li><a href=\"#pagethree\" data-icon=\"delete\" id=\"btnNO\">驳回</a></li>");
}
//其他状态
else
{
sbFooter.Append("<li><a href=\"#\" data-icon=\"minus\" id=\"btnBack\">返回</a></li>");
}
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;
}
}
}