From: Sven Schöling Date: Fri, 25 May 2007 13:48:11 +0000 (+0000) Subject: Storno fuer Kreditorenbuchungen X-Git-Tag: release-2.4.3^2~250 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6d544157899560b2b38d3407ce9874ef5694165b;p=kivitendo-erp.git Storno fuer Kreditorenbuchungen --- diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 9c71519c0..0b2676f0d 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -33,6 +33,7 @@ use SL::AP; use SL::IR; +use SL::IS; use SL::PE; require "bin/mozilla/arap.pl"; @@ -850,43 +851,30 @@ sub form_footer { $transdate = $form->datetonum($form->{transdate}, \%myconfig); $closedto = $form->datetonum($form->{closedto}, \%myconfig); - print qq||; + # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it + print qq|| + if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap') && !$form->{paid_1}); - if ($form->{id}) { + print qq||; - # print qq| - # |; + if ($form->{id}) { if ($form->{radier}) { - print qq| - - + print qq| + |; } - print qq| - - + print qq| + |; } elsif (($transdate > $closedto) && !$form->{id}) { print qq| - | . - NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), - '-class' => 'submit')); + | . + NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit')); } # button for saving history if($form->{id} ne "") { - print qq| - |; + print qq| |; } # /button for saving history print " @@ -1745,3 +1733,43 @@ sub ap_subtotal { $lxdebug->leave_sub(); } + +sub storno { + $lxdebug->enter_sub(); + + if (IS->has_storno(\%myconfig, $form, 'ap')) { + $form->{title} = $locale->text("Cancel Accounts Payables Transaction"); + $form->error($locale->text("Transaction has already been cancelled!")); + } + + # negate amount/taxes + for my $i (1 .. $form->{rowcount}) { + $form->{"amount_$i"} *= -1; + $form->{"tax_$i"} *= -1; + } + + # format things + for my $i (1 .. $form->{rowcount}) { + for (qw(amount tax)) { + $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) if $form->{"${_}_$i"}; + } + } + + $form->{storno} = 1; + $form->{storno_id} = $form->{id}; + $form->{id} = 0; + + $form->{invnumber} = "Storno-" . $form->{invnumber}; + + post(); + + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = "ordnumber_$form->{ordnumber}"; + $form->{addition} = "STORNO"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + + $lxdebug->leave_sub(); +} diff --git a/locale/de/all b/locale/de/all index 3fba12eec..ac16e7d14 100644 --- a/locale/de/all +++ b/locale/de/all @@ -210,6 +210,7 @@ aktualisieren wollen?', 'C' => 'G', 'CANCELED' => 'Storniert', 'Calculate' => 'Berechnen', + 'Cancel Accounts Payables Transaction' => 'Kreditorenbuchung stornieren', 'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren', 'Cancel General Ledger Transaction' => 'Buchung stornieren', 'Cannot create Lock!' => 'System kann nicht gesperrt werden!', diff --git a/locale/de/ap b/locale/de/ap index bf8d0d19e..4c630250a 100644 --- a/locale/de/ap +++ b/locale/de/ap @@ -18,6 +18,7 @@ $self->{texts} = { 'Bin List' => 'Lagerliste', 'Bis' => 'bis', 'CANCELED' => 'Storniert', + 'Cancel Accounts Payables Transaction' => 'Kreditorenbuchung stornieren', 'Cannot delete transaction!' => 'Buchung kann nicht gelöscht werden!', 'Cannot post payment for a closed period!' => 'Es können keine Zahlungen für abgeschlossene Bücher gebucht werden!', 'Cannot post payment!' => 'Zahlung kann nicht gebucht werden!', @@ -141,6 +142,7 @@ $self->{texts} = { 'September' => 'September', 'Skip' => 'Überspringen', 'Source' => 'Beleg', + 'Storno' => 'Storno', 'Storno Invoice' => 'Stornorechnung', 'Storno Packing List' => 'Stornolieferschein', 'Subtotal' => 'Zwischensumme', @@ -150,6 +152,7 @@ $self->{texts} = { 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.', 'Total' => 'Summe', 'Transaction deleted!' => 'Buchung gelöscht!', + 'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.', 'Transaction posted!' => 'Buchung verbucht!', 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', 'Type' => 'Typ', @@ -234,6 +237,7 @@ $self->{subs} = { 'set_longdescription' => 'set_longdescription', 'show_history' => 'show_history', 'show_vc_details' => 'show_vc_details', + 'storno' => 'storno', 'update' => 'update', 'use_as_template' => 'use_as_template', 'vendor_invoice' => 'vendor_invoice', @@ -249,6 +253,7 @@ $self->{subs} = { 'zahlung_buchen' => 'post_payment', 'entwurf_speichern' => 'save_draft', 'Überspringen' => 'skip', + 'storno' => 'storno', 'erneuern' => 'update', 'als_vorlage_verwenden' => 'use_as_template', 'einkaufsrechnung' => 'vendor_invoice',