is form_footer: weitere exportierte variablen
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 27 Oct 2009 13:54:44 +0000 (14:54 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Thu, 29 Oct 2009 14:06:33 +0000 (15:06 +0100)
bin/mozilla/is.pl
templates/webpages/is/_payments_de.html
templates/webpages/is/_payments_master.html
templates/webpages/is/form_footer_de.html
templates/webpages/is/form_footer_master.html

index 5708ac4..024dce2 100644 (file)
@@ -385,17 +385,19 @@ sub form_footer {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
-  my $cgi      = $main::cgi;
 
   $main::auth->assert('invoice_edit');
 
-  $form->{invtotal} = $form->{invsubtotal};
+  $form->{invtotal}    = $form->{invsubtotal};
+  $form->{oldinvtotal} = $form->{invtotal};
+
+  # note rows
+  $form->{rows} = max 2,
+    $form->numtextrows($form->{notes},    26, 8),
+    $form->numtextrows($form->{intnotes}, 35, 8);
 
-  my ($rows, $introws);
-  if (($rows    = $form->numtextrows($form->{notes}, 26, 8)) < 2)    { $rows    = 2; }
-  if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) { $introws = 2; }
-  $form->{rows} = ($rows > $introws) ? $rows : $introws;
 
+  # tax, total and subtotal calculations
   my ($tax, $subtotal);
   $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ];
 
@@ -412,8 +414,6 @@ sub form_footer {
     }
   }
 
-  $form->{oldinvtotal} = $form->{invtotal};
-
   # unfortunately locales doesn't support extended syntax
   if ($form->{id}) {
     my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
@@ -424,25 +424,26 @@ sub form_footer {
     }
   }
 
-
-# payments
+  # payments
   my $totalpaid = 0;
-
   $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
   $form->{paid_indices} = [ 1 .. $form->{paidaccounts} ];
 
   for my $i (1 .. $form->{paidaccounts}) {
     $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
     $form->{"selectAR_paid_$i"} =~ s/option>\Q$form->{"AR_paid_$i"}\E/option selected>$form->{"AR_paid_$i"}/;
-
-    # format amounts
     $totalpaid += $form->{"paid_$i"};
   }
 
-  $form->{print_options} = print_options(inline => 1);
-
-  print $form->parse_html_template('is/form_footer');
-# print $form->parse_html_template('is/_payments'); # parser
+  print $form->parse_html_template('is/form_footer', {
+    is_type_credit_note => ($form->{type} eq "credit_note"),
+    totalpaid           => $totalpaid,
+    paid_missing        => $form->{invtotal} - $totalpaid,
+    print_options       => print_options(inline => 1),
+    show_storno         => $form->{id} && !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar") && !$totalpaid,
+    show_delete         => ($form->current_date(\%myconfig) eq $form->{gldate}),
+  });
+##print $form->parse_html_template('is/_payments'); # parser
 
 
 
index 0c5b764..51dee51 100644 (file)
@@ -3,7 +3,7 @@
    <td>
     <table width="100%">
      <tr class="listheading">
-[% IF is_credit_note %]
+[% IF is_type_credit_note %]
       <th colspan="6" class="listheading">Zahlungsausgänge</th>
 [% ELSE %]
       <th colspan="6" class="listheading">Zahlungseingänge</th>
index ff60265..6cfdb57 100644 (file)
@@ -3,7 +3,7 @@
    <td>
     <table width="100%">
      <tr class="listheading">
-[% IF is_credit_note %]
+[% IF is_type_credit_note %]
       <th colspan="6" class="listheading"><translate>Payments</translate></th>
 [% ELSE %]
       <th colspan="6" class="listheading"><translate>Incoming Payments</translate></th>
index cc974d5..6d32a51 100644 (file)
     <input class="submit" type="submit" name="action" value="Zahlung buchen">
     <input class="submit" type="submit" name="action" value="Als Vorlage verwenden">
 
-[% IF id && is_credit_note %]
+[% IF id && is_type_credit_note %]
     <input class="submit" type="submit" name="action" value="Gutschrift">
 [% END %]
 [% IF show_delete %]
index b7548d7..8981a17 100644 (file)
     <input class="submit" type="submit" name="action" value="<translate>Post Payment</translate>">
     <input class="submit" type="submit" name="action" value="<translate>Use As Template</translate>">
 
-[% IF id && is_credit_note %]
+[% IF id && is_type_credit_note %]
     <input class="submit" type="submit" name="action" value="<translate>Credit Note</translate>">
 [% END %]
 [% IF show_delete %]