Revision 2c5603bb
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
bin/mozilla/dn.pl | ||
---|---|---|
216 | 216 |
|
217 | 217 |
sub search { |
218 | 218 |
$lxdebug->enter_sub(); |
219 |
# setup customer selection |
|
220 |
$form->all_vc(\%myconfig, "customer", "AR"); |
|
219 |
|
|
220 |
$form->get_lists("customers" => "ALL_CUSTOMERS", |
|
221 |
"departments" => "ALL_DEPARTMENTS"); |
|
221 | 222 |
|
222 | 223 |
DN->get_config(\%myconfig, \%$form); |
223 | 224 |
|
224 |
if (@{ $form->{all_customer} }) { |
|
225 |
map { $customer .= "<option>$_->{name}--$_->{id}\n" } |
|
226 |
@{ $form->{all_customer} }; |
|
227 |
$customer = qq|<select name=customer><option>\n$customer</select>|; |
|
228 |
} else { |
|
229 |
$customer = qq|<input name=customer size=35>|; |
|
230 |
} |
|
225 |
$form->{SHOW_CUSTOMER_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} } <= $myconfig{vclimit}; |
|
226 |
$form->{SHOW_DEPARTMENT_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} }; |
|
227 |
$form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} }; |
|
231 | 228 |
|
232 |
# dunning levels |
|
233 |
if (@{ $form->{DUNNING} }) { |
|
234 |
$form->{selectdunning_level} = "<option></option\n"; |
|
235 |
map { |
|
236 |
$form->{selectdunning_level} .= |
|
237 |
"<option value=$_->{id}>$_->{dunning_description}</option>\n" |
|
238 |
} (@{ $form->{DUNNING} }); |
|
239 |
} |
|
240 |
$dunning_level = qq| |
|
241 |
<tr> |
|
242 |
<th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th> |
|
243 |
<td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td> |
|
244 |
</tr> |
|
245 |
| if $form->{selectdunning_level}; |
|
246 |
|
|
247 |
# departments |
|
248 |
if (@{ $form->{all_departments} }) { |
|
249 |
$form->{selectdepartment} = "<option>\n"; |
|
250 |
map { |
|
251 |
$form->{selectdepartment} .= |
|
252 |
"<option>$_->{description}--$_->{id}\n" |
|
253 |
} (@{ $form->{all_departments} }); |
|
254 |
} |
|
255 |
$department = qq| |
|
256 |
<tr> |
|
257 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th> |
|
258 |
<td colspan=3><select name=department>$form->{selectdepartment}</select></td> |
|
259 |
</tr> |
|
260 |
| if $form->{selectdepartment}; |
|
261 |
$form->{title} = $locale->text('Search Dunning'); |
|
262 |
$form->{nextsub} = "show_dunning"; |
|
263 |
|
|
264 |
# use JavaScript Calendar or not |
|
265 |
$form->{jsscript} = 1; |
|
266 |
$jsscript = ""; |
|
267 |
if ($form->{jsscript}) { |
|
268 |
|
|
269 |
# with JavaScript Calendar |
|
270 |
$button1 = qq| |
|
271 |
<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
272 |
<input type=button name=transdatefrom id="trigger1" value=| |
|
273 |
. $locale->text('button') . qq|></td> |
|
274 |
|; |
|
275 |
$button2 = qq| |
|
276 |
<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
277 |
<input type=button name=transdateto id="trigger2" value=| |
|
278 |
. $locale->text('button') . qq|></td> |
|
279 |
|; |
|
280 |
$button3 = qq| |
|
281 |
<td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
282 |
<input type=button name=dunningfrom id="trigger3" value=| |
|
283 |
. $locale->text('button') . qq|></td> |
|
284 |
|; |
|
285 |
$button4 = qq| |
|
286 |
<td><input name=dunningto id=dunningto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
287 |
<input type=button name=dunningto id="trigger4" value=| |
|
288 |
. $locale->text('button') . qq|></td> |
|
289 |
|; |
|
290 |
|
|
291 |
#write Trigger |
|
292 |
$jsscript = |
|
293 |
Form->write_trigger(\%myconfig, "4", "transdatefrom", "BR", "trigger1", "transdateto", "BR", "trigger2", "dunningfrom", "BR", "trigger3", "dunningto", "BR", "trigger4"); |
|
294 |
} else { |
|
229 |
$form->{jsscript} = 1; |
|
230 |
$form->{title} = $locale->text('Search Dunning'); |
|
231 |
$form->{fokus} = "search.customer"; |
|
232 |
$form->{javascript} .= qq||; |
|
233 |
$form->header; |
|
295 | 234 |
|
296 |
# without JavaScript Calendar |
|
297 |
$button1 = |
|
298 |
qq|<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
299 |
$button2 = |
|
300 |
qq|<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
301 |
$button3 = |
|
302 |
qq|<td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
303 |
$button4 = |
|
304 |
qq|<td><input name=dunningfrom id=dunningto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
305 |
} |
|
235 |
$form->{onload} = qq|focus()| |
|
236 |
. qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')| |
|
237 |
. qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; |
|
306 | 238 |
|
307 |
$form->{fokus} = "search.customer"; |
|
308 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|; |
|
309 |
$form->header; |
|
310 |
$onload = qq|focus()|; |
|
311 |
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; |
|
312 |
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; |
|
313 |
|
|
314 |
print qq| |
|
315 |
<body onLoad="$onload"> |
|
316 |
|
|
317 |
<form method=post name="search" action=$form->{script}> |
|
318 |
|
|
319 |
<table width=100%> |
|
320 |
<tr><th class=listtop>$form->{title}</th></tr> |
|
321 |
<tr height="5"></tr> |
|
322 |
<tr> |
|
323 |
<td> |
|
324 |
<table> |
|
325 |
<tr> |
|
326 |
<th align=right>| . $locale->text('Customer') . qq|</th> |
|
327 |
<td colspan=3>$customer</td> |
|
328 |
</tr> |
|
329 |
$dunning_level |
|
330 |
$department |
|
331 |
<tr> |
|
332 |
<th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th> |
|
333 |
<td colspan=3><input name=invnumber size=20></td> |
|
334 |
</tr> |
|
335 |
<tr> |
|
336 |
<th align=right nowrap>| . $locale->text('Order Number') . qq|</th> |
|
337 |
<td colspan=3><input name=ordnumber size=20></td> |
|
338 |
</tr> |
|
339 |
<tr> |
|
340 |
<th align=right nowrap>| . $locale->text('Notes') . qq|</th> |
|
341 |
<td colspan=3><input name=notes size=40></td> |
|
342 |
</tr> |
|
343 |
<tr> |
|
344 |
<th align=right nowrap>| . $locale->text('Invdate from') . qq|</th> |
|
345 |
$button1 |
|
346 |
<th align=right nowrap>| . $locale->text('To') . qq|</th> |
|
347 |
$button2 |
|
348 |
</tr> |
|
349 |
<tr> |
|
350 |
<th align=right nowrap>| . $locale->text('Dunning Date from') . qq|</th> |
|
351 |
$button3 |
|
352 |
<th align=right nowrap>| . $locale->text('To') . qq|</th> |
|
353 |
$button4 |
|
354 |
</tr> |
|
355 |
|
|
356 |
</table> |
|
357 |
</td> |
|
358 |
</tr> |
|
359 |
<tr> |
|
360 |
<td><hr size=3 noshade></td> |
|
361 |
</tr> |
|
362 |
<tr> |
|
363 |
<td> |
|
364 |
<table> |
|
365 |
<tr> |
|
366 |
<th align=right nowrap>| . $locale->text('Show old dunnings') . qq|</th> |
|
367 |
<td><input type=checkbox value=1 name=showold></td> |
|
368 |
</tr> |
|
369 |
</table> |
|
370 |
</td> |
|
371 |
</tr> |
|
372 |
</table> |
|
373 |
|
|
374 |
<input type=hidden name=nextsub value=$form->{nextsub}> |
|
375 |
|
|
376 |
<input type=hidden name=login value=$form->{login}> |
|
377 |
<input type=hidden name=password value=$form->{password}> |
|
378 |
|
|
379 |
<br> |
|
380 |
<input class=submit type=submit name=action value="| |
|
381 |
. $locale->text('Continue') . qq|"> |
|
382 |
|
|
383 |
</form> |
|
384 |
|
|
385 |
</body> |
|
386 |
|
|
387 |
$jsscript |
|
388 |
|
|
389 |
</html> |
|
390 |
|; |
|
239 |
print $form->parse_html_template("dunning/search"); |
|
391 | 240 |
|
392 | 241 |
$lxdebug->leave_sub(); |
393 | 242 |
|
... | ... | |
397 | 246 |
$lxdebug->enter_sub(); |
398 | 247 |
|
399 | 248 |
DN->get_dunning(\%myconfig, \%$form); |
400 |
$form->{title} = $locale->text('Dunning overview'); |
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
$form->{callback} = |
|
407 |
"$form->{script}?action=show_dunning&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&dunningfrom=$form->{dunningfrom}&dunningto=$form->{dunningto}¬es=$form->{notes}&showold=$form->{showold}&dunning_level=$form->{dunning_level}" |
|
408 |
unless $form->{callback}; |
|
409 |
|
|
410 |
@column_index = qw(dunning_description customername invnumber invdate inv_duedate invamount dunning_date next_duedate fee interest ); |
|
411 |
|
|
412 |
$column_header{dunning_description} = |
|
413 |
qq|<th class=listheading>| |
|
414 |
. $locale->text('Dunning Level') |
|
415 |
. qq|</th>|; |
|
416 |
$column_header{customername} = |
|
417 |
qq|<th class=listheading>| |
|
418 |
. $locale->text('Customername') |
|
419 |
. qq|</th>|; |
|
420 |
$column_header{invnumber} = |
|
421 |
qq|<th class=listheading>| |
|
422 |
. $locale->text('Invnumber') |
|
423 |
. qq|</th>|; |
|
424 |
$column_header{inv_duedate} = |
|
425 |
qq|<th class=listheading>| |
|
426 |
. $locale->text('Invoice Duedate') |
|
427 |
. qq|</th>|; |
|
428 |
$column_header{dunning_date} = |
|
429 |
qq|<th class=listheading>| |
|
430 |
. $locale->text('Dunning Date') |
|
431 |
. qq|</th>|; |
|
432 |
$column_header{next_duedate} = |
|
433 |
qq|<th class=listheading>| |
|
434 |
. $locale->text('Dunning Duedate') |
|
435 |
. qq|</th>|; |
|
436 |
$column_header{invdate} = |
|
437 |
qq|<th class=listheading>| |
|
438 |
. $locale->text('Invdate') |
|
439 |
. qq|</th>|; |
|
440 |
$column_header{invamount} = |
|
441 |
qq|<th class=listheading>| |
|
442 |
. $locale->text('Amount') |
|
443 |
. qq|</th>|; |
|
444 |
$column_header{fee} = |
|
445 |
qq|<th class=listheading>| |
|
446 |
. $locale->text('Total Fees') |
|
447 |
. qq|</th>|; |
|
448 |
$column_header{interest} = |
|
449 |
qq|<th class=listheading>| |
|
450 |
. $locale->text('Interest') |
|
451 |
. qq|</th>|; |
|
452 |
|
|
453 |
$form->header; |
|
454 |
|
|
455 |
|
|
456 |
print qq| |
|
457 |
<body> |
|
458 |
<script type="text/javascript" src="js/common.js"></script> |
|
459 |
<script type="text/javascript" src="js/dunning.js"></script> |
|
460 |
<form method=post action=$form->{script}> |
|
461 |
|
|
462 | 249 |
|
463 |
<table width=100%> |
|
464 |
<tr> |
|
465 |
<th class=listtop colspan=10>$form->{title}</th> |
|
466 |
</tr> |
|
467 |
<tr height="5"></tr> |
|
468 |
<tr>|; |
|
469 |
map { print "$column_header{$_}\n" } @column_index; |
|
470 |
|
|
471 |
print qq| |
|
472 |
</tr> |
|
473 |
|; |
|
474 |
|
|
475 |
my %columns = ( |
|
476 |
"dunning_duedate" => "next_duedate", |
|
477 |
"duedate" => "inv_duedate", |
|
478 |
"transdate" => "invdate", |
|
479 |
"amount" => "invamount", |
|
480 |
); |
|
481 |
|
|
482 |
my $i = 0; |
|
483 |
my $j = 0; |
|
250 |
my $odd_even = 0; |
|
484 | 251 |
my ($previous_dunning_id, $first_row_for_dunning); |
485 |
foreach $ref (@{ $form->{DUNNINGS} }) { |
|
486 |
$i++; |
|
487 | 252 |
|
253 |
foreach $ref (@{ $form->{DUNNINGS} }) { |
|
488 | 254 |
if ($previous_dunning_id != $ref->{dunning_id}) { |
489 |
$j++; |
|
490 |
$j = $j % 2; |
|
491 |
$first_row_for_dunning = 1; |
|
492 |
} else { |
|
493 |
$first_row_for_dunning = 0; |
|
494 |
} |
|
495 |
$previous_dunning_id = $ref->{dunning_id}; |
|
496 |
|
|
497 |
print qq| |
|
498 |
<tr valign=top class=listrow$j> |
|
499 |
|; |
|
500 |
|
|
501 |
|
|
502 |
|
|
503 |
foreach (qw(dunning_date dunning_duedate duedate transdate customername amount fee interest)) { |
|
504 |
my $col = $columns{$_} ? $columns{$_} : $_; |
|
505 |
$column_data{$col} = "<td>" . H($ref->{$_}) . "</td>"; |
|
506 |
} |
|
255 |
$odd_even = ($odd_even + 1) % 2; |
|
256 |
$ref->{first_row_for_dunning} = 1; |
|
507 | 257 |
|
508 |
if ($first_row_for_dunning) { |
|
509 |
$column_data{dunning_description} = |
|
510 |
qq|<td><a href="dn.pl?action=print_dunning&format=pdf&media=screen&| . |
|
511 |
qq|dunning_id=| . E($ref->{dunning_id}) . |
|
512 |
join("", map({ "&${_}=" . E($form->{$_}) } qw(login password callback))) . |
|
513 |
qq|">| . H($ref->{dunning_description}) . qq|</a></td>|; |
|
514 | 258 |
} else { |
515 |
$column_data{dunning_description} = qq|<td> </td>|; |
|
516 |
$column_data{customername} = qq|<td> </td>|; |
|
259 |
$ref->{first_row_for_dunning} = 0; |
|
517 | 260 |
} |
518 | 261 |
|
519 |
$column_data{invnumber} = |
|
520 |
qq|<td><a href="| . ($ref->{invoice} ? "is.pl" : "ar.pl" ) . |
|
521 |
qq|?action=edit&id=| . H($ref->{id}) . |
|
522 |
join("", map({ "&${_}=" . E($form->{$_}) } qw(login password callback))) . |
|
523 |
qq|">| . H($ref->{invnumber}) . qq|</a></td>|; |
|
524 |
|
|
525 |
map { print "$column_data{$_}\n" } @column_index; |
|
526 |
|
|
527 |
print qq| |
|
528 |
</tr> |
|
529 |
|; |
|
262 |
$previous_dunning_id = $ref->{dunning_id}; |
|
263 |
$ref->{listrow_odd_even} = $odd_even; |
|
530 | 264 |
} |
531 | 265 |
|
532 |
$form->{rowcount} = $i; |
|
533 |
|
|
534 |
print qq| |
|
535 |
</table> |
|
536 |
</td> |
|
537 |
</tr> |
|
538 |
<tr> |
|
539 |
<td><hr size=3 noshade></td> |
|
540 |
</tr> |
|
541 |
</table> |
|
542 |
|
|
543 |
<br> |
|
544 |
<form method=post action=$form->{script}> |
|
545 |
|
|
546 |
<input name=callback type=hidden value="$form->{callback}"> |
|
547 |
<input name=rowcount type=hidden value="$form->{rowcount}"> |
|
548 |
<input name=nextsub type=hidden value="$form->{nextsub}"> |
|
549 |
|
|
550 |
|
|
551 |
<input type=hidden name=login value=$form->{login}> |
|
552 |
<input type=hidden name=password value=$form->{password}> |
|
553 |
|
|
554 |
</form> |
|
266 |
if (!$form->{callback}) { |
|
267 |
$form->{callback} = |
|
268 |
build_std_url("action=show_dunning", qw(customer_id customer dunning_level department_id invnumber ordnumber |
|
269 |
ransdatefrom transdateto dunningfrom dunningto notes showold)); |
|
270 |
} |
|
555 | 271 |
|
556 |
</body> |
|
557 |
</html> |
|
558 |
|; |
|
272 |
$form->{title} = $locale->text('Dunning overview'); |
|
273 |
$form->header(); |
|
559 | 274 |
|
275 |
print $form->parse_html_template("dunning/show_dunning"); |
|
560 | 276 |
|
561 | 277 |
$lxdebug->leave_sub(); |
562 | 278 |
|
Auch abrufbar als: Unified diff
Den Rest von dn.pl auf die Verwendung von HTML-Vorlagen umgestellt.