Revision 63410aa6
Von Sven Schöling vor mehr als 7 Jahren hinzugefügt
t/datev/invoices.t | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use_ok 'Support::TestSetup'; |
8 | 8 |
use SL::DATEV qw(:CONSTANTS); |
9 |
use SL::Dev::ALL; |
|
9 |
use SL::Dev::ALL qw(:ALL);
|
|
10 | 10 |
use List::Util qw(sum); |
11 | 11 |
use SL::DB::Buchungsgruppe; |
12 | 12 |
use SL::DB::Chart; |
... | ... | |
24 | 24 |
my $payment_date = DateTime->new(year => 2017, month => 1, day => 5); |
25 | 25 |
my $gldate = DateTime->new(year => 2017, month => 2, day => 9); # simulate bookings for Jan being made in Feb |
26 | 26 |
|
27 |
my $part1 = SL::Dev::Part::create_part(partnumber => '19', description => 'Part 19%')->save;
|
|
28 |
my $part2 = SL::Dev::Part::create_part(
|
|
27 |
my $part1 = new_part(partnumber => '19', description => 'Part 19%')->save;
|
|
28 |
my $part2 = new_part(
|
|
29 | 29 |
partnumber => '7', |
30 | 30 |
description => 'Part 7%', |
31 | 31 |
buchungsgruppen_id => $buchungsgruppe7->id, |
32 | 32 |
)->save; |
33 | 33 |
|
34 |
my $invoice = SL::Dev::Record::create_sales_invoice(
|
|
34 |
my $invoice = create_sales_invoice( |
|
35 | 35 |
invnumber => "1 sales invoice", |
36 | 36 |
itime => $gldate, |
37 | 37 |
gldate => $gldate, |
38 | 38 |
intnotes => 'booked in February', |
39 | 39 |
taxincluded => 0, |
40 | 40 |
transdate => $date, |
41 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 3, sellprice => 70),
|
|
42 |
SL::Dev::Record::create_invoice_item(part => $part2, qty => 10, sellprice => 50),
|
|
41 |
invoiceitems => [ create_invoice_item(part => $part1, qty => 3, sellprice => 70), |
|
42 |
create_invoice_item(part => $part2, qty => 10, sellprice => 50), |
|
43 | 43 |
] |
44 | 44 |
); |
45 | 45 |
$invoice->pay_invoice(chart_id => $bank->id, |
... | ... | |
85 | 85 |
], "trans_id datev check ok"; |
86 | 86 |
|
87 | 87 |
my $march_9 = DateTime->new(year => 2017, month => 3, day => 9); |
88 |
my $invoice2 = SL::Dev::Record::create_sales_invoice(
|
|
88 |
my $invoice2 = create_sales_invoice( |
|
89 | 89 |
invnumber => "2 sales invoice", |
90 | 90 |
itime => $march_9, |
91 | 91 |
gldate => $march_9, |
92 | 92 |
intnotes => 'booked in March', |
93 | 93 |
taxincluded => 0, |
94 | 94 |
transdate => $date, |
95 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 6, sellprice => 70),
|
|
96 |
SL::Dev::Record::create_invoice_item(part => $part2, qty => 20, sellprice => 50),
|
|
95 |
invoiceitems => [ create_invoice_item(part => $part1, qty => 6, sellprice => 70), |
|
96 |
create_invoice_item(part => $part2, qty => 20, sellprice => 50), |
|
97 | 97 |
] |
98 | 98 |
); |
99 | 99 |
|
100 |
my $credit_note = SL::Dev::Record::create_credit_note(
|
|
100 |
my $credit_note = create_credit_note( |
|
101 | 101 |
invnumber => 'Gutschrift 34', |
102 | 102 |
itime => $gldate, |
103 | 103 |
gldate => $gldate, |
104 | 104 |
intnotes => 'booked in February', |
105 | 105 |
taxincluded => 0, |
106 | 106 |
transdate => $date, |
107 |
invoiceitems => [ SL::Dev::Record::create_invoice_item(part => $part1, qty => 3, sellprice => 70),
|
|
108 |
SL::Dev::Record::create_invoice_item(part => $part2, qty => 10, sellprice => 50),
|
|
107 |
invoiceitems => [ create_invoice_item(part => $part1, qty => 3, sellprice => 70), |
|
108 |
create_invoice_item(part => $part2, qty => 10, sellprice => 50), |
|
109 | 109 |
] |
110 | 110 |
); |
111 | 111 |
|
Auch abrufbar als: Unified diff
Tests: SL::Dev Änderungen übernommen