Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 83b9d2b3

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID 83b9d2b3008f931f4fb7fdce5c456b658c8f75b3
  • Vorgänger 0743ffa0
  • Nachfolger dc0172cf

Workflow: sales_reclamation → credit_note

Unterschiede anzeigen:

bin/mozilla/is.pl
645 645
    title creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id
646 646
    max_dunning_level dunning_amount dunning_description
647 647
    taxaccounts cursor_fokus
648
    convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
648
    convert_from_reclamations_ids convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
649 649
    invoice_id
650 650
    show_details
651 651
  ), @custom_hiddens,
......
1412 1412
  $main::lxdebug->leave_sub();
1413 1413
}
1414 1414

  
1415
sub credit_note_from_reclamation {
1416
  $main::lxdebug->enter_sub();
1417

  
1418
  $main::auth->assert('invoice_edit');
1419

  
1420
  my $form     = $main::form;
1421
  my %myconfig = %main::myconfig;
1422
  my $locale   = $main::locale;
1423

  
1424

  
1425
  my $from_id = delete $form->{from_id};
1426
  my $reclamation = SL::DB::Reclamation->new(id => $from_id)->load;
1427

  
1428
  $reclamation->flatten_to_form($form, format_amounts => 1);
1429

  
1430
  # set new persistent ids for credit note and link previous reclamation id
1431
  $form->{convert_from_reclamations_ids} = $form->{id};
1432
  $form->{id}     = '';
1433

  
1434
  $form->{"converted_from_reclamation_items_id_$_"} = delete $form->{"reclamation_items_id_$_"} for 1 .. $form->{"rowcount"};
1435

  
1436
  $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1437
  $form->{duedate} =
1438
    $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1439

  
1440
  $form->{title}  = $locale->text('Add Credit Note');
1441
  $form->{script} = 'is.pl';
1442

  
1443
  # bo creates the id, reset it
1444
  map { delete $form->{$_} }
1445
    qw(id invnumber subject message cc bcc printed emailed queued);
1446
  $form->{ $form->{vc} } =~ s/--.*//g;
1447

  
1448
  $form->{type} = "credit_note";
1449

  
1450
  my $currency = $form->{currency};
1451
  &invoice_links;
1452
  $form->{currency}     = $currency;
1453
  $form->{forex}        = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{invdate}, 'buy');
1454
  $form->{exchangerate} = $form->{forex} || '';
1455

  
1456
  $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1457

  
1458
  &prepare_invoice;
1459

  
1460
  &display_form;
1461

  
1462
  $main::lxdebug->leave_sub();
1463
}
1464

  
1415 1465
sub display_form {
1416 1466
  $::lxdebug->enter_sub;
1417 1467

  

Auch abrufbar als: Unified diff