X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIR.pm;h=3982b267e15b46e7147c9a22f8bf1d871bb7b425;hb=84bed7a655edfe816ad2a04b5549b6bd6a968c79;hp=f51ce4a4b3550f87a104dd23046f8fe2dc13260a;hpb=ef17e41a8364c6c97566a054768f573659dbec79;p=kivitendo-erp.git diff --git a/SL/IR.pm b/SL/IR.pm index f51ce4a4b..3982b267e 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -646,14 +646,14 @@ sub post_invoice { $dbh->do($query) || $form->dberror($query); if ($form->{storno}) { - $query = qq| update ap set paid=paid+amount where id=$form->{storno_id}|; + $query = qq| UPDATE ap SET paid = paid+amount WHERE id = $form->{storno_id}|; $dbh->do($query) || $form->dberror($query); - $query = qq| update ap set storno='$form->{storno}' where id=$form->{storno_id}|; + $query = qq| UPDATE ap SET storno = '$form->{storno}' WHERE id = $form->{storno_id}|; $dbh->do($query) || $form->dberror($query); - $query = qq§ update ap set intnotes='Rechnung storniert am $form->{invdate} ' || intnotes where id=$form->{storno_id}§; + $query = qq§ UPDATE ap SET intnotes = 'Rechnung storniert am $form->{invdate} ' || intnotes WHERE id = $form->{storno_id}§; $dbh->do($query) || $form->dberror($query); - $query = qq| update ap set paid=amount where id=$form->{id}|; + $query = qq| UPDATE ap SET paid = amount WHERE id = $form->{id}|; $dbh->do($query) || $form->dberror($query); } @@ -1008,7 +1008,8 @@ sub get_vendor { $form->{creditremaining} = $form->{creditlimit}; $query = qq|SELECT SUM(a.amount - a.paid) FROM ap a WHERE a.vendor_id = ?|; - ($form->{creditremaining}) -= selectfirst_array_query($form, $dbh, $query, $form->{vendor_id}); + my ($unpaid_invoices) = selectfirst_array_query($form, $dbh, $query, $form->{vendor_id}); + $form->{creditremaining} -= $unpaid_invoices; $query = qq|SELECT o.amount, (SELECT e.sell FROM exchangerate e