Ejemplo n.º 1
0
        public ActionResult Allocation(int?id)
        {
            if (id == null)
            {
                return(Redirect(Url.Action("Index", "ReliefRequisition")));
            }

            var requisition =
                _reliefRequisitionService.Get(t => t.RequisitionID == id, null, "ReliefRequisitionDetails").
                FirstOrDefault();

            ViewData["donors"] = _donorService.GetAllDonor();
            //ViewBag.HRDID = new SelectList(_donorService.GetAllDonor(), "HRDID", "Year", donor.HRDID);

            if (requisition == null)
            {
                HttpNotFound();
            }
            if (requisition != null && requisition.ProgramID == (int)Programs.PSNP)
            {
                ViewBag.program = "PSNP";
            }
            var datePref             = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference;
            var requisitionViewModel = RequisitionViewModelBinder.BindReliefRequisitionViewModel(requisition, _workflowStatusService.GetStatus(WORKFLOW.RELIEF_REQUISITION), datePref);

            if (requisition != null && (requisition.RationID != null && requisition.RationID > 0))
            {
                requisitionViewModel.Ration = _rationService.FindById((int)requisition.RationID).RefrenceNumber;
            }
            return(View(requisitionViewModel));
        }
Ejemplo n.º 2
0
        private IEnumerable <HRDDetailViewModel> GetHRDDetails(HRD hrd)
        {
            var hrdDetails    = hrd.HRDDetails;
            var rationDetails = _rationService.FindById(hrd.RationID).RationDetails;

            return(from hrdDetail in hrdDetails
                   select new HRDDetailViewModel()
            {
                HRDDetailID = hrdDetail.HRDDetailID,
                HRDID = hrdDetail.HRDID,
                WoredaID = hrdDetail.WoredaID,
                ZoneID = hrdDetail.AdminUnit.AdminUnit2.AdminUnitID,
                Zone = hrdDetail.AdminUnit.AdminUnit2.Name,
                Region = hrdDetail.AdminUnit.AdminUnit2.AdminUnit2.Name,
                RegionID = hrdDetail.AdminUnit.AdminUnit2.AdminUnit2.AdminUnitID,

                Woreda = hrdDetail.AdminUnit.Name,
                NumberOfBeneficiaries = hrdDetail.NumberOfBeneficiaries,
                //(int)GetTotalBeneficiaries(hrdDetail.HRDID, hrdDetail.AdminUnit.AdminUnit2.AdminUnit2.AdminUnitID),
                StartingMonth = hrdDetail.StartingMonth,
                DurationOfAssistance = hrdDetail.DurationOfAssistance,
                //Cereal = (hrdDetail.DurationOfAssistance) * (hrdDetail.NumberOfBeneficiaries) * (rationDetails.Single(m => m.CommodityID == 1).Amount),
                //Pulse = (hrdDetail.DurationOfAssistance) * (hrdDetail.NumberOfBeneficiaries) * (rationDetails.Single(m => m.CommodityID == 2).Amount),
                //BlendedFood = (hrdDetail.DurationOfAssistance) * (hrdDetail.NumberOfBeneficiaries) * (rationDetails.Single(m => m.CommodityID == 3).Amount),
                //Oil = (hrdDetail.DurationOfAssistance) * (hrdDetail.NumberOfBeneficiaries) * (rationDetails.Single(m => m.CommodityID == 4).Amount)
            });
        }
Ejemplo n.º 3
0
        public decimal GetCommodityRation(int requisitionID, int commodityID)
        {
            var reliefRequisition = _reliefRequisitionService.FindById(requisitionID);
            var ration            = _rationService.FindById(reliefRequisition.RegionalRequest.RationID);
            var rationModel       = ration.RationDetails.FirstOrDefault(m => m.CommodityID == commodityID).Amount;

            return(rationModel);
        }
Ejemplo n.º 4
0
        public ActionResult Print(int id = 0)
        {
            if (id == 0)
            {
                RedirectToAction("Index");
            }
            var reportPath = Server.MapPath("~/Report/EarlyWarning/Ration.rdlc");
            var rd         = _rationService.FindById(id);
            var reportData = (from rationdetail in rd.RationDetails
                              select new RationDetailViewModel
            {
                Amount = rationdetail.Amount,
                RationName = rd.RefrenceNumber,
                Commodity = rationdetail.Commodity.Name,
                RationID = rationdetail.RationID
            });
            var dataSourceName = "RationDetailView";
            var result         = ReportHelper.PrintReport(reportPath, reportData, dataSourceName);

            return(File(result.RenderBytes, result.MimeType));
        }
Ejemplo n.º 5
0
        public ActionResult PostHRD(int RegionalPSNPPlanID, int RationID)
        {
            // IEnumerable<Cats.Models.Transaction> list = (IEnumerable<Cats.Models.Transaction>)_accountTransactionService.GetAllTransaction();
            loadLookups();


            RegionalPSNPPlan plan   = _regionalPSNPPlanService.FindById(RegionalPSNPPlanID);
            Ration           ration = _rationService.FindById(RationID);

            List <Cats.Models.Transaction> list = _accountTransactionService.PostPSNPPlan(plan, ration);

            ViewBag.SelectedPSNPPlan = plan;
            ViewBag.SelectedRation   = ration;
            // IEnumerable<RationDetail> rationdetails = ration.RationDetails;
            return(View(list));
        }