Revision 031251fb
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
44 | 44 |
|
45 | 45 |
use Data::Dumper; |
46 | 46 |
|
47 |
1; |
|
48 |
|
|
49 | 47 |
require "bin/mozilla/common.pl"; |
50 | 48 |
|
49 |
use strict; |
|
50 |
|
|
51 |
1; |
|
52 |
|
|
51 | 53 |
# end of main |
52 | 54 |
|
53 |
sub add { call_sub("add_$form->{type}"); } |
|
54 |
sub delete { call_sub("delete_$form->{type}"); } |
|
55 |
sub save { call_sub("save_$form->{type}"); } |
|
56 |
sub edit { call_sub("edit_$form->{type}"); } |
|
57 |
sub continue { call_sub($form->{"nextsub"}); } |
|
58 |
sub save_as_new { call_sub("save_as_new_$form->{type}"); } |
|
55 |
sub add { call_sub("add_$main::form->{type}"); }
|
|
56 |
sub delete { call_sub("delete_$main::form->{type}"); }
|
|
57 |
sub save { call_sub("save_$main::form->{type}"); }
|
|
58 |
sub edit { call_sub("edit_$main::form->{type}"); }
|
|
59 |
sub continue { call_sub($main::form->{"nextsub"}); }
|
|
60 |
sub save_as_new { call_sub("save_as_new_$main::form->{type}"); }
|
|
59 | 61 |
|
60 | 62 |
sub add_account { |
61 |
$lxdebug->enter_sub(); |
|
63 |
$main::lxdebug->enter_sub(); |
|
64 |
|
|
65 |
my $form = $main::form; |
|
66 |
my %myconfig = %main::myconfig; |
|
62 | 67 |
|
63 |
$auth->assert('config'); |
|
68 |
$main::auth->assert('config');
|
|
64 | 69 |
|
65 | 70 |
$form->{title} = "Add"; |
66 | 71 |
$form->{charttype} = "A"; |
... | ... | |
71 | 76 |
&account_header; |
72 | 77 |
&form_footer; |
73 | 78 |
|
74 |
$lxdebug->leave_sub(); |
|
79 |
$main::lxdebug->leave_sub();
|
|
75 | 80 |
} |
76 | 81 |
|
77 | 82 |
sub edit_account { |
78 |
$lxdebug->enter_sub(); |
|
83 |
$main::lxdebug->enter_sub(); |
|
84 |
|
|
85 |
my $form = $main::form; |
|
86 |
my %myconfig = %main::myconfig; |
|
79 | 87 |
|
80 |
$auth->assert('config'); |
|
88 |
$main::auth->assert('config');
|
|
81 | 89 |
|
82 | 90 |
$form->{title} = "Edit"; |
83 | 91 |
AM->get_account(\%myconfig, \%$form); |
... | ... | |
89 | 97 |
&account_header; |
90 | 98 |
&form_footer; |
91 | 99 |
|
92 |
$lxdebug->leave_sub(); |
|
100 |
$main::lxdebug->leave_sub();
|
|
93 | 101 |
} |
94 | 102 |
|
95 | 103 |
sub account_header { |
96 |
$lxdebug->enter_sub(); |
|
104 |
$main::lxdebug->enter_sub();
|
|
97 | 105 |
|
98 |
$auth->assert('config'); |
|
106 |
my $form = $main::form; |
|
107 |
my %myconfig = %main::myconfig; |
|
108 |
my $locale = $main::locale; |
|
109 |
|
|
110 |
$main::auth->assert('config'); |
|
99 | 111 |
|
100 | 112 |
if ( $form->{action} eq 'edit_account') { |
101 | 113 |
$form->{account_exists} = '1'; |
... | ... | |
122 | 134 |
} |
123 | 135 |
|
124 | 136 |
# Fill in empty row for new Taxkey |
125 |
$newtaxkey_ref = { |
|
137 |
my $newtaxkey_ref = {
|
|
126 | 138 |
id => '', |
127 | 139 |
chart_id => '', |
128 | 140 |
accno => '', |
... | ... | |
186 | 198 |
if (!$form->{new_chart_valid}) { |
187 | 199 |
$form->{selectnewaccount} = qq|<option value=""> |. $locale->text('None') .q|</option>|; |
188 | 200 |
} |
189 |
foreach $item (@{ $form->{NEWACCOUNT} }) { |
|
201 |
foreach my $item (@{ $form->{NEWACCOUNT} }) {
|
|
190 | 202 |
if ($item->{id} == $form->{new_chart_id}) { |
191 | 203 |
$form->{selectnewaccount} .= |
192 | 204 |
qq|<option value="$item->{id}" selected>$item->{accno}--$item->{description}</option>|; |
... | ... | |
198 | 210 |
} |
199 | 211 |
} |
200 | 212 |
|
201 |
$select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|; |
|
202 |
%eur = (1 => "Umsatzerl?se", |
|
213 |
my $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|; |
|
214 |
my %eur = ( |
|
215 |
1 => "Umsatzerl?se", |
|
203 | 216 |
2 => "sonstige Erl?se", |
204 | 217 |
3 => "Privatanteile", |
205 | 218 |
4 => "Zinsertr?ge", |
... | ... | |
230 | 243 |
29 => "Zinsaufwand", |
231 | 244 |
30 => "Ausserordentlicher Aufwand", |
232 | 245 |
31 => "Betriebliche Steuern"); |
233 |
foreach $item (sort({ $a <=> $b } keys(%eur))) { |
|
234 |
my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $eur{$item})); |
|
246 |
foreach my $item (sort({ $a <=> $b } keys(%eur))) {
|
|
247 |
my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $eur{$item}));
|
|
235 | 248 |
if ($item == $form->{pos_eur}) { |
236 | 249 |
$select_eur .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|. $text</option>\n|; |
237 | 250 |
} else { |
... | ... | |
240 | 253 |
|
241 | 254 |
} |
242 | 255 |
|
243 |
$select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|; |
|
256 |
my $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
|
|
244 | 257 |
|
245 |
%bwapos = (1 => 'Umsatzerl?se', |
|
258 |
my %bwapos = ( |
|
259 |
1 => 'Umsatzerl?se', |
|
246 | 260 |
2 => 'Best.Verdg.FE/UE', |
247 | 261 |
3 => 'Aktiv.Eigenleistung', |
248 | 262 |
4 => 'Mat./Wareneinkauf', |
... | ... | |
264 | 278 |
33 => 'Sonst.neutr.Ertrag', |
265 | 279 |
34 => 'Verr.kalk.Kosten', |
266 | 280 |
35 => 'Steuern Eink.u.Ertr.'); |
267 |
foreach $item (sort({ $a <=> $b } keys %bwapos)) { |
|
268 |
my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $bwapos{$item})); |
|
281 |
foreach my $item (sort({ $a <=> $b } keys %bwapos)) {
|
|
282 |
my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $bwapos{$item}));
|
|
269 | 283 |
if ($item == $form->{pos_bwa}) { |
270 | 284 |
$select_bwa .= qq|<option value="$item" selected>|. sprintf("%.2d", $item) .qq|. $text\n|; |
271 | 285 |
} else { |
... | ... | |
275 | 289 |
} |
276 | 290 |
|
277 | 291 |
# Wieder hinzugef?gt zu evaluationszwecken (us) 09.03.2007 |
278 |
$select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|; |
|
279 |
foreach $item ((1, 2, 3, 4)) { |
|
292 |
my $select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
|
|
293 |
foreach my $item ((1, 2, 3, 4)) {
|
|
280 | 294 |
if ($item == $form->{pos_bilanz}) { |
281 | 295 |
$select_bilanz .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|.\n|; |
282 | 296 |
} else { |
... | ... | |
293 | 307 |
|
294 | 308 |
# preselections category |
295 | 309 |
|
296 |
$select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|; |
|
310 |
my $select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
|
|
297 | 311 |
|
298 |
%category = ( |
|
312 |
my %category = (
|
|
299 | 313 |
'A' => $locale->text('Asset'), |
300 | 314 |
'L' => $locale->text('Liability'), |
301 | 315 |
'Q' => $locale->text('Equity'), |
... | ... | |
303 | 317 |
'E' => $locale->text('Expense'), |
304 | 318 |
'C' => $locale->text('Costs'), |
305 | 319 |
); |
306 |
foreach $item ( sort({ $a <=> $b } keys %category) ) { |
|
320 |
foreach my $item ( sort({ $a <=> $b } keys %category) ) {
|
|
307 | 321 |
if ($item eq $form->{category}) { |
308 | 322 |
$select_category .= qq|<option value="$item" selected="selected">$category{$item} (|. sprintf("%s", $item) .qq|)\n|; |
309 | 323 |
} else { |
... | ... | |
320 | 334 |
'H' => $locale->text('Header'), |
321 | 335 |
); |
322 | 336 |
|
323 |
foreach $item ( sort({ $a <=> $b } keys %charttype) ) { |
|
337 |
foreach my $item ( sort({ $a <=> $b } keys %charttype) ) {
|
|
324 | 338 |
if ($item eq $form->{charttype}) { |
325 | 339 |
$select_charttype .= qq|<option value="$item" selected="selected">$charttype{$item}\n|; |
326 | 340 |
|
... | ... | |
338 | 352 |
ChartTypeIsAccount => $ChartTypeIsAccount, |
339 | 353 |
select_category => $select_category, |
340 | 354 |
select_charttype => $select_charttype, |
341 |
newaccount => $newaccount, |
|
342 |
checked => $checked, |
|
343 | 355 |
select_bwa => $select_bwa, |
344 | 356 |
select_bilanz => $select_bilanz, |
345 | 357 |
select_eur => $select_eur, |
... | ... | |
349 | 361 |
print($form->parse_html_template('am/edit_accounts', $parameters_ref)); |
350 | 362 |
|
351 | 363 |
|
352 |
$lxdebug->leave_sub(); |
|
364 |
$main::lxdebug->leave_sub();
|
|
353 | 365 |
} |
354 | 366 |
|
355 | 367 |
sub form_footer { |
356 |
$lxdebug->enter_sub(); |
|
368 |
$main::lxdebug->enter_sub(); |
|
369 |
|
|
370 |
my $form = $main::form; |
|
371 |
my $locale = $main::locale; |
|
357 | 372 |
|
358 |
$auth->assert('config'); |
|
373 |
$main::auth->assert('config');
|
|
359 | 374 |
|
360 | 375 |
print qq| |
361 | 376 |
|
... | ... | |
387 | 402 |
</html> |
388 | 403 |
|; |
389 | 404 |
|
390 |
$lxdebug->leave_sub(); |
|
405 |
$main::lxdebug->leave_sub();
|
|
391 | 406 |
} |
392 | 407 |
|
393 | 408 |
sub save_account { |
394 |
$lxdebug->enter_sub(); |
|
409 |
$main::lxdebug->enter_sub();
|
|
395 | 410 |
|
396 |
$auth->assert('config'); |
|
411 |
my $form = $main::form; |
|
412 |
my %myconfig = %main::myconfig; |
|
413 |
my $locale = $main::locale; |
|
414 |
|
|
415 |
$main::auth->assert('config'); |
|
397 | 416 |
|
398 | 417 |
$form->isblank("accno", $locale->text('Account Number missing!')); |
399 | 418 |
$form->isblank("description", $locale->text('Account Description missing!')); |
... | ... | |
406 | 425 |
if (AM->save_account(\%myconfig, \%$form)); |
407 | 426 |
$form->error($locale->text('Cannot save account!')); |
408 | 427 |
|
409 |
$lxdebug->leave_sub(); |
|
428 |
$main::lxdebug->leave_sub();
|
|
410 | 429 |
} |
411 | 430 |
|
412 | 431 |
sub save_as_new_account { |
413 |
$lxdebug->enter_sub(); |
|
432 |
$main::lxdebug->enter_sub(); |
|
433 |
|
|
434 |
my $form = $main::form; |
|
435 |
my %myconfig = %main::myconfig; |
|
436 |
my $locale = $main::locale; |
|
414 | 437 |
|
415 |
$auth->assert('config'); |
|
438 |
$main::auth->assert('config');
|
|
416 | 439 |
|
417 | 440 |
$form->isblank("accno", $locale->text('Account Number missing!')); |
418 | 441 |
$form->isblank("description", $locale->text('Account Description missing!')); |
... | ... | |
436 | 459 |
if (AM->save_account(\%myconfig, \%$form)); |
437 | 460 |
$form->error($locale->text('Cannot save account!')); |
438 | 461 |
|
439 |
$lxdebug->leave_sub(); |
|
462 |
$main::lxdebug->leave_sub();
|
|
440 | 463 |
} |
441 | 464 |
|
442 | 465 |
sub list_account { |
443 |
$lxdebug->enter_sub(); |
|
466 |
$main::lxdebug->enter_sub();
|
|
444 | 467 |
|
445 |
$auth->assert('config'); |
|
468 |
my $form = $main::form; |
|
469 |
my %myconfig = %main::myconfig; |
|
470 |
my $locale = $main::locale; |
|
471 |
|
|
472 |
$main::auth->assert('config'); |
|
446 | 473 |
|
447 | 474 |
$form->{callback} = build_std_url('action=list_account'); |
448 | 475 |
my $link_edit_account = build_std_url('action=edit_account', 'callback'); |
449 | 476 |
|
450 | 477 |
CA->all_accounts(\%myconfig, \%$form); |
451 | 478 |
|
452 |
foreach $ca (@{ $form->{CA} }) { |
|
479 |
foreach my $ca (@{ $form->{CA} }) {
|
|
453 | 480 |
|
454 | 481 |
$ca->{debit} = ""; |
455 | 482 |
$ca->{credit} = ""; |
... | ... | |
486 | 513 |
# Ausgabe des Templates |
487 | 514 |
print($form->parse_html_template('am/list_accounts', $parameters_ref)); |
488 | 515 |
|
489 |
$lxdebug->leave_sub(); |
|
516 |
$main::lxdebug->leave_sub();
|
|
490 | 517 |
|
491 | 518 |
} |
492 | 519 |
|
493 | 520 |
|
494 | 521 |
sub list_account_details { |
495 | 522 |
# Ajax Funktion aus list_account_details |
496 |
$lxdebug->enter_sub(); |
|
523 |
$main::lxdebug->enter_sub(); |
|
524 |
|
|
525 |
my $form = $main::form; |
|
526 |
my %myconfig = %main::myconfig; |
|
527 |
my $locale = $main::locale; |
|
497 | 528 |
|
498 |
$auth->assert('config'); |
|
529 |
$main::auth->assert('config');
|
|
499 | 530 |
|
500 | 531 |
my $chart_id = $form->{args}; |
501 | 532 |
|
502 | 533 |
CA->all_accounts(\%myconfig, \%$form, $chart_id); |
503 | 534 |
|
504 |
foreach $ca (@{ $form->{CA} }) { |
|
535 |
foreach my $ca (@{ $form->{CA} }) {
|
|
505 | 536 |
|
506 | 537 |
$ca->{debit} = " "; |
507 | 538 |
$ca->{credit} = " "; |
... | ... | |
555 | 586 |
|
556 | 587 |
print $form->parse_html_template('am/list_account_details'); |
557 | 588 |
|
558 |
$lxdebug->leave_sub(); |
|
589 |
$main::lxdebug->leave_sub();
|
|
559 | 590 |
|
560 | 591 |
} |
561 | 592 |
|
562 | 593 |
sub delete_account { |
563 |
$lxdebug->enter_sub(); |
|
594 |
$main::lxdebug->enter_sub(); |
|
595 |
|
|
596 |
my $form = $main::form; |
|
597 |
my %myconfig = %main::myconfig; |
|
598 |
my $locale = $main::locale; |
|
564 | 599 |
|
565 |
$auth->assert('config'); |
|
600 |
$main::auth->assert('config');
|
|
566 | 601 |
|
567 | 602 |
$form->{title} = $locale->text('Delete Account'); |
568 | 603 |
|
569 |
foreach $id ( |
|
604 |
foreach my $id (
|
|
570 | 605 |
qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id) |
571 | 606 |
) { |
572 | 607 |
if ($form->{id} == $form->{$id}) { |
... | ... | |
578 | 613 |
if (AM->delete_account(\%myconfig, \%$form)); |
579 | 614 |
$form->error($locale->text('Cannot delete account!')); |
580 | 615 |
|
581 |
$lxdebug->leave_sub(); |
|
616 |
$main::lxdebug->leave_sub();
|
|
582 | 617 |
} |
583 | 618 |
|
584 | 619 |
sub add_department { |
585 |
$lxdebug->enter_sub(); |
|
620 |
$main::lxdebug->enter_sub();
|
|
586 | 621 |
|
587 |
$auth->assert('config'); |
|
622 |
my $form = $main::form; |
|
623 |
|
|
624 |
$main::auth->assert('config'); |
|
588 | 625 |
|
589 | 626 |
$form->{title} = "Add"; |
590 | 627 |
$form->{role} = "P"; |
... | ... | |
594 | 631 |
&department_header; |
595 | 632 |
&form_footer; |
596 | 633 |
|
597 |
$lxdebug->leave_sub(); |
|
634 |
$main::lxdebug->leave_sub();
|
|
598 | 635 |
} |
599 | 636 |
|
600 | 637 |
sub edit_department { |
601 |
$lxdebug->enter_sub(); |
|
638 |
$main::lxdebug->enter_sub(); |
|
639 |
|
|
640 |
my $form = $main::form; |
|
641 |
my %myconfig = %main::myconfig; |
|
602 | 642 |
|
603 |
$auth->assert('config'); |
|
643 |
$main::auth->assert('config');
|
|
604 | 644 |
|
605 | 645 |
$form->{title} = "Edit"; |
606 | 646 |
|
... | ... | |
609 | 649 |
&department_header; |
610 | 650 |
&form_footer; |
611 | 651 |
|
612 |
$lxdebug->leave_sub(); |
|
652 |
$main::lxdebug->leave_sub();
|
|
613 | 653 |
} |
614 | 654 |
|
615 | 655 |
sub list_department { |
616 |
$lxdebug->enter_sub(); |
|
656 |
$main::lxdebug->enter_sub();
|
|
617 | 657 |
|
618 |
$auth->assert('config'); |
|
658 |
my $form = $main::form; |
|
659 |
my %myconfig = %main::myconfig; |
|
660 |
my $locale = $main::locale; |
|
661 |
|
|
662 |
$main::auth->assert('config'); |
|
619 | 663 |
|
620 | 664 |
AM->departments(\%myconfig, \%$form); |
621 | 665 |
|
622 | 666 |
$form->{callback} = "am.pl?action=list_department"; |
623 | 667 |
|
624 |
$callback = $form->escape($form->{callback}); |
|
668 |
my $callback = $form->escape($form->{callback});
|
|
625 | 669 |
|
626 | 670 |
$form->{title} = $locale->text('Departments'); |
627 | 671 |
|
628 |
@column_index = qw(description cost profit); |
|
629 |
|
|
672 |
my @column_index = qw(description cost profit);
|
|
673 |
my %column_header; |
|
630 | 674 |
$column_header{description} = |
631 | 675 |
qq|<th class=listheading width=90%>| |
632 | 676 |
. $locale->text('Description') |
... | ... | |
662 | 706 |
</tr> |
663 | 707 |
|; |
664 | 708 |
|
665 |
foreach $ref (@{ $form->{ALL} }) { |
|
709 |
my ($i, %column_data); |
|
710 |
foreach my $ref (@{ $form->{ALL} }) { |
|
666 | 711 |
|
667 | 712 |
$i++; |
668 | 713 |
$i %= 2; |
... | ... | |
671 | 716 |
<tr valign=top class=listrow$i> |
672 | 717 |
|; |
673 | 718 |
|
674 |
$costcenter = ($ref->{role} eq "C") ? "X" : ""; |
|
675 |
$profitcenter = ($ref->{role} eq "P") ? "X" : ""; |
|
719 |
my $costcenter = ($ref->{role} eq "C") ? "X" : "";
|
|
720 |
my $profitcenter = ($ref->{role} eq "P") ? "X" : "";
|
|
676 | 721 |
|
677 | 722 |
$column_data{description} = |
678 | 723 |
qq|<td><a href="am.pl?action=edit_department&id=$ref->{id}&callback=$callback">$ref->{description}</td>|; |
... | ... | |
711 | 756 |
</html> |
712 | 757 |
|; |
713 | 758 |
|
714 |
$lxdebug->leave_sub(); |
|
759 |
$main::lxdebug->leave_sub();
|
|
715 | 760 |
} |
716 | 761 |
|
717 | 762 |
sub department_header { |
718 |
$lxdebug->enter_sub(); |
|
763 |
$main::lxdebug->enter_sub();
|
|
719 | 764 |
|
720 |
$auth->assert('config'); |
|
765 |
my $form = $main::form; |
|
766 |
my $locale = $main::locale; |
|
767 |
|
|
768 |
$main::auth->assert('config'); |
|
721 | 769 |
|
722 | 770 |
$form->{title} = $locale->text("$form->{title} Department"); |
723 | 771 |
|
... | ... | |
726 | 774 |
|
727 | 775 |
$form->{description} =~ s/\"/"/g; |
728 | 776 |
|
777 |
my ($rows, $description); |
|
729 | 778 |
if (($rows = $form->numtextrows($form->{description}, 60)) > 1) { |
730 | 779 |
$description = |
731 | 780 |
qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|; |
... | ... | |
734 | 783 |
qq|<input name=description size=60 value="$form->{description}">|; |
735 | 784 |
} |
736 | 785 |
|
737 |
$costcenter = "checked" if $form->{role} eq "C"; |
|
738 |
$profitcenter = "checked" if $form->{role} eq "P"; |
|
786 |
my $costcenter = "checked" if $form->{role} eq "C";
|
|
787 |
my $profitcenter = "checked" if $form->{role} eq "P";
|
|
739 | 788 |
|
740 | 789 |
$form->header; |
741 | 790 |
|
... | ... | |
769 | 818 |
</table> |
770 | 819 |
|; |
771 | 820 |
|
772 |
$lxdebug->leave_sub(); |
|
821 |
$main::lxdebug->leave_sub();
|
|
773 | 822 |
} |
774 | 823 |
|
775 | 824 |
sub save_department { |
776 |
$lxdebug->enter_sub(); |
|
825 |
$main::lxdebug->enter_sub(); |
|
826 |
|
|
827 |
my $form = $main::form; |
|
828 |
my %myconfig = %main::myconfig; |
|
829 |
my $locale = $main::locale; |
|
777 | 830 |
|
778 |
$auth->assert('config'); |
|
831 |
$main::auth->assert('config');
|
|
779 | 832 |
|
780 | 833 |
$form->isblank("description", $locale->text('Description missing!')); |
781 | 834 |
AM->save_department(\%myconfig, \%$form); |
782 | 835 |
$form->redirect($locale->text('Department saved!')); |
783 | 836 |
|
784 |
$lxdebug->leave_sub(); |
|
837 |
$main::lxdebug->leave_sub();
|
|
785 | 838 |
} |
786 | 839 |
|
787 | 840 |
sub delete_department { |
788 |
$lxdebug->enter_sub(); |
|
841 |
$main::lxdebug->enter_sub(); |
|
842 |
|
|
843 |
my $form = $main::form; |
|
844 |
my %myconfig = %main::myconfig; |
|
845 |
my $locale = $main::locale; |
|
789 | 846 |
|
790 |
$auth->assert('config'); |
|
847 |
$main::auth->assert('config');
|
|
791 | 848 |
|
792 | 849 |
AM->delete_department(\%myconfig, \%$form); |
793 | 850 |
$form->redirect($locale->text('Department deleted!')); |
794 | 851 |
|
795 |
$lxdebug->leave_sub(); |
|
852 |
$main::lxdebug->leave_sub();
|
|
796 | 853 |
} |
797 | 854 |
|
798 | 855 |
sub add_lead { |
799 |
$lxdebug->enter_sub(); |
|
856 |
$main::lxdebug->enter_sub();
|
|
800 | 857 |
|
801 |
$auth->assert('config'); |
|
858 |
my $form = $main::form; |
|
859 |
|
|
860 |
$main::auth->assert('config'); |
|
802 | 861 |
|
803 | 862 |
$form->{title} = "Add"; |
804 | 863 |
|
... | ... | |
807 | 866 |
&lead_header; |
808 | 867 |
&form_footer; |
809 | 868 |
|
810 |
$lxdebug->leave_sub(); |
|
869 |
$main::lxdebug->leave_sub();
|
|
811 | 870 |
} |
812 | 871 |
|
813 | 872 |
sub edit_lead { |
814 |
$lxdebug->enter_sub(); |
|
873 |
$main::lxdebug->enter_sub(); |
|
874 |
|
|
875 |
my $form = $main::form; |
|
876 |
my %myconfig = %main::myconfig; |
|
815 | 877 |
|
816 |
$auth->assert('config'); |
|
878 |
$main::auth->assert('config');
|
|
817 | 879 |
|
818 | 880 |
$form->{title} = "Edit"; |
819 | 881 |
|
... | ... | |
824 | 886 |
$form->{orphaned} = 1; |
825 | 887 |
&form_footer; |
826 | 888 |
|
827 |
$lxdebug->leave_sub(); |
|
889 |
$main::lxdebug->leave_sub();
|
|
828 | 890 |
} |
829 | 891 |
|
830 | 892 |
sub list_lead { |
831 |
$lxdebug->enter_sub(); |
|
893 |
$main::lxdebug->enter_sub(); |
|
894 |
|
|
895 |
my $form = $main::form; |
|
896 |
my %myconfig = %main::myconfig; |
|
897 |
my $locale = $main::locale; |
|
832 | 898 |
|
833 |
$auth->assert('config'); |
|
899 |
$main::auth->assert('config');
|
|
834 | 900 |
|
835 | 901 |
AM->lead(\%myconfig, \%$form); |
836 | 902 |
|
837 | 903 |
$form->{callback} = "am.pl?action=list_lead"; |
838 | 904 |
|
839 |
$callback = $form->escape($form->{callback}); |
|
905 |
my $callback = $form->escape($form->{callback});
|
|
840 | 906 |
|
841 | 907 |
$form->{title} = $locale->text('Lead'); |
842 | 908 |
|
843 |
@column_index = qw(description cost profit); |
|
844 |
|
|
909 |
my @column_index = qw(description cost profit);
|
|
910 |
my %column_header; |
|
845 | 911 |
$column_header{description} = |
846 | 912 |
qq|<th class=listheading width=100%>| |
847 | 913 |
. $locale->text('Description') |
... | ... | |
866 | 932 |
</tr> |
867 | 933 |
|; |
868 | 934 |
|
869 |
foreach $ref (@{ $form->{ALL} }) { |
|
935 |
my ($i, %column_data); |
|
936 |
foreach my $ref (@{ $form->{ALL} }) { |
|
870 | 937 |
|
871 | 938 |
$i++; |
872 | 939 |
$i %= 2; |
... | ... | |
875 | 942 |
<tr valign=top class=listrow$i> |
876 | 943 |
|; |
877 | 944 |
|
878 |
$lead = $ref->{lead}; |
|
945 |
# $lead = $ref->{lead};
|
|
879 | 946 |
|
880 | 947 |
$column_data{description} = qq|<td><a href="am.pl?action=edit_lead&id=$ref->{id}&callback=$callback">$ref->{lead}</td>|; |
881 | 948 |
|
... | ... | |
908 | 975 |
</html> |
909 | 976 |
|; |
910 | 977 |
|
911 |
$lxdebug->leave_sub(); |
|
978 |
$main::lxdebug->leave_sub();
|
|
912 | 979 |
} |
913 | 980 |
|
914 | 981 |
sub lead_header { |
915 |
$lxdebug->enter_sub(); |
|
982 |
$main::lxdebug->enter_sub(); |
|
983 |
|
|
984 |
my $form = $main::form; |
|
985 |
my $locale = $main::locale; |
|
916 | 986 |
|
917 |
$auth->assert('config'); |
|
987 |
$main::auth->assert('config');
|
|
918 | 988 |
|
919 | 989 |
$form->{title} = $locale->text("$form->{title} Lead"); |
920 | 990 |
|
... | ... | |
923 | 993 |
|
924 | 994 |
$form->{description} =~ s/\"/"/g; |
925 | 995 |
|
926 |
$description = |
|
996 |
my $description =
|
|
927 | 997 |
qq|<input name=description size=50 value="$form->{lead}">|; |
928 | 998 |
|
929 | 999 |
$form->header; |
... | ... | |
950 | 1020 |
</table> |
951 | 1021 |
|; |
952 | 1022 |
|
953 |
$lxdebug->leave_sub(); |
|
1023 |
$main::lxdebug->leave_sub();
|
|
954 | 1024 |
} |
955 | 1025 |
|
956 | 1026 |
sub save_lead { |
957 |
$lxdebug->enter_sub(); |
|
1027 |
$main::lxdebug->enter_sub(); |
|
1028 |
|
|
1029 |
my $form = $main::form; |
|
1030 |
my %myconfig = %main::myconfig; |
|
1031 |
my $locale = $main::locale; |
|
958 | 1032 |
|
959 |
$auth->assert('config'); |
|
1033 |
$main::auth->assert('config');
|
|
960 | 1034 |
|
961 | 1035 |
$form->isblank("description", $locale->text('Description missing!')); |
962 | 1036 |
AM->save_lead(\%myconfig, \%$form); |
963 | 1037 |
$form->redirect($locale->text('lead saved!')); |
964 | 1038 |
|
965 |
$lxdebug->leave_sub(); |
|
1039 |
$main::lxdebug->leave_sub();
|
|
966 | 1040 |
} |
967 | 1041 |
|
968 | 1042 |
sub delete_lead { |
969 |
$lxdebug->enter_sub(); |
|
1043 |
$main::lxdebug->enter_sub();
|
|
970 | 1044 |
|
971 |
$auth->assert('config'); |
|
1045 |
my $form = $main::form; |
|
1046 |
my %myconfig = %main::myconfig; |
|
1047 |
my $locale = $main::locale; |
|
1048 |
|
|
1049 |
$main::auth->assert('config'); |
|
972 | 1050 |
|
973 | 1051 |
AM->delete_lead(\%myconfig, \%$form); |
974 | 1052 |
$form->redirect($locale->text('lead deleted!')); |
975 | 1053 |
|
976 |
$lxdebug->leave_sub(); |
|
1054 |
$main::lxdebug->leave_sub();
|
|
977 | 1055 |
} |
978 | 1056 |
|
979 | 1057 |
sub add_business { |
980 |
$lxdebug->enter_sub(); |
|
1058 |
$main::lxdebug->enter_sub(); |
|
1059 |
|
|
1060 |
my $form = $main::form; |
|
981 | 1061 |
|
982 |
$auth->assert('config'); |
|
1062 |
$main::auth->assert('config');
|
|
983 | 1063 |
|
984 | 1064 |
$form->{title} = "Add"; |
985 | 1065 |
|
... | ... | |
988 | 1068 |
&business_header; |
989 | 1069 |
&form_footer; |
990 | 1070 |
|
991 |
$lxdebug->leave_sub(); |
|
1071 |
$main::lxdebug->leave_sub();
|
|
992 | 1072 |
} |
993 | 1073 |
|
994 | 1074 |
sub edit_business { |
995 |
$lxdebug->enter_sub(); |
|
1075 |
$main::lxdebug->enter_sub(); |
|
1076 |
|
|
1077 |
my $form = $main::form; |
|
1078 |
my %myconfig = %main::myconfig; |
|
996 | 1079 |
|
997 | 1080 |
$form->{title} = "Edit"; |
998 | 1081 |
|
... | ... | |
1003 | 1086 |
$form->{orphaned} = 1; |
1004 | 1087 |
&form_footer; |
1005 | 1088 |
|
1006 |
$lxdebug->leave_sub(); |
|
1089 |
$main::lxdebug->leave_sub();
|
|
1007 | 1090 |
} |
1008 | 1091 |
|
1009 | 1092 |
sub list_business { |
1010 |
$lxdebug->enter_sub(); |
|
1093 |
$main::lxdebug->enter_sub(); |
|
1094 |
|
|
1095 |
my $form = $main::form; |
|
1096 |
my %myconfig = %main::myconfig; |
|
1097 |
my $locale = $main::locale; |
|
1011 | 1098 |
|
1012 |
$auth->assert('config'); |
|
1099 |
$main::auth->assert('config');
|
|
1013 | 1100 |
|
1014 | 1101 |
AM->business(\%myconfig, \%$form); |
1015 | 1102 |
|
1016 | 1103 |
$form->{callback} = "am.pl?action=list_business"; |
1017 | 1104 |
|
1018 |
$callback = $form->escape($form->{callback}); |
|
1105 |
my $callback = $form->escape($form->{callback});
|
|
1019 | 1106 |
|
1020 | 1107 |
$form->{title} = $locale->text('Type of Business'); |
1021 | 1108 |
|
1022 |
@column_index = qw(description discount customernumberinit); |
|
1023 |
|
|
1109 |
my @column_index = qw(description discount customernumberinit);
|
|
1110 |
my %column_header; |
|
1024 | 1111 |
$column_header{description} = |
1025 | 1112 |
qq|<th class=listheading width=60%>| |
1026 | 1113 |
. $locale->text('Description') |
... | ... | |
1056 | 1143 |
</tr> |
1057 | 1144 |
|; |
1058 | 1145 |
|
1059 |
foreach $ref (@{ $form->{ALL} }) { |
|
1146 |
my ($i, %column_data); |
|
1147 |
foreach my $ref (@{ $form->{ALL} }) { |
|
1060 | 1148 |
|
1061 | 1149 |
$i++; |
1062 | 1150 |
$i %= 2; |
... | ... | |
1065 | 1153 |
<tr valign=top class=listrow$i> |
1066 | 1154 |
|; |
1067 | 1155 |
|
1068 |
$discount = |
|
1069 |
$form->format_amount(\%myconfig, $ref->{discount} * 100); |
|
1070 |
$description = |
|
1071 |
$ref->{description}; |
|
1156 |
my $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100); |
|
1157 |
my $description = $ref->{description}; |
|
1072 | 1158 |
$column_data{description} = qq|<td><a href="am.pl?action=edit_business&id=$ref->{id}&callback=$callback">$description</td>|; |
1073 | 1159 |
$column_data{discount} = qq|<td align=right>$discount</td>|; |
1074 | 1160 |
$column_data{customernumberinit} = |
... | ... | |
1106 | 1192 |
</html> |
1107 | 1193 |
|; |
1108 | 1194 |
|
1109 |
$lxdebug->leave_sub(); |
|
1195 |
$main::lxdebug->leave_sub();
|
|
1110 | 1196 |
} |
1111 | 1197 |
|
1112 | 1198 |
sub business_header { |
1113 |
$lxdebug->enter_sub(); |
|
1199 |
$main::lxdebug->enter_sub(); |
|
1200 |
|
|
1201 |
my $form = $main::form; |
|
1202 |
my %myconfig = %main::myconfig; |
|
1203 |
my $locale = $main::locale; |
|
1114 | 1204 |
|
1115 |
$auth->assert('config'); |
|
1205 |
$main::auth->assert('config');
|
|
1116 | 1206 |
|
1117 | 1207 |
$form->{title} = $locale->text("$form->{title} Business"); |
1118 | 1208 |
|
... | ... | |
1155 | 1245 |
</table> |
1156 | 1246 |
|; |
1157 | 1247 |
|
1158 |
$lxdebug->leave_sub(); |
|
1248 |
$main::lxdebug->leave_sub();
|
|
1159 | 1249 |
} |
1160 | 1250 |
|
1161 | 1251 |
sub save_business { |
1162 |
$lxdebug->enter_sub(); |
|
1252 |
$main::lxdebug->enter_sub();
|
|
1163 | 1253 |
|
1164 |
$auth->assert('config'); |
|
1254 |
my $form = $main::form; |
|
1255 |
my %myconfig = %main::myconfig; |
|
1256 |
my $locale = $main::locale; |
|
1257 |
|
|
1258 |
$main::auth->assert('config'); |
|
1165 | 1259 |
|
1166 | 1260 |
$form->isblank("description", $locale->text('Description missing!')); |
1167 | 1261 |
$form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100; |
1168 | 1262 |
AM->save_business(\%myconfig, \%$form); |
1169 | 1263 |
$form->redirect($locale->text('Business saved!')); |
1170 | 1264 |
|
1171 |
$lxdebug->leave_sub(); |
|
1265 |
$main::lxdebug->leave_sub();
|
|
1172 | 1266 |
} |
1173 | 1267 |
|
1174 | 1268 |
sub delete_business { |
1175 |
$lxdebug->enter_sub(); |
|
1269 |
$main::lxdebug->enter_sub(); |
|
1270 |
|
|
1271 |
my $form = $main::form; |
|
1272 |
my %myconfig = %main::myconfig; |
|
1273 |
my $locale = $main::locale; |
|
1176 | 1274 |
|
1177 |
$auth->assert('config'); |
|
1275 |
$main::auth->assert('config');
|
|
1178 | 1276 |
|
1179 | 1277 |
AM->delete_business(\%myconfig, \%$form); |
1180 | 1278 |
$form->redirect($locale->text('Business deleted!')); |
1181 | 1279 |
|
1182 |
$lxdebug->leave_sub(); |
|
1280 |
$main::lxdebug->leave_sub();
|
|
1183 | 1281 |
} |
1184 | 1282 |
|
1185 | 1283 |
sub add_language { |
1186 |
$lxdebug->enter_sub(); |
|
1284 |
$main::lxdebug->enter_sub(); |
|
1285 |
|
|
1286 |
my $form = $main::form; |
|
1187 | 1287 |
|
1188 |
$auth->assert('config'); |
|
1288 |
$main::auth->assert('config');
|
|
1189 | 1289 |
|
1190 | 1290 |
$form->{title} = "Add"; |
1191 | 1291 |
|
... | ... | |
1194 | 1294 |
&language_header; |
1195 | 1295 |
&form_footer; |
1196 | 1296 |
|
1197 |
$lxdebug->leave_sub(); |
|
1297 |
$main::lxdebug->leave_sub();
|
|
1198 | 1298 |
} |
1199 | 1299 |
|
1200 | 1300 |
sub edit_language { |
1201 |
$lxdebug->enter_sub(); |
|
1301 |
$main::lxdebug->enter_sub();
|
|
1202 | 1302 |
|
1203 |
$auth->assert('config'); |
|
1303 |
my $form = $main::form; |
|
1304 |
my %myconfig = %main::myconfig; |
|
1305 |
|
|
1306 |
$main::auth->assert('config'); |
|
1204 | 1307 |
|
1205 | 1308 |
$form->{title} = "Edit"; |
1206 | 1309 |
|
... | ... | |
1211 | 1314 |
$form->{orphaned} = 1; |
1212 | 1315 |
&form_footer; |
1213 | 1316 |
|
1214 |
$lxdebug->leave_sub(); |
|
1317 |
$main::lxdebug->leave_sub();
|
|
1215 | 1318 |
} |
1216 | 1319 |
|
1217 | 1320 |
sub list_language { |
1218 |
$lxdebug->enter_sub(); |
|
1321 |
$main::lxdebug->enter_sub(); |
|
1322 |
|
|
1323 |
my $form = $main::form; |
|
1324 |
my %myconfig = %main::myconfig; |
|
1325 |
my $locale = $main::locale; |
|
1219 | 1326 |
|
1220 |
$auth->assert('config'); |
|
1327 |
$main::auth->assert('config');
|
|
1221 | 1328 |
|
1222 | 1329 |
AM->language(\%myconfig, \%$form); |
1223 | 1330 |
|
1224 | 1331 |
$form->{callback} = "am.pl?action=list_language"; |
1225 | 1332 |
|
1226 |
$callback = $form->escape($form->{callback}); |
|
1333 |
my $callback = $form->escape($form->{callback});
|
|
1227 | 1334 |
|
1228 | 1335 |
$form->{title} = $locale->text('Languages'); |
1229 | 1336 |
|
1230 |
@column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates); |
|
1231 |
|
|
1337 |
my @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
|
|
1338 |
my %column_header; |
|
1232 | 1339 |
$column_header{description} = |
1233 | 1340 |
qq|<th class=listheading width=60%>| |
1234 | 1341 |
. $locale->text('Description') |
... | ... | |
1276 | 1383 |
</tr> |
1277 | 1384 |
|; |
1278 | 1385 |
|
1279 |
foreach $ref (@{ $form->{ALL} }) { |
|
1386 |
my ($i, %column_data); |
|
1387 |
foreach my $ref (@{ $form->{ALL} }) { |
|
1280 | 1388 |
|
1281 | 1389 |
$i++; |
1282 | 1390 |
$i %= 2; |
... | ... | |
1338 | 1446 |
</html> |
1339 | 1447 |
|; |
1340 | 1448 |
|
1341 |
$lxdebug->leave_sub(); |
|
1449 |
$main::lxdebug->leave_sub();
|
|
1342 | 1450 |
} |
1343 | 1451 |
|
1344 | 1452 |
sub language_header { |
1345 |
$lxdebug->enter_sub(); |
|
1453 |
$main::lxdebug->enter_sub();
|
|
1346 | 1454 |
|
1347 |
$auth->assert('config'); |
|
1455 |
my $form = $main::form; |
|
1456 |
my $locale = $main::locale; |
|
1457 |
|
|
1458 |
$main::auth->assert('config'); |
|
1348 | 1459 |
|
1349 | 1460 |
$form->{title} = $locale->text("$form->{title} Language"); |
1350 | 1461 |
|
... | ... | |
1361 | 1472 |
my $numberformat = |
1362 | 1473 |
qq|<option value="">| . $locale->text("use program settings") . |
1363 | 1474 |
qq|</option>|; |
1364 |
foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
|
|
1475 |
foreach my $item (('1,000.00', '1000.00', '1.000,00', '1000,00')) {
|
|
1365 | 1476 |
$numberformat .= |
1366 | 1477 |
($item eq $form->{output_numberformat}) |
1367 | 1478 |
? "<option selected>$item" |
... | ... | |
1372 | 1483 |
my $dateformat = |
1373 | 1484 |
qq|<option value="">| . $locale->text("use program settings") . |
1374 | 1485 |
qq|</option>|; |
1375 |
foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { |
|
1486 |
foreach my $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
|
|
1376 | 1487 |
$dateformat .= |
1377 | 1488 |
($item eq $form->{output_dateformat}) |
1378 | 1489 |
? "<option selected>$item" |
... | ... | |
1428 | 1539 |
</table> |
1429 | 1540 |
|; |
1430 | 1541 |
|
1431 |
$lxdebug->leave_sub(); |
|
1542 |
$main::lxdebug->leave_sub();
|
|
1432 | 1543 |
} |
1433 | 1544 |
|
1434 | 1545 |
sub save_language { |
1435 |
$lxdebug->enter_sub(); |
|
1546 |
$main::lxdebug->enter_sub(); |
|
1547 |
|
|
1548 |
my $form = $main::form; |
|
1549 |
my %myconfig = %main::myconfig; |
|
1550 |
my $locale = $main::locale; |
|
1436 | 1551 |
|
1437 |
$auth->assert('config'); |
|
1552 |
$main::auth->assert('config');
|
|
1438 | 1553 |
|
1439 | 1554 |
$form->isblank("description", $locale->text('Language missing!')); |
1440 | 1555 |
$form->isblank("template_code", $locale->text('Template Code missing!')); |
... | ... | |
1442 | 1557 |
AM->save_language(\%myconfig, \%$form); |
1443 | 1558 |
$form->redirect($locale->text('Language saved!')); |
1444 | 1559 |
|
1445 |
$lxdebug->leave_sub(); |
|
1560 |
$main::lxdebug->leave_sub();
|
|
1446 | 1561 |
} |
1447 | 1562 |
|
1448 | 1563 |
sub delete_language { |
1449 |
$lxdebug->enter_sub(); |
|
1564 |
$main::lxdebug->enter_sub();
|
|
1450 | 1565 |
|
1451 |
$auth->assert('config'); |
|
1566 |
my $form = $main::form; |
|
1567 |
my %myconfig = %main::myconfig; |
|
1568 |
my $locale = $main::locale; |
|
1569 |
|
|
1570 |
$main::auth->assert('config'); |
|
1452 | 1571 |
|
1453 | 1572 |
AM->delete_language(\%myconfig, \%$form); |
1454 | 1573 |
$form->redirect($locale->text('Language deleted!')); |
1455 | 1574 |
|
1456 |
$lxdebug->leave_sub(); |
|
1575 |
$main::lxdebug->leave_sub();
|
|
1457 | 1576 |
} |
1458 | 1577 |
|
1459 | 1578 |
|
1460 | 1579 |
sub add_buchungsgruppe { |
1461 |
$lxdebug->enter_sub(); |
|
1580 |
$main::lxdebug->enter_sub(); |
|
1581 |
|
|
1582 |
my $form = $main::form; |
|
1583 |
my %myconfig = %main::myconfig; |
|
1584 |
my $locale = $main::locale; |
|
1462 | 1585 |
|
1463 |
$auth->assert('config'); |
|
1586 |
$main::auth->assert('config');
|
|
1464 | 1587 |
|
1465 | 1588 |
# $locale->text("Add Buchungsgruppe") |
1466 | 1589 |
# $locale->text("Edit Buchungsgruppe") |
... | ... | |
1478 | 1601 |
&buchungsgruppe_header; |
1479 | 1602 |
&form_footer; |
1480 | 1603 |
|
1481 |
$lxdebug->leave_sub(); |
|
1604 |
$main::lxdebug->leave_sub();
|
|
1482 | 1605 |
} |
1483 | 1606 |
|
1484 | 1607 |
sub edit_buchungsgruppe { |
1485 |
$lxdebug->enter_sub(); |
|
1608 |
$main::lxdebug->enter_sub();
|
|
1486 | 1609 |
|
1487 |
$auth->assert('config'); |
|
1610 |
my $form = $main::form; |
|
1611 |
my %myconfig = %main::myconfig; |
|
1612 |
|
|
1613 |
$main::auth->assert('config'); |
|
1488 | 1614 |
|
1489 | 1615 |
$form->{title} = "Edit"; |
1490 | 1616 |
|
... | ... | |
1494 | 1620 |
|
1495 | 1621 |
&form_footer; |
1496 | 1622 |
|
1497 |
$lxdebug->leave_sub(); |
|
1623 |
$main::lxdebug->leave_sub();
|
|
1498 | 1624 |
} |
1499 | 1625 |
|
1500 | 1626 |
sub list_buchungsgruppe { |
1501 |
$lxdebug->enter_sub(); |
|
1627 |
$main::lxdebug->enter_sub(); |
|
1628 |
|
|
1629 |
my $form = $main::form; |
|
1630 |
my %myconfig = %main::myconfig; |
|
1631 |
my $locale = $main::locale; |
|
1502 | 1632 |
|
1503 |
$auth->assert('config'); |
|
1633 |
$main::auth->assert('config');
|
|
1504 | 1634 |
|
1505 | 1635 |
AM->buchungsgruppe(\%myconfig, \%$form); |
1506 | 1636 |
|
1507 | 1637 |
$form->{callback} = "am.pl?action=list_buchungsgruppe"; |
1508 | 1638 |
|
1509 |
$callback = $form->escape($form->{callback}); |
|
1639 |
my $callback = $form->escape($form->{callback});
|
|
1510 | 1640 |
|
1511 | 1641 |
$form->{title} = $locale->text('Buchungsgruppen'); |
1512 | 1642 |
|
1513 |
@column_index = qw(up down description inventory_accno |
|
1643 |
my @column_index = qw(up down description inventory_accno
|
|
1514 | 1644 |
income_accno_0 expense_accno_0 |
1515 | 1645 |
income_accno_1 expense_accno_1 |
1516 | 1646 |
income_accno_2 expense_accno_2 |
1517 | 1647 |
income_accno_3 expense_accno_3 ); |
1518 |
|
|
1648 |
my %column_header; |
|
1519 | 1649 |
$column_header{up} = |
1520 | 1650 |
qq|<th class="listheading" width="16">| |
1521 | 1651 |
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| |
... | ... | |
1589 | 1719 |
my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|; |
1590 | 1720 |
|
1591 | 1721 |
my $row = 0; |
1592 |
foreach $ref (@{ $form->{ALL} }) { |
|
1722 |
my ($i, %column_data); |
|
1723 |
foreach my $ref (@{ $form->{ALL} }) { |
|
1593 | 1724 |
|
1594 | 1725 |
$i++; |
1595 | 1726 |
$i %= 2; |
... | ... | |
1669 | 1800 |
</html> |
1670 | 1801 |
|; |
1671 | 1802 |
|
1672 |
$lxdebug->leave_sub(); |
|
1803 |
$main::lxdebug->leave_sub();
|
|
1673 | 1804 |
} |
1674 | 1805 |
|
1675 | 1806 |
sub buchungsgruppe_header { |
1676 |
$lxdebug->enter_sub(); |
|
1807 |
$main::lxdebug->enter_sub();
|
|
1677 | 1808 |
|
1678 |
$auth->assert('config'); |
|
1809 |
my $form = $main::form; |
|
1810 |
my $locale = $main::locale; |
|
1811 |
|
|
1812 |
$main::auth->assert('config'); |
|
1679 | 1813 |
|
1680 | 1814 |
$form->{title} = $locale->text("$form->{title} Buchungsgruppe"); |
1681 | 1815 |
|
... | ... | |
1691 | 1825 |
"IC_cogs" => $acc_expense, |
1692 | 1826 |
); |
1693 | 1827 |
|
1694 |
foreach $key (keys(%acc_type_map)) { |
|
1695 |
foreach $ref (@{ $form->{IC_links}{$key} }) { |
|
1828 |
foreach my $key (keys(%acc_type_map)) {
|
|
1829 |
foreach my $ref (@{ $form->{IC_links}{$key} }) {
|
|
1696 | 1830 |
$acc_type_map{$key}->{$ref->{"id"}} = $ref; |
1697 | 1831 |
} |
1698 | 1832 |
} |
... | ... | |
1715 | 1849 |
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/ value=$form->{expense_accno_id_0} selected/; |
1716 | 1850 |
} |
1717 | 1851 |
|
1718 |
if (!$eur) { |
|
1852 |
my $linkaccounts; |
|
1853 |
if (!$main::eur) { |
|
1719 | 1854 |
$linkaccounts = qq| |
1720 | 1855 |
<tr> |
1721 | 1856 |
<th align=right>| . $locale->text('Inventory') . qq|</th> |
... | ... | |
1811 | 1946 |
</table> |
1812 | 1947 |
|; |
1813 | 1948 |
|
1814 |
$lxdebug->leave_sub(); |
|
1949 |
$main::lxdebug->leave_sub();
|
|
1815 | 1950 |
} |
1816 | 1951 |
|
1817 | 1952 |
sub save_buchungsgruppe { |
1818 |
$lxdebug->enter_sub(); |
|
1953 |
$main::lxdebug->enter_sub(); |
|
1954 |
|
|
1955 |
my $form = $main::form; |
|
1956 |
my %myconfig = %main::myconfig; |
|
1957 |
my $locale = $main::locale; |
|
1819 | 1958 |
|
1820 |
$auth->assert('config'); |
|
1959 |
$main::auth->assert('config');
|
|
1821 | 1960 |
|
1822 | 1961 |
$form->isblank("description", $locale->text('Description missing!')); |
1823 | 1962 |
|
1824 | 1963 |
AM->save_buchungsgruppe(\%myconfig, \%$form); |
1825 | 1964 |
$form->redirect($locale->text('Accounting Group saved!')); |
1826 | 1965 |
|
1827 |
$lxdebug->leave_sub(); |
|
1966 |
$main::lxdebug->leave_sub();
|
|
1828 | 1967 |
} |
1829 | 1968 |
|
1830 | 1969 |
sub delete_buchungsgruppe { |
1831 |
$lxdebug->enter_sub(); |
|
1970 |
$main::lxdebug->enter_sub(); |
|
1971 |
|
|
1972 |
my $form = $main::form; |
|
1973 |
my %myconfig = %main::myconfig; |
|
1974 |
my $locale = $main::locale; |
|
1832 | 1975 |
|
1833 |
$auth->assert('config'); |
|
1976 |
$main::auth->assert('config');
|
|
1834 | 1977 |
|
1835 | 1978 |
AM->delete_buchungsgruppe(\%myconfig, \%$form); |
1836 | 1979 |
$form->redirect($locale->text('Accounting Group deleted!')); |
1837 | 1980 |
|
1838 |
$lxdebug->leave_sub(); |
|
1981 |
$main::lxdebug->leave_sub();
|
|
1839 | 1982 |
} |
1840 | 1983 |
|
1841 | 1984 |
sub swap_buchungsgruppen { |
1842 |
$lxdebug->enter_sub(); |
|
1985 |
$main::lxdebug->enter_sub();
|
|
1843 | 1986 |
|
1844 |
$auth->assert('config'); |
|
1987 |
my $form = $main::form; |
|
1988 |
my %myconfig = %main::myconfig; |
|
1989 |
|
|
1990 |
$main::auth->assert('config'); |
|
1845 | 1991 |
|
1846 | 1992 |
AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen"); |
1847 | 1993 |
list_buchungsgruppe(); |
1848 | 1994 |
|
1849 |
$lxdebug->leave_sub(); |
|
1995 |
$main::lxdebug->leave_sub();
|
|
1850 | 1996 |
} |
1851 | 1997 |
|
1852 | 1998 |
|
1853 | 1999 |
sub add_printer { |
1854 |
$lxdebug->enter_sub(); |
|
2000 |
$main::lxdebug->enter_sub(); |
|
2001 |
|
|
2002 |
my $form = $main::form; |
|
1855 | 2003 |
|
1856 |
$auth->assert('config'); |
|
2004 |
$main::auth->assert('config');
|
|
1857 | 2005 |
|
1858 | 2006 |
$form->{title} = "Add"; |
1859 | 2007 |
|
... | ... | |
1862 | 2010 |
&printer_header; |
1863 | 2011 |
&form_footer; |
1864 | 2012 |
|
1865 |
$lxdebug->leave_sub(); |
|
2013 |
$main::lxdebug->leave_sub();
|
|
1866 | 2014 |
} |
1867 | 2015 |
|
1868 | 2016 |
sub edit_printer { |
1869 |
$lxdebug->enter_sub(); |
|
2017 |
$main::lxdebug->enter_sub(); |
|
2018 |
|
|
2019 |
my $form = $main::form; |
|
2020 |
my %myconfig = %main::myconfig; |
|
1870 | 2021 |
|
1871 |
$auth->assert('config'); |
|
2022 |
$main::auth->assert('config');
|
|
1872 | 2023 |
|
1873 | 2024 |
$form->{title} = "Edit"; |
1874 | 2025 |
|
... | ... | |
1879 | 2030 |
$form->{orphaned} = 1; |
1880 | 2031 |
&form_footer; |
1881 | 2032 |
|
1882 |
$lxdebug->leave_sub(); |
|
2033 |
$main::lxdebug->leave_sub();
|
|
1883 | 2034 |
} |
1884 | 2035 |
|
1885 | 2036 |
sub list_printer { |
1886 |
$lxdebug->enter_sub(); |
|
2037 |
$main::lxdebug->enter_sub();
|
|
1887 | 2038 |
|
1888 |
$auth->assert('config'); |
|
2039 |
my $form = $main::form; |
|
2040 |
my %myconfig = %main::myconfig; |
|
2041 |
my $locale = $main::locale; |
|
2042 |
|
|
2043 |
$main::auth->assert('config'); |
|
1889 | 2044 |
|
1890 | 2045 |
AM->printer(\%myconfig, \%$form); |
1891 | 2046 |
|
1892 | 2047 |
$form->{callback} = "am.pl?action=list_printer"; |
1893 | 2048 |
|
1894 |
$callback = $form->escape($form->{callback}); |
|
2049 |
my $callback = $form->escape($form->{callback});
|
|
1895 | 2050 |
|
1896 | 2051 |
$form->{title} = $locale->text('Printer'); |
1897 | 2052 |
|
1898 |
@column_index = qw(printer_description printer_command template_code); |
|
1899 |
|
|
2053 |
my @column_index = qw(printer_description printer_command template_code);
|
|
2054 |
my %column_header; |
|
1900 | 2055 |
$column_header{printer_description} = |
1901 | 2056 |
qq|<th class=listheading width=60%>| |
1902 | 2057 |
. $locale->text('Printer Description') |
... | ... | |
1932 | 2087 |
</tr> |
1933 | 2088 |
|; |
1934 | 2089 |
|
1935 |
foreach $ref (@{ $form->{ALL} }) { |
|
2090 |
my ($i, %column_data); |
|
2091 |
foreach my $ref (@{ $form->{ALL} }) { |
|
1936 | 2092 |
|
1937 | 2093 |
$i++; |
1938 | 2094 |
$i %= 2; |
... | ... | |
1979 | 2135 |
</html> |
1980 | 2136 |
|; |
1981 | 2137 |
|
1982 |
$lxdebug->leave_sub(); |
|
2138 |
$main::lxdebug->leave_sub();
|
|
1983 | 2139 |
} |
1984 | 2140 |
|
1985 | 2141 |
sub printer_header { |
1986 |
$lxdebug->enter_sub(); |
|
2142 |
$main::lxdebug->enter_sub();
|
|
1987 | 2143 |
|
1988 |
$auth->assert('config'); |
|
2144 |
my $form = $main::form; |
|
2145 |
my $locale = $main::locale; |
|
2146 |
|
|
2147 |
$main::auth->assert('config'); |
|
1989 | 2148 |
|
1990 | 2149 |
$form->{title} = $locale->text("$form->{title} Printer"); |
1991 | 2150 |
|
... | ... | |
2029 | 2188 |
</table> |
2030 | 2189 |
|; |
2031 | 2190 |
|
2032 |
$lxdebug->leave_sub(); |
|
2191 |
$main::lxdebug->leave_sub();
|
|
2033 | 2192 |
} |
2034 | 2193 |
|
2035 | 2194 |
sub save_printer { |
2036 |
$lxdebug->enter_sub(); |
|
2195 |
$main::lxdebug->enter_sub(); |
|
2196 |
|
|
2197 |
my $form = $main::form; |
|
2198 |
my %myconfig = %main::myconfig; |
|
2199 |
my $locale = $main::locale; |
|
2037 | 2200 |
|
2038 |
$auth->assert('config'); |
|
2201 |
$main::auth->assert('config');
|
|
2039 | 2202 |
|
2040 | 2203 |
$form->isblank("printer_description", $locale->text('Description missing!')); |
2041 | 2204 |
$form->isblank("printer_command", $locale->text('Printer Command missing!')); |
2042 | 2205 |
AM->save_printer(\%myconfig, \%$form); |
2043 | 2206 |
$form->redirect($locale->text('Printer saved!')); |
2044 | 2207 |
|
2045 |
$lxdebug->leave_sub(); |
|
2208 |
$main::lxdebug->leave_sub();
|
|
2046 | 2209 |
} |
2047 | 2210 |
|
2048 | 2211 |
sub delete_printer { |
2049 |
$lxdebug->enter_sub(); |
|
2212 |
$main::lxdebug->enter_sub();
|
|
2050 | 2213 |
|
2051 |
$auth->assert('config'); |
|
2214 |
my $form = $main::form; |
|
2215 |
my %myconfig = %main::myconfig; |
|
2216 |
my $locale = $main::locale; |
|
2217 |
|
|
2218 |
$main::auth->assert('config'); |
|
2052 | 2219 |
|
2053 | 2220 |
AM->delete_printer(\%myconfig, \%$form); |
2054 | 2221 |
$form->redirect($locale->text('Printer deleted!')); |
2055 | 2222 |
|
2056 |
$lxdebug->leave_sub(); |
|
2223 |
$main::lxdebug->leave_sub();
|
|
2057 | 2224 |
} |
2058 | 2225 |
|
2059 | 2226 |
sub add_payment { |
2060 |
$lxdebug->enter_sub(); |
|
2227 |
$main::lxdebug->enter_sub(); |
|
2228 |
|
|
2229 |
my $form = $main::form; |
|
2230 |
my %myconfig = %main::myconfig; |
|
2061 | 2231 |
|
2062 |
$auth->assert('config'); |
|
2232 |
$main::auth->assert('config');
|
|
2063 | 2233 |
|
2064 | 2234 |
$form->{title} = "Add"; |
2065 | 2235 |
|
... | ... | |
2075 | 2245 |
&payment_header; |
2076 | 2246 |
&form_footer; |
2077 | 2247 |
|
2078 |
$lxdebug->leave_sub(); |
|
2248 |
$main::lxdebug->leave_sub();
|
|
2079 | 2249 |
} |
2080 | 2250 |
|
2081 | 2251 |
sub edit_payment { |
2082 |
$lxdebug->enter_sub(); |
|
2252 |
$main::lxdebug->enter_sub(); |
|
2253 |
|
|
2254 |
my $form = $main::form; |
|
2255 |
my %myconfig = %main::myconfig; |
|
2083 | 2256 |
|
2084 |
$auth->assert('config'); |
|
2257 |
$main::auth->assert('config');
|
|
2085 | 2258 |
|
2086 | 2259 |
$form->{title} = "Edit"; |
2087 | 2260 |
|
... | ... | |
2094 | 2267 |
$form->{orphaned} = 1; |
2095 | 2268 |
&form_footer; |
2096 | 2269 |
|
2097 |
$lxdebug->leave_sub(); |
|
2270 |
$main::lxdebug->leave_sub();
|
|
2098 | 2271 |
} |
2099 | 2272 |
|
2100 | 2273 |
sub list_payment { |
2101 |
$lxdebug->enter_sub(); |
|
2274 |
$main::lxdebug->enter_sub();
|
|
2102 | 2275 |
|
2103 |
$auth->assert('config'); |
|
2276 |
my $form = $main::form; |
|
2277 |
my %myconfig = %main::myconfig; |
|
2278 |
my $locale = $main::locale; |
|
2279 |
|
|
2280 |
$main::auth->assert('config'); |
|
2104 | 2281 |
|
2105 | 2282 |
AM->payment(\%myconfig, \%$form); |
2106 | 2283 |
|
2107 | 2284 |
$form->{callback} = build_std_url("action=list_payment"); |
2108 | 2285 |
|
2109 |
$callback = $form->escape($form->{callback}); |
|
2286 |
my $callback = $form->escape($form->{callback});
|
|
2110 | 2287 |
|
2111 | 2288 |
$form->{title} = $locale->text('Payment Terms'); |
2112 | 2289 |
|
2113 |
@column_index = qw(up down description description_long terms_netto |
|
2290 |
my @column_index = qw(up down description description_long terms_netto
|
|
2114 | 2291 |
terms_skonto percent_skonto); |
2115 |
|
|
2292 |
my %column_header; |
|
2116 | 2293 |
$column_header{up} = |
2117 | 2294 |
qq|<th class="listheading" align="center" valign="center" width="16">| |
2118 | 2295 |
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| |
... | ... | |
2167 | 2344 |
my $swap_link = build_std_url("action=swap_payment_terms"); |
2168 | 2345 |
|
2169 | 2346 |
my $row = 0; |
2170 |
foreach $ref (@{ $form->{ALL} }) { |
|
2347 |
my ($i, %column_data); |
|
2348 |
foreach my $ref (@{ $form->{ALL} }) { |
|
2171 | 2349 |
|
2172 | 2350 |
$i++; |
2173 | 2351 |
$i %= 2; |
... | ... | |
2245 | 2423 |
</html> |
2246 | 2424 |
|; |
2247 | 2425 |
|
2248 |
$lxdebug->leave_sub(); |
|
2426 |
$main::lxdebug->leave_sub();
|
|
2249 | 2427 |
} |
2250 | 2428 |
|
2251 | 2429 |
sub payment_header { |
2252 |
$lxdebug->enter_sub(); |
|
2430 |
$main::lxdebug->enter_sub(); |
|
2431 |
|
|
2432 |
my $form = $main::form; |
|
2433 |
my $locale = $main::locale; |
|
2253 | 2434 |
|
2254 |
$auth->assert('config'); |
|
2435 |
$main::auth->assert('config');
|
|
2255 | 2436 |
|
2256 | 2437 |
$form->{title} = $locale->text("$form->{title} Payment Terms"); |
2257 | 2438 |
|
... | ... | |
2353 | 2534 |
. qq|</li> |
2354 | 2535 |
</ul>|; |
2355 | 2536 |
|
2356 |
$lxdebug->leave_sub(); |
|
2537 |
$main::lxdebug->leave_sub();
|
|
2357 | 2538 |
} |
2358 | 2539 |
|
2359 | 2540 |
sub save_payment { |
2360 |
$lxdebug->enter_sub(); |
|
2541 |
$main::lxdebug->enter_sub();
|
|
2361 | 2542 |
|
2362 |
$auth->assert('config'); |
|
2543 |
my $form = $main::form; |
|
2544 |
my %myconfig = %main::myconfig; |
|
2545 |
my $locale = $main::locale; |
|
2546 |
|
|
2547 |
$main::auth->assert('config'); |
|
2363 | 2548 |
|
2364 | 2549 |
$form->isblank("description", $locale->text('Description missing!')); |
2365 | 2550 |
$form->{"percent_skonto"} = |
... | ... | |
2367 | 2552 |
AM->save_payment(\%myconfig, \%$form); |
2368 | 2553 |
$form->redirect($locale->text('Payment Terms saved!')); |
2369 | 2554 |
|
2370 |
$lxdebug->leave_sub(); |
|
2555 |
$main::lxdebug->leave_sub();
|
|
2371 | 2556 |
} |
2372 | 2557 |
|
2373 | 2558 |
sub delete_payment { |
2374 |
$lxdebug->enter_sub(); |
|
2559 |
$main::lxdebug->enter_sub(); |
|
2560 |
|
|
2561 |
my $form = $main::form; |
|
2562 |
my %myconfig = %main::myconfig; |
|
2563 |
my $locale = $main::locale; |
|
2375 | 2564 |
|
2376 |
$auth->assert('config'); |
|
2565 |
$main::auth->assert('config');
|
|
2377 | 2566 |
|
2378 | 2567 |
AM->delete_payment(\%myconfig, \%$form); |
2379 | 2568 |
$form->redirect($locale->text('Payment terms deleted!')); |
2380 | 2569 |
|
2381 |
$lxdebug->leave_sub(); |
|
2570 |
$main::lxdebug->leave_sub();
|
|
2382 | 2571 |
} |
2383 | 2572 |
|
2384 | 2573 |
sub swap_payment_terms { |
2385 |
$lxdebug->enter_sub(); |
|
2574 |
$main::lxdebug->enter_sub(); |
|
2575 |
|
|
2576 |
my $form = $main::form; |
|
2577 |
my %myconfig = %main::myconfig; |
|
2386 | 2578 |
|
2387 |
$auth->assert('config'); |
|
2579 |
$main::auth->assert('config');
|
|
2388 | 2580 |
|
2389 | 2581 |
AM->swap_sortkeys(\%myconfig, $form, "payment_terms"); |
2390 | 2582 |
list_payment(); |
2391 | 2583 |
|
2392 |
$lxdebug->leave_sub(); |
|
2584 |
$main::lxdebug->leave_sub();
|
|
2393 | 2585 |
} |
2394 | 2586 |
|
2395 | 2587 |
sub edit_defaults { |
2396 |
$lxdebug->enter_sub(); |
|
2588 |
$main::lxdebug->enter_sub(); |
Auch abrufbar als: Unified diff
am strict