예제 #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);
            }
        }