Esempio n. 1
0
        public ActionResult Detail(long id)
        {
            var refund = _iRefundService.GetOrderRefund(id, CurrentUser.Id);

            if (refund == null)
            {
                refund = _iRefundService.GetOrderRefundById(id);
                if (refund == null)
                {
                    throw new MallException("错误的退款服务号");
                }
            }
            ViewBag.UserName = CurrentUser.UserName;
            int curappnum = refund.ApplyNumber;

            refund.IsOrderRefundTimeOut = _iOrderService.IsRefundTimeOut(refund.OrderId);
            var order = OrderApplication.GetOrder(refund.OrderId);

            var refundLogs = RefundApplication.GetRefundLogs(refund.Id, curappnum, true);

            if (order.DeliveryType == DeliveryType.SelfTake || order.ShopBranchId > 0)
            {
                foreach (var item in refundLogs)
                {
                    var temp = item.OperateContent.Split('】');
                    item.OperateContent = temp[0].Replace("商家", "门店") + '】' + temp[1];
                }
            }
            ViewBag.Order      = order;
            ViewBag.RefundLogs = refundLogs;
            ViewBag.Keyword    = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords   = SiteSettings.HotKeyWords;
            return(View(refund));
        }
Esempio n. 2
0
    protected void FVRefundApplication_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        InitActsApplicable();
        InitStampDetails();
        //Adding The DataTable dt to the eventArgs of FVRefundApplication

        e.NewValues.Add("StampDetails", dt);

        dt.Rows.Add(dlRevenueStampId.SelectedValue, dlRevenueStampId.SelectedItem.Text, TxtReturnedQty.Text, txtStampsNumbers.Text);
        dt.AcceptChanges();
        gvRefundStampDetails.DataSource = dt;
        gvRefundStampDetails.DataBind();
        Session["StampDetails"] = dt;
        txtStampsNumbers.Text   = "";
        TxtReturnedQty.Text     = "";

        //******
        gvRefundStampDetails.DataSource = dt;
        gvRefundStampDetails.DataBind();

        RefundApplication RfApplication = new RefundApplication();
        Guid RefundApplicationId        = (Guid)FVRefundApplication.SelectedValue;

        DataTable dtStampDetails = RfApplication.SelectRefundStampDetailsByRefundId(RefundApplicationId);

        gvRefundStampDetails.DataSource = dtStampDetails;
        gvRefundStampDetails.DataBind();
    }
        public JsonResult DealRefund(long refundId, int auditStatus, string sellerRemark)
        {
            Result result            = new Result();
            var    refundauditstatus = (Entities.OrderRefundInfo.OrderRefundAuditStatus)auditStatus;

            switch (refundauditstatus)
            {
            case Entities.OrderRefundInfo.OrderRefundAuditStatus.UnAudit:
                if (string.IsNullOrWhiteSpace(sellerRemark))
                {
                    throw new HimallException("请填写拒绝理由");
                }
                break;
            }
            var refund = RefundApplication.GetOrderRefund(refundId);

            if (refund != null && refund.IsReturn == true && auditStatus == 2)
            {
                var shopget = ShopShippersApplication.GetDefaultGetGoodsShipper(refund.ShopId);
                if (shopget == null)
                {
                    throw new HimallException("需要先设置好退货地址再进行操作,立即前往设置!");
                }
            }
            _iRefundService.SellerDealRefund(refundId, refundauditstatus, sellerRemark, CurrentSellerManager.UserName);
            result.success = true;
            return(Json(result));
        }
Esempio n. 4
0
        public object ConfirmRefund(ConfirmRefund args)
        {
            string notifyurl = CurrentUrlHelper.CurrentUrlNoPort() + "/Pay/RefundNotify/{0}";
            var    result    = RefundApplication.ConfirmRefund(args.RefundId, args.Remark, "", notifyurl);

            return(new { success = true });
        }
Esempio n. 5
0
    protected void StampDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Guid RefundApplicationId = Guid.Empty;

        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId       = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid)fvRefundApplication.DataKey["RefundApplicationId"];
        }

        GridView  gvStampDetails = (GridView)sender;
        DataTable dtStampDetails = (DataTable)ViewState["StampDetails"];

        //object[] keys = {RefundApplicationId,
        //                e.Keys["RevenueStampId"]};
        //DataRow dr = dtStampDetails.Rows.Find(keys);

        //if (null != dr)
        //{
        //    dtStampDetails.Rows.Remove(dr);
        //}

        int i = e.RowIndex;

        dtStampDetails.Rows[i].Delete();
        dtStampDetails.AcceptChanges();

        ViewState["StampDetails"] = dtStampDetails;
        gvStampDetails.DataSource = ViewState["StampDetails"];
        gvStampDetails.DataBind();
    }
Esempio n. 6
0
    protected void fvRefundApplication_ModeChanging(object sender, FormViewModeEventArgs e)
    {
        switch (e.NewMode)
        {
        case FormViewMode.Edit:
            FormView Form = (FormView)sender;
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId((Guid)Form.DataKey["RefundApplicationId"]);

            GridView StampDetailsGrid = (GridView)Form.FindControl("gvRefundStampDetailsUpd");
            if (null != StampDetailsGrid)
            {
                StampDetailsGrid.DataSource = (DataTable)ViewState["StampDetails"];
                StampDetailsGrid.DataBind();
            }

            DropDownList dlOfficeName = (DropDownList)fvRefundApplication.FindControl("dlOfficeName");
            Profile.Permissions.FillOffices(dlOfficeName, "REF", "Insert");

            break;

        case FormViewMode.Insert:
            break;

        case FormViewMode.ReadOnly:
            break;

        default:
            break;
        }
    }
        /// <summary>
        /// 导出退款记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ActionResult ExportToExcel(RefundQuery query)
        {
            var orderResults = RefundApplication.GetAllFullOrderReFunds(query);

            string strTitle = "退款记录";

            #region 导出时标题名称
            if (query.ShowRefundType.HasValue)
            {
                switch (query.ShowRefundType)
                {
                case 1:
                    strTitle = "订单退款";
                    break;

                case 2:
                    strTitle = "退款记录";
                    break;

                case 3:
                    strTitle = "退货记录";
                    break;

                case 4:
                    strTitle = "货品退款";
                    break;
                }
            }
            #endregion

            return(ExcelView("ExportOrderRefundinfo", "平台" + strTitle, orderResults));
        }
Esempio n. 8
0
        public JsonResult SaveRefundReason(string reason, long id = 0)
        {
            Result r = new Result {
                msg = "售后原因处理成功", status = 0, success = true
            };
            bool isdataok = true;

            if (isdataok)
            {
                if (string.IsNullOrWhiteSpace(reason))
                {
                    isdataok = false;
                    r        = new Result {
                        msg = "请填写售后原因", status = -2, success = false
                    };
                }
            }
            if (isdataok)
            {
                if (reason.Length > 20)
                {
                    isdataok = false;
                    r        = new Result {
                        msg = "售后原因限20字符", status = -2, success = false
                    };
                }
            }
            RefundApplication.UpdateAndAddRefundReason(reason, id);
            return(Json(r));
        }
Esempio n. 9
0
    protected void fvRefundApplication_ModeChanged(object sender, EventArgs e)
    {
        FormView Form = (FormView)sender;

        switch (((FormView)sender).CurrentMode)
        {
        case FormViewMode.Edit:
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId((Guid)Form.DataKey["RefundApplicationId"]);

            GridView StampDetailsGrid = (GridView)Form.FindControl("gvRefundStampDetailsUpd");
            if (null != StampDetailsGrid)
            {
                StampDetailsGrid.DataSource = (DataTable)ViewState["StampDetails"];
                StampDetailsGrid.DataBind();
            }
            break;

        case FormViewMode.Insert:
            break;

        case FormViewMode.ReadOnly:
            break;

        default:
            break;
        }
    }
Esempio n. 10
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        //string userName = Thread.CurrentPrincipal.Identity.Name;
        //string RefundOrderID = ((TextBox) fvRefundApplication.FindControl("txtRefundOrderIdItm")).Text;
        //DateTime RefundDate = Convert.ToDateTime(((TextBox) fvRefundApplication.FindControl("txtRefundOrderDateItm")).Text);
        //RefundApplication RfApplication = new RefundApplication();
        ////Guid RefundApplicationId = (Guid) fvRefundApplication.SelectedValue;

        ////Guid RefundApplicationId = (Guid) GvRefundAlerts.SelectedValue;
        ////DataTable dtTotAmount = RfApplication.GetAllRefundApplicationsById(RefundApplicationId);
        //string TotAmount = Convert.ToString(dtTotAmount.Rows[0]["TotalValueOfStamps"]);
        //decimal cTotAmount = Convert.ToDecimal(TotAmount);
        //decimal PenalityAmount = (cTotAmount) * Convert.ToDecimal(0.10);
        //decimal RefundAmount = (cTotAmount) * Convert.ToDecimal(0.90);
        //RfApplication.UpdateRefundOrderDetails(RefundApplicationId, PenalityAmount, RefundAmount, RefundOrderID, RefundDate, userName, DateTime.Now);
        //fvRefundApplication.ChangeMode(FormViewMode.ReadOnly);
        RefundApplication.ApproveRefund(new Guid(fldRefundId.Value));
        Dictionary <string, string> reportParams = new Dictionary <string, string>();
        string RefundId = fldRefundId.Value;

        reportParams.Add("RefundApplicationId", RefundId);
        Session["ReportParams"] = reportParams;
        Session["ReportName"]   = "RefundOrder";
        Response.Redirect("~/Report/Report.aspx");
    }
Esempio n. 11
0
    protected void OdsRefundDetails_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        RefundApplication app = new RefundApplication();
        DataTable         dt  = app.SelectRefundStampDetailsByRefundId((Guid)e.OutputParameters["RefundApplicationId"]);

        e.OutputParameters.Add("StampDetails", dt);
    }
Esempio n. 12
0
        private int IsExitRefound(string sourceData, Entities.CapitalDetailInfo.CapitalDetailType dType)
        {
            var isRefound = 0;

            if (dType == Entities.CapitalDetailInfo.CapitalDetailType.Refund)
            {
                if (!string.IsNullOrWhiteSpace(sourceData))
                {
                    var refound = RefundApplication.GetOrderRefundById(long.Parse(sourceData));
                    if (refound != null)
                    {
                        isRefound = 1;
                    }
                    else
                    {
                        var found = RefundApplication.GetOrderRefund(long.Parse(sourceData));
                        if (found != null)
                        {
                            isRefound = 1;
                        }
                    }
                }
            }

            return(isRefound);
        }
        public ActionResult Detail(long id)
        {
            var refund = _iRefundService.GetOrderRefund(id, CurrentUser.Id);

            if (refund == null)
            {
                throw new HimallException("错误的退款服务号");
            }
            ViewBag.UserName = CurrentUser.UserName;
            int curappnum = refund.ApplyNumber.HasValue ? refund.ApplyNumber.Value : 1;

            refund.IsOrderRefundTimeOut = _iOrderService.IsRefundTimeOut(refund.OrderId);
            var order = OrderApplication.GetOrder(refund.OrderId);

            refund.Order = order;

            var refundLogs = RefundApplication.GetRefundLogs(refund.Id, curappnum, false);

            if (order.DeliveryType == Himall.CommonModel.Enum.DeliveryType.SelfTake || (order.ShopBranchId.HasValue && order.ShopBranchId.Value > 0))
            {
                foreach (var item in refundLogs)
                {
                    var temp = item.OperateContent.Split('】');
                    item.OperateContent = temp[0].Replace("诊所", "门店") + '】' + temp[1];
                }
            }

            ViewBag.RefundLogs = refundLogs;
            return(View(refund));
        }
Esempio n. 14
0
        public JsonResult DeleteRefundReason(long id)
        {
            Result r = new Result {
                msg = "删除成功", status = 0, success = true
            };

            RefundApplication.DeleteRefundReason(id);
            return(Json(r));
        }
        public object GetRefundLogs(int refundId)
        {
            CheckUserLogin();
            var curshopid = CurrentShop.Id;
            var refund    = RefundApplication.GetOrderRefund(refundId);

            if (refund == null || refund.ShopId != CurrentShop.Id)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            var order = Application.OrderApplication.GetOrder(refund.OrderId);

            if (order == null || order.ShopId != curshopid)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            var refundLogs = RefundApplication.GetRefundLogs(refundId);

            var logs = new List <object>();

            var roleMap = new Dictionary <OrderRefundStep, int>();//操作步骤 由谁完成的

            roleMap.Add(OrderRefundStep.Confirmed, 2);
            roleMap.Add(OrderRefundStep.UnAudit, 1);
            roleMap.Add(OrderRefundStep.UnConfirm, 1);
            roleMap.Add(OrderRefundStep.WaitAudit, 0);
            roleMap.Add(OrderRefundStep.WaitDelivery, 1);
            roleMap.Add(OrderRefundStep.WaitReceiving, 1);

            foreach (var log in refundLogs)
            {
                logs.Add(new
                {
                    Role = roleMap[log.Step],//操作者角色,0:买家,1:门店,2:平台
                    Step = log.Step,
                    log.OperateDate,
                    log.Remark
                });
            }

            var model = new OrderRefundApiModel();

            refund.Map(model);
            model.CertPics    = new string[3];
            model.CertPics[0] = HimallIO.GetRomoteImagePath(model.CertPic1);
            model.CertPics[1] = HimallIO.GetRomoteImagePath(model.CertPic2);
            model.CertPics[2] = HimallIO.GetRomoteImagePath(model.CertPic3);

            return(new
            {
                success = true,
                Refund = model,
                Logs = logs
            });
        }
Esempio n. 16
0
        public object GetShopHome()
        {
            CheckUserLogin();

            DateTime nowDt = DateTime.Now;
            //三个月内预约单
            OrderQuery query = new OrderQuery()
            {
                ShopId = this.CurrentUser.ShopId, StartDate = nowDt.Date.AddDays(-nowDt.Day).AddMonths(-2), EndDate = nowDt
            };
            var orders            = OrderApplication.GetOrdersNoPage(query);
            var threeMonthAmounht = orders.Sum(e => e.ActualPayAmount);
            //从三个月的数据中统计本周的
            DateTime weekStartDt = nowDt.Date.AddDays(-(int)nowDt.DayOfWeek);
            var      weekAmount  = orders.Where(e => e.OrderDate >= weekStartDt).Sum(e => e.ActualPayAmount);
            //从三个月的数据中统计当天的
            var todayAmount = orders.Where(e => e.OrderDate.Date == nowDt.Date).Sum(e => e.ActualPayAmount);


            //近三天发布诊疗项目数
            ProductQuery productQuery = new ProductQuery();

            productQuery.AuditStatus = new[] { ProductInfo.ProductAuditStatus.Audited };
            productQuery.StartDate   = nowDt.Date.AddDays(-2);
            productQuery.EndDate     = nowDt;
            productQuery.PageNo      = 1;
            productQuery.PageSize    = int.MaxValue;

            var products     = ProductManagerApplication.GetProducts(productQuery).Models;
            var productCount = products.Select(e => e.Id).Count();

            RefundQuery refundQuery = new RefundQuery()
            {
                AuditStatus = OrderRefundInfo.OrderRefundAuditStatus.WaitAudit,
                PageNo      = 1,
                PageSize    = int.MaxValue
            };
            var refunds     = RefundApplication.GetOrderRefunds(refundQuery);
            var refundCount = refunds.Total;


            return(Json(new
            {
                success = true,
                data = new
                {
                    shopName = CurrentShopBranch.ShopBranchName,
                    todayAmount = todayAmount,
                    weekAmount = weekAmount,
                    threeMonthAmounht = threeMonthAmounht,
                    createProductCount = productCount,
                    refundCount = refundCount
                }
            }));
        }
Esempio n. 17
0
        public object GetShopHome()
        {
            CheckUserLogin();

            var now = DateTime.Now;

            var orderQuery = new OrderCountStatisticsQuery()
            {
                ShopId = CurrentUser.ShopId,
                Fields = new List <OrderCountStatisticsFields> {
                    OrderCountStatisticsFields.ActualPayAmount
                }
            };

            //三月内
            orderQuery.OrderDateBegin = new DateTime(now.Year, now.Month, 1).AddMonths(-2);
            var threeMonthAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //本周
            orderQuery.OrderDateBegin = now.Date.AddDays(-(int)now.DayOfWeek);
            var weekAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //今天
            orderQuery.OrderDateBegin = now.Date;
            var todayAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //近三天发布商品数
            var productCount = ProductManagerApplication.GetProductCount(new ProductQuery
            {
                ShopId      = CurrentUser.ShopId,
                AuditStatus = new[] { Entities.ProductInfo.ProductAuditStatus.Audited },
                StartDate   = now.Date.AddDays(-2)
            });

            //待审核退货/退款
            var refundCount = RefundApplication.GetOrderRefundsCount(new RefundQuery()
            {
                ShopId      = CurrentUser.ShopId,
                AuditStatus = Entities.OrderRefundInfo.OrderRefundAuditStatus.WaitAudit,
            });

            return(new
            {
                success = true,
                data = new
                {
                    shopName = CurrentShopBranch.ShopBranchName,
                    todayAmount = todayAmount,
                    weekAmount = weekAmount,
                    threeMonthAmounht = threeMonthAmount,
                    createProductCount = productCount,
                    refundCount = refundCount
                }
            });
        }
Esempio n. 18
0
 /// <summary />
 public Refund(
     ChangeStatusInfo changeStatusInfo,
     string refundId,
     DateTime refundDocDate,
     BudgetLevel budgetLevel,
     RefundPayee refundPayee,
     RefundApplication refundApplication,
     RefundBasis refundBasis,
     RefundPayer refundPayer
     ) : base(refundId, refundDocDate, budgetLevel, refundPayee, refundApplication, refundBasis, refundPayer)
     => ChangeStatusInfo = changeStatusInfo;
Esempio n. 19
0
        public object PostReply(OrderRefundReplyModel reply)
        {
            if (reply == null)
            {
                return(ErrorResult("参数不能为空"));
            }

            CheckUserLogin();

            switch (reply.AuditStatus)
            {
            case OrderRefundInfo.OrderRefundAuditStatus.UnAudit:
                if (string.IsNullOrWhiteSpace(reply.SellerRemark))
                {
                    throw new MallException("请填写拒绝理由");
                }
                break;
            }

            var refund = Application.RefundApplication.GetOrderRefund(reply.RefundId);

            if (refund == null || refund.ShopId != CurrentShopBranch.ShopId)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            var order = Application.OrderApplication.GetOrder(refund.OrderId);

            if (order == null || order.ShopBranchId != this.CurrentUser.ShopBranchId)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            if (order.DeliveryType != CommonModel.DeliveryType.SelfTake &&
                reply.AuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving
                )
            {
                //如果不是自提订单,则状态还是为待买家寄货,不能直接到待商家收货
                reply.AuditStatus = OrderRefundInfo.OrderRefundAuditStatus.WaitDelivery;
            }

            if (refund.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving && reply.AuditStatus != OrderRefundInfo.OrderRefundAuditStatus.UnAudit)
            {
                RefundApplication.SellerConfirmRefundGood(reply.RefundId, this.CurrentUser.UserName, reply.SellerRemark);
            }
            else
            {
                RefundApplication.SellerDealRefund(reply.RefundId, reply.AuditStatus, reply.SellerRemark, this.CurrentUser.UserName);
            }

            return(SuccessResult("操作成功"));
        }
Esempio n. 20
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        OdsRefundDetails.SelectParameters["RefundApplicationId"].DefaultValue = GvRefundAlerts.SelectedDataKey.Value.ToString();
        RefundApplication Rf        = new RefundApplication();
        DataTable         dtGridUpd = new DataTable();
        Guid RefundApplicationId    = (Guid)GvRefundAlerts.SelectedValue;

        dtGridUpd = Rf.SelectRefundStampDetailsByRefundId(RefundApplicationId);
        GridView Gv = ((GridView)fvRefundApplication.FindControl("gvRefundStampDetailsIns"));

        Gv.DataSource = dtGridUpd;
        Gv.DataBind();
    }
Esempio n. 21
0
    protected void fvRefundApplication_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        Global.SetFormViewParameters(e.NewValues, RefundApplication.GetRow());
        DataTable StampDetails = (DataTable)ViewState["StampDetails"];

        e.NewValues.Add("StampDetails", StampDetails);
        InitActsApplicable();
        foreach (ListItem item in ((CheckBoxList)fvRefundApplication.FindControl("chkLstBxUpd")).Items)
        {
            dtActsApplicable.Rows.Add(item.Value, item.Selected);
        }
        e.NewValues.Add("AlertId", new Guid(Request.Params["AlertId"]));
        e.NewValues.Add("ActsApplicable", dtActsApplicable);
    }
Esempio n. 22
0
    protected void AddStampDetails_Click(object sender, EventArgs e)
    {
        string Mode = "Ins";
        Guid   RefundApplicationId = Guid.Empty;

        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId       = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid)fvRefundApplication.DataKey["RefundApplicationId"];
            Mode = "Upd";
        }

        GridView  gvStampDetails = ((GridView)fvRefundApplication.FindControl("gvRefundStampDetails" + Mode));
        DataTable dtStampDetails = (DataTable)ViewState["StampDetails"];

        DropDownList ddlRevenueStamp = ((DropDownList)fvRefundApplication.FindControl("ddlRevenueStampId" + Mode));
        TextBox      txtRefundQty    = ((TextBox)fvRefundApplication.FindControl("txtReturnedQuantity" + Mode));
        TextBox      txtSerialNo     = ((TextBox)fvRefundApplication.FindControl("txtStampSlNo" + Mode));

        object[] keys = { RefundApplicationId,
                          new Guid(ddlRevenueStamp.SelectedValue) };

        DataRow dr = dtStampDetails.Rows.Find(keys);

        if (null == dr)
        {
            dr = dtStampDetails.NewRow();
            dr["RevenueStampId"]      = new Guid(ddlRevenueStamp.SelectedValue);
            dr["StampName"]           = ddlRevenueStamp.SelectedItem.Text;
            dr["ReturnedQty"]         = txtRefundQty.Text;
            dr["StampNumber"]         = txtSerialNo.Text;
            dr["RefundApplicationId"] = RefundApplicationId;
            dtStampDetails.Rows.Add(dr);
            ddlRevenueStamp.SelectedIndex = -1;
            txtRefundQty.Text             = "";
            txtSerialNo.Text = "";
        }

        ((Button)fvRefundApplication.FindControl("btnAddStamp" + Mode)).Visible    = true;
        ((Button)fvRefundApplication.FindControl("btnUpdateStamp" + Mode)).Visible = false;

        ViewState["StampDetails"] = dtStampDetails;
        gvStampDetails.DataSource = (DataTable)ViewState["StampDetails"];
        gvStampDetails.DataBind();
    }
Esempio n. 23
0
    protected void fvRefundApplication_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        Global.SetFormViewParameters(e.Values, RefundApplication.GetRow());

        //DataTable StampDetails = (DataTable) ViewState["gvRefundStampDetailsIns"];

        DataTable StampDetails = (DataTable)ViewState["StampDetails"];

        if (StampDetails == null)
        {
            e.Cancel = true;
            //((Label)Page.Master.FindControl("Label2")).Text = "Please Enter Stamp Details";
        }
        else
        {
            e.Values.Add("StampDetails", StampDetails);

            InitActsApplicable();

            int i = dtActsApplicable.Columns.Count;
            foreach (ListItem item in ((CheckBoxList)fvRefundApplication.FindControl("chkLstBxIns")).Items)
            {
                dtActsApplicable.Rows.Add(item.Value, item.Selected);
            }


            e.Values.Add("ActsApplicable", dtActsApplicable);

            //string txtRemarksActIns = (((TextBox) fvRefundApplication.FindControl("txtRemarksActIns")).Text);
            //if (txtRemarksActIns != null)
            //{


            //    e.Values.Add("ActsApplicable", txtRemarksActIns);
            //}
            //Code Added By Akhilesh.
            FileManagement_FileForward ffc = (FileManagement_FileForward)fvRefundApplication.FindControl("FileForward1");
            Remarks rem = new Remarks();
            rem.Subject = ((TextBox)ffc.FindControl("txtRemarkSubject")).Text;
            rem.Body    = ((TextBox)ffc.FindControl("txtRemarkBody")).Text;
            e.Values.Add("rem", rem);
            UserControls_DocumentDownload ddR = (UserControls_DocumentDownload)fvRefundApplication.FindControl("ddRefund");
            //Document doc = new Document();
            //doc.DocumentName = ((TextBox)ddR.FindControl("DocNameTextBox")).Text;
            //doc.Content = Convert.ToByte(((HiddenField)ddR.FindControl("fldContent")).Value);
        }
    }
Esempio n. 24
0
    protected void fvRefundApplication_DataBound(object sender, EventArgs e)
    {
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplication app = new RefundApplication();

            Guid RefundApplicationId = (Guid)fvRefundApplication.DataKey["RefundApplicationId"];
            ViewState["StampDetails"] = app.SelectRefundStampDetailsByRefundId(RefundApplicationId);

            GridView grd = (GridView)fvRefundApplication.FindControl("gvRefundStampDetailsUpd");
            grd.DataSource    = (DataTable)ViewState["StampDetails"];
            grd.SelectedIndex = -1;
            grd.DataBind();

            DataTable ActsApplicable = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);

            //ViewState["dtActsApplicable"] = ActsApplicable;

            CheckBoxList lstActs = (CheckBoxList)fvRefundApplication.FindControl("chkLstBxUpd");
            foreach (DataRow act in ActsApplicable.Rows)
            {
                ListItem item = new ListItem();
                item.Text     = Convert.ToString(act["NameOfAct"]);
                item.Selected = Convert.ToBoolean(act["Checked"]);
                item.Value    = ((Guid)act["ActId"]).ToString();
                lstActs.Items.Add(item);
            }
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.ReadOnly)
        {
            RefundApplication app         = new RefundApplication();
            Guid      RefundApplicationId = (Guid)fvRefundApplication.DataKey["RefundApplicationId"];
            DataTable ItmActsApplicable   = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);
            ViewState["dtActsApplicable"] = ItmActsApplicable;

            CheckBoxList lstActs = (CheckBoxList)fvRefundApplication.FindControl("chkLstBxItm");
            foreach (DataRow act in ItmActsApplicable.Rows)
            {
                ListItem item = new ListItem();
                item.Text     = Convert.ToString(act["NameOfAct"]);
                item.Selected = Convert.ToBoolean(act["Checked"]);
                item.Value    = ((Guid)act["ActId"]).ToString();
                lstActs.Items.Add(item);
            }
        }
    }
Esempio n. 25
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        //RefundApplication RfApplication = new RefundApplication();
        //RfApplication.InsertNewRefundOrders(
        string            userName      = Thread.CurrentPrincipal.Identity.Name;
        string            RefundOrderID = ((TextBox)FVRefundApplication.FindControl("txtRefundOrderId")).Text;
        DateTime          RefundDate    = Convert.ToDateTime(((TextBox)FVRefundApplication.FindControl("txtRefundDate")).Text);
        RefundApplication RfApplication = new RefundApplication();
        Guid      RefundApplicationId   = (Guid)FVRefundApplication.SelectedValue;
        DataTable dtTotAmount           = RfApplication.GetAllRefundApplicationsById(RefundApplicationId);
        string    TotAmount             = Convert.ToString(dtTotAmount.Rows[0]["TotalValueOfStamps"]);
        decimal   cTotAmount            = Convert.ToDecimal(TotAmount);
        decimal   PenalityAmount        = (cTotAmount) * Convert.ToDecimal(0.10);
        decimal   RefundAmount          = (cTotAmount) * Convert.ToDecimal(0.90);

        RfApplication.UpdateRefundOrderDetails(RefundApplicationId, PenalityAmount, RefundAmount, RefundOrderID, RefundDate, userName, DateTime.Now);
    }
        public object PostReply(OrderRefundReplyModel reply)
        {
            CheckUserLogin();

            if (reply == null)
            {
                return(ErrorResult("参数不能为空"));
            }

            var shopAddress = ShopShippersApplication.GetDefaultSendGoodsShipper(CurrentShop.Id);

            if (shopAddress == null)
            {
                return(ErrorResult("未设置默认发/退货地址"));
            }

            switch (reply.AuditStatus)
            {
            case OrderRefundInfo.OrderRefundAuditStatus.UnAudit:
                if (string.IsNullOrWhiteSpace(reply.SellerRemark))
                {
                    return(ErrorResult("请填写拒绝理由"));
                }
                break;
            }

            var refund = Application.RefundApplication.GetOrderRefund(reply.RefundId);

            if (refund == null || refund.ShopId != CurrentShop.Id)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            if (refund.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving && reply.AuditStatus != OrderRefundInfo.OrderRefundAuditStatus.UnAudit)
            {
                RefundApplication.SellerConfirmRefundGood(reply.RefundId, CurrentUser.UserName, reply.SellerRemark);
            }
            else
            {
                RefundApplication.SellerDealRefund(reply.RefundId, reply.AuditStatus, reply.SellerRemark, CurrentUser.UserName);
            }

            return(SuccessResult("操作成功"));
        }
Esempio n. 27
0
    protected void FvRefundReadOnly_DataBound(object sender, EventArgs e)
    {
        RefundApplication app         = new RefundApplication();
        Guid      RefundApplicationId = (Guid)FvRefundReadOnly.DataKey["RefundApplicationId"];
        DataTable ItmActsApplicable   = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);

        ViewState["dtActsApplicable"] = ItmActsApplicable;

        CheckBoxList lstActs = (CheckBoxList)FvRefundReadOnly.FindControl("chkLstBxReadOnly");

        foreach (DataRow act in ItmActsApplicable.Rows)
        {
            ListItem item = new ListItem();
            item.Text     = Convert.ToString(act["NameOfAct"]);
            item.Selected = Convert.ToBoolean(act["Checked"]);
            item.Value    = ((Guid)act["ActId"]).ToString();
            lstActs.Items.Add(item);
        }
    }
Esempio n. 28
0
    protected void StampDetailsGrid_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Mode = "Ins";
        Guid   RefundApplicationId = Guid.Empty;

        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId       = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid)fvRefundApplication.DataKey["RefundApplicationId"];
            Mode = "Upd";
        }

        GridView  gvStampDetails = (GridView)sender;
        DataTable dtStampDetails = (DataTable)ViewState["StampDetails"];

        DropDownList ddlRevenueStamp = ((DropDownList)fvRefundApplication.FindControl("ddlRevenueStampId" + Mode));
        TextBox      txtRefundQty    = ((TextBox)fvRefundApplication.FindControl("txtReturnedQuantity" + Mode));
        TextBox      txtSerialNo     = ((TextBox)fvRefundApplication.FindControl("txtStampSlNo" + Mode));

        object[] keys = new object[gvStampDetails.SelectedDataKey.Values.Count];
        for (int i = 0; i < keys.Length; i++)
        {
            keys[i] = gvStampDetails.SelectedDataKey.Values[i];
        }
        DataRow dr = dtStampDetails.Rows.Find(keys);

        if (null != dr)
        {
            ddlRevenueStamp.SelectedValue = Convert.ToString(dr["RevenueStampId"]);
            txtRefundQty.Text             = Convert.ToString(dr["ReturnedQty"]);
            txtSerialNo.Text = Convert.ToString(dr["StampNumber"]);
        }

        ((Button)fvRefundApplication.FindControl("btnAddStamp" + Mode)).Visible    = false;
        ((Button)fvRefundApplication.FindControl("btnUpdateStamp" + Mode)).Visible = true;
    }
Esempio n. 29
0
        public ActionResult RefundReason()
        {
            var datalist = RefundApplication.GetRefundReasons();

            return(View(datalist));
        }
Esempio n. 30
0
        public JsonResult RefundApply(OrderRefundInfo info)
        {
            var order = _iOrderService.GetOrder(info.OrderId, CurrentUser.Id);

            if (order == null)
            {
                throw new Mall.Core.MallException("该订单已删除或不属于该用户");
            }
            if (info.RefundType == 1)
            {
                info.ReturnQuantity = 0;
                info.IsReturn       = false;
            }
            if (order.OrderType != OrderInfo.OrderTypes.Virtual)
            {
                info.IsReturn = false;
                if (info.ReturnQuantity > 0)
                {
                    info.IsReturn = true;
                }
                if (info.RefundType == 2)
                {
                    info.IsReturn = true;
                }
                if (info.IsReturn == true && info.ReturnQuantity < 1)
                {
                    throw new Mall.Core.MallException("错误的退货数量");
                }
            }
            if (info.Amount <= 0)
            {
                throw new Mall.Core.MallException("错误的退款金额");
            }
            if (info.ReasonDetail != null && info.ReasonDetail.Length > 1000)
            {
                throw new Mall.Core.MallException("退款说明不能超过1000字符");
            }
            // info.ReasonDetail=
            info.UserId       = CurrentUser.Id;
            info.Applicant    = CurrentUser.UserName;
            info.ApplyDate    = DateTime.Now;
            info.ReasonDetail = HttpUtility.HtmlEncode(info.ReasonDetail);
            info.Reason       = HTMLEncode(info.Reason.Replace("'", "‘").Replace("\"", "”"));
            info.CertPic1     = MoveImages(info.CertPic1, CurrentUser.Id, info.OrderItemId);
            info.CertPic2     = MoveImages(info.CertPic2, CurrentUser.Id, info.OrderItemId);
            info.CertPic3     = MoveImages(info.CertPic3, CurrentUser.Id, info.OrderItemId);

            if (order.OrderType == OrderInfo.OrderTypes.Virtual)
            {
                if (string.IsNullOrWhiteSpace(info.VerificationCodeIds))
                {
                    throw new Mall.Core.MallException("虚拟订单退款核销码不能为空");
                }

                //检测核销码都为正确的
                var codeList = info.VerificationCodeIds.Split(',').ToList();
                var codes    = OrderApplication.GetOrderVerificationCodeInfoByCodes(codeList);
                if (codes.Count != codeList.Count)
                {
                    throw new Mall.Core.MallException("包含无效的核销码");
                }
                foreach (var item in codes)
                {
                    if (item.Status != OrderInfo.VerificationCodeStatus.WaitVerification)
                    {
                        throw new Mall.Core.MallException("包含已申请售后的核销码");
                    }
                }
                info.ReturnQuantity = codes.Count;
            }

            //info.RefundAccount = HTMLEncode(info.RefundAccount.Replace("'", "‘").Replace("\"", "”"));
            Result result = new Result()
            {
                success = true, data = info.Id, msg = "提交成功"
            };

            if (order.OrderType != OrderInfo.OrderTypes.Virtual)
            {
                if (info.Id > 0)
                {
                    _iRefundService.ActiveRefund(info);
                }
                else
                {
                    var status = RefundApplication.CanApplyRefund(info.OrderId, info.OrderItemId, info.OrderItemId == 0 ? true : false);
                    if (!status)
                    {
                        result.success = false;
                        result.status  = 2;
                        result.msg     = "您已申请过售后,不可重复申请";
                    }
                    else
                    {
                        RefundApplication.AddOrderRefund(info);
                    }
                    //TODO:FG 查询逻辑
                    //取退款ID
                    var refundInfos = RefundApplication.GetOrderRefunds(new RefundQuery()
                    {
                        OrderId = info.OrderId, PageNo = 1, PageSize = int.MaxValue
                    }).Models;
                    if (refundInfos.Count > 0)
                    {
                        if (info.OrderItemId != 0)
                        {
                            var refund = refundInfos.FirstOrDefault(e => e.OrderItemId == info.OrderItemId);
                            result.data = refund.Id;
                        }
                        else
                        {
                            var refund = refundInfos.FirstOrDefault();
                            result.data = refund.Id;
                        }
                    }
                }
            }
            else
            {
                RefundApplication.AddOrderRefund(info);
                //取退款ID
                result.data = info.Id;
                #region 处理退款
                //虚拟订单自动退款,异常不提示用户,进入平台待审核
                try
                {
                    //获取异步通知地址
                    string notifyurl    = CurrentUrlHelper.CurrentUrlNoPort() + "/Pay/RefundNotify/{0}";
                    var    refundResult = _iRefundService.ConfirmRefund(info.Id, "虚拟订单申请售后自动退款", "", notifyurl);
                }
                catch (MallException ex)
                {
                    Log.Error("虚拟商品自动退异常", ex);
                }
                #endregion
            }
            return(Json(result));
        }