summaryrefslogtreecommitdiff
path: root/LedgerSMB/IS.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-07-16 00:03:37 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-07-16 00:03:37 +0000
commitdde3b204b288b72ce848bdc72762acab5399fef0 (patch)
tree5a6dbe5abee37379bf46cda9747240fa3c32ab5a /LedgerSMB/IS.pm
parent666211039ec5b79bc612f48235afee8887f49575 (diff)
Credit/Debit notes now work, credit/debit invoices still need some testing
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1399 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/IS.pm')
-rw-r--r--LedgerSMB/IS.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index f76e13f2..4967f999 100644
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -912,6 +912,9 @@ sub post_invoice {
foreach $i ( 1 .. $form->{rowcount} ) {
$form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
+ if ($form->{reverse}){
+ $form->{"qty_$i"} *= -1;
+ }
if ( $form->{"qty_$i"} ) {
@@ -1120,6 +1123,7 @@ sub post_invoice {
deliverydate = ?,
project_id = ?,
serialnumber = ?,
+ reverse = ?,
notes = ?
WHERE id = ?|;
@@ -1131,7 +1135,8 @@ sub post_invoice {
$form->{"discount_$i"}, $allocated,
$form->{"unit_$i"}, $form->{"deliverydate_$i"},
$project_id, $form->{"serialnumber_$i"},
- $form->{"notes_$i"}, $invoice_id
+ $form->{reverse}, $form->{"notes_$i"},
+ $invoice_id
) || $form->dberror($query);
if (defined $form->{approved}) {
@@ -1793,7 +1798,7 @@ sub retrieve_invoice {
a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.employee_id, e.name AS employee, a.till,
- a.entity_id,
+ a.entity_id, a.reverse
a.language_code, a.ponumber,
a.on_hold
FROM ar a
@@ -1863,6 +1868,7 @@ sub retrieve_invoice {
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
$form->db_parse_numeric(sth=>$sth, hashref => $ref);
+ $ref->{qty} *= -1 if $form->{reverse};
my ($dec) = ( $ref->{fxsellprice} =~ /\.(\d+)/ );
$dec = length $dec;
my $decimalplaces = ( $dec > 2 ) ? $dec : 2;