Adding a Payroll calculator

Jay Scherrer jay at scherrer.com
Tue Nov 1 22:45:22 EST 2005


<Snipit>
> > 
> > There are two major occurrences of payroll calculation. 
> > 1: performing the actual paycheck calculation.
> > 2: Then reporting the totals for the quarterly tax return. 
> 
> FOr my own purposes, I accumulate tax liabilities throughout the period 
> and with a couple of reports can determine both my outstanding tax 
> liabilities and labor expenses (used to calculate FICA, and MCare, among 
> others. WHat I can't get is units of work (hours in this case) and there 
> would have to be some method of recording that as some taxes are $x.xx 
> per hour as opposed to a percentage.
> > 
> > Payroll taxes could be members of the Tax class and still be different
> > from regular sales and income taxes. However Payroll taxes for the us
> > will be accounted on a quarterly basis with the IRS form 941. 
> > I myself am very rusty on c but here's a shot. And I haven't the
> > experience with any GUI's except Perl::Tk and html.
> > 
> > I have used Derek Atkins's _gncEmployee class as a template for this
> > Example: 
> > 
> > struct _gncTax 
> > {
> >   char *          id; 
> >   char *          taxName;   /* Medicare, SSI, Sales,..etc */
> >   char *          taxType;   /* Payroll, Payroll, Sales  */
> >   char *          taxCatagory;/* Employee, Salary, Sale */
> >   gnc_numeric     taxRate;   /* .0145, .062, .893 */
> >   gnc_numeric     taxFrequency; /* hourly, monthly, unit */ 
> 
> is this -----------^ used to store what unit the tax is calculated on or 
> how often the tax is accumulated? IOW where do you store information as 
> what the tax is applied to?
> 
This table would only store the different types and rates of taxes (SSI,
Medicare, State sales tax). For Labor and Industries we are given rates
according to the nature of the business. And with Unemployment we are
give rates according to the rating a business has, length of time and
turnover of employees. 
> >   gnc_commodity * currency;     
> >   gboolean        active;
> >   char *          language;
> >   Account *       tax_acc;     
> > };
> > 
> > 
> > Jay Scherrer
> > 
> > 
The resulting calculations would come when we combine or the tables. 
Perhaps an example would relate ideas:

Joe Smith a construction laborer [businessCatagory] who is paid hourly
[employeeType] at the rate of $17.50 [employeeRate] an hour. He has
accumulated 86 hours [employeeHours] for this pay period [payPeriod].
Over time is calculated at time and one half [employeeOverTimeRate]. 

To figure this employee's paycheck we would need to figure the
following: employeeOverTime, employeeSSI, employeeMedicare, employeeL&I,
employeeFICA, CompanySSI, CompanyMedicare, companyUnemployment,
companyLandI, PayPeriod.

By using the given: businessCatagory, employeeType, employeeRate,
employeeHours, payPeriod.

The Taxable items are:
Employee's over time
employeeOvertime = (employeeHours - 80) * (employeeOverTimeRate);

Employee's SSI and Medicare
employeeSSI = (employeeRate * employeeHours) * (taxType = SSI = .062); 
employeeMedicare = 
(employeeRate * employeeHours) * (taxType = medicare = .0145);

Company's SSI and Medicare
companySSI = (employeeRate * employeeHours) * (taxType = SSI = .062); 
companyMedicare = 
(employeeRate * employeeHours) * (taxType = medicare = .0145);

Company's Labor and Industries
employeeLandI = (employeeHours * taxType = employeeBusinessCatagory);
*employee's portion
companyLandI = (employeeHours * taxType = businessCatagory);
*Company's portion
*Labor and industries charges by business classification, in this case
Construction Laborer. 

The totals should be stored in one table or [account] that collects
payroll for the whole company. This table will be used when quarterly
taxes are due. And one for the employee.

You see there are at least three classes:
[employee] [business] [tax]

Derek Atkins's employee plus a couple more members:
struct _gncEmployee 
{
  QofInstance     inst;
  char *          id;
  char *          username;
  GncAddress *    addr;
  gnc_commodity * currency;
  gboolean        active;
 
  char *          language;
  char *          acl;
  gnc_numeric     workday;
  gnc_numeric     rate;
    gnc_numeric     type;         /* employeeType */
    gnc_numeric     overTimeRate; /* employeeOverTimeRate */
 
  Account *        ccard_acc;
};

struct +gncBusiness
{
char *          id; 
char *          businessName;   /* Name */
char *          businessType;   /* sole-proprieter, partnership, LLC  */
char *          businessCatagory;/* LandI or IRS listing*/
}

struct _gncTax 
{
char *          id; 
char *          taxName;   /* Medicare, SSI, Sales,..etc */
char *          taxType;   /* Payroll, Payroll, Sales  */
char *          taxCatagory;/* Employee, Salary, Sale */
gnc_numeric     taxRate;   /* .0145, .062, .893 */
gnc_numeric     taxFrequency; /* hourly, monthly, unit */ 
gnc_commodity * currency;     
gboolean        active;
char *          language;
Account *       tax_acc;     
};

My .02,
Jay Scherrer



More information about the gnucash-devel mailing list