562 |
562 |
|
563 |
563 |
# return unless (-f $filename);
|
564 |
564 |
|
565 |
|
local *FH;
|
566 |
|
|
567 |
|
open(FH, "$filename") or $form->error("$filename : $!\n");
|
|
565 |
open my $FH, "<", "$filename" or $form->error("$filename : $!\n");
|
568 |
566 |
my $query = "";
|
569 |
567 |
my $sth;
|
570 |
568 |
my @quote_chars;
|
571 |
569 |
|
572 |
|
while (<FH>) {
|
|
570 |
while (<$FH>) {
|
573 |
571 |
|
574 |
572 |
# Remove DOS and Unix style line endings.
|
575 |
573 |
s/[\r\n]//g;
|
... | ... | |
608 |
606 |
}
|
609 |
607 |
}
|
610 |
608 |
|
611 |
|
close FH;
|
|
609 |
close $FH;
|
612 |
610 |
|
613 |
611 |
$main::lxdebug->leave_sub();
|
614 |
612 |
}
|
... | ... | |
753 |
751 |
|
754 |
752 |
my ($dbh, $last_period, $fromdate, $todate, $form, $category) = @_;
|
755 |
753 |
|
756 |
|
my ($null, $department_id) = split /--/, $form->{department};
|
757 |
|
|
758 |
754 |
my $query;
|
759 |
|
my $dpt_where;
|
760 |
|
my $dpt_join;
|
761 |
|
my $project;
|
762 |
755 |
my $where = "";
|
763 |
756 |
my $glwhere = "";
|
764 |
757 |
my $subwhere = "";
|
... | ... | |
784 |
777 |
$ARwhere .= " AND acc.transdate <= '$todate'";
|
785 |
778 |
}
|
786 |
779 |
|
787 |
|
if ($department_id) {
|
788 |
|
$dpt_join = qq|
|
789 |
|
JOIN department t ON (a.department_id = t.id)
|
790 |
|
|;
|
791 |
|
$dpt_where = qq|
|
792 |
|
AND t.id = $department_id
|
793 |
|
|;
|
794 |
|
}
|
795 |
|
|
796 |
|
if ($form->{project_id}) {
|
797 |
|
$project = qq|
|
798 |
|
AND ac.project_id = $form->{project_id}
|
799 |
|
|;
|
800 |
|
}
|
801 |
780 |
############################################
|
802 |
781 |
# Method eq 'cash' = IST Versteuerung
|
803 |
782 |
############################################
|
... | ... | |
856 |
835 |
# Method eq 'accrual' = Soll Versteuerung
|
857 |
836 |
#########################################
|
858 |
837 |
|
859 |
|
if ($department_id) {
|
860 |
|
$dpt_join = qq|
|
861 |
|
JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
|
862 |
|
|;
|
863 |
|
$dpt_where = qq|
|
864 |
|
AND t.department_id = $department_id
|
865 |
|
|;
|
866 |
|
}
|
867 |
|
|
868 |
|
|
869 |
838 |
$query = qq|
|
870 |
839 |
-- Alle Einnahmen AR und pos_ustva erfassen
|
871 |
840 |
SELECT
|
... | ... | |
885 |
854 |
$dpt_join
|
886 |
855 |
WHERE 1 = 1
|
887 |
856 |
$where
|
888 |
|
$dpt_where
|
889 |
|
$project
|
890 |
857 |
GROUP BY tk.pos_ustva
|
891 |
858 |
|;
|
892 |
859 |
|
... | ... | |
922 |
889 |
WHERE
|
923 |
890 |
1=1
|
924 |
891 |
$where
|
925 |
|
$dpt_where
|
926 |
|
$project
|
927 |
892 |
GROUP BY tk.pos_ustva
|
928 |
893 |
|
929 |
894 |
UNION -- Einnahmen direkter gl Buchungen erfassen
|
... | ... | |
947 |
912 |
$dpt_join
|
948 |
913 |
WHERE 1 = 1
|
949 |
914 |
$where
|
950 |
|
$dpt_where
|
951 |
|
$project
|
952 |
915 |
GROUP BY tk.pos_ustva
|
953 |
916 |
|
954 |
917 |
|
... | ... | |
973 |
936 |
$dpt_join
|
974 |
937 |
WHERE 1 = 1
|
975 |
938 |
$where
|
976 |
|
$dpt_where
|
977 |
|
$project
|
978 |
939 |
GROUP BY tk.pos_ustva
|
979 |
940 |
|
980 |
941 |
|;
|
... | ... | |
991 |
952 |
|
992 |
953 |
$sth->execute || $form->dberror($query);
|
993 |
954 |
|
994 |
|
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
955 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
995 |
956 |
# Bug 365 solved?!
|
996 |
957 |
$ref->{amount} *= -1;
|
997 |
|
if ($category eq "pos_bwa") {
|
998 |
|
if ($last_period) {
|
999 |
|
$form->{ $ref->{$category} }{kumm} += $ref->{amount};
|
1000 |
|
} else {
|
1001 |
|
$form->{ $ref->{$category} }{jetzt} += $ref->{amount};
|
1002 |
|
}
|
1003 |
|
} else {
|
1004 |
|
$form->{ $ref->{$category} } += $ref->{amount};
|
1005 |
|
}
|
|
958 |
$form->{ $ref->{$category} } += $ref->{amount};
|
1006 |
959 |
}
|
1007 |
960 |
|
1008 |
961 |
$sth->finish;
|
... | ... | |
1014 |
967 |
sub get_config {
|
1015 |
968 |
$main::lxdebug->enter_sub();
|
1016 |
969 |
|
1017 |
|
my ($self, $userpath, $filename) = @_;
|
|
970 |
my ($self, $userspath, $filename) = @_;
|
1018 |
971 |
|
1019 |
|
local (*FACONF, *FANEW);
|
|
972 |
$form->error("Missing Parameter: @_") if !$userspath || !$filename;
|
1020 |
973 |
|
1021 |
974 |
my $form = $main::form;
|
1022 |
975 |
|
1023 |
976 |
$filename = "$form->{login}_$filename";
|
1024 |
977 |
$filename =~ s|.*/||;
|
1025 |
978 |
$filename = "$userspath/$filename";
|
|
979 |
open my $FACONF, "<", $filename or sub {# Annon Sub
|
|
980 |
# catch open error
|
|
981 |
# create file if file does not exist
|
|
982 |
open my $FANEW, ">", $filename or $form->error("CREATE: $filename : $!");
|
|
983 |
close $FANEW or $form->error("CLOSE: $filename : $!");
|
|
984 |
|
|
985 |
#try again open file
|
|
986 |
open my $FACONF, "<", $filename or $form->error("OPEN: $filename : $!");
|
|
987 |
};
|
1026 |
988 |
|
1027 |
|
if (!open(FACONF, "<", $filename)) {
|
1028 |
|
open(FANEW, ">", $filename) || $form->error("$filename : $!");
|
1029 |
|
close(FANEW);
|
1030 |
|
open(FACONF, "<", $filename) || $form->error("$filename : $!");
|
1031 |
|
}
|
1032 |
|
|
1033 |
|
while (<FACONF>) {
|
|
989 |
while (<$FACONF>) {
|
1034 |
990 |
last if (/^\[/);
|
1035 |
991 |
next if (/^(\#|\s)/);
|
1036 |
992 |
|
... | ... | |
1045 |
1001 |
|
1046 |
1002 |
}
|
1047 |
1003 |
|
1048 |
|
close(FACONF);
|
|
1004 |
close $FACONF;
|
1049 |
1005 |
|
1050 |
1006 |
$main::lxdebug->leave_sub();
|
1051 |
1007 |
}
|
open, print, close: Lokale Namensraeume (aus r2391, r2393) auf private eingeschraenkt, weitere PerlBestPractices Aenderungen.
$category, $dpt_*, $project* Variablen entfernt, Weil USTVA nie Abteilungsweit, Projektweit oder bez. BWA anders dargestellt wird.
BWA wird geregelt duch get_accounts_g.