210 |
210 |
}
|
211 |
211 |
|
212 |
212 |
sub list_spool {
|
213 |
|
$main::lxdebug->enter_sub();
|
214 |
|
|
215 |
|
my $form = $main::form;
|
216 |
|
my %myconfig = %main::myconfig;
|
217 |
|
my $locale = $main::locale;
|
218 |
|
|
|
213 |
$::lxdebug->enter_sub;
|
219 |
214 |
assert_bp_access();
|
220 |
215 |
|
221 |
|
$form->{ $form->{vc} } = $form->unescape($form->{ $form->{vc} });
|
222 |
|
($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
|
223 |
|
split(/--/, $form->{ $form->{vc} });
|
224 |
|
|
225 |
|
BP->get_spoolfiles(\%myconfig, \%$form);
|
226 |
|
|
227 |
|
my $title = $form->escape($form->{title});
|
228 |
|
my $href = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
|
|
216 |
# parse old vc picker
|
|
217 |
$::form->{ $::form->{vc} } = $::form->unescape($::form->{ $::form->{vc} });
|
|
218 |
($::form->{ $::form->{vc} }, $::form->{"$::form->{vc}_id"}) = split(/--/, $::form->{ $::form->{vc} });
|
229 |
219 |
|
230 |
|
$title = $form->escape($form->{title}, 1);
|
231 |
|
my $callback =
|
232 |
|
"bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
|
233 |
|
my $option;
|
|
220 |
BP->get_spoolfiles(\%::myconfig, $::form);
|
234 |
221 |
|
235 |
|
if ($form->{ $form->{vc} }) {
|
236 |
|
$callback .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} }, 1);
|
237 |
|
$href .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} });
|
238 |
|
$option =
|
239 |
|
($form->{vc} eq 'customer')
|
240 |
|
? $locale->text('Customer')
|
241 |
|
: $locale->text('Vendor');
|
242 |
|
$option .= " : $form->{$form->{vc}}";
|
243 |
|
}
|
244 |
|
if ($form->{account}) {
|
245 |
|
$callback .= "&account=" . $form->escape($form->{account}, 1);
|
246 |
|
$href .= "&account=" . $form->escape($form->{account});
|
247 |
|
$option .= "\n<br>" if ($option);
|
248 |
|
$option .= $locale->text('Account') . " : $form->{account}";
|
249 |
|
}
|
250 |
|
if ($form->{invnumber}) {
|
251 |
|
$callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
|
252 |
|
$href .= "&invnumber=" . $form->escape($form->{invnumber});
|
253 |
|
$option .= "\n<br>" if ($option);
|
254 |
|
$option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
|
255 |
|
}
|
256 |
|
if ($form->{ordnumber}) {
|
257 |
|
$callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
|
258 |
|
$href .= "&ordnumber=" . $form->escape($form->{ordnumber});
|
259 |
|
$option .= "\n<br>" if ($option);
|
260 |
|
$option .= $locale->text('Order Number') . " : $form->{ordnumber}";
|
261 |
|
}
|
262 |
|
if ($form->{quonumber}) {
|
263 |
|
$callback .= "&quonumber=" . $form->escape($form->{quonumber}, 1);
|
264 |
|
$href .= "&quonumber=" . $form->escape($form->{quonumber});
|
265 |
|
$option .= "\n<br>" if ($option);
|
266 |
|
$option .= $locale->text('Quotation Number') . " : $form->{quonumber}";
|
267 |
|
}
|
|
222 |
my @href_options = ('vc', 'type', 'title', $::form->{vc});
|
268 |
223 |
|
269 |
|
if ($form->{transdatefrom}) {
|
270 |
|
$callback .= "&transdatefrom=$form->{transdatefrom}";
|
271 |
|
$href .= "&transdatefrom=$form->{transdatefrom}";
|
272 |
|
$option .= "\n<br>" if ($option);
|
273 |
|
$option .=
|
274 |
|
$locale->text('From') . " "
|
275 |
|
. $locale->date(\%myconfig, $form->{transdatefrom}, 1);
|
276 |
|
}
|
277 |
|
if ($form->{transdateto}) {
|
278 |
|
$callback .= "&transdateto=$form->{transdateto}";
|
279 |
|
$href .= "&transdateto=$form->{transdateto}";
|
280 |
|
$option .= "\n<br>" if ($option);
|
281 |
|
$option .=
|
282 |
|
$locale->text('To') . " "
|
283 |
|
. $locale->date(\%myconfig, $form->{transdateto}, 1);
|
284 |
|
}
|
285 |
|
|
286 |
|
my $name = ucfirst $form->{vc};
|
|
224 |
my %option_texts = (
|
|
225 |
customer => sub { $::locale->text('Customer') . " : $::form->{customer}" },
|
|
226 |
vendor => sub { $::locale->text('Customer') . " : $::form->{vendor}" },
|
|
227 |
account => sub { $::locale->text('Account') . " : $::form->{account}" },
|
|
228 |
invnumber => sub { $::locale->text('Invoice Number') . " : $::form->{invnumber}" },
|
|
229 |
ordnumber => sub { $::locale->text('Order Number') . " : $::form->{ordnumber}" },
|
|
230 |
quonumber => sub { $::locale->text('Quotation Number') . " : $::form->{quonumber}" },
|
|
231 |
transdatefrom => sub { $::locale->text('From') . " " . $::locale->date(\%::myconfig, $::form->{transdatefrom}, 1) },
|
|
232 |
transdateto => sub { $::locale->text('To') . " " . $::locale->date(\%::myconfig, $::form->{transdateto}, 1) },
|
|
233 |
);
|
287 |
234 |
|
288 |
|
my @columns = qw(transdate);
|
289 |
|
if ($form->{type} =~ /_order$/) {
|
290 |
|
push @columns, "ordnumber";
|
|
235 |
my @options;
|
|
236 |
for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber transdatefrom transdateto)) {
|
|
237 |
next unless $::form->{$key};
|
|
238 |
push @href_options, $key;
|
|
239 |
push @options, $option_texts{$key} ? $option_texts{$key}->() : '';
|
291 |
240 |
}
|
292 |
|
if ($form->{type} =~ /_quotation$/) {
|
293 |
|
push @columns, "quonumber";
|
294 |
|
}
|
295 |
|
|
296 |
|
push @columns, qw(name spoolfile);
|
297 |
|
my @column_index = $form->sort_columns(@columns);
|
298 |
|
unshift @column_index, "checked";
|
299 |
|
|
300 |
|
my %column_header;
|
301 |
|
my %column_data;
|
302 |
|
|
303 |
|
$column_header{checked} = "<th class=listheading> </th>";
|
304 |
|
$column_header{transdate} =
|
305 |
|
"<th><a class=listheading href=$href&sort=transdate>"
|
306 |
|
. $locale->text('Date')
|
307 |
|
. "</a></th>";
|
308 |
|
$column_header{invnumber} =
|
309 |
|
"<th><a class=listheading href=$href&sort=invnumber>"
|
310 |
|
. $locale->text('Invoice')
|
311 |
|
. "</a></th>";
|
312 |
|
$column_header{ordnumber} =
|
313 |
|
"<th><a class=listheading href=$href&sort=ordnumber>"
|
314 |
|
. $locale->text('Order')
|
315 |
|
. "</a></th>";
|
316 |
|
$column_header{quonumber} =
|
317 |
|
"<th><a class=listheading href=$href&sort=quonumber>"
|
318 |
|
. $locale->text('Quotation')
|
319 |
|
. "</a></th>";
|
320 |
|
$column_header{name} =
|
321 |
|
"<th><a class=listheading href=$href&sort=name>"
|
322 |
|
. $locale->text($name)
|
323 |
|
. "</a></th>";
|
324 |
|
$column_header{spoolfile} =
|
325 |
|
"<th class=listheading>" . $locale->text('Spoolfile') . "</th>";
|
326 |
|
|
327 |
|
$form->header;
|
328 |
|
|
329 |
|
print qq|
|
330 |
|
<body>
|
331 |
|
|
332 |
|
<form method=post action=bp.pl>
|
333 |
|
|
334 |
|
<table width=100%>
|
335 |
|
<tr>
|
336 |
|
<th class=listtop>$form->{title}</th>
|
337 |
|
</tr>
|
338 |
|
<tr height="5"></tr>
|
339 |
|
<tr>
|
340 |
|
<td>$option</td>
|
341 |
|
</tr>
|
342 |
|
<tr>
|
343 |
|
<td>
|
344 |
|
<table width=100%>
|
345 |
|
<tr class=listheading>
|
346 |
|
|;
|
347 |
|
|
348 |
|
map { print "\n$column_header{$_}" } @column_index;
|
349 |
|
|
350 |
|
print qq|
|
351 |
|
</tr>
|
352 |
|
|;
|
353 |
|
|
354 |
|
# add sort and escape callback, this one we use for the add sub
|
355 |
|
$form->{callback} = $callback .= "&sort=$form->{sort}";
|
356 |
|
|
357 |
|
# escape callback for href
|
358 |
|
$callback = $form->escape($callback);
|
359 |
|
|
360 |
|
my $i = 0;
|
361 |
|
my $j = 0;
|
362 |
|
my $spoolfile;
|
363 |
|
my $spool = $::lx_office_conf{paths}->{spool};
|
364 |
|
|
365 |
|
foreach my $ref (@{ $form->{SPOOL} }) {
|
366 |
|
|
367 |
|
$i++;
|
368 |
|
|
369 |
|
$form->{"checked_$i"} = "checked" if $form->{"checked_$i"};
|
370 |
|
|
371 |
|
if ($ref->{invoice}) {
|
372 |
|
$ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir";
|
373 |
|
}
|
374 |
|
my $module = "$ref->{module}.pl";
|
375 |
|
|
376 |
|
$column_data{transdate} = "<td>$ref->{transdate} </td>";
|
377 |
|
|
378 |
|
if ($spoolfile eq $ref->{spoolfile}) {
|
379 |
|
$column_data{checked} = qq|<td></td>|;
|
380 |
|
} else {
|
381 |
|
$column_data{checked} =
|
382 |
|
qq|<td><input name=checked_$i type=checkbox style=checkbox $form->{"checked_$i"} $form->{"checked_$i"}></td>|;
|
383 |
|
}
|
384 |
|
|
385 |
|
$column_data{invnumber} =
|
386 |
|
"<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{invnumber}</a></td>";
|
387 |
|
$column_data{ordnumber} =
|
388 |
|
"<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{ordnumber}</a></td>";
|
389 |
|
$column_data{quonumber} =
|
390 |
|
"<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
|
391 |
|
$column_data{name} = "<td>$ref->{name}</td>";
|
392 |
|
$column_data{spoolfile} =
|
393 |
|
qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
|
394 |
|
<input type=hidden name="spoolfile_$i" value=$ref->{spoolfile}>
|
395 |
|
|;
|
396 |
|
|
397 |
|
$spoolfile = $ref->{spoolfile};
|
398 |
|
|
399 |
|
$j++;
|
400 |
|
$j %= 2;
|
401 |
|
print "
|
402 |
|
<tr class=listrow$j>
|
403 |
|
";
|
404 |
|
|
405 |
|
map { print "\n$column_data{$_}" } @column_index;
|
406 |
|
|
407 |
|
print qq|
|
408 |
|
</tr>
|
409 |
|
|;
|
410 |
241 |
|
|
242 |
my $last_spoolfile;
|
|
243 |
for my $ref (@{ $::form->{SPOOL} }) {
|
|
244 |
$ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir" if $ref->{invoice};
|
|
245 |
$ref->{new_file} = $last_spoolfile ne $ref->{spoolfile};
|
|
246 |
} continue {
|
|
247 |
$last_spoolfile = $ref->{spoolfile};
|
411 |
248 |
}
|
412 |
249 |
|
413 |
|
print qq|
|
414 |
|
<input type=hidden name=rowcount value=$i>
|
415 |
|
|
416 |
|
</table>
|
417 |
|
</td>
|
418 |
|
</tr>
|
419 |
|
<tr>
|
420 |
|
<td><hr size=3 noshade></td>
|
421 |
|
</tr>
|
422 |
|
</table>
|
423 |
|
|
424 |
|
<br>
|
|
250 |
$::form->get_lists(printers => "ALL_PRINTERS");
|
425 |
251 |
|
426 |
|
<input name=callback type=hidden value="$form->{callback}">
|
427 |
|
|
428 |
|
<input type=hidden name=title value="$form->{title}">
|
429 |
|
<input type=hidden name=vc value="$form->{vc}">
|
430 |
|
<input type=hidden name=type value="$form->{type}">
|
431 |
|
<input type=hidden name=sort value="$form->{sort}">
|
432 |
|
|
433 |
|
<input type=hidden name=account value="$form->{account}">
|
434 |
|
|;
|
435 |
|
|
436 |
|
# if ($myconfig{printer}) {
|
437 |
|
print qq|
|
438 |
|
<input type=hidden name=transdateto value=$form->{transdateto}>
|
439 |
|
<input type=hidden name=transdatefrom value=$form->{transdatefrom}>
|
440 |
|
<input type=hidden name=invnumber value=$form->{invnumber}>
|
441 |
|
<input type=hidden name=ordnumber value=$form->{ordnumber}>
|
442 |
|
<input type=hidden name=quonumber value=$form->{quonumber}>
|
443 |
|
<input type=hidden name=customer value=$form->{customer}>
|
444 |
|
<input type=hidden name=vendor value=$form->{vendor}>
|
445 |
|
<input class=submit type=submit name=action value="|
|
446 |
|
. $locale->text('Select all') . qq|">
|
447 |
|
<input class=submit type=submit name=action value="|
|
448 |
|
. $locale->text('Remove') . qq|">
|
449 |
|
<input class=submit type=submit name=action value="|
|
450 |
|
. $locale->text('Print') . qq|">
|
451 |
|
|;
|
452 |
|
|
453 |
|
$form->get_lists(printers=>"ALL_PRINTERS");
|
454 |
|
print qq|<select name="printer">|;
|
455 |
|
print map(qq|<option value="$_->{id}">| . H($_->{printer_description}) . qq|</option>|, @{ $form->{ALL_PRINTERS} });
|
456 |
|
print qq|</select>|;
|
457 |
|
|
458 |
|
# }
|
459 |
|
|
460 |
|
print qq|
|
461 |
|
</form>
|
462 |
|
|
463 |
|
</body>
|
464 |
|
</html>
|
465 |
|
|;
|
|
252 |
$::form->header;
|
|
253 |
print $::form->parse_html_template('bp/list_spool', {
|
|
254 |
spool => $::lx_office_conf{paths}->{spool},
|
|
255 |
href => build_std_url('bp.pl', @href_options),
|
|
256 |
is_invoice => scalar ($::form->{type} =~ /^invoice$/),
|
|
257 |
is_order => scalar ($::form->{type} =~ /_order$/),
|
|
258 |
is_quotation => scalar ($::form->{type} =~ /_quotation$/),
|
|
259 |
options => \@options,
|
|
260 |
});
|
466 |
261 |
|
467 |
|
$main::lxdebug->leave_sub();
|
|
262 |
$::lxdebug->leave_sub;
|
468 |
263 |
}
|
469 |
264 |
|
470 |
265 |
sub select_all {
|
bp::list_spool auf template umgestellt.