Custom Customer Field (for sales tax code)
I am trying to setup OpenVPMS for my brother's upcoming mobile veterinary practice in Texas (USA).
The problem is that in Texas, he has to charge sales tax based upon the place the service/sale is delivered - so he will have to keep track of each client's specific tax location code.
My current idea for how to handle it is this:
- add taxes per location
- add exemptions per customer to every tax except their specific location
- add field(s) to handle up to 4 tax location codes (each location can have up to 4 taxing entities - county, city, special district, & transit authorities)
- create a custom report that reports taxes collected based on the location codes
I am familiar with programming, and with php/mysql/etc, but basically not at all with Java. I may be able to get help from my sister, who is more familiar with Java.
I have read as much as I can find on how OpenVPMS archetypes, etc work, but am not sure of the feasibility ... or how exactly to get about the last two points - custom field & custom report.
Any pointers or alternative suggestions. Thanks!
Re: Custom Customer Field (for sales tax code)
Humm - what you want to do will almost certainly require modifications to the java code and not just the archetypes.
Some questions:
a) by 'location' do you mean the location where the practice is or the customer's address? Because of the phase "based upon the place the service/sale is delivered" & the fact that this is a mobile practice, I suspect you mean the customer's address. Some googling found me https://comptroller.texas.gov/taxes/sales/city.php so I now understand the problem. There is a large OpenVPMS user in Texas - but they run an number of "fixed" practices and hence presumably each practice location has a fixed state+local tax.
b) when reporting, can you get away with knowing that the customer's tax location is X and that the state/city/special district/transit authority are a,b,c and d and given that they were charged $T in total tax that the breakdown can be calculated as T*a/(a+b+c+d) for the state tax and similarly for the others. [I am trying to stay away from recording each of the tax amounts against each invoice etc line item.]
If a) and b) are true, then you should be able to get away with:
1) add a lookup lookup.locationTax containing the 4 tax rates for each tax location;
2) modifying the party.customerperson archetype to add a tax location field (which is verified against the lookup.taxLocation lookup location)
3) modifying the java code that does the tax calculation using the locationTax lookup
WARNING: the above are just my thoughts and may not be the optimum answer
Note also that most enhancements to OpenVPMS are done via the project mechanism - see http://www.openvpms.org/projects - ie a practice decides that it wants feature X - this gets discussed and specified then development costs it; the practice commits the funds and it is put into the development queue. The feature then become part of the standard OpenVPMS release. Although this does have the downside of making the sexy new facility that you paid for available to all, it has the massive advantage that you do not have to manage inserting your modifications into each future release.
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
a) yes - customer address
b) all I really need to know are (1) the total tax to charge the customer (which is usually approximated by zip code - not perfect, but pretty close) and (2) the total *sales* generated in a certain taxing district for tax reporting purposes (so one $100 sale in College Station would report $100 for Brazos County, $100 for College Station, and potentially $100 for a transit authority and $100 for a special district).
In other words, I don't really need the tax per jurisdiction per invoice or line item to be recorded. Would it be nice? Sure. Necessary? - not really, you don't report the actual amount of tax you collected - the state is concerned with what you owe whether or not you remembered to collect it. I just need to be able to query the amount of sales in a given date range filtered by customers having a certain tax code.
Short answer - yes, B is true.
I will look into the project mechanism. My brother is just establishing and operating on a shoestring budget (which explains why a biomechanical engineer is handling the IT ...!) - so I'm not sure there is an ability to contribute towards features at the present moment, much as I'd like it to be.
Thank you for the help --- this looks doable and the pointers are VERY helpful!
Re: Custom Customer Field (for sales tax code)
The way to do this presently would be to:
You would need to develop a JasperReport report that works out the individual tax components from invoices, counter sales and credits.
The main disadvantage with this is that you need to be diligent about adding/removing Tax Exemptions for customer. A better solution would be to identify the geographic regions that tax rates apply, so that the Tax Exclusions would be automatically determined by the customer's postcode/zipcode.
In OpenVPMS 2.0, there will be support to have different tax rates per Practice Location. You could use this to set up Practice Locations for each tax region in the state; when invoicing a particular customer, you would select the relevent Practice Location corresponding to their physical address. Not ideal, but may be easier than managing Tax Exemptions for each customer.
Re: Custom Customer Field (for sales tax code)
This was basically what I was thinking, but having it spelled out in order is helpful.
I think we can handle adding/removing Tax Exemptions per customer. Almost every software has some pain associated with Texas taxes - they are pretty inherently painful if you don't stay in one location or do any type of remote sales.
Where you say ... "so that the Tax Exclusions would be automatically determined by the customer's postcode/zipcode." How would you go about doing this? This sounds very useful but I assume would require delving into some of the Java classes - modifying? extending? any pointers?
I like the idea in using the new functionality in OpenVPMS 2.0. That would be workable, for sure - tedious to set up considering there are hundreds of tax districts. BUT ... it would make reports fairly easy.
Probably the single biggest complication is having to handle stacking taxing jurisdictions that overlap each other. For example, Customer A may be in City X, County Y, & Transit Authority Z, while Customer B may be in City X, County M, & Special District N. There are even more complicated scenarios where you have to charge sales tax from County A (the originating location) and 'use' tax (sales tax by another name) for County B (the destination). That said - that is mainly mail/internet order, and I don't see that being an issue here.
Thanks again, both Tims!
Re: Custom Customer Field (for sales tax code)
Wow... and I thought Canadian taxes were complicated...
About three years ago, we adopted OVPMS for use in BC where we have two taxes inconsistently applied... some services/products get both Federal and Provincial tax, some get only Federal, some get only Provincial... and in a few cases, no taxes are applied at all. While I am sure that Tim G's comments above are right on the money, we were able to handle the multiple taxes with no changes to the Java code, archetypes or database structure We did so simply by modifying the supplied report templates. Thinking about it at the time, I realized that I did not need OVPMS itself to keep track of any of the various taxes internally - I only needed to be able to get to that information for all the various documents (invoices, credits, company tax and financial reports, etc). So I found that it could all be handled by customizing the reports themselves.
But the core complication I was finding with stock OVPMS (and I still think this is the case), is that specific information on which taxes have been applied to each item during OVPMS's internal invoice calculation, are not exposed and available at the document/report-generating stage. So I had to determine the tax components forensically. Unfortunately, I suspect that the math logic that I used to break-out, track and display our two taxes from OVPMS's single tax total might not extend to the situation where you could have up to 4 tax rates per location... particularly if any of those taxes are very small, or any two rates are identical.
The best-case scenario (which I think MIGHT be able to be accommodated with only report template changes) would be the case Tim pointed out in b) above. Does location determine the entire tax scheme... or are any products/services differently taxed within a location? And if absolutely consistent within a location, do they vary significantly between locations? I think the answer to those questions are important in determining the scope of the issues that may need to be addressed.
Sam Longiaru
Kamloops, BC
Re: Custom Customer Field (for sales tax code)
Sam,
Thank you for the input!
1) Taxability:
The state alone sets the rules for what products/services are taxable, so they are always consistent per product category between the various jurisdictions. So, YES, for a given taxable product, tax amount is determined strictly by location. Taxability does NOT change based on which jurisdiction you are in within the state.
2) Rates:
Max total tax rate is capped at 8.25%. The state always gets 6.25% on any taxable product. Then, based on location, you stack up the relevant county (max 0.5%), city, transit authority, and special district rates to get to the max of 8.25%.
3) Reporting:
The state mandates caps on sales taxes and defines what is taxable, and allows the jurisdictions to set rates within their max allowed rates. The state collects ALL sales taxes from us, and then apportions out the sales taxes to the various jurisdictions based on the sales we report in each jursidiction.
CUSTOMER: Thus, on the invoice, it is customary for the taxes to be reported as a single "Sales Tax" line. We are not required to report to the customer how much goes to the various jurisdictions.
STATE: What we ARE required to report to the state is what our SALES are in a given jurisdiction. So, we report that in Bryan we made $$ in taxable sales, Brazos County we made $$ in taxable sales, etc.
Thus, I don't need to necessarily know how OVPMS calculated the tax line (as long as it applied the correct rate), but I do need to be able to associate sales with up to 4 different locations.
4) Goal:
The way I envision the workflow is:
a) OVPMS calculates the taxes based off of zipcode / exemptions / whatever and records a single tax line on the invoice. Not sure about how it is stored in the database - not really important so long as we can extract the total taxable sales amount excluding tax.
b) When we report taxes (monthly, quarterly, or annually, depending on sales volume), we generate a report that simply queries sales per customer, filters by tax code associated with the customer, and adds them together to create a total sales (EXCLUDING TAX) per tax code.
Based off of the input from all of you, I think it is doable. Of course, I always appreciate more pointers to HOW to accomplish it. In the meantime, I'll be poking and prodding at it and be back with more questions - Thanks all!
Re: Custom Customer Field (for sales tax code)
So building on Sam's logic ...
For invoices, I think it is fairly straightforward, though tedious - following Tim A's points:
1) Create a tax per zip code & apply them to all taxable products
2) Apply exemptions to each customer of all taxes except their zip code
3) Let OVPMS calculate taxes accordingly.
For tax-remittal reports, could I build reports that can generate a sum of the sales per zip code, compare the zip code to a table that has the tax location codes for a given zip code, and then create a sum of the sales in a given tax location?
That way, I wouldn't have to save tax codes per user...not quite as accurate, but should be OK.
----
Alternatively, is there one field associated with the customer that is possibly superfluous that I could repurpose and keep a comma-separated list of tax location codes in ... Then create a report that basically does a search and sum for a given period? Sales per customer having tax code X, then sum them together to have a total sales for tax code X, then move on to tax code Y. That would allow more accuracy, but still avoid major changes to archetypes, adding a lookup, or messing with the Java code ... only tweaking the name of a node, and customizing the reports.
Thanks!
Re: Custom Customer Field (for sales tax code)
Thinking about it overnight the problems of setting up all the exclusions for each customer concerns me. It seems to me that although it requires no changes in the code, it would be far easier to use a scheme in which the tax applied is a function of the customer's location.
Of course the scale of the problem is a function of how wide an area the mobile practice is doing business over. It is is all of Texas then there are some 2600 tax locations. If the practice is only doing business over say 10 different tax locations then the scale of the problem is less and Tim A's suggestion of using the 2.0 'tax set by practice location' solution is applicable. In fact, if one looks at all the 2600 odd tax locations, there are only 10 different total tax rates (0.0625, 0.0650, 0.0675, 0.0700, 0.0725, 0.0750, 0.0775, 0.0800, 0.0813, 0.0825). So in terms of applying the correct tax rate we only need 10 different practice locations.
We already have a practice location field for each customer - whose title/label we can easily adjust to 'Tax Location' by modifying the archetype. [Since the practice is a mobile one, you don't need the Customer's Practice Location to reflect the arm of the business involved - which is what it is used for by multi-site practices.]
Now we come to the reporting problem. We need to be able to figure out the tax breakup for each customer from their location. You have probably figured out that OpenVPMS allows one to hold multiple locations/addresses for each customer so we need a rule to say which is used for the tax location. We could use the Billing Address or add a new contact purpose Tax Location via Administration|Lookups|Contact Purpose.
Now although the purists would want the tax breakup for a given location to be held separately, there is no real downside in modifying the contact.location archetype to hold 4 taxation names, tax numbers and their rates. Since everybody is paying 6.25% Texas state tax, you do need to record this here. Also if you want to have tighter validation and better normalisation, you could have a lookup containing the tax names, numbers, and rates (eg Sabine County, 4202006, 0.05) and just put the lookup code(s) in the location contact.
Adding a field in OpenVPMS is a piece of cake - in general, one adjusts the archetype and magically the field appears on the screen ready to use - no java code changes needed. See http://www.openvpms.org/forum/referred-client-option for a neat example. As a second example, we needed to add a Language field to the customer record so that we could send out appointment reminders in either Cantonese or English. We added the following to party.customerperson.adl
<node displayName="Language" name="language" path="/details/language" type="java.lang.String" minCardinality="1" > <assertion name="lookup.local"> <propertyList name="entries"> <property name="C" value="Cantonese"/> <property name="E" value="English"/> <property name="D" value="Dual"/> </propertyList> <errorMessage>Language is mandatory</errorMessage> </assertion> </node>
and the customer information screen is now as below. (The HKID field is a example of 're-purpose by changing title' - this is normally the Travel field which we don't need, but we did need to hold the customer's Hong Kong ID number. If I knew then what I know now, I would have just hidden the travel field and added the HKID field, but at the time I didn't have the confidence/knowledge to do so.)
Meanwhile back at the reporting side. Given the above design (ie the customer's location contact with purpose 'Tax Location' holds up to 4 applicable tax rates and their names), all we need is a tweaked version of the one of the sales reports that goes though all sales (and credits) in the specified period and totals the tax amounts by each tax name/number.
Given that the practice is not going to initially have hundeds of customers, you can probably start initially with a 1.9 system and use the customer 'exclude tax' facility to get the appropriate tax rate for the customer. Then switch to tax-set-by-practice location when 2.0 becomes available.
Two other pieces of information:
a) tax on invoice: all you need to do is set the Prices Include Tax option in the practice record to Off - then your invoices will print the ex-tax amounts against the line items with an asterisk if tax is applicable. You might want to tweak the standard reports_en_US.properties to change the tax name from 'State Tax' to say 'Applicable Tax'
b) for each line item we record both the inc-tax amount and the tax amount, so the tax amount is available reporting - in your case we just need to aportion this via the Tax Location contact tax information into the various state, city, county and other pots.
Hope this helps. If you need help tweaking the archetypes, please yell.
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
OK, how about this as a too simple (and probably too much work) solution...
Working from: "Thus, I don't need to necessarily know how OVPMS calculated the tax line (as long as it applied the correct rate), but I do need to be able to associate sales with up to 4 different locations."
how about this...
Each product/service is entered 4 times, pre-pended with a letter or number code corresponding with the location. The proper tax is set for each item, given its location and its taxation level scheme.
When invoicing for services in Bryan, those items coded for Bryan are used exclusively, whereas when invoicing for Brazos County, only those items are used, etc.
This seems like a lot of product data entry, (nice that there's a Copy button) but the printed names could all be without the code and so invoices, credits, etc, would all look normal. I think that all of the required sales reports could be filtered using the currently-existing built-in product filters, or for those few that don't have filters, filters could probably be added.
It's not elegant... but if it meets the needs, it should require virtually no changes to the existing stock OVPMS. While there is probably a need down the road for a more universally-applicable fix, it might be workable here given the capabilities we have now.
Sam
Re: Custom Customer Field (for sales tax code)
An easier solution would simply be to tax everything at 8.25 percent. You will tax some some products up to 2% too high, but you can adjust prices down so that on average, customer's aren't disadvantaged.
Re: Custom Customer Field (for sales tax code)
I have thought about that. The problem is still with reporting. Also, if he collected 8.25% and then only remitted 7.5% because that's how much the actual rate was in that area, there could potentially be issues with 'fraud'.
Also, the taxes have to be reported based on the jurisdiction they are collected in.
Re: Custom Customer Field (for sales tax code)
Timothy - are you absolutely certain that for a mobile practice, the sales tax payable is a function of the customer's location rather than the business's location?
As far as I can see from https://www.taxjar.com/states/texas-sales-tax-online/#how-to-collect-sal... the tax is a function of the business'es location, and not the customer's. Specifically:
So if the business is based in Texas, then irrespective of where the customer lives, you charge the tax based on the business location. It only gets tricky if the practice is located in say New Mexico, but most of the practice's customers are in Texas.
If the above is indeed the case, then the whole problem goes away. If the mobile practice's address is in say Gause, Tx 77857 then irrespective of where the customer is the tax rate is State Tax 6.25% + Milam County tax 0.05% = 6.75%.
When doing the sales tax return we simply aportion 6.25/6.75 of the tax we charged as State Tax and 0.05/6.75% as Milam County Tax.
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
Short answer - yes, I am absolutely certain. TaxJar sometimes oversimplifies things a bit too much. Our family business (not vet!) actually went to wholesale strictly in order to avoid the nightmare that is Texas sales tax for mobile or mail-order / internet-order businesses. But that's not really an option here! I got a fair amount of experience with Texas sales tax rules during the time we were trying to manage that - since I was the one doing all the reporting.
So ... just to make sure, though, I called the Texas Comptroller's office, and confirmed that he has to charge sales tax based off of the customer's location. One little quirk that I forgot to mention:
- He will always charge 6.25% for the state and 0.5% for Milam County (because like TimG pointed out, it is the point of origin).
- Any customer location with a city, SPD, or MTA (transit authority) tax, he has to stack on top of the 6.75% (he cannot stack another county) - rural clients are good here!
- So ... when he goes to Bryan, he collects 6.25% for the state, 0.5% for Milam County, and then adds on City of Bryan tax of 1.5% - maxing out at 8.25%. If he was in a city with a 1% tax and a 0.5% MTA tax, he'd add both of those. Now, if he was in a city with a 2% tax, he'd skip it (if it goes over the max of 8.25% you don't add ANY of it). But if that same location also had 0.5% SPD and 0.5% MTA, he'd add both of those.
-----
At this point, I think he can handle determining the tax rate manually. I am thinking I'm going to use your suggestion of adding tax rates by percentage (only 10 different rates to deal with!), and use the tax exemptions for now, and then plan on switching him to using practice locations. Then, I'll plan on tweaking the customer archetype and sales reports, like you mentioned, to get the reports of 'taxable sales' per location that he needs.
Sam --- he will be going all over the state, so I'm going to try to avoid adding a product per location (especially because that would be by combo of locations ... which really ups the amount). Thanks for the suggestion!
Thanks all - now for implementation!
Re: Custom Customer Field (for sales tax code)
I thought it would be worthwhile recording the outcome of the above.
We ended up with:
Initially the system will run 1.9 with some 8 different total tax rated defined, and each customer having all of these except 1 disabled. When 2.0 with 'tax rate set by practice location' becomes available, this will be used instead.
This has been an interesting excercise in seeing how far one can tweak OpenVPMS to suit local conditions - in this case a mobile vet working in a state where the sales tax is a function of where the vets's customers live. Note that some (they have big ranches in Texas) are actually spread across more than one tax location. [These will have multiple customer accounts.]
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
A code-based solution would be to:
1. add a practice location flag 'Use Customer Tax Location' indicating if tax rates should be determined by the customer location
2. link tax types (lookup.taxType) to suburbs (lookup.suburb)
3. when charging and estimating, if 'Use Customer Tax Location' is selected, determine the tax rate by:
4. An error would need to be raised if the customer had no contact.location, or no preferred contact.location in the case of multiple contacts
This would mean that:
Re: Custom Customer Field (for sales tax code)
Unfortunately there is no hard correspondence between the tax location and either the zipcode or the suburb/locality. Essentially one enters the full address and the Texas Tax code lookup tells you what city, county, special purpose district and transit tax codes apply to that address.
Hence the need to select the customer's "tax location" and then use that to find the applicable city, county, special purpose district and transit tax codes that apply.
One can calculate the total tax rate at a given tax location and thus the rate that applies to that customer, but each month you have to report the sales and tax collected for each city, county, special purpose district and transit tax codes
Pig of a system.
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
So a given zipcode might have multiple county, special purpose district or transit tax codes that apply to it? Is it really that fine grained?
Re: Custom Customer Field (for sales tax code)
The problem is that the zip areas and the tax areas are not aligned. For example Wimberly, zip code 78676, has one of two different SPD taxes, 'Wimberly Village Library, 0.5%', and 'Hays County ESD 3-A, 0.5%' depending on where you live.
[In this case, both parts are in Hays County, but the those who live in the village pay the library tax rather than the county tax. Both are the same 0.5% but must be reported separately.]
As I said, a pig of a system, exacerbated by the fact that the tax payable is a function of where the service is delivered. If you are the Wimberly Village Vet, and all your customers come to you, then the tax is the same for all customers. But if you are a large animal mobile vet and your customers are spread all around, then the tax payable depends on the customer's location.
To be more explicit, everybody pays 6.25% state tax, everybody pays the same county tax (since this depends on where the business is located), but the city, SPD and transit taxes depend on where the service is delivered.
Regards, Tim G
Re: Custom Customer Field (for sales tax code)
Yes, TimA - it is that fine-grained.
To be exact - many (most?) vets / 'brick-and-mortar' businesses don't encounter this, because you don't encounter this nightmare if:
1) You only deliver services at a single (or finite number) business location. Then, as TimG explained, you charge a single sales tax and report it to the state under the 2-4 tax codes applicable to your location.
2) Even if you are mobile, if you are headquartered out of a location with the maximum 8.25% sales tax rate, the 'orginating' jurisdictions have priority, and you report the same way as case 1.
HOWEVER,
As TimG discussed, if you are in a rural location (like many mobile large/food animal vets are), than you aren't in a maximum-taxing region, and so have to charge destination-based taxes (technically 'use tax'). Hence, the fine-grained headache TimG has described.
All I can say is that I am impressed by 2 things:
1) how flexible the system is with no 'coding' other than defining lookups/relationships/archetypes, and adding SQL-based reports
2) how helpful TimG has been - I have never had such an enthusiastic and knowledgeable response from any other project. Thank you!
Re: Custom Customer Field (for sales tax code)
TimG,
All my emails to you have started bouncing back - about half a dozen of them over the last week or so.
Anyway, I have implemented everything you sent, and it seems to work great. I have not had a chance to load test data in and thoroughly test it, as my brother is currently working on generating the price / service / product / inventory lists.
Once we have that in, I'll give it a more thorough run through with as many variations as possible before I release the implementation to him.
One thing I'm not sure if you got is that we do have taxable and tax-exempt products - prescription drugs are exempt, over-the-counter drugs are taxable, wound care supplies are tax exempt, casting supplies for broken bones are taxable, etc, etc. I know (I think) how to handle these by defining different product types, etc. - However, I haven't been able to test yet if the Sales Tax report you created checks by line item or by invoice total?
Thank you again!
Timothy
Re: Custom Customer Field (for sales tax code)
To close this off, I did add the support for non-taxable items and sent this off to Timothy. [We were doing a lot of off forum communicaton.]
Regards, Tim G