SetTaxCalculationInputs

Set Tax Calculation Inputs

Major Business Rule

Object Name: B0700004

Parent DLL: CPAY

Location: Client/Server

Language: C

Functional Description
B0700004Set Tax Calculation Inputs

Purpose

Set Employee Information and Employee Tax Parameters into Vertex for tax calculations.



Setup Notes and Prerequisites

The Set Tax Calculation Inputs routine is called from the Business Function Vertex Tax Calculations 

(B0700010).  





Technical Specification


Parameters:

  szPayrollID                     

  mnAddressNumber                     

  szTimecardCacheName             

  szDBACacheName                  

  szVertexCacheName               

  szCheckControlNoCacheName       

  szTaxAreaWork                   

  szTaxAreaResidence              

  szTaxId                         

  cMaritalStatusTax                   

  szCompanyHome                    

  cTaxHistoryType                     

  szPayPeriodNumber                

  cPayFrequency                       

  jdDatePayCheck  

  mnCheckControlNumber                

  vDataHandle/* Vertex data variable */

  cTaxCalcMethod   

  cSetTaxErrorFlag   

  cEICStatus                          

  cWorkTaxSource                      

  cSUISource                          

  cResidencyStatus                    

  mnSchoolDistrictCode  



Related Tables

none

Related Business Functions

Source Name       Function Name
B0700010Vertex Tax Calculations

B0700008Perform Tax Calculations

B0700009Create Tax Detail records

B0700058Establish connection to Vertex


Processing

Note:  Vertex can identify up to 10 work locations for a given tax type and pay period.  This could 

be a limitation at some point that will need to be addressed.



1.0Initialize Caches:

• Timecard Cache
• DBA Cache
• Vertex Cache


2.0Initialize State List structure.  This structure contains a list of unique state  geo 

codes.  This structure is used in tax calculations for state purposes.



3.0Convert Filing Status for Vertex.

• Parameter passed in:Marital Status
• Parameter returned:Vertex Filing status

Marital StatusVertex Filing status (enumerated)Description
AEVprtFilStat02Married, filing jointly
BEVprtFilStat02Married, filing jointly

HEVprtFilStat03Head of household

JEVprtFilStat04Married, filing 

separately

MEVprtFilStat02Married, filing jointly

PEVprtFilStat01Single

QEVprtFilStat02Married, filing jointly

SEVprtFilStat01Single

1EVprtFilStat02Married, filing jointly

2EVprtFilStat01Single

3EVprtFilStat01Single



4.0Calculate Employee Pre Tax Gross Amount


Loop 

Through all Timecard cache records where the Check control number matches the Check 
control number being processed from B0700010

Until all Timecard records have been processed

• Build Exempt Tax Type structure.  There are fifteen fields in the Timecard cache (TT01 
through TT15) that hold exempted tax types.  So, this data structure is an array of 15 

holding the exempt tax types.  The exempt tax types are enumerated tax types that Vertex can 

recognize.  If a tax type field is blank then the enumerated tax type is "-1".


• Get Tax Work Area from Timecard cache.  In the Timecard cache, the work geo code is 
broken into three pieces, state geo, county geo, and city geo.  Thus, need to append all three 

pieces together to populate the Tax Work Area.


• Maintain a list of unique state geo codes.  This data structure contains up to ten 
unique state geo codes (2 digits).  The purpose of this data structure is to compute Works-In 

state taxes.


• Check for an existing Tax Area (xx-xxx-xxxx).  The Tax Area data structure contains 
unique Works-In geo codes so we need to determine if the current work geo code from the 

Timecard cache is unique compared to already existing Works-In geo codes in this data structure. 

 If the current work geo code is not unique then set a flag to TRUE then do not add this 

to the Tax Area data structure.


• Store Tax Work Area and Gross Pay from Timecard cache into Tax Area structure.  
For all fifty tax types (FWT, FUTA, SWT, '85etc.):
If current work geo code is unique then add it to the Tax Area data structure.  
That is:

• Work geo code
• State geo code
• County geo code
• City geo code

Now, check the exempt tax type from the Timecard cache:  


• If TT01 is blank then store the Gross Pay populated from Timecard cache into the 
Tax Area data structure.  


• If TT01 is "*" then determine the "Effect on Gross (+/-)".  If the "Effect on 
Gross is positive then add the Gross Pay populated from Timecard cache to the Tax Area 

data structure.  Otherwise, subtract the Gross Pay populated from Timecard cache from 

the Tax Area data structure.  


• Lastly, check each exempt tax type held in TT01 through TT15.  If a tax type 
exists, then determine the "effect on gross" and add/subtract the Gross Pay populated 

from Timecard cache to the Tax Area data structure.

Repeat


5.0Calculate Employee Pre Tax Gross Amount (continued)


Loop 

Through all DBA cache records where the Check control number matches the Check control 
number being processed from B0700010 and the PDBA type is "D"(deduction).

Until all DBA records have been processed

• Build Exempt Tax Type structure.  There are fifteen fields in the DBA cache (TT01 
through TT15) that hold exempted tax types.  So, this data structure is an array of 15 holding 

the exempt tax types.  The exempt tax types are enumerated tax types that Vertex can 

recognize.  If a tax type field is blank then the enumerated tax type is "-1".


• Populate Auto Pay Method field from F069116.  For the current DBA, determine the auto 
pay method as to whether it is considered "B" (supplemental pay) or regular pay.


• Store Excludable Pay from DBA cache into Tax Area structure.  Vertex recognizes four 
deduction types in computing adjusted gross pay (125, 401K, 403B, and 457).


Check the exempt tax type from the DBA cache:


• If TT01 is "*" then compute the deduction amounts and the YTD deduction amounts for 
125, 401K, 403B, and 457 plan deductions.  Use the Pre Tax Type field in the DBA cache 

to determine the deduction type.


• Otherwise, check each exempt tax type held in TT01 through TT15.  If a tax type 
exists,  

• Then compute the deduction amounts and the YTD deduction amounts for 125, 401K, 403B, 
and 457 plan deductions.  

Repeat


6.0Set employee general information for Vertex Tax Calculation.


• Read tax rates from F069226 file to populate FUTA, SDI, and SUI tax rate

• Determine number of pay periods based on pay frequency

Pay FrequencyPay PeriodsDescription
A1Annual
Q4Quarterly

M12Monthly

S24Semi-Monthly

B26Biweekly

W52Weekly


• Set Employee Handle

VprtSetEmpHdl (Employee handle,

Current pay period,

Employee number,

SDI rate,

FUTA rate,

Check date,

Number of pay periods,

Residence geo code,

SUI rate)



7.0Set Employee Tax Information for Vertex Tax Calculation.


Loop
Process through all of the Vertex cache records.  Each vertex record contains:
• Tax type  (A, C,'85, P)
• Tax type description(FWT, FUTA, '85 Medicare Paid)
• Vertex function  (DED, TAX, GRS, HDL, CALC, OVAL)
• Tax basis  (YTD or REGular pay)
• Tax Level  (FEDeral, STate, or LOCal)

Until all Vertex records have been processed

• Get Vertex enumerated tax type based on our payroll tax type.

• If the Vertex function is DED (deduction) then

• Determine the deduction type (401K, 125, 403B, 457, or Supplemental pay for 401K, 
125, 403B, or 457).  This is based on the deduction amount.

If the deduction amount is greater than zero, then:
• Retrieve the deduction amount and YTD deduction amount
• Call Vertex API VprtSetDeduct

• Determine the Tax Level:
If FEDeral then VprtSetDeduct (Employee handle,
Enumerated tax type,
Federal tax level, 

Deduction type,

Cash option,

Deduction amount,

YTD deductio

Data Structure

D0700004 - Set Tax Calculation Inputs

Parameter NameData ItemData TypeReq/OptI/O/Both
szPayrollIDPAYDcharOPTNONE

A code that identifies a group of employees for whom you are processing payroll. Use this ID to process each step of the payroll 
cycle. This code is also used to identify the interim ID that you select when you enter interim payments.

mnAddressNumberAN8MATH_NUMERICOPTNONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

szTimecardCacheNamePIDcharOPTNONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

szDBACacheNamePID1charOPTNONE

Program ID - 01

szVertexCacheNamePID2charOPTNONE

Program ID - 02

szCheckControlNoCacheNamePID3charOPTNONE

Program ID - 03

szTaxAreaWorkTARAcharOPTNONE

A code that identifies a geographical location and the tax authorities for an employee work site, including employee and employer statutory 
requirements. In the Vertex payroll tax calculation software, the tax area code is synonymous with GeoCode. To determine the valid codes 
for your location, refer to the documentation for the tax calculation software that you are using.

szTaxAreaResidenceTARRcharOPTNONE

A code that identifies both the geographical location and the tax authorities for the employee's residence. Authorities include employee 
and employer statutory requirements. This code is synonymous with GeoCode. Refer to Vertex System's Master GeoCode File for valid codes 
for your locations.

szTaxIdTAXXcharOPTNONE

A number that identifies your company to the tax authority. This number can include the tax ID number for an individual, a federal or state 
corporate tax ID, a sales tax number, and so on. This number has specifically been established for the Payroll system to handle the 
requirements of taxing authorities that require more than 9 positions for the tax identification number. Do not enter hyphens (dashes), slashes, spaces, or 
other punctuation in the tax identification number.

cMaritalStatusTaxMSTXcharOPTNONE

A user defined code (system 06, type MS) that specifies the employees' federal marital status code as retrieved from the W-4 form. This 
code is used in the computation of all federal income tax.  You can add codes if needed.

szCompanyHomeHMCOcharOPTNONE

The company number where the employee records generally reside.

cTaxHistoryTypeTHTYcharOPTNONE

A user defined code (07/TH) that specifies the type of information being tracked for the employee in the US Taxation Summary History 
table (F06136) or the Canadian Tax History table (F0713). The value in this field determines what type of year-end form the system generates.

szPayPeriodNumberPPNBcharOPTNONE

The number of the pay period from the beginning of the year. For instance, a monthly payroll cycle beginning in January has a total of 12 
periods with October being the 10th period. Typical values are:        001-052 (Weekly Payroll Cycle)        001-026 (Biweekly Payroll Cycle)        
001-024 (Semimonthly Payroll Cycle)        001-012 (Monthly Payroll Cycle)        001-004 (Quarterly Payroll Cycle)        001-001 (Annual Payroll Cycle)

cPayFrequencyPFRQcharOPTNONE

A user defined code (07/PF) that indicates how often an employee is paid. Valid codes are: B Biweekly   W Weekly   S Semimonthly  
M Monthly   A Annually   C European Annualized  The system uses the value in the Description-2 field on user defined codes to calculate the amount per 
pay period for a salaried employee.

jdDatePayCheckCKDTJDEDATEOPTNONE

The date associated with the various types of net pay instructions. This date relates to a payroll check, an interim payment, a bank 
automatic-deposit advice slip, a payslip (cash), or a claim reimbursement.

mnCheckControlNumberCKCNMATH_NUMERICOPTNONE

A number used to group all payroll transactions for each payment or individual interim payment. This number is carried into the accounting 
journal entries and facilitates the update of the actual check number after payment printing is complete. This number is also used for 
automatically voiding payments. The payment work table contains both the actual check number and the check control number. All associated 
payment transactions are automatically reversed using the check control number. This is not the actual check number.

vDataHandlePID4charOPTNONE

Program ID - 04

cTaxCalcMethodFICMcharOPTNONE

A code that specifies the tax method that the Vertex payroll-tax calculation system uses to calculate certain taxes. The codes are defined in 
UDC 07/TM. This code can also determine the form that the employee receives for year-end tax reporting. For example, when you enter C, 
a contract employee receives IRS Form 1099-M rather than IRS Form W-2. If a form is not specified in Description 2, the system generates 
IRS Form W-2. For employees who are paid multiple times within one pay period, the system should review previous payments within the same 
pay period and then adjust tax amounts. To specify this function, enter S. If a tax method exists for an employee in addition to the normal tax 
method that is set up in the Employee Master Information table (F060116), the system can use the alternative tax method to interactively 
process interim payments. To specify this function, enter Z. Some values, such as S and Z, might require additional setup in the UDC table.

cSetTaxErrorFlagFLGcharOPTNONE

cEICStatusEICcharOPTNONE

A code that specifies whether the employee qualifies for the earned income credit and elects for the employer to give him or her the 
advance. Valid values are:    N The employee does not qualify (default).    Y The employee qualifies and the employee is single/head of 
household.    M The employee qualifies and is married without spouse filing certificate.     B The employee qualifies and his or her spouse also 
qualifies.

cWorkTaxSourceNScharOPTNONE

This code is used to determine the source for obtaining the tax area code for the employee's work location.    N Use time entry, job master, 
employee labor rules or employee master to determine Tax Area.    E Always use the Work Tax Area from the employee master on time 
record. When blank the system assumes N.

cSUISourceSUIcharOPTNONE

Use this field to specify the work tax area that is used for SUI reporting. You can specify that the system use either the resident state or the 
work state, regardless of where the employee worked. FUI is calculated in the same state where SUI is calculated. Weeks Worked are the 
number of weeks the employee worked in the taxed state.  Valid values are:    N   Use the work tax area in the time entry record to determine 
SUI. This is the default value.    R   Always use residence tax area from Employee Master table even if the time entry record is different.    W  
Always use work tax area from Employee Master table even if the time entry record is different.

cResidencyStatusWSPScharOPTNONE

A value that identifies out-of-state employees for whom an employer must withhold tax for the state of residence. Valid values are: N 
(Default) The system uses the employee residence state to calculate taxes. Because the work state has a reciprocal agreement with the employee 
state of residence, the system uses the employee residence state from the Employee Master Information table (F060116).  W The system 
uses only the work state to calculate taxes.

mnSchoolDistrictCodeSCDCMATH_NUMERICOPTNONE

A user-defined code in UDC 06/SD that determines the school district tax for taxation purposes. Vertex automatically calculates the school 
district tax. This feature is primarily used by the public sector.

iTimecardCountINT01integerOPTNONE

Number of Days in Future to Query for Responses Due. 

cWorkStateTaxMSTIcharOPTNONE

The employee's "Work" state marital status code as retrieved from the state W-4. This code is used in the computation of all state payroll 
taxes associated with the state in which the employee performed work. If you leave this field blank, the Federal status is used.

cResStateTaxRMSTcharOPTNONE

A user defined code (system 06, type MS) that specifies the marital status code for the state of residence. It is used for tax computations. 
This code is related to specific VERTEX system codes (see the VERTEX Tax Manual for their explanation). Also, two special codes have 
been provided: one designates single for Federal and married for State, and the other designates married for Federal and single for State.

cLocalAreaTaxLMSTcharOPTNONE

The employee's Local marital status code as retrieved from the locality's W-4. This code is used in the computation of all local (city, county) 
payroll taxes associated with the state in which the employee performed work. If you leave this field blank, the Federal status is used.

szTimecardCompanyHomeHMCOcharOPTNONE

The company number where the employee records generally reside.

idEmployeeHandleGENLNGIDOPTNONE

General purpose ID variable.

mnTotalGrossPayMATH01MATH_NUMERICOPTNONE

- - - Good Performance Low Value. 

szTaxOverrideCacheNamePID5charOPTNONE

Program ID - 05

jdDateOfBirthDOBJDEDATEOPTNONE

The employee's date of birth.

szCountryCodeCCPRcharOPTNONE

A user defined code list 00/CN that indicates the country in which the employee resides.

cVertexTaxAreaFlagFLGcharOPTNONE

szUnemploymentRatesCacheNamePIDcharOPTNONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

cPayrollTypePATYcharOPTNONE

An option that specifies whether the payroll cycle includes interim payments only. Valid values are:    On Yes, the payroll cycle includes 
interim payments only.    Off No, the payroll cycle includes regular payments instead of or in addition to interim payments.

szTaxDetailCacheNamePIDcharOPTNONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

mnTimeLastUpdatedUPMTMATH_NUMERICOPTNONE

The time that specifies when the program executed the last update to this record.

jdDateUpdatedUPMJJDEDATEOPTNONE

The date that specifies the last update to the file record.

szWorkStationIdJOBNcharOPTNONE

The code that identifies the work station ID that executed a particular job.

szUserIdUSERcharOPTNONE

The code that identifies a user profile.

cHistoryConversionEV01charOPTNONE

An option that specifies the type of processing for an event.

szDBADetailCacheNamePIDcharOPTNONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

iNumberOfPayPeriodsINT01integerOPTNONE

Number of Days in Future to Query for Responses Due. 

cLastPeriodOfMonthEV01charOPTNONE

An option that specifies the type of processing for an event.

cBypassVoidwithSpecialTaxesBPVDcharOPTNONE

A code that indicates whether you want to bypass or process voided payments if those payments contain special taxes. Valid values 
are: 0 Process voided payments with special taxes.  1 Bypass voided payments with special taxes.

Related Functions

B0700010 Vertex Tax Calculations

Related Tables

F0005 User Defined Codes
F06017 Employee Tax Exceptions/Overrides
F069116 Payroll Transaction Constants
F069226 Unemployment Insurance Rates
F07353 Tax Detail File