Revision cc9d7f43
Von Tamino Steinert vor etwa 2 Jahren hinzugefügt
bin/mozilla/is.pl | ||
---|---|---|
660 | 660 |
title creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id |
661 | 661 |
max_dunning_level dunning_amount dunning_description |
662 | 662 |
taxaccounts cursor_fokus |
663 |
convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew |
|
663 |
convert_from_reclamations_ids convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
|
|
664 | 664 |
invoice_id |
665 | 665 |
show_details |
666 | 666 |
), @custom_hiddens, |
... | ... | |
1444 | 1444 |
$main::lxdebug->leave_sub(); |
1445 | 1445 |
} |
1446 | 1446 |
|
1447 |
sub credit_note_from_reclamation { |
|
1448 |
$main::lxdebug->enter_sub(); |
|
1449 |
|
|
1450 |
$main::auth->assert('invoice_edit'); |
|
1451 |
|
|
1452 |
my $form = $main::form; |
|
1453 |
my %myconfig = %main::myconfig; |
|
1454 |
my $locale = $main::locale; |
|
1455 |
|
|
1456 |
|
|
1457 |
my $from_id = delete $form->{from_id}; |
|
1458 |
my $reclamation = SL::DB::Reclamation->new(id => $from_id)->load; |
|
1459 |
|
|
1460 |
$reclamation->flatten_to_form($form, format_amounts => 1); |
|
1461 |
|
|
1462 |
# set new persistent ids for credit note and link previous reclamation id |
|
1463 |
$form->{convert_from_reclamations_ids} = $form->{id}; |
|
1464 |
$form->{id} = ''; |
|
1465 |
|
|
1466 |
$form->{"converted_from_reclamation_items_id_$_"} = delete $form->{"reclamation_items_id_$_"} for 1 .. $form->{"rowcount"}; |
|
1467 |
|
|
1468 |
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig); |
|
1469 |
$form->{duedate} = |
|
1470 |
$form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1); |
|
1471 |
|
|
1472 |
$form->{title} = $locale->text('Add Credit Note'); |
|
1473 |
$form->{script} = 'is.pl'; |
|
1474 |
|
|
1475 |
# bo creates the id, reset it |
|
1476 |
map { delete $form->{$_} } |
|
1477 |
qw(id invnumber subject message cc bcc printed emailed queued); |
|
1478 |
$form->{ $form->{vc} } =~ s/--.*//g; |
|
1479 |
|
|
1480 |
$form->{type} = "credit_note"; |
|
1481 |
|
|
1482 |
my $currency = $form->{currency}; |
|
1483 |
&invoice_links; |
|
1484 |
$form->{currency} = $currency; |
|
1485 |
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{invdate}, 'buy'); |
|
1486 |
$form->{exchangerate} = $form->{forex} || ''; |
|
1487 |
|
|
1488 |
$form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal}); |
|
1489 |
|
|
1490 |
&prepare_invoice; |
|
1491 |
|
|
1492 |
&display_form; |
|
1493 |
|
|
1494 |
$main::lxdebug->leave_sub(); |
|
1495 |
} |
|
1496 |
|
|
1447 | 1497 |
sub display_form { |
1448 | 1498 |
$::lxdebug->enter_sub; |
1449 | 1499 |
|
Auch abrufbar als: Unified diff
Workflow: sales_reclamation → credit_note