Revision 04caff2d
Von Rolf Fluehmann vor mehr als 8 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
249 | 249 |
|
250 | 250 |
my $worker = sub { |
251 | 251 |
my %data = $self->calculate_prices_and_taxes; |
252 |
my $grossamount = $self->amount; |
|
253 |
$self->amount($::form->round_amount($grossamount, 2, 1)); |
|
254 |
my $rounding = $::form->round_amount( |
|
255 |
$self->amount - $grossamount, |
|
256 |
2 |
|
257 |
); |
|
258 | 252 |
|
259 | 253 |
$self->_post_create_assemblyitem_entries($data{assembly_items}); |
260 | 254 |
$self->save; |
... | ... | |
262 | 256 |
$self->_post_add_acctrans($data{amounts_cogs}); |
263 | 257 |
$self->_post_add_acctrans($data{amounts}); |
264 | 258 |
$self->_post_add_acctrans($data{taxes}); |
259 |
|
|
265 | 260 |
$self->_post_add_acctrans({ $params{ar_id} => $self->amount * -1 }); |
266 | 261 |
|
267 | 262 |
$self->_post_update_allocated($data{allocated}); |
268 |
|
|
269 |
$self->_post_book_rounding($rounding); |
|
270 | 263 |
}; |
271 | 264 |
|
272 | 265 |
if ($self->db->in_transaction) { |
... | ... | |
303 | 296 |
} |
304 | 297 |
} |
305 | 298 |
|
306 |
sub _post_book_rounding { |
|
307 |
my ($self, $rounding) = @_; |
|
308 |
|
|
309 |
my $tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id; |
|
310 |
my $rnd_accno = $rounding == 0 ? 0 |
|
311 |
: $rounding > 0 ? SL::DB::Default->get->rndgain_accno_id |
|
312 |
: SL::DB::Default->get->rndloss_accno_id |
|
313 |
; |
|
314 |
if ($rnd_accno != 0) { |
|
315 |
SL::DB::AccTransaction->new(trans_id => $self->id, |
|
316 |
chart_id => $rnd_accno, |
|
317 |
amount => $rounding, |
|
318 |
tax_id => $tax_id, |
|
319 |
taxkey => 0, |
|
320 |
project_id => $self->globalproject_id, |
|
321 |
transdate => $self->transdate, |
|
322 |
chart_link => $rnd_accno)->save; |
|
323 |
} |
|
324 |
} |
|
325 |
|
|
326 | 299 |
sub add_ar_amount_row { |
327 | 300 |
my ($self, %params ) = @_; |
328 | 301 |
|
Auch abrufbar als: Unified diff
Revert "added roundings for periodic invoices"
This reverts commit 64b3d19a8012187c3c01717b91d59df2b2753ee3.