]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/ap.pl
Einkaufs- & Verkaufsbelege: Bearbeiter*in & Verkäufer*in mit aktueller Benutzer*in...
[mfinanz.git] / bin / mozilla / ap.pl
index 3599cbadabda662f68df0de4ed46bb22d4682773..687f149cd7bdb4e8e2fda7fb5593d8872da3c8b3 100644 (file)
@@ -154,6 +154,12 @@ sub load_record_template {
   $::form->{$_} = $form_defaults->{$_} for keys %{ $form_defaults // {} };
 
   flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name));
+  flash('info', $::locale->text("Payment bookings disallowed. After the booking this record may be " .
+                                "suggested with the amount of '#1' or otherwise has to be choosen manually." .
+                                " No automatic payment booking will be done to chart '#2'.",
+                                  $form_defaults->{paid_1_suggestion},
+                                  $form_defaults->{AP_paid_1_suggestion},
+                                )) if $::form->{no_payment_bookings};
 
   update(
     keep_rows_without_amount => 1,
@@ -451,9 +457,8 @@ sub form_header {
     $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
 
     my ($default_taxchart, $taxchart_to_use);
-    my $amount_chart_id   = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
-    my $chart_has_changed = $::form->{"previous_AP_amount_chart_id_$i"} && ($amount_chart_id != $::form->{"previous_AP_amount_chart_id_$i"});
-    my @taxcharts         = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
+    my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
+    my @taxcharts       = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
 
     foreach my $item (@taxcharts) {
       my $key             = $item->id . "--" . $item->rate;
@@ -462,7 +467,7 @@ sub form_header {
       $taxchart_to_use    = $item if $key eq $form->{"taxchart_$i"};
     }
 
-    $taxchart_to_use                 = $default_taxchart // $first_taxchart if $chart_has_changed || !$taxchart_to_use;
+    $taxchart_to_use               //= $default_taxchart // $first_taxchart;
     my $selected_taxchart            = $taxchart_to_use->id . '--' . $taxchart_to_use->rate;
     $form->{"selected_taxchart_$i"}  = $selected_taxchart;
     $form->{"AP_amount_chart_id_$i"} = $amount_chart_id;
@@ -634,6 +639,10 @@ sub update {
 
   if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
     IR->get_vendor(\%::myconfig, $form);
+    if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
+      my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart;
+      $form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
+    }
   }
 
   $form->{rowcount} = $count + ($params{dont_add_new_row} ? 0 : 1);
@@ -905,7 +914,7 @@ sub search {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
-  $form->{title}    = $locale->text('AP Transactions');
+  $form->{title} = $locale->text('Vendor Invoices & AP Transactions');
 
   $form->get_lists(projects => { "key" => "ALL_PROJECTS", "all" => 1 });
 
@@ -957,7 +966,7 @@ sub ap_transactions {
 
   AP->ap_transactions(\%myconfig, \%$form);
 
-  $form->{title} = $locale->text('AP Transactions');
+  $form->{title} = $locale->text('Vendor Invoices & AP Transactions');
 
   my $report = SL::ReportGenerator->new(\%myconfig, $form);
 
@@ -995,7 +1004,7 @@ sub ap_transactions {
     'ustid'                   => { 'text' => $locale->text('USt-IdNr.'), },
     'taxzone'                 => { 'text' => $locale->text('Tax rate'), },
     'payment_terms'           => { 'text' => $locale->text('Payment Terms'), },
-    'charts'                  => { 'text' => $locale->text('Buchungskonto'), },
+    'charts'                  => { 'text' => $locale->text('Chart'), },
     'direct_debit'            => { 'text' => $locale->text('direct debit'), },
   );