Adding a Payroll calculator

Jay Scherrer jay at scherrer.com
Wed Nov 2 00:35:33 EST 2005


On Tue, 2005-11-01 at 23:30 -0500, Derek Atkins wrote:
> Quoting Jay Scherrer <jay at scherrer.com>:
> 
> [snip]
> > 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 */
> 
> technically, gnc_numeric is the wrong type for all but the 'rate'.
> the workday and type should be an enum, or a string.
> 
I think Derek was using the numeric workday for date arithmetic. However
Employee_type should be char * but Employee_overTimeRate should remain a
number.

> > struct +gncBusiness
> > {
> > char *          id;
> > char *          businessName;   /* Name */
> > char *          businessType;   /* sole-proprieter, partnership, LLC  */
> > char *          businessCatagory;/* LandI or IRS listing*/
> > }
> 
> There is no 'gncBusiness' object.  This should all go into the QofBook
> where it belongs.
> 
I was looking for that. In what directory is QofBook located under
gnucash/src/ ? 
> > 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;
> > };
> 
> How does this deal with a graduated tax?
> 
We probably could create member functions something like this function I
had created for calculating 2001 income taxes using perl. This should
not be to difficult to convert to "c". It's just a bunch if statements. 

Example: scheduleY1()

This example is used for calculating the income tax for someone who is
married, filing jointly, and earns more then $100,000 according to the
IRS 1040 2001 rates. 

variables: 
[$line41 = wages, $line42 = Tax, scheduleY1 = member function]
## Status = married filing joint ##
sub scheduleY1(){
    my $line41 = shift;
    if ($line41 >= 0 && $line41 <= 12000){
	$line42 = $line41 * .10;
    }elsif ($line41 >= 12000 && $line41 <= 46700) {
	$line42 = ((($line41 - 12000)* .15) + 12000);
    }elsif ($line41 >= 46700 && $line41 <= 112850) {
	$line42 = ((($line41 - 46700)* .27) + 6405);
    }elsif ($line41 >= 112850 && $line41 <= 171950) {
	$line42 = ((($line41 - 112850)* .30) + 24265.50);
    }elsif ($line41 >= 171950 && $line41 <= 307050) {
	$line42 = ((($line41 - 171950)* .35) + 41995.50);
    }elsif ($line41 > 307050) {
	$line42 = ((($line41 - 307050)* .38.6) + 89280.50);
    }
    return $line42;
} 
> > My .02,
> > Jay Scherrer
> 
> -derek
> 
Jay Scherrer



More information about the gnucash-devel mailing list