Revision f0868a2c
Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
1067 | 1067 |
my $clearing_chart = SL::DB::Chart->new(id => $::instance_conf->get_advance_payment_clearing_chart_id)->load; |
1068 | 1068 |
die "No Clearing Chart for Advance Payment" unless ref $clearing_chart eq 'SL::DB::Chart'; |
1069 | 1069 |
foreach my $invoice_for_advance_payment (@$invoices_for_advance_payment) { |
1070 |
# delete ? post twice case ? |
|
1070 |
# delete ? |
|
1071 |
# --> is implemented below (bookings are marked in memo field) |
|
1072 |
# |
|
1073 |
# post twice case ? |
|
1074 |
# ? |
|
1075 |
# |
|
1071 | 1076 |
# TODO: helper table acc_trans_advance_payment |
1072 | 1077 |
# trans_id for final invoice connects to acc_trans_id here |
1073 | 1078 |
# my $booking = SL::DB::AccTrans->new( ...) |
1079 |
# --> helper table not nessessary because of mark in memo field |
|
1080 |
# |
|
1074 | 1081 |
# TODO: If final_invoice change (delete storno) delete all connectin acc_trans entries, if |
1075 | 1082 |
# period is not closed |
1083 |
# --> no problem because gldate of reverse booking is date of final invoice |
|
1084 |
# if deletion of final invoice is allowed, reverting bookings in invoices |
|
1085 |
# for advance payment are allowed, too. |
|
1076 | 1086 |
# $booking->id, $self->id in helper table |
1077 | 1087 |
$form->{amount}->{$invoice_for_advance_payment->id}->{$clearing_chart->accno} = -1 * $invoice_for_advance_payment->netamount; |
1078 | 1088 |
$form->{memo} ->{$invoice_for_advance_payment->id}->{$clearing_chart->accno} = 'reverse booking by final invoice'; |
... | ... | |
2054 | 2064 |
# if we delete a final invoice, the reverse bookings for the clearing account in the invoice for advance payment |
2055 | 2065 |
# must be deleted as well |
2056 | 2066 |
my $invoices_for_advance_payment = $self->_get_invoices_for_advance_payment($form->{convert_from_ar_ids} || $form->{id}); |
2067 |
|
|
2068 |
# Todo: allow only if invoice for advance payment is not paid. |
|
2069 |
# die if any { $_->paid } for @$invoices_for_advance_payment; |
|
2057 | 2070 |
my @trans_ids_to_consider = map { $_->id } @$invoices_for_advance_payment; |
2058 | 2071 |
if (scalar @trans_ids_to_consider) { |
2059 | 2072 |
my $query = sprintf 'DELETE FROM acc_trans WHERE memo LIKE ? AND trans_id IN (%s)', join ', ', ("?") x scalar @trans_ids_to_consider; |
Auch abrufbar als: Unified diff
Anzahlungs-Rg.: Kommentare f. Todos