|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
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 System.Text;
|
|
|
|
|
using DSWeb.DataAccess;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using System.Web.Script.Serialization;
|
|
|
|
|
namespace DSWeb.Shipping
|
|
|
|
|
{
|
|
|
|
|
public partial class ChCheckInfo : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
public string strHandleType = String.Empty;
|
|
|
|
|
public string sSQL = String.Empty;
|
|
|
|
|
public string strUserID;//用户GID
|
|
|
|
|
private string strCompanyID;//公司GID
|
|
|
|
|
private string strDeptName;//部门名称
|
|
|
|
|
private string strShowName;
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
ChFeeChequeDA ChFeeChequeDA = new ChFeeChequeDA();
|
|
|
|
|
ChFeeChequeEntity ChFeeChequeEntity = new ChFeeChequeEntity();
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Session["USERID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Server.Transfer("~/Error/FriendError.aspx");
|
|
|
|
|
return;
|
|
|
|
|
//strUserID = "";
|
|
|
|
|
}
|
|
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
this.strShowName = Session["SHOWNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.hdUserID.Value = strUserID;
|
|
|
|
|
//
|
|
|
|
|
if (ViewState["GID"] != null)
|
|
|
|
|
{
|
|
|
|
|
if (this.hdEnter.Value != "")
|
|
|
|
|
{
|
|
|
|
|
getEnter();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
if (Request.QueryString["handle"] != null) //if (Request.QueryString["handle"] != null)
|
|
|
|
|
{
|
|
|
|
|
ViewState["strHandleType"] = Request.QueryString["handle"].ToString().Trim();
|
|
|
|
|
strHandleType = ViewState["strHandleType"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ViewState["strHandleType"] = "add";
|
|
|
|
|
strHandleType = "add";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (Request.QueryString["id"] != null)
|
|
|
|
|
{
|
|
|
|
|
ViewState["GID"] = Request.QueryString["id"].ToString();
|
|
|
|
|
this.hdGid.Value = Request.QueryString["id"].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//ViewState["GID"] = "ched3106f1fc50f4bea92e2037f15689ae5";
|
|
|
|
|
//this.hdGid.Value = "ched3106f1fc50f4bea92e2037f15689ae5";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (Request.QueryString["paysettlebillno"] != null)//付费结算编号
|
|
|
|
|
{
|
|
|
|
|
ViewState["PAYSETTLEBILLNO"] = Request.QueryString["paysettlebillno"].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//ViewState["PAYSETTLEBILLNO"] = "DR2011090003";
|
|
|
|
|
//ViewState["PAYSETTLEBILLNO"] = "CR2011080004";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
switch (strHandleType)
|
|
|
|
|
{
|
|
|
|
|
case "add"://新增
|
|
|
|
|
this.ibEnter.Disabled = false;
|
|
|
|
|
this.ibPrint.Disabled = true;
|
|
|
|
|
this.imgDel.Disabled = true;
|
|
|
|
|
//
|
|
|
|
|
ViewState["GID"] = getBSNO();
|
|
|
|
|
this.hdGid.Value = ViewState["GID"].ToString().Trim();
|
|
|
|
|
|
|
|
|
|
ddlCHEQUETYPE.Text = "转帐支票";
|
|
|
|
|
tbCHEQUEMAKETIME.Text = DateTime.Parse(T_ALL_DA.GetStrSQL("sdate","select getdate() as sdate")).ToString("yyyy-MM-dd");
|
|
|
|
|
tbCHEQUEAMOUNT.Text = "0.00";
|
|
|
|
|
tbCHEQUEAMOUNTUPPER.Text = "元整";
|
|
|
|
|
this.hd_comboCURRENCY.Value = "RMB";
|
|
|
|
|
//
|
|
|
|
|
if (ViewState["PAYSETTLEBILLNO"] != null)
|
|
|
|
|
{
|
|
|
|
|
FeeSettlementEntity feeSettlementEntity = new FeeSettlementDA().GetFeeSettlementByBillNO(ViewState["PAYSETTLEBILLNO"].ToString().Trim());
|
|
|
|
|
if (feeSettlementEntity.BillNO != null)
|
|
|
|
|
{
|
|
|
|
|
this.hd_comboCUSTOMERNAME.Value = feeSettlementEntity.CustomerName.ToString().Trim();
|
|
|
|
|
if (Decimal.Parse(feeSettlementEntity.AmountRMB.ToString().Trim()) > 0)
|
|
|
|
|
{
|
|
|
|
|
this.hd_comboCURRENCY.Value = "RMB";
|
|
|
|
|
tbCHEQUEAMOUNT.Text = feeSettlementEntity.AmountRMB.ToString("F2").Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (Decimal.Parse(feeSettlementEntity.AmountUSD.ToString().Trim()) > 0)
|
|
|
|
|
{
|
|
|
|
|
this.hd_comboCURRENCY.Value = "USD";
|
|
|
|
|
tbCHEQUEAMOUNT.Text = feeSettlementEntity.AmountRMB.ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.ibEnter.Disabled = true;
|
|
|
|
|
this.ibPrint.Disabled = true;
|
|
|
|
|
this.imgDel.Disabled = true;
|
|
|
|
|
getEnabled();
|
|
|
|
|
this.ddlCUSTOMERNAME.Disabled = true;
|
|
|
|
|
this.ddlCURRENCY.Disabled = true;
|
|
|
|
|
this.ddlPAYBANK.Disabled = true;
|
|
|
|
|
//
|
|
|
|
|
Response.Write("<script>alert('开票金额数据出错,无法开出支票!');history.back();</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
break;
|
|
|
|
|
case "edit"://录入
|
|
|
|
|
ChFeeChequeEntity = ChFeeChequeDA.GetID(ViewState["GID"].ToString().Trim());
|
|
|
|
|
if (ChFeeChequeEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
//ChFeeChequeEntity.GID.ToString().Trim(); // 惟一编号
|
|
|
|
|
tbCHEQUENO.Text = ChFeeChequeEntity.CHEQUENO.ToString().Trim(); // 支票号码
|
|
|
|
|
//ChFeeChequeEntity.BILLNO.ToString().Trim(); // 申请编号
|
|
|
|
|
//ChFeeChequeEntity.PAYSETTLEBILLNO.ToString().Trim(); // 付费结算编号
|
|
|
|
|
this.hd_comboCUSTOMERNAME.Value = ChFeeChequeEntity.CUSTOMERNAME.ToString().Trim(); // 客户名称
|
|
|
|
|
tbCHEQUECUSTNAME.Text = ChFeeChequeEntity.CHEQUECUSTNAME.ToString().Trim(); // 支票抬头/收款单位
|
|
|
|
|
//出票日期
|
|
|
|
|
if (ChFeeChequeEntity.CHEQUEMAKETIME.ToString().Trim().IndexOf("0001")>-1)
|
|
|
|
|
{
|
|
|
|
|
tbCHEQUEMAKETIME.Text = "";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tbCHEQUEMAKETIME.Text = ChFeeChequeEntity.CHEQUEMAKETIME.ToString("yyyy-MM-dd").Trim();// 出票日期
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
this.tbMAKETIMEUPPER.Value = ChFeeChequeEntity.MAKETIMEUPPER.ToString().Trim(); // 出票日期中文大写
|
|
|
|
|
//ChFeeChequeEntity.YEAR.ToString().Trim(); // 年
|
|
|
|
|
//ChFeeChequeEntity.MONTH.ToString().Trim(); // 月
|
|
|
|
|
//ChFeeChequeEntity.DAY.ToString().Trim(); // 日
|
|
|
|
|
//ChFeeChequeEntity.YEARUPPER.ToString().Trim(); // 年大写
|
|
|
|
|
//ChFeeChequeEntity.MONTHUPPER.ToString().Trim(); // 月大写
|
|
|
|
|
//ChFeeChequeEntity.DAYUPPER.ToString().Trim(); // 日大写
|
|
|
|
|
tbPURPOSE.Text = ChFeeChequeEntity.PURPOSE.ToString().Trim(); // 用途
|
|
|
|
|
tbPASSWORD.Text = ChFeeChequeEntity.PASSWORD.ToString().Trim(); // 密码
|
|
|
|
|
this.hd_comboCURRENCY.Value = ChFeeChequeEntity.CHEQUECURRENCY.ToString().Trim(); // 支票币别
|
|
|
|
|
ddlCHEQUETYPE.Text = ChFeeChequeEntity.CHEQUETYPE.ToString().Trim(); // 支票类别
|
|
|
|
|
tbCHEQUEAMOUNT.Text = ChFeeChequeEntity.CHEQUEAMOUNT.ToString().Trim(); // 支票金额
|
|
|
|
|
tbCHEQUEAMOUNTUPPER.Text = ChFeeChequeEntity.CHEQUEAMOUNTUPPER.ToString().Trim(); // 支票金额大写
|
|
|
|
|
//ChFeeChequeEntity.BAIYI.ToString().Trim(); // 百亿
|
|
|
|
|
//ChFeeChequeEntity.SHIYI.ToString().Trim(); // 十亿
|
|
|
|
|
//ChFeeChequeEntity.YI.ToString().Trim(); // 亿
|
|
|
|
|
//ChFeeChequeEntity.QIANWAN.ToString().Trim(); // 千万
|
|
|
|
|
//ChFeeChequeEntity.BAIWAN.ToString().Trim(); // 百万
|
|
|
|
|
//ChFeeChequeEntity.SHIWAN.ToString().Trim(); // 十万
|
|
|
|
|
//ChFeeChequeEntity.WAN.ToString().Trim(); // 万
|
|
|
|
|
//ChFeeChequeEntity.QIAN.ToString().Trim(); // 千
|
|
|
|
|
//ChFeeChequeEntity.BAI.ToString().Trim(); // 百
|
|
|
|
|
//ChFeeChequeEntity.SHI.ToString().Trim(); // 十
|
|
|
|
|
//ChFeeChequeEntity.YUAN.ToString().Trim(); // 元
|
|
|
|
|
//ChFeeChequeEntity.JIAO.ToString().Trim(); // 角
|
|
|
|
|
//ChFeeChequeEntity.FEN.ToString().Trim(); // 分
|
|
|
|
|
tbUNIT.Text = ChFeeChequeEntity.UNIT.ToString().Trim(); // 金额单位
|
|
|
|
|
//是否废除
|
|
|
|
|
if (ChFeeChequeEntity.ISDELETE.ToString().Trim() == "True")
|
|
|
|
|
{
|
|
|
|
|
cbISDELETE.Checked = true;//是否废除
|
|
|
|
|
lbDELETEOPERATOR.Text = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + ChFeeChequeEntity.DELETEOPERATOR.ToString().Trim() + "'");// 废除人
|
|
|
|
|
lbDELETECAUSE.Text = ChFeeChequeEntity.DELETECAUSE.ToString().Trim(); // 废除原因
|
|
|
|
|
//ChFeeChequeEntity.DELETETIME.ToString().Trim(); // 废除时间
|
|
|
|
|
//
|
|
|
|
|
this.ibEnter.Disabled = true;
|
|
|
|
|
this.ibPrint.Disabled = true;
|
|
|
|
|
this.imgDel.Disabled = true;
|
|
|
|
|
getEnabled();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//是否打印
|
|
|
|
|
if (ChFeeChequeEntity.ISPRINT.ToString().Trim() == "True")
|
|
|
|
|
{
|
|
|
|
|
this.ibPrint.Disabled = true;
|
|
|
|
|
//
|
|
|
|
|
this.ibEnter.Disabled = true;
|
|
|
|
|
cbISPRINT.Checked = true;//是否打印
|
|
|
|
|
getEnabled();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
this.hd_comboPAYBANK.Value = ChFeeChequeEntity.PAYBANK.ToString().Trim(); // 付款行
|
|
|
|
|
tbPAYBANKACCOUNT.Text = ChFeeChequeEntity.PAYBANKACCOUNT.ToString().Trim(); // 付款行账号
|
|
|
|
|
tbPAYEEBANK.Text = ChFeeChequeEntity.PAYEEBANK.ToString().Trim(); // 收款单位银行
|
|
|
|
|
tbPAYEEBANKACCOUNT.Text = ChFeeChequeEntity.PAYEEBANKACCOUNT.ToString().Trim(); // 付款单位银行账号
|
|
|
|
|
tbPAYEEADR.Text = ChFeeChequeEntity.PAYEEADR.ToString().Trim(); // 收款单位地址
|
|
|
|
|
//是否审核
|
|
|
|
|
if (ChFeeChequeEntity.ISAUDIT.ToString().Trim() == "True")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//ChFeeChequeEntity.AUDITOPERATOR.ToString().Trim(); // 审核人
|
|
|
|
|
//ChFeeChequeEntity.AUDITDATE.ToString().Trim(); // 审核时间
|
|
|
|
|
//ChFeeChequeEntity.CREATEUSER.ToString().Trim(); // 创建人
|
|
|
|
|
//ChFeeChequeEntity.CREATETIME.ToString().Trim(); // 创建时间
|
|
|
|
|
//ChFeeChequeEntity.MODIFIEDUSER.ToString().Trim(); // 最后一次更新操作人GID
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//------
|
|
|
|
|
}
|
|
|
|
|
//加载下拉框
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboCUSTOMERNAME();initComboCURRENCY();initComboPAYBANK();</script>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getBSNO()
|
|
|
|
|
{
|
|
|
|
|
string strBSNO = Guid.NewGuid().ToString();
|
|
|
|
|
strBSNO = strBSNO.Replace("-", "");
|
|
|
|
|
strBSNO = "che" + strBSNO;
|
|
|
|
|
return strBSNO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void getEnabled()
|
|
|
|
|
{
|
|
|
|
|
this.isEnabled.Value = "1";
|
|
|
|
|
//ddlCUSTOMERNAME
|
|
|
|
|
cbISPRINT.Enabled=false;
|
|
|
|
|
cbISDELETE.Enabled=false;
|
|
|
|
|
lbDELETECAUSE.Enabled=false;
|
|
|
|
|
lbDELETEOPERATOR.Enabled=false;
|
|
|
|
|
//ddlCURRENCY
|
|
|
|
|
ddlCHEQUETYPE.Enabled=false;
|
|
|
|
|
tbCHEQUEMAKETIME.Enabled=false;
|
|
|
|
|
tbCHEQUEAMOUNT.Enabled=false;
|
|
|
|
|
tbCHEQUENO.Enabled=false;
|
|
|
|
|
this.tbMAKETIMEUPPER.Disabled=true;
|
|
|
|
|
//ddlPAYBANK
|
|
|
|
|
tbCHEQUECUSTNAME.Enabled=false;
|
|
|
|
|
tbPAYBANKACCOUNT.Enabled=false;
|
|
|
|
|
tbCHEQUEAMOUNTUPPER.Enabled=false;
|
|
|
|
|
tbUNIT.Enabled=false;
|
|
|
|
|
tbqw.Enabled=false;
|
|
|
|
|
tbbw.Enabled=false;
|
|
|
|
|
tbsw.Enabled=false;
|
|
|
|
|
tbw.Enabled=false;
|
|
|
|
|
tbq.Enabled=false;
|
|
|
|
|
tbb.Enabled=false;
|
|
|
|
|
tbs.Enabled=false;
|
|
|
|
|
tby.Enabled=false;
|
|
|
|
|
tbj.Enabled=false;
|
|
|
|
|
tbf.Enabled=false;
|
|
|
|
|
tbPURPOSE.Enabled=false;
|
|
|
|
|
tbPASSWORD.Enabled=false;
|
|
|
|
|
tbPAYEEBANK.Enabled=false;
|
|
|
|
|
tbPAYEEBANKACCOUNT.Enabled=false;
|
|
|
|
|
tbPAYEEADR.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void getEnter()
|
|
|
|
|
{
|
|
|
|
|
if (Decimal.Parse(tbCHEQUEAMOUNT.Text.Trim()) <= 0)
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('开票金额必须大于0!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool bl = false;
|
|
|
|
|
strHandleType = ViewState["strHandleType"].ToString();
|
|
|
|
|
if (strHandleType.Equals("add"))//新增
|
|
|
|
|
{
|
|
|
|
|
bl = getAdd();
|
|
|
|
|
}
|
|
|
|
|
else if (strHandleType.Equals("edit"))//录入
|
|
|
|
|
{
|
|
|
|
|
bl = getEdit();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (bl)
|
|
|
|
|
{
|
|
|
|
|
this.ibEnter.Disabled = false;
|
|
|
|
|
this.ibPrint.Disabled = false;
|
|
|
|
|
this.imgDel.Disabled = false;
|
|
|
|
|
ViewState["strHandleType"] = "edit";
|
|
|
|
|
strHandleType = ViewState["strHandleType"].ToString();
|
|
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "');</script>");
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "<script>alert('成功提交!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key4", "<script>alert('出错,请重新填写!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 生成开票申请编号
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成开票申请编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string CreateBillNO()
|
|
|
|
|
{
|
|
|
|
|
int CodeLength = 4;
|
|
|
|
|
string strSettleCode = "";
|
|
|
|
|
|
|
|
|
|
//获取分公司的票号头字符
|
|
|
|
|
string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
|
|
|
|
|
string strFeeType = tempBANKSHEAD+"CH";
|
|
|
|
|
FeeDoDA feeDoDA = new FeeDoDA();
|
|
|
|
|
DateTime nowDateTime = feeDoDA.getServerDateTime();
|
|
|
|
|
|
|
|
|
|
string strYear = nowDateTime.Year.ToString();
|
|
|
|
|
string strMonth = nowDateTime.Month.ToString().Length < 2 ? "0" + nowDateTime.Month.ToString() : nowDateTime.Month.ToString();
|
|
|
|
|
//string strDay = nowDateTime.Day.ToString();
|
|
|
|
|
string strDateTime = strYear + strMonth;
|
|
|
|
|
string strCodePrefix = strFeeType + strDateTime;
|
|
|
|
|
|
|
|
|
|
//string strSql = "SELECT TOP 1 BILLNO FROM ch_fee_chequeapplication WHERE BILLNO LIKE '" + strFeeType + strDateTime + "%' ORDER BY BILLNO DESC";
|
|
|
|
|
string strSql = " SELECT TOP 1 BILLNO FROM "
|
|
|
|
|
+ " (SELECT BILLNO FROM ch_fee_cheque WHERE BILLNO LIKE '" + strFeeType + strDateTime + "%') as A ORDER BY BILLNO DESC";
|
|
|
|
|
DataTable billTable = feeDoDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
|
|
|
|
ArrayList codeArg = new ArrayList();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < CodeLength; i++)
|
|
|
|
|
{
|
|
|
|
|
codeArg.Add(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string strCode = "";//编号
|
|
|
|
|
if (billTable.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string oldCode = billTable.Rows[0][0].ToString();
|
|
|
|
|
|
|
|
|
|
if (oldCode.IndexOf(strCodePrefix) >= 0)
|
|
|
|
|
{
|
|
|
|
|
oldCode = oldCode.Substring(strCodePrefix.Length, oldCode.Length - strCodePrefix.Length);
|
|
|
|
|
if (oldCode.Length == CodeLength)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < oldCode.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (oldCode[i].ToString().IndexOf("0") == 0)
|
|
|
|
|
{
|
|
|
|
|
oldCode = oldCode.Remove(i, 1);
|
|
|
|
|
i = -1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int newNum = int.Parse(oldCode);
|
|
|
|
|
|
|
|
|
|
newNum = newNum + 1;
|
|
|
|
|
|
|
|
|
|
string strNewNum = newNum.ToString();
|
|
|
|
|
|
|
|
|
|
int codeArgCount = codeArg.Count - 1;
|
|
|
|
|
for (int i = strNewNum.Length - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
codeArg[codeArgCount] = strNewNum[i];
|
|
|
|
|
codeArgCount--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int iOld = int.Parse(codeArg[codeArg.Count - 1].ToString());
|
|
|
|
|
codeArg[codeArg.Count - 1] = (iOld + 1).ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < codeArg.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
strCode += codeArg[i].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strSettleCode = strFeeType + strDateTime + strCode;
|
|
|
|
|
return strSettleCode;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
protected bool getAdd()
|
|
|
|
|
{
|
|
|
|
|
ChFeeChequeEntity.GID=ViewState["GID"].ToString().Trim(); // 惟一编号
|
|
|
|
|
//
|
|
|
|
|
string strCOMPANYID = T_ALL_DA.GetCORPID(strUserID);
|
|
|
|
|
tbCHEQUENO.Text=T_ALL_DA.GetStrSQL("CHEQUENUM", "select top 1 CHEQUENUM from ch_fee_chequeitems where ISDELETE='False' and ISLOCK=0 and ISMAKEOUT='False' and BOOKID in(select GID from ch_fee_chequebooks where ISDELETE='False' and ISLOCK='False' and COMPANYID='" + strCOMPANYID + "' and CURRENCY='" + this.hd_comboCURRENCY.Value.ToString().Trim() + "') order by CHEQUENUM");
|
|
|
|
|
ChFeeChequeEntity.CHEQUENO = tbCHEQUENO.Text.Trim();//支票号码
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.BILLNO = CreateBillNO(); // 申请编号
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.PAYSETTLEBILLNO = ""; // 付费结算编号
|
|
|
|
|
if (ViewState["PAYSETTLEBILLNO"] != null)
|
|
|
|
|
{
|
|
|
|
|
ChFeeChequeEntity.PAYSETTLEBILLNO = ViewState["PAYSETTLEBILLNO"].ToString().Trim(); // 付费结算编号
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.ToString().Trim(); // 客户名称
|
|
|
|
|
ChFeeChequeEntity.CHEQUECUSTNAME = tbCHEQUECUSTNAME.Text.Trim(); // 支票抬头/收款单位
|
|
|
|
|
//出票日期
|
|
|
|
|
ChFeeChequeEntity.YEAR=""; // 年
|
|
|
|
|
ChFeeChequeEntity.MONTH=""; // 月
|
|
|
|
|
ChFeeChequeEntity.DAY=""; // 日
|
|
|
|
|
ChFeeChequeEntity.YEARUPPER=""; // 年大写
|
|
|
|
|
ChFeeChequeEntity.MONTHUPPER=""; // 月大写
|
|
|
|
|
ChFeeChequeEntity.DAYUPPER=""; // 日大写
|
|
|
|
|
ChFeeChequeEntity.MAKETIMEUPPER = ""; // 出票日期中文大写
|
|
|
|
|
|
|
|
|
|
if (tbCHEQUEMAKETIME.Text.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
string sdate = tbCHEQUEMAKETIME.Text.Trim();
|
|
|
|
|
ChFeeChequeEntity.CHEQUEMAKETIME = DateTime.Parse(sdate);//出票日期
|
|
|
|
|
|
|
|
|
|
int idate = sdate.IndexOf("-");
|
|
|
|
|
int ildate = sdate.LastIndexOf("-");
|
|
|
|
|
ChFeeChequeEntity.YEAR = sdate.Substring(0,4); // 年
|
|
|
|
|
ChFeeChequeEntity.MONTH = sdate.Substring(idate+1,ildate-idate-1); // 月
|
|
|
|
|
ChFeeChequeEntity.DAY = sdate.Substring(ildate+1); // 日
|
|
|
|
|
//
|
|
|
|
|
sdate = this.hd_tbMAKETIMEUPPER.Value.Trim();
|
|
|
|
|
ChFeeChequeEntity.MAKETIMEUPPER = sdate;//出票日期中文大写
|
|
|
|
|
|
|
|
|
|
idate = sdate.IndexOf("年");
|
|
|
|
|
ildate = sdate.LastIndexOf("月");
|
|
|
|
|
ChFeeChequeEntity.YEARUPPER = sdate.Substring(0,idate); // 年大写
|
|
|
|
|
ChFeeChequeEntity.MONTHUPPER = sdate.Substring(idate+1,ildate-idate-1); // 月大写
|
|
|
|
|
ChFeeChequeEntity.DAYUPPER = sdate.Substring(ildate + 1, sdate.Length-ildate-2); // 日大写
|
|
|
|
|
}
|
|
|
|
|
ChFeeChequeEntity.PURPOSE = tbPURPOSE.Text.Trim(); // 用途
|
|
|
|
|
ChFeeChequeEntity.PASSWORD = tbPASSWORD.Text.Trim(); // 密码
|
|
|
|
|
ChFeeChequeEntity.CHEQUECURRENCY = this.hd_comboCURRENCY.Value.ToString().Trim(); // 支票币别
|
|
|
|
|
ChFeeChequeEntity.CHEQUETYPE = int.Parse(ddlCHEQUETYPE.Text.Trim()); // 支票类别
|
|
|
|
|
ChFeeChequeEntity.CHEQUEAMOUNT = Decimal.Parse(tbCHEQUEAMOUNT.Text.Trim()); // 支票金额
|
|
|
|
|
ChFeeChequeEntity.CHEQUEAMOUNTUPPER = this.hd_tbCHEQUEAMOUNTUPPER.Value.ToString().Trim(); // 支票金额大写
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.BAIYI = ""; // 百亿
|
|
|
|
|
ChFeeChequeEntity.SHIYI = ""; // 十亿
|
|
|
|
|
ChFeeChequeEntity.YI = ""; // 亿
|
|
|
|
|
ChFeeChequeEntity.QIANWAN = this.hd_tbqw.Value.ToString().Trim(); // 千万
|
|
|
|
|
ChFeeChequeEntity.BAIWAN = this.hd_tbbw.Value.ToString().Trim(); // 百万
|
|
|
|
|
ChFeeChequeEntity.SHIWAN = this.hd_tbsw.Value.ToString().Trim(); // 十万
|
|
|
|
|
ChFeeChequeEntity.WAN = this.hd_tbw.Value.ToString().Trim(); // 万
|
|
|
|
|
ChFeeChequeEntity.QIAN = this.hd_tbq.Value.ToString().Trim(); // 千
|
|
|
|
|
ChFeeChequeEntity.BAI = this.hd_tbb.Value.ToString().Trim(); // 百
|
|
|
|
|
ChFeeChequeEntity.SHI = this.hd_tbs.Value.ToString().Trim(); // 十
|
|
|
|
|
ChFeeChequeEntity.YUAN = this.hd_tby.Value.ToString().Trim(); // 元
|
|
|
|
|
ChFeeChequeEntity.JIAO = this.hd_tbj.Value.ToString().Trim(); // 角
|
|
|
|
|
ChFeeChequeEntity.FEN = this.hd_tbf.Value.ToString().Trim(); // 分
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.UNIT = this.hd_tbUNIT.Value.ToString().Trim(); // 金额单位
|
|
|
|
|
ChFeeChequeEntity.ISDELETE = false;//是否废除
|
|
|
|
|
ChFeeChequeEntity.DELETEOPERATOR = lbDELETEOPERATOR.Text; // 废除人
|
|
|
|
|
ChFeeChequeEntity.DELETECAUSE = lbDELETECAUSE.Text; // 废除原因
|
|
|
|
|
//ChFeeChequeEntity.DELETETIME.ToString().Trim(); // 废除时间
|
|
|
|
|
ChFeeChequeEntity.ISPRINT = false;//是否打印
|
|
|
|
|
ChFeeChequeEntity.PAYBANK = this.hd_comboPAYBANK.Value.ToString().Trim(); // 付款行
|
|
|
|
|
ChFeeChequeEntity.PAYBANKACCOUNT = tbPAYBANKACCOUNT.Text.Trim(); // 付款行账号
|
|
|
|
|
ChFeeChequeEntity.PAYEEBANK = tbPAYEEBANK.Text.Trim(); // 收款单位银行
|
|
|
|
|
ChFeeChequeEntity.PAYEEBANKACCOUNT = tbPAYEEBANKACCOUNT.Text.Trim(); // 付款单位银行账号
|
|
|
|
|
ChFeeChequeEntity.PAYEEADR = tbPAYEEADR.Text.Trim(); // 收款单位地址
|
|
|
|
|
ChFeeChequeEntity.ISAUDIT = false;//是否审核
|
|
|
|
|
ChFeeChequeEntity.AUDITOPERATOR = ""; // 审核人
|
|
|
|
|
//ChFeeChequeEntity.AUDITDATE.ToString().Trim(); // 审核时间
|
|
|
|
|
ChFeeChequeEntity.CREATEUSER = strUserID; // 创建人
|
|
|
|
|
//ChFeeChequeEntity.CREATETIME.ToString().Trim(); // 创建时间
|
|
|
|
|
ChFeeChequeEntity.MODIFIEDUSER = strUserID; // 最后一次更新操作人GID
|
|
|
|
|
//
|
|
|
|
|
int iResult = ChFeeChequeDA.InserInfo(ChFeeChequeEntity);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
ViewState["strHandleType"] = "edit";
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool getEdit()
|
|
|
|
|
{
|
|
|
|
|
ChFeeChequeEntity.GID = ViewState["GID"].ToString().Trim(); // 惟一编号
|
|
|
|
|
//
|
|
|
|
|
//ChFeeChequeEntity.CHEQUENO = ""; // 支票号码
|
|
|
|
|
//
|
|
|
|
|
//ChFeeChequeEntity.BILLNO = ""; // 申请编号
|
|
|
|
|
//
|
|
|
|
|
//ChFeeChequeEntity.PAYSETTLEBILLNO = ViewState["PAYSETTLEBILLNO"].ToString().Trim(); // 付费结算编号
|
|
|
|
|
ChFeeChequeEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.ToString().Trim(); // 客户名称
|
|
|
|
|
ChFeeChequeEntity.CHEQUECUSTNAME = tbCHEQUECUSTNAME.Text.Trim(); // 支票抬头/收款单位
|
|
|
|
|
//出票日期
|
|
|
|
|
ChFeeChequeEntity.YEAR = ""; // 年
|
|
|
|
|
ChFeeChequeEntity.MONTH = ""; // 月
|
|
|
|
|
ChFeeChequeEntity.DAY = ""; // 日
|
|
|
|
|
ChFeeChequeEntity.YEARUPPER = ""; // 年大写
|
|
|
|
|
ChFeeChequeEntity.MONTHUPPER = ""; // 月大写
|
|
|
|
|
ChFeeChequeEntity.DAYUPPER = ""; // 日大写
|
|
|
|
|
ChFeeChequeEntity.MAKETIMEUPPER = ""; // 出票日期中文大写
|
|
|
|
|
|
|
|
|
|
if (tbCHEQUEMAKETIME.Text.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
string sdate = tbCHEQUEMAKETIME.Text.Trim();
|
|
|
|
|
ChFeeChequeEntity.CHEQUEMAKETIME = DateTime.Parse(sdate);//出票日期
|
|
|
|
|
|
|
|
|
|
int idate = sdate.IndexOf("-");
|
|
|
|
|
int ildate = sdate.LastIndexOf("-");
|
|
|
|
|
ChFeeChequeEntity.YEAR = sdate.Substring(0, 4); // 年
|
|
|
|
|
ChFeeChequeEntity.MONTH = sdate.Substring(idate + 1, ildate - idate - 1); // 月
|
|
|
|
|
ChFeeChequeEntity.DAY = sdate.Substring(ildate + 1); // 日
|
|
|
|
|
//
|
|
|
|
|
sdate = this.hd_tbMAKETIMEUPPER.Value.Trim();
|
|
|
|
|
ChFeeChequeEntity.MAKETIMEUPPER = sdate;//出票日期中文大写
|
|
|
|
|
|
|
|
|
|
idate = sdate.IndexOf("年");
|
|
|
|
|
ildate = sdate.LastIndexOf("月");
|
|
|
|
|
ChFeeChequeEntity.YEARUPPER = sdate.Substring(0, idate); // 年大写
|
|
|
|
|
ChFeeChequeEntity.MONTHUPPER = sdate.Substring(idate + 1, ildate - idate - 1); // 月大写
|
|
|
|
|
ChFeeChequeEntity.DAYUPPER = sdate.Substring(ildate + 1, sdate.Length - ildate - 2); // 日大写
|
|
|
|
|
}
|
|
|
|
|
ChFeeChequeEntity.PURPOSE = tbPURPOSE.Text.Trim(); // 用途
|
|
|
|
|
ChFeeChequeEntity.PASSWORD = tbPASSWORD.Text.Trim(); // 密码
|
|
|
|
|
ChFeeChequeEntity.CHEQUECURRENCY = this.hd_comboCURRENCY.Value.ToString().Trim(); // 支票币别
|
|
|
|
|
ChFeeChequeEntity.CHEQUETYPE = int.Parse(ddlCHEQUETYPE.Text.Trim()); // 支票类别
|
|
|
|
|
ChFeeChequeEntity.CHEQUEAMOUNT = Decimal.Parse(tbCHEQUEAMOUNT.Text.Trim()); // 支票金额
|
|
|
|
|
ChFeeChequeEntity.CHEQUEAMOUNTUPPER = this.hd_tbCHEQUEAMOUNTUPPER.Value.ToString().Trim(); // 支票金额大写
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.BAIYI = ""; // 百亿
|
|
|
|
|
ChFeeChequeEntity.SHIYI = ""; // 十亿
|
|
|
|
|
ChFeeChequeEntity.YI = ""; // 亿
|
|
|
|
|
ChFeeChequeEntity.QIANWAN = this.hd_tbqw.Value.ToString().Trim(); // 千万
|
|
|
|
|
ChFeeChequeEntity.BAIWAN = this.hd_tbbw.Value.ToString().Trim(); // 百万
|
|
|
|
|
ChFeeChequeEntity.SHIWAN = this.hd_tbsw.Value.ToString().Trim(); // 十万
|
|
|
|
|
ChFeeChequeEntity.WAN = this.hd_tbw.Value.ToString().Trim(); // 万
|
|
|
|
|
ChFeeChequeEntity.QIAN = this.hd_tbq.Value.ToString().Trim(); // 千
|
|
|
|
|
ChFeeChequeEntity.BAI = this.hd_tbb.Value.ToString().Trim(); // 百
|
|
|
|
|
ChFeeChequeEntity.SHI = this.hd_tbs.Value.ToString().Trim(); // 十
|
|
|
|
|
ChFeeChequeEntity.YUAN = this.hd_tby.Value.ToString().Trim(); // 元
|
|
|
|
|
ChFeeChequeEntity.JIAO = this.hd_tbj.Value.ToString().Trim(); // 角
|
|
|
|
|
ChFeeChequeEntity.FEN = this.hd_tbf.Value.ToString().Trim(); // 分
|
|
|
|
|
//
|
|
|
|
|
ChFeeChequeEntity.UNIT = this.hd_tbUNIT.Value.ToString().Trim(); // 金额单位
|
|
|
|
|
//ChFeeChequeEntity.ISDELETE = false;//是否废除
|
|
|
|
|
//ChFeeChequeEntity.DELETEOPERATOR = lbDELETEOPERATOR.Text; // 废除人
|
|
|
|
|
//ChFeeChequeEntity.DELETECAUSE = lbDELETECAUSE.Text; // 废除原因
|
|
|
|
|
//ChFeeChequeEntity.DELETETIME.ToString().Trim(); // 废除时间
|
|
|
|
|
//ChFeeChequeEntity.ISPRINT = false;//是否打印
|
|
|
|
|
ChFeeChequeEntity.PAYBANK = this.hd_comboPAYBANK.Value.ToString().Trim(); // 付款行
|
|
|
|
|
ChFeeChequeEntity.PAYBANKACCOUNT = tbPAYBANKACCOUNT.Text.Trim(); // 付款行账号
|
|
|
|
|
ChFeeChequeEntity.PAYEEBANK = tbPAYEEBANK.Text.Trim(); // 收款单位银行
|
|
|
|
|
ChFeeChequeEntity.PAYEEBANKACCOUNT = tbPAYEEBANKACCOUNT.Text.Trim(); // 付款单位银行账号
|
|
|
|
|
ChFeeChequeEntity.PAYEEADR = tbPAYEEADR.Text.Trim(); // 收款单位地址
|
|
|
|
|
//ChFeeChequeEntity.ISAUDIT = false;//是否审核
|
|
|
|
|
//ChFeeChequeEntity.AUDITOPERATOR = ""; // 审核人
|
|
|
|
|
//ChFeeChequeEntity.AUDITDATE.ToString().Trim(); // 审核时间
|
|
|
|
|
//ChFeeChequeEntity.CREATEUSER = strUserID; // 创建人
|
|
|
|
|
//ChFeeChequeEntity.CREATETIME.ToString().Trim(); // 创建时间
|
|
|
|
|
ChFeeChequeEntity.MODIFIEDUSER = strUserID; // 最后一次更新操作人GID
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
int iResult = ChFeeChequeDA.UpdateInfo(ChFeeChequeEntity);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
//this.hdEnter.Value = "1";
|
|
|
|
|
//Response.Write("<script>alert('成功提交!');history.back();</script>");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//this.hdEnter.Value = "0";
|
|
|
|
|
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsNumeric(string s)
|
|
|
|
|
{
|
|
|
|
|
int inum = 0;
|
|
|
|
|
bool bReturn = true;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
inum = int.Parse(s);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
inum = 0;
|
|
|
|
|
bReturn = false;
|
|
|
|
|
}
|
|
|
|
|
return bReturn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|