/// <summary> /// Gets pending payment details /// </summary> /// <param name="vendorId">Vendor ID</param> /// <param name="annualBudgetId">Annual Budget ID</param> /// <returns>VendorPaymentViewModel list</returns> public IList <VendorPaymentViewModel> PendingPaymentDetails(long vendorId, long annualBudgetId) { var arrAssetPurchaseIds = DistinctAssetPurchaseId(vendorId, annualBudgetId); PurchaseAssetService pas = new PurchaseAssetService(); List <VendorPaymentViewModel> lstPayment = new List <VendorPaymentViewModel>(); for (int i = 0; i < arrAssetPurchaseIds.Count; i++) { VendorPaymentViewModel vpvm = new VendorPaymentViewModel(); vpvm.PendingPayments = pas.VendorPaymentDetails() .Where(x => x.VendorId == vendorId) .Where(x => x.AnnualBudgetId == annualBudgetId) .Where(x => x.AssetPurchaseId == arrAssetPurchaseIds[i].AssetPurchaseId) .OrderByDescending(x => x.Id) .Take(1) .SingleOrDefault(); //Get Asset Name vpvm.PendingPayments.AssetName = AssetNameFromVendorPayment(arrAssetPurchaseIds[i].AssetPurchaseId, annualBudgetId); lstPayment.Add(vpvm.PendingPayments); } return(lstPayment); }
/// <summary> /// Gets Remaining Amount by Purchase ID /// </summary> /// <param name="vendorId">Vendor ID</param> /// <param name="annualBudgetId">Annual Budget ID</param> /// <param name="assetPurchaseId">Asset Purchase ID</param> /// <returns>Asset Purchase Remaining Amount in decimal</returns> public decimal RemainingAmountByPurchaseId(long vendorId, long annualBudgetId, long assetPurchaseId) { PurchaseAssetService pas = new PurchaseAssetService(); var remainingAmount = pas.VendorPaymentDetails() .Where(x => x.VendorId == vendorId) .Where(x => x.AnnualBudgetId == annualBudgetId) .Where(x => x.AssetPurchaseId == assetPurchaseId) .OrderByDescending(x => x.Id) .Take(1) .SingleOrDefault() .RemainingAmount; return(remainingAmount); }
/// <summary> /// Gets Vendor Asset Purchase /// </summary> /// <param name="vendorId">Vendor ID</param> /// <param name="annualBudgetId">Annual Budget ID</param> /// <returns>VendorPaymentViewModel list</returns> public List <VendorPaymentViewModel> GetVendorAssetPurchase(long vendorId, long annualBudgetId) { PurchaseAssetService pas = new PurchaseAssetService(); IQueryable <VendorPaymentViewModel> paymentDetailByVendor = pas.VendorPaymentDetails() .Where(x => x.VendorId == vendorId) .Where(x => x.AnnualBudgetId == annualBudgetId); List <VendorPaymentViewModel> paymentDtl = paymentDetailByVendor.ToList(); for (int i = 0; i < paymentDtl.Count; i++) { VendorPaymentViewModel vpvm = new VendorPaymentViewModel(); vpvm.AssetPurchaseId = paymentDtl[i].AssetPurchaseId; paymentDtl.Add(vpvm); } return(paymentDtl); }