#===================================================================== # LedgerSMB Small Medium Business Accounting # http://www.ledgersmb.org/ # # Copyright (C) 2006 # This work contains copyrighted information from a number of sources all used # with permission. # # This file contains source code included with or based on SQL-Ledger which # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed # under the GNU General Public License version 2 or, at your option, any later # version. For a full list including contact information of contributors, # maintainers, and copyright holders, see the CONTRIBUTORS file. # # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork): # Copyright (c) 2004 # # Author: DWS Systems Inc. # Web: http://www.sql-ledger.org # # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #====================================================================== # # payroll module # #====================================================================== use LedgerSMB::HR; use LedgerSMB::User; 1; # end of main sub add { $label = "Add " . ucfirst $form->{db}; $form->{title} = $locale->text($label); $form->{callback} = "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; &{"$form->{db}_links"}; } sub search { &{"search_$form->{db}"} } sub search_employee { $form->{title} = $locale->text('Employees'); @a = (); push @a, qq| | . $locale->text('Pos'); push @a, qq| | . $locale->text('ID'); push @a, qq| | . $locale->text('Employee Number'); push @a, qq| | . $locale->text('Employee Name'); push @a, qq| | . $locale->text('Address'); push @a, qq| | . $locale->text('City'); push @a, qq| | . $locale->text('State/Province'); push @a, qq| | . $locale->text('Zip/Postal Code'); push @a, qq| | . $locale->text('Country'); push @a, qq| | . $locale->text('Work Phone'); push @a, qq| | . $locale->text('Home Phone'); push @a, qq| | . $locale->text('Startdate'); push @a, qq| | . $locale->text('Enddate'); push @a, qq| | . $locale->text('Sales'); push @a, qq| | . $locale->text('Manager'); push @a, qq| | . $locale->text('Role'); push @a, qq| | . $locale->text('Login'); push @a, qq| | . $locale->text('E-mail'); push @a, qq| | . $locale->text('SSN'); push @a, qq| | . $locale->text('DOB'); push @a, qq| | . $locale->text('IBAN'); push @a, qq| | . $locale->text('BIC'); push @a, qq| | . $locale->text('Notes'); $form->header; print qq|
{script}>
$form->{title}
| . $locale->text('Employee Number') . qq|
| . $locale->text('Employee Name') . qq|
| . $locale->text('Startdate') . qq| | . $locale->text('From') . qq| | . $locale->text('To') . qq|
| . $locale->text('Notes') . qq|
 | . $locale->text('All') . qq|  | . $locale->text('Active') . qq|  | . $locale->text('Inactive') . qq|  | . $locale->text('Orphaned') . qq|  | . $locale->text('Sales') . qq|
| . $locale->text('Include in Report') . qq| |; while (@a) { print qq|\n|; for ( 1 .. 5 ) { print qq|\n|; } print qq|\n|; } print qq|
| . shift @a; print qq|

|; $form->hide_form(qw(db path login sessionid)); print qq|
|; if ( $form->{lynx} ) { require "bin/menu.pl"; &menubar; } print qq| |; } sub list_employees { HR->employees( \%myconfig, \%$form ); $href = "$form->{script}?action=list_employees&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; $form->sort_order(); $callback = "$form->{script}?action=list_employees&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; @columns = $form->sort_columns( qw(id employeenumber name address city state zipcode country workphone homephone email startdate enddate ssn dob iban bic sales role manager login notes) ); unshift @columns, "ndx"; foreach $item (@columns) { if ( $form->{"l_$item"} eq "Y" ) { push @column_index, $item; # add column to href and callback $callback .= "&l_$item=Y"; $href .= "&l_$item=Y"; } } %role = ( user => $locale->text('User'), supervisor => $locale->text('Supervisor'), manager => $locale->text('Manager'), admin => $locale->text('Administrator') ); $option = $locale->text('All'); if ( $form->{status} eq 'sales' ) { $option = $locale->text('Sales'); } if ( $form->{status} eq 'orphaned' ) { $option = $locale->text('Orphaned'); } if ( $form->{status} eq 'active' ) { $option = $locale->text('Active'); } if ( $form->{status} eq 'inactive' ) { $option = $locale->text('Inactive'); } if ( $form->{employeenumber} ) { $callback .= "&employeenumber=" . $form->escape( $form->{employeenumber}, 1 ); $href .= "&employeenumber=" . $form->escape( $form->{employeenumber} ); $option .= "\n
" . $locale->text('Employee Number') . " : $form->{employeenumber}"; } if ( $form->{name} ) { $callback .= "&name=" . $form->escape( $form->{name}, 1 ); $href .= "&name=" . $form->escape( $form->{name} ); $option .= "\n
" . $locale->text('Employee Name') . " : $form->{name}"; } if ( $form->{startdatefrom} ) { $callback .= "&startdatefrom=$form->{startdatefrom}"; $href .= "&startdatefrom=$form->{startdatefrom}"; $fromdate = $locale->date( \%myconfig, $form->{startdatefrom}, 1 ); } if ( $form->{startdateto} ) { $callback .= "&startdateto=$form->{startdateto}"; $href .= "&startdateto=$form->{startdateto}"; $todate = $locale->date( \%myconfig, $form->{startdateto}, 1 ); } if ( $fromdate || $todate ) { $option .= "\n
" . $locale->text('Startdate') . " $fromdate - $todate"; } if ( $form->{notes} ) { $callback .= "¬es=" . $form->escape( $form->{notes}, 1 ); $href .= "¬es=" . $form->escape( $form->{notes} ); $option .= "\n
" if $option; $option .= $locale->text('Notes') . " : $form->{notes}"; } $form->{callback} = "$callback&sort=$form->{sort}"; $callback = $form->escape( $form->{callback} ); $column_header{ndx} = qq| |; $column_header{id} = qq|| . $locale->text('ID') . qq||; $column_header{employeenumber} = qq|| . $locale->text('Number') . qq||; $column_header{name} = qq|| . $locale->text('Name') . qq||; $column_header{manager} = qq|| . $locale->text('Manager') . qq||; $column_header{address} = qq|| . $locale->text('Address') . qq||; $column_header{city} = qq|| . $locale->text('City') . qq||; $column_header{state} = qq|| . $locale->text('State/Province') . qq||; $column_header{zipcode} = qq|| . $locale->text('Zip/Postal Code') . qq||; $column_header{country} = qq|| . $locale->text('Country') . qq||; $column_header{workphone} = qq|| . $locale->text('Work Phone') . qq||; $column_header{homephone} = qq|| . $locale->text('Home Phone') . qq||; $column_header{startdate} = qq|| . $locale->text('Startdate') . qq||; $column_header{enddate} = qq|| . $locale->text('Enddate') . qq||; $column_header{notes} = qq|| . $locale->text('Notes') . qq||; $column_header{role} = qq|| . $locale->text('Role') . qq||; $column_header{login} = qq|| . $locale->text('Login') . qq||; $column_header{sales} = qq|| . $locale->text('S') . qq||; $column_header{email} = qq|| . $locale->text('E-mail') . qq||; $column_header{ssn} = qq|| . $locale->text('SSN') . qq||; $column_header{dob} = qq|| . $locale->text('DOB') . qq||; $column_header{iban} = qq|| . $locale->text('IBAN') . qq||; $column_header{bic} = qq|| . $locale->text('BIC') . qq||; $form->{title} = $locale->text('Employees'); $form->header; print qq|
$form->{title}
$option
|; for (@column_index) { print "$column_header{$_}\n" } print qq| |; $i = 0; foreach $ref ( @{ $form->{all_employee} } ) { $i++; $ref->{notes} =~ s/\r?\n/
/g; for (@column_index) { $column_data{$_} = "" } $column_data{ndx} = ""; $column_data{sales} = ( $ref->{sales} ) ? "" : ""; $column_data{role} = qq||; $column_date{address} = qq|$ref->{address1} $ref->{address2}|; $column_data{name} = ""; if ( $ref->{email} ) { $email = $ref->{email}; $email =~ s//\>/; $column_data{email} = qq||; } $j++; $j %= 2; print " "; for (@column_index) { print "$column_data{$_}\n" } print qq| |; } $i = 1; $button{'HR--Employees--Add Employee'}{code} = qq| |; $button{'HR--Employees--Add Employee'}{order} = $i++; foreach $item ( split /;/, $myconfig{acs} ) { delete $button{$item}; } print qq|
$ref->{$_} $ix $role{"$ref->{role}"} {script}?action=edit&db=employee&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&callback=$callback>$ref->{name} $email


{script}> |; $form->hide_form(qw(callback db path login sessionid)); foreach $item ( sort { $a->{order} <=> $b->{order} } %button ) { print $item->{code}; } if ( $form->{lynx} ) { require "bin/menu.pl"; &menubar; } print qq|
|; } sub edit { # $locale->text('Edit Employee') # $locale->text('Edit Deduction') $label = ucfirst $form->{db}; $form->{title} = "Edit $label"; &{"$form->{db}_links"}; } sub employee_links { #$form->{deductions} = 1; HR->get_employee( \%myconfig, \%$form ); for ( keys %$form ) { $form->{$_} = $form->quote( $form->{$_} ) } if ( @{ $form->{all_deduction} } ) { $form->{selectdeduction} = "