Example #1
0
        private DataTable Search()
        {
            db = new DatabaseClass();

            string sql = "";
            string orderByPart = "ORDER BY JournalCode ";

            if (radCashRecipt.Checked)
            {
                #region radCashRecipt

                sql = "SELECT * FROM vwCashRecieptsReport WHERE CR_No IS NOT NULL ";
                if (ddlProfitCenters.SelectedValue != "0")
                    sql = string.Format("{0} AND CenterID={1} ", sql, ddlProfitCenters.SelectedValue);

                if (txtFrom2.SelectedDate != null)
                    sql = string.Format("{0} AND TransactionDate>='{1}' ", sql, DatabaseClass.FormatDateString(txtFrom2.SelectedDate.ToString()));

                if (txtTo2.SelectedDate != null)
                    sql = string.Format(" {0} AND TransactionDate<='{1}' ", sql, DatabaseClass.FormatDateString(txtTo2.SelectedDate.ToString()));

                sql = string.Format("{0} {1} ", sql, orderByPart);
                return db.ExecuteQuery(sql);

                #endregion
            }
            else if (radChequeRecipt.Checked)
            {
                #region radChequeRecipt

                sql = "SELECT * FROM vwChequeRecieptsReport  WHERE CR_No IS NOT NULL ";
                if (ddlProfitCenters.SelectedValue != "0")
                    sql = string.Format("{0} AND CenterID={1} ", sql, ddlProfitCenters.SelectedValue);

                if (txtFrom2.SelectedDate != null)
                    sql = string.Format("{0} AND TransactionDate>='{1}' ", sql, DatabaseClass.FormatDateString(txtFrom2.SelectedDate.ToString()));

                if (txtTo2.SelectedDate != null)
                    sql = string.Format(" {0} AND TransactionDate<='{1}' ", sql, DatabaseClass.FormatDateString(txtTo2.SelectedDate.ToString()));

                sql = string.Format("{0} {1} ", sql, orderByPart);
                return db.ExecuteQuery(sql);

                #endregion
            }
            else if (radCashDisburment.Checked)
            {
                #region radCashDisburment

                sql = "SELECT * FROM vwCashDisbursementsReport  WHERE CD_No IS NOT NULL ";
                if (ddlProfitCenters.SelectedValue != "0")
                    sql = string.Format("{0} AND CenterID={1} ", sql, ddlProfitCenters.SelectedValue);

                if (txtFrom2.SelectedDate != null)
                    sql = string.Format("{0} AND TransactionDate>='{1}' ", sql, DatabaseClass.FormatDateString(txtFrom2.SelectedDate.ToString()));

                if (txtTo2.SelectedDate != null)
                    sql = string.Format(" {0} AND TransactionDate<='{1}' ", sql, DatabaseClass.FormatDateString(txtTo2.SelectedDate.ToString()));

                sql = string.Format("{0} {1} ", sql, orderByPart);
                return db.ExecuteQuery(sql);

                #endregion
            }
            else if (radChequeDisburment.Checked)
            {
                #region radChequeDisburment

                sql = "SELECT * FROM vwChequeDisbursementsReport  WHERE CD_No IS NOT NULL ";
                if (ddlProfitCenters.SelectedValue != "0")
                    sql = string.Format("{0} AND CenterID={1} ", sql, ddlProfitCenters.SelectedValue);

                if (txtFrom2.SelectedDate != null)
                    sql = string.Format("{0} AND TransactionDate>='{1}' ", sql, DatabaseClass.FormatDateString(txtFrom2.SelectedDate.ToString()));

                if (txtTo2.SelectedDate != null)
                    sql = string.Format(" {0} AND TransactionDate<='{1}' ", sql, DatabaseClass.FormatDateString(txtTo2.SelectedDate.ToString()));

                sql = string.Format("{0} {1} ", sql, orderByPart);
                return db.ExecuteQuery(sql);

                #endregion
            }
            else
                return new DataTable();
        }
Example #2
0
        protected void btnPrint_Click1(object sender, EventArgs e)
        {
            try
            {
                string sql = "";
                lblFeedBack.Text = "";

                db = new DatabaseClass();

                if (radCashRecipt.Checked)
                {
                    sql = string.Format("SELECT * FROM vwCashRecieptsReport WHERE CR_NO={0} ORDER BY JournalCode ", int.Parse(txtCRNo.Text));
                    DataTable dt = db.ExecuteQuery(sql);
                    if (dt.Rows.Count > 0)
                    {
                        Session["vwCashRecieptsReport"] = dt;

                        string url = "ViewCashReceiptReport.aspx";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewCashReceiptReport", "window.open('" + url + "', '_new')", true);
                    }
                    else
                        lblFeedBack.Text = "No Data";

                }
                else if (radChequeRecipt.Checked)
                {
                    sql = string.Format("SELECT * FROM vwChequeRecieptsReport WHERE CR_NO={0} ORDER BY JournalCode ", int.Parse(txtCRNo.Text));
                    DataTable dt = db.ExecuteQuery(sql);
                    if (dt.Rows.Count > 0)
                    {
                        Session["vwChequeRecieptsReport"] = dt;

                        string url = "ViewChequeRecieptReport.aspx";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeRecieptReport", "window.open('" + url + "', '_new')", true);
                    }
                    else
                        lblFeedBack.Text = "No Data";

                    //sql = string.Format("SELECT * FROM vwChequeMgmtFullInfo WHERE RecordID={0} ", int.Parse(txtCRNo.Text));
                    //DataTable dt = db.ExecuteQuery(sql);
                    //if (dt.Rows.Count > 0)
                    //{
                    //    Session["vwChequeMgmtFullInfo"] = dt;

                    //    string url = "ViewChequeRecieptReport.aspx";
                    //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeRecieptReport", "window.open('" + url + "', '_new')", true);
                    //}
                    //else
                    //    lblFeedback.Text = "No Data";

                }
                else if (radCashDisburment.Checked)
                {
                    sql = string.Format("SELECT * FROM vwCashDisbursementsReport WHERE CD_NO={0} ORDER BY JournalCode ", int.Parse(txtCDNo.Text));
                    DataTable dt = db.ExecuteQuery(sql);
                    if (dt.Rows.Count > 0)
                    {
                        Session["vwCashDisbusrsesReport"] = dt;

                        string url = "ViewCashDisbursesReport.aspx";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewCashDisbursesReport", "window.open('" + url + "', '_new')", true);
                    }
                    else
                        lblFeedBack.Text = "No Data";

                }
                else if (radChequehDisburment.Checked)
                {
                    sql = string.Format("SELECT * FROM vwChequeDisbursementsReport WHERE CD_NO={0} ORDER BY JournalCode ", int.Parse(txtCDNo.Text));
                    DataTable dt = db.ExecuteQuery(sql);
                    if (dt.Rows.Count > 0)
                    {
                        Session["vwChequeDisbursementsReport"] = dt;

                        string url = "ViewChequeDisbursesReport.aspx";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeDisbursesReport", "window.open('" + url + "', '_new')", true);
                    }
                    else
                        lblFeedBack.Text = "No Data";

                    //sql = string.Format("SELECT * FROM vwChequeMgmtFullInfo WHERE RecordID={0} ", int.Parse(txtCDNo.Text));
                    //DataTable dt = db.ExecuteQuery(sql);
                    //if (dt.Rows.Count > 0)
                    //{
                    //    Session["vwChequeMgmtFullInfo"] = dt;

                    //    string url = "ViewChequeDisbursesReport.aspx";
                    //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeRecieptReport", "window.open('" + url + "', '_new')", true);
                    //}
                    //else
                    //    lblFeedback.Text = "No Data";
                }
                else
                    lblFeedBack.Text = "No Data";

                ClearControls(sender);
                ddlCurrencies_SelectedIndexChanged(sender, new EventArgs());

            }
            catch (Exception ex)
            {
                lblFeedBack.Text = ex.Message;
            }
        }
Example #3
0
        protected void gvResults_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "SendByEmail")
                {

                }
                else if (e.CommandName == "Print")
                {
                    db = new DatabaseClass();

                    DataTable dtResult;
                    int transID = int.Parse(e.CommandArgument.ToString()); //int.Parse(gvResults.SelectedValue.ToString());

                    string sql = string.Format("SELECT TOP 1 IsCheque, IsCashReciept, isCashDisburment  FROM vwGLMasterDetailed WHERE transactionid={0} ", transID);
                    DataTable dt = db.ExecuteQuery(sql);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        if (bool.Parse(dr["IsCheque"].ToString()))
                        {
                            if (bool.Parse(dr["IsCashReciept"].ToString()))
                            {
                                sql = string.Format("SELECT * FROM vwChequeRecieptsReport WHERE TransactionId={0} AND CR_NO IS NOT NULL  ", transID);
                                dtResult = db.ExecuteQuery(sql);
                                if (dtResult.Rows.Count > 0)
                                {
                                    Session["vwChequeRecieptsReport"] = dtResult;

                                    string url = "ViewChequeRecieptReport.aspx";
                                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeRecieptReport", "window.open('" + url + "', '_new')", true);
                                }
                                else
                                    lblFeedback.Text = "No Data";

                            }
                            else if (bool.Parse(dr["isCashDisburment"].ToString()))
                            {
                                sql = string.Format("SELECT * FROM vwChequeDisbursementsReport WHERE TransactionId={0} AND CD_NO IS NOT NULL ", transID);
                                dtResult = db.ExecuteQuery(sql);
                                if (dtResult.Rows.Count > 0)
                                {
                                    Session["vwChequeDisbursementsReport"] = dtResult;

                                    string url = "ViewChequeDisbursesReport.aspx";
                                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewChequeDisbursesReport.aspx", "window.open('" + url + "', '_new')", true);
                                }
                                else
                                    lblFeedback.Text = "No Data";
                            }
                            else
                                lblFeedback.Text = "No Data";
                        }
                        else
                        {
                            if (bool.Parse(dr["IsCashReciept"].ToString()))
                            {
                                sql = string.Format("SELECT * FROM vwCashRecieptsReport WHERE TransactionId={0} AND CR_NO IS NOT NULL  ", transID);
                                dtResult = db.ExecuteQuery(sql);
                                if (dtResult.Rows.Count > 0)
                                {
                                    Session["vwCashRecieptsReport"] = dtResult;

                                    string url = "ViewCashReceiptReport.aspx";
                                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewCashReceiptReport", "window.open('" + url + "', '_new')", true);
                                }
                                else
                                    lblFeedback.Text = "No Data";

                            }
                            else if (bool.Parse(dr["isCashDisburment"].ToString()))
                            {
                                sql = string.Format("SELECT * FROM vwCashDisbursementsReport WHERE TransactionId={0} AND CD_NO IS NOT NULL  ", transID);
                                dtResult = db.ExecuteQuery(sql);
                                if (dtResult.Rows.Count > 0)
                                {
                                    Session["vwCashDisbusrsesReport"] = dtResult;

                                    string url = "ViewCashDisbursesReport.aspx";
                                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectViewCashDisbursesReport", "window.open('" + url + "', '_new')", true);
                                }
                                else
                                    lblFeedback.Text = "No Data";
                            }
                            else
                                lblFeedback.Text = "No Data";
                        }
                    }
                    else
                        lblFeedback.Text = "No Data";
                }

            }
            catch (Exception ex)
            {
                lblFeedback.Text = ex.Message;
            }
        }