From: Sven Schöling Date: Tue, 25 Aug 2009 10:37:38 +0000 (+0200) Subject: Buchungskonten in Verkaufsrechnungen anzeigen. X-Git-Tag: release-2.6.1beta1~330 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=96d60de4d387a1e821b25a47e07c269995959b0f;p=kivitendo-erp.git Buchungskonten in Verkaufsrechnungen anzeigen. --- diff --git a/SL/AR.pm b/SL/AR.pm index 7357ae9d6..88ee519f0 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -407,12 +407,12 @@ sub ar_transactions { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = $form->get_standard_dbh($myconfig); my @values; my $query = - qq|SELECT a.id, a.invnumber, a.ordnumber, a.transdate, | . + qq|SELECT DISTINCT a.id, a.invnumber, a.ordnumber, a.transdate, | . qq| a.duedate, a.netamount, a.amount, a.paid, | . qq| a.invoice, a.datepaid, a.terms, a.notes, a.shipvia, | . qq| a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | . @@ -423,14 +423,17 @@ sub ar_transactions { qq| e.name AS employee, | . qq| e2.name AS salesman, | . qq| tz.description AS taxzone, | . - qq| pt.description AS payment_terms | . + qq| pt.description AS payment_terms, | . + qq{ ch.accno || ' -- ' || ch.description AS charts } . qq|FROM ar a | . qq|JOIN customer c ON (a.customer_id = c.id) | . qq|LEFT JOIN employee e ON (a.employee_id = e.id) | . qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | . qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| . qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| . - qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|; + qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| . + qq|LEFT JOIN acc_trans at ON (at.trans_id = a.id)| . + qq|INNER JOIN chart ch ON (ch.id = at.chart_id AND ch.link ~ 'AR[[:>:]]')|; my $where = "1 = 1"; if ($form->{customer_id}) { @@ -485,17 +488,9 @@ sub ar_transactions { $query .= " WHERE $where ORDER BY $sortorder"; - my $sth = $dbh->prepare($query); - $sth->execute(@values) || - $form->dberror($query . " (" . join(", ", @values) . ")"); + my @result = selectall_hashref_query($form, $dbh, $query, @values); - $form->{AR} = []; - while (my $ar = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $form->{AR} }, $ar; - } - - $sth->finish; - $dbh->disconnect; + $form->{AR} = [ @result ]; $main::lxdebug->leave_sub(); } diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index a86668c98..f506cd9cf 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1428,6 +1428,8 @@ sub search { | . $locale->text('Payment Terms') . qq| + + | . $locale->text('Buchungskonto') . qq| @@ -1498,7 +1500,7 @@ sub ar_transactions { @columns = qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia - marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms); + marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts); my @hidden_variables = map { "l_${_}" } @columns; push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto); @@ -1533,6 +1535,7 @@ sub ar_transactions { 'ustid' => { 'text' => $locale->text('USt-IdNr.'), }, 'taxzone' => { 'text' => $locale->text('Steuersatz'), }, 'payment_terms' => { 'text' => $locale->text('Payment Terms'), }, + 'charts' => { 'text' => $locale->text('Buchungskonto'), }, ); foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) { diff --git a/locale/de/all b/locale/de/all index ff5400ef9..f3125b0d0 100644 --- a/locale/de/all +++ b/locale/de/all @@ -268,6 +268,7 @@ $self->{texts} = { 'Buchungsdatum' => 'Buchungsdatum', 'Buchungsgruppe' => 'Buchungsgruppe', 'Buchungsgruppen' => 'Buchungsgruppen', + 'Buchungskonto' => 'Buchungskonto', 'Buchungsnummer' => 'Buchungsnummer', 'Business Number' => 'Firmennummer', 'Business Volume' => 'Geschäftsvolumen', diff --git a/locale/de/ar b/locale/de/ar index 695989ddc..268db0a03 100644 --- a/locale/de/ar +++ b/locale/de/ar @@ -27,6 +27,7 @@ $self->{texts} = { 'Bin List' => 'Lagerliste', 'Binding to the LDAP server as "#1" failed. Please check config/authentication.pl.' => 'Die Anmeldung am LDAP-Server als "#1" schlug fehl. Bitte überprüfen Sie die Angaben in config/authentication.pl.', 'Bis' => 'bis', + 'Buchungskonto' => 'Buchungskonto', 'CANCELED' => 'Storniert', 'CR' => 'H', 'CRM admin' => 'Administration',