Skip to content

Commit

Permalink
DATEV-Export: Filter nach Kreditoren- oder Debitorenbuchungen
Browse files Browse the repository at this point in the history
  • Loading branch information
kivijan committed Jan 17, 2025
1 parent 1d26f22 commit 2400dcd
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
13 changes: 13 additions & 0 deletions SL/DATEV.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ sub new {

$obj;
}
sub transaction_type {
my $self = shift;
$self->{transaction_type} = $_[0] if @_;

die "Invalid DATEV Transaction Type"
unless $self->{transaction_type} =~ m/^(ar|ap|all)$/;

return $self->{transaction_type};
}


sub exporttype {
my $self = shift;
Expand Down Expand Up @@ -530,6 +540,9 @@ sub generate_datev_data {

my $filter = ''; # Useful for debugging purposes

$filter .= ' AND ac.trans_id in (SELECT id from ar) ' if $self->transaction_type eq 'ar';
$filter .= ' AND ac.trans_id in (SELECT id from ap) ' if $self->transaction_type eq 'ap';

my %all_taxchart_ids = selectall_as_map($form, $self->dbh, qq|SELECT DISTINCT chart_id, TRUE AS is_set FROM tax|, 'chart_id', 'is_set');

my $ar_accno = "c.accno";
Expand Down
1 change: 1 addition & 0 deletions bin/mozilla/datev.pl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ sub export3 {
$data{locked} = $::form->{locked};
$data{imported} = $::form->{imported};
$data{documents} = $::form->{documents};
$data{transaction_type} = $::form->{transaction_type};

if ($data{documents} && !SL::DATEV->new->check_all_bookings_have_documents(from => $data{from}, to => $data{to})) {
$::form->error(t8("Cannot export with documents because some transactions don't have a PDF document attached."));
Expand Down
1 change: 1 addition & 0 deletions locale/de/all
Original file line number Diff line number Diff line change
Expand Up @@ -4564,6 +4564,7 @@ $ ./scripts/installation_check.pl',
'Transaction Date missing!' => 'Buchungsdatum fehlt!',
'Transaction Details' => 'Transaktionsdetails',
'Transaction ID missing.' => 'Die Buchungs-ID fehlt.',
'Transaction Type' => 'Buchungstyp',
'Transaction Value' => 'Umsatz',
'Transaction Value Currency Code' => 'WKZ Umsatz',
'Transaction date' => 'Buchungsdatum',
Expand Down
1 change: 1 addition & 0 deletions locale/en/all
Original file line number Diff line number Diff line change
Expand Up @@ -4562,6 +4562,7 @@ $self->{texts} = {
'Transaction Date missing!' => '',
'Transaction Details' => '',
'Transaction ID missing.' => '',
'Transaction Type' => '',
'Transaction Value' => '',
'Transaction Value Currency Code' => '',
'Transaction date' => '',
Expand Down
17 changes: 16 additions & 1 deletion templates/design40_webpages/datev/export_bewegungsdaten.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[% USE T8 %]
[% USE LxERP %]
[% USE L %]

<h1>[% 'DATEV - Export Assistent' | $T8 %]</h1>
Expand Down Expand Up @@ -60,7 +61,21 @@ <h1>[% 'DATEV - Export Assistent' | $T8 %]</h1>
</tr>
</tbody>
</table>

<table class="tbl-horizontal">
<caption>[% 'Transaction Type' | $T8 %]</caption>
<tbody>
<tr>
<td>[% 'Type' | $T8 %]</td>
<td>[% L.select_tag("transaction_type", [
[ "all", LxERP.t8("All") ],
[ "ar", LxERP.t8("AR Transactions") ],
[ "ap", LxERP.t8("AP Transactions") ],
],
default=all,
style=style) %]</td>
</tr>
</tbody>
</table>
[% IF ALL_DEPARTMENTS.as_list.size %]
<table class="tbl-horizontal">
<caption>[% 'Department' | $T8 %]</caption>
Expand Down
12 changes: 12 additions & 0 deletions templates/webpages/datev/export_bewegungsdaten.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[%- USE T8 %]
[% USE LxERP %]
[%- USE L %]
<h1>[% 'DATEV - Export Assistent' | $T8 %]</h1>

Expand Down Expand Up @@ -65,6 +66,17 @@ <h1>[% 'DATEV - Export Assistent' | $T8 %]</h1>
<td align=left></td>
<td>[% L.date_tag('gldatefrom') %]</td>
</tr>
<tr>
<td>[% 'Transaction Type' | $T8 %]</td>
<td align=left></td>
<td>[% L.select_tag("transaction_type", [
[ "all", LxERP.t8("All") ],
[ "ar", LxERP.t8("AR Transactions") ],
[ "ap", LxERP.t8("AP Transactions") ],
],
default=all,
style=style) %]</td>
</tr>
</table>
</td>
</tr>
Expand Down

0 comments on commit 2400dcd

Please sign in to comment.