Ejemplo n.º 1
0
 /// <summary>
 /// 计算已付款
 /// </summary>
 /// <param name="orderId"></param>
 /// <returns></returns>
 protected string GetPayed(string orderId)
 {
     string totle = string.Empty;
     decimal remPrice = 0;
     decimal payPrice = 0;
     decimal prePrice = 0;
     //银行支付
     ShowShop.BLL.Order.RemittanceInfo remBll = new ShowShop.BLL.Order.RemittanceInfo();
     List<ShowShop.Model.Order.RemittanceInfo> remdate = remBll.GetAll("orderid='" + orderId + "'");
     if (remdate.Count > 0)
     {
         foreach (ShowShop.Model.Order.RemittanceInfo da in remdate)
         {
             remPrice += Convert.ToDecimal(da.RemittanceMoney.ToString());
         }
     }
     //现金支付
     ShowShop.BLL.Order.PaymentMoney payBll = new ShowShop.BLL.Order.PaymentMoney();
     List<ShowShop.Model.Order.PaymentMoney> paydata = payBll.GetAll("orderid='" + orderId + "'");
     if (paydata.Count > 0)
     {
         foreach (ShowShop.Model.Order.PaymentMoney da in paydata)
         {
             payPrice += Convert.ToDecimal(da.GatheringMoney.ToString());
         }
     }
     //预付款
     ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney();
     List<ShowShop.Model.Order.PrepayMoney> predata = preBll.GetAll("orderid='" + orderId + "'");
     if (predata.Count > 0)
     {
         foreach (ShowShop.Model.Order.PrepayMoney da in predata)
         {
             prePrice += Convert.ToDecimal(da.PayoutMoney);
         }
     }
     totle = (remPrice + payPrice + prePrice).ToString();
     return totle;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        protected string GetMoneyList(string orderId)
        {
            ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
            //银行资金
            ShowShop.BLL.Order.RemittanceInfo remBll = new ShowShop.BLL.Order.RemittanceInfo();
            ChangeHope.DataBase.DataByPage remData = remBll.GetList(" 1=1 and orderid='" + orderId + "'");
            //预付款
            ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney();
            ChangeHope.DataBase.DataByPage preData = preBll.GetList(" 1=1 and orderid='" + orderId + "'");
            //现金付款
            ShowShop.BLL.Order.PaymentMoney payBll = new ShowShop.BLL.Order.PaymentMoney();
            ChangeHope.DataBase.DataByPage payData = payBll.GetList(" 1=1 and orderid='" + orderId + "'");

            //第一步先添加表头
            table.AddHeadCol("", "客户名称");
            table.AddHeadCol("", "交易时间");
            table.AddHeadCol("", "交易方式");
            table.AddHeadCol("", "交易金额");
            table.AddHeadCol("", "备注/说明");
            table.AddHeadCol("", "赠送点卷");
            table.AddRow();
            //添加银行付款的内容
            if (remData.DataReader != null)
            {
                while (remData.DataReader.Read())
                {
                    table.AddCol(remData.DataReader["username"].ToString());
                    table.AddCol(remData.DataReader["remittancedate"].ToString());
                    table.AddCol("银行支付");
                    if (remData.DataReader["remittancemoney"].ToString() == "0")
                    {
                        table.AddCol("");
                    }
                    else
                    {
                        table.AddCol(remData.DataReader["remittancemoney"].ToString());
                    }
                    table.AddCol(remData.DataReader["remark"].ToString());
                    table.AddCol(remData.DataReader["presentticket"].ToString());
                    table.AddRow();
                }
            }
            //添加预付款的内容
            if (preData.DataReader != null)
            {
                while (preData.DataReader.Read())
                {
                    table.AddCol(preData.DataReader["username"].ToString());
                    table.AddCol(preData.DataReader["notedate"].ToString());
                    table.AddCol("预付款支付");
                    table.AddCol(preData.DataReader["payoutmoney"].ToString());
                    table.AddCol(preData.DataReader["remark"].ToString());
                    table.AddCol("0");
                    table.AddRow();
                }
            }
            //添加现金付款的内容
            if (payData.DataReader != null)
            {
                while (payData.DataReader.Read())
                {
                    table.AddCol(payData.DataReader["username"].ToString());
                    table.AddCol(payData.DataReader["gatheringdate"].ToString());
                    table.AddCol("现金付款");
                    table.AddCol(payData.DataReader["gatheringmoney"].ToString());
                    table.AddCol(payData.DataReader["remark"].ToString());
                    table.AddCol(payData.DataReader["presentticket"].ToString());
                    table.AddRow();
                }
            }
            string view = table.GetTable();
            remData.Dispose();
            remData = null;
            preData.Dispose();
            preData = null;
            payData.Dispose();
            payData = null;
            return view;
        }
Ejemplo n.º 3
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            /*修改人:YM
             *修改时间:2009-12-17
             *判断订单是否是会员订单及用户是否存在
             */
            if (this.lblUserName.Text.Trim() == "")
            {
                this.ltlMsg.Text = "操作失败!您所支付的订单可能是非会员生成的订单.";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.lblUserName.Text);
            if (memberModel == null)
            {
                this.ltlMsg.Text = "操作失败!该会员不存在.";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            #region 订单预付款资金
            ShowShop.Model.Order.PrepayMoney preModel = new ShowShop.Model.Order.PrepayMoney();
            ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney();
            preModel.OrderId = this.lblOrderId.Text;
            preModel.UserName = this.lblUserName.Text;
            preModel.PayoutMoney = Convert.ToDecimal(this.txtPayoutMoney.Text.Trim());
            preModel.Remark = this.txtRemark.Text;
            preModel.BosomNote = this.txtBosomNote.Text;
            preModel.NoteDate = DateTime.Now;
            preModel.NoteName = adminInfo.AdminName;
            #endregion

            #region 用户交易明细
            ShowShop.Model.Member.UserinAndExp userModel = new ShowShop.Model.Member.UserinAndExp();
            ShowShop.BLL.Member.UserinAndExp userBll = new ShowShop.BLL.Member.UserinAndExp();

            //资金的明细
            userModel.UID = memberModel.UID;
            userModel.AdsumMoneyDate = Convert.ToDateTime(this.txtAdsumMoneyDate.Text);
            userModel.AdsumMoney = Convert.ToDecimal(this.txtPayoutMoney.Text);
            userModel.PresentCoupons = 0;
            userModel.RemitMode = 2;
            userModel.RemitBank = string.Empty;
            userModel.Remark = this.txtRemark.Text;
            userModel.FormMode = string.Empty; //通知方式
            userModel.BosomNote = this.txtBosomNote.Text;
            userModel.NoteDate = DateTime.Now;
            userModel.NoteName = adminInfo.AdminName;
            userModel.InComeandExpState = 1;
            userModel.State = 0;
            userModel.UserId = this.lblUserName.Text;
            #endregion

            #region 订单状态
            ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text);
            #endregion

            ShowShop.BLL.Member.MemberAccount mabll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.Model.Member.MemberAccount mamodel = mabll.GetModel(this.lblUserName.Text);
            try
            {
                //已付款+此次汇款的总和
                decimal payTotail = Convert.ToDecimal(this.GetPayed(this.lblOrderId.Text)) + Convert.ToDecimal(this.txtPayoutMoney.Text.Trim());
                #region 如果有多余的钱
                if (payTotail > Convert.ToDecimal(orderModel.FactPrice))
                {
                    ChangeHope.WebPage.BasePage.PageError("输入的金额大于了订单总额!", "order_bank_pay.aspx?OrderId=" + orderModel.Id);
                    return;
                }
                #endregion

                #region 查询用户金额 操作用户金额
                if (mamodel != null)
                {
                    decimal Price = decimal.Parse(mamodel.Capital.ToString());
                    if (Convert.ToDecimal(this.txtPayoutMoney.Text) > Price)
                    {
                        ChangeHope.WebPage.BasePage.PageError("用户余额不足!", "order_bank_pay.aspx?OrderId=" + orderModel.Id);
                        return;
                    }
                    mabll.Amend(mamodel.UID, "Capital", (Convert.ToDecimal(mamodel.Capital.ToString()) - Convert.ToDecimal(this.txtPayoutMoney.Text)));
                }

                #endregion
                preBll.Add(preModel);
                userBll.Add(userModel);

                #region 操作付款状态 订单状态

                int OrderId = ChangeHope.WebPage.PageRequest.GetQueryInt("OrderId");
                if (payTotail >= Convert.ToDecimal(orderModel.FactPrice))
                {
                    if (OrderId > 0)
                    {
                        orderBll.Amend(OrderId, "OrderStatus", ShowShop.Common.OrdersStatusEnum.OrderStatu.未结清.GetHashCode());
                        orderBll.Amend(OrderId, "PaymentStatus", ShowShop.Common.OrdersStatusEnum.PaymentStatu.已经付清.GetHashCode());
                        orderBll.Amend(OrderId, "OgisticsStatus", ShowShop.Common.OrdersStatusEnum.OgisticsStatus.配送中.GetHashCode());
                    }
                }
                else
                {
                    if (OrderId > 0)
                    {
                        orderBll.Amend(OrderId, "OrderStatus", ShowShop.Common.OrdersStatusEnum.OrderStatu.未结清.GetHashCode());
                        orderBll.Amend(OrderId, "PaymentStatus", ShowShop.Common.OrdersStatusEnum.PaymentStatu.未付清.GetHashCode());
                    }
                }
                #endregion
                ChangeHope.WebPage.BasePage.PageRight("已保存该信息", "order_bank_pay.aspx?OrderId=" + orderModel.Id);
            }
            catch
            {
                this.ltlMsg.Text = "操作失败!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }
            finally
            {
                adminInfo = null;
                preModel = null;
                preBll = null;
                orderBll = null;
                orderModel = null;
                GC.Collect();
            }
        }
Ejemplo n.º 4
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            if (Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim()) + Convert.ToDecimal(this.txtPoundAge.Text.Trim()) > Convert.ToDecimal(GetPayed(this.lblOrderId.Text)))
            {
                this.ltlMsg.Text = "退款的金额不能大于已付的金额!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            //银行支付
            ShowShop.BLL.Order.RemittanceInfo remBll = new ShowShop.BLL.Order.RemittanceInfo();
            ShowShop.Model.Order.RemittanceInfo remModel = remBll.GetModelByOrderId(this.lblOrderId.Text);
            //现金支付
            ShowShop.BLL.Order.PaymentMoney payBll = new ShowShop.BLL.Order.PaymentMoney();
            ShowShop.Model.Order.PaymentMoney payModel = payBll.GetModelByOrderId(this.lblOrderId.Text);
            //预付款
            ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney();
            ShowShop.Model.Order.PrepayMoney preModel = preBll.GetModelByOrderId(this.lblOrderId.Text);
            //订单信息
            ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders();
            ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text);

            #region 退款信息
            ShowShop.BLL.Order.RefundMent refBll = new ShowShop.BLL.Order.RefundMent();
            ShowShop.Model.Order.RefundMent refModel = new ShowShop.Model.Order.RefundMent();
            refModel.OrderId = this.lblOrderId.Text;
            refModel.UserName = this.lblUserId.Text;
            refModel.PaymentDate = Convert.ToDateTime(this.txtPaymentDate.Text);
            refModel.PoundAge = Convert.ToDecimal(this.txtPoundAge.Text.Trim());
            refModel.RefundMentMoney = Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim());
            refModel.RefundMentMode = this.rabRefundmentMode.SelectedItem.Text;
            refModel.Remark = this.txtRemark.Text;
            refModel.InformMode = GetInforMode(cbxInformMode)["txt"]; //通知方式
            refModel.NoteDate = DateTime.Now;
            refModel.NoteName = adminInfo.AdminName;
            #endregion

            #region 用户交易明细
            ShowShop.Model.Member.UserinAndExp userModel = new ShowShop.Model.Member.UserinAndExp();
            ShowShop.BLL.Member.UserinAndExp userBll = new ShowShop.BLL.Member.UserinAndExp();

            //银行资金的明细
            userModel.UID = this.GetUidByUserId(this.lblUserId.Text);
            userModel.AdsumMoneyDate = Convert.ToDateTime(this.txtPaymentDate.Text);
            userModel.AdsumMoney = Convert.ToDecimal(this.txtRefundmentMoney.Text);
            userModel.PresentCoupons = 0;
            userModel.RemitMode = 1;
            userModel.RemitBank = string.Empty;
            userModel.Remark = this.txtRemark.Text;
            userModel.FormMode = GetInforMode(cbxInformMode)["txt"]; //通知方式
            userModel.BosomNote = this.txtBosomNote.Text;
            userModel.NoteDate = DateTime.Now;
            userModel.NoteName = adminInfo.AdminName;
            userModel.InComeandExpState = 0;
            userModel.State = 0;
            userModel.UserId = this.lblUserId.Text;
            #endregion

            try
            {
                if (refModel.RefundMentMoney == orderModel.FactPrice)//如果退款和订单价 匹配
                {
                    remBll.Delete(remModel.ID.ToString());
                    payBll.Delete(payModel.ID.ToString());
                    preBll.Delete(preModel.ID.ToString());
                }
                else
                {
                    if (remModel.RemittanceMoney > 0) //银行汇款
                    {
                        if (remModel.RemittanceMoney <= refModel.RefundMentMoney)
                        {
                            remBll.Delete(remModel.ID.ToString());
                        }
                        else
                        {
                            remModel.RemittanceMoney = remModel.RemittanceMoney - refModel.RefundMentMoney;
                            remBll.Amend(remModel);
                        }
                    }
                    if (preModel.PayoutMoney > 0) //预付款
                    {
                        if (preModel.PayoutMoney <= refModel.RefundMentMoney)
                        {
                            preBll.Delete(preModel.ID.ToString());
                        }
                        else
                        {
                            preModel.PayoutMoney = (preModel.PayoutMoney + remModel.RemittanceMoney) - refModel.RefundMentMoney;
                            preBll.Amend(preModel);
                        }
                    }
                    if (payModel.GatheringMoney > 0) //现金支付
                    {
                        if (payModel.GatheringMoney == (refModel.RefundMentMoney - remModel.RemittanceMoney - preModel.PayoutMoney))
                        {
                            payBll.Delete(payModel.ID.ToString());
                        }
                        else
                        {
                            payModel.GatheringMoney = (remModel.RemittanceMoney + preModel.PayoutMoney + payModel.GatheringMoney) - refModel.RefundMentMoney;
                            payBll.Amend(payModel);
                        }
                    }
                }

                refBll.Add(refModel); //退款信息
                userBll.Add(userModel); //明细记录

                //已付款
                decimal payTotail = Convert.ToDecimal(this.GetPayed(this.lblOrderId.Text));
                if ((payTotail - (Convert.ToDecimal(this.txtRefundmentMoney.Text.Trim()))) < 0)
                {
                    orderModel.PaymentStatus = ShowShop.Common.OrdersStatusEnum.PaymentStatu.等待汇款.GetHashCode();
                }
                else
                {
                    orderModel.PaymentStatus = ShowShop.Common.OrdersStatusEnum.PaymentStatu.已收定金.GetHashCode();

                }
                orderModel.OrderStatus = ShowShop.Common.OrdersStatusEnum.OrderStatu.已经确认.GetHashCode();
                orderBll.Update(orderModel);
                ChangeHope.WebPage.BasePage.PageRight("已保存该信息.", "order_bank_pay.aspx?OrderId=" + orderModel.Id, "<li><a href='order_order_info.aspx?OrderId=" + orderModel.Id.ToString() + "'>返回信息页</a></li>");

            }
            catch
            {
                this.ltlMsg.Text = "操作失败!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
            }
            finally
            {
                adminInfo = null;
                remModel = null;
                remBll = null;
                userModel = null;
                userBll = null;
                payBll = null;
                payModel = null;
                preBll = null;
                preModel = null;
                orderBll = null;
                orderModel = null;
                GC.Collect();
            }
        }