public ActionResult Create(PaymentRequest request)
        {
            if (ModelState.IsValid)
            {
                   int BP_PR = _ApplicationSettingService.getPaymentRequestWorkflow();

                   if (BP_PR != 0)
                    {
                        BusinessProcessState createdstate = new BusinessProcessState
                        {
                            DatePerformed = DateTime.Now,
                            PerformedBy = "System",
                            Comment = "Created workflow for Payment Request"

                        };
                        //_PaymentRequestservice.Create(request);

                        BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PR,request.PaymentRequestID,
                                                                                           "PaymentRequest", createdstate);
                        request.BusinessProcessID = bp.BusinessProcessID;
                        request.RequestedDate = DateTime.Now;
                        _PaymentRequestservice.Create(request);
                        //_PaymentRequestservice.Update(request);
                        return RedirectToAction("Index");
                    }
                    ViewBag.ErrorMessage1 = "The workflow assosiated with Payment Request doesnot exist.";
                    ViewBag.ErrorMessage2 = "Please make sure the workflow is created and configured.";
                }
                LoadLookups();
                ModelState.AddModelError("Errors", @"Could not create Request Plan.");
                return View(request);
        }
        /*
          BusinessProcessState createdstate = new BusinessProcessState
                        {
                            DatePerformed = DateTime.Now,
                            PerformedBy = "System",
                            Comment = "Created workflow for Payment Request"

                        };
                        _PaymentRequestservice.Create(request);

                        BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PR,request.PaymentRequestID,
                                                                                           "PaymentRequest", createdstate);
                        request.BusinessProcessID = bp.BusinessProcessID;
         */
        public BusinessProcess CreateBusinessProcessForObject(int templateID, int DocumentID, string DocumentType,bool save=false)
        {
            StateTemplate startingTemplate = _unitOfWork.StateTemplateRepository.FindBy(s => s.ParentProcessTemplateID == templateID && s.StateType == 0).Single();
            BusinessProcess bp = new BusinessProcess { ProcessTypeID = templateID, DocumentID = DocumentID, DocumentType = DocumentType };
            BusinessProcessState StartingState = new BusinessProcessState
            {
                DatePerformed = DateTime.Now,
                PerformedBy = "System",
                Comment = "Created workflow for" + DocumentType

            };
             _unitOfWork.BusinessProcessRepository.Add(bp);

            StartingState.ParentBusinessProcess = bp;
            StartingState.StateID = startingTemplate.StateTemplateID;

            _unitOfWork.BusinessProcessStateRepository.Add(StartingState);
            bp.CurrentStateID = StartingState.BusinessProcessStateID;

             //   _unitOfWork.BusinessProcessRepository.Edit(bp);
              //  PromotWorkflow(StartingState);

            if (save)
            {
                _unitOfWork.Save();

            }
            return bp;
        }
 public bool Update(BusinessProcessState item)
 {
     if (item == null) return false;
     _unitOfWork.BusinessProcessStateRepository.Edit(item);
     _unitOfWork.Save();
     return true;
 }
        public BusinessProcess CreateBusinessProcess(int templateID, int DocumentID, string DocumentType, BusinessProcessState StartingState)
        {
            StateTemplate startingTemplate=_unitOfWork.StateTemplateRepository.FindBy(s => s.ParentProcessTemplateID == templateID && s.StateType == 0).Single();
            BusinessProcess bp = new BusinessProcess { ProcessTypeID = templateID, DocumentID = DocumentID, DocumentType = DocumentType };
            Add(bp);
            StartingState.ParentBusinessProcessID = bp.BusinessProcessID;
            StartingState.StateID = startingTemplate.StateTemplateID;
            PromotWorkflow(StartingState);

            return bp;
        }
 public BusinessProcess CreateBusinessProcess(int templateID, int documentID, string documentType, BusinessProcessState startingState)
 {
     var startingTemplate=_unitOfWork.StateTemplateRepository.FindBy(s => s.ParentProcessTemplateID == templateID && s.StateType == 0).FirstOrDefault();
     if (startingTemplate==null)
         return null;
     var bp = new BusinessProcess { ProcessTypeID = templateID, DocumentID = documentID, DocumentType = documentType };
     Add(bp);
     startingState.ParentBusinessProcessID = bp.BusinessProcessID;
     startingState.StateID = startingTemplate.StateTemplateID;
     PromotWorkflow(startingState);
     return bp;
 }
        public ActionResult Create(RegionalPSNPPlan regionalpsnpplan)
        {
            var planName = regionalpsnpplan.Plan.PlanName;
            var startDate = regionalpsnpplan.Plan.StartDate;
            var firstDayOfTheMonth = startDate.AddDays(1 - startDate.Day);
            var endDate = firstDayOfTheMonth.AddMonths(regionalpsnpplan.Duration).AddDays(-1);
            UserProfile user = _userProfileService.GetUser(User.Identity.Name);
             if (ModelState.IsValid)
                {

                        _regionalPSNPPlanService.AddPsnpPlan(planName, firstDayOfTheMonth, endDate);
                        var plan = _planService.Get(m => m.PlanName == planName,null,"Program").FirstOrDefault();
                         regionalpsnpplan.Plan = plan;

                         //check if this psnp plan exitsts for this year and Plan
                         var exists = plan != null && _regionalPSNPPlanService.DoesPsnpPlanExistForThisRegion(plan.PlanID, regionalpsnpplan.Year);

                         if (!exists)
                         {

                             int BP_PSNP = _ApplicationSettingService.getPSNPWorkflow();
                             if (BP_PSNP != 0)
                             {
                                 BusinessProcessState createdstate = new BusinessProcessState
                                 {
                                     DatePerformed = DateTime.Now,
                                     PerformedBy = "System",
                                     Comment = "Created workflow for PSNP Plan"

                                 };

                         var psnpPlan=  _regionalPSNPPlanService.CreatePsnpPlan(regionalpsnpplan.Year,regionalpsnpplan.Duration,regionalpsnpplan.RationID,regionalpsnpplan.StatusID,plan.PlanID,user.UserProfileID);
                        //_planService.ChangePlanStatus(regionalpsnpplan.PlanId);
                        BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PSNP,
                                                                                           regionalpsnpplan.
                                                                                               RegionalPSNPPlanID,
                                                                                           "PSNP", createdstate);
                        psnpPlan.StatusID = bp.BusinessProcessID;
                        _regionalPSNPPlanService.UpdateRegionalPSNPPlan(psnpPlan);
                        return RedirectToAction("Index");

                    }
                    ViewBag.ErrorMessage1 = "The workflow assosiated with PSNP planning doesnot exist.";
                    ViewBag.ErrorMessage2 = "Please make sure the workflow is created and configured.";
                }
                LoadLookups();
                ModelState.AddModelError("Errors", @"PSNP plan already made for this period and plan Name.");
                return View(regionalpsnpplan);
            }
            LoadLookups();

            return View(regionalpsnpplan);
        }
 public ActionResult Promote(BusinessProcessState st)
 {
     _BusinessProcessService.PromotWorkflow(st);
     return RedirectToAction("Index");
 }
Beispiel #8
0
 public ActionResult Promote(BusinessProcessState st, int transporterID)
 {
     _businessProcessService.PromotWorkflow(st);
     return RedirectToAction("Cheques", "Cheque", new { Area = "Finance", transporterID });
 }
 public ActionResult Promote(BusinessProcessState st, int transporterID)
 {
     _BusinessProcessService.PromotWorkflow(st);
     return RedirectToAction("PaymentRequests", "TransporterPaymentRequest", new { Area = "Logistics", transporterID });
 }
        public ActionResult Edit(BusinessProcessState st)
        {
            _BusinessProcessService.PromotWorkflow(st);
            BusinessProcess item = _BusinessProcessService.FindById(st.ParentBusinessProcessID);
            /*if (ModelState.IsValid)
            {

                item.CurrentStateID = st.StateID;
                _BusinessProcessService.Update(item);
                _BusinessProcessStateService.Add(st);
                return View(item);
              //  _BusinessProcessService.Update(item);
             //   return RedirectToAction("Index");
            }*/
            return View(item);
        }
        public ActionResult Multiplesubmission(List<TransporterPaymentRequestViewModel> transporterPaymentRequestViewModels,int transporterID)
        {
            var checkedPaymentRequests = transporterPaymentRequestViewModels.Where(m => m.Checked == true).ToList();
            BusinessProcessState processState;
            if (checkedPaymentRequests.Count>0)
            {
                foreach (var transporterPaymentRequestViewModel in checkedPaymentRequests)
                {
                    var parentBussinessProcessID = transporterPaymentRequestViewModel.BusinessProcess.CurrentState.
                        ParentBusinessProcessID;
                    processState = new BusinessProcessState()
                                       {
                                           DatePerformed = DateTime.Now,
                                           ParentBusinessProcessID =parentBussinessProcessID,
                                           PerformedBy =
                                               _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).FirstName,
                                            StateID =_transporterPaymentRequestService.GetFinalState(parentBussinessProcessID)
                                               //transporterPaymentRequestViewModel.BusinessProcess.CurrentState.BaseStateTemplate.InitialStateFlowTemplates.FirstOrDefault().FinalStateID

                                       };

                    _BusinessProcessService.PromotWorkflow(processState);
                }
                return RedirectToAction("PaymentRequests", "TransporterPaymentRequest",
                                            new { Area = "Logistics", transporterID });
            }
            return RedirectToAction("PaymentRequests", "TransporterPaymentRequest",
                                            new { Area = "Logistics", transporterID });
        }
 public bool Add(BusinessProcessState item)
 {
     _unitOfWork.BusinessProcessStateRepository.Add(item);
     _unitOfWork.Save();
     return true;
 }
        public ActionResult EditCollectiveChequeInfo(Models.TransporterChequeViewModel transporterChequeViewModel, int transporterID)
        {
            var paymentRequestList = (IEnumerable<Cats.Models.TransporterPaymentRequest>)_transporterPaymentRequestService
                        .Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo == 3, null, "BusinessProcess")
                        .OrderByDescending(t => t.TransporterPaymentRequestID);
            //var transporterChequeObj = _transporterChequeService.Get(t => t.TransporterChequeId == transporterChequeViewModel.TransporterChequeId).FirstOrDefault();
            if (paymentRequestList.Any())
            {
                var transporterChequeDetails = new List<TransporterChequeDetail>();
                foreach(var paymentRequest in paymentRequestList)
                {
                    var transporterChequeDetail = new TransporterChequeDetail
                                                      {
                                                          TransporterPaymentRequestID = paymentRequest.TransporterPaymentRequestID
                                                      };
                    transporterChequeDetails.Add(transporterChequeDetail);
                }
                var user = UserAccountHelper.GetUser(User.Identity.Name);
                var transporterChequeObj = new TransporterCheque()
                                                {
                                                    CheckNo = transporterChequeViewModel.CheckNo,
                                                    PaymentVoucherNo = transporterChequeViewModel.PaymentVoucherNo,
                                                    BankName = transporterChequeViewModel.BankName,
                                                    Amount = transporterChequeViewModel.Amount,
                                                    PreparedBy = user.UserProfileID,
                                                    Status = 1,
                                                    TransporterChequeDetails = transporterChequeDetails
                                                };

                int BP_PR = _applicationSettingService.getTransporterChequeWorkflow();
                if (BP_PR != 0)
                {
                    BusinessProcessState createdstate = new BusinessProcessState
                    {
                        DatePerformed = DateTime.Now,
                        PerformedBy = "System",
                        Comment = "Created workflow for Transporter Cheque"

                    };
                    //_PaymentRequestservice.Create(request);

                    BusinessProcess bp = _businessProcessService.CreateBusinessProcess(BP_PR, transporterChequeObj.TransporterChequeId,
                                                                                        "ValidatedPaymentRequest", createdstate);
                    transporterChequeObj.BusinessProcessID = bp.BusinessProcessID;
                    transporterChequeObj.IssueDate = DateTime.Now;
                    _transporterChequeService.AddTransporterCheque(transporterChequeObj);
                    foreach (var paymentRequest in paymentRequestList)
                    {
                        var currFlowTemplate = paymentRequest.BusinessProcess.CurrentState.BaseStateTemplate.InitialStateFlowTemplates.FirstOrDefault();
                        if (currFlowTemplate != null)
                        {
                            var state = new BusinessProcessState()
                                            {
                                                StateID = currFlowTemplate.FinalStateID,
                                                PerformedBy = user.FullName,
                                                Comment = "Finance: Batch generated cheque for the payment request",
                                                DatePerformed = DateTime.Now,
                                                ParentBusinessProcessID = paymentRequest.BusinessProcess.CurrentState.ParentBusinessProcessID
                                            };
                            var item = _businessProcessService.FindById(state.ParentBusinessProcessID);
                            _businessProcessStateService.Add(state);
                            item.CurrentStateID = state.BusinessProcessStateID;
                            _businessProcessService.Update(item);
                        }
                    }
                }
            }
            return RedirectToAction("Cheques", "Cheque", new { Area = "Finance", transporterID });
        }
 public ActionResult Promote(BusinessProcessState st, int PaymentRequestID)
 {
     _businessProcessService.PromotWorkflow(st);
     var transporterChequeObj = _transporterChequeService.Get(t => t.PaymentRequestID == PaymentRequestID).FirstOrDefault();
     if (transporterChequeObj != null)
     {
         if (st.StateID == (int)Cats.Models.Constant.StateTemplate.ChequeApproved)
         {
             transporterChequeObj.AppovedBy = UserAccountHelper.GetUser(User.Identity.Name).UserProfileID;
             transporterChequeObj.AppovedDate = DateTime.Now;
         }
     }
     return RedirectToAction("Index");
 }
 public ActionResult Promote(BusinessProcessState st)
 {
     loadLookups();
     BusinessProcess item = _BusinessProcessService.FindById(st.ParentBusinessProcessID);
     item.ProcessTypeID = st.StateID;
     _BusinessProcessService.Update(item);
     _BusinessProcessStateService.Add(st);
     return View();
 }
        public bool PromotWorkflow(BusinessProcessState state)
        {
            BusinessProcess item = this.FindById(state.ParentBusinessProcessID);
            if(item!=null)
            {

                _unitOfWork.BusinessProcessStateRepository.Add(state);
                _unitOfWork.Save();
                item.CurrentStateID = state.BusinessProcessStateID;
                _unitOfWork.BusinessProcessRepository.Edit(item);
                _unitOfWork.Save();

                return true;
            }
            return false;
        }
 public bool CheckPlanBeforeReject(BusinessProcessState st)
 {
     var state =
          _unitOfWork.StateTemplateRepository.FindBy(s => s.StateTemplateID == st.StateID).FirstOrDefault();
      return state != null && state.Name == "Rejected";
 }
        public ActionResult Create(RegionalPSNPPlan regionalpsnpplan)
        {
            //regionalpsnpplan.StatusID = 1;

            //check if this psnp plan exitsts for this region
            var exists = _regionalPSNPPlanService.DoesPsnpPlanExistForThisRegion(regionalpsnpplan.PlanId);

             if (ModelState.IsValid)
                {
                    if (!exists)
                    {

                    int BP_PSNP = _ApplicationSettingService.getPSNPWorkflow();
                    if (BP_PSNP != 0)
                    {
                        BusinessProcessState createdstate = new BusinessProcessState
                                                                {
                                                                    DatePerformed = DateTime.Now,
                                                                    PerformedBy = "System",
                                                                    Comment = "Created workflow for PSNP Plan"

                                                                };
                        _regionalPSNPPlanService.AddRegionalPSNPPlan(regionalpsnpplan);
                       _planService.ChangePlanStatus(regionalpsnpplan.PlanId);
                        BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PSNP,
                                                                                           regionalpsnpplan.
                                                                                               RegionalPSNPPlanID,
                                                                                           "PSNP", createdstate);
                        regionalpsnpplan.StatusID = bp.BusinessProcessID;
                        _regionalPSNPPlanService.UpdateRegionalPSNPPlan(regionalpsnpplan);
                        return RedirectToAction("Index");

                    }
                    ViewBag.ErrorMessage1 = "The workflow assosiated with PSNP planning doesnot exist.";
                    ViewBag.ErrorMessage2 = "Please make sure the workflow is created and configured.";
                }
                LoadLookups();
                ModelState.AddModelError("Errors", "PSNP plan already made for this period.");
                return View(regionalpsnpplan);
            }
            LoadLookups();

            return View(regionalpsnpplan);
        }
        public ActionResult EditGRN(GRNViewModel delivery)
        {
            var originaldelivery = _deliveryService.Get(t => t.DispatchID == delivery.DispatchID, null,
                "FDP,FDP.AdminUnit,FDP.AdminUnit.AdminUnit2,FDP.AdminUnit.AdminUnit2.AdminUnit2,Hub").FirstOrDefault();
            var newdelivery = new Delivery();
            var deliveryDetail = new DeliveryDetail();
            if (originaldelivery != null)
            {
                newdelivery = _deliveryService.FindBy(t => t.DeliveryID == originaldelivery.DeliveryID).FirstOrDefault();
                TransporterPaymentRequest newTransportPaymentRequest = null;
                newTransportPaymentRequest = _transporterPaymentRequestService.FindBy(t => t.GIN == delivery.InvoiceNo).FirstOrDefault();

                if (newdelivery != null)
                {
                    newdelivery.DispatchID = delivery.DispatchID;
                    newdelivery.ReceivingNumber = delivery.ReceivingNumber;
                    newdelivery.WayBillNo = delivery.WayBillNo;
                    newdelivery.ReceivedBy = delivery.ReceivedBy;
                    newdelivery.ReceivedDate = delivery.ReceivedDate != null ? DateTime.Parse(delivery.ReceivedDate) : DateTime.Now;
                    newdelivery.DeliveryBy = delivery.DeliveryBy;
                    newdelivery.DeliveryDate = delivery.DeliveryDate != null ? DateTime.Parse(delivery.DeliveryDate) : DateTime.Now;
                    newdelivery.DocumentReceivedDate = delivery.DocumentReceivedDate != null ? DateTime.Parse(delivery.DocumentReceivedDate) : DateTime.Now;

                    _deliveryService.EditDelivery(newdelivery);

                    deliveryDetail =
                        _deliveryDetailService.Get(t => t.DeliveryID == newdelivery.DeliveryID, null,
                                                       "Commodity,Unit").FirstOrDefault();
                    if (deliveryDetail != null)
                    {
                        deliveryDetail.ReceivedQuantity = delivery.ReceivedQuantity.ToMetricTone(); //save it using MT
                        _deliveryDetailService.EditDeliveryDetail(deliveryDetail);

                    }
                    if(newTransportPaymentRequest!=null)
                    {
                        newTransportPaymentRequest.ReferenceNo = delivery.RefNo;
                        _transporterPaymentRequestService.EditTransporterPaymentRequest(newTransportPaymentRequest);
                    }

                }

            }
            else
            {
                var dispatch = _dispatchService.FindBy(t => t.DispatchID == delivery.DispatchID).FirstOrDefault();
                //newDelivery = new Delivery();
                newdelivery.DeliveryID = Guid.NewGuid();
                newdelivery.DispatchID = delivery.DispatchID;
                newdelivery.ReceivingNumber = delivery.ReceivingNumber;
                newdelivery.WayBillNo = delivery.WayBillNo;
                newdelivery.ReceivedBy = delivery.ReceivedBy;
                newdelivery.ReceivedDate = delivery.ReceivedDate != null ? DateTime.Parse(delivery.ReceivedDate) : DateTime.Now;
                newdelivery.DeliveryBy = delivery.DeliveryBy;
                newdelivery.DeliveryDate = delivery.DeliveryDate != null ? DateTime.Parse(delivery.DeliveryDate) : DateTime.Now;
                newdelivery.DocumentReceivedDate = delivery.DocumentReceivedDate != null ? DateTime.Parse(delivery.DocumentReceivedDate) : DateTime.Now;
                if (dispatch != null)
                {
                    var dispatchAllocation =
                        _dispatchAllocationService.FindBy(m => m.DispatchAllocationID == dispatch.DispatchAllocationID).
                            FirstOrDefault();
                    //if (dispatchAllocation != null && dispatchAllocation.ShippingInstructionID!=null)
                    //{
                    //    newdelivery.DonorID = _deliveryService.GetDonorID(dispatchAllocation.ShippingInstruction.Value);
                    //}
                    if (dispatch.DriverName != null)
                        newdelivery.DriverName = dispatch.DriverName;
                    //newDistribution.FDP = dispatch.FDP;
                    if (dispatch.FDPID != null)
                        newdelivery.FDPID = int.Parse(dispatch.FDPID.ToString());
                    //newDistribution.Hub = dispatch.Hub;
                    newdelivery.HubID = dispatch.HubID;
                    newdelivery.InvoiceNo = dispatch.GIN;
                    newdelivery.PlateNoPrimary = dispatch.PlateNo_Prime;
                    newdelivery.PlateNoTrailler = dispatch.PlateNo_Trailer;
                    newdelivery.RequisitionNo = dispatch.RequisitionNo;
                    newdelivery.TransporterID = dispatch.TransporterID;
                }
                //_deliveryService.AddDelivery(newdelivery);

                deliveryDetail.DeliveryDetailID = Guid.NewGuid();
                deliveryDetail.CommodityID = delivery.CommodityID;
                deliveryDetail.UnitID = delivery.UnitID;
                deliveryDetail.SentQuantity = delivery.SentQuantity.ToMetricTone();//save it using MT
                deliveryDetail.ReceivedQuantity = delivery.ReceivedQuantity.ToMetricTone();//save it using MT
                //deliveryDetail.Delivery.DeliveryBy = _commodityService.FindById(delivery.CommodityID);
                //deliveryDetail.Unit = _unitService.FindById(delivery.UnitID);
                newdelivery.DeliveryDetails = new List<DeliveryDetail> { deliveryDetail };
                _deliveryService.AddDelivery(newdelivery);

                var transporterPaymentRequest = new TransporterPaymentRequest();
                transporterPaymentRequest.ReferenceNo =  delivery.RefNo;
                transporterPaymentRequest.GIN = delivery.InvoiceNo;

                //var firstOrDefault = _transportOrderService.Get(t => t.TransporterID == newdelivery.TransporterID && t.StatusID >= 3).FirstOrDefault();
                var transportOrderId = delivery.TransportOrderID;
                if (transportOrderId != null)
                    transporterPaymentRequest.TransportOrderID = transportOrderId;

                transporterPaymentRequest.DeliveryID = newdelivery.DeliveryID;
                transporterPaymentRequest.ShortageBirr = (decimal)0.00;
                int BP_PR = _applicationSettingService.getPaymentRequestWorkflow();

                if (BP_PR != 0)
                {
                    BusinessProcessState createdstate = new BusinessProcessState
                    {
                        DatePerformed = DateTime.Now,
                        PerformedBy = "System",
                        Comment = "Created workflow for Payment Request"

                    };
                    //_PaymentRequestservice.Create(request);

                    BusinessProcess bp = _businessProcessService.CreateBusinessProcess(BP_PR, transporterPaymentRequest.TransporterPaymentRequestID,
                                                                                        "PaymentRequest", createdstate);
                    transporterPaymentRequest.BusinessProcessID = bp.BusinessProcessID;
                    transporterPaymentRequest.RequestedDate = DateTime.Now;
                    _transporterPaymentRequestService.AddTransporterPaymentRequest(transporterPaymentRequest);
                }
                ViewBag.ErrorMessage1 = "The workflow assosiated with Payment Request doesnot exist.";
                ViewBag.ErrorMessage2 = "Please make sure the workflow is created and configured.";
            }
            var deliveryViewModel = new GRNViewModel();
            if (newdelivery != null && deliveryDetail != null)
            {
                var deliveryWithFDP = _deliveryService.Get(t => t.DeliveryID == newdelivery.DeliveryID, null, "FDP").FirstOrDefault();
                deliveryViewModel = BindDeliveryViewModel(deliveryWithFDP);
                var deliveryDetailWithComodityUnit = _deliveryDetailService.Get(t => t.DeliveryDetailID == deliveryDetail.DeliveryDetailID, null, "Commodity,Unit").FirstOrDefault();
                if (deliveryDetailWithComodityUnit != null)
                {
                    deliveryViewModel.DeliveryID = deliveryDetailWithComodityUnit.DeliveryID;
                    deliveryViewModel.CommodityID = deliveryDetailWithComodityUnit.CommodityID;
                    deliveryViewModel.UnitID = deliveryDetailWithComodityUnit.UnitID;
                    deliveryViewModel.SentQuantity = deliveryDetailWithComodityUnit.SentQuantity;
                    deliveryViewModel.ReceivedQuantity = deliveryDetailWithComodityUnit.ReceivedQuantity;
                    deliveryViewModel.Commodity = deliveryDetailWithComodityUnit.Commodity.Name;
                    deliveryViewModel.Unit = deliveryDetailWithComodityUnit.Unit.Name;

                }
            }

            return Json(deliveryViewModel, JsonRequestBehavior.AllowGet);
            //return View("Dispatches", distributionViewModel);
        }
        public ActionResult Promote(BusinessProcessState st)
        {
            var isReject = _BusinessProcessService.CheckPlanBeforeReject(st);
            if (isReject)
            {

            }
            _BusinessProcessService.PromotWorkflow(st);
            return RedirectToAction("Index");
        }