summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/Form.pm6
-rwxr-xr-xLedgerSMB/HR.pm8
-rwxr-xr-xLedgerSMB/User.pm2
-rwxr-xr-xbin/hr.pl16
-rwxr-xr-xbin/ir.pl7
-rwxr-xr-xbin/is.pl4
-rwxr-xr-xbin/oe.pl6
-rwxr-xr-xbin/rc.pl16
8 files changed, 48 insertions, 17 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 34ca7187..9376beab 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -2153,6 +2153,9 @@ sub all_departments {
while ( my $ref = $sth->fetchrow_hashref('NAME_lc') ) {
push @{ $self->{all_department} }, $ref;
+ if ($self->{department_id} == $ref->{id}){
+ $self->{department} = "$ref->{description}--$ref->{id}";
+ }
}
$sth->finish;
@@ -2217,6 +2220,7 @@ sub create_links {
my ( $self, $module, $myconfig, $vc, $job ) = @_;
+ $self->{department_id} = $myconfig->{department_id};
# get last customers or vendors
my ( $query, $sth );
@@ -2391,6 +2395,8 @@ sub lastname_used {
my ( $self, $myconfig, $dbh2, $vc, $module ) = @_;
my $dbh = $self->{dbh};
+ $self->{department_id} = $myconfig->{department_id};
+
$vc ||= $self->{vc}; # add default to correct for improper passing
my $arap = ( $vc eq 'customer' ) ? "ar" : "ap";
my $where = "1 = 1";
diff --git a/LedgerSMB/HR.pm b/LedgerSMB/HR.pm
index 4f1f4dab..7324694e 100755
--- a/LedgerSMB/HR.pm
+++ b/LedgerSMB/HR.pm
@@ -126,6 +126,10 @@ sub save_employee {
my ( $null, $managerid ) = split /--/, $form->{manager};
$managerid *= 1;
$form->{sales} *= 1;
+ my ($department, $department_id) = (undef, undef);
+ if ($form->{department}){
+ ($department, $department_id) = split /--/, $form->{department};
+ }
$query = qq|
@@ -150,6 +154,7 @@ sub save_employee {
dob = ?,
iban = ?,
bic = ?,
+ department_id = ?,
managerid = ?
WHERE id = ?|;
$sth = $dbh->prepare($query);
@@ -163,7 +168,8 @@ sub save_employee {
$form->{homephone}, $form->{startdate}, $form->{enddate},
$form->{notes}, $form->{role}, $form->{sales},
$form->{email}, $form->{ssn}, $form->{dob},
- $form->{iban}, $form->{bic}, $managerid,
+ $form->{iban}, $form->{bic}, $department_id,
+ $managerid,
$form->{id}
) || $form->dberror( __FILE__ . ':' . __LINE__ . ':' . $query );
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index cbdb0c41..00047f36 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -137,7 +137,7 @@ sub fetch_config {
email, fax, menuwidth, name, numberformat,
password, print, printer, role, sid,
signature, stylesheet, tel, templates,
- timeout, vclimit, u.username
+ timeout, vclimit, u.username, department_id
FROM users_conf as uc, users as u
WHERE u.username = ?
AND u.id = uc.id;"
diff --git a/bin/hr.pl b/bin/hr.pl
index 78b098c0..d98d8eed 100755
--- a/bin/hr.pl
+++ b/bin/hr.pl
@@ -528,6 +528,17 @@ sub employee_links {
for ( keys %$form ) { $form->{$_} = $form->quote( $form->{$_} ) }
+ $form->all_departments;
+ if ( @{ $form->{all_department} } ) {
+ $form->{selectdepartment} = "<option>\n";
+ $form->{department} = "$form->{department}--$form->{department_id}"
+ if $form->{department_id};
+
+ for ( @{ $form->{all_department} } ) {
+ $form->{selectdepartment} .=
+qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
+ }
+ }
if ( @{ $form->{all_deduction} } ) {
$form->{selectdeduction} = "<option>\n";
for ( @{ $form->{all_deduction} } ) {
@@ -731,6 +742,11 @@ sub employee_header {
<th align=right nowrap>| . $locale->text('BIC') . qq|</th>
<td><input name=bic size=11 maxlength=11 value="$form->{bic}"></td>
</tr>
+ <tr>
+ <th align=right nowrap>| . $locale->text('Department') . qq|</th>
+ <td><select name="department">
+ $form->{selectdepartment}
+ </select>
</table>
</td>
</tr>
diff --git a/bin/ir.pl b/bin/ir.pl
index d892cedd..37fa75fc 100755
--- a/bin/ir.pl
+++ b/bin/ir.pl
@@ -139,14 +139,15 @@ qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
# departments
if ( @{ $form->{all_department} } ) {
$form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}"
- if $form->{department_id};
for ( @{ $form->{all_department} } ) {
$form->{selectdepartment} .=
qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
}
}
+ $form->{department} = "$form->{department}--$myconfig{department_id}"
+ if $myconfig{department_id};
+
if ( @{ $form->{all_language} } ) {
$form->{selectlanguage} = "<option>\n";
@@ -273,7 +274,7 @@ sub form_header {
for (qw(vendor department)) {
$form->{"select$_"} = $form->unescape( $form->{"select$_"} );
$form->{"select$_"} =~ s/ selected//;
- $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
+ $form->{"select$_"} =~ s/(<option value="[^"]*\Q$form->{$_}\E")/$1 selected/;
}
if ( $form->{selectlanguage} ) {
diff --git a/bin/is.pl b/bin/is.pl
index 3338018a..6749bea7 100755
--- a/bin/is.pl
+++ b/bin/is.pl
@@ -153,6 +153,8 @@ qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
}
}
+ $form->{department} = "$form->{department}--$myconfig{department_id}"
+ if $myconfig{department_id};
$form->{employee} = "$form->{employee}--$form->{employee_id}";
@@ -306,7 +308,7 @@ sub form_header {
for (qw(customer department employee)) {
$form->{"select$_"} = $form->unescape( $form->{"select$_"} );
$form->{"select$_"} =~ s/ selected//;
- $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
+ $form->{"select$_"} =~ s/(<option value="[^"]*\Q$form->{$_}\E")/$1 selected/;
}
$form->{exchangerate} =
diff --git a/bin/oe.pl b/bin/oe.pl
index 64732dab..81c147cf 100755
--- a/bin/oe.pl
+++ b/bin/oe.pl
@@ -192,8 +192,6 @@ qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
# departments
if ( @{ $form->{all_department} } ) {
$form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}"
- if $form->{department_id};
for ( @{ $form->{all_department} } ) {
$form->{selectdepartment} .=
@@ -372,7 +370,7 @@ sub form_header {
for ( "$form->{vc}", "department", "employee" ) {
$form->{"select$_"} = $form->unescape( $form->{"select$_"} );
$form->{"select$_"} =~ s/ selected//;
- $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
+ $form->{"select$_"} =~ s/(<option value="[^"]*\Q$form->{$_}\E")/$1 selected/;
}
$form->{exchangerate} =
@@ -1512,6 +1510,8 @@ sub transactions {
# split vendor / customer
( $form->{ $form->{vc} }, $form->{"$form->{vc}_id"} ) =
split( /--/, $form->{ $form->{vc} } );
+ $form->{department} = "$form->{department}--$myconfig{department_id}"
+ if $myconfig{department_id};
OE->transactions( \%myconfig, \%$form );
diff --git a/bin/rc.pl b/bin/rc.pl
index 8f282f57..fe55c397 100755
--- a/bin/rc.pl
+++ b/bin/rc.pl
@@ -402,7 +402,7 @@ sub close_till {
$form->{transdate} = $form->current_date( \%myconfig );
GL->post_transaction( \%myconfig, \%$form );
delete $form->{id};
- $lines .= "Cumulative Error: $amount";
+ $lines .= "Cumulative Error: $amount\n\n";
$form->{accno} = $form->{accno_1};
RC->getbalance( \%myconfig, \%$form );
$amount = $form->{balance} * -1;
@@ -419,7 +419,7 @@ sub close_till {
$head =
"Closing Till $pos_config{till} for $form->{login}\n"
. "Date: $form->{transdate}\n\n\n";
- my @cashlines = [ $locale->text("Cash Breakdown:") ];
+ my @cashlines = ( $locale->text("Cash Breakdown:") );
foreach my $unit ( @{ $pos_config{'breakdown'} } ) {
# XXX Needs to take into account currencies that don't use 2 dp
@@ -428,34 +428,34 @@ sub close_till {
$calcval = sprintf( '%03d', $calcval * 100 ) if $calcval < 1;
my $subval = 'sub_' . $calcval;
$calcval = 'calc_' . $calcval;
- push @cashlines, "$form->{$calcval} x $parseval = $form->{$subval}";
+ push @cashlines, "$form->{$calcval} x $parsed = $form->{$subval}";
}
push @cashlines,
$locale->text( "Total Cash in Drawer: [_1]", $form->{sub_sub} );
push @cashlines,
- $locale->text( "Less Cash in Till At Start: [_1]", $form->{till_cash} );
+ $locale->text( "Less Cash in Till At Start: [_1]", $pos_config{till_cash} );
push @cashlines, "\n";
$cash = join( "\n", @cashlines );
$foot = $locale->text( "Cumulative Error: [_1]", $difference ) . "\n";
$foot .=
$locale->text( 'Reset Till By [_1]', $amount ) . "\n\n\n\n\n\n\n\n\n\n";
open( PRN, "|-", ${LedgerSMB::Sysconfig::printer}{Printer} );
+
print PRN $head;
print PRN $lines;
print PRN $cash;
- print PRN $cash;
print PRN $foot;
close PRN;
- if ( $difference > 0 ) {
+ if ( $difference < 0 ) {
$message = $locale->text( "You are over by [_1]", $difference );
}
- elsif ( $difference < 0 ) {
+ elsif ( $difference > 0 ) {
$message = $locale->text( "You are under by [_1]", $difference * -1 );
}
else {
$message =
- $local->text("Congratulations! Your till is exactly balanced.");
+ $locale->text("Congratulations! Your till is exactly balanced.");
}
$form->info($message);
}