Debitorenbuchungen: Checkbox für "Lastschrifteinzug"; Vorbelegung aus Stammdaten
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 10 Jan 2013 12:23:00 +0000 (13:23 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 10 Jan 2013 13:03:12 +0000 (14:03 +0100)
SL/AR.pm
SL/Form.pm
bin/mozilla/ar.pl
templates/webpages/ar/form_header.html

index 8331c39..3016f5b 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -158,12 +158,13 @@ sub post_transaction {
            invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?,
            taxincluded = ?, amount = ?, duedate = ?, paid = ?,
            netamount = ?, curr = ?, notes = ?, department_id = ?,
-           employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?
+           employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?,
+           direct_debit = ?
          WHERE id = ?|;
     my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount},
                   conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}),
                   conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id},
-                  conv_i($form->{globalproject_id}), conv_i($form->{id}));
+                  conv_i($form->{globalproject_id}), $form->{direct_debit} ? 't' : 'f', conv_i($form->{id}));
     do_query($form, $dbh, $query, @values);
 
     # add individual transactions for AR, amount and taxes
index b34458e..f966a2d 100644 (file)
@@ -2736,6 +2736,9 @@ sub create_links {
     $self->{TAX} = selectall_hashref_query($self, $dbh, $query);
   }
 
+  my $extra_columns = '';
+  $extra_columns   .= 'a.direct_debit, ' if $module eq 'AR';
+
   if ($self->{id}) {
     $query =
       qq|SELECT
@@ -2743,7 +2746,7 @@ sub create_links {
            a.duedate, a.ordnumber, a.taxincluded, a.curr AS currency, a.notes,
            a.intnotes, a.department_id, a.amount AS oldinvtotal,
            a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
-           a.globalproject_id,
+           a.globalproject_id, ${extra_columns}
            c.name AS $table,
            d.description AS department,
            e.name AS employee
index f8b4f0b..a05a971 100644 (file)
@@ -146,18 +146,13 @@ sub create_links {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
 
-  my ($duedate, $taxincluded);
-
   $form->create_links("AR", \%myconfig, "customer");
-  $duedate = $form->{duedate};
 
-  $taxincluded = $form->{taxincluded};
-  my $id = $form->{id};
+  my %saved = map { ($_ => $form->{$_}) } qw(direct_debit duedate id taxincluded);
+
   IS->get_customer(\%myconfig, \%$form);
-  $form->{taxincluded} = $taxincluded;
-  $form->{id} = $id;
 
-  $form->{duedate}     = $duedate if $duedate;
+  $form->{$_}          = $saved{$_} for keys %saved;
   $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
   $form->{rowcount}    = 1;
 
index ea17d6d..af574a5 100644 (file)
               [%- END %]
               <tr>
                 <td align=right>[% L.checkbox_tag('taxincluded', checked=taxincluded) %]</td>
-                <th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
+                <th align="left" nowrap><label for="taxincluded">[% 'Tax Included' | $T8 %]</label></th>
+              </tr>
+              <tr>
+                <td align="right">[% L.checkbox_tag('direct_debit', checked=direct_debit) %]</td>
+                <th align="left" nowrap><label for="direct_debit">[% 'direct debit' | $T8 %]</label></th>
               </tr>
             </table>
           </td>