public ViewResult Notifications()
        {
            ViewBag.Title = Constant.NOTIFICATIONS;

            var ldnvm   = new ListDepreciationNotificationViewModel();
            var depnObj = _repDepreciation.GetAnnualDepreciationNotifications()
                          .Select(x => new DepreciationNotificationViewModel
            {
                AssetName           = x.AssetName,
                PurchaseNo          = x.PurchaseNo,
                AssetPurchaseId     = x.AssetPurchaseId,
                PurchaseType        = x.PurchaseType,
                PurchasedDateString = x.PurchasedDate.ToString("yyyy/MM/dd"),
                PurchasedPrice      = Decimal.Parse(x.PurchasedPrice.ToString("G29")),
                DepreciationRate    = Decimal.Parse(x.DepreciationRate.ToString("G29")),
                DepreciationType    = x.DepreciationType.ToUpper(),
                //AssetValue = Decimal.Parse(GetCurrentAssetValue(x.PurchasedPrice,
                //                x.PurchasedDate,
                //                x.DepreciationRate,
                //                x.DepreciationType).ToString("#.##")) //Calculate Asset Value

                AssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(x.AssetPurchaseId).ToString("#.##"))
            }).Skip(0).Take(5);

            ldnvm.CountDepreciationNotification = _repDepreciation.GetAnnualDepreciationNotifications().Count();

            if (depnObj != null)
            {
                ldnvm.ListDepreciationNotification = depnObj.ToList();
            }



            return(View(ldnvm));
        }
        public JsonResult NotificationsByLimitOffset(int limit, int offset)
        {
            var ldnvm = new ListDepreciationNotificationViewModel();

            ldnvm.ListDepreciationNotification = _repDepreciation.GetAnnualDepreciationNotifications()
                                                 .Select(x => new DepreciationNotificationViewModel
            {
                AssetName           = x.AssetName,
                PurchaseNo          = x.PurchaseNo,
                AssetPurchaseId     = x.AssetPurchaseId,
                PurchaseType        = x.PurchaseType,
                PurchasedDateString = x.PurchasedDate.ToString("yyyy/MM/dd"),
                PurchasedPrice      = Decimal.Parse(x.PurchasedPrice.ToString("G29")),
                DepreciationRate    = Decimal.Parse(x.DepreciationRate.ToString("G29")),
                DepreciationType    = x.DepreciationType.ToUpper(),
                //AssetValue = Decimal.Parse(GetCurrentAssetValue(x.PurchasedPrice,
                //                x.PurchasedDate,
                //                x.DepreciationRate,
                //                x.DepreciationType).ToString("#.##")) //Calculate Asset Value
                AssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(x.AssetPurchaseId).ToString("#.##"))
            }).Skip(offset).Take(limit).ToList();
            ldnvm.CountDepreciationNotification = _repDepreciation.GetAnnualDepreciationNotifications().Count();

            var json = JsonConvert.SerializeObject(ldnvm);

            if (ldnvm != null)
            {
                return(Json(json, JsonRequestBehavior.AllowGet));
            }

            return(Json("[]", JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetPurchaseDateByLimitOffset(int limit, int offset)
        {
            var ldvm           = new ListDepreciationViewModel();
            var listPurchaseNo = _repDepreciation.ListPurchaseNo();

            //ldvm.PurchasedDateString = listPurchaseNo.Skip(0).Take(10);

            var listDepreciation = new List <ListDepreciationViewModel>();

            foreach (var item in listPurchaseNo)
            {
                var ldvmObj = new ListDepreciationViewModel();
                ldvmObj.AssetPurchaseId   = item.AssetPurchaseId;
                ldvmObj.PurchaseNo        = item.PurchaseNo;
                ldvmObj.AssetName         = item.AssetName;
                ldvmObj.PurchasedPrice    = item.PurchasedPrice;
                ldvmObj.CurrentAssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(item.AssetPurchaseId).ToString("#.##"));

                var purchasedPrice = _repPurchaseAsset.GetAssetPurchaseDetails()
                                     .Where(x => x.Id == item.AssetPurchaseId)
                                     .SingleOrDefault().PricePerUnit;

                ldvmObj.DepRateList = _repDepreciation.GetDepreciation()
                                      .Where(x => x.AssetPurchaseId == item.AssetPurchaseId)
                                      .Select(x => new DepreciationRateViewModel()
                {
                    AssetPurchaseId          = x.AssetPurchaseId,
                    PurchasedDate            = x.PurchasedDate,
                    Year                     = x.Year,
                    Rate                     = x.Rate,
                    DepreciationType         = x.DepreciationType,
                    DepreciationMaturityDate = x.DepreciationMaturityDate,
                    DepreciationEntryDate    = x.DepreciationEntryDate,
                    //CurrentAssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(x.AssetPurchaseId).ToString("#.##"))
                    //CurrentAssetValue = Decimal.Parse(GetCurrentAssetValue(purchasedPrice,
                    //                            x.PurchasedDate,
                    //                            x.Rate,
                    //                            "fixed").ToString("#.##"))
                }).OrderByDescending(x => x.Year).ToList();

                listDepreciation.Add(ldvmObj);
            }

            ldvm.ListDepreciation = listDepreciation.Skip(offset).Take(limit).ToList();
            ldvm.TotalDateCount   = _repDepreciation.ListPurchaseNo().Count();

            var json = JsonConvert.SerializeObject(ldvm);

            if (ldvm != null)
            {
                return(Json(json, JsonRequestBehavior.AllowGet));
            }

            return(Json("[]", JsonRequestBehavior.AllowGet));
        }
        public ViewResult ListDepreciationValue()
        {
            ViewBag.Title = Constant.LIST_DEPRECIATION;

            var ldvm           = new ListDepreciationViewModel();
            var listPurchaseNo = _repDepreciation.ListPurchaseNo();

            //ldvm.PurchasedDateString = listPurchaseNo.Skip(0).Take(10);

            var listDepreciation = new List <ListDepreciationViewModel>();

            foreach (var item in listPurchaseNo)
            {
                var ldvmObj = new ListDepreciationViewModel();
                ldvmObj.AssetPurchaseId   = item.AssetPurchaseId;
                ldvmObj.PurchaseNo        = item.PurchaseNo;
                ldvmObj.AssetName         = item.AssetName;
                ldvmObj.PurchasedPrice    = item.PurchasedPrice;
                ldvmObj.CurrentAssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(item.AssetPurchaseId).ToString("#.##"));

                var purchasedPrice = _repPurchaseAsset.GetAssetPurchaseDetails()
                                     .Where(x => x.Id == item.AssetPurchaseId)
                                     .SingleOrDefault().PricePerUnit;

                ldvmObj.DepRateList = _repDepreciation.GetDepreciation()
                                      .Where(x => x.AssetPurchaseId == item.AssetPurchaseId)
                                      .Select(x => new DepreciationRateViewModel()
                {
                    AssetPurchaseId          = x.AssetPurchaseId,
                    PurchasedDate            = x.PurchasedDate,
                    Year                     = x.Year,
                    Rate                     = x.Rate,
                    DepreciationType         = x.DepreciationType,
                    DepreciationMaturityDate = x.DepreciationMaturityDate,
                    DepreciationEntryDate    = x.DepreciationEntryDate,
                    //CurrentAssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(x.AssetPurchaseId).ToString("#.##"))
                    //CurrentAssetValue = Decimal.Parse(GetCurrentAssetValue(purchasedPrice,
                    //                            x.PurchasedDate,
                    //                            x.Rate,
                    //                            "fixed").ToString("#.##"))
                }).OrderByDescending(x => x.Year).ToList();

                listDepreciation.Add(ldvmObj);
            }

            ldvm.ListDepreciation = listDepreciation.Skip(0).Take(10).ToList();
            ldvm.TotalDateCount   = _repDepreciation.ListPurchaseNo().Count();

            ldvm.DateCount = listDepreciation.Skip(0).Take(10).ToList().Count();

            return(View(ldvm));
        }
예제 #5
0
        public ActionResult DepreciationInAYear()
        {
            ViewBag.Title = Constant.DEPRECIATION_IN_A_YEAR;

            var diayVm = new DepreciationInAYearViewModel();

            var yearList = _repDepreciation.GetYearOfDepreciation();

            decimal totalPurchaseValue = 0;
            decimal totalCurrentValue  = 0;

            var lstYear = new List <string>();
            var lstTotalPurchaseValue = new List <decimal>();
            var lstTotalDepnValue     = new List <decimal>();

            foreach (var item1 in yearList)
            {
                var purchaseDetails = _repPurchaseAsset.GetPurchaseDetailsByYear().Where(x => x.Year == item1.Year).ToList();
                foreach (var item2 in purchaseDetails)
                {
                    //Check if item is in Purchase Return
                    var checkPurchaseReturnObj = _repPurchaseAsset.GetPurchaseReturnDetails()
                                                 .Where(x => x.AssetPurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    //Check if item is in Scrap
                    var checkScrapObj = _repAsset.GetScrap().Where(x => x.PurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    if (checkPurchaseReturnObj == null && checkScrapObj == null)
                    {
                        totalCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item2.AssetPurchaseId).ToString("#.##"));

                        var totalPurchaseValueObj = _repPurchaseAsset.GetAssetPurchaseDetails()
                                                    .Where(x => x.Id == item2.AssetPurchaseId)
                                                    .SingleOrDefault();

                        if (totalPurchaseValueObj != null)
                        {
                            totalPurchaseValue += totalPurchaseValueObj.PricePerUnit;
                        }
                    }
                }
                lstTotalPurchaseValue.Add(totalPurchaseValue);
                lstTotalDepnValue.Add(totalPurchaseValue - totalCurrentValue);
                lstYear.Add(item1.Year);
            }

            diayVm.YearList = lstYear.ToArray();
            diayVm.TotalDepreciationValue = lstTotalDepnValue.ToArray();

            return(View(diayVm));
        }
        public ActionResult GetAssetByPurchasedDate(FormCollection fc)
        {
            var PurchasedDate = fc["formValue[purchasedDate]"];

            var abpdvmObj = new AssetByPurchasedDateListViewModel();

            var AssetList = _repDepreciation.GetAssetByPurchasedDate(PurchasedDate).ToList();

            var itemList = new List <AssetByPurchasedDateViewModel>();

            foreach (var item in AssetList)
            {
                //var purchaseDepnDetails = _repDepreciation.GetAssetPurchaseByDate(PurchasedDate, item.AssetId);
                var purchaseDepnDetails = _repDepreciation.GetDepreciationDetailsWithAssetPurchase(PurchasedDate, item.AssetId);

                var lstPibavm = new List <PurchasedItemByAssetViewModel>();

                foreach (var purchaseDepnItem in purchaseDepnDetails)
                {
                    var pibavm = new PurchasedItemByAssetViewModel()
                    {
                        PurchaseNo       = purchaseDepnItem.PurchaseNo,
                        PurchasedDate    = purchaseDepnItem.PurchasedDate,
                        AssetPrice       = purchaseDepnItem.AssetPrice,
                        CurrentYear      = purchaseDepnItem.CurrentYear,
                        DepreciationRate = purchaseDepnItem.DepreciationRate,
                        DepreciationType = purchaseDepnItem.DepreciationType,
                        //AssetValue = Decimal.Parse(GetCurrentAssetValue(purchaseDepnItem.AssetPrice,
                        //                                    purchaseDepnItem.PurchasedDate,
                        //                                    purchaseDepnItem.DepreciationRate,
                        //                                    purchaseDepnItem.DepreciationType).ToString("#.##")) //Calculate Asset Value
                        AssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(purchaseDepnItem.AssetPurchaseId).ToString("#.##"))
                    };

                    lstPibavm.Add(pibavm);
                }

                var abpdvm = new AssetByPurchasedDateViewModel()
                {
                    AssetId           = item.AssetId,
                    AssetName         = item.AssetName,
                    PurchasedItemList = lstPibavm.ToList()
                };
                itemList.Add(abpdvm);
            }

            abpdvmObj.AssetByPurchasedDateList = itemList;

            return(PartialView(abpdvmObj));
        }
예제 #7
0
        public ActionResult ActiveAssetCost()
        {
            ViewBag.Title = Constant.ACTIVE_ASSET_COST;

            var aacVm = new ActiveAssetCostViewModel();

            var     workingAccessories           = _repActiveAsset.GetWorkingAccessories();
            decimal totalActiveAssetCurrentValue = 0;

            var activeAssetPurchaseCostList      = new List <decimal>();
            var totalActiveAssetCurrentValueList = new List <decimal>();
            var AssetNameList = new List <string>();

            foreach (var item in workingAccessories)
            {
                var scrapItem = _repAsset.GetScrap().Where(x => x.PurchaseNo == item.PurchaseNo).SingleOrDefault();

                if (scrapItem == null)
                {
                    var wavm = new WorkingAccessoriesViewModel()
                    {
                        Id = item.Id,
                        AssetPurchaseId = item.AssetPurchaseId,
                        PurchaseNo      = item.PurchaseNo,
                        AssetName       = item.AssetName,
                        AssetCategory   = item.AssetCategory,
                        Description     = item.Description
                    };

                    AssetNameList.Add(String.Concat(item.AssetName, " (", item.PurchaseNo, ")"));
                    totalActiveAssetCurrentValueList.Add(Decimal.Parse(CurrentItemValue.GetCurrentValue(item.AssetPurchaseId).ToString("#.##")));

                    var purchaseCost = _repPurchaseAsset.GetAssetPurchaseDetails()
                                       .Where(x => x.Id == item.AssetPurchaseId)
                                       .SingleOrDefault().PricePerUnit;
                    activeAssetPurchaseCostList.Add(purchaseCost);

                    totalActiveAssetCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item.AssetPurchaseId).ToString("#.##"));
                }
            }

            aacVm.AssetNameList          = AssetNameList.ToArray();
            aacVm.AssetCostList          = activeAssetPurchaseCostList.ToArray();
            aacVm.TotalAssetCurrentValue = totalActiveAssetCurrentValueList.ToArray();

            return(View(aacVm));
        }
        public ActionResult EditRate(FormCollection fc, long id)
        {
            ViewBag.Title = Constant.EDIT_RATE;

            var updatedRate    = Decimal.Parse(fc["formValue[DepreciationRate]"]);
            var depreciationId = Int64.Parse(fc["formValue[DepreciationId]"]);

            var purchasedPrice   = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == id).SingleOrDefault().PricePerUnit;
            var purchasedDate    = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == id).SingleOrDefault().PurchasedDate;
            var depreciationType = "fixed";

            //var currentAssetValue = Decimal.Parse(GetCurrentAssetValue(purchasedPrice,
            //                                                            purchasedDate,
            //                                                            updatedRate,
            //                                                            depreciationType).ToString("#.##")); //Calculate Asset Value

            var currentAssetValue = Decimal.Parse(CurrentItemValue.GetCurrentValue(id).ToString("#.##"));

            var isUpdated = _repDepreciation.UpdateNewDepreciation(updatedRate, currentAssetValue, depreciationId, id);

            if (isUpdated == 1)
            {
                //Asset Value and Rate JSON Object
                var uracvVm = new UpdatedRateAndCurrentValueViewModel();
                uracvVm.AssetValue      = currentAssetValue;
                uracvVm.AssetPurchaseId = id;
                uracvVm.UpdatedRate     = updatedRate;
                uracvVm.PurchaseNo      = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == id).SingleOrDefault().PurchaseNo;
                uracvVm.CurrentYear     = DateTime.Now.Year.ToString();

                var json = JsonConvert.SerializeObject(uracvVm);

                if (uracvVm != null)
                {
                    return(Json(json, JsonRequestBehavior.AllowGet));
                }

                return(Content("Rate not updated"));
            }
            else
            {
                return(Content("Rate not updated"));
            }
        }
 public override string ToString()
 {
     if (VariableBase.IsDateTime)
     {
         return(CurrentDateTimeValue.ToString());
     }
     if (VariableBase.IsNumber)
     {
         return(CurrentNumberValue.ToString());
     }
     if (VariableBase.IsString)
     {
         return(CurrentStringValue.ToString());
     }
     if (VariableBase.IsItem)
     {
         return(CurrentItemValue.ToString());
     }
     return("");
 }
        public ActionResult SetNewDepreciation(FormCollection fc, long id)
        {
            var depreciationRate      = Decimal.Parse(fc["formValue[DepreciationRate]"]);
            var depreciationType      = fc["formValue[DepreciationType]"];
            var depreciationEntryDate = fc["formValue[DepreciationEntryDate]"];
            var purchasedDate         = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == id).SingleOrDefault().PurchasedDate;
            var purchasedPrice        = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == id).SingleOrDefault().PricePerUnit;

            var sndVm = new SetNewDepreciationViewModel()
            {
                AssetPurchaseId  = id,
                DepreciationRate = depreciationRate,
                DepreciationType = depreciationType,
                //CurrentAssetValue = Decimal.Parse(GetCurrentAssetValue(purchasedPrice,
                //                                                        purchasedDate,
                //                                                        depreciationRate,
                //                                                        depreciationType).ToString("#.##")), //Calculate Asset Value,
                CurrentAssetValue     = Decimal.Parse(CurrentItemValue.GetCurrentValue(id).ToString("#.##")),
                RateStatus            = 1,
                DepreciationEntryDate = DateTime.Now
            };

            var hasNewDepreciation = _repDepreciation.SetNewDepreciation(sndVm);

            var annualDepnNotificationObj = _repDepreciation.GetAnnualDepreciationNotifications();

            sndVm.NewDepreciationCount = annualDepnNotificationObj.Count();

            //Update Session Notification
            SessionHelper.NotificationCount = annualDepnNotificationObj.Count();
            SessionHelper.TopNotification   = annualDepnNotificationObj.ToList();

            var json = "[]";

            if (hasNewDepreciation == 1)
            {
                json = JsonConvert.SerializeObject(sndVm);
            }

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        /*public ActionResult DepreciationInAYear()
         * {
         *  ViewBag.Title = Constant.DEPRECIATION_IN_A_YEAR;
         *
         *  var drVm = new DepreciationReportViewModel();
         *
         *  var currentMonth = DateTime.Now.Month;
         *
         *  var monthList = new List<string>();
         *  var depnAmtList = new List<decimal>();
         *  for (int i = 1; i <= currentMonth; i++)
         *  {
         *      var monthString = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i);
         *      monthList.Add(monthString);
         *
         *      var depnAmount = 30000;
         *      depnAmtList.Add(depnAmount);
         *  }
         *  drVm.MonthList = monthList.ToArray();
         *  drVm.DepreciationAmount = depnAmtList.ToArray();
         *
         *  return View(drVm);
         * }*/

        public ActionResult ActiveComputerCost()
        {
            ViewBag.Title = Constant.ACTIVE_COMPUTER_COST;

            var operatingComputerList = _repActiveAsset.GetOperatingComputer();

            var accVm = new ActiveComputerCostViewModel();

            var computerPurchaseCostList = new List <decimal>();
            var totalOperatingComputerCurrentValueList = new List <decimal>();
            var ComputerNameList = new List <string>();

            foreach (var item1 in operatingComputerList)
            {
                var accVmObj = new ActiveComputerCostViewModel();
                //Computer Purchase Cost
                accVmObj.PurchasedPrice = _repActiveAsset.ComputerAccessoriesPurchaseCost()
                                          .Where(x => x.OperatingComputerId == item1.Id)
                                          .SingleOrDefault().PurchasedPrice;
                accVmObj.OperatingComputerId = item1.Id;
                computerPurchaseCostList.Add(accVmObj.PurchasedPrice);

                var assetPurchaseId = _repActiveAsset.GetPurchaseIdOfOperatingComputer()
                                      .Where(x => x.OperatingComputerId == item1.Id);

                decimal totalOperatingComputerCurrentValue = 0;
                foreach (var item2 in assetPurchaseId)
                {
                    totalOperatingComputerCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item2.AssetPurchaseId).ToString("#.##"));
                }
                totalOperatingComputerCurrentValueList.Add(totalOperatingComputerCurrentValue);

                ComputerNameList.Add(item1.ComputerName);
            }

            accVm.ComputerPurchaseCostList           = computerPurchaseCostList.ToArray();
            accVm.TotalOperatingComputerCurrentValue = totalOperatingComputerCurrentValueList.ToArray();
            accVm.ComputerNameList = ComputerNameList.ToArray();

            return(View(accVm));
        }
예제 #12
0
        private decimal AssetValueWithDepreciation()
        {
            decimal totalCurrentValue = 0;

            foreach (var item in _repPurchaseAsset.GetAssetPurchaseDetails())
            {
                //Check if item is in Purchase Return
                var checkPurchaseReturnObj = _repPurchaseAsset.GetPurchaseReturnDetails()
                                             .Where(x => x.AssetPurchaseId == item.Id).SingleOrDefault();

                //Check if item is in Scrap
                var checkScrapObj = _repAsset.GetScrap().Where(x => x.PurchaseId == item.Id).SingleOrDefault();

                if (checkPurchaseReturnObj == null && checkScrapObj == null)
                {
                    totalCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item.Id).ToString("#.##"));
                }
            }

            return(totalCurrentValue);
        }
예제 #13
0
        public ActionResult AssetValueInHand()
        {
            ViewBag.Title = Constant.ASSET_VALUE_IN_HAND;

            var avihVm = new AssetValueInHandViewModel();

            var yearList = _repDepreciation.GetYearOfDepreciation();

            decimal totalCurrentValue    = 0;
            var     lstYear              = new List <string>();
            var     lstTotalCurrentValue = new List <decimal>();

            foreach (var item1 in yearList)
            {
                var purchaseDetails = _repPurchaseAsset.GetPurchaseDetailsByYear().Where(x => x.Year == item1.Year).ToList();
                foreach (var item2 in purchaseDetails)
                {
                    //Check if item is in Purchase Return
                    var checkPurchaseReturnObj = _repPurchaseAsset.GetPurchaseReturnDetails()
                                                 .Where(x => x.AssetPurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    //Check if item is in Scrap
                    var checkScrapObj = _repAsset.GetScrap().Where(x => x.PurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    if (checkPurchaseReturnObj == null && checkScrapObj == null)
                    {
                        totalCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item2.AssetPurchaseId).ToString("#.##"));
                    }
                }
                lstTotalCurrentValue.Add(totalCurrentValue);
                lstYear.Add(item1.Year);
            }

            avihVm.YearList          = lstYear.ToArray();
            avihVm.TotalCurrentValue = lstTotalCurrentValue.ToArray();

            return(View(avihVm));
        }
예제 #14
0
        public ActionResult Dashboard()
        {
            ViewBag.Title = Constant.DASHBOARD;

            var currentAnnualBudgetId = new BaseController(_repAnnualBudget).budgetList;

            var dvm = new DashboardViewModel();

            dvm.BudgetProvision = _repAnnualBudget.GetBudgetList()
                                  .Where(x => x.Year == DateTime.Now.Year.ToString())
                                  .SingleOrDefault().BudgetProvision;

            var budgetList = _repAnnualBudget.GetBudgetList().OrderByDescending(x => x.Id).ToList();

            decimal ExceedSum       = 0;
            decimal TotalUsedBudget = 0;

            foreach (var item in budgetList)
            {
                ExceedSum = _repAnnualBudget.GetBudgetExceed()
                            .Where(x => x.BudgetYear == DateTime.Now.Year.ToString())
                            .Select(x => x.ExceedAmountProvision)
                            .Sum();

                //TotalUsedBudget += _repAnnualBudget.GetUsedBudget(item.Id); //Total Purchase - Total Purchase Return

                decimal TotalPurchase       = _repAnnualBudget.GetTotalPurchaseInAYear(item.Id);
                decimal TotalPurchaseReturn = _repAnnualBudget.GetTotalPurchaseReturnInAYear(item.Id);
                TotalUsedBudget += TotalPurchase - TotalPurchaseReturn;
            }

            dvm.ExceedProvision = ExceedSum;

            dvm.AmountUsed = TotalUsedBudget;
            dvm.AssetValueWithDepreciation = AssetValueWithDepreciation();
            //dvm.AssetValueWithoutDepreciation = _repPurchaseAsset.AssetValueWithoutDepreciation();

            decimal TotalPurchaseAmt = _repAnnualBudget.GetTotalPurchase();
            decimal TotalReturnAmt   = _repAnnualBudget.GetTotalPurchaseReturn();
            decimal TotalScrap       = _repAnnualBudget.GetTotalScrap();

            dvm.AssetValueWithoutDepreciation = TotalPurchaseAmt - TotalReturnAmt - TotalScrap;

            dvm.LatestPurchase = _repPurchaseAsset.GetLatestPurchase(currentAnnualBudgetId).ToList();

            //Minimum Stock List
            dvm.MinimumStockList = MinimumAssetStockList(currentAnnualBudgetId);

            dvm.LatestDepreciation = _repDepreciation.GetLatestCurrentDepreciation().ToList();

            /********************************ASSET VALUE IN HAND********************************/
            var yearList = _repDepreciation.GetYearOfDepreciation();

            decimal totalCurrentValue    = 0;
            var     lstYear              = new List <string>();
            var     lstTotalCurrentValue = new List <decimal>();

            foreach (var item1 in yearList)
            {
                var purchaseDetails = _repPurchaseAsset.GetPurchaseDetailsByYear().Where(x => x.Year == item1.Year).ToList();
                foreach (var item2 in purchaseDetails)
                {
                    //Check if item is in Purchase Return
                    var checkPurchaseReturnObj = _repPurchaseAsset.GetPurchaseReturnDetails()
                                                 .Where(x => x.AssetPurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    //Check if item is in Scrap
                    var checkScrapObj = _repAsset.GetScrap().Where(x => x.PurchaseId == item2.AssetPurchaseId).SingleOrDefault();

                    if (checkPurchaseReturnObj == null && checkScrapObj == null)
                    {
                        totalCurrentValue += Decimal.Parse(CurrentItemValue.GetCurrentValue(item2.AssetPurchaseId).ToString("#.##"));
                    }
                }
                lstTotalCurrentValue.Add(totalCurrentValue);
                lstYear.Add(item1.Year);
            }

            dvm.YearList          = lstYear.ToArray();
            dvm.TotalCurrentValue = lstTotalCurrentValue.ToArray();
            /********************************ASSET VALUE IN HAND********************************/

            return(View(dvm));
        }