Revision 356fec7e
Von Jan Büren vor fast 6 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
123 | 123 |
my $new_acc_trans; |
124 | 124 |
|
125 | 125 |
# all three payment type create 1 AR/AP booking (the paid part) |
126 |
# difference_as_skonto creates n skonto bookings (1 for each tax type)
|
|
127 |
# with_skonto_pt creates 1 bank booking and n skonto bookings (1 for each tax type)
|
|
126 |
# difference_as_skonto creates n skonto bookings (1 for each buchungsgruppe type)
|
|
127 |
# with_skonto_pt creates 1 bank booking and n skonto bookings (1 for each buchungsgruppe type)
|
|
128 | 128 |
# without_skonto creates 1 bank booking |
129 | 129 |
|
130 | 130 |
# as long as there is no automatic tax, payments are always booked with |
... | ... | |
196 | 196 |
$new_acc_trans->save; |
197 | 197 |
push @new_acc_ids, $new_acc_trans->acc_trans_id; |
198 | 198 |
|
199 |
};
|
|
200 |
};
|
|
201 |
};
|
|
199 |
} |
|
200 |
} |
|
201 |
} |
|
202 | 202 |
|
203 | 203 |
if ( $params{payment_type} eq 'difference_as_skonto' or $params{payment_type} eq 'with_skonto_pt' ) { |
204 | 204 |
|
... | ... | |
244 | 244 |
if ( $params{payment_type} eq 'difference_as_skonto' ) { |
245 | 245 |
die "difference_as_skonto calculated incorrectly, sum of calculated payments doesn't add up to open amount $total_open_amount, reference_amount = $reference_amount\n" unless _round($reference_amount) == 0; |
246 | 246 |
} |
247 |
|
|
248 |
}; |
|
247 |
} |
|
249 | 248 |
|
250 | 249 |
my $arap_amount = 0; |
251 | 250 |
|
... | ... | |
258 | 257 |
# with_skonto_pt for completely unpaid invoices we just use the value |
259 | 258 |
# from the invoice |
260 | 259 |
$arap_amount = $total_open_amount; |
261 |
};
|
|
260 |
} |
|
262 | 261 |
|
263 | 262 |
# regardless of payment_type there is always only exactly one arap booking |
264 | 263 |
# TODO: compare $arap_amount to running total |
... | ... | |
447 | 446 |
# the result is rounded so we can directly compare it with the user input |
448 | 447 |
my $self = shift; |
449 | 448 |
|
450 |
my $is_sales = ref($self) eq 'SL::DB::Invoice'; |
|
451 |
|
|
452 | 449 |
my $percent_skonto = $self->percent_skonto || 0; |
453 | 450 |
|
454 | 451 |
return _round($self->amount - ( $self->amount * $percent_skonto) ); |
Auch abrufbar als: Unified diff
Kosmetik, Kommentar verbessert, toter Code entfernt