Revision 04caff2d
Von Rolf Fluehmann vor fast 9 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
|
||
my $worker = sub {
|
||
my %data = $self->calculate_prices_and_taxes;
|
||
my $grossamount = $self->amount;
|
||
$self->amount($::form->round_amount($grossamount, 2, 1));
|
||
my $rounding = $::form->round_amount(
|
||
$self->amount - $grossamount,
|
||
2
|
||
);
|
||
|
||
$self->_post_create_assemblyitem_entries($data{assembly_items});
|
||
$self->save;
|
||
... | ... | |
$self->_post_add_acctrans($data{amounts_cogs});
|
||
$self->_post_add_acctrans($data{amounts});
|
||
$self->_post_add_acctrans($data{taxes});
|
||
|
||
$self->_post_add_acctrans({ $params{ar_id} => $self->amount * -1 });
|
||
|
||
$self->_post_update_allocated($data{allocated});
|
||
|
||
$self->_post_book_rounding($rounding);
|
||
};
|
||
|
||
if ($self->db->in_transaction) {
|
||
... | ... | |
}
|
||
}
|
||
|
||
sub _post_book_rounding {
|
||
my ($self, $rounding) = @_;
|
||
|
||
my $tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id;
|
||
my $rnd_accno = $rounding == 0 ? 0
|
||
: $rounding > 0 ? SL::DB::Default->get->rndgain_accno_id
|
||
: SL::DB::Default->get->rndloss_accno_id
|
||
;
|
||
if ($rnd_accno != 0) {
|
||
SL::DB::AccTransaction->new(trans_id => $self->id,
|
||
chart_id => $rnd_accno,
|
||
amount => $rounding,
|
||
tax_id => $tax_id,
|
||
taxkey => 0,
|
||
project_id => $self->globalproject_id,
|
||
transdate => $self->transdate,
|
||
chart_link => $rnd_accno)->save;
|
||
}
|
||
}
|
||
|
||
sub add_ar_amount_row {
|
||
my ($self, %params ) = @_;
|
||
|
Auch abrufbar als: Unified diff
Revert "added roundings for periodic invoices"
This reverts commit 64b3d19a8012187c3c01717b91d59df2b2753ee3.