summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/IR.pm12
-rwxr-xr-xLedgerSMB/IS.pm12
-rwxr-xr-xbin/aa.pl22
3 files changed, 14 insertions, 32 deletions
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 5dc1676b..3f3b0aed 100755
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -123,9 +123,10 @@ sub post_invoice {
&reverse_invoice( $dbh, $form );
}
else {
- $query = qq|INSERT INTO ap (id) VALUES (?)|;
+ $query = qq|INSERT INTO ap (id, vendor_id) VALUES (?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{id} ) || $form->dberror($query);
+ $sth->execute( $form->{id}, $form->{vendor_id} )
+ || $form->dberror($query);
}
}
@@ -135,11 +136,12 @@ sub post_invoice {
if ( !$form->{id} ) {
$query = qq|
- INSERT INTO ap (invnumber, employee_id)
- VALUES ('$uid', (SELECT id FROM employee
+ INSERT INTO ap (invnumber, vendor_id, employee_id)
+ VALUES ('$uid', ?, (SELECT id FROM employee
WHERE login = ?))|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{login} ) || $form->dberror($query);
+ $sth->execute( $form->{vendor_id}, $form->{login})
+ || $form->dberror($query);
$query = qq|SELECT id FROM ap WHERE invnumber = '$uid'|;
$sth = $dbh->prepare($query);
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index a45e0000..6fc6ba81 100755
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -854,9 +854,10 @@ sub post_invoice {
&reverse_invoice( $dbh, $form );
}
else {
- $query = qq|INSERT INTO ar (id) VALUES (?)|;
+ $query = qq|INSERT INTO ar (id, customer_id) VALUES (?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{id} ) || $form->dberror($query);
+ $sth->execute( $form->{id}, $form->{customer_id} )
+ || $form->dberror($query);
}
}
@@ -867,10 +868,11 @@ sub post_invoice {
if ( !$form->{id} ) {
$query = qq|
- INSERT INTO ar (invnumber, employee_id)
- VALUES ('$uid', ?)|;
+ INSERT INTO ar (invnumber, customer_id, employee_id)
+ VALUES ('$uid', ?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute( $form->{employee_id} ) || $form->dberror($query);
+ $sth->execute( $form->{customer_id}, $form->{employee_id} )
+ || $form->dberror($query);
$query = qq|SELECT id FROM ar WHERE invnumber = '$uid'|;
$sth = $dbh->prepare($query);
diff --git a/bin/aa.pl b/bin/aa.pl
index 90296b48..5a6f571b 100755
--- a/bin/aa.pl
+++ b/bin/aa.pl
@@ -966,28 +966,6 @@ sub update {
}
@taxaccounts = Tax::init_taxes( $form, $form->{taxaccounts} );
- if ( $form->{taxincluded} ) {
- $totaltax =
- Tax::calculate_taxes( \@taxaccounts, $form, $form->{invtotal}, 1 );
- }
- else {
- $totaltax =
- Tax::calculate_taxes( \@taxaccounts, $form, $form->{invtotal}, 0 );
- }
- foreach $item (@taxaccounts) {
- $taccno = $item->account;
- if ( $form->{calctax} ) {
- $form->{"calctax_$taccno"} = 1;
- $form->{"tax_$taccno"} = $form->round_amount( $item->value, 2 );
- }
- $form->{"select$form->{ARAP}_tax_$taccno"} =
- qq|<option>$taccno--$form->{"${taccno}_description"}|;
- }
-
- $form->{invtotal} =
- ( $form->{taxincluded} )
- ? $form->{invtotal}
- : $form->{invtotal} + $totaltax;
$j = 1;
for $i ( 1 .. $form->{paidaccounts} ) {