Merge pull request #61 from grandoc/develop

Develop
This commit is contained in:
Regis Houssin 2011-12-03 14:42:18 -08:00
commit ae5fbb3927
2 changed files with 63 additions and 1 deletions

View File

@ -970,6 +970,33 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
}
}
/**
* Return line unit price including tax
* @param object Object
* @param i Current line number
* @param outputlangs Object langs for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $hook)
{
if (method_exists($hook['modules'][$special_code],'pdf_getlineupwithtax')) return $hook['modules'][$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
}
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
}
}
/**
* Return line quantity
*
@ -1154,6 +1181,41 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
}
}
/**
* Return line total including tax
* @param object Object
* @param i Current line number
* @param outputlangs Object langs for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
else
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $hook)
{
if (method_exists($hook['modules'][$special_code],'pdf_getlinetotalwithtax')) return $hook['modules'][$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails);
}
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
}
}
}
/**
* Return total quantity of products and/or services
*

View File

@ -33,6 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php");
if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
@ -256,7 +257,6 @@ if ($action == 'settrackingnumber' || $action == 'settrackingurl'
*/
if ($action == 'builddoc') // En get ou en post
{
require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php");
// Sauvegarde le dernier modele choisi pour generer un document
$shipment = new Expedition($db);