Ejemplo n.º 1
0
    public DataTable DepositIntPayable(double Branch, string strAbbr, string strdate)
    {
        DataTable dtData = new DataTable();

        try
        {
            SingletonConn    objDataFetch = new SingletonConn();
            OracleConnection oraConn      = new OracleConnection();
            OracleCommand    cmd          = new OracleCommand();
            oraConn = objDataFetch.getSingletonConnectionInstance();
            cmd.Parameters.Clear();
            cmd.Connection  = oraConn;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "INTPAYABLE";
            cmd.Parameters.Add("ABBR", OracleType.VarChar).Value     = strAbbr;
            cmd.Parameters.Add("ONDATE", OracleType.DateTime).Value  = String.Format("{0:dd-MMM-yyyy}", strdate);
            cmd.Parameters.Add("BRANCH", OracleType.Number).Value    = Branch;
            cmd.Parameters.Add("ITCUR", OracleType.Cursor).Direction = System.Data.ParameterDirection.Output;
            OracleDataAdapter odaLOrpt = new OracleDataAdapter(cmd);
            odaLOrpt.Fill(dtData);
            objlog.WriteLog("INTPAYABLE" + "" + "Executed Sucessfully");
            //objLog.WriteLog("CBSILODNEWFORMAT.CBS_ILODREPORT : ds2.Rows.Count:" + dtLOrpt.Rows.Count);
        }
        catch (Exception ex)
        {
            string g;
            g = ex.Message;
            g = Regex.Replace(g, "[^a-zA-Z0-9_]+", " ");
            objlog.WriteLog("DepositIntPayableReport.aspx: Exception in DepositIntPayable() : " + g);
            ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('" + g + "')</script>");
        }
        finally
        {
            objlog.WriteLog("DepositIntPayableReport.aspx: DepositIntPayable():finally block reached..");
        }
        return(dtData);
    }
Ejemplo n.º 2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        DataTable dtDCB     = new DataTable();
        DataTable dtDetails = new DataTable();
        DataRow   row;

        globalSession.checkSession();
        OraConn = objDataFetch.getSingletonConnectionInstance();
        objCmdSave.Connection = OraConn;

        string abbr = "", sOD = "", sLoan = "", strFrmDate = "", strToDate = "";
        int    intRecount = 0;
        double dblSlNo = 0, dblTotErlierDemand = 0.00, dblTotPresentDemand = 0.00,
               dblTotPresentCollection = 0.00, dblGTotErlierCollection = 0.00, dblTotFutureCollection = 0.00,
               dblTotErlierBalance = 0.00, dblTotPresentBalance = 0.00,
               dblgrdTotdmd = 0.00, dblgrdTotColl = 0.00, dblgrdTotBal = 0.00, dblTotErDemand = 0.00, dblTotPrDemand = 0.00,
               dblgrdTotdemand = 0.00, dblGTotErCollection = 0.00, dblTotPrCollection = 0.00, dblTotFuCollection = 0.00,
               dblgrdTotCollection = 0.00, dblTotErBalance = 0.00, dblTotPrBalance = 0.00, dblgrdTotBalance = 0.00;
        DateTime temp;

        try
        {
            strFrmDate            = txtFromDate.Text.ToString();
            Session["strFrmDate"] = strFrmDate;
            strToDate             = txtToDate.Text;
            Session["strToDate"]  = strToDate;

            if (!(DateTime.TryParse(strFrmDate, out temp)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Enter a Valid From Date') </script>");
                return;
            }
            if (!(DateTime.TryParse(strToDate, out temp)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Enter a Valid To Date') </script>");
                return;
            }

            if ((Convert.ToDateTime(strFrmDate) > DateTime.Now) || (Convert.ToDateTime(strToDate) > DateTime.Now))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Enter a Valid Date') </script>");
                return;
            }
            if (Convert.ToDateTime(strFrmDate) > Convert.ToDateTime(strToDate))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Check From and To Dates') </script>");
                return;
            }

            if ((chkLoanScheme.SelectedValue == "") && (chkODScheme.SelectedValue == ""))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Select atleast one Scheme') </script>");
                return;
            }

            for (int c = 0; c < chkODScheme.Items.Count; c++)
            {
                if (chkODScheme.Items[c].Selected)
                {
                    abbr      += chkODScheme.Items[c].Value.Trim() + ",";
                    sOD       += "" + chkODScheme.Items[c].Value.Trim() + ",";
                    intRecount = intRecount + 1;
                }
            }
            objLog.WriteLog("DCBStatment sOD : " + sOD);

            for (int i = 0; i < chkLoanScheme.Items.Count; i++)
            {
                if (chkLoanScheme.Items[i].Selected)
                {
                    abbr      += chkLoanScheme.Items[i].Value.Trim() + ",";
                    sLoan     += "" + chkLoanScheme.Items[i].Value.Trim() + ",";
                    intRecount = intRecount + 1;
                }
            }
            objLog.WriteLog("DCBStatment sLoan : " + sLoan);


            OracleCommand cmdProcExe = new OracleCommand("DCBSTAT.MENT", OraConn);
            cmdProcExe.CommandType = System.Data.CommandType.StoredProcedure;
            cmdProcExe.Parameters.Add("V_BRANCH", OracleType.Number).Value   = ddlBranch.SelectedValue;
            cmdProcExe.Parameters.Add("V_LSCHEME", OracleType.VarChar).Value = sLoan;
            cmdProcExe.Parameters.Add("V_OSCHEME", OracleType.VarChar).Value = sOD;
            cmdProcExe.Parameters.Add("V_TYPE", OracleType.VarChar).Value    = rblPriOrInt.SelectedValue;
            cmdProcExe.Parameters.Add("V_FDATE", OracleType.DateTime).Value  = String.Format("{0:dd-MMM-yyyy}", strFrmDate);
            cmdProcExe.Parameters.Add("V_TDATE", OracleType.DateTime).Value  = String.Format("{0:dd-MMM-yyyy}", strToDate);

            cmdProcExe.Parameters.Add("V_OUT", OracleType.Cursor).Direction = System.Data.ParameterDirection.Output;

            OracleDataAdapter oDaExecution = new OracleDataAdapter(cmdProcExe);
            oDaExecution.Fill(dtDCB);

            if (dtDCB.Rows.Count <= 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('There is No Criteria') </script>");
                return;
            }

            //objLog.WriteLog("DCBStatement - V_BRANCH INPUT to Stored Procedure " + ddlBranch.SelectedValue);
            //objLog.WriteLog("DCBStatement - V_LSCHEME INPUT to Stored Procedure " + sOD);
            //objLog.WriteLog("DCBStatement - V_OSCHEME INPUT to Stored Procedure " + sLoan);
            //objLog.WriteLog("DCBStatement - V_TYPE INPUT to Stored Procedure " + rblPriOrInt.SelectedValue);
            //objLog.WriteLog("DCBStatement - V_FDATE INPUT to Stored Procedure " + txtFromDate.Text);
            //objLog.WriteLog("DCBStatement - V_TDATE INPUT to Stored Procedure " + txtToDate.Text);

            //objLog.WriteLog("DCBStatment - dtDCB(Row Count)" + dtDCB.Rows.Count);

            objLog.WriteLog("DCBStatement - V_BRANCH:" + ddlBranch.SelectedValue + "V_LSCHEME :" + sOD + "V_OSCHEME:" + sLoan +
                            "V_TYPE:" + rblPriOrInt.SelectedValue + "V_FDATE:" + txtFromDate.Text + "V_TDATE:" + txtToDate.Text);

            if (dtDCB.Rows.Count > 0)
            {
                dtDetails.Columns.Add(new DataColumn("SlNo", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("LoanNo", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Name", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Arr Dmd", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Crnt Dmd", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Tot Dmd", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Arr Coln", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Crnt Coln", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Future Coln", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Tot Coln", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Arr Bal", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Cur Bal", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("Tot Bal", typeof(string)));
                dtDetails.Columns.Add(new DataColumn("BrName", typeof(string)));
            }
            foreach (DataRow dr in dtDCB.Rows)
            {
                row         = dtDetails.NewRow();
                dblSlNo     = dblSlNo + 1;
                row["SlNo"] = dblSlNo;

                if ((!DBNull.Value.Equals(dr["C_AccNo"])) || (!DBNull.Value.Equals(dr["C_AccNo"])))
                {
                    row["LoanNo"] = dr["C_ABBR"] + " " + dr["C_AccNo"];
                }

                if (!DBNull.Value.Equals(dr["C_NAME"]))
                {
                    row["Name"] = dr["C_NAME"];
                }

                if (!DBNull.Value.Equals(dr["C_ERDEM"]))
                {
                    row["Arr Dmd"]     = String.Format("{0:0.00}", dr["C_ERDEM"]);
                    dblTotErlierDemand = Convert.ToDouble(dr["C_ERDEM"]);
                    dblTotErDemand    += dblTotErlierDemand;
                }

                if (!DBNull.Value.Equals(dr["C_PRDEM"]))
                {
                    row["Crnt Dmd"]     = String.Format("{0:0.00}", dr["C_PRDEM"]);
                    dblTotPresentDemand = Convert.ToDouble(dr["C_PRDEM"]);
                    dblTotPrDemand     += dblTotPresentDemand;
                }

                row["Tot Dmd"]   = String.Format("{0:0.00}", dblTotErlierDemand + dblTotPresentDemand);
                dblgrdTotdmd     = Convert.ToDouble(row["Tot Dmd"]);
                dblgrdTotdemand += dblgrdTotdmd;


                if (!DBNull.Value.Equals(dr["C_ERCOL"]))
                {
                    row["Arr Coln"]         = String.Format("{0:0.00}", dr["C_ERCOL"]);
                    dblGTotErlierCollection = Convert.ToDouble(dr["C_ERCOL"]);
                    dblGTotErCollection    += dblGTotErlierCollection;
                }
                if (!DBNull.Value.Equals(dr["C_PRCOL"]))
                {
                    row["Crnt Coln"]        = String.Format("{0:0.00}", dr["C_PRCOL"]);
                    dblTotPresentCollection = Convert.ToDouble(dr["C_PRCOL"]);
                    dblTotPrCollection     += dblTotPresentCollection;
                }
                if (!DBNull.Value.Equals(dr["C_ADVCOL"]))
                {
                    row["Future Coln"]     = String.Format("{0:0.00}", dr["C_ADVCOL"]);
                    dblTotFutureCollection = Convert.ToDouble(dr["C_ADVCOL"]);
                    dblTotFuCollection    += dblTotFutureCollection;
                }

                row["Tot Coln"]      = String.Format("{0:0.00}", dblGTotErlierCollection + dblTotPresentCollection + dblTotFutureCollection);
                dblgrdTotColl        = Convert.ToDouble(row["Tot Coln"]);
                dblgrdTotCollection += dblgrdTotColl;

                if (!DBNull.Value.Equals(dr["C_ERBAL"]))
                {
                    row["Arr Bal"]      = String.Format("{0:0.00}", dr["C_ERBAL"]);
                    dblTotErlierBalance = Convert.ToDouble(dr["C_ERBAL"]);
                    dblTotErBalance    += dblTotErlierBalance;
                }
                if (!DBNull.Value.Equals(dr["C_PRBAL"]))
                {
                    row["Cur Bal"]       = String.Format("{0:0.00}", dr["C_PRBAL"]);
                    dblTotPresentBalance = Convert.ToDouble(dr["C_PRBAL"]);
                    dblTotPrBalance     += dblTotPresentBalance;
                }

                row["Tot Bal"]    = String.Format("{0:0.00}", dblTotErlierBalance + dblTotPresentBalance);
                dblgrdTotBal      = Convert.ToDouble(row["Tot Bal"]);
                dblgrdTotBalance += dblgrdTotBal;

                if (!DBNull.Value.Equals(dr["C_BNO"]))
                {
                    row["BrName"] = dr["C_BNO"];

                    //DataTable dtBranch = new DataTable();
                    //string strSql = "", strbrnchname = "";
                    //strSql = "  select * from branch where bran_sno= " + dr["C_BNO"];
                    //dtBranch = objDataFetch.DatatablePassSQL(strSql);
                    //if (dtBranch.Rows.Count > 0)
                    //{
                    //    strbrnchname = dtBranch.Rows[0]["BRAN_NAME"].ToString();
                    //}
                    //row["BrName"] = strbrnchname;
                }


                dtDetails.Rows.Add(row);
            }

            row                = dtDetails.NewRow();
            row["Name"]        = "GRAND TOTAL";
            row["Arr Dmd"]     = (String.Format("{0:0.00}", dblTotErDemand));
            row["Crnt Dmd"]    = (String.Format("{0:0.00}", dblTotPrDemand));
            row["Tot Dmd"]     = (String.Format("{0:0.00}", dblgrdTotdemand));
            row["Arr Coln"]    = (String.Format("{0:0.00}", dblGTotErCollection));
            row["Crnt Coln"]   = (String.Format("{0:0.00}", dblTotPrCollection));
            row["Future Coln"] = (String.Format("{0:0.00}", dblTotFuCollection));
            row["Tot Coln"]    = (String.Format("{0:0.00}", dblgrdTotCollection));
            row["Arr Bal"]     = (String.Format("{0:0.00}", dblTotErBalance));
            row["Cur Bal"]     = (String.Format("{0:0.00}", dblTotPrBalance));
            row["Tot Bal"]     = (String.Format("{0:0.00}", dblgrdTotBalance));

            dtDetails.Rows.Add(row);

            lblBank.Visible    = true;
            lblBranch.Visible  = true;
            lblHeading.Visible = true;
            lblBank.Text       = global.BankName();
            lblBranch.Text     = Session["LoginBranchName"].ToString().Trim();
            lblHeading.Text    = "DCB STATEMENT REPORT[CBS] From " + txtFromDate.Text + " TO " + txtToDate.Text + "";

            gvDCB.DataSource = dtDetails;
            gvDCB.DataBind();
            Session["dtDetails"] = dtDetails;

            objFrmPt.FormatGridView(gvDCB);
            GridPrint(gvDCB);

            ViewState["Pagename"] = "DCB STATEMENT REPORT";

            imgxl0.Visible = true;
        }

        catch (Exception ex)
        {
            objLog.WriteLog(ex.Message);
            ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('" + ex.Message + "')</script>");
        }
        finally
        {
            objLog.WriteLog("DCBStatment.aspx-->btnOK_Click() Event Reached finally block without any exceptions.");
            dtDCB.Dispose();
            dtDetails.Dispose();
        }
    }
Ejemplo n.º 3
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        DataTable        dtDetails = new DataTable();
        DateTime         temp;
        string           sDeposit = "";
        OracleConnection oraConn;

        oraConn = objDataFetch.getSingletonConnectionInstance();
        OracleCommand cmd = new OracleCommand();

        try
        {
            if (!(DateTime.TryParse(txtDate.Text, out temp)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Enter a Valid Date.') </script>");
                return;
            }

            if (txtBalance.Text == string.Empty)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Please enter the Balance and Proceed.') </script>");
                return;
            }

            if (Convert.ToDouble(txtBalance.Text) == 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Balance Amount should be greater than Zero.') </script>");
                return;
            }

            if (chkScheme.SelectedValue == "")
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Select atleast one Scheme and Proceed.') </script>");
                return;
            }

            for (int i = 0; i < chkScheme.Items.Count; i++)
            {
                if (chkScheme.Items[i].Selected)
                {
                    sDeposit += chkScheme.Items[i].Value.Trim() + ",";
                }
            }
            sDeposit = sDeposit.Remove(sDeposit.Length - 1, 1) + "";

            cmd.Connection  = oraConn;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "HEAD.DICGC_REPORT";
            //  cmd.Parameters.Add(new OracleParameter("branch", OracleType.Number)).Value =Convert.ToInt16( ddlBranch.SelectedValue);
            if (rblBrnchConsol.SelectedValue.ToUpper().Trim() == "C")
            {
                cmd.Parameters.Add("branch", OracleType.Number).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add("branch", OracleType.Number).Value = ddlBranch.SelectedValue;
            }
            cmd.Parameters.Add(new OracleParameter("schemes", OracleType.VarChar)).Value     = sDeposit.Trim();
            cmd.Parameters.Add(new OracleParameter("asdate", OracleType.DateTime)).Value     = String.Format("{0:dd/MM/yyyy}", txtDate.Text);
            cmd.Parameters.Add(new OracleParameter("balance", OracleType.Number)).Value      = Convert.ToDouble(txtBalance.Text);
            cmd.Parameters.Add(new OracleParameter("dicgccur", OracleType.Cursor)).Direction = ParameterDirection.Output;
            OracleDataAdapter adp = new OracleDataAdapter(cmd);
            adp.Fill(dtDetails);

            if (dtDetails.Rows.Count > 0)
            {
                pnlGrid.Visible      = true;
                lblBank.Visible      = true;
                lblBranch.Visible    = true;
                lblHeading.Visible   = true;
                lblBank.Text         = global.BankName();
                lblBranch.Text       = Session["LoginBranchName"].ToString().Trim();
                lblHeading.Text      = "DICGC REPORT AS ON " + txtDate.Text + "";
                gvDetails.DataSource = dtDetails;
                gvDetails.DataBind();
                Session["dtDetails"] = dtDetails;

                objFrmPt.FormatGridView(gvDetails);
                GridPrint(gvDetails);

                ViewState["Pagename"] = "DICGCREPORT";
                imgxl0.Visible        = true;
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('Data Not Found.')</script>");
                imgxl0.Visible  = false;
                pnlGrid.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            string g = ex.Message + ex;
            g = Regex.Replace(g, "[^a-zA-Z0-9_]+", " ");
            objLog.WriteLog("DICGCRep.aspx-->Exception in btnOK_Click() Event" + g);
            ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('" + g + "')</script>");
            return;
        }
        finally
        {
            dtDetails.Dispose();
            objLog.WriteLog("DICGCRep.aspx-->btnOK_Click() Event Reached finally block without any exceptions.");
        }
    }
Ejemplo n.º 4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string    strFromDate = "", strAbbr = "", abbrCount = "", strBranch = "", abbrSno = "", sDate = string.Empty;
        double    dblBal = 0.0, dblDiffAmt = 0.0;
        DataTable dtResult     = new DataTable();
        DataTable dtAllDetails = new DataTable();
        DataRow   row;
        int       iLength = 0;

        try
        {
            SingletonConn    objDataFetch = new SingletonConn();
            OracleConnection oraConn      = new OracleConnection();
            oraConn = objDataFetch.getSingletonConnectionInstance();


            lblBank.Visible   = true;
            lblBranch.Visible = true;
            lblBank.Text      = global.BankName();
            lblBranch.Text    = ddlBranch.SelectedItem.Text;

            strBranch   = ddlBranch.SelectedValue;
            strFromDate = txtAsDate.Text;

            for (int i = 0; i < chkList.Items.Count; i++)
            {
                if (chkList.Items[i].Selected)
                {
                    strAbbr  += chkList.Items[i].Value.Trim() + ",";
                    abbrCount = abbrCount + 1;
                }
            }
            if (strAbbr != "")
            {
                iLength = strAbbr.Length - 1;
                abbrSno = strAbbr.Substring(0, iLength);
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Select a Scheme and then Proceed...!') </script>");
                return;
            }

            strFromDate = String.Format("{0:dd-MMM-yyyy}", Convert.ToDateTime(txtAsDate.Text));
            objlog.WriteLog("DepositIntPayableReport .aspx: Before calling the procedur");
            dtAllDetails = DepositIntPayable(Convert.ToInt32(ddlBranch.SelectedValue), strAbbr, strFromDate);
            if (dtAllDetails.Rows.Count > 0)
            {
                dtResult.Columns.Add(new DataColumn("SL No", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Client No", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Abbr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Acno", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Name", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Balance", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Int Payable", typeof(string)));
                //ADDED BY ROOPA ON 14032018
                dtResult.Columns.Add(new DataColumn("Deposit Date", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Maturity Date", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Rate of Int(%)", typeof(string)));
                dtResult.Columns.Add(new DataColumn("No. of Days Int Calu", typeof(string)));
                //END
                int i = 1;

                foreach (DataRow dr in dtAllDetails.Rows)
                {
                    row              = dtResult.NewRow();
                    row["SL No"]     = i;
                    row["Abbr"]      = dr["ABBR"];
                    row["Acno"]      = dr["ACC_NO"];
                    row["Client No"] = dr["CLIENT"];
                    row["Name"]      = dr["CLIENT_NAME"];
                    row["Balance"]   = string.Format("{0:0.00}", dr["ACC_BAL"]);
                    if (!DBNull.Value.Equals(dr["ACC_BAL"]))
                    {
                        dblBal = dblBal + Convert.ToDouble(dr["ACC_BAL"]);
                    }
                    row["Int Payable"] = string.Format("{0:0.00}", dr["DIFFAMT"]);
                    if (!DBNull.Value.Equals(dr["DIFFAMT"]))
                    {
                        dblDiffAmt = dblDiffAmt + Convert.ToDouble(dr["DIFFAMT"]);
                    }

                    //ADDED BY ROOPA ON 14032018
                    if (!DBNull.Value.Equals(dr["DEPDATE"]))
                    {
                        row["Deposit Date"] = String.Format("{0:dd/MM/yyyy}", dr["DEPDATE"]);
                    }
                    else
                    {
                        row["Deposit Date"] = "";
                    }

                    if (!DBNull.Value.Equals(dr["MATDATE"]))
                    {
                        row["Maturity Date"] = String.Format("{0:dd/MM/yyyy}", dr["MATDATE"]);
                    }
                    else
                    {
                        row["Maturity Date"] = "";
                    }

                    if (!DBNull.Value.Equals(dr["INTRATE"]))
                    {
                        row["Rate of Int(%)"] = dr["INTRATE"];
                    }

                    if (!DBNull.Value.Equals(dr["NOOFDAYS"]))
                    {
                        row["No. of Days Int Calu"] = dr["NOOFDAYS"];;
                    }
                    else
                    {
                        row["No. of Days Int Calu"] = 0;
                    }
                    //END

                    dtResult.Rows.Add(row);
                    i++;
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Data not found') </script>");
                return;
            }
            row                = dtResult.NewRow();
            row["Name"]        = "Total";
            row["Balance"]     = string.Format("{0:0.00}", dblBal);
            row["Int Payable"] = string.Format("{0:0.00}", dblDiffAmt);
            dtResult.Rows.Add(row);
            gvRptDisp.DataSource = dtResult;
            gvRptDisp.DataBind();
            (ViewState["Details"]) = dtResult;
        }
        catch (Exception ex)
        {
            string g = ex.Message;
            g = Regex.Replace(g, "[^a-zA-Z0-9_]+", " ");
            objlog.WriteLog("DepositIntPayableReport .aspx: Exception in btnSubmit_Click():" + g);
            ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('" + g + "')</script>");
            return;
        }
        finally
        {
            objlog.WriteLog("DepositIntPayableReport .aspx: btnSubmit_Click-->btnSubmit_Click events Finally block Executed  ");
        }
    }
Ejemplo n.º 5
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int              Slno = 1, namecnt = 1, nCnt = 1, Count = 0;
        double           dblTotAmt = 0.00, dblAmt = 0.00, dblcdAmt = 0.00, dblTotcdAmt = 0.00;
        string           strDesc    = "";
        DataTable        dtDetails  = new DataTable();
        DataTable        dtDailyExp = new DataTable();
        DateTime         temp;
        DataRow          grdmn1;
        OracleConnection oraConn;

        oraConn = objDataFetch.getSingletonConnectionInstance();
        OracleCommand cmd = new OracleCommand();

        try
        {
            if (!(DateTime.TryParse(txtAsonDate.Text, out temp)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert ('Enter a Valid Date.') </script>");
                return;
            }

            //if (txtNoOfYears.Text == string.Empty)
            //{
            //    txtNoOfYears.Text = "0";
            //}

            //cmd.Parameters.Clear();
            //cmd.Connection = oraConn;
            //cmd.CommandType = System.Data.CommandType.StoredProcedure;
            //cmd.CommandText = "HEAD.DAILY_EXCEPTION";
            //cmd.Parameters.Add(new OracleParameter("d_asondate", OracleType.DateTime)).Value = String.Format("{0:dd/MM/yyyy}", txtAsonDate.Text);
            //if (rblBrnConsol.SelectedValue.ToUpper().Trim() == "C")
            //{
            //    cmd.Parameters.Add(new OracleParameter("d_branch", OracleType.Number)).Value = DBNull.Value;
            //}
            //else
            //{
            //    cmd.Parameters.Add(new OracleParameter("d_branch", OracleType.Number)).Value =Convert.ToInt16(ddlBranch.SelectedValue);
            //}
            //cmd.Parameters.Add(new OracleParameter("d_detorsum", OracleType.VarChar)).Value ="'"+rblSumDet.SelectedItem.Text.Trim()+"'";
            //cmd.Parameters.Add(new OracleParameter("c_out", OracleType.Cursor)).Direction = ParameterDirection.Output;
            //OracleDataAdapter adp = new OracleDataAdapter(cmd);
            //adp.Fill(dtDetails);



            cmd.Parameters.Clear();
            cmd.Connection  = oraConn;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "HEAD.DAILY_EXCEPTION_CONSOLIDATED";
            cmd.Parameters.Add("d_asondate", OracleType.DateTime).Value = String.Format("{0:dd-MMM-yyyy}", txtAsonDate.Text);
            //if (rblBrnConsol.SelectedValue.ToUpper().Trim() == "C")
            //{
            //    cmd.Parameters.Add("d_branch", OracleType.Number).Value = DBNull.Value;
            //}
            //else
            //{
            cmd.Parameters.Add("d_branch", OracleType.Number).Value = Convert.ToInt16(ddlBranch.SelectedValue);
            // }

            cmd.Parameters.Add("d_detorsum", OracleType.VarChar).Value = rblSumDet.SelectedItem.Text.Trim().ToUpper();

            cmd.Parameters.Add("c_out", OracleType.Cursor).Direction = System.Data.ParameterDirection.Output;
            OracleDataAdapter adp = new OracleDataAdapter(cmd);
            adp.Fill(dtDetails);


            if (dtDetails.Rows.Count > 0)
            {
                if (rblSumDet.SelectedValue == "S")
                {
                    dtDailyExp.Columns.Add(new DataColumn("SlNo", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("No of Accounts", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Description", typeof(string)));

                    foreach (DataRow rgrd1 in dtDetails.Rows)
                    {
                        grdmn1         = dtDailyExp.NewRow();
                        grdmn1["SlNo"] = Slno;

                        if (!DBNull.Value.Equals(rgrd1["NOACCOUNTS"]))
                        {
                            grdmn1["No of Accounts"] = rgrd1["NOACCOUNTS"].ToString();
                        }

                        if (!DBNull.Value.Equals(rgrd1["D_DESCRIPTION"]))
                        {
                            grdmn1["Description"] = rgrd1["D_DESCRIPTION"].ToString();
                        }
                        dtDailyExp.Rows.Add(grdmn1);
                        Slno++;
                    }
                }
                else
                {
                    dtDailyExp.Columns.Add(new DataColumn("SlNo", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Name", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("PAN No", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("A/c No", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Branch", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Amount", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Debit/CreditAmt", typeof(string)));
                    dtDailyExp.Columns.Add(new DataColumn("Debit/Credit", typeof(string)));

                    // dtDailyExp.Columns.Add(new DataColumn("Description", typeof(string)));

                    foreach (DataRow rgrd1 in dtDetails.Rows)
                    {
                        if ((strDesc != string.Empty) && (strDesc != rgrd1["D_DESCRIPTION"].ToString()))
                        {
                            grdmn1                    = dtDailyExp.NewRow();
                            grdmn1["PAN No"]          = "Total no. of Accounts";
                            grdmn1["A/c No"]          = Count;
                            grdmn1["Branch"]          = "TOTAL";
                            grdmn1["Amount"]          = String.Format("{0:0.00}", dblAmt);
                            grdmn1["Debit/CreditAmt"] = String.Format("{0:0.00}", dblcdAmt);
                            dblTotAmt                += dblAmt;
                            dblTotcdAmt              += dblcdAmt;
                            dtDailyExp.Rows.Add(grdmn1);
                            dblAmt   = 0.00;
                            dblcdAmt = 0.00;
                            Count    = 0;
                            //Slno++;
                            namecnt = 1;

                            grdmn1 = dtDailyExp.NewRow();
                            dtDailyExp.Rows.Add(grdmn1);
                        }

                        if (namecnt == 1)
                        {
                            grdmn1 = dtDailyExp.NewRow();
                            if (!DBNull.Value.Equals(rgrd1["D_DESCRIPTION"]))
                            {
                                grdmn1["Name"] = rgrd1["D_DESCRIPTION"].ToString();
                            }
                            dtDailyExp.Rows.Add(grdmn1);

                            grdmn1 = dtDailyExp.NewRow();

                            grdmn1["SlNo"] = Slno;
                            Count++;
                            if (!DBNull.Value.Equals(rgrd1["D_CNAME"]))
                            {
                                grdmn1["Name"] = rgrd1["D_CNAME"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_PAMNO"]))
                            {
                                grdmn1["PAN No"] = rgrd1["D_PAMNO"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_ABBR"]))
                            {
                                grdmn1["A/c No"] = rgrd1["D_ABBR"].ToString() + "-" + rgrd1["D_ACNO"];
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_BRANCH"]))
                            {
                                grdmn1["Branch"] = rgrd1["D_BRANCH"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_AMOUNT"]))
                            {
                                grdmn1["Amount"] = String.Format("{0:0.00}", rgrd1["D_AMOUNT"]);
                                dblAmt           = dblAmt + Convert.ToDouble(rgrd1["D_AMOUNT"]);

                                //dblTotAmt = dblTotAmt + Convert.ToDouble(rgrd1["AMOUNT"]);
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_DEBITORCREDITAMOUNT"]))
                            {
                                grdmn1["Debit/CreditAmt"] = String.Format("{0:0.00}", rgrd1["D_DEBITORCREDITAMOUNT"]);
                                dblcdAmt = dblcdAmt + Convert.ToDouble(rgrd1["D_DEBITORCREDITAMOUNT"]);
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_DRCR"]))
                            {
                                grdmn1["Debit/Credit"] = String.Format("{0:0.00}", rgrd1["D_DRCR"]);
                            }


                            //if (!DBNull.Value.Equals(rgrd1["D_DESCRIPTION"]))
                            //{
                            //    grdmn1["Description"] = rgrd1["D_DESCRIPTION"].ToString();
                            //}

                            dtDailyExp.Rows.Add(grdmn1);
                        }
                        else if ((strDesc != string.Empty) && (strDesc == rgrd1["D_DESCRIPTION"].ToString()))
                        {
                            grdmn1 = dtDailyExp.NewRow();

                            grdmn1["SlNo"] = Slno;
                            Count++;
                            if (!DBNull.Value.Equals(rgrd1["D_CNAME"]))
                            {
                                grdmn1["Name"] = rgrd1["D_CNAME"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_PAMNO"]))
                            {
                                grdmn1["PAN No"] = rgrd1["D_PAMNO"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_ABBR"]))
                            {
                                grdmn1["A/c No"] = rgrd1["D_ABBR"].ToString() + "-" + rgrd1["D_ACNO"];
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_BRANCH"]))
                            {
                                grdmn1["Branch"] = rgrd1["D_BRANCH"].ToString();
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_AMOUNT"]))
                            {
                                grdmn1["Amount"] = String.Format("{0:0.00}", rgrd1["D_AMOUNT"]);
                                // dblTotAmt = dblTotAmt + Convert.ToDouble(rgrd1["AMOUNT"]);
                                dblAmt = dblAmt + Convert.ToDouble(rgrd1["D_AMOUNT"]);
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_DEBITORCREDITAMOUNT"]))
                            {
                                grdmn1["Debit/CreditAmt"] = String.Format("{0:0.00}", rgrd1["D_DEBITORCREDITAMOUNT"]);
                                dblcdAmt = dblcdAmt + Convert.ToDouble(rgrd1["D_DEBITORCREDITAMOUNT"]);
                            }

                            if (!DBNull.Value.Equals(rgrd1["D_DRCR"]))
                            {
                                grdmn1["Debit/Credit"] = String.Format("{0:0.00}", rgrd1["D_DRCR"]);
                            }

                            //if (!DBNull.Value.Equals(rgrd1["D_DESCRIPTION"]))
                            //{
                            //    grdmn1["Description"] = rgrd1["D_DESCRIPTION"].ToString();
                            //}

                            dtDailyExp.Rows.Add(grdmn1);
                        }

                        if (!DBNull.Value.Equals(rgrd1["D_DESCRIPTION"]))
                        {
                            strDesc = rgrd1["D_DESCRIPTION"].ToString();
                        }
                        Slno++;
                        namecnt++;
                        //  nCnt++;
                        //if (!DBNull.Value.Equals(dtPosting.Rows[i]["ClientNo"]))
                        //{
                        //    strClient = dtPosting.Rows[i]["ClientNo"].ToString();
                        //}
                    }

                    grdmn1                    = dtDailyExp.NewRow();
                    grdmn1["PAN No"]          = "Total no. of Accounts";
                    grdmn1["A/c No"]          = Count;
                    grdmn1["Branch"]          = "TOTAL";
                    grdmn1["Amount"]          = String.Format("{0:0.00}", dblAmt);
                    grdmn1["Debit/CreditAmt"] = String.Format("{0:0.00}", dblcdAmt);
                    dtDailyExp.Rows.Add(grdmn1);
                    dblTotAmt   += dblAmt;
                    dblTotcdAmt += dblcdAmt;
                    Count        = 0;
                    dblcdAmt     = 0.00;

                    grdmn1 = dtDailyExp.NewRow();
                    dtDailyExp.Rows.Add(grdmn1);

                    grdmn1                    = dtDailyExp.NewRow();
                    grdmn1["Branch"]          = "GRAND TOTAL";
                    grdmn1["Amount"]          = String.Format("{0:0.00}", dblTotAmt);
                    grdmn1["Debit/CreditAmt"] = String.Format("{0:0.00}", dblTotcdAmt);
                    dtDailyExp.Rows.Add(grdmn1);
                }

                pnlGrid.Visible      = true;
                lblBank.Visible      = true;
                lblBranch.Visible    = true;
                lblHeading.Visible   = true;
                lblBank.Text         = global.BankName();
                lblBranch.Text       = Session["LoginBranchName"].ToString().Trim();
                lblHeading.Text      = "DAILY EXCEPTIONAL REPORT AS ON " + txtAsonDate.Text + "";
                gvDetails.DataSource = dtDailyExp;
                gvDetails.DataBind();
                Session["dtDetails"] = dtDailyExp;

                //objFrmPt.FormatGridView(gvDetails);
                //GridPrint(gvDetails);

                ViewState["Pagename"] = "DAILYEXCEPTIONALREPORT";
                imgxl0.Visible        = true;
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('Data Not Found.')</script>");
                imgxl0.Visible  = false;
                pnlGrid.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            string g = ex.Message + ex;
            g = Regex.Replace(g, "[^a-zA-Z0-9_]+", " ");
            objLog.WriteLog("DailyExcepRep.aspx-->Exception in btnOK_Click() Event" + g);
            ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('" + g + "')</script>");
            return;
        }
        finally
        {
            objLog.WriteLog("DailyExcepRep.aspx-->btnOK_Click() Event Reached finally block without any exceptions.");
        }
    }