kivitendo/bin/mozilla/ustva.pl @ 88a171df
d319704a | Moritz Bunkus | #=====================================================================
|
||
008c2e15 | Moritz Bunkus | # kivitendo ERP
|
||
d319704a | Moritz Bunkus | # Copyright (c) 2004 by Udo Spallek, Aachen
|
||
#
|
||||
# Author: Udo Spallek
|
||||
# Email: udono@gmx.net
|
||||
# Web: http://www.lx-office.org
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
f7b15d43 | Christian Wittmer | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
# MA 02110-1335, USA.
|
||||
d319704a | Moritz Bunkus | #======================================================================
|
||
# German Tax authority Module and later ELSTER Interface
|
||||
127b0df3 | Jan Büren | # 08.01.14 ELSTER Interface software (taxbird/winston) removed
|
||
d319704a | Moritz Bunkus | #======================================================================
|
||
1b026c0b | Sven Schöling | use strict;
|
||
05c6840d | Moritz Bunkus | use utf8;
|
||
40782548 | Moritz Bunkus | require "bin/mozilla/common.pl";
|
||
d319704a | Moritz Bunkus | |||
f8779cd3 | Moritz Bunkus | use List::Util qw(first);
|
||
2e66dde5 | Moritz Bunkus | use SL::DB::Default;
|
||
d319704a | Moritz Bunkus | use SL::RP;
|
||
use SL::USTVA;
|
||||
use SL::User;
|
||||
7b9ad004 | Moritz Bunkus | use SL::Locale::String qw(t8);
|
||
d319704a | Moritz Bunkus | 1;
|
||
# this is for our long dates
|
||||
# $locale->text('January')
|
||||
# $locale->text('February')
|
||||
# $locale->text('March')
|
||||
# $locale->text('April')
|
||||
# $locale->text('May ')
|
||||
# $locale->text('June')
|
||||
# $locale->text('July')
|
||||
# $locale->text('August')
|
||||
# $locale->text('September')
|
||||
# $locale->text('October')
|
||||
# $locale->text('November')
|
||||
# $locale->text('December')
|
||||
# this is for our short month
|
||||
# $locale->text('Jan')
|
||||
# $locale->text('Feb')
|
||||
# $locale->text('Mar')
|
||||
# $locale->text('Apr')
|
||||
# $locale->text('May')
|
||||
# $locale->text('Jun')
|
||||
# $locale->text('Jul')
|
||||
# $locale->text('Aug')
|
||||
# $locale->text('Sep')
|
||||
# $locale->text('Oct')
|
||||
# $locale->text('Nov')
|
||||
# $locale->text('Dec')
|
||||
a205ed21 | Udo Spallek | |||
d319704a | Moritz Bunkus | #############################
|
||
sub report {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
a205ed21 | Udo Spallek | |||
0279167d | Sven Schöling | my $form = $::form;
|
||
my $locale = $::locale;
|
||||
my %myconfig = %::myconfig;
|
||||
8c7e4493 | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
6c0e5cb7 | Moritz Bunkus | |||
cd417762 | Moritz Bunkus | my $defaults = SL::DB::Default->get;
|
||
d319704a | Moritz Bunkus | $form->{title} = $locale->text('UStVA');
|
||
6c0e5cb7 | Moritz Bunkus | $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0
|
||
d319704a | Moritz Bunkus | |||
6ab3da45 | Udo Spallek | my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig ),
|
||
0, 4);
|
||||
d319704a | Moritz Bunkus | |||
my $department = '';
|
||||
0279167d | Sven Schöling | my $hide = '';
|
||
7b9ad004 | Moritz Bunkus | |||
setup_ustva_report_action_bar();
|
||||
d319704a | Moritz Bunkus | $form->header;
|
||
# Einlesen der Finanzamtdaten
|
||||
f8779cd3 | Moritz Bunkus | my $ustva = USTVA->new();
|
||
a68089fb | Martin Helmling | $ustva->get_config();
|
||
$ustva->get_finanzamt();
|
||||
081a4f97 | Moritz Bunkus | |||
4dd73ccf | Stephan Köhler | # Hier Einlesen der user-config
|
||
05c6840d | Moritz Bunkus | # steuernummer entfernt für prerelease
|
||
a205ed21 | Udo Spallek | my @a = qw(
|
||
cd417762 | Moritz Bunkus | signature name
|
||
9fb8eec8 | Moritz Bunkus | tel fax email co_chief co_department
|
||
a205ed21 | Udo Spallek | co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
|
||
9fb8eec8 | Moritz Bunkus | co_name1 co_name2 co_street co_street1 co_zip
|
||
co_city co_city1 co_country co_tel co_tel1
|
||||
a205ed21 | Udo Spallek | co_tel2 co_fax co_fax1 co_email co_email1
|
||
cd417762 | Moritz Bunkus | co_url co_url1 co_bankname
|
||
a205ed21 | Udo Spallek | co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
|
||
9fb8eec8 | Moritz Bunkus | co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2
|
||
a205ed21 | Udo Spallek | co_accountnr3
|
||
);
|
||||
4dd73ccf | Stephan Köhler | |||
cd417762 | Moritz Bunkus | $form->{$_} = $myconfig{$_} for @a;
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | my $openings = $form->{fa_oeffnungszeiten};
|
||
a205ed21 | Udo Spallek | $openings =~ s/\\\\n/<br>/g;
|
||
9fb8eec8 | Moritz Bunkus | my $company_given = ($form->{company} ne '')
|
||
a205ed21 | Udo Spallek | ? qq|<h3>$form->{company}</h3>\n|
|
||
a68089fb | Martin Helmling | : qq|<a href="controller.pl?action=ClientConfig/edit">|
|
||
a205ed21 | Udo Spallek | . $locale->text('No Company Name given') . qq|!</a><br>|;
|
||
081a4f97 | Moritz Bunkus | |||
4dd73ccf | Stephan Köhler | # Anpassungen der Variablennamen auf pre 2.1.1 Namen
|
||
05c6840d | Moritz Bunkus | # klären, ob $form->{company_street|_address} gesetzt sind
|
||
d319704a | Moritz Bunkus | if ($form->{address} ne '') {
|
||
my $temp = $form->{address};
|
||||
963c5048 | Sven Schöling | $temp =~ s/\n/<br \/>/;
|
||
4dd73ccf | Stephan Köhler | ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp);
|
||
963c5048 | Sven Schöling | $form->{co_city} =~ s/\n//g;
|
||
4dd73ccf | Stephan Köhler | }
|
||
a205ed21 | Udo Spallek | |||
9fb8eec8 | Moritz Bunkus | my $address_given =
|
||
($form->{co_street} && ($form->{co_zip} || $form->{co_city}))
|
||||
a205ed21 | Udo Spallek | ? qq|$form->{co_street}<br>|
|
||
. qq|$form->{co_street1}<br>|
|
||||
. qq|$form->{co_zip} $form->{co_city}|
|
||||
a68089fb | Martin Helmling | : qq|<a href="controller.pl?action=ClientConfig/edit">|
|
||
9fb8eec8 | Moritz Bunkus | . $locale->text('No Company Address given')
|
||
a205ed21 | Udo Spallek | . qq|!</a>\n|;
|
||
081a4f97 | Moritz Bunkus | $form->{co_email} = $form->{email} unless $form->{co_email};
|
||
$form->{co_tel} = $form->{tel} unless $form->{co_tel};
|
||||
$form->{co_fax} = $form->{fax} unless $form->{co_fax};
|
||||
$form->{co_url} = $form->{urlx} unless $form->{co_url};
|
||||
a68089fb | Martin Helmling | my $taxnumber_given = ($form->{taxnumber} ne '') ? $form->{taxnumber} : qq|<a href="ustva.pl?action=config_step1">Keine Steuernummer hinterlegt!</a><br>|;
|
||
my $fa_name_given = ($form->{fa_name} ne '') ? $form->{fa_name} : qq|<a href="ustva.pl?action=config_step1">Kein Finanzamt hinterlegt!</a><br>|;
|
||||
a205ed21 | Udo Spallek | my $ustva_vorauswahl = &ustva_vorauswahl();
|
||
d319704a | Moritz Bunkus | |||
a205ed21 | Udo Spallek | my @all_years = $form->all_years(\%myconfig);
|
||
d319704a | Moritz Bunkus | |||
9fb8eec8 | Moritz Bunkus | my $select_year = qq|<select name=year title="|
|
||
a205ed21 | Udo Spallek | . $locale->text('Year') . qq|">|;
|
||
foreach my $key (@all_years) {
|
||||
$select_year .= qq|<option |;
|
||||
$select_year .= qq|selected| if ($key eq $form->{year});
|
||||
$select_year .= qq| >$key</option>|;
|
||||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | $select_year .= qq|</select>|;
|
||
my $_checked = '';
|
||||
$_checked = "checked" if ($form->{kz10} eq '1');
|
||||
my $checkbox_kz_10 = qq|<input name="FA_10" id=FA_10 class=checkbox|
|
||||
. qq| type=checkbox value="1" $_checked title = "|
|
||||
a68089fb | Martin Helmling | . $locale->text('Amended Advance Turnover Tax Return').'(Nr. 10)'
|
||
9fb8eec8 | Moritz Bunkus | . qq|">|
|
||
. $locale->text('Amended Advance Turnover Tax Return');
|
||||
a205ed21 | Udo Spallek | |||
a68089fb | Martin Helmling | $_checked = "checked" if ($form->{kz22} eq '1');
|
||
my $checkbox_kz_22 = qq|<input name="FA_22" id=FA_22 class=checkbox|
|
||||
. qq| type=checkbox value="1" $_checked title = "|
|
||||
. $locale->text('Receipts attached/extra').'(Nr. 22)'
|
||||
. qq|">|
|
||||
. $locale->text('Receipts attached/extra');
|
||||
$_checked = "checked" if ($form->{kz29} eq '1');
|
||||
my $checkbox_kz_29 = qq|<input name="FA_29" id=FA_29 class=checkbox|
|
||||
. qq| type=checkbox value="1" $_checked title = "|
|
||||
. $locale->text('Accounting desired').'(Nr. 29)'
|
||||
. qq|">|
|
||||
. $locale->text('Accounting desired');
|
||||
$_checked = "checked" if ($form->{kz26} eq '1');
|
||||
my $checkbox_kz_26 = qq|<input name="FA_26" id=FA_26 class=checkbox|
|
||||
. qq| type=checkbox value="1" $_checked title = "|
|
||||
. $locale->text('Direct debit revoked').'(Nr. 26)'
|
||||
. qq|">|
|
||||
. $locale->text('Direct debit revoked');
|
||||
my $method_local = ($form->{accounting_method} eq 'accrual') ? $locale->text('accrual')
|
||||
: ($form->{accounting_method} eq 'cash') ? $locale->text('cash')
|
||||
a205ed21 | Udo Spallek | : '';
|
||
a68089fb | Martin Helmling | my $period_local = ( $form->{fa_voranmeld} eq 'month') ? $locale->text('month')
|
||
: ( $form->{fa_voranmeld} eq 'quarter') ? $locale->text('quarter')
|
||||
9fb8eec8 | Moritz Bunkus | : '';
|
||
a205ed21 | Udo Spallek | |||
a68089fb | Martin Helmling | my @tax_office_banks_ref = (
|
||
{ BLZ => $form->{fa_blz_1},
|
||||
Kontonummer => $form->{fa_kontonummer_1},
|
||||
Bankbezeichnung => $form->{fa_bankbezeichnung_1}
|
||||
a205ed21 | Udo Spallek | },
|
||
a68089fb | Martin Helmling | { BLZ => $form->{fa_blz_2},
|
||
Kontonummer => $form->{fa_kontonummer_2},
|
||||
Bankbezeichnung => $form->{fa_bankbezeichnung_2}
|
||||
d319704a | Moritz Bunkus | }
|
||
a68089fb | Martin Helmling | );
|
||
9fb8eec8 | Moritz Bunkus | |||
9c412887 | Geoffrey Richardson | $ustva->get_coa($form); # fetches coa and modifies some form variables
|
||
ccd0b365 | Udo Spallek | |||
a205ed21 | Udo Spallek | my $template_ref = {
|
||
9fb8eec8 | Moritz Bunkus | openings => $openings,
|
||
a205ed21 | Udo Spallek | company_given => $company_given,
|
||
9fb8eec8 | Moritz Bunkus | address_given => $address_given,
|
||
a205ed21 | Udo Spallek | taxnumber_given => $taxnumber_given,
|
||
a68089fb | Martin Helmling | fa_name_given => $fa_name_given,
|
||
cd417762 | Moritz Bunkus | taxnumber => $defaults->taxnumber,
|
||
9fb8eec8 | Moritz Bunkus | select_year => $select_year,
|
||
a205ed21 | Udo Spallek | period_local => $period_local,
|
||
method_local => $method_local,
|
||||
ustva_vorauswahl => $ustva_vorauswahl,
|
||||
checkbox_kz_10 => $checkbox_kz_10,
|
||||
a68089fb | Martin Helmling | checkbox_kz_22 => $checkbox_kz_22,
|
||
checkbox_kz_29 => $checkbox_kz_29,
|
||||
checkbox_kz_26 => $checkbox_kz_26,
|
||||
tax_office_banks => \@tax_office_banks_ref,
|
||||
9fb8eec8 | Moritz Bunkus | select_options => &show_options,
|
||
ccd0b365 | Udo Spallek | |||
a205ed21 | Udo Spallek | };
|
||
9fb8eec8 | Moritz Bunkus | |||
9aaca433 | Moritz Bunkus | print($form->parse_html_template('ustva/report', $template_ref));
|
||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | |||
d319704a | Moritz Bunkus | sub ustva_vorauswahl {
|
||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
081a4f97 | Moritz Bunkus | |||
0279167d | Sven Schöling | my $form = $::form;
|
||
my $locale = $::locale;
|
||||
my %myconfig = %::myconfig;
|
||||
$::auth->assert('advance_turnover_tax_return');
|
||||
8c7e4493 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | my $select_vorauswahl;
|
||
d319704a | Moritz Bunkus | #Aktuelles Datum zerlegen:
|
||
63a1c75d | Stephan Köhler | my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig);
|
||
d319704a | Moritz Bunkus | |||
#$locale->date($myconfig, $form->current_date($myconfig), 0)=~ /(\d\d).(\d\d).(\d\d\d\d)/;
|
||||
63a1c75d | Stephan Köhler | $form->{day} = substr($date, 6, 2);
|
||
$form->{month} = substr($date, 4, 2);
|
||||
$form->{year} = substr($date, 0, 4);
|
||||
0279167d | Sven Schöling | $::lxdebug->message(LXDebug->DEBUG1, qq|
|
||
9fb8eec8 | Moritz Bunkus | Actual date from Database: $date\n
|
||
63a1c75d | Stephan Köhler | Actual year from Database: $form->{year}\n
|
||
Actual day from Database: $form->{day}\n
|
||||
Actual month from Database: $form->{month}\n|);
|
||||
081a4f97 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | my $sel = '';
|
||
my $yymmdd = '';
|
||||
# Testdaten erzeugen:
|
||||
#$form->{day}= '11';
|
||||
#$form->{month}= '01';
|
||||
#$form->{year}= 2004;
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl = qq|
|
||
a68089fb | Martin Helmling | <input type="hidden" name="day" value="$form->{day}">
|
||
<input type="hidden" name="month" value="$form->{month}">
|
||||
<input type="hidden" name="yymmdd" value="$yymmdd">
|
||||
<input type="hidden" name="sel" value="$sel">
|
||||
a205ed21 | Udo Spallek | |;
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | if ($form->{fa_voranmeld} eq 'month') {
|
||
d319704a | Moritz Bunkus | |||
# Vorauswahl bei monatlichem Voranmeldungszeitraum
|
||||
6c0e5cb7 | Moritz Bunkus | my %liste = ('01' => $locale->text('January'),
|
||
'02' => $locale->text('February'),
|
||||
'03' => $locale->text('March'),
|
||||
'04' => $locale->text('April'),
|
||||
'05' => $locale->text('May'),
|
||||
'06' => $locale->text('June'),
|
||||
'07' => $locale->text('July'),
|
||||
'08' => $locale->text('August'),
|
||||
'09' => $locale->text('September'),
|
||||
'10' => $locale->text('October'),
|
||||
'11' => $locale->text('November'),
|
||||
'12' => $locale->text('December'),
|
||||
'13' => $locale->text('Yearly'),
|
||||
);
|
||||
081a4f97 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | my $yy = $form->{year} * 10000;
|
||
$yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
|
||||
$sel = '';
|
||||
6c0e5cb7 | Moritz Bunkus | my $dfv = '';
|
||
081a4f97 | Moritz Bunkus | |||
05c6840d | Moritz Bunkus | # Offset für Dauerfristverlängerung
|
||
a68089fb | Martin Helmling | $dfv = '100' if ($form->{fa_dauerfrist} eq '1');
|
||
d319704a | Moritz Bunkus | |||
SWITCH: {
|
||||
$yymmdd <= ($yy + 110 + $dfv) && do {
|
||||
$form->{year} = $form->{year} - 1;
|
||||
$sel = '12';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 210 + $dfv) && do {
|
||||
$sel = '01';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 310 + $dfv) && do {
|
||||
$sel = '02';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 410 + $dfv) && do {
|
||||
$sel = '03';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 510 + $dfv) && do {
|
||||
$sel = '04';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 610 + $dfv) && do {
|
||||
$sel = '05';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 710 + $dfv) && do {
|
||||
$sel = '06';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 810 + $dfv) && do {
|
||||
$sel = '07';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 910 + $dfv) && do {
|
||||
$sel = '08';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 1010 + $dfv) && do {
|
||||
$sel = '09';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 1110 + $dfv) && do {
|
||||
$sel = '10';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 1210) && do {
|
||||
$sel = '11';
|
||||
last SWITCH;
|
||||
};
|
||||
$yymmdd <= ($yy + 1231) && do {
|
||||
$sel = '12';
|
||||
last SWITCH;
|
||||
};
|
||||
}
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
|
||
6c0e5cb7 | Moritz Bunkus | . $locale->text('Select a period') . qq|" >|;
|
||
d319704a | Moritz Bunkus | my $key = '';
|
||
foreach $key (sort keys %liste) {
|
||||
my $selected = '';
|
||||
$selected = 'selected' if ($sel eq $key);
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|
|
||
6c0e5cb7 | Moritz Bunkus | <option value="$key" $selected> $liste{$key}</option>
|
||
a205ed21 | Udo Spallek | |;
|
||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|</select>|;
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | } elsif ($form->{fa_voranmeld} eq 'quarter') {
|
||
d319704a | Moritz Bunkus | |||
# Vorauswahl bei quartalsweisem Voranmeldungszeitraum
|
||||
2e2e8ce6 | Udo Spallek | my %liste = ('41' => $locale->text('1. Quarter'),
|
||
'42' => $locale->text('2. Quarter'),
|
||||
'43' => $locale->text('3. Quarter'),
|
||||
'44' => $locale->text('4. Quarter'),
|
||||
081a4f97 | Moritz Bunkus | '13' => $locale->text('Yearly'),);
|
||
d319704a | Moritz Bunkus | |||
my $yy = $form->{year} * 10000;
|
||||
$yymmdd = "$form->{year}$form->{month}$form->{day}" * 1;
|
||||
$sel = '';
|
||||
05c6840d | Moritz Bunkus | my $dfv = ''; # Offset für Dauerfristverlängerung
|
||
a68089fb | Martin Helmling | $dfv = '100' if ($form->{fa_dauerfrist} eq '1');
|
||
d319704a | Moritz Bunkus | |||
SWITCH: {
|
||||
$yymmdd <= ($yy + 110 + $dfv) && do {
|
||||
$form->{year} = $form->{year} - 1;
|
||||
6ab3da45 | Udo Spallek | $sel = '44';
|
||
d319704a | Moritz Bunkus | last SWITCH;
|
||
};
|
||||
$yymmdd <= ($yy + 410 + $dfv) && do {
|
||||
6ab3da45 | Udo Spallek | $sel = '41';
|
||
d319704a | Moritz Bunkus | last SWITCH;
|
||
};
|
||||
$yymmdd <= ($yy + 710 + $dfv) && do {
|
||||
6ab3da45 | Udo Spallek | $sel = '42';
|
||
d319704a | Moritz Bunkus | last SWITCH;
|
||
};
|
||||
$yymmdd <= ($yy + 1010 + $dfv) && do {
|
||||
6ab3da45 | Udo Spallek | $sel = '43';
|
||
d319704a | Moritz Bunkus | last SWITCH;
|
||
};
|
||||
$yymmdd <= ($yy + 1231) && do {
|
||||
6ab3da45 | Udo Spallek | $sel = '44';
|
||
d319704a | Moritz Bunkus | };
|
||
}
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
|
||
d319704a | Moritz Bunkus | . $locale->text('Select a period') . qq|" >|;
|
||
my $key = '';
|
||||
foreach $key (sort keys %liste) {
|
||||
my $selected = '';
|
||||
$selected = 'selected' if ($sel eq $key);
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|
|
||
f575aa99 | Stephan Köhler | <option value="$key" $selected>$liste{$key}</option>
|
||
d319704a | Moritz Bunkus | |;
|
||
}
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|\n</select>
|
||
d319704a | Moritz Bunkus | |;
|
||
} else {
|
||||
# keine Vorauswahl bei Voranmeldungszeitraum
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
|
||
d319704a | Moritz Bunkus | . $locale->text('Select a period') . qq|" >|;
|
||
2e2e8ce6 | Udo Spallek | my %listea = ('41' => '1. Quarter',
|
||
'42' => '2. Quarter',
|
||||
'43' => '3. Quarter',
|
||||
'44' => '4. Quarter',);
|
||||
d319704a | Moritz Bunkus | |||
my %listeb = ('01' => 'January',
|
||||
'02' => 'February',
|
||||
'03' => 'March',
|
||||
'04' => 'April',
|
||||
'05' => 'May',
|
||||
'06' => 'June',
|
||||
'07' => 'July',
|
||||
'08' => 'August',
|
||||
'09' => 'September',
|
||||
'10' => 'October',
|
||||
'11' => 'November',
|
||||
f575aa99 | Stephan Köhler | '12' => 'December',
|
||
081a4f97 | Moritz Bunkus | '13' => 'Yearly',);
|
||
d319704a | Moritz Bunkus | my $key = '';
|
||
foreach $key (sort keys %listea) {
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|
|
||
081a4f97 | Moritz Bunkus | <option value="$key">|
|
||
. $locale->text("$listea{$key}")
|
||||
. qq|</option>\n|;
|
||||
d319704a | Moritz Bunkus | }
|
||
foreach $key (sort keys %listeb) {
|
||||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|
|
||
081a4f97 | Moritz Bunkus | <option value="$key">|
|
||
. $locale->text("$listeb{$key}")
|
||||
. qq|</option>\n|;
|
||||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | $select_vorauswahl .= qq|</select>|;
|
||
d319704a | Moritz Bunkus | }
|
||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | return $select_vorauswahl;
|
||
d319704a | Moritz Bunkus | }
|
||
sub show_options {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | # $form->{PD}{$form->{type}} = "selected";
|
||
# $form->{DF}{$form->{format}} = "selected";
|
||||
# $form->{OP}{$form->{media}} = "selected";
|
||||
# $form->{SM}{$form->{sendmode}} = "selected";
|
||||
my $type = qq| <input type=hidden name="type" value="ustva">|;
|
||||
my $media = qq| <input type=hidden name="media" value="screen">|;
|
||||
my $format =
|
||||
qq| <option value=html selected>|
|
||||
127b0df3 | Jan Büren | . $::locale->text('HTML')
|
||
d319704a | Moritz Bunkus | . qq|</option>|;
|
||
a68089fb | Martin Helmling | #my $disabled= qq|disabled="disabled"|;
|
||
#$disabled='' if ($form->{elster} eq '1' );
|
||||
#if ($::form->{elster} eq '1') {
|
||||
if ( 1 ) {
|
||||
$format .=
|
||||
qq|<option value=elstertaxbird>|
|
||||
. $::locale->text('ELSTER Export (via Geierlein)')
|
||||
. qq|</option>|;
|
||||
}
|
||||
a205ed21 | Udo Spallek | my $show_options = qq|
|
||
d319704a | Moritz Bunkus | $type
|
||
$media
|
||||
<select name=format title = "|
|
||||
0279167d | Sven Schöling | . $::locale->text('Choose Outputformat') . qq|">$format</select>
|
||
d319704a | Moritz Bunkus | |;
|
||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | return $show_options;
|
||
d319704a | Moritz Bunkus | }
|
||
sub generate_ustva {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
my $form = $::form;
|
||||
my $locale = $::locale;
|
||||
my %myconfig = %::myconfig;
|
||||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
2e66dde5 | Moritz Bunkus | my $defaults = SL::DB::Default->get;
|
||
d319704a | Moritz Bunkus | |||
f8779cd3 | Moritz Bunkus | my $ustva = USTVA->new();
|
||
a68089fb | Martin Helmling | $ustva->get_config();
|
||
$ustva->get_finanzamt();
|
||||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | # Setze Anmeldungszeitraum
|
||
9fb8eec8 | Moritz Bunkus | |||
a68089fb | Martin Helmling | $ustva->set_FromTo(\%$form);
|
||
6ab3da45 | Udo Spallek | |||
# Get the USTVA
|
||||
f8779cd3 | Moritz Bunkus | $ustva->ustva(\%myconfig, \%$form);
|
||
081a4f97 | Moritz Bunkus | |||
63a1c75d | Stephan Köhler | # reformat Dates to dateformat
|
||
081a4f97 | Moritz Bunkus | $form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
|
||
6ab3da45 | Udo Spallek | $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
|
||
081a4f97 | Moritz Bunkus | $form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
|
||
d319704a | Moritz Bunkus | |||
2e2e8ce6 | Udo Spallek | $form->{longperiod} =
|
||
d319704a | Moritz Bunkus | $locale->date(\%myconfig, $form->current_date(\%myconfig), 1, 0, 0);
|
||
63a1c75d | Stephan Köhler | |||
d319704a | Moritz Bunkus | # if there are any dates construct a where
|
||
if ($form->{fromdate} || $form->{todate}) {
|
||||
0279167d | Sven Schöling | $form->{todate} = $form->current_date(\%myconfig) unless ($form->{todate});
|
||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | my $longtodate = $locale->date(\%myconfig, $form->{todate}, 1, 0, 0);
|
||
my $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
|
||||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | my $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1, 0, 0);
|
||
my $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
|
||||
d319704a | Moritz Bunkus | |||
$form->{this_period} = "$shortfromdate<br>\n$shorttodate";
|
||||
2e2e8ce6 | Udo Spallek | $form->{longperiod} =
|
||
d319704a | Moritz Bunkus | $locale->text('for Period')
|
||
. qq|<br>\n$longfromdate |
|
||||
6c3f16ab | Udo Spallek | . $locale->text('to (date)')
|
||
d319704a | Moritz Bunkus | . qq| $longtodate|;
|
||
}
|
||||
if ($form->{comparefromdate} || $form->{comparetodate}) {
|
||||
my $longcomparefromdate =
|
||||
$locale->date(\%myconfig, $form->{comparefromdate}, 1, 0, 0);
|
||||
my $shortcomparefromdate =
|
||||
$locale->date(\%myconfig, $form->{comparefromdate}, 0, 0, 0);
|
||||
my $longcomparetodate =
|
||||
$locale->date(\%myconfig, $form->{comparetodate}, 1, 0, 0);
|
||||
my $shortcomparetodate =
|
||||
$locale->date(\%myconfig, $form->{comparetodate}, 0, 0, 0);
|
||||
$form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
|
||||
2e2e8ce6 | Udo Spallek | $form->{longperiod} .=
|
||
d319704a | Moritz Bunkus | "<br>\n$longcomparefromdate "
|
||
6c3f16ab | Udo Spallek | . $locale->text('to (date)')
|
||
d319704a | Moritz Bunkus | . qq| $longcomparetodate|;
|
||
}
|
||||
$form->{Datum_heute} =
|
||||
$locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
|
||||
# setup variables for the form
|
||||
cd417762 | Moritz Bunkus | my @a = qw(tel fax email
|
||
4dd73ccf | Stephan Köhler | co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
|
||
co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
|
||||
cd417762 | Moritz Bunkus | co_fax co_fax1 co_email co_email1 co_url co_url1
|
||
4dd73ccf | Stephan Köhler | co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
|
||
co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3);
|
||||
cd417762 | Moritz Bunkus | $form->{$_} = $myconfig{$_} for @a;
|
||
$form->{$_} = $defaults->$_ for qw(company address co_ustid duns);
|
||||
d319704a | Moritz Bunkus | |||
if ($form->{address} ne '') {
|
||||
my $temp = $form->{address};
|
||||
a68089fb | Martin Helmling | $temp =~ s/\n/<br \/>/;
|
||
($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp,2);
|
||||
b39c8ce9 | Moritz Bunkus | $form->{co_city} =~ s/\\n//g;
|
||
d319704a | Moritz Bunkus | }
|
||
a68089fb | Martin Helmling | $form->{id} = [];
|
||
$form->{amount} = [];
|
||||
c1d8418b | Udo Spallek | |||
f59c9111 | Jan Büren | if ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
|
||
081a4f97 | Moritz Bunkus | |||
18942bd7 | Udo Spallek | $form->{IN} = $form->{type} . '.html';
|
||
$form->{padding} = " ";
|
||||
$form->{bold} = "<b>";
|
||||
$form->{endbold} = "</b>";
|
||||
$form->{br} = "<br>";
|
||||
$form->{address} =~ s/\\n/\n/g;
|
||||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | foreach my $number (@{$::form->{category_cent}}) {
|
||
18942bd7 | Udo Spallek | $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
|
||
}
|
||||
9fb8eec8 | Moritz Bunkus | |||
a68089fb | Martin Helmling | foreach my $number (@{$::form->{category_euro}}) {
|
||
18942bd7 | Udo Spallek | $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
|
||
}
|
||||
f59c9111 | Jan Büren | } else { # we have only html
|
||
18942bd7 | Udo Spallek | $form->header;
|
||
USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
|
||||
09479f02 | Moritz Bunkus | $::dispatcher->end_request;
|
||
f59c9111 | Jan Büren | }
|
||
6ab3da45 | Udo Spallek | if ( $form->{period} eq '13' and $form->{format} ne 'html') {
|
||
$form->header;
|
||||
USTVA::info(
|
||||
$locale->text(
|
||||
'Yearly taxreport not yet implemented')
|
||||
. '!');
|
||||
}
|
||||
9fb8eec8 | Moritz Bunkus | |||
f59c9111 | Jan Büren | # add a prefix for ustva pos numbers, i.e.: 81 -> post_ustva_81
|
||
$form->{"pos_ustva_$_"} = $form->{$_} for grep { m{^\d+} } keys %{ $form };
|
||||
$form->{title} = $locale->text('Advance turnover tax return');
|
||||
ccd0b365 | Udo Spallek | |||
f59c9111 | Jan Büren | $form->header;
|
||
print $form->parse_html_template('ustva/ustva');
|
||||
d319704a | Moritz Bunkus | |||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | sub config_step1 {
|
||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
081a4f97 | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
0279167d | Sven Schöling | $::form->{title} = $::locale->text('Tax Office Preferences');
|
||
1de53cbf | Sven Donath | |||
d319704a | Moritz Bunkus | # edit all taxauthority prefs
|
||
1d8cd5cd | Moritz Bunkus | setup_ustva_config_step1_action_bar();
|
||
0279167d | Sven Schöling | $::form->header;
|
||
f8779cd3 | Moritz Bunkus | |||
my $ustva = USTVA->new();
|
||||
a68089fb | Martin Helmling | $ustva->get_config();
|
||
$ustva->get_finanzamt();
|
||||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | my $land = $::form->{fa_land_nr};
|
||
my $amt = $::form->{fa_bufa_nr};
|
||||
d319704a | Moritz Bunkus | |||
a205ed21 | Udo Spallek | |||
0279167d | Sven Schöling | $::form->{title} = $::locale->text('Tax Office Preferences');
|
||
d319704a | Moritz Bunkus | |||
74fca575 | Sven Schöling | my $select_tax_office = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%::myconfig, $::form));
|
||
a68089fb | Martin Helmling | my $method_local = ($::form->{accounting_method} eq 'accrual') ? $::locale->text('accrual')
|
||
: ($::form->{accounting_method} eq 'cash') ? $::locale->text('cash')
|
||||
: '';
|
||||
my $checked_monthly = $::form->{fa_voranmeld} eq 'month' ? "checked" : '';
|
||||
my $checked_quarterly = $::form->{fa_voranmeld} eq 'quarter' ? "checked" : '';
|
||||
my $checked_dauerfristverlaengerung = $::form->{da_dauerfrist} eq '1' ? "checked" : '';
|
||||
d319704a | Moritz Bunkus | |||
a205ed21 | Udo Spallek | my $_hidden_variables_ref;
|
||
d319704a | Moritz Bunkus | |||
9fb8eec8 | Moritz Bunkus | my %_hidden_local_variables = (
|
||
0279167d | Sven Schöling | 'saved' => $::locale->text('Check Details'),
|
||
a205ed21 | Udo Spallek | );
|
||
foreach my $variable (keys %_hidden_local_variables) {
|
||||
9fb8eec8 | Moritz Bunkus | push @{ $_hidden_variables_ref },
|
||
a205ed21 | Udo Spallek | { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
|
||
}
|
||||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | my @_hidden_form_variables = $ustva->get_fiamt_vars();
|
||
push @_hidden_form_variables ,qw(fa_bufa_nr taxnumber accounting_method coa);
|
||||
d319704a | Moritz Bunkus | |||
a205ed21 | Udo Spallek | foreach my $variable (@_hidden_form_variables) {
|
||
9fb8eec8 | Moritz Bunkus | push @{ $_hidden_variables_ref},
|
||
0279167d | Sven Schöling | { 'variable' => $variable, 'value' => $::form->{$variable} };
|
||
d319704a | Moritz Bunkus | }
|
||
9c412887 | Geoffrey Richardson | $ustva->get_coa($::form); # fetches coa and modifies some form variables
|
||
ccd0b365 | Udo Spallek | |||
05c6840d | Moritz Bunkus | # Variablen für das Template zur Verfügung stellen
|
||
a205ed21 | Udo Spallek | my $template_ref = {
|
||
select_tax_office => $select_tax_office,
|
||||
a68089fb | Martin Helmling | method_local => $method_local,
|
||
a205ed21 | Udo Spallek | checked_monthly => $checked_monthly,
|
||
checked_quarterly => $checked_quarterly,
|
||||
checked_dauerfristverlaengerung => $checked_dauerfristverlaengerung,
|
||||
hidden_variables => $_hidden_variables_ref,
|
||||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | };
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | # Ausgabe des Templates
|
||
0279167d | Sven Schöling | print($::form->parse_html_template('ustva/config_step1', $template_ref));
|
||
a205ed21 | Udo Spallek | |||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | sub config_step2 {
|
||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
my $form = $::form;
|
||||
my $locale = $::locale;
|
||||
my %myconfig = %::myconfig;
|
||||
8c7e4493 | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
1d8cd5cd | Moritz Bunkus | setup_ustva_config_step2_action_bar();
|
||
d319704a | Moritz Bunkus | $form->header();
|
||
a205ed21 | Udo Spallek | |||
a68089fb | Martin Helmling | my $fa_land_nr = '';
|
||
my $fa_bufa_nr = '';
|
||||
f8779cd3 | Moritz Bunkus | |||
my $ustva = USTVA->new();
|
||||
a68089fb | Martin Helmling | $ustva->get_config() if ($form->{saved} eq $locale->text('saved'));
|
||
my $coa = $::form->{coa};
|
||||
$form->{"COA_$coa"} = '1';
|
||||
$form->{COA_Germany} = '1' if ($coa =~ m/^germany/i);
|
||||
$ustva->get_finanzamt();
|
||||
d319704a | Moritz Bunkus | |||
05c6840d | Moritz Bunkus | # Auf Übergabefehler checken
|
||
081a4f97 | Moritz Bunkus | USTVA::info( $locale->text('Missing Tax Authoritys Preferences') . "\n"
|
||
. $locale->text('USTVA-Hint: Tax Authoritys'))
|
||||
a68089fb | Martin Helmling | if ( $form->{fa_bufa_nr_new} eq 'Auswahl'
|
||
|| $form->{fa_land_nr_new} eq 'Auswahl');
|
||||
081a4f97 | Moritz Bunkus | USTVA::info( $locale->text('Missing Method!') . "\n"
|
||
. $locale->text('USTVA-Hint: Method'))
|
||||
a68089fb | Martin Helmling | if ($form->{accounting_method} eq '');
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | # Klären, ob Variablen bereits befüllt sind UND ob veränderungen auf
|
||
d319704a | Moritz Bunkus | # der vorherigen Maske stattfanden: $change = 1(in der edit sub,
|
||
# mittels get_config)
|
||||
a68089fb | Martin Helmling | # $::lxdebug->message(LXDebug->DEBUG2,"land old=".$form->{fa_land_nr}." new=".$form->{fa_land_nr_new});
|
||
# $::lxdebug->message(LXDebug->DEBUG2,"bufa old=".$form->{fa_bufa_nr}." new=".$form->{fa_bufa_nr_new});
|
||||
my $change = $form->{fa_land_nr} eq $form->{fa_land_nr_new}
|
||||
&& $form->{fa_bufa_nr} eq $form->{fa_bufa_nr_new} ? '0' : '1';
|
||||
d319704a | Moritz Bunkus | $change = '0' if ($form->{saved} eq $locale->text('saved'));
|
||
if ($change eq '1') {
|
||||
05c6840d | Moritz Bunkus | # Daten ändern
|
||
a68089fb | Martin Helmling | $fa_land_nr = $form->{fa_land_nr_new};
|
||
$fa_bufa_nr = $form->{fa_bufa_nr_new};
|
||||
$form->{fa_land_nr} = $fa_land_nr;
|
||||
$form->{fa_bufa_nr} = $fa_bufa_nr;
|
||||
$form->{taxnumber} = '';
|
||||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | create_steuernummer();
|
||
d319704a | Moritz Bunkus | |||
# rebuild elster_amt
|
||||
a68089fb | Martin Helmling | $ustva->get_finanzamt();
|
||
d319704a | Moritz Bunkus | |||
} else {
|
||||
a68089fb | Martin Helmling | $fa_land_nr = $form->{fa_land_nr};
|
||
$fa_bufa_nr = $form->{fa_bufa_nr};
|
||||
d319704a | Moritz Bunkus | |||
}
|
||||
a68089fb | Martin Helmling | # $::lxdebug->message(LXDebug->DEBUG2, "form stnr=".$form->{taxnumber}." fa_bufa_nr=".$fa_bufa_nr.
|
||
# " pattern=".$form->{elster_pattern}." fa_land_nr=".$fa_land_nr);
|
||||
my $stnr = $form->{taxnumber};
|
||||
d319704a | Moritz Bunkus | $stnr =~ s/\D+//g;
|
||
a68089fb | Martin Helmling | my $taxnumber = $stnr eq '' ? $form->{taxnumber} : '';
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | $form->{fa_oeffnungszeiten} =~ s/\\\\n/\n/g;
|
||
9fb8eec8 | Moritz Bunkus | |||
9c412887 | Geoffrey Richardson | $ustva->get_coa($form); # fetches coa and modifies some form variables
|
||
a205ed21 | Udo Spallek | |||
f8779cd3 | Moritz Bunkus | my $input_steuernummer = $ustva->steuernummer_input(
|
||
a68089fb | Martin Helmling | $fa_land_nr,
|
||
$fa_bufa_nr,
|
||||
$form->{taxnumber}
|
||||
a205ed21 | Udo Spallek | );
|
||
a68089fb | Martin Helmling | # $::lxdebug->message(LXDebug->DEBUG2, qq|$input_steuernummer|);
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | |||
my $_hidden_variables_ref;
|
||||
d319704a | Moritz Bunkus | |||
a205ed21 | Udo Spallek | my %_hidden_local_variables = (
|
||
a68089fb | Martin Helmling | 'fa_land_nr' => $fa_land_nr,
|
||
'fa_bufa_nr' => $fa_bufa_nr,
|
||||
'taxnumber' => $stnr,
|
||||
a205ed21 | Udo Spallek | 'lastsub' => 'config_step1',
|
||
'nextsub' => 'save',
|
||||
9fb8eec8 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | );
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | foreach my $variable (keys %_hidden_local_variables) {
|
||
9fb8eec8 | Moritz Bunkus | push @{ $_hidden_variables_ref },
|
||
a205ed21 | Udo Spallek | { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
|
||
d319704a | Moritz Bunkus | }
|
||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | my @_hidden_form_variables = qw(
|
||
a68089fb | Martin Helmling | fa_dauerfrist fa_steuerberater_city fa_steuerberater_name
|
||
94f55685 | Geoffrey Richardson | fa_steuerberater_street fa_steuerberater_tel
|
||
a68089fb | Martin Helmling | fa_voranmeld fa_dauerfrist
|
||
accounting_method
|
||||
type
|
||||
1d8cd5cd | Moritz Bunkus | saved
|
||
a205ed21 | Udo Spallek | );
|
||
foreach my $variable (@_hidden_form_variables) {
|
||||
9fb8eec8 | Moritz Bunkus | push @{ $_hidden_variables_ref},
|
||
a205ed21 | Udo Spallek | { 'variable' => $variable, 'value' => $form->{$variable} };
|
||
}
|
||||
my $template_ref = {
|
||||
input_steuernummer => $input_steuernummer,
|
||||
readonly => '', #q|disabled="disabled"|,
|
||||
a68089fb | Martin Helmling | COA_Germany => $form->{COA_Germany},
|
||
a205ed21 | Udo Spallek | hidden_variables => $_hidden_variables_ref,
|
||
};
|
||||
9fb8eec8 | Moritz Bunkus | |||
a205ed21 | Udo Spallek | # Ausgabe des Templates
|
||
9aaca433 | Moritz Bunkus | print($form->parse_html_template('ustva/config_step2', $template_ref));
|
||
a205ed21 | Udo Spallek | |||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
sub create_steuernummer {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
8c7e4493 | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
0279167d | Sven Schöling | my $part = $::form->{part};
|
||
my $patterncount = $::form->{patterncount};
|
||||
a68089fb | Martin Helmling | my $delimiter = $::form->{delimiter1};
|
||
0279167d | Sven Schöling | my $elster_pattern = $::form->{elster_pattern};
|
||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | # rebuild taxnumber
|
||
# es gibt eine gespeicherte steuernummer $form->{taxnumber}
|
||||
d319704a | Moritz Bunkus | # und die parts und delimiter
|
||
my $h = 0;
|
||||
my $i = 0;
|
||||
a68089fb | Martin Helmling | my $taxnumber_new = $part;
|
||
d319704a | Moritz Bunkus | |||
for ($h = 1; $h < $patterncount; $h++) {
|
||||
a68089fb | Martin Helmling | $delimiter = $::form->{delimiter2} if $h > 1;
|
||
$taxnumber_new .= qq|$delimiter|;
|
||||
d319704a | Moritz Bunkus | for (my $i = 1; $i <= length($elster_pattern); $i++) {
|
||
a68089fb | Martin Helmling | $taxnumber_new .= $::form->{"part_$h\_$i"};
|
||
d319704a | Moritz Bunkus | }
|
||
}
|
||||
a68089fb | Martin Helmling | # $::lxdebug->message(LXDebug->DEBUG2, "oldstnr=".$::form->{taxnumber}." newstnr=".$taxnumber_new);
|
||
if ($::form->{taxnumber} ne $taxnumber_new) {
|
||||
$::form->{taxnumber} = $taxnumber_new;
|
||||
$::form->{taxnumber_new} = $taxnumber_new;
|
||||
d319704a | Moritz Bunkus | } else {
|
||
a68089fb | Martin Helmling | $::form->{taxnumber_new} = '';
|
||
d319704a | Moritz Bunkus | }
|
||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
sub save {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
81afc40a | Moritz Bunkus | |||
0279167d | Sven Schöling | $::auth->assert('advance_turnover_tax_return');
|
||
8c7e4493 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | #zuerst die steuernummer aus den part, parts_X_Y und delimiter herstellen
|
||
a205ed21 | Udo Spallek | create_steuernummer();
|
||
d319704a | Moritz Bunkus | |||
# Textboxen formatieren: Linebreaks entfernen
|
||||
#
|
||||
a68089fb | Martin Helmling | $::form->{fa_oeffnungszeiten} =~ s/\r\n/\\n/g;
|
||
d319704a | Moritz Bunkus | |||
#URL mit http:// davor?
|
||||
a68089fb | Martin Helmling | $::form->{fa_internet} =~ s/^http:\/\///;
|
||
$::form->{fa_internet} = 'http://' . $::form->{fa_internet};
|
||||
9fb8eec8 | Moritz Bunkus | |||
a68089fb | Martin Helmling | # Hier kommt dann die Plausibilitätsprüfung der ELSTERSteuernummer TODO ??
|
||
if (1) {
|
||||
my $ustva = USTVA->new();
|
||||
$ustva->save_config();
|
||||
d319704a | Moritz Bunkus | |||
a68089fb | Martin Helmling | #$::form->{elster} = '1';
|
||
0279167d | Sven Schöling | $::form->{saved} = $::locale->text('saved');
|
||
d319704a | Moritz Bunkus | |||
} else {
|
||||
0279167d | Sven Schöling | $::form->{saved} = $::locale->text('Choose a Tax Number');
|
||
d319704a | Moritz Bunkus | }
|
||
a205ed21 | Udo Spallek | config_step2();
|
||
0279167d | Sven Schöling | $::lxdebug->leave_sub();
|
||
d319704a | Moritz Bunkus | }
|
||
sub continue {
|
||||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
081a4f97 | Moritz Bunkus | |||
d319704a | Moritz Bunkus | # allow Symbolic references just here:
|
||
0279167d | Sven Schöling | call_sub($::form->{"nextsub"});
|
||
$::lxdebug->leave_sub();
|
||||
d319704a | Moritz Bunkus | }
|
||
081a4f97 | Moritz Bunkus | sub back {
|
||
0279167d | Sven Schöling | $::lxdebug->enter_sub();
|
||
call_sub($::form->{"lastsub"});
|
||||
$::lxdebug->leave_sub();
|
||||
4dd73ccf | Stephan Köhler | }
|
||
7b9ad004 | Moritz Bunkus | |||
sub setup_ustva_report_action_bar {
|
||||
for my $bar ($::request->layout->get('actionbar')) {
|
||||
$bar->add(
|
||||
action => [
|
||||
t8('Show'),
|
||||
submit => [ '#form_do', { action => 'generate_ustva' } ],
|
||||
accesskey => 'enter',
|
||||
],
|
||||
action => [
|
||||
t8('Geierlein'),
|
||||
call => [ 'sendGeierlein' ],
|
||||
disabled => !length($::lx_office_conf{paths}{geierlein_path} // '') ? t8('The Geierlein path has not been set in the configuration.') : undef,
|
||||
tooltip => t8('Transfer data to Geierlein ELSTER application'),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
1d8cd5cd | Moritz Bunkus | |||
sub setup_ustva_config_step1_action_bar {
|
||||
for my $bar ($::request->layout->get('actionbar')) {
|
||||
$bar->add(
|
||||
action => [
|
||||
t8('Continue'),
|
||||
submit => [ '#form', { action => 'config_step2' } ],
|
||||
accesskey => 'enter',
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
sub setup_ustva_config_step2_action_bar {
|
||||
for my $bar ($::request->layout->get('actionbar')) {
|
||||
$bar->add(
|
||||
action => [
|
||||
t8('Save'),
|
||||
submit => [ '#form', { action => 'save' } ],
|
||||
accesskey => 'enter',
|
||||
],
|
||||
action => [
|
||||
t8('Back'),
|
||||
call => [ 'kivi.history_back' ],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|