public NavModel CalculateNav(NavModel model) { model.BankFixedCharge = 100; model.BankGST = 18; model.BrokeragePercent = 5; model.BrokerageTax = 25; model.DailyBankCharge = (model.BankFixedCharge + (model.BankFixedCharge * (model.BankGST / 100))); model.BankChargeforCurrentTransaction = model.totalValue * (model.DailyBankCharge / model.totalspendofday); model.TotalBrockerage = calcualteBrockerage(model.totalValue, model.BrokeragePercent, model.BrokerageTax); model.TotalCumulativeValue = model.TotalBrockerage + model.BankChargeforCurrentTransaction + model.totalValue; model.Totalvalueatpurchasre = model.TotalCumulativeValue / model.totalQty; Decimal totalatselling = model.Totalvalueatpurchasre * model.totalQty; model.BrockerageAtSelling = calcualteBrockerage(totalatselling, model.BrokeragePercent, model.BrokerageTax); model.MinimumSellablevalue = (totalatselling + model.BrockerageAtSelling) / model.totalQty; return(model); }
public void calculateSellableNav() { try { Decimal totalspendofday = 0; Decimal totalQty = 0; Decimal totalValue = 0; Decimal Purchaseprice = 0; try { totalspendofday = Decimal.Parse(txt_Spendofday.Text); } catch (Exception) { } try { totalQty = Decimal.Parse(txt_qty.Text); } catch (Exception) { } try { Purchaseprice = Decimal.Parse(txt_buyPrice.Text); } catch (Exception) { } try { totalValue = totalQty * Purchaseprice; } catch (Exception) { } try { totalspendofday = Decimal.Parse(txt_Spendofday.Text); } catch (Exception) { } NavModel navModel = new NavModel(); navModel.totalspendofday = totalspendofday; navModel.totalQty = totalQty; navModel.totalValue = totalValue; navModel.Purchaseprice = Purchaseprice; CalculateRepo calculateRepo = new CalculateRepo(); navModel = calculateRepo.CalculateNav(navModel); txt_value.Text = navModel.totalValue.ToString(); txt_actualsalevalue.Text = navModel.Totalvalueatpurchasre.ToString(); txt_minimumSellingvalue.Text = navModel.MinimumSellablevalue.ToString(); } catch (Exception) { } }