1 #=====================================================================
3 # Copyright (c) 2004 by Udo Spallek, Aachen
7 # Web: http://www.lx-office.org
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 #======================================================================
24 # German Tax authority Module and later ELSTER Interface
25 # 08.01.14 ELSTER Interface software (taxbird/winston) removed
26 #======================================================================
31 require "bin/mozilla/common.pl";
33 use List::Util qw(first);
39 use SL::Locale::String qw(t8);
42 # this is for our long dates
43 # $locale->text('January')
44 # $locale->text('February')
45 # $locale->text('March')
46 # $locale->text('April')
47 # $locale->text('May ')
48 # $locale->text('June')
49 # $locale->text('July')
50 # $locale->text('August')
51 # $locale->text('September')
52 # $locale->text('October')
53 # $locale->text('November')
54 # $locale->text('December')
56 # this is for our short month
57 # $locale->text('Jan')
58 # $locale->text('Feb')
59 # $locale->text('Mar')
60 # $locale->text('Apr')
61 # $locale->text('May')
62 # $locale->text('Jun')
63 # $locale->text('Jul')
64 # $locale->text('Aug')
65 # $locale->text('Sep')
66 # $locale->text('Oct')
67 # $locale->text('Nov')
68 # $locale->text('Dec')
70 #############################
73 $::lxdebug->enter_sub();
76 my $locale = $::locale;
77 my %myconfig = %::myconfig;
79 $::auth->assert('advance_turnover_tax_return');
81 my $defaults = SL::DB::Default->get;
82 $form->{title} = $locale->text('UStVA');
83 $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0
85 my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig ),
91 setup_ustva_report_action_bar();
94 # Einlesen der Finanzamtdaten
95 my $ustva = USTVA->new();
97 $ustva->get_finanzamt();
99 # Hier Einlesen der user-config
100 # steuernummer entfernt für prerelease
103 tel fax email co_chief co_department
104 co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
105 co_name1 co_name2 co_street co_street1 co_zip
106 co_city co_city1 co_country co_tel co_tel1
107 co_tel2 co_fax co_fax1 co_email co_email1
108 co_url co_url1 co_bankname
109 co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
110 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2
114 $form->{$_} = $myconfig{$_} for @a;
116 my $openings = $form->{fa_oeffnungszeiten};
117 $openings =~ s/\\\\n/<br>/g;
119 my $company_given = ($form->{company} ne '')
120 ? qq|<h3>$form->{company}</h3>\n|
121 : qq|<a href="controller.pl?action=ClientConfig/edit">|
122 . $locale->text('No Company Name given') . qq|!</a><br>|;
125 # Anpassungen der Variablennamen auf pre 2.1.1 Namen
126 # klären, ob $form->{company_street|_address} gesetzt sind
127 if ($form->{address} ne '') {
128 my $temp = $form->{address};
129 $temp =~ s/\n/<br \/>/;
130 ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp);
131 $form->{co_city} =~ s/\n//g;
136 ($form->{co_street} && ($form->{co_zip} || $form->{co_city}))
137 ? qq|$form->{co_street}<br>|
138 . qq|$form->{co_street1}<br>|
139 . qq|$form->{co_zip} $form->{co_city}|
140 : qq|<a href="controller.pl?action=ClientConfig/edit">|
141 . $locale->text('No Company Address given')
144 $form->{co_email} = $form->{email} unless $form->{co_email};
145 $form->{co_tel} = $form->{tel} unless $form->{co_tel};
146 $form->{co_fax} = $form->{fax} unless $form->{co_fax};
147 $form->{co_url} = $form->{urlx} unless $form->{co_url};
149 my $taxnumber_given = ($form->{taxnumber} ne '') ? $form->{taxnumber} : qq|<a href="ustva.pl?action=config_step1">Keine Steuernummer hinterlegt!</a><br>|;
150 my $fa_name_given = ($form->{fa_name} ne '') ? $form->{fa_name} : qq|<a href="ustva.pl?action=config_step1">Kein Finanzamt hinterlegt!</a><br>|;
151 my $ustva_vorauswahl = &ustva_vorauswahl();
153 my @all_years = $form->all_years(\%myconfig);
155 my $select_year = qq|<select name=year title="|
156 . $locale->text('Year') . qq|">|;
157 foreach my $key (@all_years) {
158 $select_year .= qq|<option |;
159 $select_year .= qq|selected| if ($key eq $form->{year});
160 $select_year .= qq| >$key</option>|;
162 $select_year .= qq|</select>|;
165 $_checked = "checked" if ($form->{kz10} eq '1');
166 my $checkbox_kz_10 = qq|<input name="FA_10" id=FA_10 class=checkbox|
167 . qq| type=checkbox value="1" $_checked title = "|
168 . $locale->text('Amended Advance Turnover Tax Return').'(Nr. 10)'
170 . $locale->text('Amended Advance Turnover Tax Return');
172 $_checked = "checked" if ($form->{kz22} eq '1');
173 my $checkbox_kz_22 = qq|<input name="FA_22" id=FA_22 class=checkbox|
174 . qq| type=checkbox value="1" $_checked title = "|
175 . $locale->text('Receipts attached/extra').'(Nr. 22)'
177 . $locale->text('Receipts attached/extra');
179 $_checked = "checked" if ($form->{kz29} eq '1');
180 my $checkbox_kz_29 = qq|<input name="FA_29" id=FA_29 class=checkbox|
181 . qq| type=checkbox value="1" $_checked title = "|
182 . $locale->text('Accounting desired').'(Nr. 29)'
184 . $locale->text('Accounting desired');
186 $_checked = "checked" if ($form->{kz26} eq '1');
187 my $checkbox_kz_26 = qq|<input name="FA_26" id=FA_26 class=checkbox|
188 . qq| type=checkbox value="1" $_checked title = "|
189 . $locale->text('Direct debit revoked').'(Nr. 26)'
191 . $locale->text('Direct debit revoked');
193 my $method_local = ($form->{accounting_method} eq 'accrual') ? $locale->text('accrual')
194 : ($form->{accounting_method} eq 'cash') ? $locale->text('cash')
197 my $period_local = ( $form->{fa_voranmeld} eq 'month') ? $locale->text('month')
198 : ( $form->{fa_voranmeld} eq 'quarter') ? $locale->text('quarter')
201 my @tax_office_banks_ref = (
202 { BLZ => $form->{fa_blz_1},
203 Kontonummer => $form->{fa_kontonummer_1},
204 Bankbezeichnung => $form->{fa_bankbezeichnung_1}
206 { BLZ => $form->{fa_blz_2},
207 Kontonummer => $form->{fa_kontonummer_2},
208 Bankbezeichnung => $form->{fa_bankbezeichnung_2}
212 $ustva->get_coa($form); # fetches coa and modifies some form variables
215 openings => $openings,
216 company_given => $company_given,
217 address_given => $address_given,
218 taxnumber_given => $taxnumber_given,
219 fa_name_given => $fa_name_given,
220 taxnumber => $defaults->taxnumber,
221 select_year => $select_year,
222 period_local => $period_local,
223 method_local => $method_local,
224 ustva_vorauswahl => $ustva_vorauswahl,
225 checkbox_kz_10 => $checkbox_kz_10,
226 checkbox_kz_22 => $checkbox_kz_22,
227 checkbox_kz_29 => $checkbox_kz_29,
228 checkbox_kz_26 => $checkbox_kz_26,
229 tax_office_banks => \@tax_office_banks_ref,
230 select_options => &show_options,
234 print($form->parse_html_template('ustva/report', $template_ref));
236 $::lxdebug->leave_sub();
240 sub ustva_vorauswahl {
241 $::lxdebug->enter_sub();
244 my $locale = $::locale;
245 my %myconfig = %::myconfig;
247 $::auth->assert('advance_turnover_tax_return');
249 my $select_vorauswahl;
251 #Aktuelles Datum zerlegen:
252 my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig);
254 #$locale->date($myconfig, $form->current_date($myconfig), 0)=~ /(\d\d).(\d\d).(\d\d\d\d)/;
255 $form->{day} = substr($date, 6, 2);
256 $form->{month} = substr($date, 4, 2);
257 $form->{year} = substr($date, 0, 4);
258 $::lxdebug->message(LXDebug->DEBUG1, qq|
259 Actual date from Database: $date\n
260 Actual year from Database: $form->{year}\n
261 Actual day from Database: $form->{day}\n
262 Actual month from Database: $form->{month}\n|);
267 # Testdaten erzeugen:
269 #$form->{month}= '01';
270 #$form->{year}= 2004;
271 $select_vorauswahl = qq|
272 <input type="hidden" name="day" value="$form->{day}">
273 <input type="hidden" name="month" value="$form->{month}">
274 <input type="hidden" name="yymmdd" value="$yymmdd">
275 <input type="hidden" name="sel" value="$sel">
278 if ($form->{fa_voranmeld} eq 'month') {
280 # Vorauswahl bei monatlichem Voranmeldungszeitraum
282 my %liste = ('01' => $locale->text('January'),
283 '02' => $locale->text('February'),
284 '03' => $locale->text('March'),
285 '04' => $locale->text('April'),
286 '05' => $locale->text('May'),
287 '06' => $locale->text('June'),
288 '07' => $locale->text('July'),
289 '08' => $locale->text('August'),
290 '09' => $locale->text('September'),
291 '10' => $locale->text('October'),
292 '11' => $locale->text('November'),
293 '12' => $locale->text('December'),
294 '13' => $locale->text('Yearly'),
297 my $yy = $form->{year} * 10000;
298 $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
302 # Offset für Dauerfristverlängerung
303 $dfv = '100' if ($form->{fa_dauerfrist} eq '1');
306 $yymmdd <= ($yy + 110 + $dfv) && do {
307 $form->{year} = $form->{year} - 1;
311 $yymmdd <= ($yy + 210 + $dfv) && do {
315 $yymmdd <= ($yy + 310 + $dfv) && do {
319 $yymmdd <= ($yy + 410 + $dfv) && do {
323 $yymmdd <= ($yy + 510 + $dfv) && do {
327 $yymmdd <= ($yy + 610 + $dfv) && do {
331 $yymmdd <= ($yy + 710 + $dfv) && do {
335 $yymmdd <= ($yy + 810 + $dfv) && do {
339 $yymmdd <= ($yy + 910 + $dfv) && do {
343 $yymmdd <= ($yy + 1010 + $dfv) && do {
347 $yymmdd <= ($yy + 1110 + $dfv) && do {
351 $yymmdd <= ($yy + 1210) && do {
355 $yymmdd <= ($yy + 1231) && do {
361 $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
362 . $locale->text('Select a period') . qq|" >|;
365 foreach $key (sort keys %liste) {
367 $selected = 'selected' if ($sel eq $key);
368 $select_vorauswahl .= qq|
369 <option value="$key" $selected> $liste{$key}</option>
372 $select_vorauswahl .= qq|</select>|;
374 } elsif ($form->{fa_voranmeld} eq 'quarter') {
376 # Vorauswahl bei quartalsweisem Voranmeldungszeitraum
377 my %liste = ('41' => $locale->text('1. Quarter'),
378 '42' => $locale->text('2. Quarter'),
379 '43' => $locale->text('3. Quarter'),
380 '44' => $locale->text('4. Quarter'),
381 '13' => $locale->text('Yearly'),);
383 my $yy = $form->{year} * 10000;
384 $yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
386 my $dfv = ''; # Offset für Dauerfristverlängerung
387 $dfv = '100' if ($form->{fa_dauerfrist} eq '1');
390 $yymmdd <= ($yy + 110 + $dfv) && do {
391 $form->{year} = $form->{year} - 1;
395 $yymmdd <= ($yy + 410 + $dfv) && do {
399 $yymmdd <= ($yy + 710 + $dfv) && do {
403 $yymmdd <= ($yy + 1010 + $dfv) && do {
407 $yymmdd <= ($yy + 1231) && do {
412 $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
413 . $locale->text('Select a period') . qq|" >|;
415 foreach $key (sort keys %liste) {
417 $selected = 'selected' if ($sel eq $key);
418 $select_vorauswahl .= qq|
419 <option value="$key" $selected>$liste{$key}</option>
422 $select_vorauswahl .= qq|\n</select>
427 # keine Vorauswahl bei Voranmeldungszeitraum
428 $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
429 . $locale->text('Select a period') . qq|" >|;
431 my %listea = ('41' => '1. Quarter',
432 '42' => '2. Quarter',
433 '43' => '3. Quarter',
434 '44' => '4. Quarter',);
436 my %listeb = ('01' => 'January',
450 foreach $key (sort keys %listea) {
451 $select_vorauswahl .= qq|
452 <option value="$key">|
453 . $locale->text("$listea{$key}")
457 foreach $key (sort keys %listeb) {
458 $select_vorauswahl .= qq|
459 <option value="$key">|
460 . $locale->text("$listeb{$key}")
463 $select_vorauswahl .= qq|</select>|;
465 $::lxdebug->leave_sub();
467 return $select_vorauswahl;
471 $::lxdebug->enter_sub();
473 $::auth->assert('advance_turnover_tax_return');
475 # $form->{PD}{$form->{type}} = "selected";
476 # $form->{DF}{$form->{format}} = "selected";
477 # $form->{OP}{$form->{media}} = "selected";
478 # $form->{SM}{$form->{sendmode}} = "selected";
479 my $type = qq| <input type=hidden name="type" value="ustva">|;
480 my $media = qq| <input type=hidden name="media" value="screen">|;
482 qq| <option value=html selected>|
483 . $::locale->text('HTML')
486 #my $disabled= qq|disabled="disabled"|;
487 #$disabled='' if ($form->{elster} eq '1' );
488 #if ($::form->{elster} eq '1') {
491 qq|<option value=elstertaxbird>|
492 . $::locale->text('ELSTER Export (via Geierlein)')
496 my $show_options = qq|
499 <select name=format title = "|
500 . $::locale->text('Choose Outputformat') . qq|">$format</select>
502 $::lxdebug->leave_sub();
504 return $show_options;
508 $::lxdebug->enter_sub();
511 my $locale = $::locale;
512 my %myconfig = %::myconfig;
514 $::auth->assert('advance_turnover_tax_return');
516 my $defaults = SL::DB::Default->get;
518 my $ustva = USTVA->new();
519 $ustva->get_config();
520 $ustva->get_finanzamt();
522 # Setze Anmeldungszeitraum
524 $ustva->set_FromTo(\%$form);
527 $ustva->ustva(\%myconfig, \%$form);
529 # reformat Dates to dateformat
530 $form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
532 $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
533 $form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
535 $form->{longperiod} =
536 $locale->date(\%myconfig, $form->current_date(\%myconfig), 1, 0, 0);
538 # if there are any dates construct a where
539 if ($form->{fromdate} || $form->{todate}) {
541 $form->{todate} = $form->current_date(\%myconfig) unless ($form->{todate});
543 my $longtodate = $locale->date(\%myconfig, $form->{todate}, 1, 0, 0);
544 my $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
546 my $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1, 0, 0);
547 my $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
549 $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
550 $form->{longperiod} =
551 $locale->text('for Period')
552 . qq|<br>\n$longfromdate |
553 . $locale->text('to (date)')
557 if ($form->{comparefromdate} || $form->{comparetodate}) {
558 my $longcomparefromdate =
559 $locale->date(\%myconfig, $form->{comparefromdate}, 1, 0, 0);
560 my $shortcomparefromdate =
561 $locale->date(\%myconfig, $form->{comparefromdate}, 0, 0, 0);
563 my $longcomparetodate =
564 $locale->date(\%myconfig, $form->{comparetodate}, 1, 0, 0);
565 my $shortcomparetodate =
566 $locale->date(\%myconfig, $form->{comparetodate}, 0, 0, 0);
568 $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
569 $form->{longperiod} .=
570 "<br>\n$longcomparefromdate "
571 . $locale->text('to (date)')
572 . qq| $longcomparetodate|;
575 $form->{Datum_heute} =
576 $locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
578 # setup variables for the form
579 my @a = qw(tel fax email
580 co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
581 co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
582 co_fax co_fax1 co_email co_email1 co_url co_url1
583 co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
584 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3);
586 $form->{$_} = $myconfig{$_} for @a;
587 $form->{$_} = $defaults->$_ for qw(company address co_ustid duns);
589 if ($form->{address} ne '') {
590 my $temp = $form->{address};
591 $temp =~ s/\n/<br \/>/;
592 ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp,2);
593 $form->{co_city} =~ s/\\n//g;
597 $form->{amount} = [];
599 if ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
601 $form->{IN} = $form->{type} . '.html';
602 $form->{padding} = " ";
603 $form->{bold} = "<b>";
604 $form->{endbold} = "</b>";
605 $form->{br} = "<br>";
606 $form->{address} =~ s/\\n/\n/g;
608 foreach my $number (@{$::form->{category_cent}}) {
609 $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
612 foreach my $number (@{$::form->{category_euro}}) {
613 $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
615 } else { # we have only html
617 USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
618 $::dispatcher->end_request;
620 if ( $form->{period} eq '13' and $form->{format} ne 'html') {
624 'Yearly taxreport not yet implemented')
628 # add a prefix for ustva pos numbers, i.e.: 81 -> post_ustva_81
629 $form->{"pos_ustva_$_"} = $form->{$_} for grep { m{^\d+} } keys %{ $form };
630 $form->{title} = $locale->text('Advance turnover tax return');
633 print $form->parse_html_template('ustva/ustva');
635 $::lxdebug->leave_sub();
639 $::lxdebug->enter_sub();
641 $::auth->assert('advance_turnover_tax_return');
643 $::form->{title} = $::locale->text('Tax Office Preferences');
645 # edit all taxauthority prefs
647 setup_ustva_config_step1_action_bar();
651 my $ustva = USTVA->new();
652 $ustva->get_config();
653 $ustva->get_finanzamt();
655 my $land = $::form->{fa_land_nr};
656 my $amt = $::form->{fa_bufa_nr};
659 $::form->{title} = $::locale->text('Tax Office Preferences');
662 my $select_tax_office = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%::myconfig, $::form));
663 my $method_local = ($::form->{accounting_method} eq 'accrual') ? $::locale->text('accrual')
664 : ($::form->{accounting_method} eq 'cash') ? $::locale->text('cash')
667 my $checked_monthly = $::form->{fa_voranmeld} eq 'month' ? "checked" : '';
668 my $checked_quarterly = $::form->{fa_voranmeld} eq 'quarter' ? "checked" : '';
669 my $checked_dauerfristverlaengerung = $::form->{da_dauerfrist} eq '1' ? "checked" : '';
671 my $_hidden_variables_ref;
673 my %_hidden_local_variables = (
674 'saved' => $::locale->text('Check Details'),
677 foreach my $variable (keys %_hidden_local_variables) {
678 push @{ $_hidden_variables_ref },
679 { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
682 my @_hidden_form_variables = $ustva->get_fiamt_vars();
683 push @_hidden_form_variables ,qw(fa_bufa_nr taxnumber accounting_method coa);
685 foreach my $variable (@_hidden_form_variables) {
686 push @{ $_hidden_variables_ref},
687 { 'variable' => $variable, 'value' => $::form->{$variable} };
690 $ustva->get_coa($::form); # fetches coa and modifies some form variables
692 # Variablen für das Template zur Verfügung stellen
694 select_tax_office => $select_tax_office,
695 method_local => $method_local,
696 checked_monthly => $checked_monthly,
697 checked_quarterly => $checked_quarterly,
698 checked_dauerfristverlaengerung => $checked_dauerfristverlaengerung,
699 hidden_variables => $_hidden_variables_ref,
703 # Ausgabe des Templates
704 print($::form->parse_html_template('ustva/config_step1', $template_ref));
706 $::lxdebug->leave_sub();
710 $::lxdebug->enter_sub();
713 my $locale = $::locale;
714 my %myconfig = %::myconfig;
716 $::auth->assert('advance_turnover_tax_return');
718 setup_ustva_config_step2_action_bar();
725 my $ustva = USTVA->new();
726 $ustva->get_config() if ($form->{saved} eq $locale->text('saved'));
727 my $coa = $::form->{coa};
728 $form->{"COA_$coa"} = '1';
729 $form->{COA_Germany} = '1' if ($coa =~ m/^germany/i);
730 $ustva->get_finanzamt();
733 # Auf Übergabefehler checken
734 USTVA::info( $locale->text('Missing Tax Authoritys Preferences') . "\n"
735 . $locale->text('USTVA-Hint: Tax Authoritys'))
736 if ( $form->{fa_bufa_nr_new} eq 'Auswahl'
737 || $form->{fa_land_nr_new} eq 'Auswahl');
738 USTVA::info( $locale->text('Missing Method!') . "\n"
739 . $locale->text('USTVA-Hint: Method'))
740 if ($form->{accounting_method} eq '');
742 # Klären, ob Variablen bereits befüllt sind UND ob veränderungen auf
743 # der vorherigen Maske stattfanden: $change = 1(in der edit sub,
744 # mittels get_config)
746 # $::lxdebug->message(LXDebug->DEBUG2,"land old=".$form->{fa_land_nr}." new=".$form->{fa_land_nr_new});
747 # $::lxdebug->message(LXDebug->DEBUG2,"bufa old=".$form->{fa_bufa_nr}." new=".$form->{fa_bufa_nr_new});
748 my $change = $form->{fa_land_nr} eq $form->{fa_land_nr_new}
749 && $form->{fa_bufa_nr} eq $form->{fa_bufa_nr_new} ? '0' : '1';
750 $change = '0' if ($form->{saved} eq $locale->text('saved'));
753 if ($change eq '1') {
756 $fa_land_nr = $form->{fa_land_nr_new};
757 $fa_bufa_nr = $form->{fa_bufa_nr_new};
758 $form->{fa_land_nr} = $fa_land_nr;
759 $form->{fa_bufa_nr} = $fa_bufa_nr;
760 $form->{taxnumber} = '';
762 create_steuernummer();
765 $ustva->get_finanzamt();
769 $fa_land_nr = $form->{fa_land_nr};
770 $fa_bufa_nr = $form->{fa_bufa_nr};
773 # $::lxdebug->message(LXDebug->DEBUG2, "form stnr=".$form->{taxnumber}." fa_bufa_nr=".$fa_bufa_nr.
774 # " pattern=".$form->{elster_pattern}." fa_land_nr=".$fa_land_nr);
775 my $stnr = $form->{taxnumber};
777 my $taxnumber = $stnr eq '' ? $form->{taxnumber} : '';
779 $form->{fa_oeffnungszeiten} =~ s/\\\\n/\n/g;
782 $ustva->get_coa($form); # fetches coa and modifies some form variables
784 my $input_steuernummer = $ustva->steuernummer_input(
790 # $::lxdebug->message(LXDebug->DEBUG2, qq|$input_steuernummer|);
793 my $_hidden_variables_ref;
795 my %_hidden_local_variables = (
796 'fa_land_nr' => $fa_land_nr,
797 'fa_bufa_nr' => $fa_bufa_nr,
798 'taxnumber' => $stnr,
799 'lastsub' => 'config_step1',
804 foreach my $variable (keys %_hidden_local_variables) {
805 push @{ $_hidden_variables_ref },
806 { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
809 my @_hidden_form_variables = qw(
810 fa_dauerfrist fa_steuerberater_city fa_steuerberater_name
811 fa_steuerberater_street fa_steuerberater_tel
812 fa_voranmeld fa_dauerfrist
818 foreach my $variable (@_hidden_form_variables) {
819 push @{ $_hidden_variables_ref},
820 { 'variable' => $variable, 'value' => $form->{$variable} };
824 input_steuernummer => $input_steuernummer,
825 readonly => '', #q|disabled="disabled"|,
826 COA_Germany => $form->{COA_Germany},
827 hidden_variables => $_hidden_variables_ref,
830 # Ausgabe des Templates
831 print($form->parse_html_template('ustva/config_step2', $template_ref));
834 $::lxdebug->leave_sub();
837 sub create_steuernummer {
838 $::lxdebug->enter_sub();
840 $::auth->assert('advance_turnover_tax_return');
842 my $part = $::form->{part};
843 my $patterncount = $::form->{patterncount};
844 my $delimiter = $::form->{delimiter1};
845 my $elster_pattern = $::form->{elster_pattern};
848 # es gibt eine gespeicherte steuernummer $form->{taxnumber}
849 # und die parts und delimiter
854 my $taxnumber_new = $part;
856 for ($h = 1; $h < $patterncount; $h++) {
857 $delimiter = $::form->{delimiter2} if $h > 1;
858 $taxnumber_new .= qq|$delimiter|;
859 for (my $i = 1; $i <= length($elster_pattern); $i++) {
860 $taxnumber_new .= $::form->{"part_$h\_$i"};
863 # $::lxdebug->message(LXDebug->DEBUG2, "oldstnr=".$::form->{taxnumber}." newstnr=".$taxnumber_new);
864 if ($::form->{taxnumber} ne $taxnumber_new) {
865 $::form->{taxnumber} = $taxnumber_new;
866 $::form->{taxnumber_new} = $taxnumber_new;
868 $::form->{taxnumber_new} = '';
870 $::lxdebug->leave_sub();
874 $::lxdebug->enter_sub();
876 $::auth->assert('advance_turnover_tax_return');
878 #zuerst die steuernummer aus den part, parts_X_Y und delimiter herstellen
879 create_steuernummer();
881 # Textboxen formatieren: Linebreaks entfernen
883 $::form->{fa_oeffnungszeiten} =~ s/\r\n/\\n/g;
885 #URL mit http:// davor?
886 $::form->{fa_internet} =~ s/^http:\/\///;
887 $::form->{fa_internet} = 'http://' . $::form->{fa_internet};
889 # Hier kommt dann die Plausibilitätsprüfung der ELSTERSteuernummer TODO ??
891 my $ustva = USTVA->new();
892 $ustva->save_config();
894 #$::form->{elster} = '1';
895 $::form->{saved} = $::locale->text('saved');
899 $::form->{saved} = $::locale->text('Choose a Tax Number');
903 $::lxdebug->leave_sub();
908 $::lxdebug->enter_sub();
910 # allow Symbolic references just here:
911 call_sub($::form->{"nextsub"});
912 $::lxdebug->leave_sub();
916 $::lxdebug->enter_sub();
917 call_sub($::form->{"lastsub"});
918 $::lxdebug->leave_sub();
921 sub setup_ustva_report_action_bar {
922 for my $bar ($::request->layout->get('actionbar')) {
926 submit => [ '#form_do', { action => 'generate_ustva' } ],
927 accesskey => 'enter',
931 call => [ 'sendGeierlein' ],
932 disabled => !length($::lx_office_conf{paths}{geierlein_path} // '') ? t8('The Geierlein path has not been set in the configuration.') : undef,
933 tooltip => t8('Transfer data to Geierlein ELSTER application'),
939 sub setup_ustva_config_step1_action_bar {
940 for my $bar ($::request->layout->get('actionbar')) {
944 submit => [ '#form', { action => 'config_step2' } ],
945 accesskey => 'enter',
951 sub setup_ustva_config_step2_action_bar {
952 for my $bar ($::request->layout->get('actionbar')) {
956 submit => [ '#form', { action => 'save' } ],
957 accesskey => 'enter',
961 call => [ 'kivi.history_back' ],