diff options
-rwxr-xr-x | LedgerSMB/PE.pm | 28 | ||||
-rwxr-xr-x | bin/pe.pl | 4 |
2 files changed, 22 insertions, 10 deletions
diff --git a/LedgerSMB/PE.pm b/LedgerSMB/PE.pm index 58d7a6cf..7fc00012 100755 --- a/LedgerSMB/PE.pm +++ b/LedgerSMB/PE.pm @@ -1431,23 +1431,33 @@ sub delete_translation { } +sub timecard_get_currency { + my $self = shift @_; + my $form = shift @_; + my $dbh = $form->{dbh}; + my $query = qq|SELECT curr FROM customer WHERE id = ?|; + my $sth = $dbh->prepare($query); + $sth->execute($form->{customer_id}); + my ($curr) = $sth->fetchrow_array; + $form->{currency} = $curr; +} sub project_sales_order { - my ($self, $myconfig, $form) = @_; + my ($self, $myconfig, $form) = @_; - # connect to database - my $dbh = $form->{dbh}; + # connect to database + my $dbh = $form->{dbh}; - my $query = qq|SELECT current_date|; - my ($transdate) = $dbh->selectrow_array($query); + my $query = qq|SELECT current_date|; + my ($transdate) = $dbh->selectrow_array($query); - $form->all_years($myconfig, $dbh); + $form->all_years($myconfig, $dbh); - $form->all_projects($myconfig, $dbh, $transdate); + $form->all_projects($myconfig, $dbh, $transdate); - $form->all_employees($myconfig, $dbh, $transdate); + $form->all_employees($myconfig, $dbh, $transdate); - $dbh->commit; + $dbh->commit; } @@ -2528,7 +2528,7 @@ sub generate_sales_orders { $i = 0; $order->{"$order->{vc}_id"} = $_; - + AA->get_name(\%myconfig, \%$order); foreach $ref (@ {$form->{order}{$_} }) { @@ -2550,6 +2550,8 @@ sub generate_sales_orders { $order->{reqdate} = $order->{transdate}; for (qw(intnotes employee employee_id)) { delete $order->{$_} } + PE->timecard_get_currency(\%$order); + if (OE->save(\%myconfig, \%$order)) { if (! PE->allocate_projectitems(\%myconfig, \%$order)) { |