Revision c872d063
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/SEPA.pm | ||
---|---|---|
149 | 149 |
my $self = shift; |
150 | 150 |
my %params = @_; |
151 | 151 |
|
152 |
Common::check_params(\%params, qw(id)); |
|
152 |
Common::check_params(\%params, qw(id vc));
|
|
153 | 153 |
|
154 | 154 |
my $myconfig = \%main::myconfig; |
155 | 155 |
my $form = $main::form; |
156 |
my $vc = $params{vc} eq 'customer' ? 'customer' : 'vendor'; |
|
157 |
my $arap = $params{vc} eq 'customer' ? 'ar' : 'ap'; |
|
156 | 158 |
|
157 | 159 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
158 | 160 |
|
159 | 161 |
my ($joins, $columns); |
160 | 162 |
|
161 | 163 |
if ($params{details}) { |
162 |
$columns = ', ap.invoice'; |
|
163 |
$joins = 'LEFT JOIN ap ON (se.ap_id = ap.id)';
|
|
164 |
$columns = ', arap.invoice';
|
|
165 |
$joins = "LEFT JOIN ${arap} arap ON (se.${arap}_id = arap.id)";
|
|
164 | 166 |
} |
165 | 167 |
|
166 | 168 |
my $query = |
... | ... | |
176 | 178 |
my ($columns, $joins); |
177 | 179 |
|
178 | 180 |
if ($params{details}) { |
179 |
$columns = qq|, ap.invnumber, ap.invoice, v.name AS vendor_name, c.accno AS chart_accno, c.description AS chart_description|;
|
|
180 |
$joins = qq|LEFT JOIN ap ON (sei.ap_id = ap.id)
|
|
181 |
LEFT JOIN vendor v ON (ap.vendor_id = v.id)
|
|
182 |
LEFT JOIN chart c ON (sei.chart_id = c.id)|;
|
|
181 |
$columns = qq|, arap.invnumber, arap.invoice, vc.name AS vc_name, c.accno AS chart_accno, c.description AS chart_description|;
|
|
182 |
$joins = qq|LEFT JOIN ${arap} arap ON (sei.${arap}_id = arap.id)
|
|
183 |
LEFT JOIN ${vc} vc ON (arap.${vc}_id = vc.id)
|
|
184 |
LEFT JOIN chart c ON (sei.chart_id = c.id)|;
|
|
183 | 185 |
} |
184 | 186 |
|
185 | 187 |
$query = qq|SELECT sei.* |
... | ... | |
187 | 189 |
FROM sepa_export_items sei |
188 | 190 |
$joins |
189 | 191 |
WHERE sei.sepa_export_id = ?|; |
192 |
|
|
190 | 193 |
$export->{items} = selectall_hashref_query($form, $dbh, $query, conv_i($params{id})); |
191 | 194 |
|
192 | 195 |
} else { |
Auch abrufbar als: Unified diff
Unterscheidung Bankeinzug/Überweisung bei Liste & Editmaske