Main Web API Documentation Information
|
|
Actual Page/Function Name:
|
calculateTaxes |
Human Readable Name or Caption:
|
Calculate Taxes |
Page/Function Description:
|
This method will calculate taxes according to tax categories for an item. |
Page/Function Output Type:
|
API - JSON or WDDX |
Categories:
|
eComm,invoice,quote |
Extra Page/Function Notes:
|
This needs to be run for each item before submitting to the database. All taxes inside the system use this calculation method. |
Parameters
|
|||||||
Scope | Name | Type | Default | Description | Required | Alternates | Known Values |
Arguments | CORP_ID | Numeric | 0 | Pass in the corp id number. This is your corporation ID or your business world number. This is required and will be validated. The default is 0, but will be checked for a real number. | Yes | ||
Arguments | INVENTORY_TYPE_ID | Numeric | 5 | Pass in the inventory type id. The two main values that get passed in are 5 (normal items) or 7 (unlimited items), and the default value is 5. Some others are 2=Trailer, 3=Vehicle, 4=Topper, 5=Parts, 6=Flatbeds, 7=Labor/Service, 8=Specific Unit, 9=Rental, and 10=Balance Sheet Items. | Yes | ||
Arguments | ITEM_PRICE | Numeric | 0 | Pass in the item price. This is the main sales price for a single item. This value will be multiplied by the quantity and then goes to the P&L in the revenue portion. If a discount is used, it actually needs to be reflected in this item price. There is another field called original list price where you can put the original value. | Yes | ||
Arguments | LINE_AMOUNT | Numeric | 0 | Pass in the line amount. This is the extended taxable amount. Once again, if there is a discount, the discount should have already been applied. | Yes | ||
Arguments | LINE_QUANTITY | Numeric | 0 | Pass in the quantity. This will be multiplied by the price and entered into the database. Pass in a positive value for a sale and a negative value for a return. However many you sold is usually a positive number. | Yes | ||
Arguments | NUMBER_OF_DECIMALS | Numeric | 2 | Pass in the number of decimals. This should be the number 2 to 5. This is controlled through the corp-wide settings and tells the system how detailed to carry out calculations. | Yes | ||
Arguments | PART_CATEGORY_ID | Numeric | 0 | Pass in the part category id number. This is corporation-specific and needs to be looked up using the getAllPartsCategories method. Later on in the system, this is how everything is categorized in the sales & profit reports, the P&L, and other financials. | Yes | ||
Arguments | STORE_ID | Numeric | 0 | Pass in the store or location id number. This value is corporation specific and can be looked up by going to the getGeneralLookupValues method. You'll be looking for the QRY_LOCATION_INFO_ARRAY data. This is a huge part of how we track quantities per location. If you have multiple locations, this is extremely important. | Yes | ||
Arguments | TAX_CATEGORY_ID | Numeric | 2 | Pass in the tax category id number. Default is 2 (2=taxable). These id numbers can be found by using the getLookUpValues method. Make sure to pass in the table name as tax_categories. As a side note, if you're using With Tax Included, make sure that it gets flipped to a normal taxable value here on the invoice line items. Basically, the With Tax Included setting is only used to figure out the taxes, and then it is set as physical taxable for database storage. The method used to calculate taxes is calculateTaxes. | Yes |
Results
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RET_STATUS | RET_MAIN_MESSAGE | RET_SECOND_MESSAGE | Redirect Link | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ok | success | This assumes that everything went well. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dataIn | Unable to calculate taxes for the line item. Missing some data. | Use your back button and try again. | This is returned if the corp id, inventory type id, number of decimals, part category id, store id, or tax category arguments are not found. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
corpSettings | Missing the correct corp-wide settings. Unable to proceed. | Use your back button and try again. | This is returned if the corp-wide settings could not be found. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
db | Unable to connect to the database. Missing the [name] and tax information. | Use your back button and try again. | This is returned if there was an error in inserting or querying values such as default loc name, limit other tax category list, other tax title, other tax 1, store city tax, store state tax, etc. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zero | Unable to find the [name] that was submitted. No taxes were calculated. | Use your back button and try again. | This is returned if the queried tax fields are empty for the requested store id. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ok | success | This "ok" status is found part-way through the function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mathCalc | Unable to calculate the taxes for the line item. Taxes were not updated. | Use your back button and try again. | This is returned if there were any errors in math calculation. |
Samples
|
|
Caption | Text |
JSON |
{"API_CALL_FUNCTION_NAME":"calculateTaxes","CORP_ID":53,"INVENTORY_TYPE_ID":3,"NUMBER_OF_DECIMALS":2,"PART_CATEGORY_ID":555,"STORE_ID":178,"TAX_CATEGORY_ID":2,"ITEM_PRICE":15,"LINE_AMOUNT":15,"LINE_QUANTITY":4,"API_CORP_KEY_ID":"PLA-0053","API_USER_NAME":"demo","API_USER_PASSWORD":"1234","API_CURRENT_PAYEE_ID":"3","API_INPUT_OUTPUT_TYPE":"JSON","API_URL_ENCODING":"AUTO"}
|