X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8bee4bac5b3e562f26e866ca9ab337af20c97314..a2777d1a:/SL/AP.pm diff --git a/SL/AP.pm b/SL/AP.pm index ed0fe98c6..ad8749f56 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -35,8 +35,11 @@ package AP; use SL::DBUtils; +use SL::IO; use SL::MoreCommon; +use strict; + sub post_transaction { $main::lxdebug->enter_sub(); @@ -153,9 +156,6 @@ sub post_transaction { # amount for total AP $form->{payables} = $form->{invtotal}; - $form->{datepaid} = $form->{transdate} unless ($form->{datepaid}); - my $datepaid = ($form->{invpaid} != 0) ? $form->{datepaid} : undef; - # update exchangerate if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) { $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0, @@ -193,14 +193,14 @@ sub post_transaction { $query = qq|UPDATE ap SET invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?, - amount = ?, duedate = ?, paid = ?, datepaid = ?, netamount = ?, + amount = ?, duedate = ?, paid = ?, netamount = ?, curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ? WHERE id = ?|; @values = ($form->{invnumber}, conv_date($form->{transdate}), $form->{ordnumber}, conv_i($form->{vendor_id}), $form->{taxincluded} ? 't' : 'f', $form->{invtotal}, conv_date($form->{duedate}), $form->{invpaid}, - conv_date($datepaid), $form->{netamount}, + $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}), $form->{storno}, $form->{storno_id}, $form->{id}); @@ -352,6 +352,8 @@ sub post_transaction { do_query($form, $dbh, $query, $form->{invpaid}, $form->{invpaid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id})); } + IO->set_datepaid(table => 'ap', id => $form->{id}, dbh => $dbh); + my $rc = 1; if (!$provided_dbh) { $dbh->commit(); @@ -473,7 +475,7 @@ sub ap_transactions { } my @a = qw(transdate invnumber name); - push @a, "employee" if $self->{l_employee}; + push @a, "employee" if $form->{l_employee}; my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; my $sortorder = join(', ', map { "$_ $sortdir" } @a); @@ -640,6 +642,7 @@ sub setup_form { $j = 0; $k = 0; + next unless $form->{acc_trans}{$key}; for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { if ($key eq "AP_paid") { @@ -783,6 +786,8 @@ sub storno { do_query($form, $dbh, $query, (values %$row)); } + map { IO->set_datepaid(table => 'ap', id => $_, dbh => $dbh) } ($id, $new_id); + $dbh->commit; $main::lxdebug->leave_sub();