Revision ef294a75
Von Moritz Bunkus vor etwa 14 Jahren hinzugefügt
SL/SEPA.pm | ||
---|---|---|
230 | 230 |
|
231 | 231 |
my $myconfig = \%main::myconfig; |
232 | 232 |
my $form = $main::form; |
233 |
my $vc = $params{vc} eq 'customer' ? 'customer' : 'vendor'; |
|
234 |
my $arap = $params{vc} eq 'customer' ? 'ar' : 'ap'; |
|
233 | 235 |
|
234 | 236 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
235 | 237 |
|
... | ... | |
261 | 263 |
} |
262 | 264 |
|
263 | 265 |
if ($filter->{invnumber}) { |
264 |
push @where_sub, "ap.invnumber ILIKE ?"; |
|
266 |
push @where_sub, "arap.invnumber ILIKE ?";
|
|
265 | 267 |
push @values_sub, '%' . $filter->{invnumber} . '%'; |
266 |
$joins_sub{ap} = 1; |
|
268 |
$joins_sub{$arap} = 1;
|
|
267 | 269 |
} |
268 | 270 |
|
269 |
if ($filter->{vendor}) {
|
|
270 |
push @where_sub, "v.name ILIKE ?"; |
|
271 |
push @values_sub, '%' . $filter->{vendor} . '%';
|
|
272 |
$joins_sub{ap} = 1;
|
|
273 |
$joins_sub{vendor} = 1;
|
|
271 |
if ($filter->{vc}) {
|
|
272 |
push @where_sub, "vc.name ILIKE ?";
|
|
273 |
push @values_sub, '%' . $filter->{vc} . '%';
|
|
274 |
$joins_sub{$arap} = 1;
|
|
275 |
$joins_sub{vc} = 1;
|
|
274 | 276 |
} |
275 | 277 |
|
276 | 278 |
foreach my $type (qw(requested_execution execution)) { |
... | ... | |
283 | 285 |
|
284 | 286 |
if (@where_sub) { |
285 | 287 |
my $joins_sub = ''; |
286 |
$joins_sub .= ' LEFT JOIN ap ON (items.ap_id = ap.id)' if ($joins_sub{ap});
|
|
287 |
$joins_sub .= ' LEFT JOIN vendor v ON (ap.vendor_id = v.id)' if ($joins_sub{vendor});
|
|
288 |
$joins_sub .= " LEFT JOIN ${arap} arap ON (items.${arap}_id = arap.id)" if ($joins_sub{$arap});
|
|
289 |
$joins_sub .= " LEFT JOIN ${vc} vc ON (arap.${vc}_id = vc.id)" if ($joins_sub{vc});
|
|
288 | 290 |
|
289 | 291 |
my $where_sub = join(' AND ', map { "(${_})" } @where_sub); |
290 | 292 |
|
... | ... | |
297 | 299 |
push @values, @values_sub; |
298 | 300 |
} |
299 | 301 |
|
302 |
push @where, 'se.vc = ?'; |
|
303 |
push @values, $vc; |
|
304 |
|
|
300 | 305 |
my $where = ' WHERE ' . join(' AND ', map { "(${_})" } @where) if (@where); |
301 | 306 |
|
302 | 307 |
my $query = |
bin/mozilla/sepa.pl | ||
---|---|---|
167 | 167 |
my $form = $main::form; |
168 | 168 |
my $locale = $main::locale; |
169 | 169 |
my $cgi = $main::cgi; |
170 |
my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor'; |
|
170 | 171 |
|
171 |
$form->{title} = $locale->text('List of bank transfers'); |
|
172 |
$form->{title} = $vc eq 'customer' ? $::locale->text('List of bank collections') : $locale->text('List of bank transfers');
|
|
172 | 173 |
|
173 | 174 |
$form->{sort} ||= 'id'; |
174 | 175 |
$form->{sortdir} = '1' if (!defined $form->{sortdir}); |
175 | 176 |
|
176 |
$form->{callback} = build_std_url('action=bank_transfer_list', 'sort', 'sortdir'); |
|
177 |
$form->{callback} = build_std_url('action=bank_transfer_list', 'sort', 'sortdir', 'vc');
|
|
177 | 178 |
|
178 | 179 |
my %filter = map +( $_ => $form->{"f_${_}"} ), |
179 | 180 |
grep { $form->{"f_${_}"} } |
180 |
(qw(vendor invnumber),
|
|
181 |
(qw(vc invnumber),
|
|
181 | 182 |
map { ("${_}_date_from", "${_}_date_to") } |
182 | 183 |
qw(export requested_execution execution)); |
183 | 184 |
$filter{executed} = $form->{l_executed} ? 1 : 0 if ($form->{l_executed} != $form->{l_not_executed}); |
... | ... | |
185 | 186 |
|
186 | 187 |
my $exports = SL::SEPA->list_exports('filter' => \%filter, |
187 | 188 |
'sortorder' => $form->{sort}, |
188 |
'sortdir' => $form->{sortdir}); |
|
189 |
'sortdir' => $form->{sortdir}, |
|
190 |
'vc' => $vc); |
|
189 | 191 |
|
190 | 192 |
my $open_available = any { !$_->{closed} } @{ $exports }; |
191 | 193 |
|
192 | 194 |
my $report = SL::ReportGenerator->new(\%main::myconfig, $form); |
193 | 195 |
|
194 |
my @hidden_vars = grep { m/^[fl]_/ && $form->{$_} } keys %{ $form };
|
|
196 |
my @hidden_vars = ('vc', grep { m/^[fl]_/ && $form->{$_} } keys %{ $form });
|
|
195 | 197 |
|
196 | 198 |
my $href = build_std_url('action=bank_transfer_list', @hidden_vars); |
197 | 199 |
|
... | ... | |
216 | 218 |
$column_defs{closed}->{visible} = $form->{l_closed} && $form->{l_open} ? 1 : 0; |
217 | 219 |
|
218 | 220 |
my @options = (); |
219 |
push @options, $locale->text('Vendor') . ' : ' . $form->{f_vendor} if ($form->{f_vendor});
|
|
221 |
push @options, ($vc eq 'customer' ? $::locale->text('Customer') : $locale->text('Vendor')) . ' : ' . $form->{f_vc} if ($form->{f_vc});
|
|
220 | 222 |
push @options, $locale->text('Invoice number') . ' : ' . $form->{f_invnumber} if ($form->{f_invnumber}); |
221 | 223 |
push @options, $locale->text('Export date from') . ' : ' . $form->{f_export_date_from} if ($form->{f_export_date_from}); |
222 | 224 |
push @options, $locale->text('Export date to') . ' : ' . $form->{f_export_date_to} if ($form->{f_export_date_to}); |
... | ... | |
249 | 251 |
|
250 | 252 |
map { $row->{$_}->{data} = $export->{$_} ? $locale->text('yes') : $locale->text('no') } qw(executed closed); |
251 | 253 |
|
252 |
$row->{id}->{link} = $edit_url . '&id=' . E($export->{id}); |
|
254 |
$row->{id}->{link} = $edit_url . '&id=' . E($export->{id}) . '&vc=' . E($vc);
|
|
253 | 255 |
|
254 | 256 |
if (!$export->{closed}) { |
255 | 257 |
$row->{selected}->{raw_data} = |
Auch abrufbar als: Unified diff
Unterscheidung Bankeinzug/Überweisung bei Suchefunktion