2 #=====================================================================
4 # Copyright (c) 2004 by Udo Spallek, Aachen
8 # Web: http://www.lx-office.org
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #======================================================================
24 # German Tax authority Module and later ELSTER Interface
25 #======================================================================
27 require "$form->{path}/arap.pl";
32 #use warnings; # FATAL=> 'all';
33 #use vars qw($locale $form %myconfig);
35 #use CGI::Carp "fatalsToBrowser";
43 # this is for our long dates
44 # $locale->text('January')
45 # $locale->text('February')
46 # $locale->text('March')
47 # $locale->text('April')
48 # $locale->text('May ')
49 # $locale->text('June')
50 # $locale->text('July')
51 # $locale->text('August')
52 # $locale->text('September')
53 # $locale->text('October')
54 # $locale->text('November')
55 # $locale->text('December')
57 # this is for our short month
58 # $locale->text('Jan')
59 # $locale->text('Feb')
60 # $locale->text('Mar')
61 # $locale->text('Apr')
62 # $locale->text('May')
63 # $locale->text('Jun')
64 # $locale->text('Jul')
65 # $locale->text('Aug')
66 # $locale->text('Sep')
67 # $locale->text('Oct')
68 # $locale->text('Nov')
69 # $locale->text('Dec')
70 #############################
73 $lxdebug->enter_sub();
74 my $myconfig = \%myconfig;
76 $form->{title} = $locale->text('UStVA');
77 $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1
80 $form->datetonum($form->current_date(\%myconfig),
92 <form method=post action=$form->{script}>
94 <input type=hidden name=title value="$form->{title}">
98 <th class=listtop>$form->{title}</th>
107 # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
108 # Einlesen der Finanzamtdaten
109 &get_config($userspath, 'finanzamt.ini');
111 # Hier Einlesen der user-config
112 # steuernummer entfernt für prerelease
113 my @a = qw(signature name company address businessnumber tel fax email
114 co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
116 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
117 co_fax co_fax1 co_email co_email1 co_url co_url1 ustid duns
118 co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
119 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3);
121 map { $form->{$_} = $myconfig->{$_} } @a;
123 my $oeffnungszeiten = $form->{FA_Oeffnungszeiten};
124 $oeffnungszeiten =~ s/\\\\n/<br>/g;
127 <td width="50%" align="left" valign="top">
130 <b>| . $locale->text('Firma') . qq|</b>
133 if ($form->{company} ne '') {
134 print qq|<h3>$form->{company}</h3>\n|;
137 <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
138 | . $locale->text('Kein Firmenname hinterlegt!') . qq|</a><br>
142 # Anpassungen der Variablennamen auf pre 2.1.1 Namen
143 # klären, ob $form->{company_street|_address} gesetzt sind
146 if ($form->{address} ne '') {
147 my $temp = $form->{address};
148 $temp =~ s/\\n/<br \/>/;
149 ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp);
150 $form->{co_city} =~ s/\\n//g;
153 if ($form->{co_street} ne ''
154 and ( $form->{co_zip} ne ''
155 or $form->{co_city} ne '')
158 $form->{co_street}<br>
159 $form->{co_street1}<br>
160 $form->{co_zip} $form->{co_city}|;
163 <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
164 | . $locale->text('Keine Firmenadresse hinterlegt!') . qq|</a>\n|;
166 $form->{co_email} = $form->{email} unless $form->{co_email};
167 $form->{co_tel} = $form->{tel} unless $form->{co_tel};
168 $form->{co_fax} = $form->{fax} unless $form->{co_fax};
169 $form->{co_url} = $form->{urlx} unless $form->{co_url};
174 | . $locale->text('Tel.: ') . qq|
177 | . $locale->text('Fax.: ') . qq|
184 | . $locale->text('Steuernummer: ') . qq|
187 if ($form->{steuernummer} ne '') {
188 print qq|$form->{steuernummer}|;
191 <a href="ustva.pl?path=$form->{path}&action=edit&level=Programm--Finanzamteinstellungen&login=$form->{login}&password=$form->{password}">
192 Keine Steuernummer hinterlegt!</a><br>|;
196 | . $locale->text('ELSTER-Steuernummer: ') . qq|
197 $form->{elstersteuernummer}
204 if ($form->{FA_steuerberater_name} ne '') {
208 <input checked="checked" title="|
209 . $locale->text('Beraterdaten in UStVA übernehmen?')
210 . qq|" name="FA_steuerberater" id=steuerberater class=checkbox type=checkbox value="1">
211 <b>| . $locale->text('Steuerberater/-in') . qq|</b>
214 $form->{FA_steuerberater_name}<br>
215 $form->{FA_steuerberater_street}<br>
216 $form->{FA_steuerberater_city}<br>
217 Tel: $form->{FA_steuerberater_tel}<br>
225 <b>| . $locale->text('Voranmeldezeitraum') . qq|</b>
231 if (not defined $form->{all_years}) {
233 # accounting years if SQL-Ledger Version < 2.4.1
234 # $year = $form->{year} * 1;
235 @years = sort { $b <=> $a } (2003 .. ($year + 1));
236 $form->{all_years} = \@years;
238 map { $form->{selectaccountingyear} .= qq|<option>$_\n| }
239 @{ $form->{all_years} };
241 <select name=year title="| . $locale->text('Year') . qq|">
244 foreach $key (@years) {
246 print qq|selected| if ($key eq $form->{year});
247 print qq| >$key</option>
251 my $voranmeld = $form->{FA_voranmeld};
252 print qq| </select>|;
254 $checked = "checked" if ($form->{kz10} eq '1');
256 <input name="FA_10" id=FA_10 class=checkbox type=checkbox value="1" $checked title = "|
258 'Ist dies eine berichtigte Anmeldung? (Nr. 10/Zeile 15 Steuererklärung)')
260 | . $locale->text('Berichtigte Anmeldung') . qq|
264 if ($voranmeld ne '') {
267 | . $locale->text($voranmeld) . qq|
269 print qq| mit Dauerfristverlängerung| if ($form->{FA_dauerfrist} eq '1');
275 if ($form->{method} ne '') {
276 print qq|| . $locale->text('Method') . qq|: |;
277 print qq|| . $locale->text('accrual') . qq||
278 if ($form->{method} eq 'accrual');
279 print qq|| . $locale->text('cash') . qq|| if ($form->{method} eq 'cash');
286 if ($form->{FA_Name} ne '') {
288 <td width="50%" valign="top">
291 <b>| . $locale->text('Finanzamt') . qq|</b>
293 <h3>$form->{FA_Name}</h2>
296 #if ($form->{FA_Ergaenzung_Name ne ''}){
298 # $form->{FA_Ergaenzung_Name} 
305 $form->{FA_PLZ} $form->{FA_Ort}
308 | . $locale->text('Tel. : ') . qq|
311 | . $locale->text('Fax. : ') . qq|
315 <a href="mailto:$form->{FA_Email}?subject=|
316 . CGI::escape("Steuer Nr: $form->{steuernummer}:")
319 "Sehr geehrte Damen und Herren,\n\n\nMit freundlichen Grüßen\n\n")
320 . CGI::escape($form->{signature}) . qq|">
324 <a href="$form->{FA_Internet}">
329 | . $locale->text('Öffnungszeiten') . qq|
336 ( $form->{FA_BLZ_1} ne ''
337 && $form->{FA_Kontonummer_1} ne ''
338 && $form->{FA_Bankbezeichnung_1} ne '');
340 ( $form->{FA_BLZ_2} ne ''
341 && $form->{FA_Kontonummer_2} ne ''
342 && $form->{FA_Bankbezeichnung_oertlich} ne '');
344 if ($FA_1 && $FA_2) {
347 | . $locale->text('Bankverbindungen') . qq|
351 $form->{FA_Bankbezeichnung_1}
353 | . $locale->text('Konto: ') . qq|
354 $form->{FA_Kontonummer_1}
356 | . $locale->text('BLZ: ') . qq|
360 $form->{FA_Bankbezeichnung_oertlich}
362 | . $locale->text('Konto: ') . qq|
363 $form->{FA_Kontonummer_2}
365 | . $locale->text('BLZ: ') . qq|
374 | . $locale->text('Bankverbindung') . qq|
377 $form->{FA_Bankbezeichnung_1}
379 | . $locale->text('Konto: ') . qq|
380 $form->{FA_Kontonummer_1}
382 | . $locale->text('BLZ: ') . qq|
383 $form->{FA_BLZ_1} <br>
388 | . $locale->text('Bankverbindung') . qq|
391 $form->{FA_Bankbezeichnung_oertlich}
393 | . $locale->text('Konto: ') . qq|
394 $form->{FA_Kontonummer_2}
396 | . $locale->text('BLZ: ') . qq|
406 <b>| . $locale->text('Ausgabeformat') . qq|</b>
418 <td width="50%" valign="bottom">
421 <b>| . $locale->text('Hinweise') . qq|</b>
423 <h2 class="confirm">|
424 . $locale->text('Missing Preferences: Outputroutine disabled')
426 <h3>| . $locale->text('Help:') . qq|</h3>
428 <li>| . $locale->text('Hint-Missing-Preferences') . qq|</li>
433 $hide = q|disabled="disabled"|;
441 #}# end if report = ustva
448 <td><hr size="3" noshade></td>
453 <input type="hidden" name="address" value="$form->{address}">
454 <input type="hidden" name="reporttype" value="custom">
455 <input type="hidden" name="co_street" value="$form->{co_street}">
456 <input type="hidden" name="co_city" value="$form->{co_city}">
457 <input type="hidden" name="path" value="$form->{path}">
458 <input type="hidden" name="login" value="$form->{login}">
459 <input type="hidden" name="password" value="$form->{password}">
463 <input type=hidden name=nextsub value=generate_ustva>
464 <input $hide type=submit class=submit name=action value="|
465 . $locale->text('Show') . qq|">
470 <form action="doc/ustva.html" method="get">
472 <input type=submit class=submit name=action value="|
473 . $locale->text('Help') . qq|">
485 $lxdebug->leave_sub();
488 #############################
491 $lxdebug->enter_sub();
493 # parse help documents under doc
494 my $tmp = $form->{templates};
495 $form->{templates} = 'doc';
496 $form->{help} = 'ustva';
497 $form->{type} = 'help';
498 $form->{format} = 'html';
501 #$form->{templates} = $tmp;
502 $lxdebug->leave_sub();
506 $lxdebug->enter_sub();
510 $lxdebug->leave_sub();
511 &{ $form->{nextsub} };
515 sub ustva_vorauswahl {
516 $lxdebug->enter_sub();
518 #Aktuelles Datum zerlegen:
519 my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig);
521 #$locale->date($myconfig, $form->current_date($myconfig), 0)=~ /(\d\d).(\d\d).(\d\d\d\d)/;
522 $form->{day} = substr($date, 6, 2);
523 $form->{month} = substr($date, 4, 2);
524 $form->{year} = substr($date, 0, 4);
525 $lxdebug->message(LXDebug::DEBUG1, qq|
526 Actual date from Database: $date\n
527 Actual year from Database: $form->{year}\n
528 Actual day from Database: $form->{day}\n
529 Actual month from Database: $form->{month}\n|);
534 # Testdaten erzeugen:
536 #$form->{month}= '01';
537 #$form->{year}= 2004;
539 <input type=hidden name=day value=$form->{day}>
540 <input type=hidden name=month value=$form->{month}>
541 <input type=hidden name=yymmdd value=$yymmdd>
542 <input type=hidden name=sel value=$sel>
545 if ($form->{FA_voranmeld} eq 'month') {
547 # Vorauswahl bei monatlichem Voranmeldungszeitraum
549 <select name="duetyp" id=zeitraum title="|
550 . $locale->text('Hier den Berechnungszeitraum auswählen...') . qq|">
553 my %liste = ('01' => 'January',
567 my $yy = $form->{year} * 10000;
568 $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
573 # Offset für Dauerfristverlängerung
574 $dfv = '100' if ($form->{FA_dauerfrist} eq '1');
577 $yymmdd <= ($yy + 110 + $dfv) && do {
578 $form->{year} = $form->{year} - 1;
582 $yymmdd <= ($yy + 210 + $dfv) && do {
586 $yymmdd <= ($yy + 310 + $dfv) && do {
590 $yymmdd <= ($yy + 410 + $dfv) && do {
594 $yymmdd <= ($yy + 510 + $dfv) && do {
598 $yymmdd <= ($yy + 610 + $dfv) && do {
602 $yymmdd <= ($yy + 710 + $dfv) && do {
606 $yymmdd <= ($yy + 810 + $dfv) && do {
610 $yymmdd <= ($yy + 910 + $dfv) && do {
614 $yymmdd <= ($yy + 1010 + $dfv) && do {
618 $yymmdd <= ($yy + 1110 + $dfv) && do {
622 $yymmdd <= ($yy + 1210) && do {
626 $yymmdd <= ($yy + 1231) && do {
633 foreach $key (sort keys %liste) {
635 $selected = 'selected' if ($sel eq $key);
637 <option value="$key" $selected>|
638 . $locale->text("$liste{$key}") . qq|</option>
644 } elsif ($form->{FA_voranmeld} eq 'quarter') {
646 # Vorauswahl bei quartalsweisem Voranmeldungszeitraum
647 my %liste = ('A' => $locale->text('1. Quarter'),
648 'B' => $locale->text('2. Quarter'),
649 'C' => $locale->text('3. Quarter'),
650 'D' => $locale->text('4. Quarter'),
651 '13' => $locale->text('Yearly'),);
653 my $yy = $form->{year} * 10000;
654 $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
656 my $dfv = ''; # Offset für Dauerfristverlängerung
657 $dfv = '100' if ($form->{FA_dauerfrist} eq '1');
660 $yymmdd <= ($yy + 110 + $dfv) && do {
661 $form->{year} = $form->{year} - 1;
665 $yymmdd <= ($yy + 410 + $dfv) && do {
669 $yymmdd <= ($yy + 710 + $dfv) && do {
673 $yymmdd <= ($yy + 1010 + $dfv) && do {
677 $yymmdd <= ($yy + 1231) && do {
682 print qq|<select id="zeitraum" name="duetyp" title="|
683 . $locale->text('Select a period') . qq|" >|;
685 foreach $key (sort keys %liste) {
687 $selected = 'selected' if ($sel eq $key);
689 <option value="$key" $selected>$liste{$key}</option>
697 # keine Vorauswahl bei Voranmeldungszeitraum
698 print qq|<select id="zeitraum" name="duetyp" title="|
699 . $locale->text('Select a period') . qq|" >|;
701 my %listea = ('A' => '1. Quarter',
704 'D' => '4. Quarter',);
706 my %listeb = ('01' => 'January',
720 foreach $key (sort keys %listea) {
722 <option value="$key">|
723 . $locale->text("$listea{$key}")
727 foreach $key (sort keys %listeb) {
729 <option value="$key">|
730 . $locale->text("$listeb{$key}")
735 $lxdebug->leave_sub();
739 $lxdebug->enter_sub();
741 $lxdebug->leave_sub();
745 $lxdebug->enter_sub();
747 $lxdebug->leave_sub();
751 $lxdebug->enter_sub();
753 # $form->{PD}{$form->{type}} = "selected";
754 # $form->{DF}{$form->{format}} = "selected";
755 # $form->{OP}{$form->{media}} = "selected";
756 # $form->{SM}{$form->{sendmode}} = "selected";
757 my $type = qq| <input type=hidden name="type" value="ustva">|;
758 my $media = qq| <input type=hidden name="media" value="screen">|;
760 qq| <option value=html selected>|
761 . $locale->text('Vorschau')
765 qq| <option value=pdf>|
766 . $locale->text('UStVA als PDF-Dokument')
770 #my $disabled= qq|disabled="disabled"|;
771 #$disabled='' if ($form->{elster} eq '1' );
772 if ($form->{elster} eq '1') {
774 qq|<option value=elster>|
775 . $locale->text('ELSTER Export nach Winston')
779 #$format .= qq|<option value=elster>|.$locale->text('ELSTER Export nach Winston').qq|</option>|;
783 <select name=format title = "|
784 . $locale->text('Ausgabeformat auswählen...') . qq|">$format</select>
786 $lxdebug->leave_sub();
790 $lxdebug->enter_sub();
792 # Aufruf von get_config aus bin/mozilla/ustva.pl zum
793 # Einlesen der Finanzamtdaten aus finanzamt.ini
795 get_config($userspath, 'finanzamt.ini');
797 # form vars initialisieren
798 my @anmeldungszeitraum =
799 qw('0401' '0402' '0403' '0404' '0405' '0405' '0406' '0407' '0408' '0409' '0410' '0411' '0412' '0441' '0442' '0443' '0444');
801 foreach $item (@anmeldungszeitraum) {
804 if ($form->{reporttype} eq "custom") {
806 #forgotten the year --> thisyear
807 if ($form->{year} !~ m/^\d\d\d\d$/) {
808 $form->{year} = substr(
810 $form->current_date(\%myconfig), \%myconfig
813 $lxdebug->message(LXDebug::DEBUG1,
814 qq|Actual year from Database: $form->{year}\n|);
818 if ($form->{duetyp} eq "13") {
819 $form->{fromdate} = "$form->{year}0101";
820 $form->{todate} = "$form->{year}1231";
824 if ($form->{duetyp} eq "A") {
825 $form->{fromdate} = "$form->{year}0101";
826 $form->{todate} = "$form->{year}0331";
827 $form->{'0441'} = "X";
829 if ($form->{duetyp} eq "B") {
830 $form->{fromdate} = "$form->{year}0401";
831 $form->{todate} = "$form->{year}0630";
832 $form->{'0442'} = "X";
834 if ($form->{duetyp} eq "C") {
835 $form->{fromdate} = "$form->{year}0701";
836 $form->{todate} = "$form->{year}0930";
837 $form->{'0443'} = "X";
839 if ($form->{duetyp} eq "D") {
840 $form->{fromdate} = "$form->{year}1001";
841 $form->{todate} = "$form->{year}1231";
842 $form->{'0444'} = "X";
847 $form->{duetyp} eq "01" && do {
848 $form->{fromdate} = "$form->{year}0101";
849 $form->{todate} = "$form->{year}0131";
850 $form->{'0401'} = "X";
853 $form->{duetyp} eq "02" && do {
854 $form->{fromdate} = "$form->{year}0201";
856 #this works from 1901 to 2099, 1900 and 2100 fail.
857 my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
858 $form->{todate} = "$form->{year}02$leap";
859 $form->{"0402"} = "X";
862 $form->{duetyp} eq "03" && do {
863 $form->{fromdate} = "$form->{year}0301";
864 $form->{todate} = "$form->{year}0331";
865 $form->{"0403"} = "X";
868 $form->{duetyp} eq "04" && do {
869 $form->{fromdate} = "$form->{year}0401";
870 $form->{todate} = "$form->{year}0430";
871 $form->{"0404"} = "X";
874 $form->{duetyp} eq "05" && do {
875 $form->{fromdate} = "$form->{year}0501";
876 $form->{todate} = "$form->{year}0531";
877 $form->{"0405"} = "X";
880 $form->{duetyp} eq "06" && do {
881 $form->{fromdate} = "$form->{year}0601";
882 $form->{todate} = "$form->{year}0630";
883 $form->{"0406"} = "X";
886 $form->{duetyp} eq "07" && do {
887 $form->{fromdate} = "$form->{year}0701";
888 $form->{todate} = "$form->{year}0731";
889 $form->{"0407"} = "X";
892 $form->{duetyp} eq "08" && do {
893 $form->{fromdate} = "$form->{year}0801";
894 $form->{todate} = "$form->{year}0831";
895 $form->{"0408"} = "X";
898 $form->{duetyp} eq "09" && do {
899 $form->{fromdate} = "$form->{year}0901";
900 $form->{todate} = "$form->{year}0930";
901 $form->{"0409"} = "X";
904 $form->{duetyp} eq "10" && do {
905 $form->{fromdate} = "$form->{year}1001";
906 $form->{todate} = "$form->{year}1031";
907 $form->{"0410"} = "X";
910 $form->{duetyp} eq "11" && do {
911 $form->{fromdate} = "$form->{year}1101";
912 $form->{todate} = "$form->{year}1130";
913 $form->{"0411"} = "X";
916 $form->{duetyp} eq "12" && do {
917 $form->{fromdate} = "$form->{year}1201";
918 $form->{todate} = "$form->{year}1231";
919 $form->{"0412"} = "X";
925 # using dates in ISO-8601 format: yyyymmmdd for Postgres...
926 USTVA->ustva(\%myconfig, \%$form);
928 # reformat Dates to dateformat
929 $form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
931 $form->{todate} = $form->current_date($myconfig) unless $form->{todate};
932 $form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
935 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1, 0, 0);
937 # if there are any dates construct a where
938 if ($form->{fromdate} || $form->{todate}) {
940 unless ($form->{todate}) {
941 $form->{todate} = $form->current_date($myconfig);
944 my $longtodate = $locale->date($myconfig, $form->{todate}, 1, 0, 0);
945 my $shorttodate = $locale->date($myconfig, $form->{todate}, 0, 0, 0);
947 my $longfromdate = $locale->date($myconfig, $form->{fromdate}, 1, 0, 0);
948 my $shortfromdate = $locale->date($myconfig, $form->{fromdate}, 0, 0, 0);
950 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
952 $locale->text('for Period')
953 . qq|<br>\n$longfromdate |
954 . $locale->text('bis')
958 if ($form->{comparefromdate} || $form->{comparetodate}) {
959 my $longcomparefromdate =
960 $locale->date(\%myconfig, $form->{comparefromdate}, 1, 0, 0);
961 my $shortcomparefromdate =
962 $locale->date(\%myconfig, $form->{comparefromdate}, 0, 0, 0);
964 my $longcomparetodate =
965 $locale->date(\%myconfig, $form->{comparetodate}, 1, 0, 0);
966 my $shortcomparetodate =
967 $locale->date(\%myconfig, $form->{comparetodate}, 0, 0, 0);
969 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
971 "<br>\n$longcomparefromdate "
972 . $locale->text('bis')
973 . qq| $longcomparetodate|;
976 $form->{Datum_heute} =
977 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
979 # setup variables for the form
980 # steuernummer für prerelease entfernt
981 my @a = qw(company businessnumber tel fax email
982 co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
983 co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
984 co_fax co_fax1 co_email co_email1 co_url co_url1 ustid duns
985 co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
986 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3);
988 map { $form->{$_} = $myconfig{$_} } @a;
990 if ($form->{address} ne '') {
991 my $temp = $form->{address};
992 $temp =~ s/\\n/<br \/>/;
993 ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp);
994 $form->{co_city} =~ s/\\n//g;
997 if ( $form->{format} eq 'pdf'
998 or $form->{format} eq 'postscript') {
999 $form->{padding} = "~~";
1000 $form->{bold} = "\textbf{";
1001 $form->{endbold} = "}";
1002 $form->{br} = '\\\\';
1004 my @numbers = qw(511 861 36 80 971 931 98 96 53 74
1005 85 65 66 61 62 Z67 63 64 59 69 39 83
1006 Z43 Z45 Z53 Z62 Z65);
1010 # Zahlenformatierung für Latex USTVA Formulare
1011 if ( $myconfig{numberformat} eq '1.000,00'
1012 or $myconfig{numberformat} eq '1000,00') {
1013 foreach $number (@numbers) {
1014 $form->{$number} =~ s/,/~~/g;
1017 if ( $myconfig{numberformat} eq '1000.00'
1018 or $myconfig{numberformat} eq '1,000.00') {
1019 foreach $number (@numbers) {
1020 $form->{$number} =~ s/\./~~/g;
1024 # Formatierungen für HTML Ausgabe
1025 } elsif ($form->{format} eq 'html') {
1026 $form->{padding} = " ";
1027 $form->{bold} = "<b>";
1028 $form->{endbold} = "</b>";
1029 $form->{br} = "<br>";
1030 $form->{address} =~ s/\\n/<br \/>/g;
1034 if ($form->{format} eq 'elster') {
1035 if ($form->{duetyp} eq '13') {
1039 'Impossible to create yearly Tax Report via Winston.<br \> Not yet implemented!'
1045 $form->{templates} = $myconfig{templates};
1046 $form->{templates} = "doc" if ($form->{type} eq 'help');
1048 $form->{IN} = "$form->{type}";
1049 $form->{IN} = "$form->{help}" if ($form->{type} eq 'help');
1050 $form->{IN} = 'USTE'
1051 if ( $form->{duetyp} eq '13'
1052 && $form->{format} ne 'html');
1054 if ($form->{IN} eq 'USTE') {
1058 'Impossible to create yearly Tax Report as PDF or PS.<br \> Not yet implemented!'
1062 $form->{IN} .= "-$form->{year}"
1063 if ( $form->{format} eq 'pdf'
1064 or $form->{format} eq 'postscript');
1066 $form->{IN} .= '.tex'
1067 if ( $form->{format} eq 'pdf'
1068 or $form->{format} eq 'postscript');
1070 $form->{IN} .= '.html' if ($form->{format} eq 'html');
1073 #print qq|$myconfig<br>$path|;
1074 $form->parse_template($myconfig, $userspath);
1076 $lxdebug->leave_sub();
1080 $lxdebug->enter_sub();
1082 # edit all taxauthority prefs
1085 &get_config($userspath, 'finanzamt.ini');
1087 #&create_steuernummer;
1089 my $land = $form->{elsterland};
1090 my $amt = $form->{elsterFFFF};
1094 "$form->{cbscript}?action=edit&login=$form->{cblogin}&path=$form->{cbpath}&root=$form->{cbroot}&rpw=$form->{cbrpw}"
1095 if ($form->{cbscript} ne '' and $form->{cblogin} ne '');
1097 $form->{title} = $locale->text('Finanzamt - Einstellungen');
1100 <form name="verzeichnis" method=post action="$form->{script}">
1103 <th class="listtop">|
1104 . $locale->text('Finanzamt - Einstellungen') . qq|</th>
1111 . $locale->text('Angaben zum Finanzamt') . qq|</b></legend>
1114 #print qq|$form->{terminal}|;
1116 USTVA::fa_auswahl($land, $amt, &elster_hash());
1122 $checked = "checked" if ($form->{method} eq 'accrual');
1125 <legend><b>| . $locale->text('Verfahren') . qq|</b>
1127 <input name=method id=accrual class=radio type=radio value="accrual" $checked>
1128 <label for="accrual">| . $locale->text('accrual') . qq|</label>
1132 $checked = "checked" if ($form->{method} eq 'cash');
1134 <input name=method id=cash class=radio type=radio value="cash" $checked>
1135 <label for="cash">| . $locale->text('cash') . qq|</label>
1139 <legend><b>| . $locale->text('Voranmeldungszeitraum') . qq|</b>
1143 $checked = "checked" if ($form->{FA_voranmeld} eq 'month');
1145 <input name=FA_voranmeld id=month class=radio type=radio value="month" $checked>
1146 <label for="month">| . $locale->text('month') . qq|</label>
1150 $checked = "checked" if ($form->{FA_voranmeld} eq 'quarter');
1152 <input name="FA_voranmeld" id=quarter class=radio type=radio value="quarter" $checked>
1153 <label for="quarter">| . $locale->text('quarter') . qq|</label>
1157 $checked = "checked" if ($form->{FA_dauerfrist} eq '1');
1159 <input name="FA_dauerfrist" id=FA_dauerfrist class=checkbox type=checkbox value="1" $checked>
1161 . $locale->text('Dauerfristverlängerung') . qq|</label>
1166 <legend><b>| . $locale->text('Steuerberater/-in') . qq|</b>
1170 $checked = "checked" if ($form->{FA_71} eq 'X');
1172 <!-- <input name="FA_71" id=FA_71 class=checkbox type=checkbox value="X" $checked>
1173 <label for="FA_71">|
1174 . $locale->text('Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)')
1181 | . $locale->text('Name') . qq|
1184 | . $locale->text('Straße') . qq|
1187 | . $locale->text('PLZ, Ort') . qq|
1190 | . $locale->text('Telefon') . qq|
1195 <input name="FA_steuerberater_name" id=steuerberater size=25 value="$form->{FA_steuerberater_name}">
1198 <input name="FA_steuerberater_street" id=steuerberater size=25 value="$form->{FA_steuerberater_street}">
1201 <input name="FA_steuerberater_city" id=steuerberater size=25 value="$form->{FA_steuerberater_city}">
1204 <input name="FA_steuerberater_tel" id=steuerberater size=25 value="$form->{FA_steuerberater_tel}">
1213 <!--<input type=submit class=submit name=action value="|
1214 . $locale->text('debug') . qq|">-->
1217 <input type="button" name="Verweis" value="|
1218 . $locale->text('Back to user config...') . qq|"
1219 onClick="self.location.href='$callback'">| if ($callback ne '');
1222 <input type=submit class=submit name=action value="|
1223 . $locale->text('continue') . qq|">
1230 my @variables = qw( steuernummer elsterland elstersteuernummer elsterFFFF);
1232 foreach $variable (@variables) {
1234 <input name=$variable type=hidden value="$form->{$variable}">|;
1236 my $steuernummer_new = '';
1238 #<input type=hidden name="steuernummer_new" value="$form->{$steuernummer_new}">
1240 <input type=hidden name="callback" value="$callback">
1241 <input type=hidden name="nextsub" value="edit_form">
1242 <input type=hidden name="warnung" value="1">
1243 <input type=hidden name="saved" value="|
1244 . $locale->text('Bitte Angaben überprüfen') . qq|">
1245 <input type=hidden name="path" value=$form->{path}>
1246 <input type=hidden name="login" value=$form->{login}>
1247 <input type=hidden name="password" value=$form->{password}>
1248 <input type=hidden name="warnung" value="0">
1251 @variables = qw(FA_Name FA_Strasse FA_PLZ
1252 FA_Ort FA_Telefon FA_Fax FA_PLZ_Grosskunden FA_PLZ_Postfach FA_Postfach
1253 FA_BLZ_1 FA_Kontonummer_1 FA_Bankbezeichnung_1 FA_BLZ_2
1254 FA_Kontonummer_2 FA_Bankbezeichnung_oertlich FA_Oeffnungszeiten
1255 FA_Email FA_Internet);
1257 foreach $variable (@variables) {
1259 <input name=$variable type=hidden value="$form->{$variable}">|;
1266 $lxdebug->leave_sub();
1270 $lxdebug->enter_sub();
1275 my $elsterland = '';
1276 my $elster_amt = '';
1277 my $elsterFFFF = '';
1278 my $elstersteuernummer = '';
1279 &get_config($userspath, 'finanzamt.ini')
1280 if ($form->{saved} eq $locale->text('saved'));
1282 # Auf Übergabefehler checken
1283 USTVA::info( $locale->text('Missing Tax Authoritys Preferences') . "\n"
1284 . $locale->text('USTVA-Hint: Tax Authoritys'))
1285 if ( $form->{elsterFFFF_new} eq 'Auswahl'
1286 || $form->{elsterland_new} eq 'Auswahl');
1287 USTVA::info( $locale->text('Missing Method!') . "\n"
1288 . $locale->text('USTVA-Hint: Method'))
1289 if ($form->{method} eq '');
1291 # Klären, ob Variablen bereits befüllt sind UND ob veräderungen auf
1292 # der vorherigen Maske stattfanden: $change = 1(in der edit sub,
1293 # mittels get_config)
1295 my $change = $form->{elsterland} eq $form->{elsterland_new}
1296 && $form->{elsterFFFF} eq $form->{elsterFFFF_new} ? '0' : '1';
1297 $change = '0' if ($form->{saved} eq $locale->text('saved'));
1298 my $elster_init = &elster_hash();
1300 #my %elster_init = ();
1301 my %elster_init = %$elster_init;
1303 if ($change eq '1') {
1306 $elsterland = $form->{elsterland_new};
1307 $elsterFFFF = $form->{elsterFFFF_new};
1308 $form->{elsterland} = $elsterland;
1309 $form->{elsterFFFF} = $elsterFFFF;
1310 $form->{steuernummer} = '';
1311 &create_steuernummer;
1313 # rebuild elster_amt
1315 foreach $amt (keys %{ $elster_init{ $form->{elsterland} } }) {
1317 if ($elster_init{ $form->{elsterland}{$amt} eq $form->{elsterFFFF} });
1320 # load the predefined hash data into the FA_* Vars
1321 my @variables = qw(FA_Name FA_Strasse FA_PLZ FA_Ort
1322 FA_Telefon FA_Fax FA_PLZ_Grosskunden FA_PLZ_Postfach
1324 FA_BLZ_1 FA_Kontonummer_1 FA_Bankbezeichnung_1
1325 FA_BLZ_2 FA_Kontonummer_2 FA_Bankbezeichnung_oertlich
1326 FA_Oeffnungszeiten FA_Email FA_Internet);
1328 for (my $i = 0; $i <= 20; $i++) {
1329 $form->{ $variables[$i] } =
1330 $elster_init->{$elsterland}->{$elsterFFFF}->[$i];
1335 $elsterland = $form->{elsterland};
1336 $elsterFFFF = $form->{elsterFFFF};
1339 my $stnr = $form->{steuernummer};
1341 my $patterncount = $form->{patterncount};
1342 my $elster_pattern = $form->{elster_pattern};
1343 my $delimiter = $form->{delimiter};
1344 my $steuernummer = '';
1345 $steuernummer = $form->{steuernummer} if ($steuernummer eq '');
1348 my $warnung = $form->{warnung};
1352 <form name="elsterform" method=post action="$form->{script}">
1353 <table width="100%">
1355 <th colspan="2" class="listtop">|
1356 . $locale->text('Finanzamt - Einstellungen') . qq|</th>
1371 <font size="+1">| . $locale->text('Steuernummer') . qq|</font>
1376 USTVA::steuernummer_input($form->{elsterland}, $form->{elsterFFFF},
1377 $form->{steuernummer});
1389 <input type=hidden name=lastsub value="edit">
1391 print qq|<input type=submit class=submit name=action value="|
1392 . $locale->text('back') . qq|">|
1393 if ($form->{callback} eq '');
1396 <input type="button" name="Verweis" value="|
1397 . $locale->text('Back to user config...') . qq|"
1398 onClick="self.location.href='$form->{callback}'">|
1399 if ($form->{callback} ne '');
1401 if ($form->{warnung} eq "1") {
1403 <input type=hidden name=nextsub value="edit_form">
1404 <input type=submit class=submit name=action value="|
1405 . $locale->text('continue') . qq|">
1406 <input type=hidden name="saved" value="|
1407 . $locale->text('Bitte alle Angaben überprüfen') . qq|">
1411 <input type=hidden name="nextsub" value="save">
1412 <input type=hidden name="filename" value="finanzamt.ini">
1413 <input type=submit class=submit name=action value="|
1414 . $locale->text('save') . qq|">
1421 <H2 class=confirm>$form->{saved}</H2>
1427 my @variables = qw(FA_steuerberater_name FA_steuerberater_street
1428 FA_steuerberater_city FA_steuerberater_tel
1430 FA_dauerfrist FA_71 elster
1431 path login password type elster_init saved
1434 foreach $variable (@variables) {
1436 <input name="$variable" type="hidden" value="$form->{$variable}">|;
1439 <input type=hidden name="elsterland" value="$elsterland">
1440 <input type=hidden name="elsterFFFF" value="$elsterFFFF">
1441 <input type=hidden name="warnung" value="$warnung">
1442 <input type=hidden name="elstersteuernummer" value="$elstersteuernummer">
1443 <input type=hidden name="steuernummer" value="$stnr">
1444 <input type=hidden name="callback" value="$form->{callback}">
1447 $lxdebug->leave_sub();
1450 sub create_steuernummer {
1451 $lxdebug->enter_sub();
1452 my $part = $form->{part};
1453 my $patterncount = $form->{patterncount};
1454 my $delimiter = $form->{delimiter};
1455 my $elster_pattern = $form->{elster_pattern};
1457 # rebuild steuernummer and elstersteuernummer
1458 # es gibt eine gespeicherte steuernummer $form->{steuernummer}
1459 # und die parts und delimiter
1464 my $steuernummer_new = $part;
1465 my $elstersteuernummer_new = $form->{elster_FFFF};
1466 $elstersteuernummer_new .= '0';
1468 for ($h = 1; $h < $patterncount; $h++) {
1469 $steuernummer_new .= qq|$delimiter|;
1470 for (my $i = 1; $i <= length($elster_pattern); $i++) {
1471 $steuernummer_new .= $form->{"part_$h\_$i"};
1472 $elstersteuernummer_new .= $form->{"part_$h\_$i"};
1475 if ($form->{steuernummer} ne $steuernummer_new) {
1476 $form->{steuernummer} = $steuernummer_new;
1477 $form->{elstersteuernummer} = $elstersteuernummer_new;
1478 $form->{steuernummer_new} = $steuernummer_new;
1480 $form->{steuernummer_new} = '';
1481 $form->{elstersteuernummer_new} = '';
1483 $lxdebug->leave_sub();
1487 $lxdebug->enter_sub();
1489 my ($userpath, $filename) = @_;
1490 my ($key, $value) = '';
1491 open(FACONF, "$userpath/$form->{login}_$filename")
1492 or #falls Datei nicht vorhanden ist
1494 open(FANEW, ">$userpath/$form->{login}_$filename")
1495 or $form->error("$userpath/$filename : $!");
1497 open(FACONF, "$userpath/$form->{login}_$filename")
1498 or $form->error("$userpath/$form->{username}_$filename : $!");
1507 # remove any trailing whitespace
1508 s/^\s*(.*?)\s*$/$1/;
1509 ($key, $value) = split /=/, $_, 2;
1511 #if ($value eq ' '){
1512 # $form->{$key} = " " ;
1513 #} elsif ($value ne ' '){
1514 $form->{$key} = "$value";
1520 # Textboxen formatieren: Linebreaks entfernen
1522 #$form->{FA_Oeffnungszeiten} =~ s/\\\\n/<br>/g;
1523 $lxdebug->leave_sub();
1527 $lxdebug->enter_sub();
1528 my $filename = "$form->{login}_$form->{filename}";
1530 #zuerst die steuernummer aus den part, parts_X_Y und delimiter herstellen
1531 create_steuernummer;
1533 # Textboxen formatieren: Linebreaks entfernen
1535 $form->{FA_Oeffnungszeiten} =~ s/\r\n/\\n/g;
1537 #URL mit http:// davor?
1538 $form->{FA_Internet} =~ s/^http:\/\///;
1539 $form->{FA_Internet} = 'http://' . $form->{FA_Internet};
1541 my @config = qw(elster elsterland elstersteuernummer steuernummer
1542 elsteramt elsterFFFF FA_Name FA_Strasse
1543 FA_PLZ FA_Ort FA_Telefon FA_Fax FA_PLZ_Grosskunden
1544 FA_PLZ_Postfach FA_Postfach FA_BLZ_1 FA_Kontonummer_1
1545 FA_Bankbezeichnung_1 FA_BLZ_2 FA_Kontonummer_2
1546 FA_Bankbezeichnung_oertlich FA_Oeffnungszeiten
1547 FA_Email FA_Internet FA_voranmeld method FA_steuerberater_name
1548 FA_steuerberater_street FA_steuerberater_city FA_steuerberater_tel
1549 FA_71 FA_dauerfrist);
1551 # Hier kommt dann die Plausibilitätsprüfung der ELSTERSteuernummer
1552 if ($form->{elstersteuernummer} ne '000000000') {
1553 $form->{elster} = '1';
1554 open(CONF, ">$userspath/$filename") or $form->error("$filename : $!");
1556 # create the config file
1557 print CONF qq|# Configuration file for USTVA\n\n|;
1559 foreach $key (sort @config) {
1560 $form->{$key} =~ s/\\/\\\\/g;
1561 $form->{$key} =~ s/"/\\"/g;
1564 $form->{$key} =~ s/\r\n/\n/g;
1565 print CONF qq|$key=|;
1566 if ($form->{$key} ne 'Y') {
1567 print CONF qq|$form->{$key}\n|;
1569 if ($form->{$key} eq 'Y') {
1570 print CONF qq|checked \n|;
1573 print CONF qq|\n\n|;
1575 $form->{saved} = $locale->text('saved');
1579 $form->{saved} = $locale->text('Bitte eine Steuernummer angeben');
1583 $lxdebug->leave_sub();
1587 $lxdebug->enter_sub();
1589 my $oeffnungszeiten = $form->{FA_Oeffnungszeiten};
1590 $oeffnungszeiten =~ s/\\\\n/\n/g;
1595 . $locale->text('Finanzamt') . qq| $form->{FA_Name}</font>
1599 #print qq|\n<h4>$form->{FA_Ergaenzung_Name} </h4>
1600 # | if ( $form->{FA_Ergaenzung_Name} );
1602 <table width="100%" valign="top">
1608 <b>| . $locale->text('Address') . qq|</b>
1611 <table width="100%">
1614 | . $locale->text('Finanzamt') . qq|
1619 <input name="FA_Name" size="40" title="FA_Name" value="$form->{FA_Name}" $readonly>
1624 <input name="FA_Strasse" size="40" title="FA_Strasse" value="$form->{FA_Strasse}" $readonly>
1629 <input name="FA_PLZ" size="10" title="FA_PLZ" value="$form->{FA_PLZ}" $readonly>
1632 <input name="FA_Ort" size="20" title="FA_Ort" value="$form->{FA_Ort}" $readonly>
1640 <b>| . $locale->text('Kontakt') . qq|</b>
1642 | . $locale->text('Telefon') . qq|<br>
1643 <input name="FA_Telefon" size="40" title="FA_Telefon" value="$form->{FA_Telefon}" $readonly>
1646 | . $locale->text('Fax') . qq|<br>
1647 <input name="FA_Fax" size="40" title="FA_Fax" value="$form->{FA_Fax}" $readonly>
1650 | . $locale->text('Internet') . qq|<br>
1651 <input name="FA_Email" size="40" title="FA_Email" value="$form->{FA_Email}" $readonly>
1654 <input name="FA_Internet" size="40" title="" title="FA_Internet" value="$form->{FA_Internet}" $readonly>
1662 <b>| . $locale->text('Öffnungszeiten') . qq|</b>
1664 <textarea name="FA_Oeffnungszeiten" rows="4" cols="40" $readonly>$oeffnungszeiten</textarea>
1669 ( $form->{FA_BLZ_1} ne ''
1670 && $form->{FA_Kontonummer_1} ne ''
1671 && $form->{FA_Bankbezeichnung_1} ne '');
1673 ( $form->{FA_BLZ_2} ne ''
1674 && $form->{FA_Kontonummer_2} ne ''
1675 && $form->{FA_Bankbezeichnung_oertlich} ne '');
1677 if ($FA_1 && $FA_2) {
1682 . $locale->text('Bankverbindungen des Finanzamts') . qq|</b>
1687 | . $locale->text('Kreditinstitut') . qq|
1689 <input name="FA_Bankbezeichnung_1" size="30" value="$form->{FA_Bankbezeichnung_1}" $readonly>
1692 | . $locale->text('Kontonummer') . qq|
1694 <input name="FA_Kontonummer_1" size="15" value="$form->{FA_Kontonummer_1}" $readonly>
1697 | . $locale->text('Bankleitzahl') . qq|
1699 <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
1702 | . $locale->text('Kreditinstitut') . qq|
1704 <input name="FA_Bankbezeichnung_oertlich" size="30" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
1707 | . $locale->text('Kontonummer') . qq|
1709 <input name="FA_Kontonummer_2" size="15" value="$form->{FA_Kontonummer_2}" $readonly>
1712 | . $locale->text('Bankleitzahl') . qq|
1714 <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
1725 . $locale->text('Bankverbindung des Finanzamts') . qq|</b>
1727 | . $locale->text('Kontonummer') . qq|
1729 <input name="FA_Kontonummer_1" size="30" value="$form->{FA_Kontonummer_1}" $readonly>
1732 | . $locale->text('Bankleitzahl (BLZ)') . qq|
1734 <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
1737 | . $locale->text('Kreditinstitut') . qq|
1739 <input name="FA_Bankbezeichnung_1" size="15" value="$form->{FA_Bankbezeichnung_1}" $readonly>
1748 . $locale->text('Bankverbindung des Finanzamts') . qq|</b>
1750 | . $locale->text('Kontonummer') . qq|
1752 <input name="FA_Kontonummer_2" size="30" value="$form->{FA_Kontonummer_2}" $readonly>
1755 | . $locale->text('Bankleitzahl (BLZ)') . qq|
1757 <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
1760 | . $locale->text('Kreditinstitut') . qq|
1762 <input name="FA_Bankbezeichnung_oertlich" size="15" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
1772 $lxdebug->leave_sub();
1775 sub create_winston {
1776 $lxdebug->enter_sub();
1777 &get_config($userspath, 'finanzamt.ini');
1779 # There is no generic Linux GNU/GPL solution out for using ELSTER.
1780 # In lack of availability linux users may use windows pendants. I choose
1781 # WINSTON, because it's free of coast, it has an API and its tested under
1783 # The author of WINSTON developed some c-code to realize ELSTER under
1784 # WINDOWS and Linux (http://www.felfri.de/fa_xml/). Next year (2005) I start to
1785 # develop a server side solution for LX-Office ELSTER under Linux and
1786 # WINDOWS based on this c-code.
1788 # You need to download WINSTON from http://www.felfri.de/winston/
1789 # There (http://www.felfri.de/winston/download.htm) you'll find instructions
1790 # about WINSTON under Linux WINE
1791 # More infos about Winstons API: http://www.felfri.de/winston/schnittstellen.htm
1793 my $file = ''; # Filename for Winstonfile
1794 $file .= 'U'; # 1. char 'U' = USTVA
1797 { # 2. and 3. char 01-12= Month 41-44= Quarter (azr:Abrechnungszeitraum)
1798 $form->{duetyp} eq "01" && do {
1802 $form->{duetyp} eq "02" && do {
1806 $form->{duetyp} eq "03" && do {
1810 $form->{duetyp} eq "04" && do {
1814 $form->{duetyp} eq "05" && do {
1818 $form->{duetyp} eq "06" && do {
1822 $form->{duetyp} eq "07" && do {
1826 $form->{duetyp} eq "08" && do {
1830 $form->{duetyp} eq "09" && do {
1834 $form->{duetyp} eq "10" && do {
1838 $form->{duetyp} eq "11" && do {
1842 $form->{duetyp} eq "12" && do {
1846 $form->{duetyp} eq "A" && do {
1850 $form->{duetyp} eq "B" && do {
1854 $form->{duetyp} eq "C" && do {
1858 $form->{duetyp} eq "D" && do {
1864 "Ungültiger Anmeldezeitraum.\n
1865 Sie können für ELSTER nur einen monatlichen oder
1866 quartalsweisen Anmeldezeitraum auswählen."
1873 #4. and 5. char = year modulo 100
1874 $file .= sprintf("%02d", $form->{year} % 100);
1876 #6. to 18. char = Elstersteuernummer
1877 #Beispiel: Steuernummer in Bayern
1878 #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
1880 $file .= $form->{elsterFFFF};
1881 $file .= $form->{elstersteuernummer};
1886 $form->{elsterfile} = $file;
1891 sprintf("%d", $form->parse_amount(\%myconfig, $form->{"51"}))
1892 ; # Umsätze zu 16% USt
1894 sprintf("%d", $form->parse_amount(\%myconfig, $form->{"86"}))
1895 ; # Umsätze zu 7% USt
1897 sprintf("%d", $form->parse_amount(\%myconfig, $form->{"97"}))
1898 ; # 16% Steuerpflichtige innergemeinsachftliche Erwerbe
1900 sprintf("%d", $form->parse_amount(\%myconfig, $form->{"93"}))
1901 ; # 16% Steuerpflichtige innergemeinsachftliche Erwerbe
1903 sprintf("%d", $form->parse_amount(\%myconfig, $form->{"94"}))
1904 ; # neuer Fahrzeuge von Lieferern
1906 $form->parse_amount(\%myconfig, $form->{"66"}) *
1907 100; # Vorsteuer 7% plus 16%
1909 $form->parse_amount(\%myconfig, $form->{"67"}) * 100; # Umsätze zu 7% USt
1910 my $k96 = $form->parse_amount(\%myconfig, $form->{"96"}) * 100; #
1912 # Now build the xml content
1915 $form->{elster} = qq|<?xml version="1.0" encoding="ISO-8859-1" ?>
1916 <!-- Diese Datei ist mit Lx-Office $form->{version} generiert -->
1918 <Formular Typ="UST"></Formular>
1919 <Ordnungsnummer>$form->{elstersteuernummer}</Ordnungsnummer>
1920 <AnmeldeJahr>$form->{year}</AnmeldeJahr>
1921 <AnmeldeZeitraum>$azr</AnmeldeZeitraum>
1924 $form->{elster} .= qq|<Kennzahl Nr="51">$k51</Kennzahl>\n| if ($k51 ne '0');
1925 $form->{elster} .= qq|<Kennzahl Nr="86">$k86</Kennzahl>\n| if ($k86 ne '0');
1926 $form->{elster} .= qq|<Kennzahl Nr="97">$k97</Kennzahl>\n| if ($k97 ne '0');
1927 $form->{elster} .= qq|<Kennzahl Nr="93">$k93</Kennzahl>\n| if ($k93 ne '0');
1928 $form->{elster} .= qq|<Kennzahl Nr="94">$k94</Kennzahl>\n| if ($k94 ne '0');
1929 $form->{elster} .= qq|<Kennzahl Nr="96">$k96</Kennzahl>\n| if ($k96 ne '0');
1930 $form->{elster} .= qq|<Kennzahl Nr="66">$k66</Kennzahl>\n| if ($k66 ne '0');
1931 $form->{elster} .= qq|<Kennzahl Nr="83">$k83</Kennzahl>\n| if ($k83 ne '0');
1932 $form->{elster} .= qq|\n</WinstonAusgang>\n\n|;
1935 #print qq|$form->{elsterfile}|;
1936 #print qq|$form->{elster}|;
1937 $SIG{INT} = 'IGNORE';
1940 $lxdebug->leave_sub();
1944 $lxdebug->enter_sub();
1945 my $elster = $form->{elster};
1946 my $elsterfile = $form->{elsterfile};
1947 open(OUT, ">-") or $form->error("STDOUT : $!");
1948 print OUT qq|Content-Type: application/file;
1949 Content-Disposition: attachment; filename="$elsterfile"\n\n|;
1952 $lxdebug->leave_sub();
1956 $lxdebug->enter_sub();
1958 # allow Symbolic references just here:
1960 &{ $form->{nextsub} };
1962 $lxdebug->leave_sub();
1966 $lxdebug->enter_sub();
1967 &{ $form->{lastsub} };
1968 $lxdebug->leave_sub();
1972 $lxdebug->enter_sub();
1973 my $finanzamt = USTVA::query_finanzamt(\%myconfig, \%$form);
1974 $lxdebug->leave_sub();
1979 $lxdebug->enter_sub();
1981 # biegt nur den Testeintrag in Programm->Test auf eine Routine um
1985 $lxdebug->leave_sub();
1989 $lxdebug->enter_sub();
1992 my $elster_conf = &elster_conf();
1995 $form->{cwd} = cwd();
1996 $form->{tmpdir} = $form->{cwd} . '/' . $elster_conf->{'path'};
1997 $form->{tmpfile} = $elster_conf->{'err'};
1998 my $caller = $elster_conf->{'call'}[0];
2000 chdir("$form->{tmpdir}") or $form->error($form->cleanup . "chdir : $!");
2002 "faxmlsend $caller -config etc/faxmlsend.cnf -xml faxmlsend.xml -tt faxmlsend.tt -debug";
2004 system("$send > $form->{tmpfile}");
2005 $form->{tmpdir} .= "$elster_conf->{'path'}/";
2006 $form->{tmpfile} = "faxmlsend.err";
2007 $form->error($form->cleanup
2008 . "faxmlsend : OFD meldet: Error 404 \n Internetseite nicht vorhanden")
2010 $form->error($form->cleanup
2011 . "faxmlsend : No such File: faxmlsend.xml \n Fehlernummer: $? \n Problem beim öffnen der faxmlsend.xml"
2015 # foreach my $line (&elster_feedback("$elster_conf->{'path'}")){
2016 # print qq|$line\n|;
2020 #for (my $i=0; $i<= )
2022 print qq|\n ende\n|;
2023 $lxdebug->leave_sub();
2026 sub elster_readlog {
2027 $lxdebug->enter_sub();
2028 my $elster_conf = &elster_conf();
2029 open(LOG, "$elster_conf->{'logfile'}")
2030 or $form->error("$elster_conf->{'logfile'}: $!");
2031 print qq|<listing>|;
2042 #$_ =~ s/\015\012//mg;
2046 if ($_ =~ /^\d\d\d\d\d\d/g) {
2049 #} elsif ($_ =~ /(<([^\/]*?)>)/ ) {
2050 } elsif ($_ =~ /(<([^\/].*?)>(.*))/g) {
2052 #$xml .= qq|$2 = $3\n\n|;
2053 #$_ =~ s/\015\012//mg;
2066 # $var .= qq|$2 = $3\n\n|;
2070 print qq|</listing>|;
2073 # s{<(\w+)\b([^<>]*)>
2074 # ((?:.(?!</?\1\b))*.)
2076 # { print "markup=",$1," args=",$2," enclosed=",$3," final=",$4 ; "" }gsex;
2078 $lxdebug->leave_sub();
2081 sub elster_feedback {
2082 $lxdebug->enter_sub();
2085 print qq|feedback:<br>|;
2091 $lxdebug->leave_sub();
2096 $lxdebug->enter_sub();
2097 my $elster_conf = { 'path' => 'elster',
2098 'prg' => 'faxmlsend',
2099 'err' => 'faxmlsend.err',
2100 'ttfile' => 'faxmlsend.tt',
2101 'xmlfile' => 'faxmlsend.xml',
2102 'cline' => '-tt $ttfile -xml $xmlfile',
2103 'call' => ['send', 'protokoll', 'anmeldesteuern'],
2104 'logfile' => 'log/faxmlsend.log',
2105 'conffile' => 'faxmlsend.cnf',
2106 'debug' => '-debug' };
2107 $lxdebug->leave_sub();
2108 return $elster_conf;
2113 $lxdebug->enter_sub();
2114 my $elster_conf = &elster_conf();
2116 # $k51 = sprintf("%d", $form->parse_amount(\%myconfig, $form->{"51"})); # Umsätze zu 16% USt
2117 # $k86 = sprintf("%d", $form->parse_amount(\%myconfig, $form->{"86"})); # Umsätze zu 7% USt
2118 # $k97 = sprintf("%d", $form->parse_amount(\%myconfig, $form->{"97"})); # 16% Steuerpflichtige innergemeinsachftliche Erwerbe
2119 # $k93 = sprintf("%d", $form->parse_amount(\%myconfig, $form->{"93"})); # 16% Steuerpflichtige innergemeinsachftliche Erwerbe
2120 # $k94 = sprintf("%d", $form->parse_amount(\%myconfig, $form->{"94"})); # neuer Fahrzeuge von Lieferern
2121 # $k66 = $form->parse_amount(\%myconfig, $form->{"66"}) * 100;# Vorsteuer 7% plus 16%
2122 # $k83 = $form->parse_amount(\%myconfig, $form->{"67"}) * 100;# Umsätze zu 7% USt
2123 # $k96 = $form->parse_amount(\%myconfig, $form->{"96"}) * 100;#
2125 my $TransferHeader = qq|<?xml version="1.0" encoding="ISO-8859-1"?>
2126 <?xml-stylesheet type="text/xsl" href="..\\Stylesheet\\ustva.xsl"?>
2127 <Elster xmlns="http://www.elster.de/2002/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.elster.de/2002/XMLSchema
2128 ..\\Schemata\\elster_UStA_200501_extern.xsd">
2129 <TransferHeader version="7">
2130 <Verfahren>ElsterAnmeldung</Verfahren>
2131 <DatenArt>UStVA</DatenArt>
2132 <Vorgang>send-NoSig</Vorgang>
2133 <Testmerker>700000004</Testmerker>
2134 <HerstellerID>74931</HerstellerID>
2135 <DatenLieferant>Helmut</DatenLieferant>
2137 <Verschluesselung>PKCS#7v1.5</Verschluesselung>
2138 <Kompression>GZIP</Kompression>
2139 <DatenGroesse>123456789012345678901234567890123456789012</DatenGroesse>
2140 <TransportSchluessel/>
2161 <NutzdatenHeader version="9">
2162 <NutzdatenTicket>234234234</NutzdatenTicket>
2163 <Empfaenger id="F">9198</Empfaenger>
2165 <ProduktName>ElsterAnmeldung</ProduktName>
2166 <ProduktVersion>V 1.4</ProduktVersion>
2168 <DatenLieferant>String, der Lieferanteninfo enthaelt</DatenLieferant>
2174 <!--die Version gibt Auskunft ueber das Jahr und die derzeit gueltige Versionsnummer-->
2175 <Anmeldungssteuern art="UStVA" version="200501">
2177 <Name>OFD Muenchen</Name>
2178 <Strasse>Meiserstr. 6</Strasse>
2182 <Erstellungsdatum>20041127</Erstellungsdatum>
2184 <Umsatzsteuervoranmeldung>
2186 <Zeitraum>01</Zeitraum>
2187 <Steuernummer>9198011310134</Steuernummer>
2188 <Kz09>74931*NameSteuerber.*Berufsbez.*089*59958327*Mandantenname</Kz09>
2189 </Umsatzsteuervoranmeldung>
2191 </Anmeldungssteuern>
2197 #$DatenTeil .= qq| <Kz51>$k51</Kz51>\n| if ($k51 ne '0');
2198 #$DatenTeil .= qq| <Kz86>$k86</Kz86>\n| if ($k86 ne '0');
2199 #$DatenTeil .= qq| <Kz97>$k97</Kz97>\n| if ($k97 ne '0');
2200 #$DatenTeil .= qq| <Kz93>$k93</Kz93>\n| if ($k93 ne '0');
2201 #$DatenTeil .= qq| <Kz94>$k94</Kz94>\n| if ($k94 ne '0');
2202 #$DatenTeil .= qq| <Kz96>$k96</Kz96>\n| if ($k96 ne '0');
2203 #$DatenTeil .= qq| <Kz66>$k66</Kz66>\n| if ($k66 ne '0');
2204 #$DatenTeil .= qq| <Kz83>$k83</Kz83>\n| if ($k83 ne '0');
2206 my $filename = "$elster_conf->{'path'}/$elster_conf->{'xmlfile'}";
2207 open(XML, ">$elster_conf->{'path'}/$elster_conf->{'xmlfile'}")
2208 or $form->error("$filename : $!");
2209 print XML qq|$TransferHeader $DatenTeil|;
2211 $lxdebug->leave_sub();