return 0;
}
+# Problemfall: Verkaufsrechnungen, bei denen Steuern verbucht wurden, obwohl
+# kein Steuerschlüssel eingetragen ist.
+sub _check_missing_taxkeys_in_invoices {
+ $::lxdebug->enter_sub;
+
+ my $self = shift;
+ my %params = @_;
+ my $transaction = $params{transaction};
+ my $found_broken = 0;
+
+ $::lxdebug->leave_sub and return 0
+ if !$transaction->[0]->{invoice};
+
+ my @sub_transactions = $self->_group_sub_transactions($transaction);
+
+ for my $sub_transaction (@sub_transactions) {
+ $::lxdebug->leave_sub and return 0
+ if _is_split_transaction($sub_transaction)
+ || _is_simple_transaction($sub_transaction);
+
+ my $split_side_entries = _get_splitted_side($sub_transaction);
+ my $num_tax_rows;
+ my $num_taxed_rows;
+ for my $entry (@{ $split_side_entries }) {
+ my $is_tax = grep { m/(?:AP_tax|AR_tax)/ } keys %{ $entry->{chartlinks} };
+
+ $num_tax_rows++ if $is_tax;
+ $num_taxed_rows++ if !$is_tax && $entry->{tax_key} != 0;
+ }
+
+ # now if this has tax rows but NO taxed rows, something is wrong.
+ if ($num_tax_rows > 0 && $num_taxed_rows == 0) {
+ $params{problem}->{type} = 'missing_taxkeys_in_invoices';
+ push @{ $self->{missing_taxkeys_in_invoices} ||= [] }, $params{problem};
+ $found_broken = 1;
+ }
+ }
+
+ $::lxdebug->leave_sub;
+
+ return $found_broken;
+}
+
# Problemfall: Kreditorenbuchungen, bei denen mit Umsatzsteuerschlüsseln
# gebucht wurde und Debitorenbuchungen, bei denen mit Vorsteuerschlüsseln
# gebucht wurde.
unshift @problems, $problem;
}
+ if (0 != scalar @{ $self->{missing_taxkeys_in_invoices} }) {
+ my $problem = {
+ 'type' => 'missing_taxkeys_in_invoices',
+ 'ap_problems' => [ grep { $_->{data}->{module} eq 'ap' } @{ $self->{missing_taxkeys_in_invoices} } ],
+ 'ar_problems' => [ grep { $_->{data}->{module} eq 'ar' } @{ $self->{missing_taxkeys_in_invoices} } ],
+ };
+ unshift @problems, $problem;
+ }
+
$main::lxdebug->leave_sub();
+# $::lxdebug->dump(0, 'problems:', \@problems);
return @problems;
}
'Missing amount' => 'Fehlbetrag',
'Missing parameter #1 in call to sub #2.' => 'Fehlernder Parameter \'#1\' in Funktionsaufruf \'#2\'.',
'Missing parameter (at least one of #1) in call to sub #2.' => 'Fehlernder Parameter (mindestens einer aus \'#1\') in Funktionsaufruf \'#2\'.',
+ 'Missing taxkeys in invoices with taxes.' => 'Fehlende Steuerschlüssel in Rechnungen mit Steuern',
'Mitarbeiter' => 'Mitarbeiter',
'Mobile1' => 'Mobile 1',
'Mobile2' => 'Mobile 2',
[%- END %]
[%- END %]
+ [%- ELSIF problem.type == 'missing_taxkeys_in_invoices' %]
+ [%- IF problem.ar_problems.size %]
+ Verkaufsrechnungen
+ [%- FOREACH subproblem = problem.ar_problems %]
+ [%- UNLESS loop.first %], [%- END %]
+ <a href="[% subproblem.link %]">[% HTML.escape(subproblem.data.reference) %]</a>
+ [%- END %]
+ [%- END %]
+
+ [%- IF problem.ap_problems.size %]
+ [%- IF problem.ar_problems.size %]; [%- END %]
+ Einkaufsrechnungen
+ [%- FOREACH subproblem = problem.ap_problems %]
+ [%- UNLESS loop.first %], [%- END %]
+ <a href="[% subproblem.link %]">[% HTML.escape(subproblem.data.reference) %]</a>
+ [%- END %]
+ [%- END %]
+
[%- ELSE %]
<a href="[% problem.link %]">
[%- ELSIF problem.type == 'invoice_inventory_with_taxkeys' %]
Einkaufs- und Verkaufsrechnungen mit Warenbestandsbuchungen mit Steuerschlüsseln
+ [%- ELSIF problem.type == 'missing_taxkeys_in_invoices' %]
+ Fehlende Steuerschlüssel in Rechnungen mit Steuern
+
[%- END %]
</td>
[%- END %]
[%- END %]
+ [%- ELSIF problem.type == 'missing_taxkeys_in_invoices' %]
+ [%- IF problem.ar_problems.size %]
+ <translate>Sales invoices</translate>
+ [%- FOREACH subproblem = problem.ar_problems %]
+ [%- UNLESS loop.first %], [%- END %]
+ <a href="[% subproblem.link %]">[% HTML.escape(subproblem.data.reference) %]</a>
+ [%- END %]
+ [%- END %]
+
+ [%- IF problem.ap_problems.size %]
+ [%- IF problem.ar_problems.size %]; [%- END %]
+ <translate>Purchase invoices</translate>
+ [%- FOREACH subproblem = problem.ap_problems %]
+ [%- UNLESS loop.first %], [%- END %]
+ <a href="[% subproblem.link %]">[% HTML.escape(subproblem.data.reference) %]</a>
+ [%- END %]
+ [%- END %]
+
[%- ELSE %]
<a href="[% problem.link %]">
[%- ELSIF problem.type == 'invoice_inventory_with_taxkeys' %]
<translate>Sales and purchase invoices with inventory transactions with taxkeys</translate>
+ [%- ELSIF problem.type == 'missing_taxkeys_in_invoices' %]
+ <translate>Missing taxkeys in invoices with taxes.</translate>
+
[%- END %]
</td>