Exemplo n.º 1
0
        public PartialViewResult Payment(long Id)
        {
            ViewBag.Title = Constant.VENDOR_PAYMENT;

            var AnnualBudgetId = new BaseController(_repAnnualBudget).budgetList;

            var vpvm = new VendorPaymentViewModel();

            vpvm.VendorInfo = _repPurchaseAsset.GetAssetPurchaseDetails().Where(x => x.Id == Id).SingleOrDefault();
            var PaidAmtObj = _repPurchaseAsset.VendorPaymentDetails()
                             .Where(x => x.AssetPurchaseId == Id)
                             .Where(x => x.AnnualBudgetId == AnnualBudgetId).ToList();

            var lstVendorPayment = new List <VendorPaymentViewModel>();

            vpvm.AlreadyPaidAmount  = 0;
            vpvm.PaymentConfirmedBy = "";

            if (PaidAmtObj != null)
            {
                for (int i = 0; i < PaidAmtObj.Count; i++)
                {
                    var vpv = new VendorPaymentViewModel();
                    vpv.AlreadyPaidAmount  = PaidAmtObj[i].PaidAmount;
                    vpv.PaymentConfirmedBy = PaidAmtObj[i].PaymentConfirmedBy;
                    lstVendorPayment.Add(vpv);
                }
            }

            vpvm.AlreadyPaidList = lstVendorPayment;

            return(PartialView(vpvm));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
        }
        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));
        }