Revision 1a3b9961
Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt
SL/DATEV.pm | ||
---|---|---|
383 | 383 |
$gl_department_id_filter = " AND gl.department_id = ? "; |
384 | 384 |
} |
385 | 385 |
|
386 |
my ($gl_itime_filter, $ar_itime_filter, $ap_itime_filter); |
|
387 |
if ( $form->{gldatefrom} ) { |
|
388 |
$gl_itime_filter = " AND gl.itime >= ? "; |
|
389 |
$ar_itime_filter = " AND ar.itime >= ? "; |
|
390 |
$ap_itime_filter = " AND ap.itime >= ? "; |
|
391 |
} |
|
392 |
|
|
386 | 393 |
if ( $self->{trans_id} ) { |
387 | 394 |
# ignore dates when trans_id is passed so that the entire transaction is |
388 | 395 |
# checked, not just either the initial bookings or the subsequent payments |
... | ... | |
419 | 426 |
WHERE (ar.id IS NOT NULL) |
420 | 427 |
AND $fromto |
421 | 428 |
$trans_id_filter |
429 |
$ar_itime_filter |
|
422 | 430 |
$ar_department_id_filter |
423 | 431 |
$filter |
424 | 432 |
|
... | ... | |
443 | 451 |
WHERE (ap.id IS NOT NULL) |
444 | 452 |
AND $fromto |
445 | 453 |
$trans_id_filter |
454 |
$ap_itime_filter |
|
446 | 455 |
$ap_department_id_filter |
447 | 456 |
$filter |
448 | 457 |
|
... | ... | |
466 | 475 |
WHERE (gl.id IS NOT NULL) |
467 | 476 |
AND $fromto |
468 | 477 |
$trans_id_filter |
478 |
$gl_itime_filter |
|
469 | 479 |
$gl_department_id_filter |
470 | 480 |
$filter |
471 | 481 |
|
472 | 482 |
ORDER BY trans_id, acc_trans_id|; |
473 | 483 |
|
474 | 484 |
my @query_args; |
475 |
if ( $form->{department_id} ) { |
|
476 |
push(@query_args, ($form->{department_id}) x 3); |
|
485 |
if ( $form->{gldatefrom} or $form->{department_id} ) { |
|
486 |
|
|
487 |
for ( 1 .. 3 ) { |
|
488 |
if ( $form->{gldatefrom} ) { |
|
489 |
my $glfromdate = $::locale->parse_date_to_object($form->{gldatefrom}); |
|
490 |
die "illegal data" unless ref($glfromdate) eq 'DateTime'; |
|
491 |
push(@query_args, $glfromdate); |
|
492 |
} |
|
493 |
if ( $form->{department_id} ) { |
|
494 |
push(@query_args, $form->{department_id}); |
|
495 |
} |
|
496 |
} |
|
477 | 497 |
} |
478 | 498 |
|
479 | 499 |
my $sth = prepare_execute_query($form, $self->dbh, $query, @query_args); |
doc/changelog | ||
---|---|---|
11 | 11 |
- Stammdaten -> Berichte -> Artikel: Standardlager und Lagerplatz optional anzeigen |
12 | 12 |
- Vorbelegte Texte inkl. Ansprechpartner für den E-Mail-Versand bei allen Workflows hinzugefügt. |
13 | 13 |
|
14 |
- DATEV-Export: Buchungen für einen bestimmten Zeitraum ab einem |
|
15 |
Buchungsdatum filtern. Z.B. wenn man einen DATEV-Export für Januar schon |
|
16 |
exportiert hat, und im Juni noch ein Buchung für Januar nachbucht, kann man |
|
17 |
mit "Erfassungsdatum Von: 01.06.2017" nur diese eine Buchung aus Januar |
|
18 |
exportieren. |
|
19 |
|
|
14 | 20 |
2017-07-17 - Release 3.5.0 |
15 | 21 |
|
16 | 22 |
große Features: |
t/datev/invoices.t | ||
---|---|---|
16 | 16 |
|
17 | 17 |
clear_up(); |
18 | 18 |
|
19 |
my $dbh = SL::DB->client->dbh; |
|
20 |
|
|
19 | 21 |
my $buchungsgruppe7 = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 7%') || die "No accounting group for 7\%"; |
20 | 22 |
my $bank = SL::DB::Manager::Chart->find_by(description => 'Bank') || die 'Can\'t find chart "Bank"'; |
21 | 23 |
my $date = DateTime->new(year => 2017, month => 1, day => 1); |
22 | 24 |
my $payment_date = DateTime->new(year => 2017, month => 1, day => 5); |
25 |
my $gldate = DateTime->new(year => 2017, month => 2, day => 9); # simulate bookings for Jan being made in Feb |
|
23 | 26 |
|
24 | 27 |
my $part1 = SL::Dev::Part::create_part(partnumber => '19', description => 'Part 19%')->save; |
25 | 28 |
my $part2 = SL::Dev::Part::create_part( |
... | ... | |
30 | 33 |
|
31 | 34 |
my $invoice = SL::Dev::Record::create_sales_invoice( |
32 | 35 |
invnumber => "1 sales invoice", |
36 |
itime => $gldate, |
|
37 |
gldate => $gldate, |
|
38 |
intnotes => 'booked in February', |
|
33 | 39 |
taxincluded => 0, |
34 | 40 |
transdate => $date, |
35 | 41 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 3, sellprice => 70), |
... | ... | |
78 | 84 |
}, |
79 | 85 |
], "trans_id datev check ok"; |
80 | 86 |
|
87 |
my $march_9 = DateTime->new(year => 2017, month => 3, day => 9); |
|
81 | 88 |
my $invoice2 = SL::Dev::Record::create_sales_invoice( |
82 | 89 |
invnumber => "2 sales invoice", |
90 |
itime => $march_9, |
|
91 |
gldate => $march_9, |
|
92 |
intnotes => 'booked in March', |
|
83 | 93 |
taxincluded => 0, |
84 | 94 |
transdate => $date, |
85 | 95 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 6, sellprice => 70), |
... | ... | |
89 | 99 |
|
90 | 100 |
my $credit_note = SL::Dev::Record::create_credit_note( |
91 | 101 |
invnumber => 'Gutschrift 34', |
102 |
itime => $gldate, |
|
103 |
gldate => $gldate, |
|
104 |
intnotes => 'booked in February', |
|
92 | 105 |
taxincluded => 0, |
93 | 106 |
transdate => $date, |
94 | 107 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 3, sellprice => 70), |
... | ... | |
96 | 109 |
] |
97 | 110 |
); |
98 | 111 |
|
99 |
my $startdate = DateTime->new(year => 2017, month => 1, day => 1); |
|
112 |
my $startdate = DateTime->new(year => 2017, month => 1, day => 1);
|
|
100 | 113 |
my $enddate = DateTime->new(year => 2017, month => 12, day => 31); |
101 | 114 |
|
102 | 115 |
my $datev = SL::DATEV->new( |
103 |
dbh => $credit_note->db->dbh, |
|
116 |
dbh => $dbh, |
|
117 |
from => $startdate, |
|
118 |
to => $enddate, |
|
119 |
); |
|
120 |
$datev->generate_datev_data(from_to => $datev->fromto); |
|
121 |
my $datev_lines = $datev->generate_datev_lines; |
|
122 |
my $umsatzsumme = sum map { $_->{umsatz} } @{ $datev_lines }; |
|
123 |
cmp_ok($::form->round_amount($umsatzsumme,2), '==', 3924.5, "Sum of all bookings ok"); |
|
124 |
|
|
125 |
note('testing gldatefrom'); |
|
126 |
my $datev = SL::DATEV->new( |
|
127 |
dbh => $dbh, |
|
104 | 128 |
from => $startdate, |
105 |
to => $enddate
|
|
129 |
to => DateTime->new(year => 2017, month => 01, day => 31),
|
|
106 | 130 |
); |
131 |
|
|
132 |
$::form = Support::TestSetup->create_new_form; |
|
133 |
$::form->{gldatefrom} = DateTime->new(year => 2017, month => 3, day => 1)->to_kivitendo; |
|
134 |
|
|
107 | 135 |
$datev->generate_datev_data(from_to => $datev->fromto); |
108 | 136 |
my $datev_lines = $datev->generate_datev_lines; |
109 | 137 |
my $umsatzsumme = sum map { $_->{umsatz} } @{ $datev_lines }; |
110 |
is($umsatzsumme, 3924.50, "umsatzsumme ok"); |
|
138 |
cmp_ok($umsatzsumme, '==', 1569.8, "Sum of bookings made after March 1st (only invoice2) ok"); |
|
139 |
|
|
140 |
$::form->{gldatefrom} = DateTime->new(year => 2017, month => 5, day => 1)->to_kivitendo; |
|
141 |
$datev->generate_datev_data(from_to => $datev->fromto); |
|
142 |
cmp_bag $datev->generate_datev_lines, [], "no bookings for January made after May 1st: ok"; |
|
111 | 143 |
|
112 | 144 |
done_testing(); |
113 | 145 |
clear_up(); |
... | ... | |
120 | 152 |
SL::DB::Manager::Part->delete_all( all => 1); |
121 | 153 |
}; |
122 | 154 |
|
123 |
|
|
124 | 155 |
1; |
125 |
|
templates/webpages/datev/export_bewegungsdaten.html | ||
---|---|---|
54 | 54 |
</table> |
55 | 55 |
</td> |
56 | 56 |
</tr> |
57 |
[% IF ALL_DEPARTMENTS.as_list.size %] |
|
58 |
<tr> |
|
59 |
<th align=left>[% 'Department' | $T8 %]</th> |
|
60 |
</tr> |
|
61 | 57 |
<tr> |
62 |
<td> |
|
63 |
<table> |
|
64 |
<tr> |
|
65 |
<td align=left>[% 'Department' | $T8 %]</td> |
|
66 |
<td align=left></td> |
|
67 |
<td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1) %]</td> |
|
68 |
</tr> |
|
69 |
</table> |
|
70 |
</td> |
|
58 |
<td><hr size=1 noshade></td> |
|
59 |
</tr> |
|
60 |
<tr> |
|
61 |
<td> |
|
62 |
<table> |
|
63 |
<tr> |
|
64 |
<td align=left>[% 'Gldate' | $T8 %] [% 'From' | $T8 %]</td> |
|
65 |
<td align=left></td> |
|
66 |
<td>[% L.date_tag('gldatefrom') %]</td> |
|
67 |
</tr> |
|
68 |
</table> |
|
69 |
</td> |
|
70 |
</tr> |
|
71 |
<tr> |
|
72 |
<tr> |
|
73 |
<td><hr size=1 noshade></td> |
|
74 |
</tr> |
|
75 |
[% IF ALL_DEPARTMENTS.as_list.size %] |
|
76 |
<tr> |
|
77 |
<td> |
|
78 |
<table> |
|
79 |
<tr> |
|
80 |
<td align=left>[% 'Department' | $T8 %]</td> |
|
81 |
<td align=left></td> |
|
82 |
<td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1) %]</td> |
|
83 |
</tr> |
|
84 |
</table> |
|
85 |
</td> |
|
86 |
</tr> |
|
87 |
<tr> |
|
88 |
<td><hr size=3 noshade></td> |
|
71 | 89 |
</tr> |
72 | 90 |
[% END %] |
73 |
<tr> |
|
74 |
<td><hr size=3 noshade></td> |
|
75 |
</tr> |
|
76 | 91 |
</table> |
77 | 92 |
|
78 | 93 |
<input type=hidden name=beraternr value="[% beraternr %]"> |
Auch abrufbar als: Unified diff
DATEV-Export nach Erfassungsdatum filtern
Hat man einen DATEV-Export schon für einen bestimmten Zeitraum
exportiert, und muß nachträglich noch ein paar Buchungen in dem Zeitraum
tätigen, kann man diese nachträglichen Buchungen nun gesondert
exportieren, indem man ein Datum nach dem letzten Exportdatum
angibt.