예제 #1
0
 public bool Delete(int RecordID)
 {
     string sql = string.Format("DELETE FROM ChequeMgmt WHERE RecordID={0} ", RecordID);
     int rows = new DatabaseClass().ExecuteNonQuery(sql);
     if (rows > 0)
         return true;
     else
         return false;
 }
예제 #2
0
    //public int PurchaseInvoiceJType { get; set; }
    //public int SaleInvoiceJType { get; set; }
    public StockSales08Configurations()
    {
        string sql = "SELECT TOP 1 ISNULL(CashAccountID, 0) AS CashAccountID, ISNULL(SettlementAccountID, 0) AS SettlementAccountID, ISNULL(BankAccountID, 0) AS BankAccountID, ISNULL(TaxVatAccount, 0) AS TaxVatAccount, ISNULL(DefaultCurrency, 0) AS DefaultCurrency, ISNULL(VatRatio, 0) AS VatRatio, ISNULL(DebitorsUpperAccountID, 0) AS DebitorsUpperAccountID, ISNULL(CreditorsUpperAccountID, 0) AS CreditorsUpperAccountID, ISNULL(LoansUpperAccountID, 0) AS LoansUpperAccountID FROM Configrations ";
        DataTable dt = new DatabaseClass().ExecuteQuery(sql);
        if (dt.Rows.Count == 1)
        {
            DataRow dr = dt.Rows[0];
            CashAccount = int.Parse(dr["CashAccountID"].ToString());
            SettlementAccountID = int.Parse(dr["SettlementAccountID"].ToString());
            BankAccountID = int.Parse(dr["BankAccountID"].ToString());
            TaxVatAccount = int.Parse(dr["TaxVatAccount"].ToString());

            DefaultCurrencyID = int.Parse(dr["DefaultCurrency"].ToString());

            VatRatio = decimal.Parse(dr["VatRatio"].ToString());

            DebitorsUpperAccountID = int.Parse(dr["DebitorsUpperAccountID"].ToString());
            CreditorsUpperAccountID = int.Parse(dr["CreditorsUpperAccountID"].ToString());
            LoansUpperAccountID = int.Parse(dr["LoansUpperAccountID"].ToString());
        }
        else
        {
            CashAccount = 0;
            SettlementAccountID = 0;
            BankAccountID = 0;
            TaxVatAccount = 0;

            DefaultCurrencyID = 0;
            CurrentYear = 0;

            VatRatio = 0;

            DebitorsUpperAccountID = 0;
            CreditorsUpperAccountID = 0;
            LoansUpperAccountID = 0;
        }
    }
예제 #3
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;
            }
        }
예제 #4
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();
        }
예제 #5
0
        private static DataView GetData()
        {
            DataView view = (DataView)HttpContext.Current.Cache["Suggestions"];
            if (view == null)
            {
                string sql = "SELECT * FROM Emails ORDER BY EmailAddress ";
                view = new DatabaseClass().ExecuteQuery(sql).DefaultView;
                HttpContext.Current.Cache["Suggestions"] = view;
            }

            return view;
        }
예제 #6
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;
            }
        }
예제 #7
0
        public bool Update(string ChequeNo,string CheqeDate,int ChequeStatus,int BankId,decimal Amount,string AddressTo,int CurrencyId,string Description,int UserId,int RecordId)
        {
            string sql = string.Format("UPDATE ChequeMgmt SET ChequeNum='{0}', ChequeDueDate='{1}', ChequeStatus={2}, BankID={3}, ChequeAmount={4}, WrittenTo='{5}', ChequeCurrencyID={6}, Description='{7}', EditDate=GETDATE(), EditUserId={8} WHERE RecordID={9} ",
                ChequeNo, DatabaseClass.FormatDateString(CheqeDate),
                 ChequeStatus, BankId, Amount, AddressTo,
                 CurrencyId, Description, UserId, RecordId);

            int rows = new DatabaseClass().ExecuteNonQuery(sql);
            if (rows > 0)
                return true;
            else
                return false;
        }