1 |
1 |
use strict;
|
2 |
|
use Test::More tests => 6;
|
|
2 |
use Test::More tests => 7;
|
3 |
3 |
|
4 |
4 |
use lib 't';
|
5 |
5 |
use Support::TestSetup;
|
... | ... | |
56 |
56 |
is($number_of_acc_trans , 5 , "number of transactions");
|
57 |
57 |
is($inv->datepaid->to_kivitendo , DateTime->today->to_kivitendo , "datepaid");
|
58 |
58 |
is($inv->amount - $inv->paid , 0 , "paid = amount ");
|
|
59 |
is($inv->gldate->to_kivitendo, $inv->transactions->[0]->gldate->to_kivitendo, "gldate matches in ar and acc_trans");
|
59 |
60 |
} else {
|
60 |
61 |
ok 0, "couldn't find first invoice";
|
61 |
62 |
}
|
... | ... | |
92 |
93 |
|
93 |
94 |
my $amount = $params{amount} || croak "ar needs param amount";
|
94 |
95 |
my $customer = $params{customer} || croak "ar needs param customer";
|
95 |
|
my $date = $params{date} || DateTime->today;
|
|
96 |
my $transdate = $params{transdate} || DateTime->today;
|
|
97 |
my $gldate = $params{gldate} || DateTime->today->add(days => 1);
|
96 |
98 |
my $with_payment = $params{with_payment} || 0;
|
97 |
99 |
|
98 |
100 |
# SL::DB::Invoice has a _before_save_set_invnumber hook, so we don't need to pass invnumber
|
... | ... | |
100 |
102 |
invoice => 0,
|
101 |
103 |
amount => $amount,
|
102 |
104 |
netamount => $amount,
|
103 |
|
transdate => $date,
|
|
105 |
transdate => $transdate,
|
|
106 |
gldate => $gldate,
|
104 |
107 |
taxincluded => 'f',
|
105 |
108 |
customer_id => $customer->id,
|
106 |
109 |
taxzone_id => $customer->taxzone_id,
|
... | ... | |
144 |
147 |
|
145 |
148 |
my $amount = $params{amount} || croak "ar needs param amount";
|
146 |
149 |
my $customer = $params{customer} || croak "ar needs param customer";
|
147 |
|
my $date = $params{date} || DateTime->today;
|
|
150 |
my $transdate = $params{transdate} || DateTime->today;
|
|
151 |
my $gldate = $params{gldate} || DateTime->today->add(days => 1);
|
148 |
152 |
my $with_payment = $params{with_payment} || 0;
|
149 |
153 |
|
150 |
154 |
my $invoice = SL::DB::Invoice->new(
|
151 |
155 |
invoice => 0,
|
152 |
156 |
amount => $amount,
|
153 |
157 |
netamount => $amount,
|
154 |
|
transdate => $date,
|
|
158 |
transdate => $transdate,
|
|
159 |
gldate => $gldate,
|
155 |
160 |
taxincluded => 'f',
|
156 |
161 |
customer_id => $customer->id,
|
157 |
162 |
taxzone_id => $customer->taxzone_id,
|
add_{ap|ar}_amount_row berücksichtigen gldate
Ansonsten konnte gldate in ar/ap und acc_trans abweichen, wenn gldate
explizit gesetzt war und nicht dem aktuellen Tag entsprach.