public ActionResult ToPaymentRequests(int transporterID, string refNo)
        {
            var statuses    = _workflowStatusService.GetStatus(WORKFLOW.TRANSPORT_ORDER);
            var currentUser = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name);

            var datePref = currentUser.DatePreference;

            ViewBag.TargetController = "ValidatedPaymentRequest";
            var list = (IEnumerable <Cats.Models.TransporterPaymentRequest>)_transporterPaymentRequestService
                       .Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo >= 2 && t.TransportOrder.TransporterID == transporterID && t.ReferenceNo == refNo, null, "BusinessProcess")
                       .OrderByDescending(t => t.TransporterPaymentRequestID);
            var transporterPaymentRequests = TransporterPaymentRequestViewModelBinder(list.ToList());
            var transportOrder             = _transportOrderService.Get(t => t.TransporterID == transporterID && t.StatusID >= 3, null, "Transporter").FirstOrDefault();

            var transportOrderViewModel            = TransportOrderViewModelBinder.BindTransportOrderViewModel(transportOrder, datePref, statuses);
            var transporterPaymentRequestViewModel = transporterPaymentRequests.FirstOrDefault();

            if (transporterPaymentRequestViewModel != null)
            {
                ViewBag.ReferenceNo = transporterPaymentRequestViewModel.ReferenceNo;
            }
            ViewBag.TransportOrderViewModel = transportOrderViewModel;
            ViewBag.TransporterID           = transportOrderViewModel.TransporterID;
            ViewBag.ApprovedPRCount         =
                _transporterPaymentRequestService.Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo == 3 && t.TransportOrder.TransporterID == transporterID && t.ReferenceNo == refNo, null, "BusinessProcess").Count();
            return(View("PaymentRequests", transporterPaymentRequests));
        }
        public ActionResult PaymentRequests(int transporterID)
        {
            var statuses    = _workflowStatusService.GetStatus(WORKFLOW.TRANSPORT_ORDER);
            var currentUser = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name);

            var datePref = currentUser.DatePreference;

            ViewBag.TargetController = "TransporterPaymentRequest";
            var paymentRequests = _transporterPaymentRequestService
                                  .Get(t => t.TransportOrder.TransporterID == transporterID &&
                                       t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo < 2, null,
                                       "Delivery,Delivery.DeliveryDetails,TransportOrder").ToList();
            var transporterPaymentRequests = TransporterPaymentRequestViewModelBinder(paymentRequests);
            var transportOrder             =
                _TransportOrderService.Get(t => t.TransporterID == transporterID && t.StatusID >= 3, null, "Transporter")
                .FirstOrDefault();
            var transportOrderViewModel = TransportOrderViewModelBinder.BindTransportOrderViewModel(transportOrder,
                                                                                                    datePref, statuses);

            ViewBag.TransportOrderViewModel = transportOrderViewModel;
            ViewBag.TransporterID           = transportOrderViewModel.TransporterID;
            if (TempData["CustomError"] != null)
            {
                ModelState.AddModelError("Errors", TempData["CustomError"].ToString());
            }
            return(View(transporterPaymentRequests));
        }
        public ActionResult PrintPaymentRequest([DataSourceRequest] DataSourceRequest request, int transporterId, string refno = "", string programname = "All")
        {
            var statuses    = _workflowStatusService.GetStatus(WORKFLOW.TRANSPORT_ORDER);
            var currentUser = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name);

            var datePref        = currentUser.DatePreference;
            var paymentRequests = _transporterPaymentRequestService
                                  .Get(t => t.TransportOrder.TransporterID == transporterId &&
                                       t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo < 2, null,
                                       "Delivery,Delivery.DeliveryDetails,TransportOrder").ToList();
            List <TransporterPaymentRequestViewModel> transporterPaymentRequests;

            if (refno == "" && programname == "All")
            {
                transporterPaymentRequests = TransporterPaymentRequestViewModelBinder(paymentRequests);
            }
            else
            {
                transporterPaymentRequests = (programname == "All") ? TransporterPaymentRequestViewModelBinder(paymentRequests).Where(t => t.ReferenceNo.Contains(refno)).ToList() : TransporterPaymentRequestViewModelBinder(paymentRequests).Where(t => t.ReferenceNo.Contains(refno) && t.Program.Name == programname).ToList();
            }
            var transportOrder          = _transportOrderService.Get(t => t.TransporterID == transporterId && t.StatusID >= 3, null, "Transporter").FirstOrDefault();
            var transportOrderViewModel = TransportOrderViewModelBinder.BindTransportOrderViewModel(transportOrder, datePref, statuses);
            var TransportOrderViewModel = transportOrderViewModel;

            var reportPath      = Server.MapPath("~/Report/Finance/TransporterPaymentRequest.rdlc");
            var reportDataArray = new object[2];
            var dsNameArray     = new string[2];
            var tprvm           = (from data in transporterPaymentRequests
                                   where (data.BusinessProcess.CurrentState.BaseStateTemplate.Name == "Request Verified")
                                   select new
            {
                RequisitionNo = data.RequisitionNo,
                GIN = data.GIN,
                GRN = data.GRN,
                CommodityName = data.Commodity,
                childCommodity = data.ChildCommodity,
                Source = data.Source,
                Destination = data.Destination,
                ReceivedQuantity = data.ReceivedQty,
                Tariff = data.Tarrif,
                ShortageQty = data.ShortageQty,
                ShortageBirr = data.ShortageBirr,
                FreightCharge = data.FreightCharge,
                ContractNumber = data.ContractNumber
            });

            var tovm = new List <TransportOrderViewModel> {
                TransportOrderViewModel
            };

            reportDataArray[0] = tprvm;
            reportDataArray[1] = tovm;

            dsNameArray[0] = "TransporterPayReq";
            dsNameArray[1] = "TOVM";
            var result = ReportHelper.PrintReport(reportPath, reportDataArray, dsNameArray, "PDF", false);

            return(File(result.RenderBytes, result.MimeType));
        }
Example #4
0
        //public ActionResult Promote(BusinessProcessState st, int PaymentRequestID, int transporterID)
        //{
        //    _businessProcessService.PromotWorkflow(st);
        //    var transporterChequeObj =
        //        _transporterChequeService.Get(t => t.TransporterPaymentRequestID == 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;
        //            transporterChequeObj.Status = (int)Cats.Models.Constant.ChequeStatus.ChequeApproved;
        //            _transporterChequeService.EditTransporterCheque(transporterChequeObj);
        //        }
        //        if (st.StateID == (int)Cats.Models.Constant.StateTemplate.ChequeCollected)
        //        {
        //            transporterChequeObj.Status = (int)Cats.Models.Constant.ChequeStatus.ChequeCollected;
        //            _transporterChequeService.EditTransporterCheque(transporterChequeObj);
        //        }
        //    }
        //    return RedirectToAction("PaymentRequests", "ValidatedPaymentRequest", new {Area = "Finance", transporterID});

        //}

        public ActionResult TransportOrderDetail(int transportOrderID)
        {
            var transportOrder          = _transportOrderService.Get(t => t.TransportOrderID == transportOrderID, null, "TransportOrderDetails.FDP,TransportOrderDetails.FDP.AdminUnit,TransportOrderDetails.Commodity,TransportOrderDetails.Hub,TransportOrderDetails.ReliefRequisition").FirstOrDefault();
            var datePref                = UserAccountHelper.GetUser(User.Identity.Name).DatePreference;
            var statuses                = _workflowStatusService.GetStatus(WORKFLOW.TRANSPORT_ORDER);
            var transportOrderViewModel = TransportOrderViewModelBinder.BindTransportOrderViewModel(transportOrder, datePref, statuses);

            ViewData["Transport.order.detail.ViewModel"] = transportOrder == null ? null :
                                                           GetDetail(transportOrder.TransportOrderDetails);
            return(View(transportOrderViewModel));
        }
Example #5
0
        public ActionResult Dispatches(int id)
        {
            //id--transportorderid
            var transportOrder = _transportOrderService.Get(t => t.TransportOrderID == id, null, "Transporter").FirstOrDefault();
            var statuses       = _workflowStatusService.GetStatus(WORKFLOW.TRANSPORT_ORDER);
            var currentUser    = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name);

            var datePref = currentUser.DatePreference;

            ViewBag.TransportOrderId = id;
            var transportOrderViewModel = TransportOrderViewModelBinder.BindTransportOrderViewModel(transportOrder,
                                                                                                    datePref, statuses);

            return(View(transportOrderViewModel));
        }