void GetOptionsandTaxValues() { OptionsEntity oData = new OptionsEntity(); IPandSStockValueListRepository pandsRepository = new PandSStockValueListRepository(); oData = pandsRepository.GetOptionDetails(); if (oData != null) { this.CurrencyName = oData.CurrencyCode; //there is no currency name field in database this.CurrencyCode = oData.CurrencyCode; this.CurrencyFormat = oData.NumberFormat; this.DateFormat = oData.DateFormat; this.DecimalPlaces = oData.DecimalPlaces; if (oData.ShowAmountIncGST == true) { this.ShowIncTaxTrue = true; this.ShowExcTaxTrue = false; //int decimalpoints = Convert.ToInt32(DecimalPlaces); //foreach (var item in this.PurchaseQuotationList) //{ // item.QuotationAmount = Math.Round(Convert.ToDouble(item.QuotationAmount), decimalpoints).ToString(); //} //this.PurchaseQuotationList = this.PurchaseQuotationList.Where(x => x.ExcIncGST == true).ToList(); } else { this.ShowIncTaxTrue = false; this.ShowExcTaxTrue = true; int decimalpoints = Convert.ToInt32(DecimalPlaces); //foreach (var item in this.PurchaseQuotationList) //{ // //item.QuotationAmount = item.QuotationAmountExcGST; // //item.QuotationAmount = Math.Round(Convert.ToDouble(item.QuotationAmountExcGST), decimalpoints).ToString(); // item.QuotationAmount = Math.Round(Convert.ToDouble(item.QuotationAmount), decimalpoints).ToString(); //} //commented on 23 May 2017 //if (this.PurchaseQuotationList != null) // this.PurchaseQuotationList = this.PurchaseQuotationList.Where(x => x.ExcIncGST == false).ToList(); } } else { this.CurrencyName = "USD"; this.CurrencyCode = "USD"; this.CurrencyFormat = "en-US"; this.DateFormat = "dd/MM/yyyy"; } var objDefaultTax = pandsRepository.GetTaxes().FirstOrDefault(); if (objDefaultTax != null) { this.TaxName = objDefaultTax.TaxName; } else { this.TaxName = "GST"; } }
private void RefreshData() { IPandSStockValueListRepository pandsRepository = new PandSStockValueListRepository(); this.PandSStockValueList = pandsRepository.GetPandSList().OrderBy(x => x.PandSName).ToList(); this.ShowAllCount = this.PandSStockValueList.Count(); this.ShowSelectedCount = 0; FullList = this.PandSStockValueList.ToList(); DefaultList = this.PandSStockValueList.ToList(); this.PandSStockValueListcmb = this.PandSStockValueList.OrderBy(x => x.PandSName).ToList(); this.PandSStockValueListcmbCode = this.PandSStockValueList.OrderBy(x => x.PandSName).ToList(); this.PandSStockValueListcmbCat1 = this.PandSStockValueList.GroupBy(x => x.Category1).Select(e => e.First()).OrderBy(x => x.Category1).ToList(); this.PandSStockValueListcmbCat2 = this.PandSStockValueList.GroupBy(x => x.Category2).Select(e => e.First()).OrderBy(x => x.Category2).ToList(); this.TotalQtyInStock = Convert.ToString(this.PandSStockValueList.Sum(e => e.QtyInStock)); allPosition.Category1 = "All"; allPosition.Category2 = "All"; this.PandSStockValueListcmbCat1.Insert(0, allPosition); this.PandSStockValueListcmbCat2.Insert(0, allPosition); GetOptionsandTaxValues(); this.ShowAllTrue = true; this.ShowBoth = true; this.ShowSelectedTrue = false; this.ShowProducts = false; this.ShowServices = false; if (this.ShowIncTaxTrue == true) { foreach (var item in this.PandSStockValueList) { item.StandardCostPriceStr = item.PandSAveCostPricebefGST.ToString(); item.AverageCostPriceStr = item.PandSAveCostPriceaftGST.ToString(); item.PSStockValueStr = item.PSStockValueaftTax.ToString(); } this.TotalStockValue = Convert.ToString(this.PandSStockValueList.Sum(e => e.PSStockValueaftTax)); this.TotalAvgCostPrice = Convert.ToString(this.PandSStockValueList.Sum(e => e.PandSAveCostPriceaftGST)); } else { foreach (var item in DefaultList) { item.StandardCostPriceStr = item.PandSAveCostPricebefGST.ToString(); item.AverageCostPriceStr = item.PandSAveCostPriceaftGST.ToString(); item.PSStockValueStr = item.PSStockValuebefTax.ToString(); } this.TotalStockValue = Convert.ToString(this.PandSStockValueList.Sum(e => e.PSStockValuebefTax)); this.TotalAvgCostPrice = Convert.ToString(this.PandSStockValueList.Sum(e => e.PandSAveCostPricebefGST)); } }