Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d9f8d8b4

Von Bernd Bleßmann vor etwa 3 Jahren hinzugefügt

  • ID d9f8d8b4da50fec4e102555febad888ccacf4411
  • Vorgänger 2d66b506
  • Nachfolger 238d4a46

Anzahlungs-Rg.: Gegenbuchung bei Schluss-Rg.

Unterschiede anzeigen:

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

  
bin/mozilla/is.pl
1192 1192
  # (order) -> invoice for adv. payment 1 -> invoice for adv. payment 2 -> invoice for adv. payment 3 -> final invoice
1193 1193
  #
1194 1194
  # we are currently in the last invoice for adv. payment (3 in this example)
1195
  my $invoice_obj      = SL::DB::Invoice->load_cached($form->{id});
1196
  my $links            = $invoice_obj->linked_records(direction => 'from', from => ['Invoice'], recursive => 1);
1197
  my @related_invoices = grep {'SL::DB::Invoice' eq ref $_ && "invoice_for_advance_payment" eq $_->type} @$links;
1198

  
1199
  push @related_invoices, $invoice_obj;
1195
  my $related_invoices = IS->_get_invoices_for_advance_payment($form->{id});
1200 1196

  
1201 1197
  delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)};
1202 1198

  
......
1223 1219
  remove_emptied_rows(1);
1224 1220

  
1225 1221
  my $i = 0;
1226
  foreach my $ri (@related_invoices) {
1222
  foreach my $ri (@$related_invoices) {
1227 1223
    foreach my $item (@{$ri->items_sorted}) {
1228 1224
      $i++;
1229 1225
      $form->{"id_$i"}         = $item->parts_id;

Auch abrufbar als: Unified diff