It is too long for one posting so I am seperating it into three postings.
Here is the first part:
'**************************************************************************
'** FILE: PAYROLL.XLS
'** PURPOSE: Generate Invoice & Payroll transactions via DDE into Peachtree.
'** AUTHOR: Conrad R. Meitl, KHS
'** CREATED: December 08, 1994
'** REVISED: DATE SE DESCRIPTION
'** 12/09/94 KHS/CM Added Edit button to Payroll_Entry sheet.
'** 12/11/94 KHS/CM Eliminated screen update during execution.
'** 12/13/94 KHS/CM Added Add button to Payroll_Entry sheet.
'** 12/15/94 KHS/CM Added status display window during processing.
'** 01/25/95 KHS/CM Updated tax tables.
'** 07/18/95 LM Changed SUI to 0.
'** 12/28/95 CRM Updated 1996 tax tables.
'** 12/14/96 LM Changed departments - adding 1,2, or 3 for
offices.
'** 12/26/96 CRM/LM Updated 1997 tax tables.
'** 12/23/97 CRM/LM Updated 1998 tax tables.
'** 02/18/98 CRM/LM Always update customer and employee list.
'** 01/04/99 CRM/LM/TW Updated 1999 tax tables.
'** 04/23/99 CRM Widen year fields to 4 places.
'** 12/29/99 LM/TW/CRM Updated 2000 tax tables.
'** 12/28/00 LM/TW Updated 2001 tax tables.
'** 07/02/01 LM Updated 2001 tax tables for FIT only.
'** 12/31/01 LM/TW Updated 2002 tax tables.
'** 12/30/02 TW Updated 2003 tax tables.
'** 06/19/03 VS Removed "SortbyEmp" procedure; removed
"SortbyEmp" in UpdatePayrollSummary Procedure.
'** 09/10/03 TW Updated tax tables
'** NOTES: This program requires a Peachtree password with access to
employee,
'** customer, payroll and invoice screens.
'** Some worksheet items are hidden to improve appearance. These
items
'** can be displayed for maintenance by running the
"SetDevelopmentEnv"
'** macro. They can be rehidden with the "SetProductionEnv" macro.
'** SETUP: Copy the Peachtree Alert, Alarm and Eventlog file to the Peachtree
'** program directory to eliminate problem with Peachtree DDE Open.
'** USAGE:
'** Step 1
'** Make all employee & customer updates within Peachtree. Import the
Peachtree
'** Employee & Customer information into this worksheet by clicking on the
Update
'** button on the Employee_List & Customer_List screen.
'** Step 2
'** Enter the current periods employee time sheet information into the
Payroll
'** worksheet Payroll_Entry screen.
'** "Add" Button - Add an additional line to the Payroll_Entry screen for
'** time sheet data entry. (Ctrl-C)
'** "Input / Edit" Button - Display the time sheet data entry form for
'** time sheet input & editing. (Ctrl-E)
'** "Sort By Emp" Button - Sorts time sheet data by Employee ID.
'** "Sort By Dept" Button - Sorts time sheet data by Department.
'** "Sort By Cust" Button - Sorts time sheet data by Customer ID.
'** "Print" Button - Print entire payroll entry sheet.
'** "Reset" Button - Delete previously entered time sheet data.
'** Step 3
'** Calculate employee payroll deductions by clicking on the Update button
on the
'** Payroll worksheet Payroll_Calc screen. Only enter additional employee
income
'** and deduction after clicking on the Update button. Clicking on the
Update button
'** will reset any previously entered special payroll income or
deductions. Additional
'** income should be entered as a positive number and deductions as a
negative number.
'** Step 4
'** Create Peachtree payroll & invoice transactions by clicking on the
Generate_Invoice
'** and/or Generate_Payroll button on the Payroll worksheet Payroll_Calc
screen.
'** This step will take a while to complete and may be run overnight.
Peachtree
'** accounting files should be backed up immediately prior to generating
payroll
'** or invoice transactions. If a major error is discovered after the
transactions
'** are generated, the Peachtree accounting files should be restored from
the backup.
'** Step 5
'** Print and verify Peachtree payroll & sales reports. Print customer
invoices and
'** payroll checks from within Peachtree.
'** PROCEDURES:
'** AddPayrollEntry - Add an additional line to Payroll_Entry sheet.
'** ConvertDeptToAccount - Return PAW account # for department.
'** DefineNamedRanges - Define worksheet named ranges (Development).
'** DefinePayrollEntryFormulas - Build Payroll_Entry total formulas.
'** EditPayrollEntry - Allow data entry into Payroll_Entry sheet.
'** FIT - Return federal income tax deduction.
'** FICA - Return Social Security tax deduction.
'** FUTA - Return employer FUTA.
'** GenerateAll - Generate payroll & invoice transactions.
'** GenerateInvoice - Generate Peachtree invoice transactions.
'** GeneratePayroll - Generate Peachtree payroll transactions.
'** GetPayroll - Retrieve poked payroll for verification (Development).
'** GetSales - Retrieve poked invoices for verification (Development).
'** PayFrequencyAnnualConvFactor - Returns employee pay frequency conv
factor.
'** PSLookup - Returns lookup value from PS_TData table.
'** PrintSelectedSheet - Print current worksheet.
'** ResetPayrollEntry - Clear contents of Payroll_Entry sheet.
'** SetDevelopmentEnv - Unprotect & restore development settings
(Development).
'** SetProductionEnv - Protect & restore production settings (Development).
'** SIT - Return state income tax deduction.
'** Sub SortByBillRate - Sort PE_Data by Bill Rate.
'** SortByCustomer - Sort PE_Data by Customer ID.
'** SortByDate- Sort PE_Data by Date.
'** SortByDepartment - Sort PE_Data by Department.
'** SortByEmployee - Sort PE_Data by Employee ID.
'** Sub SortByPayRate - Sort PE_Data by Pay Rate.
'** SUI - Return employer SUI.
'** UpdateCustomerList - Update Customer_List from Peachtree files.
'** UpdateDeptSum - Recalc Dept_Sum pivot table.
'** UpdatePayrollEntry - Update Payroll Entry table department and rate
formulas.
'** UpdateEmplyeeList - Update Employee_List from Peachtree files.
'** UpdatePayrollCalc - Update & recalc Payroll_Calc sheet.
'** UpdatePayrollSum - Recalc Payroll_Sum pivot table.
'***************************************************************************
'***************************************************************************
'** D E C L A R E M O D U L E - L E V E L C O N S T A N T S
'***************************************************************************
'Const COMPANY = "MARCHINC" ' Company Short Name"
Const COMPANY = "AGENCY" ' Company Short Name"
Const PROGRAM = "C:\PEACHW\PEACHW.EXE" ' Program Exec Name
Const CL_DATA_ROW = 6 ' CL First Customer Data
Row
Const EL_DATA_ROW = 6 ' EL First Employee Data
Row
Const EL_STATUS = 4 ' EL "Status" Column Number
Const EL_PAY_FREQ = 5 ' EL "Frequency" Column
Number
Const EL_FED_ALLOW = 6 ' EL "Fed.Allow" Column
Number
Const EL_EXTRA_FIT = 7 ' EL "Extra.FIT" Column
Number
Const EL_EXTRA_SIT = 11 ' EL "Extra.SIT" Column
Number
Const EL_STATE_ALLOW = 8 ' EL "KS.Allow" Column
Number
Const EL_YTD_GROSS = 9 ' EL "YTD.Gross" Column
Number
Const PC_DATA_ROW = 10 ' PC First Employee Data
Row
Const PC_DIST_COLUMN = 7 ' PC First Distribution
Comumn
Const PE_DATA_ROW = 8 ' PE First Employee Data
Row
'***************************************************************************
'** D E C L A R E M O D U L E - L E V E L V A R I A B L E S
'***************************************************************************
Dim CPointer As Integer ' Current Worksheet Column
Dim RPointer As Integer ' Current Worksheet Row
Dim Channel As Integer ' DDE Conversation Ref
Dim PAWData As Variant ' Requested PAW Hdr Data
Dim PAWDist As Variant ' Requested PAW Dist Data
'***************************************************************************
'** AddPayrollEntry F U N C T I O N
'***************************************************************************
Sub AddPayrollEntry()
Application.ScreenUpdating = False
Sheets("Payroll_Entry").Unprotect
RPointer = Range("Payroll_Entry!A7").End(xlDown).Row
Range("PE_Formula").EntireRow.Hidden = False
Range("PE_Formula").Copy
Sheets("Payroll_Entry").Rows(RPointer + 1).Insert Shift:=xlDown
Range("PE_Formula").EntireRow.Hidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
'***************************************************************************
'** ConvertDeptToAccount F U N C T I O N
'***************************************************************************
Function ConvertDeptToAccount(Dept)
If (VarType(Dept) = vbString) Then
Dept = Val(Right(Dept, 3))
End If
Select Case Dept
Case 100
ConvertDeptToAccount = 511100
Case 119
ConvertDeptToAccount = 525120
Case 120
ConvertDeptToAccount = 511120
Case 125
ConvertDeptToAccount = 525126
Case 126
ConvertDeptToAccount = 511126
Case 128
ConvertDeptToAccount = 525129
Case 129
ConvertDeptToAccount = 511129
Case 131
ConvertDeptToAccount = 511131
Case 133
ConvertDeptToAccount = 511133
Case 135
ConvertDeptToAccount = 511135
Case 140
ConvertDeptToAccount = 511140
Case 141
ConvertDeptToAccount = 511141
Case 142
ConvertDeptToAccount = 511142
Case 145
ConvertDeptToAccount = 511145
Case 150
ConvertDeptToAccount = 511150
Case 151
ConvertDeptToAccount = 511151
Case 152
ConvertDeptToAccount = 511152
Case 155
ConvertDeptToAccount = 511155
Case 159
ConvertDeptToAccount = 511159
Case 160
ConvertDeptToAccount = 511160
Case 161
ConvertDeptToAccount = 511161
Case 162
ConvertDeptToAccount = 511162
Case 163
ConvertDeptToAccount = 511163
Case 164
ConvertDeptToAccount = 511164
Case 165
ConvertDeptToAccount = 511165
Case 166
ConvertDeptToAccount = 511166
Case 167
ConvertDeptToAccount = 511167
Case 170
ConvertDeptToAccount = 511170
Case 172
ConvertDeptToAccount = 511172
Case 173
ConvertDeptToAccount = 511173
Case 174
ConvertDeptToAccount = 511174
Case 175
ConvertDeptToAccount = 511175
Case 176
ConvertDeptToAccount = 511176
Case 180
ConvertDeptToAccount = 511180
Case 182
ConvertDeptToAccount = 511182
Case 195
ConvertDeptToAccount = 511195
Case 196
ConvertDeptToAccount = 511196
Case 200
ConvertDeptToAccount = 511200
Case 219
ConvertDeptToAccount = 525220
Case 220
ConvertDeptToAccount = 511220
Case 225
ConvertDeptToAccount = 525226
Case 226
ConvertDeptToAccount = 511226
Case 228
ConvertDeptToAccount = 525229
Case 229
ConvertDeptToAccount = 511229
Case 231
ConvertDeptToAccount = 511231
Case 233
ConvertDeptToAccount = 511233
Case 235
ConvertDeptToAccount = 511235
Case 240
ConvertDeptToAccount = 511240
Case 245
ConvertDeptToAccount = 511245
Case 250
ConvertDeptToAccount = 511250
Case 251
ConvertDeptToAccount = 511251
Case 252
ConvertDeptToAccount = 511252
Case 260
ConvertDeptToAccount = 511260
Case 261
ConvertDeptToAccount = 511261
Case 262
ConvertDeptToAccount = 511262
Case 263
ConvertDeptToAccount = 511263
Case 264
ConvertDeptToAccount = 511264
Case 265
ConvertDeptToAccount = 511265
Case 266
ConvertDeptToAccount = 511266
Case 267
ConvertDeptToAccount = 511267
Case 270
ConvertDeptToAccount = 511270
Case 272
ConvertDeptToAccount = 511272
Case 274
ConvertDeptToAccount = 511274
Case 275
ConvertDeptToAccount = 511275
Case 276
ConvertDeptToAccount = 511276
Case 280
ConvertDeptToAccount = 511280
Case 282
ConvertDeptToAccount = 511282
Case 295
ConvertDeptToAccount = 511295
Case 296
ConvertDeptToAccount = 511296
Case 300
ConvertDeptToAccount = 511300
Case 319
ConvertDeptToAccount = 525320
Case 320
ConvertDeptToAccount = 511320
Case 325
ConvertDeptToAccount = 525326
Case 326
ConvertDeptToAccount = 511326
Case 328
ConvertDeptToAccount = 525329
Case 329
ConvertDeptToAccount = 511329
Case 331
ConvertDeptToAccount = 511331
Case 333
ConvertDeptToAccount = 511333
Case 335
ConvertDeptToAccount = 511335
Case 338
ConvertDeptToAccount = 511338
Case 339
ConvertDeptToAccount = 511339
Case 340
ConvertDeptToAccount = 511340
Case 341
ConvertDeptToAccount = 511341
Case 345
ConvertDeptToAccount = 511345
Case 350
ConvertDeptToAccount = 511350
Case 351
ConvertDeptToAccount = 511351
Case 352
ConvertDeptToAccount = 511352
Case 360
ConvertDeptToAccount = 511360
Case 361
ConvertDeptToAccount = 511361
Case 362
ConvertDeptToAccount = 511362
Case 363
ConvertDeptToAccount = 511363
Case 364
ConvertDeptToAccount = 511364
Case 365
ConvertDeptToAccount = 511365
Case 366
ConvertDeptToAccount = 511366
Case 367
ConvertDeptToAccount = 511367
Case 370
ConvertDeptToAccount = 511370
Case 372
ConvertDeptToAccount = 511372
Case 374
ConvertDeptToAccount = 511374
Case 375
ConvertDeptToAccount = 511375
Case 376
ConvertDeptToAccount = 511376
Case 395
ConvertDeptToAccount = 511395
Case 396
ConvertDeptToAccount = 511396
Case 419
ConvertDeptToAccount = 525420
Case 420
ConvertDeptToAccount = 511420
Case 425
ConvertDeptToAccount = 525426
Case 426
ConvertDeptToAccount = 511426
Case 428
ConvertDeptToAccount = 525429
Case 429
ConvertDeptToAccount = 511429
Case 431
ConvertDeptToAccount = 511431
Case 433
ConvertDeptToAccount = 511433
Case 435
ConvertDeptToAccount = 511435
Case 436
ConvertDeptToAccount = 511436
Case 439
ConvertDeptToAccount = 511439
Case 440
ConvertDeptToAccount = 511440
Case 441
ConvertDeptToAccount = 511441
Case 445
ConvertDeptToAccount = 511445
Case 450
ConvertDeptToAccount = 511450
Case 451
ConvertDeptToAccount = 511451
Case 452
ConvertDeptToAccount = 511452
Case 460
ConvertDeptToAccount = 511460
Case 461
ConvertDeptToAccount = 511461
Case 462
ConvertDeptToAccount = 511462
Case 463
ConvertDeptToAccount = 511463
Case 464
ConvertDeptToAccount = 511464
Case 465
ConvertDeptToAccount = 511465
Case 466
ConvertDeptToAccount = 511466
Case 467
ConvertDeptToAccount = 511467
Case 470
ConvertDeptToAccount = 511470
Case 472
ConvertDeptToAccount = 511472
Case 474
ConvertDeptToAccount = 511474
Case 475
ConvertDeptToAccount = 511475
Case 476
ConvertDeptToAccount = 511476
Case 480
ConvertDeptToAccount = 511480
Case 562
ConvertDeptToAccount = 511562
Case 563
ConvertDeptToAccount = 511563
Case 566
ConvertDeptToAccount = 511566
Case 572
ConvertDeptToAccount = 511572
Case 576
ConvertDeptToAccount = 511576
Case 580
ConvertDeptToAccount = 511580
Case 633
ConvertDeptToAccount = 511633
Case 640
ConvertDeptToAccount = 511640
Case 662
ConvertDeptToAccount = 511662
Case 663
ConvertDeptToAccount = 511663
Case 672
ConvertDeptToAccount = 511672
Case 676
ConvertDeptToAccount = 511676
Case Else
ConvertDeptToAccount = 51200
End Select
End Function
'***************************************************************************
'** DefineNamedRanges F U N C T I O N
'***************************************************************************
Sub DefineNamedRanges()
SetDevelopmentEnv
' CL_Data - Customer_List ID & Name range wo/column headings.
' Defined in UpdateCustomerList
' EL_Data - Employee_List ID & Name range wo/column headings.
' Defined in UpdateEmployeeList
' EL_ID - Employee_List ID range wo/column heading.
' Defined in UpdateEmployeeList
' I_Account - Invoice Account # distribution work area.
Names.Add Name:="I_Account", RefersToR1C1:="=Work!R5C2"
' I_Amount - Invoice Amount distribution work area.
Names.Add Name:="I_Amount", RefersToR1C1:="=Work!R5C3"
' I_Description - Invoice Description distribution work area.
Names.Add Name:="I_Description", RefersToR1C1:="=Work!R5C6"
' I_Distribution - Work area for poking invoice distribution.
Names.Add Name:="I_Distribution", RefersToR1C1:="=Work!R5C2:R5C9"
' I_Item - Invoice Item distribution work area.
Names.Add Name:="I_Item", RefersToR1C1:="=Work!R5C4"
' I_Quanity - Invoice Quanity distribution work area.
Names.Add Name:="I_Quanity", RefersToR1C1:="=Work!R5C5"
' P_Account - Payroll Account # distribution work area.
Names.Add Name:="P_Account", RefersToR1C1:="=Work!R3C2"
' P_Amount - Payroll Amount distribution work area.
Names.Add Name:="P_Amount", RefersToR1C1:="=Work!R3C3"
' P_CheckDate - Payroll CheckDate header work area.
Names.Add Name:="P_CheckDate", RefersToR1C1:="=Work!R7C2"
' P_Distribution - Work area for poking payroll distribution.
Names.Add Name:="P_Distribution", RefersToR1C1:="=Work!R3C2:R3C5"
' P_Employee - Payroll Employee header work area.
Names.Add Name:="P_Employee", RefersToR1C1:="=Work!R7C3"
' P_Field - Payroll Field distribution work area.
Names.Add Name:="P_Field", RefersToR1C1:="=Work!R3C4"
' P_Header - Payroll header work area.
Names.Add Name:="P_Header", RefersToR1C1:="=Work!R7C2:R7C6"
' P_RegHours - Payroll RegHours header work area.
Names.Add Name:="P_RegHours", RefersToR1C1:="=Work!R7C4"
' P_SpecHours - Payroll SpecHours header work area.
Names.Add Name:="P_SpecHours", RefersToR1C1:="=Work!R7C6"
' P_OTHours - Payroll OTHours header work area.
Names.Add Name:="P_OTHours", RefersToR1C1:="=Work!R7C5"
' PC_Formula - Payroll_Calc table summary formula row.
Names.Add Name:="PC_Formula", RefersToR1C1:="=Payroll_Calc!R4:R5"
' PE_CheckDate - Payroll_Entry "Check Date".
Names.Add Name:="PE_CheckDate", RefersToR1C1:="=Payroll_Entry!R1C11"
' PE_Data - Payroll_Entry Timesheet entry range wo/column headings.
' Defined in DefinePayrollEntryFormulas
' PE_Formula - Payroll_Entry data entry formula row.
Names.Add Name:="PE_Formula", RefersToR1C1:="=Payroll_Entry!R5:R5"
' PE_Header - Payroll_Entry header rows.
Names.Add Name:="PE_Header", RefersToR1C1:="=Payroll_Entry!R1:R6"
' PE_InvoiceDate - Payroll_Entry "Invoice Date".
Names.Add Name:="PE_InvoiceDate", RefersToR1C1:="=Payroll_Entry!R3C11"
' PE_PeriodEndDate - Payroll_Entry "Period End Date".
Names.Add Name:="PE_PeriodEndDate", RefersToR1C1:="=Payroll_Entry!R2C11"
' PE_Table - Payroll_Entry Timesheet entry range w/column headings.
' Defined in DefinePayrollEntryFormulas
' PC_TData - Pivot table w/total column header wo/row desc.
' Defined in UpdatePayrollSum
' PWord - DDE Link PWord.
Names.Add Name:="PWord", RefersToR1C1:="=Work!R1C2"
' S_Counter - Status of current procedure.
Names.Add Name:="S_Counter", RefersToR1C1:="=Status!R5C3"
' S_Function - Description of current procedure.
Names.Add Name:="S_Function", RefersToR1C1:="=Status!R3C3"
' DS_PT - Dept_Sum pivot table name.
' PS_PT - Payroll_Sum pivot table name.
DefinePayrollEntryFormulas
End Sub
'***************************************************************************
'** DefinePayrollEntryFormulas F U N C T I O N
'***************************************************************************
Sub DefinePayrollEntryFormulas()
Sheets("Payroll_Entry").Unprotect
RPointer = Range("Payroll_Entry!A7").End(xlDown).Row + 1
Range("Payroll_Entry!C6").Formula = "=COUNTA(C8:C" & Format(RPointer) &
")"
Range("Payroll_Entry!D6").Formula = "=COUNT(D8
" & Format(RPointer) & ")"
Range("Payroll_Entry!E6").Formula = "=COUNT(E8:E" & Format(RPointer) & ")"
Range("Payroll_Entry!F6").Formula = "=COUNT(F8:F" & Format(RPointer) & ")"
Range("Payroll_Entry!G6").Formula = "=COUNT(G8:G" & Format(RPointer) & ")"
Range("Payroll_Entry!H6").Formula = "=SUM(H8:H" & Format(RPointer) & ")"
Range("Payroll_Entry!I6").Formula = "=COUNTA(I8:I" & Format(RPointer) &
")"
Range("Payroll_Entry!J6").Formula = "=COUNT(J8:J" & Format(RPointer) & ")"
Range("Payroll_Entry!K6").Formula = "=COUNT(K8:K" & Format(RPointer) & ")"
Range("Payroll_Entry!L6").Formula = "=COUNTA(L8:L" & Format(RPointer) &
")"
Range("Payroll_Entry!M6").Formula = "=COUNTA(M8:M" & Format(RPointer) &
")"
' Range("Payroll_Entry!N6").Formula = "=SUMIF(N8:N" & Format(RPointer) &
',">0")'
' Range("Payroll_Entry!O6").Formula = "=SUM(O8:O" & Format(RPointer) & ")"
Names.Add Name:="PE_Data", RefersToR1C1:= _
Sheets("Payroll_Entry").Range(Cells(8, 3), Cells(RPointer, 12))
Names.Add Name:="PE_Table", RefersToR1C1:= _
Sheets("Payroll_Entry").Range(Cells(7, 2), Cells(RPointer, 16))
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
'***************************************************************************
'** EditPayrollEntry F U N C T I O N
'***************************************************************************
Sub EditPayrollEntry()
Application.ScreenUpdating = False
Sheets("Payroll_Entry").Unprotect
' Remove worksheet headers
Range("PE_Header").Select
Range("PE_Header").Cut
ActiveSheet.Paste destination:=Sheets("Work").Range("A10")
Sheets("Payroll_Entry").Select
Selection.Delete Shift:=xlUp
' Display input form
ActiveSheet.ShowDataForm
' Replace worksheet headers
Range("PE_Header").Cut
Sheets("Payroll_Entry").Rows("1:1").Insert Shift:=xlUp
DefinePayrollEntryFormulas
Sheets("Work").Visible = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
SendKeys ("{End}{Home}{Home}{End}{UP}")
End Sub
'***************************************************************************
'** FICA F U N C T I O N
'***************************************************************************
Function FICA(Employee, AdjGross)
If IsError(Employee) Then FICA = 0: Exit Function
EmpYtdGross = Range("Employee_List!A5").Offset(Employee, EL_YTD_GROSS - 1)
If (AdjGross + EmpYtdGross) > 90000 Then
If AdjGross > 90000 Then
FICA = 0
Else
FICA = Application.Round((90000 - EmpYtdGross) * 0.062, 2)
End If
Else
FICA = Application.Round(AdjGross * 0.062, 2)
End If
End Function
'***************************************************************************
'** FIT F U N C T I O N
'***************************************************************************
Function FIT(Employee, AdjGross)
If IsError(Employee) Then FIT = 0: Exit Function
ConvFactor = PayFrequencyAnnualConvFactor(Employee)
AnnualGross = (AdjGross * ConvFactor) - _
(Range("Employee_List!A5").Offset(Employee, EL_FED_ALLOW - 1) * 3200)
If Range("Employee_List!A5").Offset(Employee, EL_STATUS - 1) = "Single"
Then
If AnnualGross <= 2650 Then
Table = 0
ElseIf AnnualGross <= 9800 Then
Table = (AnnualGross - 2650) * 0.1
ElseIf AnnualGross <= 31500 Then
Table = 715 + ((AnnualGross - 9800) * 0.15)
ElseIf AnnualGross <= 69750 Then
Table = 3970 + ((AnnualGross - 31500) * 0.25)
ElseIf AnnualGross <= 151950 Then
Table = 13532.5 + ((AnnualGross - 69750) * 0.28)
ElseIf AnnualGross <= 328250 Then
Table = 36548.5 + ((AnnualGross - 151950) * 0.33)
Else
Table = 94727.5 + ((AnnualGross - 328250) * 0.35)
End If
Else
If AnnualGross <= 8000 Then
Table = 0
ElseIf AnnualGross <= 22600 Then
Table = (AnnualGross - 8000) * 0.1
ElseIf AnnualGross <= 66200 Then
Table = 1460 + ((AnnualGross - 22600) * 0.15)
ElseIf AnnualGross <= 120750 Then
Table = 8000 + ((AnnualGross - 66200) * 0.25)
ElseIf AnnualGross <= 189600 Then
Table = 21637.5 + ((AnnualGross - 120750) * 0.28)
ElseIf AnnualGross <= 333250 Then
Table = 40915.5 + ((AnnualGross - 189600) * 0.33)
Else
Table = 88320 + ((AnnualGross - 333250) * 0.35)
End If
End If
FIT = -Application.Round((Table / ConvFactor) + _
Range("Employee_List!A5").Offset(Employee, EL_EXTRA_FIT - 1), 2)
End Function
'***************************************************************************
'** FUTA F U N C T I O N
'***************************************************************************
Function FUTA(Employee, AdjGross)
If IsError(Employee) Then FUTA = 0: Exit Function
EmpYtdGross = Range("Employee_List!A5").Offset(Employee, EL_YTD_GROSS - 1)
If (AdjGross + EmpYtdGross) > 7000 Then
If EmpYtdGross > 7000 Then
FUTA = 0
Else
FUTA = Application.Round((7000 - EmpYtdGross) * 0.008, 2)
End If
Else
FUTA = Application.Round(AdjGross * 0.008, 2)
End If
End Function
'***************************************************************************
'** GenerateAll F U N C T I O N
'***************************************************************************
Sub GenerateAll()
GeneratePayroll
GenerateInvoice
End Sub