Created function to retrieve total discounted amount of a commonobject
Also added an ODT tag to let people add it to their invoices, etc..
This commit is contained in:
parent
70ae16f89e
commit
c9944a6b9b
@ -54,6 +54,8 @@ For users:
|
|||||||
- New: [ task #210 ] Can choose cash account during POS login
|
- New: [ task #210 ] Can choose cash account during POS login
|
||||||
- New: [ task #104 ] Can create an invoice from several orders
|
- New: [ task #104 ] Can create an invoice from several orders
|
||||||
- New: Update libs/tools/logo for DoliWamp (now use PHP 5.3).
|
- New: Update libs/tools/logo for DoliWamp (now use PHP 5.3).
|
||||||
|
- New: Added ODT Template tag {object_total_discount}
|
||||||
|
|
||||||
New experimental modules:
|
New experimental modules:
|
||||||
- New: Add margin management module.
|
- New: Add margin management module.
|
||||||
- New: Add commissions management module.
|
- New: Add commissions management module.
|
||||||
@ -81,6 +83,7 @@ For developers:
|
|||||||
expedition, order supplier and order invoice (lines included), intervention card, project, tasks.
|
expedition, order supplier and order invoice (lines included), intervention card, project, tasks.
|
||||||
- New: Add ChromePHP output into syslog module.
|
- New: Add ChromePHP output into syslog module.
|
||||||
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
||||||
|
- New: Created function to retrieve total amount of discount of an invoice/proposal...
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -2214,6 +2215,27 @@ abstract class CommonObject
|
|||||||
return $nb;
|
return $nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that returns the total amount of discounts applied.
|
||||||
|
*
|
||||||
|
* @return false|float False is returned if the discount couldn't be retrieved
|
||||||
|
*/
|
||||||
|
function getTotalDiscount()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT (SUM(`subprice`) - SUM(`total_ht`)) as `discount` FROM '.MAIN_DB_PREFIX.$this->table_element.'det WHERE `'.$this->fk_element.'` = '.$this->id;
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($query)
|
||||||
|
{
|
||||||
|
$result = $this->db->fetch_object($query);
|
||||||
|
|
||||||
|
return price2num($result->discount);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set extra parameters
|
* Set extra parameters
|
||||||
*
|
*
|
||||||
|
|||||||
@ -124,6 +124,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
|||||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||||
|
'object_total_discount' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||||
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
||||||
'object_note_private'=>$object->note,
|
'object_note_private'=>$object->note,
|
||||||
'object_note'=>$object->note_public,
|
'object_note'=>$object->note_public,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user