Revision 58186225
Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
1054 | 1054 |
# entsprechend auch beim Bestimmen des Steuerschlüssels in Taxkey.pm berücksichtigen |
1055 | 1055 |
my $taxdate = $form->{tax_point} ||$form->{deliverydate} || $form->{invdate}; |
1056 | 1056 |
|
1057 |
|
|
1058 |
# reverse booking for invoices for advance payment |
|
1059 |
my $invoices_for_advance_payment = $self->_get_invoices_for_advance_payment($form->{convert_from_ar_ids} || $form->{id}); |
|
1060 |
foreach my $invoice_for_advance_payment (@$invoices_for_advance_payment) { |
|
1061 |
my $transactions = SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $invoice_for_advance_payment->id ], sort_by => 'acc_trans_id ASC'); |
|
1062 |
foreach my $transaction (@$transactions) { |
|
1063 |
$form->{amount}->{$invoice_for_advance_payment->id}->{$transaction->chart->accno} = -1 * $transaction->amount; |
|
1064 |
} |
|
1065 |
} |
|
1066 |
|
|
1057 | 1067 |
foreach my $trans_id (keys %{ $form->{amount_cogs} }) { |
1058 | 1068 |
foreach my $accno (keys %{ $form->{amount_cogs}{$trans_id} }) { |
1059 | 1069 |
next unless ($form->{expense_inventory} =~ /\Q$accno\E/); |
... | ... | |
1474 | 1484 |
return 1; |
1475 | 1485 |
} |
1476 | 1486 |
|
1487 |
sub _get_invoices_for_advance_payment { |
|
1488 |
my ($self, $id) = @_; |
|
1489 |
|
|
1490 |
return [] if !$id; |
|
1491 |
|
|
1492 |
my $invoice_obj = SL::DB::Invoice->new(id => $id*1)->load; |
|
1493 |
my $links = $invoice_obj->linked_records(direction => 'from', from => ['Invoice'], recursive => 1); |
|
1494 |
my @related_invoices = grep {'SL::DB::Invoice' eq ref $_ && "invoice_for_advance_payment" eq $_->type} @$links; |
|
1495 |
|
|
1496 |
push @related_invoices, $invoice_obj if "invoice_for_advance_payment" eq $invoice_obj->type; |
|
1497 |
|
|
1498 |
return \@related_invoices; |
|
1499 |
} |
|
1500 |
|
|
1501 |
|
|
1477 | 1502 |
sub transfer_out { |
1478 | 1503 |
$::lxdebug->enter_sub; |
1479 | 1504 |
|
Auch abrufbar als: Unified diff
Anzahlungs-Rg.: Gegenbuchung bei Schluss-Rg.