/// <summary>
        /// 检验是否能成功产生单据名称
        /// </summary>
        /// <param name="cuscode">输入的单号</param>
        /// <param name="cname">单号全称</param>
        /// <param name="attachment">>单号代码不包含流水号</param>
        /// <param name="txt">流水号</param>
        private bool StrNumbers(string strcuscode, out string serialNum, out string codeformat, out string ordernum)
        {
            bool result = true;

            serialNum  = "";                                                     //客户代码全称
            codeformat = "";                                                     //名称,不包含流水号
            ordernum   = "";                                                     //流水号

            DataTable tbl       = GetModuleCoding();                             //自动编码
            string    txtformat = tbl.Rows[0]["txtformat"].ToString();           //名称的格式
            string    usecode   = tbl.Rows[0]["usecode"].ToString();             //流水号
            int       len       = int.Parse(tbl.Rows[0]["orderlen"].ToString()); //流水号长度


            DataTable custbl = null;
            string    strsql = ""; //查询字符窜

            if (usecode == "0")
            {
                if (strcuscode.Trim() != "")
                {
                    serialNum = strcuscode; //客户代码全称
                }
                else
                {
                    result = false;
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "test", "<script>alert('保存失败,业务编号不能为空!')</script>");
                }
            }
            else
            {
                int num = 1;                     //默认流水号
                codeformat = Numbers(txtformat); //名称
                strsql     = "  codeFormat= '" + codeformat + "' AND LEN(orderNum) =" + len.ToString();
                custbl     = To_CollectingManager.GetList(1, strsql, "markDate desc");

                if (custbl.Rows.Count >= 1)
                {
                    if (custbl.Rows[0]["orderNum"].ToString() != "")
                    {
                        num = int.Parse(custbl.Rows[0]["orderNum"].ToString()) + 1; //流水号
                        if (num.ToString().Length > len)
                        {
                            result = false;
                            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "test", "<script>alert('保存失败,业务编号长度不够!')</script>");
                        }
                    }
                }
                ordernum  = num.ToString().PadLeft(len, '0'); //流水号
                serialNum = codeformat + ordernum;            //客户代码全称
            }
            return(result);
        }
        protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            //参数数组,0:单据ID,1:是否确认,2:制单员
            string[] cmdArgs = e.CommandArgument.ToString().Split(',');

            string cmdName = e.CommandName;

            //表示单据是否已确认
            bool      confirmReceipt = false;
            bool      ismaker        = false;
            LoginInfo login          = Session["login"] as LoginInfo;

            if (cmdArgs.Length > 1)
            {
                confirmReceipt = cmdArgs[1] == "1";
                ismaker        = cmdArgs[2] == login.Cname;
            }

            string msg = "";

            switch (cmdName)
            {
            case "EDIT":
                if (confirmReceipt)
                {
                    msg = "已确认单据不能修改";
                    break;
                }
                if (!ismaker)
                {
                    msg = "不是本人所做的收款单不能修改";
                    break;
                }
                if (HttpContext.Current.Request.QueryString["page"] != null)
                {
                    int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                    Server.Transfer(string.Format("CollectingEdit.aspx?pageindex=" + page + "&id={0}", cmdArgs[0]));
                }
                else
                {
                    Server.Transfer(string.Format("CollectingEdit.aspx?id={0}", cmdArgs[0]));
                }
                break;

            case "search":
                if (AspNetPager1.CurrentPageIndex > 1)
                {
                    int page = AspNetPager1.CurrentPageIndex;
                    Response.Redirect("Collecting.aspx?pageindex=" + page + "&id=" + e.CommandArgument.ToString());    //参数sqsh判断当前所跳转到预览界面的是申请还是审核
                }
                else
                {
                    Response.Redirect("Collecting.aspx?id=" + e.CommandArgument.ToString());
                }
                break;

            case "DELETE":
                if (confirmReceipt)
                {
                    msg = "已确认单据不能删除";
                    break;
                }
                if (!ismaker)
                {
                    msg = "不是本人所做的收款单不能删除";
                    break;
                }
                DeleteCollecting(int.Parse(cmdArgs[0]));
                break;

            case "CANCEL":
                To_ClaimManager claimBLL = new To_ClaimManager();
                if (claimBLL.ExitsCollecting(int.Parse(cmdArgs[0])))
                {
                    msg = "该条收款记录已被认领,不能取消确认";
                    break;
                }
                To_CollectingManager.CancelConfirm(int.Parse(cmdArgs[0]));
                BindRpList();
                break;

            case "confirm":
                To_CollectingManager.updateConfirm(cmdArgs[0], login.Cname, DateTime.Now.ToString());
                BindRpList();
                break;

            case "CHANGE":
                To_Income income  = new To_Income();
                DataTable mytable = To_CollectingManager.GetList(1, "id=" + cmdArgs[0], "id desc");
                if (mytable != null)
                {
                    income.ComeBankAccount = mytable.Rows[0]["payBankAcount"].ToString();
                    income.ComeBankId      = int.Parse(mytable.Rows[0]["payBankId"].ToString());
                    income.ComeBankName    = mytable.Rows[0]["payBank"].ToString();
                    income.ComeDate        = DateTime.Parse(mytable.Rows[0]["receiptDate"].ToString());
                    income.ComeDepart      = mytable.Rows[0]["markerDepartment"].ToString();
                    income.ComeDepartId    = int.Parse(mytable.Rows[0]["markerDepartmentID"].ToString());
                    income.ComeMoney       = double.Parse(mytable.Rows[0]["receiptAmount"].ToString());
                    income.ComeUnit        = mytable.Rows[0]["paymentUnit"].ToString();
                    income.MakeDate        = DateTime.Parse(mytable.Rows[0]["markDate"].ToString());
                    income.MakeId          = int.Parse(mytable.Rows[0]["markerID"].ToString());
                    income.MakeName        = mytable.Rows[0]["marker"].ToString();
                    income.Remark          = mytable.Rows[0]["receiptMark"].ToString() + " 由原收款单号为" + mytable.Rows[0]["receiptNum"].ToString() + "转化而来";
                    income.SKType          = "";
                    income.SKTypeId        = 0;
                    if (To_IncomeManager.Add(income) > 0)
                    {
                        msg = "该条收款记录已成功转化为其他收款";
                        To_CollectingManager.deleteTo_Collecting(int.Parse(cmdArgs[0]));    //转化完成之后对起进行删除
                    }
                }
                BindRpList();
                break;

            default:
                break;
            }

            if (msg != string.Empty)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", string.Format("alert('{0}');", msg), true);
            }
        }