% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::Cron::tax_rate_update
Cron routine to update city/district sales tax rates in cust_main_county. Currently supports sales tax in the state of Washington.
Once each month, update the tax tables from the WA DOR website.
Find cust_location rows in WA with no tax district. Try to determine a tax district. Otherwise, generate a log error that address needs to be correctd.
Cron routine for freeside_daily.
Run one of the available cron functions based on conf value tax_district_method
Monthly: Update the complete WA state tax tables Every Run: Log errors for cust_location records without a district
For any cust_location records * In WA state * Attached to non cancelled packages * With no tax district
Classify the tax district for the record using the WA State Dept of Revenue API. If this fails, generate an error into system log so address can be corrected
Update city/district sales tax rates in FS::cust_main_county from the Washington State Department of Revenue published data files.
Creates, or updates, a FS::cust_main_county row for every tax district in Washington state. Some cities have different tax rates based on the address, within the city. Because of this, some cities have multiple districts.
If tax classes are enabled, a row is created in every tax class for every district.
Customer addresses aren't classified into districts here. Instead, when a Washington state address is inserted or changed in FS::cust_location, a job is queued for FS::geocode_Mixin::process_district_update, to ask the Washington state API which tax district to use for this address.
All arguments are optional:
filename: Skip file download, and process the specified filename instead
taxname: Updated or created records will be set to the given tax name.
If not specified, conf value 'tax_district_taxname' is used
year: Specify year for tax table download. Defaults to current year
quarter: Specify quarter for tax table download. Defaults to current quarter
The state of Washington makes data files available via their public website. It's possible the availability or format of these files may change. As of now, the only data file that contains both city and county names is published in XLSX format.
https://dor.wa.gov
https://dor.wa.gov/find-taxes-rates/sales-and-use-tax-rates/downloadable-database
https://dor.wa.gov/sites/default/files/legacy/Docs/forms/ExcsTx/LocSalUseTx/ExcelLocalSlsUserates_19_Q1.xlsx
https://dor.wa.gov/sites/default/files/legacy/downloads/Add_DataRates2018Q4.zip
http://webgis.dor.wa.gov/webapi/AddressRates.aspx?output=xml&addr=410 Terry Ave. North&city=&zip=98100
Create or update the FS::cust_main_county records with new data
The customer may have created additional taxes, such as Universal Service Fund.
Ensure the columns for city and county are consistant between the user-created tax rows and the wa-sales-managed tax rows.
Parse given XLSX file for tax district information Return an arrayref of district information hashrefs
Download data file from WA state DOR to temporary storage, return filename
There should be no duplicate tax table entries in the tax table, with the same district value, within a tax class, where source=wa_sales.
If there are, custome taxes may have been user-entered in the freeside UI, and incorrectly labelled as source=wa_sales. Or, the dupe record may have been created by issues with older wa_sales code.
If these dupes exist, the sysadmin must solve the problem by hand with the freeeside-wa-tax-table-resolve script
Returns 1 unless problem sales tax entries are detected
Hey! The above document had some coding errors, which are explained below:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'