예제 #1
0
        /// <summary>
        /// 添加收款数据
        /// </summary>
        /// <returns>添加成功返回true</returns>
        private int AddCollecting()
        {
            string number      = ""; //单号
            string codeFormart = ""; //自动编码规则
            string orderNum    = ""; //流水号

            if (StrNumbers(txtNumber.Text.Trim(), out number, out codeFormart, out orderNum))
            {
                LoginInfo currentUser = Session["login"] as LoginInfo;

                To_Collecting collectingModel = new To_Collecting();
                collectingModel.ReceiptNum         = number;                                                                         //收款单号
                collectingModel.codeFormat         = codeFormart;                                                                    //编码规则
                collectingModel.orderNum           = orderNum;
                collectingModel.ReceiptDate        = DateTime.Parse(txtDate.Text.Trim());                                            //收款时间
                collectingModel.ReceiptAmount      = double.Parse(txtMoney.Text.Trim());                                             // 收款金额
                collectingModel.BusinessUnit       = ddlUnit.SelectedItem.Text;                                                      //经营单位
                collectingModel.BusinessUnitID     = int.Parse(ddlUnit.SelectedValue);
                collectingModel.PaymentUnit        = txtUnit.Text;                                                                   //付款单位
                collectingModel.PaymentUnitID      = int.Parse(hidComID.Value.Trim() == string.Empty ? "0" : hidComID.Value.Trim()); //付款单位id
                collectingModel.PaymentMode        = 1;                                                                              /* int.Parse(ddlWay.SelectedValue.Trim()); //入账方式*/
                collectingModel.ReceiptMark        = txtMark.Value;                                                                  //备注
                collectingModel.Marker             = currentUser.Cname;
                collectingModel.MarkerID           = currentUser.Id;
                collectingModel.MarkerDepartment   = lblMarkerDepartment.Text;
                collectingModel.MarkerDepartmentID = currentUser.Departid;
                collectingModel.MarkDate           = DateTime.Parse(txtMarkDate.Text);
                collectingModel.ConfirmReceipt     = ChkConfirm.Checked ? 1 : 0;
                collectingModel.receiptStatusCode  = 0;

                collectingModel.payBankId     = int.Parse(DdlBank.SelectedValue);
                collectingModel.PayBank       = DdlBank.SelectedItem.Text;//txtBank.Text;
                collectingModel.PayBankAcount = txtBankAccount.Text;

                //if (int.Parse(ddlWay.SelectedValue.Trim()) != 0)
                //{
                //    collectingModel.payBankId = int.Parse(DdlBank.SelectedValue);
                //    collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text;
                //    collectingModel.PayBankAcount = txtBankAccount.Text;
                //}
                //else
                //{
                //    collectingModel.payBankId = 0;
                //    collectingModel.PayBank = "";//txtBank.Text;
                //    collectingModel.PayBankAcount = "";
                //}

                int id = To_CollectingManager.addTo_Collecting(collectingModel);
                if (ChkConfirm.Checked) //如果确认登记了。那么需要登记确认人和确认日期
                {
                    To_CollectingManager.updateConfirm(id.ToString(), currentUser.Cname, DateTime.Now.ToString());
                }
                AddLimit(id);
                return(id);
            }
            else
            {
                return(0);
            }
        }
예제 #2
0
        /// <summary>
        /// 添加收款数据
        /// </summary>
        /// <returns>添加成功返回true</returns>
        private bool EditCollecting()
        {
            LoginInfo currentUser = Session["login"] as LoginInfo;

            To_Collecting collectingModel = new To_Collecting();

            int ID = Convert.ToInt32(Request.QueryString["id"]);

            collectingModel = To_CollectingManager.getTo_CollectingById(ID);

            collectingModel.BusinessUnit       = ddlUnit.SelectedItem.Text;
            collectingModel.BusinessUnitID     = int.Parse(ddlUnit.SelectedValue);
            collectingModel.MarkDate           = DateTime.Parse(txtMarkDate.Text);
            collectingModel.Marker             = currentUser.Cname;
            collectingModel.MarkerID           = currentUser.Id;
            collectingModel.MarkerDepartment   = lblMarkerDepartment.Text;
            collectingModel.MarkerDepartmentID = currentUser.Departid;
            collectingModel.payBankId          = int.Parse(DdlBank.SelectedValue);
            collectingModel.PayBank            = DdlBank.SelectedItem.Text;//txtBank.Text;
            collectingModel.PayBankAcount      = txtBankAccount.Text;

            //collectingModel.PaymentMode = int.Parse(ddlWay.SelectedValue.Trim());
            //if (int.Parse(ddlWay.SelectedValue.Trim()) != 0)
            //{
            //    if (DdlBank.SelectedIndex < 0)
            //    {
            //        return false;
            //    }
            //    collectingModel.payBankId = int.Parse(DdlBank.SelectedValue);
            //    collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text;
            //    collectingModel.PayBankAcount = txtBankAccount.Text;
            //}
            //else
            //{
            //    collectingModel.payBankId = 0;
            //    collectingModel.PayBank = "";//txtBank.Text;
            //    collectingModel.PayBankAcount = "";
            //}

            collectingModel.PaymentUnit    = txtUnit.Text;
            collectingModel.PaymentUnitID  = int.Parse(hidComID.Value.Trim() == string.Empty ? "0" : hidComID.Value.Trim());
            collectingModel.ReceiptAmount  = float.Parse(txtMoney.Text);
            collectingModel.ReceiptDate    = DateTime.Parse(txtDate.Text);
            collectingModel.ReceiptMark    = txtMark.Value;
            collectingModel.ReceiptNum     = txtNumber.Text;
            collectingModel.ConfirmReceipt = ChkConfirm.Checked ? 1 : 0;

            AddLimit(ID);
            if (ChkConfirm.Checked) //如果确认登记了。那么需要登记确认人和确认日期
            {
                To_CollectingManager.updateConfirm(ID.ToString(), currentUser.Cname, DateTime.Now.ToString());
            }
            if (Request.QueryString["action"] == null)
            {
                collectingModel.ID = Convert.ToInt32(Request.QueryString["id"]);
                return(To_CollectingManager.updateTo_Collecting(collectingModel) > 0);
            }
            else
            {
                return(To_CollectingManager.addTo_Collecting(collectingModel) > 0);
            }
        }
예제 #3
0
        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);
            }
        }