Beispiel #1
0
    protected void findRoutingButton_Click(object sender, EventArgs e)
    {
        string    bankInfo         = "";
        DataTable dtBankBracnhInfo = regBLObj.dtGetBankBracnhInfo(RoutingNoTextBox.Text.Trim().ToString());

        if (dtBankBracnhInfo.Rows.Count > 0)
        {
            bankInfo             = bankInfo + reportObj.getBankNameByBankCode(Convert.ToInt32(dtBankBracnhInfo.Rows[0]["BANK_CODE"].ToString())).ToString();
            bankInfo             = bankInfo + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtBankBracnhInfo.Rows[0]["BANK_CODE"].ToString()), Convert.ToInt32(dtBankBracnhInfo.Rows[0]["BRANCH_CODE"].ToString())).ToString() + " BRANCH ";
            BankInfoTextBox.Text = bankInfo.ToString();
        }
        else
        {
            BankInfoTextBox.Text = "";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Bank Information Found');", true);
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string fundCode   = "";
        string branchCode = "";

        if (BaseContent.IsSessionExpired())
        {
            Response.Redirect("../../Default.aspx");
            return;
        }
        bcContent = (BaseClass)Session["BCContent"];

        userObj.UserID = bcContent.LoginID.ToString();
        CDSStatus      = bcContent.CDS.ToString().ToUpper();
        branchCode     = (string)Session["branchCode"];
        fundCode       = (string)Session["fundCode"];


        DataTable dtReport = reportObj.getDtForReportStatement();

        dtReport.TableName = "ReportSaleStatement";
        DataRow drReport;

        DataTable dtReportStatement = (DataTable)Session["dtReportStatement"];

        if (dtReportStatement.Rows.Count > 0)
        {
            int saleNo = 0;


            for (int looper = 0; looper < dtReportStatement.Rows.Count; looper++)
            {
                drReport            = dtReport.NewRow();
                drReport["SL_NO"]   = Convert.ToInt32(dtReportStatement.Rows[looper]["SL_NO"].ToString());
                drReport["SL_DT"]   = dtReportStatement.Rows[looper]["SL_DT"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["SL_DT"].ToString();
                drReport["SL_TYPE"] = dtReportStatement.Rows[looper]["SL_TYPE"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["SL_TYPE"].ToString();
                drReport["HNAME"]   = dtReportStatement.Rows[looper]["HNAME"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["HNAME"].ToString();
                drReport["MOBILE1"] = dtReportStatement.Rows[looper]["MOBILE1"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["MOBILE1"].ToString();

                drReport["NID"]          = dtReportStatement.Rows[looper]["NID"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["NID"].ToString();
                drReport["MONY_RECT_NO"] = dtReportStatement.Rows[looper]["MONY_RECT_NO"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["MONY_RECT_NO"].ToString();

                drReport["TIN"] = dtReportStatement.Rows[looper]["TIN"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["TIN"].ToString();
                if (!dtReportStatement.Rows[looper]["REG_TYPE"].Equals(DBNull.Value))
                {
                    drReport["REG_TYPE"] = reportObj.getRegTypeFullName(dtReportStatement.Rows[looper]["REG_TYPE"].ToString()).ToString();
                }
                drReport["JNT_NAME"] = dtReportStatement.Rows[looper]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["JNT_NAME"].ToString();
                drReport["ADDRS1"]   = dtReportStatement.Rows[looper]["ADDRS1"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ADDRS1"].ToString();
                drReport["ADDRS2"]   = dtReportStatement.Rows[looper]["ADDRS2"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ADDRS2"].ToString();
                drReport["CITY"]     = dtReportStatement.Rows[looper]["CITY"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CITY"].ToString();
                drReport["REG_NO"]   = dtReportStatement.Rows[looper]["REG_NO"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["REG_NO"].ToString();

                DataTable dtNominee = reportObj.dtNominee(dtReportStatement.Rows[looper]["REG_BK"].ToString(), dtReportStatement.Rows[looper]["REG_BR"].ToString(), Convert.ToInt32(dtReportStatement.Rows[looper]["RG_NO"].ToString()));
                if (dtNominee.Rows.Count > 0)
                {
                    for (int loop = 0; loop < dtNominee.Rows.Count; loop++)
                    {
                        if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 1)
                        {
                            drReport["NOMI1_NAME"] = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                        }
                        else if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 2)
                        {
                            drReport["NOMI2_NAME"] = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                        }
                    }
                }

                if (CDSStatus.ToString() == "Y")
                {
                    drReport["DRF_REF_NO"]          = dtReportStatement.Rows[looper]["DRF_REF_NO"];
                    drReport["DRF_REG_FOLIO_NO"]    = dtReportStatement.Rows[looper]["DRF_REG_FOLIO_NO"];
                    drReport["DRF_CERT_NO"]         = dtReportStatement.Rows[looper]["DRF_CERT_NO"];
                    drReport["DRF_DISTNCT_NO_FROM"] = dtReportStatement.Rows[looper]["DRF_DISTNCT_NO_FROM"];
                    drReport["DRF_DISTNCT_NO_TO"]   = dtReportStatement.Rows[looper]["DRF_DISTNCT_NO_TO"];
                    drReport["DRF_CUST_REQ_DATE"]   = dtReportStatement.Rows[looper]["DRF_CUST_REQ_DATE"];
                    drReport["DRF_ACCEPT_NO"]       = dtReportStatement.Rows[looper]["DRF_ACCEPT_NO"];
                    drReport["DRF_DRN"]             = dtReportStatement.Rows[looper]["DRF_DRN"];
                    drReport["DRF_ACCEPT_DATE"]     = dtReportStatement.Rows[looper]["DRF_ACCEPT_DATE"];
                    drReport["DRF_TR_SEQ_NO"]       = dtReportStatement.Rows[looper]["DRF_TR_SEQ_NO"];
                    drReport["DRF_TR_DATE"]         = dtReportStatement.Rows[looper]["DRF_TR_DATE"];
                    drReport["BO"] = dtReportStatement.Rows[looper]["HOLDER_BO"];
                }
                else
                {
                    saleNo = Convert.ToInt32(dtReportStatement.Rows[looper]["SL_NO"].ToString());
                    drReport["CERT_DLVRY_DT"] = dtReportStatement.Rows[looper]["CERT_DLVRY_DT"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CERT_DLVRY_DT"].ToString();
                    drReport["CERT_RCV_BY"]   = dtReportStatement.Rows[looper]["CERT_RCV_BY"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CERT_RCV_BY"].ToString();
                    drReport["CERT_NO"]       = reportObj.getTotalCertNo("SELECT  NVL(CERT_TYPE,' ') AS CERT_TYPE, NVL(CERT_NO,0) AS CERT_NO FROM SALE_CERT WHERE SL_NO=" + saleNo + " AND REG_BK='" + fundCode.ToString() + "'AND REG_BR='" + branchCode.ToString() + "'  ORDER BY CERT_TYPE ", fundCode.ToString()).ToString();
                }


                if (!dtReportStatement.Rows[looper]["BK_FLAG"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtReportStatement.Rows[looper]["BK_FLAG"].ToString(), "Y", true) == 0)
                    {
                        if (!dtReportStatement.Rows[looper]["BK_NM_CD"].Equals(DBNull.Value) && !dtReportStatement.Rows[looper]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtReportStatement.Rows[looper]["BK_AC_NO"].Equals(DBNull.Value))
                        {
                            drReport["BK_AC_NO"]       = dtReportStatement.Rows[looper]["BK_AC_NO"].ToString();
                            drReport["BANK_NAME"]      = reportObj.getBankNameByBankCode(Convert.ToInt16(dtReportStatement.Rows[looper]["BK_NM_CD"].ToString())).ToString();
                            drReport["BRANCH_NAME"]    = reportObj.getBankBranchNameByCode(Convert.ToInt16(dtReportStatement.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtReportStatement.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                            drReport["BRANCH_ADDRESS"] = reportObj.getBankBranchAddressByCode(Convert.ToInt16(dtReportStatement.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtReportStatement.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                        }
                        else
                        {
                        }
                    }
                }
                drReport["CIP"]    = dtReportStatement.Rows[looper]["CIP"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CIP"].ToString();
                drReport["ID_AC"]  = dtReportStatement.Rows[looper]["ID_AC"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ID_AC"].ToString();
                drReport["QTY"]    = Convert.ToInt32(dtReportStatement.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0": dtReportStatement.Rows[looper]["QTY"].ToString());
                drReport["RATE"]   = decimal.Parse(dtReportStatement.Rows[looper]["RATE"].Equals(DBNull.Value) ? "0" : dtReportStatement.Rows[looper]["RATE"].ToString());
                drReport["AMOUNT"] = decimal.Parse(dtReportStatement.Rows[looper]["AMOUNT"].Equals(DBNull.Value) ? "0" : dtReportStatement.Rows[looper]["AMOUNT"].ToString());


                dtReport.Rows.Add(drReport);
            }


            //dtReport.WriteXmlSchema(@"F:\GITHUB_AMCL\DOTNET2015\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\dtUnitReportForStatement.xsd");
            if (CDSStatus.ToString() == "Y")
            {
                sale_Statement_CDS.Refresh();
                sale_Statement_CDS.SetDataSource(dtReport);

                sale_Statement_CDS.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString()));
                sale_Statement_CDS.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCode.ToString()).ToString());
                sale_Statement_CDS.SetParameterValue("branchCode", branchCode.ToString());

                CrystalReportViewer1.ReportSource = sale_Statement_CDS;
            }
            else
            {
                sale_Statement.Refresh();
                sale_Statement.SetDataSource(dtReport);

                sale_Statement.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString()));
                sale_Statement.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCode.ToString()).ToString());
                sale_Statement.SetParameterValue("branchCode", branchCode.ToString());

                CrystalReportViewer1.ReportSource = sale_Statement;
            }
        }
        else
        {
            Response.Write("No data found");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string fundCodeStatement   = "";
        string branchCodeStatement = "";

        if (BaseContent.IsSessionExpired())
        {
            Response.Redirect("../../Default.aspx");
            return;
        }
        bcContent = (BaseClass)Session["BCContent"];

        userObj.UserID      = bcContent.LoginID.ToString();
        branchCodeStatement = (string)Session["branchCodeStatement"];
        fundCodeStatement   = (string)Session["fundCodeStatement"];



        DataTable dtUnitHolderInfo = reportObj.getDtHolderInfo();

        dtUnitHolderInfo.TableName = "UnitHolderStatementAfterClosing";
        DataRow drUnitHolderInfo;

        DataTable dtHolderInfo = (DataTable)Session["dtStatementAfterClosing"];

        if (dtHolderInfo.Rows.Count > 0)
        {
            for (int looper = 0; looper < dtHolderInfo.Rows.Count; looper++)
            {
                drUnitHolderInfo           = dtUnitHolderInfo.NewRow();
                drUnitHolderInfo["REG_NO"] = dtHolderInfo.Rows[looper]["REGI_NUMBER"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["REGI_NUMBER"].ToString();


                drUnitHolderInfo["HNAME"]       = dtHolderInfo.Rows[looper]["HNAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["HNAME"].ToString();
                drUnitHolderInfo["REG_BR_NAME"] = dtHolderInfo.Rows[looper]["REG_BR"].Equals(DBNull.Value) ? "" : opendMFDAO.GetBranchName(dtHolderInfo.Rows[looper]["REG_BR"].ToString());

                drUnitHolderInfo["BEFTN"] = dtHolderInfo.Rows[looper]["BEFTN"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BEFTN"].ToString();

                drUnitHolderInfo["ADDRS1"]        = dtHolderInfo.Rows[looper]["ADDRS1"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ADDRS1"].ToString();
                drUnitHolderInfo["ADDRS2"]        = dtHolderInfo.Rows[looper]["ADDRS2"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ADDRS2"].ToString();
                drUnitHolderInfo["CITY"]          = dtHolderInfo.Rows[looper]["CITY"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["CITY"].ToString();
                drUnitHolderInfo["TIN"]           = dtHolderInfo.Rows[looper]["TIN"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["TIN"].ToString();
                drUnitHolderInfo["PASS_NO"]       = dtHolderInfo.Rows[looper]["PASS_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BEFTN"].ToString();
                drUnitHolderInfo["BIRTH_CERT_NO"] = dtHolderInfo.Rows[looper]["BIRTH_CERT_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BEFTN"].ToString();
                drUnitHolderInfo["BIRTH_CERT_NO"] = dtHolderInfo.Rows[looper]["BIRTH_CERT_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BEFTN"].ToString();
                drUnitHolderInfo["NID"]           = dtHolderInfo.Rows[looper]["NID"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["NID"].ToString();
                drUnitHolderInfo["BALANCE"]       = Convert.ToInt32(dtHolderInfo.Rows[looper]["BALANCE"].Equals(DBNull.Value) ? "0" : dtHolderInfo.Rows[looper]["BALANCE"].ToString());

                drUnitHolderInfo["JNT_NAME"] = dtHolderInfo.Rows[looper]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_NAME"].ToString();


                drUnitHolderInfo["CIP"] = dtHolderInfo.Rows[looper]["CIP"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["CIP"].ToString();

                if (!dtHolderInfo.Rows[looper]["CIP"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["CIP"].ToString(), "Y", true) == 0)
                    {
                        drUnitHolderInfo["CIP"] = "YES";
                    }
                    else if (string.Compare(dtHolderInfo.Rows[looper]["CIP"].ToString(), "N", true) == 0)
                    {
                        drUnitHolderInfo["CIP"] = "NO";
                    }
                }


                if (!dtHolderInfo.Rows[looper]["ID_FLAG"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["ID_FLAG"].ToString(), "Y", true) == 0)
                    {
                        drUnitHolderInfo["ID_FLAG"]                   = "YES";
                        drUnitHolderInfo["ID_AC"]                     = dtHolderInfo.Rows[looper]["ID_AC"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ID_AC"].ToString();
                        drUnitHolderInfo["ID_INTSTITUTE_NAME"]        = dtHolderInfo.Rows[looper]["BANK_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BANK_NAME"].ToString();
                        drUnitHolderInfo["ID_INTSTITUTE_BRANCH_NAME"] = dtHolderInfo.Rows[looper]["BRANCH_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["BRANCH_NAME"].ToString();
                    }
                    else if (string.Compare(dtHolderInfo.Rows[looper]["ID_FLAG"].ToString(), "N", true) == 0)
                    {
                        drUnitHolderInfo["ID_FLAG"] = "NO";
                    }
                }



                if (!dtHolderInfo.Rows[looper]["BK_FLAG"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["BK_FLAG"].ToString(), "Y", true) == 0)
                    {
                        if (!dtHolderInfo.Rows[looper]["BK_NM_CD"].Equals(DBNull.Value) && !dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtHolderInfo.Rows[looper]["BK_AC_NO"].Equals(DBNull.Value))
                        {
                            drUnitHolderInfo["BK_AC_NO"]       = dtHolderInfo.Rows[looper]["BK_AC_NO"].ToString();
                            drUnitHolderInfo["BANK_NAME"]      = reportObj.getBankNameByBankCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString())).ToString();
                            drUnitHolderInfo["BRANCH_NAME"]    = reportObj.getBankBranchNameByCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                            drUnitHolderInfo["BRANCH_ADDRESS"] = reportObj.getBankBranchAddressByCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                        }
                        else
                        {
                            string   branchAddress   = "";
                            string   BankAccInfo     = dtHolderInfo.Rows[looper]["SPEC_IN1"].ToString() + dtHolderInfo.Rows[looper]["SPEC_IN2"].ToString();
                            string[] BankAccountInfo = BankAccInfo.Split(',');
                            if (BankAccountInfo.Length > 0)
                            {
                                drUnitHolderInfo["BK_AC_NO"] = BankAccountInfo[0].ToString();
                                if (BankAccountInfo.Length > 1)
                                {
                                    drUnitHolderInfo["BANK_NAME"] = BankAccountInfo[1].ToString();
                                }
                                if (BankAccountInfo.Length > 2)
                                {
                                    drUnitHolderInfo["BRANCH_NAME"] = BankAccountInfo[2].ToString();
                                }
                                if (BankAccountInfo.Length > 3)
                                {
                                    for (int loop = 3; loop < BankAccountInfo.Length; loop++)
                                    {
                                        branchAddress = branchAddress + BankAccountInfo[loop].ToString();
                                    }
                                    drUnitHolderInfo["BRANCH_ADDRESS"] = branchAddress;
                                }
                            }
                        }
                    }
                }


                DataTable dtNominee = reportObj.dtNominee(dtHolderInfo.Rows[looper]["REG_BK"].ToString(), dtHolderInfo.Rows[looper]["REG_BR"].ToString(), Convert.ToInt32(dtHolderInfo.Rows[looper]["REG_NO"].ToString()));
                if (dtNominee.Rows.Count > 0)
                {
                    for (int loop = 0; loop < dtNominee.Rows.Count; loop++)
                    {
                        if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 1)
                        {
                            drUnitHolderInfo["NOMI1_NAME"] = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                        }
                        else if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 2)
                        {
                            drUnitHolderInfo["NOMI2_NAME"] = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                        }
                    }
                }
                dtUnitHolderInfo.Rows.Add(drUnitHolderInfo);
            }

            //dtUnitHolderInfo.WriteXmlSchema(@"F:\GITHUB_AMCL\DOTNET2008\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\dtUnitHolderStatementAfterClosing.xsd");


            CR_StatementAfterClosing.Refresh();
            CR_StatementAfterClosing.SetDataSource(dtUnitHolderInfo);

            CR_StatementAfterClosing.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCodeStatement.ToString()));
            CR_StatementAfterClosing.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCodeStatement.ToString()));
            CrystalReportViewer1.ReportSource = CR_StatementAfterClosing;
            //CR_StatementAfterClosing.Close();
            //CR_StatementAfterClosing.Dispose();
        }
        else
        {
            Response.Write("No data found");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null)
        {
            Session.RemoveAll();
            Response.Redirect("../../Default.aspx");
        }
        string regNo          = "";
        string fundCode       = "";
        string branchCode     = "";
        string unitHolderName = "";
        string branchName     = "";
        string fundName       = "";

        if (Request.QueryString["reg"] != null)
        {
            regNo = Request.QueryString["reg"].ToString();
        }
        if (Request.QueryString["fund"] != null)
        {
            fundName = omfDAOObj.GetFundName(Request.QueryString["fund"].ToString());
            fundCode = Request.QueryString["fund"].ToString();
        }
        if (Request.QueryString["branch"] != null)
        {
            branchName = omfDAOObj.GetBranchName(Request.QueryString["branch"].ToString());
            branchCode = Request.QueryString["branch"].ToString();
        }
        if (regNo != "" && fundCode != "" && branchCode != "")
        {
            unitHolderName    = omfDAOObj.GetHolderName(fundCode, branchCode, regNo);
            regObj.RegNumber  = regNo;
            regObj.FundCode   = fundCode.ToString();
            regObj.BranchCode = branchCode.ToString();
        }
        tdBranch.InnerHtml     = "<span style=\"color:Green\"><b>" + unitLienBLObj.totalLienAmount(regObj).ToString() + "</b></span>";
        tdFund.InnerHtml       = "<span style=\"color:Green\"><b>" + fundName.ToString() + "</b></span>";
        tdHolderName.InnerHtml = "<span style=\"color:Green\"><b>" + unitHolderName.ToString() + "</b></span>";
        tdReg.InnerHtml        = "<span style=\"color:Green\"><b>" + fundCode.ToString() + "/" + branchCode.ToString() + "/" + regNo.ToString() + "</b></span>";
        StringBuilder sbInnerString     = new StringBuilder();
        DataTable     dtLienDetails     = unitLienBLObj.dtLienDetailsCertificate(regObj);
        DataTable     dtLienBankDetails = new DataTable();

        if (dtLienDetails.Rows.Count > 0)
        {
            sbInnerString.Append("<table width=\"800\" align=\"center\">");

            sbInnerString.Append("<colgroup width=\"120\"></colgroup>");
            sbInnerString.Append("<colgroup width=\"120\"></colgroup>");
            sbInnerString.Append("<colgroup width=\"120\"></colgroup>");
            sbInnerString.Append("<colgroup width=\"120\"></colgroup>");
            sbInnerString.Append("<tr>");
            sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b> LIEN NUMBER </b></span></td>");
            // sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b> LIEN DATE </b></span></td>");
            sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b> TRANSACTION NUMBER</b></span></td>");
            sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b> CERTIFICATE </b></span></td>");
            sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b>WEIGHT </b></span></td>");
            sbInnerString.Append("<td <span style=\"color:Green;border:1px solid; text-align:center;\"><b>LIEN INSTITUTION </b></span></td>");
            sbInnerString.Append("</tr>");

            for (int looper = 0; looper < dtLienDetails.Rows.Count; looper++)
            {
                unitLienObj        = new UnitLien();
                unitLienObj.LienNo = Convert.ToInt32(dtLienDetails.Rows[looper]["LIEN_NO"].ToString());
                dtLienBankDetails  = unitLienBLObj.dtLienDetailsInfo(regObj, unitLienObj);
                sbInnerString.Append("<tr>");
                sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b>" + dtLienDetails.Rows[looper]["LIEN_NO"].ToString() + " </b></td>");
                //sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b>" + dtLienDetails.Rows[looper]["LN_REQ_DT"].ToString() + " </b></td>");
                sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b> " + dtLienDetails.Rows[looper]["SL_TR_NO"].ToString() + "</b></td>");
                sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b>" + dtLienDetails.Rows[looper]["CERTIFICATE"].ToString() + " </b></td>");
                sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b>" + dtLienDetails.Rows[looper]["QTY"].ToString() + " </b></td>");
                sbInnerString.Append("<td style=\"border:1px solid; text-align:center;\"><b>" + reportObj.getBankNameByBankCode(Convert.ToInt16(dtLienBankDetails.Rows[0]["LN_BK_CODE"].ToString())) + "," + reportObj.getBankBranchNameByCode(Convert.ToInt16(dtLienBankDetails.Rows[0]["LN_BK_CODE"].ToString()), Convert.ToInt16(dtLienBankDetails.Rows[0]["LN_BK_BR_CODE"].ToString())) + " </b></td>");
                sbInnerString.Append("</tr>");
            }

            sbInnerString.Append("</table>");
            tdLeinDetails.InnerHtml = sbInnerString.ToString();
        }
    }
    public void displayRegInfo(UnitHolderRegistration unitRegObj)
    {
        dvLedger.Visible = true;

        unitRegObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
        unitRegObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();
        DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtNominee = opendMFDAO.dtNomineeRegInfo(unitRegObj);


        if (dtRegInfo.Rows.Count > 0)
        {
            //Trasaction Lock Status

            if (!(dtRegInfo.Rows[0]["ALL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["SL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REP_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["TR_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LIEN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value)))
            {
                dvLockin.Attributes.Add("style", "visibility:visible");
                if (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "Y")
                {
                    SaleLockLabel.Text      = "YES";
                    RepLockLabel.Text       = "YES";
                    TransferLockLabel.Text  = "YES";
                    LienLockLabel.Text      = "YES";
                    RenLockLabel.Text       = "YES";
                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
                else
                {
                    if (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "Y")
                    {
                        SaleLockLabel.Text = "YES";
                    }
                    else
                    {
                        SaleLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "Y")
                    {
                        RepLockLabel.Text = "YES";
                    }
                    else
                    {
                        RepLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "Y")
                    {
                        TransferLockLabel.Text = "YES";
                    }
                    else
                    {
                        TransferLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "Y")
                    {
                        LienLockLabel.Text = "YES";
                    }
                    else
                    {
                        LienLockLabel.Text = "NO";
                    }

                    if (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "Y")
                    {
                        RenLockLabel.Text = "YES";
                    }
                    else
                    {
                        RenLockLabel.Text = "NO";
                    }



                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
            }
            else
            {
                SaleLockLabel.Text     = "NO";
                RepLockLabel.Text      = "NO";
                TransferLockLabel.Text = "NO";
                LienLockLabel.Text     = "NO";
                RenLockLabel.Text      = "NO";
                dvLockin.Attributes.Add("style", "visibility:hidden");
            }
            regNoTextBox.Text          = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text       = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();
            folioTextBox.Text          = dtRegInfo.Rows[0]["FOLIO_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["FOLIO_NO"].ToString();
            holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
            tdTIN.InnerHtml            = dtRegInfo.Rows[0]["TIN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TIN"].ToString();
            string CIP   = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
            string BEFTN = dtRegInfo.Rows[0]["IS_BEFTN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["IS_BEFTN"].ToString();
            if (string.Compare(CIP, "Y", true) == 0)
            {
                tdCIP.InnerHtml = "YES";
            }
            else if (string.Compare(CIP, "N", true) == 0)
            {
                tdCIP.InnerHtml = "NO";
            }
            else
            {
                tdCIP.InnerHtml = " ";
            }
            if (string.Compare(BEFTN, "Y", true) == 0)
            {
                tdBEFTN.InnerHtml = "YES";
            }
            else
            {
                tdBEFTN.InnerHtml = "NO";
            }
            if (dtNominee.Rows.Count > 1)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = dtNominee.Rows[1]["NOMI_NAME"].ToString();
            }
            else if (dtNominee.Rows.Count > 0)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = "";
            }
            else
            {
                Nominee1NameTextBox.Text = "";
                Nominee2NameTextBox.Text = "";
            }
            RemarksTextBox.Text = dtRegInfo.Rows[0]["REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REMARKS"].ToString();
            if (dtRegInfo.Rows[0]["BK_FLAG"].ToString() == "Y")
            {
                string bankInfo = "";
                if (!dtRegInfo.Rows[0]["BK_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_AC_NO"].Equals(DBNull.Value))
                {
                    bankInfo = "AC:" + dtRegInfo.Rows[0]["BK_AC_NO"].ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankNameByBankCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString())).ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString())).ToString();

                    DataTable dtBankBracnhInfo = unitHolderRegBLObj.dtGetBankBracnhInfo(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString()));
                    if (dtBankBracnhInfo.Rows.Count > 0)
                    {
                        bankInfo = bankInfo + " Routing No=[" + dtBankBracnhInfo.Rows[0]["ROUTING_NO"].ToString() + "] " + dtBankBracnhInfo.Rows[0]["ADDRESS"].ToString() + " ";
                    }
                }
                BankInfoTextBox.Text = bankInfo.ToString();
            }
            else
            {
                BankInfoTextBox.Text = "";
            }

            DataTable dtDividendLedger = getDividendLedger(unitRegObj);
            //  int balance = 0;
            if (dtDividendLedger.Rows.Count > 0)
            {
                dgLedger.DataSource = dtDividendLedger;
                dgLedger.DataBind();
                totalRowCountLabel.Text     = dtDividendLedger.Rows.Count.ToString();
                Session["dtDividendLedger"] = dtDividendLedger;
                displaySign();
            }
            else
            {
                ClearText();
                SignImage.ImageUrl          = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
                dvLedger.Visible            = false;
                Session["dtDividendLedger"] = null;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Ledger Balance Data Found');", true);
            }
        }

        else
        {
            SignImage.ImageUrl          = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
            dvLedger.Visible            = false;
            Session["dtDividendLedger"] = null;
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", " window.fnResetAll();", true);
            tdCIP.InnerHtml = "";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string fundCode   = "";
        string branchCode = "";

        if (BaseContent.IsSessionExpired())
        {
            Response.Redirect("../../Default.aspx");
            return;
        }
        bcContent = (BaseClass)Session["BCContent"];

        userObj.UserID = bcContent.LoginID.ToString();
        branchCode     = (string)Session["branchCode"];
        fundCode       = (string)Session["fundCode"];


        DataTable dtUnitHolderInfo = reportObj.getDtHolderInfo();

        dtUnitHolderInfo.TableName = "UnitHolderInfo";
        DataRow drUnitHolderInfo;

        DataTable dtHolderInfo = (DataTable)Session["dtHolderInfo"];

        if (dtHolderInfo.Rows.Count > 0)
        {
            for (int looper = 0; looper < dtHolderInfo.Rows.Count; looper++)
            {
                drUnitHolderInfo           = dtUnitHolderInfo.NewRow();
                drUnitHolderInfo["REG_NO"] = dtHolderInfo.Rows[looper]["REG_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["REG_NO"].ToString();
                drUnitHolderInfo["REG_DT"] = dtHolderInfo.Rows[looper]["REG_DT"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["REG_DT"].ToString();

                if (!dtHolderInfo.Rows[looper]["REG_TYPE"].Equals(DBNull.Value))
                {
                    drUnitHolderInfo["REG_TYPE"] = reportObj.getRegTypeFullName(dtHolderInfo.Rows[looper]["REG_TYPE"].ToString()).ToString();
                }

                drUnitHolderInfo["HNAME"]       = dtHolderInfo.Rows[looper]["HNAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["HNAME"].ToString();
                drUnitHolderInfo["FMH_NAME"]    = dtHolderInfo.Rows[looper]["FMH_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["FMH_NAME"].ToString();
                drUnitHolderInfo["MO_NAME"]     = dtHolderInfo.Rows[looper]["MO_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["MO_NAME"].ToString();
                drUnitHolderInfo["ADDRS1"]      = dtHolderInfo.Rows[looper]["ADDRS1"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ADDRS1"].ToString();
                drUnitHolderInfo["ADDRS2"]      = dtHolderInfo.Rows[looper]["ADDRS2"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ADDRS2"].ToString();
                drUnitHolderInfo["CITY"]        = dtHolderInfo.Rows[looper]["CITY"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["CITY"].ToString();
                drUnitHolderInfo["NATIONALITY"] = dtHolderInfo.Rows[looper]["NATIONALITY"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["NATIONALITY"].ToString();
                drUnitHolderInfo["OCC_CODE"]    = dtHolderInfo.Rows[looper]["OCC_CODE"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["OCC_CODE"].ToString();
                drUnitHolderInfo["B_DATE"]      = dtHolderInfo.Rows[looper]["B_DATE"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["B_DATE"].ToString();

                if (!dtHolderInfo.Rows[looper]["SEX"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["SEX"].ToString(), "M", true) == 0)
                    {
                        drUnitHolderInfo["SEX"] = "MAlE";
                    }
                    else if (string.Compare(dtHolderInfo.Rows[looper]["SEX"].ToString(), "F", true) == 0)
                    {
                        drUnitHolderInfo["SEX"] = "FEMALE";
                    }
                }


                if (!dtHolderInfo.Rows[looper]["MAR_STAT"].Equals(DBNull.Value))
                {
                    drUnitHolderInfo["MAR_STAT"] = reportObj.getMaritialFullName(dtHolderInfo.Rows[looper]["MAR_STAT"].ToString()).ToString();
                }

                if (!dtHolderInfo.Rows[looper]["RELIGION"].Equals(DBNull.Value))
                {
                    drUnitHolderInfo["RELIGION"] = reportObj.getReligionFullName(dtHolderInfo.Rows[looper]["RELIGION"].ToString()).ToString();
                }


                drUnitHolderInfo["EDU_QUA"] = dtHolderInfo.Rows[looper]["EDU_QUA"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["EDU_QUA"].ToString();
                drUnitHolderInfo["TEL_NO"]  = dtHolderInfo.Rows[looper]["TEL_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["TEL_NO"].ToString();
                drUnitHolderInfo["EMAIL"]   = dtHolderInfo.Rows[looper]["EMAIL"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["EMAIL"].ToString();

                drUnitHolderInfo["JNT_NAME"]        = dtHolderInfo.Rows[looper]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_NAME"].ToString();
                drUnitHolderInfo["JNT_FMH_NAME"]    = dtHolderInfo.Rows[looper]["JNT_FMH_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_FMH_NAME"].ToString();
                drUnitHolderInfo["JNT_MO_NAME"]     = dtHolderInfo.Rows[looper]["JNT_MO_NAME"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_MO_NAME"].ToString();
                drUnitHolderInfo["JNT_OCC_CODE"]    = dtHolderInfo.Rows[looper]["JNT_OCC_CODE"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_OCC_CODE"].ToString();
                drUnitHolderInfo["JNT_ADDRS1"]      = dtHolderInfo.Rows[looper]["JNT_ADDRS1"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_ADDRS1"].ToString();
                drUnitHolderInfo["JNT_ADDRS2"]      = dtHolderInfo.Rows[looper]["JNT_ADDRS2"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_ADDRS2"].ToString();
                drUnitHolderInfo["JNT_NATIONALITY"] = dtHolderInfo.Rows[looper]["JNT_NATIONALITY"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_NATIONALITY"].ToString();
                drUnitHolderInfo["JNT_CITY"]        = dtHolderInfo.Rows[looper]["JNT_CITY"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_CITY"].ToString();
                drUnitHolderInfo["JNT_TEL_NO"]      = dtHolderInfo.Rows[looper]["JNT_TEL_NO"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_TEL_NO"].ToString();
                drUnitHolderInfo["JNT_FMH_REL"]     = dtHolderInfo.Rows[looper]["JNT_FMH_REL"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["JNT_FMH_REL"].ToString();

                drUnitHolderInfo["CIP"] = dtHolderInfo.Rows[looper]["CIP"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["CIP"].ToString();

                if (!dtHolderInfo.Rows[looper]["CIP"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["CIP"].ToString(), "Y", true) == 0)
                    {
                        drUnitHolderInfo["CIP"] = "YES";
                    }
                    else if (string.Compare(dtHolderInfo.Rows[looper]["CIP"].ToString(), "N", true) == 0)
                    {
                        drUnitHolderInfo["CIP"] = "NO";
                    }
                }


                if (!dtHolderInfo.Rows[looper]["ID_FLAG"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["ID_FLAG"].ToString(), "Y", true) == 0)
                    {
                        drUnitHolderInfo["ID_FLAG"]                   = "YES";
                        drUnitHolderInfo["ID_AC"]                     = dtHolderInfo.Rows[looper]["ID_AC"].Equals(DBNull.Value) ? "" : dtHolderInfo.Rows[looper]["ID_AC"].ToString();
                        drUnitHolderInfo["ID_INTSTITUTE_NAME"]        = reportObj.getBankNameByBankCode(Convert.ToInt16(dtHolderInfo.Rows[0]["ID_BK_NM_CD"].Equals(DBNull.Value) ? "0" : dtHolderInfo.Rows[0]["ID_BK_NM_CD"].ToString())).ToString();
                        drUnitHolderInfo["ID_INTSTITUTE_BRANCH_NAME"] = reportObj.getBankBranchNameByCode(Convert.ToInt16(dtHolderInfo.Rows[0]["ID_BK_NM_CD"].Equals(DBNull.Value) ? "0" : dtHolderInfo.Rows[0]["ID_BK_NM_CD"].ToString()), Convert.ToInt16(dtHolderInfo.Rows[0]["ID_BK_BR_NM_CD"].Equals(DBNull.Value) ? "0" : dtHolderInfo.Rows[0]["ID_BK_BR_NM_CD"].ToString())).ToString();
                    }
                    else if (string.Compare(dtHolderInfo.Rows[looper]["ID_FLAG"].ToString(), "N", true) == 0)
                    {
                        drUnitHolderInfo["ID_FLAG"] = "NO";
                    }
                }



                if (!dtHolderInfo.Rows[looper]["BK_FLAG"].Equals(DBNull.Value))
                {
                    if (string.Compare(dtHolderInfo.Rows[looper]["BK_FLAG"].ToString(), "Y", true) == 0)
                    {
                        if (!dtHolderInfo.Rows[looper]["BK_NM_CD"].Equals(DBNull.Value) && !dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtHolderInfo.Rows[looper]["BK_AC_NO"].Equals(DBNull.Value))
                        {
                            drUnitHolderInfo["BK_AC_NO"]       = dtHolderInfo.Rows[looper]["BK_AC_NO"].ToString();
                            drUnitHolderInfo["BANK_NAME"]      = reportObj.getBankNameByBankCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString())).ToString();
                            drUnitHolderInfo["BRANCH_NAME"]    = reportObj.getBankBranchNameByCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                            drUnitHolderInfo["BRANCH_ADDRESS"] = reportObj.getBankBranchAddressByCode(Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_NM_CD"].ToString()), Convert.ToInt16(dtHolderInfo.Rows[looper]["BK_BR_NM_CD"].ToString())).ToString();
                        }
                        else
                        {
                            string   branchAddress   = "";
                            string   BankAccInfo     = dtHolderInfo.Rows[looper]["SPEC_IN1"].ToString() + dtHolderInfo.Rows[looper]["SPEC_IN2"].ToString();
                            string[] BankAccountInfo = BankAccInfo.Split(',');
                            if (BankAccountInfo.Length > 0)
                            {
                                drUnitHolderInfo["BK_AC_NO"] = BankAccountInfo[0].ToString();
                                if (BankAccountInfo.Length > 1)
                                {
                                    drUnitHolderInfo["BANK_NAME"] = BankAccountInfo[1].ToString();
                                }
                                if (BankAccountInfo.Length > 2)
                                {
                                    drUnitHolderInfo["BRANCH_NAME"] = BankAccountInfo[2].ToString();
                                }
                                if (BankAccountInfo.Length > 3)
                                {
                                    for (int loop = 3; loop < BankAccountInfo.Length; loop++)
                                    {
                                        branchAddress = branchAddress + BankAccountInfo[loop].ToString();
                                    }
                                    drUnitHolderInfo["BRANCH_ADDRESS"] = branchAddress;
                                }
                            }
                        }
                    }
                }


                DataTable dtNominee = reportObj.dtNominee(dtHolderInfo.Rows[looper]["REG_BK"].ToString(), dtHolderInfo.Rows[looper]["REG_BR"].ToString(), Convert.ToInt32(dtHolderInfo.Rows[looper]["R_NO"].ToString()));
                if (dtNominee.Rows.Count > 0)
                {
                    for (int loop = 0; loop < dtNominee.Rows.Count; loop++)
                    {
                        if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 1)
                        {
                            drUnitHolderInfo["NOMI_CTL_NO"]       = dtNominee.Rows[loop]["NOMI_CTL_NO"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_CTL_NO"].ToString();
                            drUnitHolderInfo["NOMI1_NAME"]        = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                            drUnitHolderInfo["NOMI1_FMH_NAME"]    = dtNominee.Rows[loop]["NOMI_FMH_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_FMH_NAME"].ToString();
                            drUnitHolderInfo["NOMI1_OCC_CODE"]    = dtNominee.Rows[loop]["DESCR"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["DESCR"].ToString();
                            drUnitHolderInfo["NOMI1_ADDRS1"]      = dtNominee.Rows[loop]["NOMI_ADDRS1"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_ADDRS1"].ToString();
                            drUnitHolderInfo["NOMI1_ADDRS2"]      = dtNominee.Rows[loop]["NOMI_ADDRS2"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_ADDRS2"].ToString();
                            drUnitHolderInfo["NOMI1_CITY"]        = dtNominee.Rows[loop]["NOMI_CITY"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_CITY"].ToString();
                            drUnitHolderInfo["NOMI1_NATIONALITY"] = dtNominee.Rows[loop]["NOMI_NATIONALITY"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NATIONALITY"].ToString();
                            drUnitHolderInfo["NOMI1_NOMI_REL"]    = dtNominee.Rows[loop]["NOMI_REL"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_REL"].ToString();
                            drUnitHolderInfo["NOMI1_PERCENTAGE"]  = dtNominee.Rows[loop]["PERCENTAGE"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["PERCENTAGE"].ToString();
                        }
                        else if (Convert.ToInt16(dtNominee.Rows[loop]["NOMI_NO"].ToString()) == 2)
                        {
                            drUnitHolderInfo["NOMI2_NAME"]        = dtNominee.Rows[loop]["NOMI_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NAME"].ToString();
                            drUnitHolderInfo["NOMI2_FMH_NAME"]    = dtNominee.Rows[loop]["NOMI_FMH_NAME"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_FMH_NAME"].ToString();
                            drUnitHolderInfo["NOMI2_OCC_CODE"]    = dtNominee.Rows[loop]["DESCR"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["DESCR"].ToString();
                            drUnitHolderInfo["NOMI2_ADDRS1"]      = dtNominee.Rows[loop]["NOMI_ADDRS1"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_ADDRS1"].ToString();
                            drUnitHolderInfo["NOMI2_ADDRS2"]      = dtNominee.Rows[loop]["NOMI_ADDRS2"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_ADDRS2"].ToString();
                            drUnitHolderInfo["NOMI2_CITY"]        = dtNominee.Rows[loop]["NOMI_CITY"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_CITY"].ToString();
                            drUnitHolderInfo["NOMI2_NATIONALITY"] = dtNominee.Rows[loop]["NOMI_NATIONALITY"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_NATIONALITY"].ToString();
                            drUnitHolderInfo["NOMI2_NOMI_REL"]    = dtNominee.Rows[loop]["NOMI_REL"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["NOMI_REL"].ToString();
                            drUnitHolderInfo["NOMI2_PERCENTAGE"]  = dtNominee.Rows[loop]["PERCENTAGE"].Equals(DBNull.Value) ? "" : dtNominee.Rows[loop]["PERCENTAGE"].ToString();
                        }
                    }
                }
                dtUnitHolderInfo.Rows.Add(drUnitHolderInfo);
            }

            // dtUnitHolderInfo.WriteXmlSchema(@"D:\Project\Web\AMCL.OPENMF\AMCL.Web\UI\ReportViewer\Report\dtUnitHolderInfo.xsd");


            string Path = Server.MapPath("Report/rptRegHolderInfo.rpt");
            rdoc.Load(Path);
            rdoc.SetDataSource(dtUnitHolderInfo);
            CrystalReportViewer1.ReportSource = rdoc;
            rdoc.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString()));
            rdoc = ReportFactory.GetReport(rdoc.GetType());
        }
        else
        {
            Response.Write("No data found");
        }
    }
    // AMCL.REPORT.CR_BDFInterimDividendWarrantPrint CRBDF_Inetrim_Dividend = new CR_BDFInterimDividendWarrantPrint();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (BaseContent.IsSessionExpired())
        {
            Response.Redirect("../../Default.aspx");
            return;
        }
        bcContent = (BaseClass)Session["BCContent"];

        userObj.UserID = bcContent.LoginID.ToString();
        string    fundCode         = (string)Session["fundCode"];
        DataTable dtDividend       = (DataTable)Session["dtDividend"];
        string    duplicate        = (string)Session["duplicate"];
        string    dividendCategory = (string)Session["dividendCategory"];

        if (dtDividend.Rows.Count > 0)
        {
            DataTable dtReport  = diviDAOObj.dtGetDataTableforDividend();
            decimal   taxDiduct = 0;
            DataRow   drReport;
            for (int loop = 0; loop < dtDividend.Rows.Count; loop++)
            {
                drReport             = dtReport.NewRow();
                drReport["FUND_CD"]  = dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString();
                drReport["FUND_NM"]  = dtDividend.Rows[loop]["FUND_NM"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_NM"].ToString();
                drReport["DIVI_NO"]  = Convert.ToInt32(dtDividend.Rows[loop]["DIVI_NO"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["DIVI_NO"].ToString());
                drReport["F_YEAR"]   = dtDividend.Rows[loop]["F_YEAR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["F_YEAR"].ToString();
                drReport["CLOSE_DT"] = dtDividend.Rows[loop]["CLOSE_DT"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["CLOSE_DT"].ToString();


                drReport["DIVI_RATE"]     = Convert.ToDecimal(dtDividend.Rows[loop]["DIVI_RATE"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["DIVI_RATE"].ToString());
                drReport["BK_AC_NO"]      = dtDividend.Rows[loop]["BK_AC_NO"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_AC_NO"].ToString();
                drReport["BK_AC_NO_MICR"] = dtDividend.Rows[loop]["BK_AC_NO_MICR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_AC_NO_MICR"].ToString();
                drReport["BK_NAME"]       = dtDividend.Rows[loop]["BK_NAME"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_NAME"].ToString();
                drReport["BK_ADDRS1"]     = dtDividend.Rows[loop]["BK_ADDRS1"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_ADDRS1"].ToString();

                drReport["BK_ADDRS2"]           = dtDividend.Rows[loop]["BK_ADDRS2"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_ADDRS2"].ToString();
                drReport["BK_ROUTING_NO"]       = dtDividend.Rows[loop]["BK_ROUTING_NO"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_ROUTING_NO"].ToString();
                drReport["BK_ROUTING_NO_MICR"]  = dtDividend.Rows[loop]["BK_ROUTING_NO_MICR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["BK_ROUTING_NO_MICR"].ToString();
                drReport["BK_TRANSACTION_CODE"] = Convert.ToInt16(dtDividend.Rows[loop]["BK_TRANSACTION_CODE"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["BK_TRANSACTION_CODE"].ToString());
                drReport["ISS_DT"]   = dtDividend.Rows[loop]["ISS_DT"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["ISS_DT"].ToString();
                drReport["REG_NO"]   = dtDividend.Rows[loop]["REG_NO"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_NO"].ToString();
                drReport["HNAME"]    = dtDividend.Rows[loop]["HNAME"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["HNAME"].ToString();
                drReport["JNT_NAME"] = dtDividend.Rows[loop]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["JNT_NAME"].ToString();

                drReport["ADDRS1"]      = dtDividend.Rows[loop]["ADDRS1"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["ADDRS1"].ToString();
                drReport["ADDRS2"]      = dtDividend.Rows[loop]["ADDRS2"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["ADDRS2"].ToString();
                drReport["CITY"]        = dtDividend.Rows[loop]["CITY"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["CITY"].ToString();
                drReport["WAR_NO"]      = dtDividend.Rows[loop]["WAR_NO"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["WAR_NO"].ToString();
                drReport["WAR_NO_MICR"] = dtDividend.Rows[loop]["WAR_NO_MICR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["WAR_NO_MICR"].ToString();

                if (!(dtDividend.Rows[loop]["H_BK_AC_NO"].Equals(DBNull.Value)) && !(dtDividend.Rows[loop]["H_BK_NM_CD"].Equals(DBNull.Value)) && !(dtDividend.Rows[loop]["H_BK_BR_NM_CD"].Equals(DBNull.Value)))
                {
                    drReport["HOLDER_BK_ACC_NO"] = dtDividend.Rows[loop]["H_BK_AC_NO"].ToString();
                    drReport["HOLDER_BK_NM"]     = reportObj.getBankNameByBankCode(Convert.ToInt16(dtDividend.Rows[loop]["H_BK_NM_CD"].ToString()));
                    drReport["HOLDER_BK_BR_NM"]  = reportObj.getBankBranchNameByCode(Convert.ToInt16(dtDividend.Rows[loop]["H_BK_NM_CD"].ToString()), Convert.ToInt32(dtDividend.Rows[loop]["H_BK_BR_NM_CD"].ToString()));
                }

                drReport["NO_OF_UNITS"] = Convert.ToInt32(dtDividend.Rows[loop]["NO_OF_UNITS"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["NO_OF_UNITS"].ToString());
                drReport["TOT_DIVI"]    = Convert.ToDecimal(dtDividend.Rows[loop]["TOT_DIVI"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TOT_DIVI"].ToString());
                drReport["TAX_DIDUCT"]  = Convert.ToDecimal(dtDividend.Rows[loop]["TAX_DIDUCT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_DIDUCT"].ToString());

                drReport["FI_DIVI_QTY"]        = Convert.ToDecimal(dtDividend.Rows[loop]["FI_DIVI_QTY"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["FI_DIVI_QTY"].ToString());
                drReport["FI_DIVI_QTY_INWORD"] = NumToEngObj.changeNumericToWords(Convert.ToDecimal(dtDividend.Rows[loop]["FI_DIVI_QTY"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["FI_DIVI_QTY"].ToString())) + "Only";

                drReport["CIP_QTY"]  = Convert.ToInt32(dtDividend.Rows[loop]["CIP_QTY"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["CIP_QTY"].ToString());
                drReport["CIP_RATE"] = Convert.ToDecimal(dtDividend.Rows[loop]["CIP_RATE"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["CIP_RATE"].ToString());
                drReport["CIP"]      = dtDividend.Rows[loop]["CIP"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["CIP"].ToString();
                drReport["AGM_DT"]   = dtDividend.Rows[loop]["AGM_DT"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["AGM_DT"].ToString();

                //taxDiduct = Convert.ToDecimal(dtDividend.Rows[loop]["TAX_DIDUCT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_DIDUCT"].ToString());
                //decimal taxDiductCal = 0;
                //if (taxDiduct == 0)
                //{
                //    drReport["TAX_RT_INDIVIDUAL"] = 0;
                //    drReport["TAX_RT_INSTITUTION"] = 0;
                //    taxDiductCal = 0;
                //}
                //else if (taxDiduct > 0)
                //{
                //    if (diviDAOObj.getRegType(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString()).ToString().ToUpper() == "I")
                //    {
                //        drReport["TAX_RT_INDIVIDUAL"] = 0;
                //        drReport["TAX_RT_INSTITUTION"] = diviDAOObj.getTaxDiductRate(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString(), dtDividend.Rows[loop]["F_YEAR"].ToString(), Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString()));
                //        taxDiductCal = diviDAOObj.getTaxDiductRate(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString(), dtDividend.Rows[loop]["F_YEAR"].ToString(), Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString()));
                //    }
                //    else
                //    {
                //        drReport["TAX_RT_INDIVIDUAL"] = diviDAOObj.getTaxDiductRate(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString(), dtDividend.Rows[loop]["F_YEAR"].ToString(), Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString()));
                //        drReport["TAX_RT_INSTITUTION"] = 0;
                //        taxDiductCal = diviDAOObj.getTaxDiductRate(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString(), dtDividend.Rows[loop]["F_YEAR"].ToString(), Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString()));
                //    }
                //}

                drReport["REG_TYPE"]  = dtDividend.Rows[loop]["REG_TYPE"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_TYPE"].ToString();
                drReport["FY_PART"]   = dtDividend.Rows[loop]["FY_PART"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FY_PART"].ToString();
                drReport["NET_DIVI"]  = Convert.ToDecimal(dtDividend.Rows[loop]["NET_DIVI"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["NET_DIVI"].ToString());
                drReport["FRAC_DIVI"] = Convert.ToDecimal(dtDividend.Rows[loop]["FRAC_DIVI"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["FRAC_DIVI"].ToString());
                drReport["REG_NUM"]   = Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString());
                drReport["REG_BR"]    = dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString();
                string taxCalText = "";
                //DataTable dtTaxCal = diviDAOObj.dtDividendInfo(Convert.ToInt32(dtDividend.Rows[loop]["REG_NUM"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["REG_NUM"].ToString()), dtDividend.Rows[loop]["FUND_CD"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["FUND_CD"].ToString(), dtDividend.Rows[loop]["REG_BR"].Equals(DBNull.Value) ? "" : dtDividend.Rows[loop]["REG_BR"].ToString(), dtDividend.Rows[loop]["F_YEAR"].ToString());
                //if (dtTaxCal.Rows.Count > 1)
                //{
                //    if (taxDiduct == 0)
                //    {
                //        drReport["TAX_CAL_TEXT"] = "";
                //    }
                //    else
                //    {
                //        decimal totalDividend = Convert.ToDecimal(dtTaxCal.Rows[0]["TOT_DIVI"].ToString()) + Convert.ToDecimal(dtTaxCal.Rows[1]["TOT_DIVI"].ToString());
                //        decimal totalDiduct = Convert.ToDecimal(dtTaxCal.Rows[0]["DIDUCT"].ToString()) + Convert.ToDecimal(dtTaxCal.Rows[1]["DIDUCT"].ToString()); ;
                //        decimal total_remainning = totalDividend - Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString());
                //        decimal taxtLimit = Convert.ToDecimal(dtDividend.Rows[loop]["TAX_LIMIT"].Equals(DBNull.Value) ? "0" : dtDividend.Rows[loop]["TAX_LIMIT"].ToString());
                //        decimal diduct1 = Convert.ToDecimal(dtTaxCal.Rows[0]["DIDUCT"].ToString());
                //        decimal diduct2 = Convert.ToDecimal(dtTaxCal.Rows[1]["DIDUCT"].ToString());


                //        string TAX_CAL_TEXT = "*" + dtTaxCal.Rows[0]["TOT_DIVI"].ToString() + " (" + dtTaxCal.Rows[0]["FY_PART"].ToString() + ") +" + dtTaxCal.Rows[1]["TOT_DIVI"].ToString() + " (" + dtTaxCal.Rows[1]["FY_PART"].ToString() + ") ";
                //        TAX_CAL_TEXT = TAX_CAL_TEXT + "=" + totalDividend.ToString() + "-" + taxtLimit + "=";
                //        TAX_CAL_TEXT = TAX_CAL_TEXT + total_remainning.ToString() + "@" + taxDiductCal + "%=" + totalDiduct.ToString() + " [" + diduct1 + "(" + dtTaxCal.Rows[0]["FY_PART"].ToString() + ")+" + diduct2 + "(" + dtTaxCal.Rows[1]["FY_PART"].ToString() + ")" + "]";

                //        drReport["TAX_CAL_TEXT"] = TAX_CAL_TEXT;

                //    }
                //}
                //else
                //{
                //    drReport["TAX_CAL_TEXT"] = "";
                //}
                drReport["TAX_CAL_TEXT"] = "";
                dtReport.Rows.Add(drReport);
            }

            dtReport.TableName = "ReportDividend";
            //dtReport.WriteXmlSchema(@"D:\Project\Web\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\ReportDividend.xsd");
            if (fundCode.ToString().ToUpper() == "IAMPH")
            {
                CRPen_Dividend.Refresh();
                CRPen_Dividend.SetDataSource(dtReport);
                CRPen_Dividend.SetParameterValue("duplicate", duplicate);
                CrystalReportViewer1.ReportSource = CRPen_Dividend;
            }
            else if (fundCode.ToString().ToUpper() == "BDF")
            {
                if (dividendCategory == "INTERIM")
                {
                    CRBDF_Dividend.Refresh();
                    CRBDF_Dividend.SetDataSource(dtReport);
                    CRBDF_Dividend.SetParameterValue("duplicate", duplicate);
                    CrystalReportViewer1.ReportSource = CRBDF_Dividend;
                }
                else
                {
                    CRBDF_Dividend.Refresh();
                    CRBDF_Dividend.SetDataSource(dtReport);
                    CRBDF_Dividend.SetParameterValue("duplicate", duplicate);
                    CrystalReportViewer1.ReportSource = CRBDF_Dividend;
                }
            }
            else
            {
                CRUnit_Dividend.Refresh();
                CRUnit_Dividend.SetDataSource(dtReport);
                CRUnit_Dividend.SetParameterValue("duplicate", duplicate);
                CrystalReportViewer1.ReportSource = CRUnit_Dividend;
            }
        }
        else
        {
            Response.Write("No data found");
        }
    }
Beispiel #8
0
    protected void ShowReportButton_Click(object sender, EventArgs e)
    {
        try
        {
            //StringBuilder sbRepurchase = new StringBuilder();
            //sbRepurchase.Append("SELECT  SUM(QTY) AS QTY, SUM(QTY * REP_PRICE) AS AMOUNT FROM (SELECT REPURCHASE.REP_NO, REPURCHASE.REP_DT, REPURCHASE.QTY, U_MASTER.HNAME, REPURCHASE.SL_TR_NO, ");
            //sbRepurchase.Append(" ");


            UnitHolderRegistration regObj = new UnitHolderRegistration();
            // UnitTransfer transferObj = new UnitTransfer();
            UnitRepurchase unitRepObj = new UnitRepurchase();

            regObj.FundCode         = fundCodeTextBox.Text.Trim();
            regObj.BranchCode       = branchCodeTextBox.Text.Trim();
            unitRepObj.RepurchaseNo = Convert.ToInt32(fromRepNoTextBox.Text.Trim().ToString());

            StringBuilder sbMaster          = new StringBuilder();
            StringBuilder sbFilter          = new StringBuilder();
            DataTable     dtReportStatement = new DataTable();
            StringBuilder sbReportString    = new StringBuilder();


            string copy = fundCodeTextBox.Text.ToString() + " Copy";
            if (accoountRadioButton.Checked)
            {
                copy = "Accounts Copy";
            }


            sbMaster.Append("SELECT NVL(REPURCHASE.REP_NO,0) AS REP_NO , TO_CHAR(REPURCHASE.REP_DT, 'DD-MON-YYYY') AS REP_DT, U_MASTER.REG_BK, U_MASTER.REG_BR, U_MASTER.REG_NO AS RG_NO, ");
            sbMaster.Append(" U_MASTER.HNAME, U_JHOLDER.JNT_NAME, U_MASTER.REG_BK || '/' || U_MASTER.REG_BR || '/' || U_MASTER.REG_NO AS REG_NO,U_MASTER.TIN,U_MASTER.BO,");
            sbMaster.Append(" U_MASTER.ADDRS1, U_MASTER.ADDRS2, U_MASTER.CITY, U_MASTER.BK_AC_NO,U_MASTER.BK_NM_CD,U_MASTER.ID_FLAG,U_MASTER.ID_BK_NM_CD, U_MASTER.ID_BK_BR_NM_CD,");
            sbMaster.Append(" U_MASTER.BK_BR_NM_CD, U_MASTER.BK_FLAG,REPURCHASE.QTY,  REPURCHASE.REP_PRICE AS RATE, REPURCHASE.QTY * REPURCHASE.REP_PRICE AS AMOUNT,  REPURCHASE.SL_TR_NO, U_MASTER.CIP, U_MASTER.ID_AC,");
            sbMaster.Append(" DECODE(REPURCHASE.PAY_TYPE,'EFT','BEFTN','CHEQUE') AS PAY_TYPE ");
            sbMaster.Append(" FROM  U_MASTER INNER JOIN  REPURCHASE ON U_MASTER.REG_BK = REPURCHASE.REG_BK AND U_MASTER.REG_BR = REPURCHASE.REG_BR AND  U_MASTER.REG_NO = REPURCHASE.REG_NO");
            sbMaster.Append(" LEFT OUTER JOIN  U_JHOLDER ON U_MASTER.REG_BK = U_JHOLDER.REG_BK AND U_MASTER.REG_BR = U_JHOLDER.REG_BR AND U_MASTER.REG_NO = U_JHOLDER.REG_NO");

            sbMaster.Append(" WHERE 1=1");
            sbMaster.Append(" AND (U_MASTER.REG_BK = '" + fundCodeTextBox.Text.Trim().ToString().ToUpper() + "') AND (U_MASTER.REG_BR = '" + branchCodeTextBox.Text.Trim().ToString().ToUpper() + "')");

            if (fromRepNoTextBox.Text != "")
            {
                sbFilter.Append(" AND (REPURCHASE.REP_NO = " + Convert.ToInt32(fromRepNoTextBox.Text.Trim().ToString()) + ")");
            }
            if (fromRegNoTextBox.Text != "")
            {
                sbFilter.Append(" AND (U_MASTER.REG_NO = " + Convert.ToInt32(fromRegNoTextBox.Text.Trim().ToString()) + ")");
            }

            if (fromRepDateTextBox.Text != "")
            {
                sbFilter.Append(" AND ( REPURCHASE.REP_DT ='" + Convert.ToDateTime(fromRepDateTextBox.Text.Trim().ToString()).ToString("dd-MMM-yyyy") + "')");
            }

            sbFilter.Append(" ORDER BY TO_NUMBER(SUBSTR(REPURCHASE.SL_TR_NO,2)) ");
            sbMaster.Append(sbFilter.ToString());
            dtReportStatement = commonGatewayObj.Select(sbMaster.ToString());

            if (dtReportStatement.Rows.Count > 0)
            {
                string holderName = dtReportStatement.Rows[0]["HNAME"].ToString().ToUpper();
                if (dtReportStatement.Rows[0]["BK_FLAG"].ToString().ToUpper() == "N" || dtReportStatement.Rows[0]["BK_NM_CD"].Equals(DBNull.Value) || dtReportStatement.Rows[0]["BK_BR_NM_CD"].Equals(DBNull.Value))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('Please Update Bank Information');", true);
                }
                else if ((dtReportStatement.Rows[0]["ID_FLAG"].ToString().ToUpper() == "Y") && (dtReportStatement.Rows[0]["ID_BK_NM_CD"].Equals(DBNull.Value) || dtReportStatement.Rows[0]["ID_BK_BR_NM_CD"].Equals(DBNull.Value) || dtReportStatement.Rows[0]["ID_AC"].Equals(DBNull.Value)))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('Please Update ID  Information');", true);
                }

                else
                {
                    if (dtReportStatement.Rows[0]["ID_FLAG"].ToString().ToUpper() == "Y")
                    {
                        holderName = reportObj.getBankNameByBankCode(Convert.ToInt32(dtReportStatement.Rows[0]["ID_BK_NM_CD"].ToString())).ToString() + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtReportStatement.Rows[0]["ID_BK_NM_CD"].ToString()), Convert.ToInt32(dtReportStatement.Rows[0]["ID_BK_BR_NM_CD"].ToString())).ToString() + " ID NO:" + dtReportStatement.Rows[0]["ID_AC"].ToString().ToUpper();
                    }

                    string    BankInfo         = ", bank account no : " + dtReportStatement.Rows[0]["BK_AC_NO"].ToString().ToUpper() + " , " + reportObj.getBankNameByBankCode(int.Parse(dtReportStatement.Rows[0]["BK_NM_CD"].ToString())) + "," + " " + reportObj.getBankBranchNameByCode(int.Parse(dtReportStatement.Rows[0]["BK_NM_CD"].ToString()), int.Parse(dtReportStatement.Rows[0]["BK_BR_NM_CD"].ToString()));
                    DataTable dtBankBracnhInfo = unitHolderRegBLObj.dtGetBankBracnhInfo(Convert.ToInt32(dtReportStatement.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtReportStatement.Rows[0]["BK_BR_NM_CD"].ToString()));
                    if (dtBankBracnhInfo.Rows.Count > 0)
                    {
                        BankInfo = BankInfo + " [ " + dtBankBracnhInfo.Rows[0]["ROUTING_NO"].ToString() + "] ";
                    }

                    // string BankInfo = "";
                    decimal totalRepAmount = 0;
                    for (int looper = 0; looper < dtReportStatement.Rows.Count; looper++)
                    {
                        totalRepAmount = totalRepAmount + Convert.ToDecimal(dtReportStatement.Rows[looper]["AMOUNT"].ToString());
                    }
                    if (NoRadioButton.Checked)
                    {
                        string payType = unitRepBLObj.getPayType(regObj, unitRepObj);
                        if (payType.ToString() == "EFT")
                        {
                            sbReportString.Append(" Through BEFTN Tk. " + totalRepAmount.ToString("#,##0.00") + "  ( Taka " + numberToEnglishObj.changeNumericToWords(totalRepAmount) + " ) ");
                            sbReportString.Append(" be issued in favour of Mr./Ms. " + holderName.ToString().ToUpper() + "" + BankInfo);
                            sbReportString.Append(" being the surrended value of units.  ");
                        }
                        else
                        {
                            sbReportString.Append(" An account payee cheque for Tk. " + totalRepAmount.ToString("#,##0.00") + "  ( Taka " + numberToEnglishObj.changeNumericToWords(totalRepAmount) + " ) ");
                            sbReportString.Append(" be issued in favour of Mr./Ms. " + holderName.ToString().ToUpper() + "" + BankInfo);
                            sbReportString.Append(" being the surrended value of units.  ");
                        }
                    }
                    else if (YesRadioButton.Checked)
                    {
                        decimal lienAmount      = Convert.ToDecimal(LienAmountTextBox.Text.Trim().ToString());
                        decimal remainingAmount = totalRepAmount - lienAmount;

                        sbReportString.Append("According to the letter no: " + LienReqRefTextBox.Text.Trim().ToString() + " dated on " + LienReqDateTextBox.Text.Trim().ToString() + ", the above certificates are ");
                        sbReportString.Append(" surrendered by " + LienbankNameDropDownList.SelectedItem.Text.ToString() + ", " + LienbranchNameDropDownList.SelectedItem.Text.ToString() + " .  An account payee cheque for Tk. " + lienAmount.ToString("#,##0.00") + " ( Taka ");
                        sbReportString.Append(numberToEnglishObj.changeNumericToWords(lienAmount).ToString() + " )  be issued in favour of  " + LienbankNameDropDownList.SelectedItem.Text.ToString() + " , " + LienbranchNameDropDownList.SelectedItem.Text.ToString());
                        sbReportString.Append(" and another account payee cheque of remaining amout for Tk. " + remainingAmount.ToString("#,##0.00") + " ( Taka  " + numberToEnglishObj.changeNumericToWords(remainingAmount));
                        sbReportString.Append(" ) be issued in favour of Mr./Ms. " + holderName.ToString().ToUpper() + BankInfo + "   being the surrended value of units. ");
                    }
                    Session["dtReportStatement"] = dtReportStatement;
                    Session["fundCode"]          = fundCodeTextBox.Text.Trim().ToString();
                    Session["branchCode"]        = branchCodeTextBox.Text.Trim().ToString();
                    Session["sbReportString"]    = sbReportString.ToString();
                    Session["copy"] = copy;

                    // ClientScript.RegisterStartupScript(this.GetType(), "UnitHolderInfo", "window.open('ReportViewer/UnitReportRepurchaseVoucherReportViewer.aspx')", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "UnitHolderInfo", "window.open('ReportViewer/UnitReportRepurchaseVoucherReportViewer.aspx')", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('No data found');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('" + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
    public void displayRegInfo(UnitHolderRegistration unitRegObj)
    {
        dvLedger.Visible = true;


        DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtNominee = opendMFDAO.dtNomineeRegInfo(unitRegObj);

        if (dtRegInfo.Rows.Count > 0)
        {
            //Trasaction Lock Status

            if (!(dtRegInfo.Rows[0]["ALL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["SL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REP_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["TR_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LIEN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value)))
            {
                dvLockin.Attributes.Add("style", "visibility:visible");
                if (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "Y")
                {
                    SaleLockLabel.Text      = "YES";
                    RepLockLabel.Text       = "YES";
                    TransferLockLabel.Text  = "YES";
                    LienLockLabel.Text      = "YES";
                    RenLockLabel.Text       = "YES";
                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
                else
                {
                    if (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "Y")
                    {
                        SaleLockLabel.Text = "YES";
                    }
                    else
                    {
                        SaleLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "Y")
                    {
                        RepLockLabel.Text = "YES";
                    }
                    else
                    {
                        RepLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "Y")
                    {
                        TransferLockLabel.Text = "YES";
                    }
                    else
                    {
                        TransferLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "Y")
                    {
                        LienLockLabel.Text = "YES";
                    }
                    else
                    {
                        LienLockLabel.Text = "NO";
                    }

                    if (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "Y")
                    {
                        RenLockLabel.Text = "YES";
                    }
                    else
                    {
                        RenLockLabel.Text = "NO";
                    }



                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
            }
            else
            {
                SaleLockLabel.Text     = "NO";
                RepLockLabel.Text      = "NO";
                TransferLockLabel.Text = "NO";
                LienLockLabel.Text     = "NO";
                RenLockLabel.Text      = "NO";
                dvLockin.Attributes.Add("style", "visibility:hidden");
            }
            regNoTextBox.Text          = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text       = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();
            folioTextBox.Text          = dtRegInfo.Rows[0]["FOLIO_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["FOLIO_NO"].ToString();
            holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
            tdTIN.InnerHtml            = dtRegInfo.Rows[0]["TIN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TIN"].ToString();
            string CIP   = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
            string BEFTN = dtRegInfo.Rows[0]["IS_BEFTN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["IS_BEFTN"].ToString();
            if (string.Compare(CIP, "Y", true) == 0)
            {
                tdCIP.InnerHtml = "YES";
            }
            else if (string.Compare(CIP, "N", true) == 0)
            {
                tdCIP.InnerHtml = "NO";
            }
            else
            {
                tdCIP.InnerHtml = " ";
            }
            if (string.Compare(BEFTN, "Y", true) == 0)
            {
                tdBEFTN.InnerHtml = "YES";
            }
            else
            {
                tdBEFTN.InnerHtml = "NO";
            }
            if (dtNominee.Rows.Count > 1)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = dtNominee.Rows[1]["NOMI_NAME"].ToString();
            }
            else if (dtNominee.Rows.Count > 0)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = "";
            }
            else
            {
                Nominee1NameTextBox.Text = "";
                Nominee2NameTextBox.Text = "";
            }
            RemarksTextBox.Text = dtRegInfo.Rows[0]["REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REMARKS"].ToString();
            if (dtRegInfo.Rows[0]["BK_FLAG"].ToString() == "Y")
            {
                string bankInfo = "";
                if (!dtRegInfo.Rows[0]["BK_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_AC_NO"].Equals(DBNull.Value))
                {
                    bankInfo = "AC:" + dtRegInfo.Rows[0]["BK_AC_NO"].ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankNameByBankCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString())).ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString())).ToString();

                    DataTable dtBankBracnhInfo = unitHolderRegBLObj.dtGetBankBracnhInfo(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString()));
                    if (dtBankBracnhInfo.Rows.Count > 0)
                    {
                        bankInfo = bankInfo + " Routing No=[" + dtBankBracnhInfo.Rows[0]["ROUTING_NO"].ToString() + "] " + dtBankBracnhInfo.Rows[0]["ADDRESS"].ToString() + " ";
                    }
                }
                BankInfoTextBox.Text = bankInfo.ToString();
            }
            else
            {
                BankInfoTextBox.Text = "";
            }

            DataTable dtLedger = reportObj.GetLedgerData(unitRegObj);
            int       balance  = 0;
            if (dtLedger.Rows.Count > 0)
            {
                DataTable dtLedgerForReport = reportObj.GetDtLedgerTable();
                DataRow   drLedgerForReport;
                for (int looper = 0; looper < dtLedger.Rows.Count; looper++)
                {
                    drLedgerForReport       = dtLedgerForReport.NewRow();
                    drLedgerForReport["SI"] = looper + 1;
                    if (!dtLedger.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_DATE"] = Convert.ToDateTime(dtLedger.Rows[looper]["TRANS_DATE"].ToString()).ToString("dd-MMM-yyyy");
                    }

                    drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedger.Rows[looper]["TRANS_NO"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["TRANS_NO"].ToString());
                    //drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value) ? "0" : dtLedgerForReport.Rows[looper]["TRANS_DATE"].ToString());
                    if (!dtLedger.Rows[looper]["TRANS_TYPE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_TYPE"] = dtLedger.Rows[looper]["TRANS_TYPE"].ToString();
                        if ((string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "SL", true) == 0) || (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "CIP", true) == 0))
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]        = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));

                            int saleBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + saleBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRI", true) == 0)
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferInBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + transferInBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRO", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferOutBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - transferOutBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "REP", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]       = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));
                            int repurchaseBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - repurchaseBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                    }
                    dtLedgerForReport.Rows.Add(drLedgerForReport);
                }
                TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                dgLedger.DataSource = dtLedgerForReport;
                dgLedger.DataBind();
                Session["dtLedgerForReport"] = dtLedgerForReport;
                displaySign();
            }
            else
            {
                ClearText();
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                dvLedger.Visible   = false;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Ledger Balance Data Found');", true);
            }
        }

        else
        {
            SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
            dvLedger.Visible   = false;
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", " window.fnResetAll();", true);
            tdCIP.InnerHtml = "";
        }
    }