OFBiz
  1. OFBiz
  2. OFBIZ-1806

automatically set countyGeoId from postalCode and countryGeoId?

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Is there anything which automatically sets countyGeoId from postal code + countryGeoId? If not, how does one calculate county level taxes?

        Activity

        Hide
        Si Chen added a comment -

        screenshot of order in ZIP code 84057 but no Utah county sales tax was assessed

        Show
        Si Chen added a comment - screenshot of order in ZIP code 84057 but no Utah county sales tax was assessed
        Hide
        Si Chen added a comment -

        I'm sorry David, but this does not work for me. I could not access the trunk demo at http://demo.hotwaxmedia.com/ecommerce/control/main but I was able to use your release 4.0 demo, and since this code is really not changed, I think it should be more or less the same. I loaded the additional setup for ZIP code 84057 and for the Utah county sales tax in Web tools, and then I created an order for a new customer in the 84057 zip code. However, as you can see from the screenshot, no Utah county sales tax was charged. You can also look at this order here:
        https://demo40.hotwaxmedia.com/ordermgr/control/orderview?orderId=WS10000

        Does anybody get a Utah county sales tax added to orders for DemoCustomer?

        Also, looking at the code, TaxAuthorityServices.java seems to be calling:
        geoIdSet = GeoWorker.expandGeoRegionDeep(geoIdSet, delegator);

        which in turn:
        Set geoIdSetTemp = FastSet.newInstance();
        Iterator geoIdIter = geoIdSet.iterator();
        while (geoIdIter.hasNext()) {
        String curGeoId = (String) geoIdIter.next();
        List geoAssocList = delegator.findByAndCache("GeoAssoc", UtilMisc.toMap("geoIdTo", curGeoId, "geoAssocTypeId", "REGIONS"));
        Iterator geoAssocIter = geoAssocList.iterator();
        while (geoAssocIter.hasNext())

        { GenericValue geoAssoc = (GenericValue) geoAssocIter.next(); geoIdSetTemp.add(geoAssoc.get("geoId")); }

        }
        geoIdSetTemp = expandGeoRegionDeep(geoIdSetTemp, delegator);

        I can see that it is traversing down GeoAssoc recursively, but I don't see anything that looks for the ST_ZIPCO format here or anywhere else. If you could just enlighten me as to where this code might be, I'd be happy to go root around for it.

        Show
        Si Chen added a comment - I'm sorry David, but this does not work for me. I could not access the trunk demo at http://demo.hotwaxmedia.com/ecommerce/control/main but I was able to use your release 4.0 demo, and since this code is really not changed, I think it should be more or less the same. I loaded the additional setup for ZIP code 84057 and for the Utah county sales tax in Web tools, and then I created an order for a new customer in the 84057 zip code. However, as you can see from the screenshot, no Utah county sales tax was charged. You can also look at this order here: https://demo40.hotwaxmedia.com/ordermgr/control/orderview?orderId=WS10000 Does anybody get a Utah county sales tax added to orders for DemoCustomer? Also, looking at the code, TaxAuthorityServices.java seems to be calling: geoIdSet = GeoWorker.expandGeoRegionDeep(geoIdSet, delegator); which in turn: Set geoIdSetTemp = FastSet.newInstance(); Iterator geoIdIter = geoIdSet.iterator(); while (geoIdIter.hasNext()) { String curGeoId = (String) geoIdIter.next(); List geoAssocList = delegator.findByAndCache("GeoAssoc", UtilMisc.toMap("geoIdTo", curGeoId, "geoAssocTypeId", "REGIONS")); Iterator geoAssocIter = geoAssocList.iterator(); while (geoAssocIter.hasNext()) { GenericValue geoAssoc = (GenericValue) geoAssocIter.next(); geoIdSetTemp.add(geoAssoc.get("geoId")); } } geoIdSetTemp = expandGeoRegionDeep(geoIdSetTemp, delegator); I can see that it is traversing down GeoAssoc recursively, but I don't see anything that looks for the ST_ZIPCO format here or anywhere else. If you could just enlighten me as to where this code might be, I'd be happy to go root around for it.
        Hide
        David E. Jones added a comment -

        You don't need to explicitly specify the county. As long as you have the zip code Geo setup with the ID in the ST_ZIPCO format it will find it, and then as long as you have the rollup between the zip code and the county defined it will find it when it expands the Geo records to include all parent records.

        Show
        David E. Jones added a comment - You don't need to explicitly specify the county. As long as you have the zip code Geo setup with the ID in the ST_ZIPCO format it will find it, and then as long as you have the rollup between the zip code and the county defined it will find it when it expands the Geo records to include all parent records.
        Hide
        Si Chen added a comment -

        TaxAuthorityServices will consider countyGeoId in tax calculations, and there is the Geo rollup you describe. However, I can find no code for populating countyGeoId from postal code or anything else, unless users are supposed to enter their county?

        Show
        Si Chen added a comment - TaxAuthorityServices will consider countyGeoId in tax calculations, and there is the Geo rollup you describe. However, I can find no code for populating countyGeoId from postal code or anything else, unless users are supposed to enter their county?
        Hide
        Jacques Le Roux added a comment -

        Then whould we not close ? :o)

        Show
        Jacques Le Roux added a comment - Then whould we not close ? :o)
        Hide
        David E. Jones added a comment -

        Would this question be better asked on the user mailing list?

        Whatever the case, there is support for this already implemented with the TaxAuthority and Geo rollup (through GeoAssoc). There is even some demo data for a few zip codes in Utah (only because I happen to know a few here). Anyway, this stuff is years old and fairly stable with a few options for figuring out the County, etc based on the zip code and state, or any other rollup just depending on how you setup your Geo rollup and TaxAuthority records.

        Show
        David E. Jones added a comment - Would this question be better asked on the user mailing list? Whatever the case, there is support for this already implemented with the TaxAuthority and Geo rollup (through GeoAssoc). There is even some demo data for a few zip codes in Utah (only because I happen to know a few here). Anyway, this stuff is years old and fairly stable with a few options for figuring out the County, etc based on the zip code and state, or any other rollup just depending on how you setup your Geo rollup and TaxAuthority records.
        Hide
        Chris Howe added a comment -

        Postal code is an unreliable indicator of taxing jurisdiction, in general but specifically in the case of county taxes. A postal code often times crosses county lines (zip+4 may offer increased reliability, but I don't believe that is even perfect). The only certain way to determine county without prompting the customer would be to geocode the address and then compare that result within a geospatial database.

        This is perhaps overkill of a solution and would probably be better accommodated by assuming county if postal code is fully within a county and then returning to prompt the user if there are multiple county options. Or even easier prompt the user if/when the state he chooses requires county specification to determine taxes.

        Show
        Chris Howe added a comment - Postal code is an unreliable indicator of taxing jurisdiction, in general but specifically in the case of county taxes. A postal code often times crosses county lines (zip+4 may offer increased reliability, but I don't believe that is even perfect). The only certain way to determine county without prompting the customer would be to geocode the address and then compare that result within a geospatial database. This is perhaps overkill of a solution and would probably be better accommodated by assuming county if postal code is fully within a county and then returning to prompt the user if there are multiple county options. Or even easier prompt the user if/when the state he chooses requires county specification to determine taxes.

          People

          • Assignee:
            Unassigned
            Reporter:
            Si Chen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development