Skip to content

Commit

Permalink
Fix: Correct sign
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 18, 2011
1 parent 5492f4f commit 5699127
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -1895,11 +1895,11 @@ function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocalta
$this->line->rang=$rangtouse;
$this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except;
$this->line->total_ht= (($this->type==2||$qty<0)?-1:1)*abs($total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==2||$qty<0)?-1:1)*abs($total_tva);
$this->line->total_localtax1=(($this->type==2||$qty<0)?-1:1)*abs($total_localtax1);
$this->line->total_localtax2=(($this->type==2||$qty<0)?-1:1)*abs($total_localtax2);
$this->line->total_ttc= (($this->type==2||$qty<0)?-1:1)*abs($total_ttc);
$this->line->total_ht= (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
$this->line->origin=$origin;
Expand Down Expand Up @@ -2011,19 +2011,19 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $date_start, $d

$this->line->rowid = $rowid;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->qty= ($this->type==2?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->remise_percent = $remise_percent;
$this->line->subprice = ($this->type==2?-1:1)*abs($pu);
$this->line->subprice= ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start = $date_start;
$this->line->date_end = $date_end;
$this->line->total_ht = ($this->type==2?-1:1)*abs($total_ht);
$this->line->total_tva = ($this->type==2?-1:1)*abs($total_tva);
$this->line->total_localtax1 = ($this->type==2?-1:1)*abs($total_localtax1);
$this->line->total_localtax2 = ($this->type==2?-1:1)*abs($total_localtax2);
$this->line->total_ttc = ($this->type==2?-1:1)*abs($total_ttc);
$this->line->total_ht= (($this->type==2||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->info_bits = $info_bits;
$this->line->product_type = $type;
$this->line->fk_parent_line = $fk_parent_line;
Expand Down

0 comments on commit 5699127

Please sign in to comment.