X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/83b760fbb97a5fd96ec2b9b6fa6ee146e72d08c0..a7b9212927afc0b5b02295db4f7c2fba7318508f:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 1cf71d8ee..0afc2d842 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -46,7 +46,6 @@ use SL::DB::PurchaseInvoice; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; -require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; use strict; @@ -91,11 +90,9 @@ sub add { $main::auth->assert('general_ledger'); - return $main::lxdebug->leave_sub() if (load_draft_maybe()); - $form->{title} = "Add"; - $form->{callback} = "ap.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback}; + $form->{callback} = "ap.pl?action=add" unless $form->{callback}; AP->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; @@ -149,6 +146,8 @@ sub create_links { if (!$params{dont_save}) { %saved = map { ($_ => $form->{$_}) } qw(direct_debit taxincluded); $saved{duedate} = $form->{duedate} if $form->{duedate}; + $saved{currency} = $form->{currency} if $form->{currency}; + $saved{taxincluded} = $form->{taxincluded} if $form->{taxincluded}; } IR->get_vendor(\%myconfig, \%$form); @@ -326,6 +325,7 @@ sub form_header { $form->{javascript} .= qq||; $form->{javascript} .= qq||; $form->{javascript} .= qq||; + $form->{javascript} .= qq||; $form->header(); @@ -428,6 +428,11 @@ sub form_header { $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); } + #deaktivieren von gebuchten Zahlungen ausserhalb der Bücherkontrolle, vorher prüfen ob heute eingegeben + if ($form->date_closed($form->{"gldate_$i"})) { + $changeable = 0; + } + $form->{'paidaccount_changeable_'. $i} = $changeable; $form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}}; @@ -449,7 +454,7 @@ sub form_footer { my $num_due; my $num_follow_ups; if ($::form->{id}) { - my $follow_ups = FU->follow_ups('trans_id' => $::form->{id}); + my $follow_ups = FU->follow_ups('trans_id' => $::form->{id}, 'not_done' => 1); if (@{ $follow_ups }) { $num_due = sum map { $_->{due} * 1 } @{ $follow_ups }; @@ -596,8 +601,13 @@ sub post_payment { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($form->{"datepaid_$i"}, \%myconfig)); + + #Zusätzlich noch das Buchungsdatum in die Bücherkontrolle einbeziehen + # (Dient zur Prüfung ob ZE oder ZA geprüft werden soll) $form->error($locale->text('Cannot post payment for a closed period!')) - if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); + if ($form->date_closed($form->{"datepaid_$i"}) && !$form->date_closed($form->{"gldate_$i"}, \%myconfig)); if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { $form->{"exchangerate_$i"} = $form->{exchangerate} @@ -676,8 +686,13 @@ sub post { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($form->{"datepaid_$i"}, \%myconfig)); + + #Zusätzlich noch das Buchungsdatum in die Bücherkontrolle einbeziehen + # (Dient zur Prüfung ob ZE oder ZA geprüft werden soll) $form->error($locale->text('Cannot post payment for a closed period!')) - if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); + if ($form->date_closed($form->{"datepaid_$i"}) && !$form->date_closed($form->{"gldate_$i"}, \%myconfig)); if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { $form->{"exchangerate_$i"} = $form->{exchangerate} @@ -693,7 +708,7 @@ sub post { my ($vendor) = split /--/, $form->{vendor}; if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") { &update; - ::end_of_request(); + $::dispatcher->end_request; } my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected}; my ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; @@ -714,7 +729,6 @@ sub post { $form->save_history; } # /saving the history - remove_draft() if $form->{remove_draft}; # Dieser Text wird niemals ausgegeben: Probleme beim redirect? $form->redirect($locale->text('Transaction posted!')) unless $inline; } else { @@ -903,7 +917,8 @@ sub ap_transactions { vendornumber country ustid taxzone payment_terms charts direct_debit); my @hidden_variables = map { "l_${_}" } @columns; - push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto department); + push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto department + parts_partnumber parts_description); my $href = build_std_url('action=ap_transactions', grep { $form->{$_} } @hidden_variables); @@ -928,7 +943,7 @@ sub ap_transactions { 'vendornumber' => { 'text' => $locale->text('Vendor Number'), }, 'country' => { 'text' => $locale->text('Country'), }, 'ustid' => { 'text' => $locale->text('USt-IdNr.'), }, - 'taxzone' => { 'text' => $locale->text('Steuersatz'), }, + 'taxzone' => { 'text' => $locale->text('Tax rate'), }, 'payment_terms' => { 'text' => $locale->text('Payment Terms'), }, 'charts' => { 'text' => $locale->text('Buchungskonto'), }, 'direct_debit' => { 'text' => $locale->text('direct debit'), }, @@ -959,6 +974,8 @@ sub ap_transactions { push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if ($form->{ordnumber}); push @options, $locale->text('Notes') . " : $form->{notes}" if ($form->{notes}); push @options, $locale->text('Transaction description') . " : $form->{transaction_description}" if ($form->{transaction_description}); + push @options, $locale->text('Part Description') . " : $form->{parts_description}" if $form->{parts_description}; + push @options, $locale->text('Part Number') . " : $form->{parts_partnumber}" if $form->{parts_partnumber}; push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1) if ($form->{transdatefrom}); push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1) if ($form->{transdateto}); push @options, $locale->text('Open') if ($form->{open});