Revision da311bca
Von Sven Schöling vor fast 13 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
847 | 847 |
} |
848 | 848 |
|
849 | 849 |
sub buchungsgruppe_header { |
850 |
$main::lxdebug->enter_sub(); |
|
851 |
|
|
852 |
my $form = $main::form; |
|
853 |
my $locale = $main::locale; |
|
854 |
|
|
855 |
$main::auth->assert('config'); |
|
856 |
|
|
857 |
$form->{title} = $locale->text("$form->{title} Buchungsgruppe"); |
|
850 |
$::lxdebug->enter_sub; |
|
851 |
$::auth->assert('config'); |
|
858 | 852 |
|
859 | 853 |
# $locale->text('Add Accounting Group') |
860 | 854 |
# $locale->text('Edit Accounting Group') |
855 |
$::form->{title} = $::locale->text("$::form->{title} Buchungsgruppe"); |
|
861 | 856 |
|
862 | 857 |
my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); |
863 | 858 |
my %acc_type_map = ( |
864 |
"IC" => $acc_inventory,
|
|
865 |
"IC_income" => $acc_income,
|
|
866 |
"IC_sale" => $acc_income,
|
|
867 |
"IC_expense" => $acc_expense,
|
|
868 |
"IC_cogs" => $acc_expense,
|
|
869 |
);
|
|
859 |
IC => $acc_inventory,
|
|
860 |
IC_income => $acc_income,
|
|
861 |
IC_sale => $acc_income,
|
|
862 |
IC_expense => $acc_expense,
|
|
863 |
IC_cogs => $acc_expense,
|
|
864 |
); |
|
870 | 865 |
|
871 |
foreach my $key (keys(%acc_type_map)) {
|
|
872 |
foreach my $ref (@{ $form->{IC_links}{$key} }) {
|
|
873 |
$acc_type_map{$key}->{$ref->{"id"}} = $ref;
|
|
866 |
for my $key (keys %acc_type_map) {
|
|
867 |
for my $ref (@{ $::form->{IC_links}{$key} }) {
|
|
868 |
$acc_type_map{$key}{$ref->{id}} = $ref;
|
|
874 | 869 |
} |
875 | 870 |
} |
876 | 871 |
|
877 |
foreach my $type (qw(IC IC_income IC_expense)) { |
|
878 |
$form->{"select$type"} = |
|
879 |
join("", |
|
880 |
map({ "<option value=$_->{id} $_->{selected}>" . |
|
881 |
"$_->{accno}--" . H($_->{description}) . "</option>" } |
|
882 |
sort({ $a->{"accno"} cmp $b->{"accno"} } |
|
883 |
values(%{$acc_type_map{$type}})))); |
|
884 |
} |
|
885 |
|
|
886 |
if ($form->{id}) { |
|
887 |
$form->{selectIC} =~ s/selected//g; |
|
888 |
$form->{selectIC} =~ s/ value=\Q$form->{inventory_accno_id}\E/ value=$form->{inventory_accno_id} selected/; |
|
889 |
$form->{selectIC_income} =~ s/selected//g; |
|
890 |
$form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_0}\E/ value=$form->{income_accno_id_0} selected/; |
|
891 |
$form->{selectIC_expense} =~ s/selected//g; |
|
892 |
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/ value=$form->{expense_accno_id_0} selected/; |
|
893 |
} |
|
894 |
|
|
895 |
my $linkaccounts; |
|
896 |
if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) { } |
|
897 |
$linkaccounts = qq| |
|
898 |
<tr> |
|
899 |
<th align=right>| . $locale->text('Inventory') . qq|</th> |
|
900 |
<td><select name=inventory_accno_id>$form->{selectIC}</select></td> |
|
901 |
<input name=selectIC type=hidden value="$form->{selectIC}"> |
|
902 |
</tr>|; |
|
903 |
} elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) { |
|
904 |
# don't allow choice of inventory accno and don't show that line |
|
905 |
$linkaccounts = qq| |
|
906 |
<input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|; |
|
907 |
}; |
|
908 |
|
|
909 |
|
|
910 |
$linkaccounts .= qq| |
|
911 |
<tr> |
|
912 |
<th align=right>| . $locale->text('National Revenues') . qq|</th> |
|
913 |
<td><select name=income_accno_id_0>$form->{selectIC_income}</select></td> |
|
914 |
</tr> |
|
915 |
<tr> |
|
916 |
<th align=right>| . $locale->text('National Expenses') . qq|</th> |
|
917 |
<td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td> |
|
918 |
</tr>|; |
|
919 |
if ($form->{id}) { |
|
920 |
$form->{selectIC_income} =~ s/selected//g; |
|
921 |
$form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_1}\E/ value=$form->{income_accno_id_1} selected/; |
|
922 |
$form->{selectIC_expense} =~ s/selected//g; |
|
923 |
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_1}\E/ value=$form->{expense_accno_id_1} selected/; |
|
924 |
} |
|
925 |
$linkaccounts .= qq| <tr> |
|
926 |
<th align=right>| . $locale->text('Revenues EU with UStId') . qq|</th> |
|
927 |
<td><select name=income_accno_id_1>$form->{selectIC_income}</select></td> |
|
928 |
</tr> |
|
929 |
<tr> |
|
930 |
<th align=right>| . $locale->text('Expenses EU with UStId') . qq|</th> |
|
931 |
<td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td> |
|
932 |
</tr>|; |
|
933 |
|
|
934 |
if ($form->{id}) { |
|
935 |
$form->{selectIC_income} =~ s/selected//g; |
|
936 |
$form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_2}\E/ value=$form->{income_accno_id_2} selected/; |
|
937 |
$form->{selectIC_expense} =~ s/selected//g; |
|
938 |
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_2}\E/ value=$form->{expense_accno_id_2} selected/; |
|
939 |
} |
|
940 |
|
|
941 |
$linkaccounts .= qq| <tr> |
|
942 |
<th align=right>| . $locale->text('Revenues EU without UStId') . qq|</th> |
|
943 |
<td><select name=income_accno_id_2>$form->{selectIC_income}</select></td> |
|
944 |
</tr> |
|
945 |
<tr> |
|
946 |
<th align=right>| . $locale->text('Expenses EU without UStId') . qq|</th> |
|
947 |
<td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td> |
|
948 |
</tr>|; |
|
949 |
|
|
950 |
if ($form->{id}) { |
|
951 |
$form->{selectIC_income} =~ s/selected//g; |
|
952 |
$form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_3}\E/ value=$form->{income_accno_id_3} selected/; |
|
953 |
$form->{selectIC_expense} =~ s/selected//g; |
|
954 |
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_3}\E/ value=$form->{expense_accno_id_3} selected/; |
|
955 |
} |
|
956 |
|
|
957 |
$linkaccounts .= qq| <tr> |
|
958 |
<th align=right>| . $locale->text('Foreign Revenues') . qq|</th> |
|
959 |
<td><select name=income_accno_id_3>$form->{selectIC_income}</select></td> |
|
960 |
</tr> |
|
961 |
<tr> |
|
962 |
<th align=right>| . $locale->text('Foreign Expenses') . qq|</th> |
|
963 |
<td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td> |
|
964 |
</tr> |
|
965 |
|; |
|
966 |
|
|
967 |
|
|
968 |
$form->header; |
|
969 |
|
|
970 |
print qq| |
|
971 |
<body> |
|
972 |
|
|
973 |
<form method=post action=am.pl> |
|
872 |
my %sorted_accounts = map { |
|
873 |
$_ => [ sort { $a->{accno} cmp $b->{accno} } values %{ $acc_type_map{$_} } ], |
|
874 |
} keys %acc_type_map; |
|
974 | 875 |
|
975 |
<input type=hidden name=id value=$form->{id}> |
|
976 |
<input type=hidden name=type value=buchungsgruppe> |
|
977 |
|
|
978 |
<table width=100%> |
|
979 |
<tr> |
|
980 |
<th class=listtop colspan=2>$form->{title}</th> |
|
981 |
</tr> |
|
982 |
<tr height="5"></tr> |
|
983 |
<tr> |
|
984 |
<th align=right>| . $locale->text('Buchungsgruppe') . qq|</th> |
|
985 |
<td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td> |
|
986 |
<tr> |
|
987 |
$linkaccounts |
|
988 |
<td colspan=2><hr size=3 noshade></td> |
|
989 |
</tr> |
|
990 |
</table> |
|
991 |
|; |
|
876 |
$::form->header; |
|
877 |
print $::form->parse_html_template('am/buchungsgruppe_header', { |
|
878 |
accounts => \%sorted_accounts, |
|
879 |
account_label => sub { "$_[0]{accno}--$_[0]{description}" }, |
|
880 |
}); |
|
992 | 881 |
|
993 |
$main::lxdebug->leave_sub();
|
|
882 |
$::lxdebug->leave_sub;
|
|
994 | 883 |
} |
995 | 884 |
|
996 | 885 |
sub save_buchungsgruppe { |
Auch abrufbar als: Unified diff
am/buchungsgruppen_header auf template umgeschrieben