Adding a Payroll calculator
Andrew Sackville-West
andrew at farwestbilliards.com
Wed Nov 2 12:33:30 EST 2005
This is in response to several above.... and my own thoughts on it last
night.
Derek Atkins wrote:
>
>>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;
>
>
> Um, this seems particular hard-coded and not very flexible. It's even
> WORSE if it's in C, because then the numbers aren't user-settable.
> You /need/ to support this kind of configuration in a user-settable
> method. How do you propose to do that?
>
> This is why I'm suggesting scheme, because then you can configure this
> kind of "function" in scheme and users can change the values without
> having to rebuild gnucash. I'm open to other suggestions, too. We
> can certainly try to create a generalized "graduated tax" in C, but
> you'd need to figure out some way to allow the user to configure that.
>
WHy not do something like this:
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_numeric taxFloor; /* minimum value below which tax is NOT applied */
gnc_numeric tax Ceiling; /* max value above which tax is NOT applied */
gnc_commodity * currency;
gboolean active;
char * language;
Account * tax_acc;
};
This allows you to set tax brackets which would work for US graduated
taxes by setting a different instance for each bracket with min and max
values set by the user. But it could also apply to "Wage base" taxes
like Social Security or Unemployment Tax which both only apply to the
first $x of wage per year. by setting the taxFloor to 0, and taxCeiling
to $x then you only tax the first $x wages. etc. you couuld hard code a
default so that if tax Ceiling is $0 then the tax always applies (i.e.
medicare).
I think we might need something like this as well:
struct _gncPayrollItem
{
char * id;
char * PIName; /* name of the item */
char * PIType; /* addition or deduction */
Account * PIAccount;/* account linked to this Item (can be
blank, can we do that with Account?) */
gboolean taxable; /* some items are taxable */
/* some method of determining which taxes apply??? */
gnc_numeric PIAmount; /* the amount */
gnc_commodity * currency;
gboolean active;
char * language;
};
I really don't know what I'm doing here as far as gnc code goes, but it
works like this. Everything that is part of a paycheck has to be
associated with an _gncPayrollItem. Each of these items is previsouly
set-up by the user and linked to the employee. you can have one for
wages, one for employee mileage reimbursements, one for reported tips
(and then another one to deduct the employee tips back out), one for
reclaiming employee advances etc. etc. etc. This idean is stolen right
out of QB by the way.... The point is there are lots of other things
that go on in payroll besides taxes and any reasonable solution, in my
mind, needs to include these things. So you can have an employee with a
variety of _gncTax applied and a variety of _gncPayrollItem applied to
build up the whole transaction.
For those that question the tips portion above it works like this: If
you have tipped employees (/me) then you have to tax them on their tips
so their tips are included in the Total Wages before taxes are
calculated. Then those tips are deducted back out (because the employee
already has them) out of the final paycheck.
A
More information about the gnucash-devel
mailing list