Revision c2ed42c3
Von Udo Spallek vor fast 19 Jahren hinzugefügt
bin/mozilla/ustva.pl | ||
---|---|---|
29 | 29 |
#use strict; |
30 | 30 |
#no strict 'refs'; |
31 | 31 |
#use diagnostics; |
32 |
#use warnings FATAL=> 'all'; |
|
32 |
#use warnings; # FATAL=> 'all';
|
|
33 | 33 |
#use vars qw($locale $form %myconfig); |
34 | 34 |
#our ($myconfig); |
35 | 35 |
#use CGI::Carp "fatalsToBrowser"; |
... | ... | |
76 | 76 |
$form->{title} = $locale->text('UStVA'); |
77 | 77 |
$form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 |
78 | 78 |
|
79 |
# $accrual = ($eur) ? "" : "checked"; |
|
80 |
# $cash = ($eur) ? "checked" : ""; |
|
81 |
my $year = ''; |
|
82 |
my $null = ''; |
|
83 |
($null, $null, $null, $null, $null, $year, $null, $null, $null) = |
|
84 |
localtime(); |
|
85 |
$year += 1900; |
|
79 |
my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig),0,4); |
|
86 | 80 |
|
87 | 81 |
my $department = ''; |
88 | 82 |
local $hide = ''; |
... | ... | |
233 | 227 |
|
234 | 228 |
# accounting years if SQL-Ledger Version < 2.4.1 |
235 | 229 |
# $year = $form->{year} * 1; |
236 |
@years = sort { $b <=> $a } (2000 .. ($year+1));
|
|
230 |
@years = sort { $b <=> $a } (2003 .. ($year+1));
|
|
237 | 231 |
$form->{all_years} = \@years; |
238 | 232 |
} |
239 | 233 |
map { $form->{selectaccountingyear} .= qq|<option>$_\n| } |
... | ... | |
539 | 533 |
sub ustva_vorauswahl { |
540 | 534 |
$lxdebug->enter_sub(); |
541 | 535 |
#Aktuelles Datum zerlegen: |
542 |
$locale->date(\%myconfig, $form->current_date(\%myconfig, '0', '0'), 0) =~ |
|
543 |
/(\d\d).(\d\d).(\d\d\d\d)/; |
|
536 |
my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig); |
|
544 | 537 |
|
545 | 538 |
#$locale->date($myconfig, $form->current_date($myconfig), 0)=~ /(\d\d).(\d\d).(\d\d\d\d)/; |
546 |
$form->{day} = $1; |
|
547 |
$form->{month} = $2; |
|
548 |
$form->{year} = $3; |
|
539 |
$form->{day} = substr($date, 6, 2); |
|
540 |
$form->{month} = substr($date, 4, 2); |
|
541 |
$form->{year} = substr($date, 0, 4); |
|
542 |
$lxdebug->message(LXDebug::DEBUG1, qq| |
|
543 |
Actual date from Database: $date\n |
|
544 |
Actual year from Database: $form->{year}\n |
|
545 |
Actual day from Database: $form->{day}\n |
|
546 |
Actual month from Database: $form->{month}\n|); |
|
547 |
|
|
549 | 548 |
my $sel = ''; |
550 | 549 |
my $yymmdd = ''; |
551 | 550 |
|
... | ... | |
585 | 584 |
|
586 | 585 |
my $yy = $form->{year} * 10000; |
587 | 586 |
$yymmdd = "$form->{year}$form->{month}$form->{day}" * 1; |
587 |
$yymmdd = 20060121; |
|
588 | 588 |
$sel = ''; |
589 |
my $dfv = '0'; # Offset f?r Dauerfristverl?ngerung |
|
590 |
#$dfv = '100' if ($form->{FA_dauerfrist} eq '1'); |
|
589 |
my $dfv = '0'; |
|
590 |
|
|
591 |
# Offset f?r Dauerfristverl?ngerung |
|
592 |
$dfv = '100' if ($form->{FA_dauerfrist} eq '1'); |
|
591 | 593 |
|
592 | 594 |
SWITCH: { |
593 | 595 |
$yymmdd <= ($yy + 110 + $dfv) && do { |
... | ... | |
824 | 826 |
|
825 | 827 |
#forgotten the year --> thisyear |
826 | 828 |
if ($form->{year} !~ m/^\d\d\d\d$/) { |
827 |
$locale->date(\$myconfig, $form->current_date(\$myconfig), 0) =~ |
|
828 |
/(\d\d\d\d)/; |
|
829 |
$form->{year} = $1; |
|
829 |
$form->{year} = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig),0,4); |
|
830 |
$lxdebug->message(LXDebug::DEBUG1, qq|Actual year from Database: $form->{year}\n|); |
|
830 | 831 |
} |
831 | 832 |
|
832 | 833 |
#yearly report |
833 | 834 |
if ($form->{duetyp} eq "13") { |
834 |
$form->{fromdate} = "$form->{year}-01-01";
|
|
835 |
$form->{todate} = "$form->{year}-12-31";
|
|
835 |
$form->{fromdate} = "$form->{year}0101";
|
|
836 |
$form->{todate} = "$form->{year}1231";
|
|
836 | 837 |
} |
837 | 838 |
|
838 | 839 |
#Quater reports |
839 | 840 |
if ($form->{duetyp} eq "A") { |
840 |
$form->{fromdate} = "$form->{year}-01-01";
|
|
841 |
$form->{todate} = "$form->{year}-03-31";
|
|
841 |
$form->{fromdate} = "$form->{year}0101";
|
|
842 |
$form->{todate} = "$form->{year}0331";
|
|
842 | 843 |
$form->{'0441'} = "X"; |
843 | 844 |
} |
844 | 845 |
if ($form->{duetyp} eq "B") { |
845 |
$form->{fromdate} = "$form->{year}-04-01";
|
|
846 |
$form->{todate} = "$form->{year}-06-30";
|
|
846 |
$form->{fromdate} = "$form->{year}0401";
|
|
847 |
$form->{todate} = "$form->{year}0630";
|
|
847 | 848 |
$form->{'0442'} = "X"; |
848 | 849 |
} |
849 | 850 |
if ($form->{duetyp} eq "C") { |
850 |
$form->{fromdate} = "$form->{year}-07-01";
|
|
851 |
$form->{todate} = "$form->{year}-09-30";
|
|
851 |
$form->{fromdate} = "$form->{year}0701";
|
|
852 |
$form->{todate} = "$form->{year}0930";
|
|
852 | 853 |
$form->{'0443'} = "X"; |
853 | 854 |
} |
854 | 855 |
if ($form->{duetyp} eq "D") { |
855 |
$form->{fromdate} = "$form->{year}-10-01";
|
|
856 |
$form->{todate} = "$form->{year}-12-31";
|
|
856 |
$form->{fromdate} = "$form->{year}1001";
|
|
857 |
$form->{todate} = "$form->{year}1231";
|
|
857 | 858 |
$form->{'0444'} = "X"; |
858 | 859 |
} |
859 | 860 |
|
860 | 861 |
#Monthly reports |
861 | 862 |
SWITCH: { |
862 | 863 |
$form->{duetyp} eq "01" && do { |
863 |
$form->{fromdate} = "$form->{year}-01-01";
|
|
864 |
$form->{todate} = "$form->{year}-01-31";
|
|
864 |
$form->{fromdate} = "$form->{year}0101";
|
|
865 |
$form->{todate} = "$form->{year}0131";
|
|
865 | 866 |
$form->{'0401'} = "X"; |
866 | 867 |
last SWITCH; |
867 | 868 |
}; |
868 | 869 |
$form->{duetyp} eq "02" && do { |
869 |
$form->{fromdate} = "$form->{year}-02-01";
|
|
870 |
$form->{fromdate} = "$form->{year}0201";
|
|
870 | 871 |
|
871 | 872 |
#this works from 1901 to 2099, 1900 and 2100 fail. |
872 | 873 |
my $leap = ($form->{year} % 4 == 0) ? "29" : "28"; |
873 |
$form->{todate} = "$form->{year}-02-$leap";
|
|
874 |
$form->{todate} = "$form->{year}02$leap";
|
|
874 | 875 |
$form->{"0402"} = "X"; |
875 | 876 |
last SWITCH; |
876 | 877 |
}; |
877 | 878 |
$form->{duetyp} eq "03" && do { |
878 |
$form->{fromdate} = "$form->{year}-03-01";
|
|
879 |
$form->{todate} = "$form->{year}-03-31";
|
|
879 |
$form->{fromdate} = "$form->{year}0301";
|
|
880 |
$form->{todate} = "$form->{year}0331";
|
|
880 | 881 |
$form->{"0403"} = "X"; |
881 | 882 |
last SWITCH; |
882 | 883 |
}; |
883 | 884 |
$form->{duetyp} eq "04" && do { |
884 |
$form->{fromdate} = "$form->{year}-04-01";
|
|
885 |
$form->{todate} = "$form->{year}-04-30";
|
|
885 |
$form->{fromdate} = "$form->{year}0401";
|
|
886 |
$form->{todate} = "$form->{year}0430";
|
|
886 | 887 |
$form->{"0404"} = "X"; |
887 | 888 |
last SWITCH; |
888 | 889 |
}; |
889 | 890 |
$form->{duetyp} eq "05" && do { |
890 |
$form->{fromdate} = "$form->{year}-05-01";
|
|
891 |
$form->{todate} = "$form->{year}-05-31";
|
|
891 |
$form->{fromdate} = "$form->{year}0501";
|
|
892 |
$form->{todate} = "$form->{year}0531";
|
|
892 | 893 |
$form->{"0405"} = "X"; |
893 | 894 |
last SWITCH; |
894 | 895 |
}; |
895 | 896 |
$form->{duetyp} eq "06" && do { |
896 |
$form->{fromdate} = "$form->{year}-06-01";
|
|
897 |
$form->{todate} = "$form->{year}-06-30";
|
|
897 |
$form->{fromdate} = "$form->{year}0601";
|
|
898 |
$form->{todate} = "$form->{year}0630";
|
|
898 | 899 |
$form->{"0406"} = "X"; |
899 | 900 |
last SWITCH; |
900 | 901 |
}; |
901 | 902 |
$form->{duetyp} eq "07" && do { |
902 |
$form->{fromdate} = "$form->{year}-07-01";
|
|
903 |
$form->{todate} = "$form->{year}-07-31";
|
|
903 |
$form->{fromdate} = "$form->{year}0701";
|
|
904 |
$form->{todate} = "$form->{year}0731";
|
|
904 | 905 |
$form->{"0407"} = "X"; |
905 | 906 |
last SWITCH; |
906 | 907 |
}; |
907 | 908 |
$form->{duetyp} eq "08" && do { |
908 |
$form->{fromdate} = "$form->{year}-08-01";
|
|
909 |
$form->{todate} = "$form->{year}-08-31";
|
|
909 |
$form->{fromdate} = "$form->{year}0801";
|
|
910 |
$form->{todate} = "$form->{year}0831";
|
|
910 | 911 |
$form->{"0408"} = "X"; |
911 | 912 |
last SWITCH; |
912 | 913 |
}; |
913 | 914 |
$form->{duetyp} eq "09" && do { |
914 |
$form->{fromdate} = "$form->{year}-09-01";
|
|
915 |
$form->{todate} = "$form->{year}-09-30";
|
|
915 |
$form->{fromdate} = "$form->{year}0901";
|
|
916 |
$form->{todate} = "$form->{year}0930";
|
|
916 | 917 |
$form->{"0409"} = "X"; |
917 | 918 |
last SWITCH; |
918 | 919 |
}; |
919 | 920 |
$form->{duetyp} eq "10" && do { |
920 |
$form->{fromdate} = "$form->{year}-10-01";
|
|
921 |
$form->{todate} = "$form->{year}-10-31";
|
|
921 |
$form->{fromdate} = "$form->{year}1001";
|
|
922 |
$form->{todate} = "$form->{year}1031";
|
|
922 | 923 |
$form->{"0410"} = "X"; |
923 | 924 |
last SWITCH; |
924 | 925 |
}; |
925 | 926 |
$form->{duetyp} eq "11" && do { |
926 |
$form->{fromdate} = "$form->{year}-11-01";
|
|
927 |
$form->{todate} = "$form->{year}-11-30";
|
|
927 |
$form->{fromdate} = "$form->{year}1101";
|
|
928 |
$form->{todate} = "$form->{year}1130";
|
|
928 | 929 |
$form->{"0411"} = "X"; |
929 | 930 |
last SWITCH; |
930 | 931 |
}; |
931 | 932 |
$form->{duetyp} eq "12" && do { |
932 |
$form->{fromdate} = "$form->{year}-12-01";
|
|
933 |
$form->{todate} = "$form->{year}-12-31";
|
|
933 |
$form->{fromdate} = "$form->{year}1201";
|
|
934 |
$form->{todate} = "$form->{year}1231";
|
|
934 | 935 |
$form->{"0412"} = "X"; |
935 | 936 |
last SWITCH; |
936 | 937 |
}; |
937 | 938 |
} |
938 | 939 |
} |
939 | 940 |
|
940 |
#$myconfig = \%myconfig; |
|
941 |
#$myconfig->{dateformat} = 'yyyy-mm-dd'; |
|
942 |
#$form->{fromdate}= $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0); |
|
943 |
#$form->{todate}= $locale->date(\%myconfig, $form->{todate}, 0, 0, 0); |
|
941 |
# using dates in ISO-8601 format: yyyymmmdd for Postgres... |
|
944 | 942 |
USTVA->ustva(\%myconfig, \%$form); |
945 |
|
|
946 |
#??($form->{department}) = split /--/, $form->{department}; |
|
943 |
|
|
944 |
# reformat Dates to dateformat |
|
945 |
$form->{fromdate}= $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0); |
|
946 |
|
|
947 |
$form->{todate} = $form->current_date($myconfig) unless $form->{todate}; |
|
948 |
$form->{todate}= $locale->date(\%myconfig, $form->{todate}, 0, 0, 0); |
|
947 | 949 |
|
948 | 950 |
$form->{period} = |
949 | 951 |
$locale->date(\%myconfig, $form->current_date(\%myconfig), 1, 0, 0); |
950 |
$form->{todate} = $form->current_date($myconfig) unless $form->{todate}; |
|
952 |
|
|
951 | 953 |
|
952 | 954 |
# if there are any dates construct a where |
953 | 955 |
if ($form->{fromdate} || $form->{todate}) { |
Auch abrufbar als: Unified diff
Fixed date problems between database and screen-output,
reported by Holger on the devel-ML.