Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e9013716

Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt

  • ID e9013716fffd65de9d3df3ae7608cbd6c5c99de8
  • Vorgänger 44212e4b
  • Nachfolger b2670cff

Workflow: sales_reclamation → credit_note

Unterschiede anzeigen:

bin/mozilla/is.pl
649 649
    title creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id
650 650
    max_dunning_level dunning_amount dunning_description
651 651
    taxaccounts cursor_fokus
652
    convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
652
    convert_from_reclamations_ids convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
653 653
    invoice_id
654 654
    show_details
655 655
  ), @custom_hiddens,
......
1434 1434
  $main::lxdebug->leave_sub();
1435 1435
}
1436 1436

  
1437
sub credit_note_from_reclamation {
1438
  $main::lxdebug->enter_sub();
1439

  
1440
  $main::auth->assert('invoice_edit');
1441

  
1442
  my $form     = $main::form;
1443
  my %myconfig = %main::myconfig;
1444
  my $locale   = $main::locale;
1445

  
1446

  
1447
  my $from_id = delete $form->{from_id};
1448
  my $reclamation = SL::DB::Reclamation->new(id => $from_id)->load;
1449

  
1450
  $reclamation->flatten_to_form($form, format_amounts => 1);
1451

  
1452
  # set new persistent ids for credit note and link previous reclamation id
1453
  $form->{convert_from_reclamations_ids} = $form->{id};
1454
  $form->{id}     = '';
1455

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

  
1458
  $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1459
  $form->{duedate} =
1460
    $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1461

  
1462
  $form->{title}  = $locale->text('Add Credit Note');
1463
  $form->{script} = 'is.pl';
1464

  
1465
  # bo creates the id, reset it
1466
  map { delete $form->{$_} }
1467
    qw(id invnumber subject message cc bcc printed emailed queued);
1468
  $form->{ $form->{vc} } =~ s/--.*//g;
1469

  
1470
  $form->{type} = "credit_note";
1471

  
1472
  my $currency = $form->{currency};
1473
  &invoice_links;
1474
  $form->{currency}     = $currency;
1475
  $form->{forex}        = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{invdate}, 'buy');
1476
  $form->{exchangerate} = $form->{forex} || '';
1477

  
1478
  $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1479

  
1480
  &prepare_invoice;
1481

  
1482
  &display_form;
1483

  
1484
  $main::lxdebug->leave_sub();
1485
}
1486

  
1437 1487
sub display_form {
1438 1488
  $::lxdebug->enter_sub;
1439 1489

  

Auch abrufbar als: Unified diff