|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Security;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using DSWeb.Authority;
|
|
|
|
|
using DSWeb.Log;
|
|
|
|
|
using DSWeb.WorkFlow;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Settlements
|
|
|
|
|
{
|
|
|
|
|
public partial class RecvSettlementGridSource : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
private string strHandle;//值为recvapp表示获取收费申请列表值
|
|
|
|
|
private string strBillNO;//申请业务编号
|
|
|
|
|
//private string strAppGID;//申请收费GID
|
|
|
|
|
private string strSearch;//查询条件
|
|
|
|
|
private int iCurrentPage;//当前页数
|
|
|
|
|
private int iShowPage;//显示最大页数
|
|
|
|
|
private string strUserID;
|
|
|
|
|
private string strCompanyID;//公司GID
|
|
|
|
|
private string strShowName;//用户显示名
|
|
|
|
|
private string strDeptName;//部门名称
|
|
|
|
|
private string strRunSettleGID;//运行结算表GID
|
|
|
|
|
private string strPaySettleAppGID;//收费申请GID
|
|
|
|
|
private string strPaySettleGID;//收费结算GID
|
|
|
|
|
private string stroplb;//业务类别
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Request.QueryString["handle"] != null)
|
|
|
|
|
{
|
|
|
|
|
strHandle = Request.QueryString["handle"].ToString().Trim().ToLower();
|
|
|
|
|
}
|
|
|
|
|
if (Session["USERID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strUserID = Session["USERID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["billno"] != null)
|
|
|
|
|
{
|
|
|
|
|
strBillNO = Request.QueryString["billno"].ToString();
|
|
|
|
|
}
|
|
|
|
|
//if (Request.QueryString["id"] != null)
|
|
|
|
|
//{
|
|
|
|
|
// strAppGID = Request.QueryString["id"].ToString();
|
|
|
|
|
//}
|
|
|
|
|
if (Request.QueryString["oplb"] != null)
|
|
|
|
|
{
|
|
|
|
|
stroplb = Request.QueryString["oplb"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["search"] != null)
|
|
|
|
|
{
|
|
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
|
|
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["cur_page"] != null)
|
|
|
|
|
{
|
|
|
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iCurrentPage = 0;
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["show_page"] != null)
|
|
|
|
|
{
|
|
|
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iShowPage = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Request.QueryString["runsettleid"] != null)
|
|
|
|
|
{
|
|
|
|
|
strRunSettleGID = Request.QueryString["runsettleid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Request.QueryString["id"] != null)
|
|
|
|
|
{
|
|
|
|
|
strPaySettleAppGID = Request.QueryString["id"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(Request.QueryString["paysettleid"] != null)
|
|
|
|
|
{
|
|
|
|
|
strPaySettleGID = Request.QueryString["paysettleid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle != null)
|
|
|
|
|
{
|
|
|
|
|
//获取收费申请列表信息
|
|
|
|
|
if (strHandle.Equals("recvapp"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetRecvApplicationList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//获取收费申请列表页码信息
|
|
|
|
|
if (strHandle.Equals("recvapppage"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetRecvApplicationListPageCount());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//验证用户是否操作收费申请列表的权限
|
|
|
|
|
if (strHandle == "validatepaysettleapp")
|
|
|
|
|
{
|
|
|
|
|
Response.Write(ValidateUserRecvSettleApplicationAuthority());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//驳回收费申请
|
|
|
|
|
if (strHandle == "auditreject" && strBillNO != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(FeeRecvApplicationAuditReject(strBillNO).ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
//获取收费申请结算信息
|
|
|
|
|
if (strHandle.Equals("paysettle"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetPaySettleApplicationList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//获取收费结算信息
|
|
|
|
|
if (strHandle.Equals("paysettlelist"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetPaySettlementList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "paysettlelistpage")
|
|
|
|
|
{
|
|
|
|
|
//获取收费结算分页总页数
|
|
|
|
|
Response.Write(GetPaySettlementPageCount());
|
|
|
|
|
}
|
|
|
|
|
//获取收费结算信息导出
|
|
|
|
|
if (strHandle.Equals("paysettlelistexcel"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetPaySettlementListExcel());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle.Equals("recvappsettlelist"))
|
|
|
|
|
{
|
|
|
|
|
//在收费申请结算时,获取收费申请审核后的信息
|
|
|
|
|
Response.Write(GetRecvApplicationSettleList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//获取收款申请审核信息
|
|
|
|
|
if (strHandle.Equals("payappauditlist") && strUserID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetPayApplyAuditList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle.Equals("payappauditlistpage"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(GetPayApplyAuditListPageCount());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "validaterecvsettlement")
|
|
|
|
|
{
|
|
|
|
|
Response.Write(ValidateUserRecvSettleAuthority());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle == "postsavedapp" && strRunSettleGID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(PostSavedPaySettleApplication(strRunSettleGID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle == "repostpayapp" && strPaySettleAppGID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(RePostRejectPaySettleApplication(strPaySettleAppGID));
|
|
|
|
|
}
|
|
|
|
|
//删除未结算收费信息
|
|
|
|
|
if (strHandle == "deleteunsavedpaysettle" && strRunSettleGID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(DeleteSavedUnSettlePay(strRunSettleGID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle == "postunsavedpaysettle" && strRunSettleGID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(PostSavePaySettle(strRunSettleGID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle == "cancelpaysettle" && strPaySettleGID != null)
|
|
|
|
|
{
|
|
|
|
|
Response.Write(CacelPaySettle(strPaySettleGID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strHandle == "issettled")
|
|
|
|
|
{
|
|
|
|
|
//查看申请收费是否已经结算过了
|
|
|
|
|
Response.Write(IsFeeRecvApplicationSettled(strBillNO));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#region 获取收费申请列表信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费申请列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetRecvApplicationList()
|
|
|
|
|
{
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strTopInclude = "";
|
|
|
|
|
string strTopNotInclude = "";
|
|
|
|
|
string strSearchSettle = " AND BILLSTATUS <> 4 ";
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,20) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,20) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "blno"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO in (select BILLNO from ch_fee_do where bsno in (select bsno from VW_Settlement where (CUSTNO LIKE '%{0}%' or MBLNO LIKE '%{0}%' or HBLNO LIKE '%{0}%' or CUSTOMNO LIKE '%{0}%' OR CUSTOMNO2 LIKE '%{0}%'))))", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "billstatus":
|
|
|
|
|
string strbillstatus = strArg[1].Replace("\"", "");
|
|
|
|
|
if (strbillstatus.Trim() != "7" && strbillstatus.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strSearchSettle = "";
|
|
|
|
|
}
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleAppList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLEAPPLIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string strSql = "";
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
|
|
{
|
|
|
|
|
if (iCurrentPage == 1)
|
|
|
|
|
{
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB"
|
|
|
|
|
+ ",(select top 1 SHOWNAME from [user] where gid=a.APPLICANT) AS APPLICANT"
|
|
|
|
|
+ ",A.APPLYTIME,dbo.F_JSDH(A.billno),replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK"
|
|
|
|
|
+ ",(select top 1 OPLB from VW_Settlement where bsno in (select bsno from ch_fee_do where billno=a.billno)) AS OPLB"
|
|
|
|
|
+ " FROM ch_fee_recvapplication as A "
|
|
|
|
|
+ " WHERE 1>0 {1} {2} {3} "
|
|
|
|
|
+ " ORDER BY A.BILLNO DESC "
|
|
|
|
|
, "top " + iShowPage.ToString(), strSearchSettle, strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB"
|
|
|
|
|
+ ",(select top 1 SHOWNAME from [user] where gid=a.APPLICANT) AS APPLICANT"
|
|
|
|
|
+ ",A.APPLYTIME,dbo.F_JSDH(A.billno),replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK"
|
|
|
|
|
+ ",(select top 1 OPLB from VW_Settlement where bsno in (select bsno from ch_fee_do where billno=a.billno)) AS OPLB"
|
|
|
|
|
+ " FROM ch_fee_recvapplication as A "
|
|
|
|
|
+ " WHERE 1>0 {2} AND A.GID NOT IN "
|
|
|
|
|
+ " (SELECT {1} GID FROM ch_fee_recvapplication A WHERE 1>0 {2} {3} {4} ORDER BY BILLNO DESC ) {3} {4} "
|
|
|
|
|
+ " ORDER BY A.BILLNO DESC "
|
|
|
|
|
, strTopInclude, strTopNotInclude, strSearchSettle, strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB"
|
|
|
|
|
+ ",(select top 1 SHOWNAME from [user] where gid=a.APPLICANT) AS APPLICANT"
|
|
|
|
|
+ ",A.APPLYTIME,dbo.F_JSDH(A.billno),replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK"
|
|
|
|
|
+ ",(select top 1 OPLB from VW_Settlement where bsno in (select bsno from ch_fee_do where billno=a.billno)) AS OPLB"
|
|
|
|
|
+ " FROM ch_fee_recvapplication as A WHERE 1<0";
|
|
|
|
|
}
|
|
|
|
|
sourceTable = getStatusNameTableBillStatus(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0]);
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
|
|
//
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取收费申请列表分页总页数信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费申请列表分页总页数信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回总页数</returns>
|
|
|
|
|
private int GetRecvApplicationListPageCount()
|
|
|
|
|
{
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
string strSql = "SELECT COUNT(*) FROM ch_fee_recvapplication as A WHERE BILLNO LIKE '%AC%' ";
|
|
|
|
|
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
string strSearchSettle = " AND A.BILLSTATUS <> 4 ";
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleAppList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLEAPPLIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
|
|
strSql += strAuthorityCondition;
|
|
|
|
|
}
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,20) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,20) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "blno"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO in (select BILLNO from ch_fee_do where bsno in (select bsno from VW_Settlement where (CUSTNO LIKE '%{0}%' or MBLNO LIKE '%{0}%' or HBLNO LIKE '%{0}%' or CUSTOMNO LIKE '%{0}%' OR CUSTOMNO2 LIKE '%{0}%'))))", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "billstatus":
|
|
|
|
|
string strbillstatus = strArg[1].Replace("\"", "");
|
|
|
|
|
if (strbillstatus.Trim() != "7" && strbillstatus.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strSearchSettle = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
strSql += strSearchSettle + strCondition;
|
|
|
|
|
int iTotal = int.Parse(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
|
|
return iTotal;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 验证用户是否操作收费申请列表的权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 验证用户是否操作收费申请列表的权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>值1表示有权限操作收费申请 值不等于1表示没有权限操作收费申请</returns>
|
|
|
|
|
private int ValidateUserRecvSettleApplicationAuthority()
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleAppList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL && userAuthorityManage.OperateType != AuthorityType.NONE)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 驳回收费申请
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 驳回收费申请
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempBillNO">申请编号</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int FeeRecvApplicationAuditReject(string tempBillNO)
|
|
|
|
|
{
|
|
|
|
|
FeeDoDA feeDoDA = new FeeDoDA();
|
|
|
|
|
IList<FeeDoEntity> feeDoEntities = new List<FeeDoEntity>();
|
|
|
|
|
feeDoEntities = feeDoDA.GetFeeDoByBillNO(tempBillNO);
|
|
|
|
|
ChFeeRecvApplicationDA ChFeeRecvApplicationDA = new ChFeeRecvApplicationDA();
|
|
|
|
|
int iResult = ChFeeRecvApplicationDA.FeeRecvApplicationAuditReject(feeDoEntities, tempBillNO, strCompanyID);
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#region 获取收费申请审核总页数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费申请审核总页数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回总页数</returns>
|
|
|
|
|
public int GetPayApplyAuditListPageCount()
|
|
|
|
|
{
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
string strSql = String.Format(" SELECT COUNT(*) FROM ch_fee_recvapplication as A "
|
|
|
|
|
+ " WHERE BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') ", strUserID);
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),APPLYTIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),APPLYTIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "billstatus":
|
|
|
|
|
string strbillstatus = strArg[1].Replace("\"", "");
|
|
|
|
|
if (strbillstatus.Trim() != "7" && strbillstatus.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition += " AND A.billstatus=3 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition += " AND A.billstatus=3 ";
|
|
|
|
|
}
|
|
|
|
|
strSql += strCondition;
|
|
|
|
|
//
|
|
|
|
|
int iTotal = int.Parse(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
|
|
|
|
|
|
|
return iTotal;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 验证用户是否操作收费结算的权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 验证用户是否操作收费结算的权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>值1表示有权限操作收费结算 值不等于1表示没有权限操作收费结算</returns>
|
|
|
|
|
private int ValidateUserRecvSettleAuthority()
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL && userAuthorityManage.OperateType != AuthorityType.NONE)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取收费结算分页总页数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费结算分页总页数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回总页数</returns>
|
|
|
|
|
private int GetPaySettlementPageCount()
|
|
|
|
|
{
|
|
|
|
|
//获取分公司的票号头字符
|
|
|
|
|
//T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
//string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
|
|
|
|
|
//string strFeeType = tempBANKSHEAD + "CR";
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
string strSql = "SELECT COUNT(*) FROM ch_fee_settlement as A WHERE BILLNO LIKE '%CR%' AND ISNULL(ISDELETE,0) <> 1 ";
|
|
|
|
|
|
|
|
|
|
string strAmount1 = "";
|
|
|
|
|
string strAmount2 = "";
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLELIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
|
|
strSql += strAuthorityCondition;
|
|
|
|
|
}
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),SETTLETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),SETTLETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
//strCondition += String.Format(" AND BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO LIKE '%{0}%' or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where CHEQUENUM LIKE '%{0}%') and BILLNO LIKE '%CR%') or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where bsno in (select bsno from VW_Settlement where MBLNO LIKE '%{0}%')) and BILLNO LIKE '%CR%')) ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "amount1"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount1 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
case "amount2"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB <= '{0}' or A.AMOUNTUSD <= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount2 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strAmount1.Trim() != "" && strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND ((A.AMOUNTRMB >= '{0}' and A.AMOUNTRMB <= '{1}') or (A.AMOUNTUSD >= '{0}' and A.AMOUNTUSD <= '{1}'))", strAmount1.Trim(), strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (strAmount1.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strAmount1.Trim());
|
|
|
|
|
}
|
|
|
|
|
else if (strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB <= '{1}' or A.AMOUNTUSD <= '{1}')", strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
strSql += strCondition;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int iTotal = int.Parse(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
|
|
|
|
|
|
|
return iTotal;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 在收费申请结算时,获取收费申请审核后的信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在收费申请结算时,获取收费申请审核后的信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetRecvApplicationSettleList()
|
|
|
|
|
{
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus":
|
|
|
|
|
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no":
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO LIKE '%{0}%' or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where CHEQUENUM LIKE '%{0}%')) or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where bsno in (select bsno from VW_Settlement where MBLNO LIKE '%{0}%')))) ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string strSql = " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.SETTLETYPE,A.AMOUNTUSD-isnull(A.SETTLEUSD,0) as AMOUNTUSD,(A.AMOUNTRMB-isnull(A.SETTLERMB,0)) as AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ ",OPLB=(SELECT top 1 OPLB FROM VW_Settlement WHERE BSNO=(SELECT top 1 C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID WHERE A.BILLSTATUS <> 3 AND A.BILLSTATUS <> 6 AND A.BILLSTATUS <> 4 "
|
|
|
|
|
//1-Begin 修改2014-02-20
|
|
|
|
|
//+ " AND ( EXISTS (select 1 from ch_fee_do d1 where "
|
|
|
|
|
//+ " NOT EXISTS (select 1 from ch_fee_do d2 where d2.BILLNO like '%CR%' and d2.AMOUNT=d2.DOAMOUNT and (d2.ISDELETED=0 or d2.ISDELETED is null) and d1.FEEID=d2.FEEID) "
|
|
|
|
|
//+ " and A.BILLNO=d1.BILLNO "
|
|
|
|
|
//+ " and billno NOT in (select billno from ch_fee_do as d3 where feeid in (select feeid from ch_fee_do as d2 where (d2.BILLNO like '%CR%' or d2.BILLNO like '%DR%') and d2.AMOUNT=d2.DOAMOUNT and (d2.ISDELETED=0 or d2.ISDELETED is null) and (CATEGORY=2 or CATEGORY=8)))"
|
|
|
|
|
//+ ")) "
|
|
|
|
|
//1-End
|
|
|
|
|
//1-Begin 修改2014-03-03
|
|
|
|
|
+ " AND (EXISTS (select gid from ch_fee_do d1 where NOT EXISTS (select f.gid from (select feeid,sum(AMOUNT) as AMOUNT from (select feeid,AMOUNT from ch_fee_do where (billno like '%CR%' or billno like '%DR%') and (ISDELETED is null or ISDELETED=0) and AMOUNT=DOAMOUNT) as a group by a.feeid) as d LEFT OUTER JOIN ch_fee as f on f.gid=d.feeid where f.AMOUNT=d.AMOUNT and d1.FEEID=f.gid) and A.BILLNO=d1.BILLNO)) "
|
|
|
|
|
//1-End
|
|
|
|
|
+ strCondition
|
|
|
|
|
+ " ORDER BY A.APPLYTIME DESC ";
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
sourceTable = getStatusNameTableBillStatus(T_ALL_DA.GetExcuteSql(strSql).Tables[0]);
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
|
|
//
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public string GetPayApplyAuditList()
|
|
|
|
|
{
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strTopInclude = "";
|
|
|
|
|
string strTopNotInclude = "";
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
//strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO LIKE '%{0}%' or A.BILLNO in (SELECT AA.BILLNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID where C.bsno in (SELECT bsno FROM VW_Settlement where mblno like '%{0}%')))", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "billstatus":
|
|
|
|
|
string strbillstatus = strArg[1].Replace("\"", "");
|
|
|
|
|
if(strbillstatus.Trim()!="7" && strbillstatus.Trim()!="")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition += " AND A.billstatus=3 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition += " AND A.billstatus=3 ";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
string strSql = "";
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
|
|
{
|
|
|
|
|
if (iCurrentPage == 1)
|
|
|
|
|
{
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " WHERE BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{1}') "
|
|
|
|
|
// + strCondition + " ORDER BY BILLNO DESC ", "top " + iShowPage.ToString(), strUserID);
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seae' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seae as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{1}') {2} "
|
|
|
|
|
// //+ " ORDER BY BILLNO DESC "
|
|
|
|
|
// + " union all "
|
|
|
|
|
// + " SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seai' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seai as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{1}') {2} "
|
|
|
|
|
// + " ORDER BY BILLNO DESC "
|
|
|
|
|
// , "top " + iShowPage.ToString(), strUserID,strCondition);
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
// + ",OPLB=(SELECT top 1 'op_seae' OPLB FROM op_seae WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO) union all (SELECT top 1 'op_seai' OPLB FROM op_seai WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO)))"
|
|
|
|
|
// + " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
// + " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{1}') {2} ORDER BY APPLYTIME DESC"
|
|
|
|
|
// , "top " + iShowPage.ToString(), strUserID, strCondition);
|
|
|
|
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME"
|
|
|
|
|
//+ ",MBLNO=(SELECT top 1 MBLNO FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ ",OPLB=(SELECT top 1 OPLB FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{1}') {2} ORDER BY APPLYTIME DESC"
|
|
|
|
|
, "top " + iShowPage.ToString(), strUserID, strCondition);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seae' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seae as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID "
|
|
|
|
|
// + " WHERE C.AUDITOR = '{1}') AND A.GID NOT IN "
|
|
|
|
|
// + " (SELECT {2} A.GID FROM ch_fee_recvapplication A WHERE A.BILLNO IN (SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{1}') {3} "
|
|
|
|
|
// + " ORDER BY A.BILLNO DESC ) {3} "
|
|
|
|
|
// //+ " ORDER BY BILLNO DESC "
|
|
|
|
|
// + " union all "
|
|
|
|
|
// + " SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seai' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seai as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID "
|
|
|
|
|
// + " WHERE C.AUDITOR = '{1}') AND C.GID NOT IN "
|
|
|
|
|
// + " (SELECT {2} A.GID FROM ch_fee_recvapplication as A WHERE A.BILLNO IN (SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{1}') {3} "
|
|
|
|
|
// + " ORDER BY A.BILLNO DESC ) {3} "
|
|
|
|
|
// + " ORDER BY BILLNO DESC "
|
|
|
|
|
// , strTopInclude, strUserID, strTopNotInclude, strCondition);
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.SETTLEMODE,A.CUSTOMERNAME,A.SETTLETYPE,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
// + " FROM ch_fee_settlement as A LEFT JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE 'CR%' AND ISNULL(A.ISDELETE,0) <> 1 AND A.GID NOT IN "
|
|
|
|
|
// + " (SELECT {1} GID FROM ch_fee_settlement WHERE BILLNO LIKE 'CR%' AND ISNULL(ISDELETE,0) <> 1 " + strAuthorityCondition + strCondition + " ORDER BY BILLNO DESC ) " + strAuthorityCondition + strCondition
|
|
|
|
|
// + " ORDER BY BILLNO DESC ", strTopInclude, strTopNotInclude);
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
// + ",OPLB=(SELECT top 1 'op_seae' OPLB FROM op_seae WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO) union all (SELECT top 1 'op_seai' OPLB FROM op_seai WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO)))"
|
|
|
|
|
// + " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.gid NOT IN "
|
|
|
|
|
// + " (SELECT {2} A.GID FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
// + " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{1}') {3} ORDER BY APPLYTIME DESC) {3} ORDER BY APPLYTIME DESC"
|
|
|
|
|
// , strTopInclude, strUserID, strTopNotInclude, strCondition);
|
|
|
|
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME"
|
|
|
|
|
//+ ",MBLNO=(SELECT top 1 MBLNO FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ ",OPLB=(SELECT top 1 OPLB FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.gid NOT IN "
|
|
|
|
|
+ " (SELECT {2} A.GID FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{1}') {3} ORDER BY APPLYTIME DESC) {3} ORDER BY APPLYTIME DESC"
|
|
|
|
|
, strTopInclude, strUserID, strTopNotInclude, strCondition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seae' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seae as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
|
|
|
|
|
// //+ " ORDER BY BILLNO DESC "
|
|
|
|
|
// + " union all "
|
|
|
|
|
// + " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,'op_Seai' OPLB "
|
|
|
|
|
// + " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
|
|
|
|
|
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
|
|
|
|
|
// + " inner join op_seai as E on C.BSNO =E.BSNO "
|
|
|
|
|
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
|
|
|
|
|
// + " ORDER BY BILLNO DESC "
|
|
|
|
|
// , strUserID, strCondition);
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
// + ",OPLB=(SELECT top 1 'op_seae' OPLB FROM op_seae WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO) union all (SELECT top 1 'op_seai' OPLB FROM op_seai WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO)))"
|
|
|
|
|
// + " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
// + " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
|
|
|
|
|
// , strUserID, strCondition);
|
|
|
|
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
|
|
strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME"
|
|
|
|
|
//+ ",MBLNO=(SELECT top 1 MBLNO FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ ",OPLB=(SELECT top 1 OPLB FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as AA INNER JOIN ch_fee_do as B ON AA.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE AA.BILLNO =A.BILLNO))"
|
|
|
|
|
+ " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
|
|
|
|
|
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
|
|
|
|
|
, strUserID, strCondition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceTable = getStatusNameTableBillStatus(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0]);
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
|
|
//
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取收费申请单信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费申请单信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetPaySettleApplicationList()
|
|
|
|
|
{
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
|
|
|
|
|
string strSql = "SELECT GID,BILLNO,BILLSTATUS,CUSTOMERNAME,AMOUNTUSD,AMOUNTRMB,APPLICANT,APPLYTIME,REMARK FROM ch_fee_settlement ORDER BY BILLNO DESC ";
|
|
|
|
|
|
|
|
|
|
sourceTable = getStatusNameTableBillStatus(feePaySettleApplicationDA.GetDataSetBySql(strSql).Tables[0]);
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取收费结算信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费结算信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetPaySettlementList()
|
|
|
|
|
{
|
|
|
|
|
FeeSettlementDA feeSettlementDA = new FeeSettlementDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strTopInclude = "";
|
|
|
|
|
string strTopNotInclude = "";
|
|
|
|
|
string strAmount1 = "";
|
|
|
|
|
string strAmount2 = "";
|
|
|
|
|
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
//strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
|
|
strCondition += String.Format(" AND (A.BILLNO LIKE '%{0}%' or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where CHEQUENUM LIKE '%{0}%') and BILLNO LIKE '%CR%') or A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where bsno in (select bsno from VW_Settlement where MBLNO LIKE '%{0}%')) and BILLNO LIKE '%CR%')) ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "amount1"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount1 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
case "amount2"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB <= '{0}' or A.AMOUNTUSD <= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount2 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strAmount1.Trim() != "" && strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND ((A.AMOUNTRMB >= '{0}' and A.AMOUNTRMB <= '{1}') or (A.AMOUNTUSD >= '{0}' and A.AMOUNTUSD <= '{1}'))", strAmount1.Trim(), strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (strAmount1.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strAmount1.Trim());
|
|
|
|
|
}
|
|
|
|
|
else if (strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB <= '{1}' or A.AMOUNTUSD <= '{1}')", strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string strSql = "";
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleList");
|
|
|
|
|
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLELIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////获取分公司的票号头字符
|
|
|
|
|
//T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
//string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
|
|
|
|
|
//string strFeeType = tempBANKSHEAD + "CR";
|
|
|
|
|
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
|
|
{
|
|
|
|
|
if (iCurrentPage == 1)
|
|
|
|
|
{
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.SETTLEMODE,A.CUSTOMERNAME,A.SETTLETYPE"
|
|
|
|
|
+ ", CHEQUENUM=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY='RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ", CHEQUENUMUSD=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY<>'RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ " FROM ch_fee_settlement as A LEFT JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE '%CR%' AND ISNULL(A.ISDELETE,0) <> 1 " + strAuthorityCondition + strCondition + " ORDER BY BILLNO DESC ", "top " + iShowPage.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.BILLNO,A.BILLSTATUS,A.SETTLEMODE,A.CUSTOMERNAME,A.SETTLETYPE"
|
|
|
|
|
+ ", CHEQUENUM=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY='RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ", CHEQUENUMUSD=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY<>'RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ " FROM ch_fee_settlement as A LEFT JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE '%CR%' AND ISNULL(A.ISDELETE,0) <> 1 AND A.GID NOT IN "
|
|
|
|
|
+ " (SELECT {1} GID FROM ch_fee_settlement WHERE BILLNO LIKE '%CR%' AND ISNULL(ISDELETE,0) <> 1 " + strAuthorityCondition + strCondition + " ORDER BY BILLNO DESC ) " + strAuthorityCondition + strCondition
|
|
|
|
|
+ " ORDER BY BILLNO DESC ", strTopInclude, strTopNotInclude);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.SETTLEMODE,A.CUSTOMERNAME,A.SETTLETYPE"
|
|
|
|
|
+ ", CHEQUENUM=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY='RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ", CHEQUENUMUSD=isnull((select top 1 CHEQUENUM from ch_fee where CURRENCY<>'RMB' and gid in (select feeid from ch_fee_do where billno=A.billno)),'')"
|
|
|
|
|
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ " FROM ch_fee_settlement as A LEFT JOIN [user] as B ON A.SETTLEUSER = B.GID "
|
|
|
|
|
+ " WHERE BILLNO LIKE '%CR%' AND ISNULL(A.ISDELETE,0) <> 1 " + strAuthorityCondition + strCondition + " ORDER BY A.BILLNO DESC ";
|
|
|
|
|
}
|
|
|
|
|
sourceTable = getFeeSettlementBillStatus(feeSettlementDA.GetExcuteSql(strSql).Tables[0]);
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
|
|
//
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取收费结算信息导出
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取收费结算信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetPaySettlementListExcel()
|
|
|
|
|
{
|
|
|
|
|
FeeSettlementDA feeSettlementDA = new FeeSettlementDA();
|
|
|
|
|
string strCondition = "";
|
|
|
|
|
string strAmount1 = "";
|
|
|
|
|
string strAmount2 = "";
|
|
|
|
|
if (strSearch != null)
|
|
|
|
|
{
|
|
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "btime"://Customer
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "etime"://BillNO
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://ETD BeginDate
|
|
|
|
|
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "no"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "amount1"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount1 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
case "amount2"://
|
|
|
|
|
//strCondition += String.Format(" AND (A.AMOUNTRMB <= '{0}' or A.AMOUNTUSD <= '{0}')", strArg[1].Replace("\"", ""));
|
|
|
|
|
strAmount2 = strArg[1].Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strAmount1.Trim() != "" && strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND ((A.AMOUNTRMB >= '{0}' and A.AMOUNTRMB <= '{1}') or (A.AMOUNTUSD >= '{0}' and A.AMOUNTUSD <= '{1}'))", strAmount1.Trim(), strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (strAmount1.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strAmount1.Trim());
|
|
|
|
|
}
|
|
|
|
|
else if (strAmount2.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND (A.AMOUNTRMB <= '{1}' or A.AMOUNTUSD <= '{1}')", strAmount2.Trim());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string strSql = "";
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleList");
|
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLELIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
|
|
}
|
|
|
|
|
//获取分公司的票号头字符
|
|
|
|
|
//T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
//string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
|
|
|
|
|
//string strFeeType = tempBANKSHEAD + "CR";
|
|
|
|
|
//
|
|
|
|
|
strSql = " SELECT A.BILLNO,case A.BILLSTATUS when 1 then '锁定' when 2 then '未锁定' when 3 then '结算撤销' else '' end as BILLSTATUS,case A.SETTLEMODE when 1 then '申请' when 2 then '自由' when 3 then '发票' when 4 then '流程' else '' end as SETTLEMODE,A.CUSTOMERNAME,case A.SETTLETYPE when 1 then '现金' when 2 then '发票' when 3 then '电汇' when 4 then '转账' when 5 then '承兑汇票' else '' end as SETTLETYPE,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
|
|
|
|
|
+ " FROM ch_fee_settlement as A LEFT JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE '%CR%' AND ISNULL(A.ISDELETE,0) <> 1 " + strAuthorityCondition + strCondition + " ORDER BY BILLNO DESC ";
|
|
|
|
|
return strSql.Trim();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public string GetSeaeOrderBySearch(string tempSearch)
|
|
|
|
|
{
|
|
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
string strSeaeCondition = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
|
|
{
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
//case "cus"://Customer
|
|
|
|
|
// strSeaeCondition += String.Format("AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
// break;
|
|
|
|
|
case "bno"://BillNO
|
|
|
|
|
strSeaeCondition += String.Format(" AND (CUSTNO LIKE '%{0}%' OR MBLNO LIKE '%{0}%' OR HBLNO LIKE '%{0}%' or CUSTOMNO LIKE '%{0}%' OR CUSTOMNO2 LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "bt"://ETD BeginDate
|
|
|
|
|
strSeaeCondition += String.Format(" AND ETD >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "et"://ETD EndDate
|
|
|
|
|
strSeaeCondition += String.Format(" AND ETD <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "ves"://Vessel
|
|
|
|
|
strSeaeCondition += String.Format(" AND VESSEL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "voy"://Voyno
|
|
|
|
|
strSeaeCondition += String.Format(" AND VOYNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
//case "deno"://DebitNO
|
|
|
|
|
// //strSqlCondition += String.Format(" VOYNO LIKE '%{0}%' ", strArg[1]);
|
|
|
|
|
// break;
|
|
|
|
|
//case "ise"://IsSettled
|
|
|
|
|
// break;
|
|
|
|
|
//case "fty"://FeeType
|
|
|
|
|
// strSqlCondition += String.Format(" FEETYPE = {0} ", strArg[1]);
|
|
|
|
|
// break;
|
|
|
|
|
//case "cur"://Currency
|
|
|
|
|
// strSqlCondition += String.Format(" FEETYPE = {0} ", strArg[1]);
|
|
|
|
|
// break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FeeSettlementDA feeSettlementDA = new FeeSettlementDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
|
|
|
|
|
//string strSql = "SELECT BSNO, CUSTOMERNAME,MBLNO,HBLNO FROM op_seae WHERE 1 > 0 AND BSNO IN ( "
|
|
|
|
|
// + "SELECT BSNO FROM ch_fee WHERE GID IN"
|
|
|
|
|
// + "(SELECT A.GID FROM ch_fee as A LEFT JOIN ch_fee_do as B ON A.GID = B.FEEID WHERE FEEID IS NULL) AND (FEESTATUS = 8 OR FEESTATUS = 0))"
|
|
|
|
|
// + strSeaeCondition;
|
|
|
|
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
|
|
string strSql = "SELECT BSNO, CUSTOMERNAME,MBLNO,HBLNO FROM VW_Settlement WHERE 1 > 0 AND BSNO IN ( "
|
|
|
|
|
+ "SELECT BSNO FROM ch_fee WHERE GID IN"
|
|
|
|
|
+ "(SELECT A.GID FROM ch_fee as A LEFT JOIN ch_fee_do as B ON A.GID = B.FEEID WHERE FEEID IS NULL) AND (FEESTATUS = 8 OR FEESTATUS = 0))"
|
|
|
|
|
+ strSeaeCondition;
|
|
|
|
|
sourceTable = feeSettlementDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
|
|
sourceBuilder.Append("data:[");
|
|
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sourceBuilder.Append("]},");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DataTable getFeeSettlementBillStatus(DataTable tempTable)
|
|
|
|
|
{
|
|
|
|
|
DataTable sourceTable = tempTable;
|
|
|
|
|
DataTable cloneTable = new DataTable();
|
|
|
|
|
int iSwitch = 0;
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (iSwitch == 0)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (sourceTable.Columns[j].ColumnName.Equals("BILLSTATUS"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[j].ColumnName.Equals("SETTLEMODE"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[j].ColumnName.Equals("SETTLETYPE"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = sourceTable.Columns[j].DataType;
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
iSwitch = 1;
|
|
|
|
|
}
|
|
|
|
|
DataRow cloneRow = cloneTable.NewRow();
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < sourceTable.Columns.Count; k++)
|
|
|
|
|
{
|
|
|
|
|
if (sourceTable.Columns[k].ColumnName.Equals("BILLSTATUS"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "锁定";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "未锁定";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "结算撤销";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[k].ColumnName.Equals("SETTLEMODE"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "申请";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "自由";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "发票";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
strFeeStatus = "流程";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[k].ColumnName.Equals("SETTLETYPE"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "现金";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "发票";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "电汇";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
strFeeStatus = "转账";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
strFeeStatus = "承兑汇票";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = sourceTable.Rows[i][k];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cloneTable.Rows.Add(cloneRow);
|
|
|
|
|
}
|
|
|
|
|
return cloneTable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DataTable getStatusNameTableBillStatus(DataTable tempTable)
|
|
|
|
|
{
|
|
|
|
|
DataTable sourceTable = tempTable;
|
|
|
|
|
DataTable cloneTable = new DataTable();
|
|
|
|
|
int iSwitch = 0;
|
|
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (iSwitch == 0)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < sourceTable.Columns.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (sourceTable.Columns[j].ColumnName.Equals("BILLSTATUS"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[j].ColumnName.Equals("SETTLEMODE"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[j].ColumnName.Equals("SETTLETYPE"))
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
|
|
newColumn.DataType = sourceTable.Columns[j].DataType;
|
|
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
iSwitch = 1;
|
|
|
|
|
}
|
|
|
|
|
DataRow cloneRow = cloneTable.NewRow();
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < sourceTable.Columns.Count; k++)
|
|
|
|
|
{
|
|
|
|
|
if (sourceTable.Columns[k].ColumnName.Equals("BILLSTATUS"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
strFeeStatus = "已审批";
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "未提交";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "已提交";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "审批中";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
strFeeStatus = "已结算";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
strFeeStatus = "部分结算";
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
strFeeStatus = "审核驳回";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[k].ColumnName.Equals("SETTLEMODE"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "申请";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "自由";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "发票";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
strFeeStatus = "流程";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else if (sourceTable.Columns[k].ColumnName.Equals("SETTLETYPE"))
|
|
|
|
|
{
|
|
|
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
|
|
|
string strFeeStatus = "";
|
|
|
|
|
switch (iFeeStatus)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
strFeeStatus = "现金";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
strFeeStatus = "发票";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
strFeeStatus = "电汇";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
strFeeStatus = "转账";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
strFeeStatus = "承兑汇票";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = sourceTable.Rows[i][k];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cloneTable.Rows.Add(cloneRow);
|
|
|
|
|
}
|
|
|
|
|
return cloneTable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提交包保存的申请
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunSettleGID"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int PostSavedPaySettleApplication(string tempRunSettleGID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
T_ALL_DA t_all_da = new T_ALL_DA();
|
|
|
|
|
int bsnoCount = 0;
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
DataSet ds = t_all_da.GetAllSQL("select gid,OPLBNAME=(select top 1 OPLBNAME from VW_Settlement where bsno=run_fee_do.bsno),bsno,mblno from [run_fee_do] where runsettleid='" + tempRunSettleGID.Trim() + "'");//获取费用运行明细表中的数据(根据RUNSETTLEID)
|
|
|
|
|
if (ds!=null&&ds.Tables[0].Rows.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
string topBsno = ds.Tables[0].Rows[0]["OPLBNAME"].ToString().Trim();
|
|
|
|
|
for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (topBsno != ds.Tables[0].Rows[i]["OPLBNAME"].ToString().Trim())
|
|
|
|
|
{
|
|
|
|
|
bsnoCount++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string strFeePayApplicationID = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
iResult = feePaySettleApplicationDA.PostSavedPaySettleRequest(strFeePayApplicationID, tempRunSettleGID, strUserID, "", strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
strBillNO = feePaySettleApplicationDA.GetBillNoByPaySettleAppID(strFeePayApplicationID);
|
|
|
|
|
//工作流
|
|
|
|
|
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
|
|
|
|
|
|
|
|
|
|
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.PAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
|
|
|
|
|
if (stroplb.ToLower() == "op_seae")
|
|
|
|
|
{
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.PAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_seai")
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "tmswlbshead" || stroplb.ToLower() == "tmswlpchead")//51 陆运
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.tMsWlPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "wms_fee" || stroplb.ToLower() == "wms" || stroplb.ToLower() == "wms_out")//61
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.WmszxPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "import_main")
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_apply")
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_bulk")
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
|
|
|
|
|
if (workFlowEntity != null)
|
|
|
|
|
{
|
|
|
|
|
//消息系统
|
|
|
|
|
IList<MessageEntity> messageEntities = new List<MessageEntity>();
|
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
|
|
|
|
|
|
|
|
WorkFlowDoEntity workFlowDoEntity = null;
|
|
|
|
|
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
|
|
|
|
|
|
|
|
|
|
workFlowDoEntity = workFlowDoDA.GetSigleWorkFlowDoByBillNO(workFlowEntity.GID, strBillNO);
|
|
|
|
|
|
|
|
|
|
if (workFlowDoEntity == null)
|
|
|
|
|
{
|
|
|
|
|
if (workFlowDoEntity.GID == null)
|
|
|
|
|
{
|
|
|
|
|
//workFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
|
|
|
|
|
//遍历所有工作流下步骤,获取第一步骤GID信息
|
|
|
|
|
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
|
|
|
|
|
{
|
|
|
|
|
if (step.StepNO == 1)
|
|
|
|
|
{
|
|
|
|
|
WorkFlowDoEntity paySettleWorkFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
paySettleWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
paySettleWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepID = step.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepNO = step.StepNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.Auditor = step.Auditor;
|
|
|
|
|
paySettleWorkFlowDoEntity.BillNO = strBillNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.IsFinish = false;
|
|
|
|
|
paySettleWorkFlowDoEntity.Applicant = strUserID;
|
|
|
|
|
|
|
|
|
|
workFlowDoEntities.Add(paySettleWorkFlowDoEntity);
|
|
|
|
|
|
|
|
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
|
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeePayAudit";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeeSeaAllPaySettleAudit";
|
|
|
|
|
}
|
|
|
|
|
messageEntity.Description = "收费申请审核";
|
|
|
|
|
messageEntity.IsRead = false;
|
|
|
|
|
messageEntity.ReadCount = 0;
|
|
|
|
|
messageEntity.MessageContent = strShowName + " 业务编号:" + strBillNO + " 提交待审核 [收费申请] ";
|
|
|
|
|
messageEntity.TaskID = strBillNO;
|
|
|
|
|
messageEntity.Receiver = step.Auditor;
|
|
|
|
|
messageEntity.TaskUrl = messageEntity.TaskUrl = "settlements/feepayaudit.aspx";
|
|
|
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEPAYAPP);
|
|
|
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
|
|
|
|
|
|
|
|
messageEntities.Add(messageEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
|
|
|
|
|
|
|
|
|
|
feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3, strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (messageEntities.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
messageDA.CreateMessage(MessageType.FEEPAYAPP, messageEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (workFlowDoEntity.GID == null)
|
|
|
|
|
{
|
|
|
|
|
//workFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
|
|
|
|
|
//遍历所有工作流下步骤,获取第一步骤GID信息
|
|
|
|
|
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
|
|
|
|
|
{
|
|
|
|
|
if (step.StepNO == 1)
|
|
|
|
|
{
|
|
|
|
|
WorkFlowDoEntity paySettleWorkFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
paySettleWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
paySettleWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepID = step.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepNO = step.StepNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
|
|
|
|
|
paySettleWorkFlowDoEntity.FeeID = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.BSNO = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.FeeStatus = 0;
|
|
|
|
|
paySettleWorkFlowDoEntity.DoQuerySql = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.BillNO = strBillNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.IsFinish = false;
|
|
|
|
|
paySettleWorkFlowDoEntity.Applicant = strUserID;
|
|
|
|
|
|
|
|
|
|
workFlowDoEntities.Add(paySettleWorkFlowDoEntity);
|
|
|
|
|
|
|
|
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
|
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeePayAudit";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeeSeaAllPaySettleAudit";
|
|
|
|
|
}
|
|
|
|
|
messageEntity.Description = "收费申请审核";
|
|
|
|
|
messageEntity.IsRead = false;
|
|
|
|
|
messageEntity.ReadCount = 0;
|
|
|
|
|
messageEntity.MessageContent = strShowName + " 业务编号:" + strBillNO + " 提交待审核 [收费申请] ";
|
|
|
|
|
messageEntity.TaskID = strBillNO;
|
|
|
|
|
messageEntity.Receiver = step.Auditor;
|
|
|
|
|
messageEntity.TaskUrl = messageEntity.TaskUrl = "settlements/feepayaudit.aspx";
|
|
|
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEPAYAPP);
|
|
|
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
|
|
|
|
|
|
|
|
messageEntities.Add(messageEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
|
|
|
|
|
|
|
|
|
|
feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3, strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (messageEntities.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
messageDA.CreateMessage(MessageType.FEEPAYAPP, messageEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "添加收费申请信息";
|
|
|
|
|
logEntity.LogType = "INSERT 插入操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.INSERT), "收费申请", "申请编号:" + strBillNO);
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重新提交申请
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempPaySettleAppGID"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int RePostRejectPaySettleApplication(string tempPaySettleAppGID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
FeePaySettleApplicationDA feePaySettleApplicationDA = new FeePaySettleApplicationDA();
|
|
|
|
|
T_ALL_DA t_all_da = new T_ALL_DA();
|
|
|
|
|
int bsnoCount = 0;
|
|
|
|
|
FeePayApplicationEntity feePayApplicationEntity = feePaySettleApplicationDA.GetFeePayApplicationByGID(tempPaySettleAppGID);
|
|
|
|
|
|
|
|
|
|
if (feePayApplicationEntity != null)
|
|
|
|
|
{
|
|
|
|
|
if (feePayApplicationEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
if (feePayApplicationEntity.BillStatus == 6)
|
|
|
|
|
{
|
|
|
|
|
iResult = feePaySettleApplicationDA.PostRejectPaySettleApplication(tempPaySettleAppGID);
|
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
strBillNO = feePaySettleApplicationDA.GetBillNoByPaySettleAppID(tempPaySettleAppGID);
|
|
|
|
|
DataSet ds = t_all_da.GetAllSQL("SELECT BSNO,OPLBNAME,CUSTOMERNAME,MBLNO FROM VW_Settlement WHERE BSNO IN (SELECT C.BSNO FROM ch_fee_recvapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.BILLNO ='"+strBillNO.Trim()+"')");
|
|
|
|
|
if (ds != null && ds.Tables[0].Rows.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
string topBsno = ds.Tables[0].Rows[0]["OPLBNAME"].ToString().Trim();
|
|
|
|
|
for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (topBsno != ds.Tables[0].Rows[i]["OPLBNAME"].ToString().Trim())
|
|
|
|
|
{
|
|
|
|
|
bsnoCount++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//工作流
|
|
|
|
|
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
|
|
|
|
|
|
|
|
|
|
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.PAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
|
|
|
|
|
if (stroplb.ToLower() == "op_seae")
|
|
|
|
|
{
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.PAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_seai")
|
|
|
|
|
{
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "tmswlbshead" || stroplb.ToLower() == "tmswlpchead")//51 陆运
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.tMsWlPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "wms_fee" || stroplb.ToLower() == "wms" || stroplb.ToLower() == "wms_out")//61
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.WmszxPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "import_main")
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_apply")
|
|
|
|
|
{
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stroplb.ToLower() == "op_bulk")
|
|
|
|
|
{
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKPAYSETTLEAUDIT, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeSeaAllPaySettleAudit, strCompanyID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
|
|
|
|
|
if (workFlowEntity != null)
|
|
|
|
|
{
|
|
|
|
|
//消息系统
|
|
|
|
|
IList<MessageEntity> messageEntities = new List<MessageEntity>();
|
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
|
|
|
|
|
|
|
|
WorkFlowDoEntity workFlowDoEntity = null;
|
|
|
|
|
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
|
|
|
|
|
|
|
|
|
|
workFlowDoEntity = workFlowDoDA.GetSigleWorkFlowDoByBillNO(workFlowEntity.GID, strBillNO);
|
|
|
|
|
|
|
|
|
|
if (workFlowDoEntity == null)
|
|
|
|
|
{
|
|
|
|
|
if (workFlowDoEntity.GID == null)
|
|
|
|
|
{
|
|
|
|
|
//workFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
|
|
|
|
|
//遍历所有工作流下步骤,获取第一步骤GID信息
|
|
|
|
|
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
|
|
|
|
|
{
|
|
|
|
|
if (step.StepNO == 1)
|
|
|
|
|
{
|
|
|
|
|
WorkFlowDoEntity paySettleWorkFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
paySettleWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
paySettleWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepID = step.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepNO = step.StepNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.Auditor = step.Auditor;
|
|
|
|
|
paySettleWorkFlowDoEntity.BillNO = strBillNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.IsFinish = false;
|
|
|
|
|
paySettleWorkFlowDoEntity.Applicant = strUserID;
|
|
|
|
|
|
|
|
|
|
workFlowDoEntities.Add(paySettleWorkFlowDoEntity);
|
|
|
|
|
|
|
|
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
|
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeePayAudit";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeeSeaAllPaySettleAudit";
|
|
|
|
|
}
|
|
|
|
|
messageEntity.Description = "收费申请审核";
|
|
|
|
|
messageEntity.IsRead = false;
|
|
|
|
|
messageEntity.ReadCount = 0;
|
|
|
|
|
messageEntity.MessageContent = strShowName + " 业务编号:" + strBillNO + " 提交待审核 [收费申请] ";
|
|
|
|
|
messageEntity.TaskID = strBillNO;
|
|
|
|
|
messageEntity.Receiver = step.Auditor;
|
|
|
|
|
messageEntity.TaskUrl = messageEntity.TaskUrl = "settlements/feepayaudit.aspx";
|
|
|
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEPAYAPP);
|
|
|
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
|
|
|
|
|
|
|
|
messageEntities.Add(messageEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
|
|
|
|
|
|
|
|
|
|
feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3, strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (messageEntities.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
messageDA.CreateMessage(MessageType.FEEPAYAPP, messageEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (workFlowDoEntity.GID == null)
|
|
|
|
|
{
|
|
|
|
|
//workFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
|
|
|
|
|
//遍历所有工作流下步骤,获取第一步骤GID信息
|
|
|
|
|
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
|
|
|
|
|
{
|
|
|
|
|
if (step.StepNO == 1)
|
|
|
|
|
{
|
|
|
|
|
WorkFlowDoEntity paySettleWorkFlowDoEntity = new WorkFlowDoEntity();
|
|
|
|
|
paySettleWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
paySettleWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepID = step.GID;
|
|
|
|
|
paySettleWorkFlowDoEntity.StepNO = step.StepNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
|
|
|
|
|
paySettleWorkFlowDoEntity.FeeID = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.BSNO = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.FeeStatus = 0;
|
|
|
|
|
paySettleWorkFlowDoEntity.DoQuerySql = "";
|
|
|
|
|
paySettleWorkFlowDoEntity.BillNO = strBillNO;
|
|
|
|
|
paySettleWorkFlowDoEntity.IsFinish = false;
|
|
|
|
|
paySettleWorkFlowDoEntity.Applicant = strUserID;
|
|
|
|
|
|
|
|
|
|
workFlowDoEntities.Add(paySettleWorkFlowDoEntity);
|
|
|
|
|
|
|
|
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
|
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
if (bsnoCount == 0)
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeePayAudit";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
messageEntity.Name = "FeeSeaAllPaySettleAudit";
|
|
|
|
|
}
|
|
|
|
|
messageEntity.Description = "收费申请审核";
|
|
|
|
|
messageEntity.IsRead = false;
|
|
|
|
|
messageEntity.ReadCount = 0;
|
|
|
|
|
messageEntity.MessageContent = strShowName + " 业务编号:" + strBillNO + " 提交待审核 [收费申请] ";
|
|
|
|
|
messageEntity.TaskID = strBillNO;
|
|
|
|
|
messageEntity.Receiver = step.Auditor;
|
|
|
|
|
messageEntity.TaskUrl = messageEntity.TaskUrl = "settlements/feepayaudit.aspx";
|
|
|
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEPAYAPP);
|
|
|
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
|
|
|
|
|
|
|
|
messageEntities.Add(messageEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
|
|
|
|
|
|
|
|
|
|
feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3, strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (messageEntities.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
messageDA.CreateMessage(MessageType.FEEPAYAPP, messageEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "添加收费申请信息";
|
|
|
|
|
logEntity.LogType = "INSERT 插入操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.INSERT), "收费申请", "申请编号:" + strBillNO);
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -5;//只能提交状态为驳回的收费申请
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -4;//不存在收费申请
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -4;//不存在收费申请
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 删除运行结算表信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除运行结算表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunFeeSettleID">运行结算表GID</param>
|
|
|
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
|
|
|
private int DeleteSavedPaySettleApplication(string tempRunFeeSettleID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
RunFeeSettlementDA runFeeSettlementDA = new RunFeeSettlementDA();
|
|
|
|
|
iResult = runFeeSettlementDA.DeleteRunFeeSettlementByGID(tempRunFeeSettleID);
|
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "删除收费申请保存信息";
|
|
|
|
|
logEntity.LogType = "DELETE 删除操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.DELETE), "收费申请保存信息", "");
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除已保存未结算的收费信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除已保存未结算的收费信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunSettlementID">运行结算表GID</param>
|
|
|
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
|
|
|
private int DeleteSavedUnSettlePay(string tempRunSettlementID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
RunFeeSettlementDA runFeeSettlementDA = new RunFeeSettlementDA();
|
|
|
|
|
RunFeeSettlementEntity runFeeSettlementEntity = runFeeSettlementDA.GetRunFeeSettlementByGID(tempRunSettlementID);
|
|
|
|
|
|
|
|
|
|
if (runFeeSettlementEntity != null)
|
|
|
|
|
{
|
|
|
|
|
if (runFeeSettlementEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
iResult = runFeeSettlementDA.DeleteRunFeeSettlementByGID(tempRunSettlementID);
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "删除已保存未结算收费信息";
|
|
|
|
|
logEntity.LogType = "DELETE 删除操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.DELETE), "已保存未结算收费", "");
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -3;//数据不存在
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -3;//数据不存在
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 将已保存为结算的收费进行结算操作
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将已保存为结算的收费进行结算操作
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunSettleID"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int PostSavePaySettle(string tempRunSettleID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
string strBillNO = "";
|
|
|
|
|
string strFeePaySettleID = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
FeePaySettleDA feePaySettleDA = new FeePaySettleDA();
|
|
|
|
|
iResult = feePaySettleDA.PostSavePaySettle(strFeePaySettleID, tempRunSettleID, strUserID, "", strCompanyID);
|
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
strBillNO = feePaySettleDA.GetBillNoByPaySettleID(strFeePaySettleID);
|
|
|
|
|
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "添加收费结算信息";
|
|
|
|
|
logEntity.LogType = "INSERT 插入操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.INSERT), "收费结算", "结算单号:" + strBillNO);
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 撤销收费结算
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 撤销收费结算
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strPaySettleID">收费结算GID</param>
|
|
|
|
|
/// <returns>值1表示结算成功 值不等于1表示结算失败</returns>
|
|
|
|
|
private int CacelPaySettle(string strPaySettleID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
FeePaySettleDA feePaySettleDA = new FeePaySettleDA();
|
|
|
|
|
|
|
|
|
|
FeeSettlementDA feeSettlementDA = new FeeSettlementDA();
|
|
|
|
|
FeeSettlementEntity feeSettlementEntity = new FeeSettlementEntity();
|
|
|
|
|
|
|
|
|
|
feeSettlementEntity = feeSettlementDA.GetFeeSettlementByGID(strPaySettleID);
|
|
|
|
|
|
|
|
|
|
if (feeSettlementEntity != null)
|
|
|
|
|
{
|
|
|
|
|
if (feeSettlementEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
string ssql = "select count(*) as nums from ch_fee_advance_payment_detail where BILLNO='" + feeSettlementEntity.BillNO.ToString() + "' and (ISDELETE=0 or ISDELETE is null)";
|
|
|
|
|
int nums = int.Parse(T_ALL_DA.GetStrSQL("nums", ssql));
|
|
|
|
|
if (nums != 0)//判断是否存在预收预收主表中的预收支资料
|
|
|
|
|
{
|
|
|
|
|
return -3;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
iResult = feePaySettleDA.CacelPaySettle(strPaySettleGID, feeSettlementEntity.BillNO, strUserID, feeSettlementEntity.CompanyID);
|
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
|
|
{
|
|
|
|
|
LogEntity logEntity = new LogEntity();
|
|
|
|
|
logEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
logEntity.Name = "撤销收费结算信息";
|
|
|
|
|
logEntity.LogType = "CANCEL 撤销操作";
|
|
|
|
|
logEntity.CreateUserID = strUserID;
|
|
|
|
|
logEntity.LogContent = strShowName + String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.CANCEL), "收费结算", "结算单号:" + feeSettlementEntity.BillNO);
|
|
|
|
|
|
|
|
|
|
Logger.Instance.WriteLog(logEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查看收费申请是否已经结算完成
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查看收费申请是否已经结算完成
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempBillNO"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int IsFeeRecvApplicationSettled(string tempBillNO)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
ChFeeRecvApplicationEntity ChFeeRecvApplicationEntity = new ChFeeRecvApplicationEntity();
|
|
|
|
|
ChFeeRecvApplicationDA ChFeeRecvApplicationDA = new ChFeeRecvApplicationDA();
|
|
|
|
|
ChFeeRecvApplicationEntity = ChFeeRecvApplicationDA.GetModel(tempBillNO, strCompanyID);
|
|
|
|
|
if (ChFeeRecvApplicationEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
if (ChFeeRecvApplicationEntity.BILLSTATUS == 4)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;//收费申请已经结算完毕
|
|
|
|
|
}
|
|
|
|
|
else if (ChFeeRecvApplicationEntity.BILLSTATUS == 0)
|
|
|
|
|
{
|
|
|
|
|
iResult = 0;//收费申请已审批
|
|
|
|
|
}
|
|
|
|
|
else if (ChFeeRecvApplicationEntity.BILLSTATUS == 3)
|
|
|
|
|
{
|
|
|
|
|
iResult = -2;//收费申请正在审批中
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//没有相关申请信息
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|