Revision f5c454e3
Von Niclas Zimmermann vor mehr als 10 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
790 | 790 |
$main::lxdebug->leave_sub(); |
791 | 791 |
} |
792 | 792 |
|
793 |
|
|
794 |
sub add_buchungsgruppe { |
|
795 |
$main::lxdebug->enter_sub(); |
|
796 |
|
|
797 |
my $form = $main::form; |
|
798 |
my %myconfig = %main::myconfig; |
|
799 |
my $locale = $main::locale; |
|
800 |
|
|
801 |
$main::auth->assert('config'); |
|
802 |
|
|
803 |
# $locale->text("Add Buchungsgruppe") |
|
804 |
# $locale->text("Edit Buchungsgruppe") |
|
805 |
$form->{title} = "Add"; |
|
806 |
|
|
807 |
$form->{callback} = "am.pl?action=add_buchungsgruppe" unless $form->{callback}; |
|
808 |
|
|
809 |
AM->get_buchungsgruppe(\%myconfig, \%$form); |
|
810 |
$form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; |
|
811 |
for (my $i = 0; 4 > $i; $i++) { |
|
812 |
map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; } |
|
813 |
qw(income expense)); |
|
814 |
} |
|
815 |
|
|
816 |
&buchungsgruppe_header; |
|
817 |
&form_footer; |
|
818 |
|
|
819 |
$main::lxdebug->leave_sub(); |
|
820 |
} |
|
821 |
|
|
822 |
sub edit_buchungsgruppe { |
|
823 |
$main::lxdebug->enter_sub(); |
|
824 |
|
|
825 |
my $form = $main::form; |
|
826 |
my %myconfig = %main::myconfig; |
|
827 |
|
|
828 |
$main::auth->assert('config'); |
|
829 |
|
|
830 |
$form->{title} = "Edit"; |
|
831 |
|
|
832 |
AM->get_buchungsgruppe(\%myconfig, \%$form); |
|
833 |
|
|
834 |
&buchungsgruppe_header; |
|
835 |
|
|
836 |
&form_footer; |
|
837 |
|
|
838 |
$main::lxdebug->leave_sub(); |
|
839 |
} |
|
840 |
|
|
841 |
sub list_buchungsgruppe { |
|
842 |
$::lxdebug->enter_sub; |
|
843 |
$::auth->assert('config'); |
|
844 |
|
|
845 |
AM->buchungsgruppe(\%::myconfig, $::form); |
|
846 |
|
|
847 |
$::form->{callback} = "am.pl?action=list_buchungsgruppe"; |
|
848 |
$::form->{title} = $::locale->text('Buchungsgruppen'); |
|
849 |
$::form->header; |
|
850 |
|
|
851 |
print $::form->parse_html_template('am/buchungsgruppe_list', { |
|
852 |
swap_link => qq|am.pl?action=swap_buchungsgruppen&|, |
|
853 |
}); |
|
854 |
|
|
855 |
$::lxdebug->leave_sub; |
|
856 |
} |
|
857 |
|
|
858 |
sub buchungsgruppe_header { |
|
859 |
$::lxdebug->enter_sub; |
|
860 |
$::auth->assert('config'); |
|
861 |
|
|
862 |
# $locale->text('Add Accounting Group') |
|
863 |
# $locale->text('Edit Accounting Group') |
|
864 |
$::form->{title} = $::locale->text("$::form->{title} Buchungsgruppe"); |
|
865 |
|
|
866 |
my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); |
|
867 |
my %acc_type_map = ( |
|
868 |
IC => $acc_inventory, |
|
869 |
IC_income => $acc_income, |
|
870 |
IC_sale => $acc_income, |
|
871 |
IC_expense => $acc_expense, |
|
872 |
IC_cogs => $acc_expense, |
|
873 |
); |
|
874 |
|
|
875 |
for my $key (keys %acc_type_map) { |
|
876 |
for my $ref (@{ $::form->{IC_links}{$key} }) { |
|
877 |
$acc_type_map{$key}{$ref->{id}} = $ref; |
|
878 |
} |
|
879 |
} |
|
880 |
|
|
881 |
my %sorted_accounts = map { |
|
882 |
$_ => [ sort { $a->{accno} cmp $b->{accno} } values %{ $acc_type_map{$_} } ], |
|
883 |
} keys %acc_type_map; |
|
884 |
|
|
885 |
$::form->header; |
|
886 |
print $::form->parse_html_template('am/buchungsgruppe_header', { |
|
887 |
accounts => \%sorted_accounts, |
|
888 |
account_label => sub { "$_[0]{accno}--$_[0]{description}" }, |
|
889 |
}); |
|
890 |
|
|
891 |
$::lxdebug->leave_sub; |
|
892 |
} |
|
893 |
|
|
894 |
sub save_buchungsgruppe { |
|
895 |
$main::lxdebug->enter_sub(); |
|
896 |
|
|
897 |
my $form = $main::form; |
|
898 |
my %myconfig = %main::myconfig; |
|
899 |
my $locale = $main::locale; |
|
900 |
|
|
901 |
$main::auth->assert('config'); |
|
902 |
|
|
903 |
$form->isblank("description", $locale->text('Description missing!')); |
|
904 |
|
|
905 |
AM->save_buchungsgruppe(\%myconfig, \%$form); |
|
906 |
$form->redirect($locale->text('Accounting Group saved!')); |
|
907 |
|
|
908 |
$main::lxdebug->leave_sub(); |
|
909 |
} |
|
910 |
|
|
911 |
sub delete_buchungsgruppe { |
|
912 |
$main::lxdebug->enter_sub(); |
|
913 |
|
|
914 |
my $form = $main::form; |
|
915 |
my %myconfig = %main::myconfig; |
|
916 |
my $locale = $main::locale; |
|
917 |
|
|
918 |
$main::auth->assert('config'); |
|
919 |
|
|
920 |
AM->delete_buchungsgruppe(\%myconfig, \%$form); |
|
921 |
$form->redirect($locale->text('Accounting Group deleted!')); |
|
922 |
|
|
923 |
$main::lxdebug->leave_sub(); |
|
924 |
} |
|
925 |
|
|
926 |
sub swap_buchungsgruppen { |
|
927 |
$main::lxdebug->enter_sub(); |
|
928 |
|
|
929 |
my $form = $main::form; |
|
930 |
my %myconfig = %main::myconfig; |
|
931 |
|
|
932 |
$main::auth->assert('config'); |
|
933 |
|
|
934 |
AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen"); |
|
935 |
list_buchungsgruppe(); |
|
936 |
|
|
937 |
$main::lxdebug->leave_sub(); |
|
938 |
} |
|
939 |
|
|
940 | 793 |
sub _build_cfg_options { |
941 | 794 |
my $form = $main::form; |
942 | 795 |
my %myconfig = %main::myconfig; |
Auch abrufbar als: Unified diff
Steuerzonen und Buchungsgruppen bearbeiten
Nachdem man Steuerzonen und Buchungsgruppen auf Datenbankebene
bearbeiten kann, ist jetzt auch eine Bearbeitung an der Ober-
fläche möglich.
Alter Code, der für die Anzeige/Bearbeitung/Erstellung von
Buchungsgruppen entwickelt wurde hat nicht mehr funktioniert
und wurde vollständig ersetzt.