Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 563a5200

Von jan vor fast 15 Jahren hinzugefügt

SL/OP.pm wird hat schon laenger keine sinnvolle funktion. entsprechend rausgenommen

Unterschiede anzeigen:

SL/CP.pm
358 358
    }
359 359
  }
360 360

  
361
  # record a AR/AP with a payment
362
  if ($form->round_amount($paymentamount, 2) > 0) {
363
    $form->{invnumber} = "";
364
    OP::overpayment("", $myconfig, $form, $dbh, $paymentamount, $ml, 1);
365
  }
366

  
367 361
  my $rc;
368 362
  if ($form->round_amount($paymentamount, 2) < 0) {
369
    $dbh->rollback;
363
		# Hier werden negativen Zahlungseingänge abgefangen
364
		# Besser: in Oberfläche schon prüfen
365
		# Zahlungsein- und ausgänge sind immer positiv
366
    $dbh->rollback;	
370 367
    $rc = 0;
371 368
  }
372 369
  if ($form->round_amount($paymentamount, 2) == 0) {
SL/OP.pm
1
#=====================================================================
2
# LX-Office ERP
3
# Copyright (C) 2004
4
# Based on SQL-Ledger Version 2.1.9
5
# Web http://www.lx-office.org
6
#
7
#=====================================================================
8
# SQL-Ledger Accounting
9
# Copyright (C) 2003
10
#
11
#  Author: Dieter Simader
12
#   Email: dsimader@sql-ledger.org
13
#     Web: http://www.sql-ledger.org
14
#
15
#  Contributors:
16
#
17
# This program is free software; you can redistribute it and/or modify
18
# it under the terms of the GNU General Public License as published by
19
# the Free Software Foundation; either version 2 of the License, or
20
# (at your option) any later version.
21
#
22
# This program is distributed in the hope that it will be useful,
23
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
# GNU General Public License for more details.
26
# You should have received a copy of the GNU General Public License
27
# along with this program; if not, write to the Free Software
28
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
#======================================================================
30
#
31
# Overpayment function
32
# used in AR, AP, IS, IR, OE, CP
33
#======================================================================
34

  
35
package OP;
36

  
37
use SL::DBUtils;
38

  
39
use strict;
40

  
41
sub overpayment {
42
  $main::lxdebug->enter_sub();
43

  
44
  my ($self, $myconfig, $form, $dbh, $amount, $ml) = @_;
45

  
46
  my $fxamount = $form->round_amount($amount * $form->{exchangerate}, 2);
47
  my ($paymentaccno) = split(/--/, $form->{account});
48

  
49
  my $vc_id = $form->{vc} eq "customer" ? "customer_id" : "vendor_id";
50
  my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
51

  
52
  my $query = qq|SELECT nextval('glid')|;
53
  my ($new_id) = selectrow_query($form, $dbh, $query);
54

  
55
  # add AR/AP header transaction with a payment
56
  $query =
57
    qq|INSERT INTO $arap (id, invnumber, employee_id) | .
58
    qq|VALUES (?, ?, (SELECT id FROM employee WHERE login = ?))|;
59
  my @values = ($new_id, $form->{login}, $form->{login});
60
  do_query($form, $dbh, $query, @values);
61

  
62
  my $invnumber = ($form->{invnumber}) ? $form->{invnumber} : $new_id;
63
  $query =
64
    qq|UPDATE $arap SET invnumber = ?, $vc_id = ?, transdate = ?, datepaid = ?, | .
65
    qq|duedate = ?, netamount = ?, amount = ?, paid = ?, | .
66
    qq|curr = ?, department_id = ? | .
67
    qq|WHERE id = ?|;
68
  @values = ($invnumber, $form->{$vc_id},
69
             conv_date($form->{datepaid}), conv_date($form->{datepaid}),
70
             conv_date($form->{datepaid}), 0, 0, $fxamount, $form->{currency},
71
             $form->{department_id}, $new_id);
72
  do_query($form, $dbh, $query, @values);
73

  
74
  # add AR/AP
75
  my ($accno) = split /--/, $form->{ $form->{ARAP} };
76

  
77
  $query =
78
    qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | .
79
    qq|VALUES (?, (SELECT id FROM chart WHERE accno = ? ), ?, ?)|;
80
	@values = ($new_id, $accno, conv_date($form->{datepaid}), $fxamount * $ml);
81
  do_query($form, $dbh, $query, @values);
82

  
83
  # add payment
84
  $query =
85
    qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, memo) | .
86
    qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
87
  @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}),
88
             $amount * $ml * -1, $form->{source}, $form->{memo});
89
  do_query($form, $dbh, $query, @values);
90

  
91
  # add exchangerate difference
92
  if ($fxamount != $amount) {
93
    $query =
94
      qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, cleared, fx_transaction) | .
95
      qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
96
	  @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}),
97
               (($fxamount - $amount) * $ml * -1), 1, 1);
98
    do_query($form, $dbh, $query, @values);
99
  }
100

  
101
  $main::lxdebug->leave_sub();
102
}
103

  
104
1;
105

  
bin/mozilla/cp.pl
32 32
#======================================================================
33 33

  
34 34
use SL::CP;
35
use SL::OP;
36 35
use SL::IS;
37 36
use SL::IR;
38 37

  

Auch abrufbar als: Unified diff