示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            userVo    = (UserVo)Session["UserVo"];
            path      = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
            advisorVo = (AdvisorVo)Session[SessionContents.AdvisorVo];
            rmVo      = (RMVo)Session[SessionContents.RmVo];
            txtCustomer_autoCompleteExtender.ContextKey = rmVo.RMId.ToString();
            BindPortfolioTypeDropDown();
            if (!IsPostBack)
            {
                if (Request.QueryString["action"] == "EditCustomerPortfolio")
                {
                    btnSave.Visible = false;
                    portfolioId     = int.Parse(Session["PortfolioId"].ToString());
                    dsPortfolioType = portfolioBo.GetCustomerPortfolioDetails(portfolioId);
                    dtPortfolioType = dsPortfolioType.Tables[0];

                    txtCustomer.Text    = dtPortfolioType.Rows[0]["C_FirstName"].ToString();
                    txtCustomerId.Value = dtPortfolioType.Rows[0]["C_CustomerId"].ToString();

                    txtPanCustomer.Text     = dtPortfolioType.Rows[0]["C_PANNum"].ToString();
                    txtAddressCustomer.Text = dtPortfolioType.Rows[0]["C_Adr1Line1"].ToString();

                    txtPortfolioName.Text = dtPortfolioType.Rows[0]["CP_PortfolioName"].ToString();
                    txtPMSIdentifier.Text = dtPortfolioType.Rows[0]["CP_PMSIdentifier"].ToString();

                    ddlPortfolioType.SelectedValue = dtPortfolioType.Rows[0]["XPT_PortfolioTypeCode"].ToString();
                    btnSubmit.Text = "Update";
                }
            }
        }
        /// <summary>
        /// Creating Data Table For "ELIGIBLE CAPITAL GAIN DETAILS & SUMMARY" Report : "Author:Pramod"
        /// </summary>
        /// <param name="reports">"reports" is a object of "MFReportVo" Contails report parameters </param>
        /// <returns> DataTable</returns>
        public DataTable GetEligibleCapitalGainDetailsReport(MFReportVo reports)
        {
            DataTable dtEligibleCapitalGainDetails = new DataTable();

            dtEligibleCapitalGainDetails.Columns.Add("CustomerName");
            dtEligibleCapitalGainDetails.Columns.Add("CustomerId");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioName");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioId");
            dtEligibleCapitalGainDetails.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("RedDate");
            dtEligibleCapitalGainDetails.Columns.Add("RedAmount", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("DaysInvestedFor");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseDate");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseAmount", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("FolioNum");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanCode");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanName");

            dtEligibleCapitalGainDetails.Columns.Add("STCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("LTCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("Category");
            dtEligibleCapitalGainDetails.Columns.Add("CurrNAV", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("CurrVALUE", System.Type.GetType("System.Double"));

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == false && mFPortfolioTransaction.BuyDate < reports.ToDate)
                                {
                                    DataRow drEligibleCapitalGainDetails = dtEligibleCapitalGainDetails.NewRow();

                                    drEligibleCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drEligibleCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drEligibleCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drEligibleCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Units"]      = mFPortfolioTransaction.BuyQuantity;
                                    drEligibleCapitalGainDetails["RedDate"]    = mFPortfolioTransaction.SellDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["RedAmount"]  = mFPortfolioTransaction.NetSalesProceed;

                                    drEligibleCapitalGainDetails["DaysInvestedFor"] = mFPortfolioTransaction.AgeOfInvestment;

                                    drEligibleCapitalGainDetails["PurchaseDate"]   = mFPortfolioTransaction.BuyDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["PurchaseAmount"] = mFPortfolioTransaction.CostOfAcquisition;

                                    drEligibleCapitalGainDetails["FolioNum"]       = mFPortfolioVo.Folio;
                                    drEligibleCapitalGainDetails["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drEligibleCapitalGainDetails["SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drEligibleCapitalGainDetails["STCGTax"]  = mFPortfolioTransaction.STCGTax;
                                    drEligibleCapitalGainDetails["LTCGTax"]  = mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Category"] = mFPortfolioVo.Category;

                                    drEligibleCapitalGainDetails["CurrNAV"]   = mFPortfolioTransaction.CurrentNAV;
                                    drEligibleCapitalGainDetails["CurrVALUE"] = mFPortfolioTransaction.CurrentValue;


                                    dtEligibleCapitalGainDetails.Rows.Add(drEligibleCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtEligibleCapitalGainDetails);
        }
        public DataTable GetCapitalGainSummaryReport(MFReportVo reports)
        {
            DataTable dtCapitalGainSummary = new DataTable();

            dtCapitalGainSummary.Columns.Add("CustomerName");
            dtCapitalGainSummary.Columns.Add("CustomerId");
            dtCapitalGainSummary.Columns.Add("PortfolioName");
            dtCapitalGainSummary.Columns.Add("PortfolioId");
            dtCapitalGainSummary.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtCapitalGainSummary.Columns.Add("FolioNum");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanCode");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanName");


            dtCapitalGainSummary.Columns.Add("STCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("LTCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("Category");


            DataRow dtRow = dtCapitalGainSummary.NewRow();

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == true && mFPortfolioTransaction.SellDate > reports.FromDate && mFPortfolioTransaction.SellDate < reports.ToDate)
                                {
                                    DataRow drCapitalGainDetails = dtCapitalGainSummary.NewRow();

                                    drCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drCapitalGainDetails["GainOrLoss"]          = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["FolioNum"]            = mFPortfolioVo.Folio;
                                    drCapitalGainDetails["PASP_SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drCapitalGainDetails["PASP_SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drCapitalGainDetails["STCGAmount"] = mFPortfolioTransaction.STCGTax;
                                    drCapitalGainDetails["LTCGAmount"] = mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["Category"]   = mFPortfolioVo.Category;

                                    dtCapitalGainSummary.Rows.Add(drCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtCapitalGainSummary);
        }
        public DataTable GetReturnTransactionSummaryReport(MFReportVo reports)
        {
            DataTable            dtReturnTransaction   = new DataTable();
            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();

            dtReturnTransaction.Columns.Add("TransactionType");
            dtReturnTransaction.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("PurchasePrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseCost", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SellDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("SellPrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SaleProceed", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsonDateNAV", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsOnDateValue", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AgeOfInvestment", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("ActualPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("NotionalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("TotalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AbsoluteReturn", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AnnualReturn", System.Type.GetType("System.Double"));


            dtReturnTransaction.Columns.Add("SchemePlanCode");
            dtReturnTransaction.Columns.Add("SchemePlanName");
            dtReturnTransaction.Columns.Add("FolioNum");
            dtReturnTransaction.Columns.Add("CustomerName");
            dtReturnTransaction.Columns.Add("CustomerId");
            dtReturnTransaction.Columns.Add("PortfolioName");
            dtReturnTransaction.Columns.Add("PortfolioId");

            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32 portfoliioId = 0;
                    portfoliioId = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.FromDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                DataRow drReturnTransaction = dtReturnTransaction.NewRow();
                                drReturnTransaction["TransactionType"] = mFPortfolioTransaction.TransactionType;
                                drReturnTransaction["Units"]           = mFPortfolioTransaction.BuyQuantity; //
                                drReturnTransaction["PurchaseDate"]    = mFPortfolioTransaction.BuyDate;
                                drReturnTransaction["PurchasePrice"]   = mFPortfolioTransaction.BuyPrice;
                                drReturnTransaction["PurchaseCost"]    = mFPortfolioTransaction.CostOfAcquisition; //
                                drReturnTransaction["SellDate"]        = mFPortfolioTransaction.SellDate;
                                drReturnTransaction["SellPrice"]       = mFPortfolioTransaction.SellPrice;
                                drReturnTransaction["SaleProceed"]     = mFPortfolioTransaction.RealizedSalesValue;
                                drReturnTransaction["AsonDateNAV"]     = mFPortfolioTransaction.CurrentNAV;//
                                drReturnTransaction["AsOnDateValue"]   = mFPortfolioTransaction.CurrentValue;
                                drReturnTransaction["AgeOfInvestment"] = mFPortfolioTransaction.AgeOfInvestment;
                                drReturnTransaction["ActualPL"]        = mFPortfolioTransaction.RealizedProfitLoss;
                                drReturnTransaction["NotionalPL"]      = mFPortfolioTransaction.NotionalProfitLoss;
                                drReturnTransaction["TotalPL"]         = mFPortfolioTransaction.TotalProfitLoss;
                                drReturnTransaction["AbsoluteReturn"]  = mFPortfolioTransaction.AbsoluteReturns;
                                drReturnTransaction["AnnualReturn"]    = mFPortfolioTransaction.AnnualReturns;


                                drReturnTransaction["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                drReturnTransaction["SchemePlanName"] = mFPortfolioVo.SchemePlan;
                                drReturnTransaction["FolioNum"]       = mFPortfolioVo.Folio;
                                drReturnTransaction["CustomerName"]   = drPortfolioCustomer["C_FirstName"].ToString();
                                drReturnTransaction["CustomerId"]     = mFPortfolioVo.CustomerId;
                                if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                {
                                    drReturnTransaction["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                }
                                drReturnTransaction["PortfolioId"] = portfoliioId;
                                dtReturnTransaction.Rows.Add(drReturnTransaction);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtReturnTransaction);
        }