Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: sprocs for taxrate

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default sprocs for taxrate

    I have modified the stored procedures for getting the state tax rate (aspdnsf_getStateTaxRate, aspdnsf_getStateTaxRatebyID). I have attached my modification script to this post. My problem is that it is still pulling the tax rate straight from what the value is set to in the taxrate table. This makes me think that nothing is looking at these sprocs and it's calculated elsewhere. Any ideas?
    Attached Files Attached Files

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    What exactly you're trying to achieve?

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I am trying to have the system look at my other table and pull the tax rate for an ohio county if the state ID is 44. I tried just changing the stored proc to start with but it always pulls the percent from the state tax table even though I put the if @stateid=44 in the sproc.

  4. #4
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I took the aspdnsf_GetStateTaxRate & GetStateTaxRateByID sprocs completely out and the tax still calculates. I thought the script looked at those sprocs to calculate the tax?

  5. #5
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    So deleting the sprocs for getting the state tax rate doesn't effect the application. It still continues to calculate state taxes. I cannot find how it is doing this though. I have searched StateTaxRate.cs and Prices.cs w/ no success

  6. #6
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I think I may have tracked down the code but I'm not 100% sure. I am modified line 260 in StateTaxRate.cs to be the following but this throws the error "Object reference not set to an instance of an object":

    Code:
    public StateTaxRates()
            {
                m_StateTaxRates = new SortedList();
                object customersession = HttpContext.Current.Session["CustomerID"];
                int customer;
                customer = (int)customersession;
    
                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS("aspdnsf_getStateTaxRate " + customer.ToString(), con))
                    {
                        while (rs.Read())
                        {
                            m_StateTaxRates.Add(DB.RSFieldInt(rs, "StateTaxID"), new StateTaxRate(DB.RSFieldInt(rs, "StateTaxID"), DB.RSFieldInt(rs, "StateID"), DB.RSFieldInt(rs, "TaxClassID"), DB.RSField(rs, "StateName"), DB.RSField(rs, "TaxClass"), DB.RSFieldDecimal(rs, "TaxRate"), DB.RSFieldDateTime(rs, "CreatedOn")));
                        }
                    }
                }
    Any ideas why I'm getting this error or if this is even the right spot to modify?
    Last edited by chrismartz; 05-19-2010 at 12:44 PM.

  7. #7
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I have my sproc fixed and running just how I want. The only issue is that when I choose a county and submit that change, it changes in the db but not in the application. It seems that if I don't change the state, the tax rate doesn't get re-pulled from the database. Is there something that runs when the state is changed and submitted that it goes out and re-calculates the tax?