public ActionResult ApproveBySalesAdmin(long salesReturnId)
        {
            try
            {
                ViewBag.ApproverActionId = _iCommonManager.GetAllApprovalActionList().ToList();
                ViewBag.SalesReturnId    = salesReturnId;
                var returnById = _iProductReturnManager.GetSalesReturnBySalesReturnId(salesReturnId);
                List <ViewReturnDetails> models;
                ViewReturnModel          model = new ViewReturnModel();
                if (returnById.ClientId != null)
                {
                    models = _iProductReturnManager.GetReturnDetailsBySalesReturnId(salesReturnId).ToList();
                    var firstOrdefault = models.FirstOrDefault();
                    if (firstOrdefault != null)
                    {
                        var delivery        = _iDeliveryManager.GetOrderByDeliveryId(firstOrdefault.DeliveryId);
                        var deliveryDetails = _iDeliveryManager.GetDeliveryDetailsInfoByDeliveryId(firstOrdefault.DeliveryId);
                        var orderInfo       = _iOrderManager.GetOrderInfoByTransactionRef(delivery.TransactionRef);
                        var client          = _iClientManager.GetClientDeailsById(orderInfo.ClientId);

                        ViewInvoiceModel invoice = new ViewInvoiceModel
                        {
                            Client          = client,
                            Order           = orderInfo,
                            Delivery        = delivery,
                            DeliveryDetails = deliveryDetails
                        };
                        model.InvoiceModel = invoice;
                    }
                }
                else
                {
                    models = _iProductReturnManager.GetGeneralReqReturnDetailsById(salesReturnId).ToList();
                }
                model.ReturnModel     = returnById;
                model.ReturnDetailses = models;

                return(View(model));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
        public ActionResult ApproveByNsm(long salesReturnId)
        {
            try
            {
                ViewBag.ApproverActionId = _iCommonManager.GetAllApprovalActionList().ToList();
                ViewBag.SalesReturnId    = salesReturnId;
                var returnById = _iProductReturnManager.GetSalesReturnBySalesReturnId(salesReturnId);
                List <ViewReturnDetails> models      = _iProductReturnManager.GetReturnDetailsBySalesReturnId(salesReturnId).ToList();
                ViewReturnModel          returnModel = new ViewReturnModel
                {
                    ReturnDetailses = models,
                    ReturnModel     = returnById,
                };
                var firstOrdefault = models.FirstOrDefault();
                if (firstOrdefault != null)
                {
                    var delivery = _iDeliveryManager.GetOrderByDeliveryId(firstOrdefault.DeliveryId);
                    //var chalan = _iDeliveryManager.GetChalanByDeliveryId(deliveryId);
                    var deliveryDetails = _iDeliveryManager.GetDeliveryDetailsInfoByDeliveryId(firstOrdefault.DeliveryId);

                    // var invocedOrder = _iInvoiceManager.GetInvoicedOrderByInvoiceId(deliveryId);
                    var orderInfo = _iOrderManager.GetOrderInfoByTransactionRef(delivery.TransactionRef);
                    //IEnumerable<InvoiceDetails> details = _iInvoiceManager.GetInvoicedOrderDetailsByInvoiceId(deliveryId);
                    var client = _iClientManager.GetClientDeailsById(orderInfo.ClientId);

                    ViewInvoiceModel model = new ViewInvoiceModel
                    {
                        Client          = client,
                        Order           = orderInfo,
                        Delivery        = delivery,
                        DeliveryDetails = deliveryDetails
                    };

                    returnModel.InvoiceModel = model;
                }

                return(View(returnModel));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
Ejemplo n.º 3
0
        //---------------------Approve By R&D Manager---------------

        public ActionResult ApproveGeneralRequistionReturn(long salesReturnId)
        {
            try
            {
                ViewBag.ApproverActionId = _iCommonManager.GetAllApprovalActionList().ToList();
                ViewBag.SalesReturnId    = salesReturnId;
                var returnById = _iProductReturnManager.GetSalesReturnBySalesReturnId(salesReturnId);
                List <ViewReturnDetails> models      = _iProductReturnManager.GetGeneralReqReturnDetailsById(salesReturnId).ToList();
                ViewReturnModel          returnModel = new ViewReturnModel
                {
                    ReturnDetailses = models,
                    ReturnModel     = returnById,
                };
                return(View(returnModel));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
Ejemplo n.º 4
0
        public ActionResult ApproveGeneralRequistionReturn(FormCollection collection)
        {
            try
            {
                var  remarks         = collection["Remarks"];
                var  user            = (ViewUser)Session["user"];
                long salesReturnId   = Convert.ToInt64(collection["salesReturnId"]);
                var  aproverActionId = Convert.ToInt32(collection["ApprovarActionId"]);
                var  returnById      = _iProductReturnManager.GetSalesReturnBySalesReturnId(salesReturnId);

                returnById.LastApproverDatetime   = DateTime.Now;
                returnById.LastApproverRoleId     = returnById.CurrentApproverRoleId;
                returnById.CurrentApprovalLevel   = returnById.CurrentApprovalLevel + 1;
                returnById.CurrentApproverRoleId  = Convert.ToInt32(RoleEnum.SalesAdmin);
                returnById.NotesByManager         = remarks;
                returnById.SalesReturnId          = salesReturnId;
                returnById.ApproveByManagerUserId = user.UserId;
                returnById.AproveActionId         = aproverActionId;

                bool result = _iProductReturnManager.ApproveReturnBySalesManager(returnById);
                if (result)
                {
                    return(RedirectToAction("PendingGeneralReqReturns"));
                }

                List <ViewReturnDetails> models      = _iProductReturnManager.GetReturnDetailsBySalesReturnId(salesReturnId).ToList();
                ViewReturnModel          returnModel = new ViewReturnModel
                {
                    ReturnDetailses = models,
                };
                return(View(returnModel));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
        public ActionResult ApproveBySalesAdmin(FormCollection collection)
        {
            try
            {
                var  user                       = (ViewUser)Session["user"];
                long salesReturnId              = Convert.ToInt64(collection["salesReturnId"]);
                var  remarks                    = collection["Remarks"];
                var  aproverActionId            = Convert.ToInt32(collection["ApprovarActionId"]);
                var  returnLessAmount           = Convert.ToDecimal(collection["ReturnLessAmount"]);
                List <ViewReturnDetails> models = _iProductReturnManager.GetReturnDetailsBySalesReturnId(salesReturnId).ToList();
                var returnById                  = _iProductReturnManager.GetSalesReturnBySalesReturnId(salesReturnId);
                returnById.LastApproverDatetime  = DateTime.Now;
                returnById.LastApproverRoleId    = returnById.CurrentApproverRoleId;
                returnById.CurrentApprovalLevel  = 0;
                returnById.CurrentApproverRoleId = 0;
                returnById.IsFinalApproved       = 1;
                returnById.NotesByAdmin          = remarks;
                returnById.SalesReturnId         = salesReturnId;
                returnById.ApproveByAdminUserId  = user.UserId;
                returnById.AproveActionId        = aproverActionId;

                bool result = _iProductReturnManager.ApproveReturnBySalesAdmin(returnById, returnLessAmount);
                if (result)
                {
                    return(RedirectToAction("ViewAll"));
                }
                ViewReturnModel aModel = new ViewReturnModel {
                    ReturnDetailses = models
                };
                return(View(aModel));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }