From: jan Date: Fri, 18 Dec 2009 08:19:25 +0000 (+0100) Subject: SL/OP.pm wird hat schon laenger keine sinnvolle funktion. entsprechend rausgenommen X-Git-Tag: release-2.6.1beta1~75 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=563a5200e1d2f3cdfec65c407a020f6106528579;p=kivitendo-erp.git SL/OP.pm wird hat schon laenger keine sinnvolle funktion. entsprechend rausgenommen --- diff --git a/SL/CP.pm b/SL/CP.pm index dec4323e2..e29622fb3 100644 --- a/SL/CP.pm +++ b/SL/CP.pm @@ -358,15 +358,12 @@ sub process_payment { } } - # record a AR/AP with a payment - if ($form->round_amount($paymentamount, 2) > 0) { - $form->{invnumber} = ""; - OP::overpayment("", $myconfig, $form, $dbh, $paymentamount, $ml, 1); - } - my $rc; if ($form->round_amount($paymentamount, 2) < 0) { - $dbh->rollback; + # Hier werden negativen Zahlungseingänge abgefangen + # Besser: in Oberfläche schon prüfen + # Zahlungsein- und ausgänge sind immer positiv + $dbh->rollback; $rc = 0; } if ($form->round_amount($paymentamount, 2) == 0) { diff --git a/SL/OP.pm b/SL/OP.pm deleted file mode 100644 index 43be29bf4..000000000 --- a/SL/OP.pm +++ /dev/null @@ -1,105 +0,0 @@ -#===================================================================== -# LX-Office ERP -# Copyright (C) 2004 -# Based on SQL-Ledger Version 2.1.9 -# Web http://www.lx-office.org -# -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2003 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# Contributors: -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#====================================================================== -# -# Overpayment function -# used in AR, AP, IS, IR, OE, CP -#====================================================================== - -package OP; - -use SL::DBUtils; - -use strict; - -sub overpayment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form, $dbh, $amount, $ml) = @_; - - my $fxamount = $form->round_amount($amount * $form->{exchangerate}, 2); - my ($paymentaccno) = split(/--/, $form->{account}); - - my $vc_id = $form->{vc} eq "customer" ? "customer_id" : "vendor_id"; - my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; - - my $query = qq|SELECT nextval('glid')|; - my ($new_id) = selectrow_query($form, $dbh, $query); - - # add AR/AP header transaction with a payment - $query = - qq|INSERT INTO $arap (id, invnumber, employee_id) | . - qq|VALUES (?, ?, (SELECT id FROM employee WHERE login = ?))|; - my @values = ($new_id, $form->{login}, $form->{login}); - do_query($form, $dbh, $query, @values); - - my $invnumber = ($form->{invnumber}) ? $form->{invnumber} : $new_id; - $query = - qq|UPDATE $arap SET invnumber = ?, $vc_id = ?, transdate = ?, datepaid = ?, | . - qq|duedate = ?, netamount = ?, amount = ?, paid = ?, | . - qq|curr = ?, department_id = ? | . - qq|WHERE id = ?|; - @values = ($invnumber, $form->{$vc_id}, - conv_date($form->{datepaid}), conv_date($form->{datepaid}), - conv_date($form->{datepaid}), 0, 0, $fxamount, $form->{currency}, - $form->{department_id}, $new_id); - do_query($form, $dbh, $query, @values); - - # add AR/AP - my ($accno) = split /--/, $form->{ $form->{ARAP} }; - - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ? ), ?, ?)|; - @values = ($new_id, $accno, conv_date($form->{datepaid}), $fxamount * $ml); - do_query($form, $dbh, $query, @values); - - # add payment - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, memo) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|; - @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}), - $amount * $ml * -1, $form->{source}, $form->{memo}); - do_query($form, $dbh, $query, @values); - - # add exchangerate difference - if ($fxamount != $amount) { - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, cleared, fx_transaction) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|; - @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}), - (($fxamount - $amount) * $ml * -1), 1, 1); - do_query($form, $dbh, $query, @values); - } - - $main::lxdebug->leave_sub(); -} - -1; - diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index c19cc5312..e0c567934 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -32,7 +32,6 @@ #====================================================================== use SL::CP; -use SL::OP; use SL::IS; use SL::IR;