Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/compta/facture/class/facture.class.php
	htdocs/core/lib/functions2.lib.php
This commit is contained in:
Laurent Destailleur 2017-09-13 20:57:53 +02:00
commit eadfbfe2bd
21 changed files with 289 additions and 209 deletions

View File

@ -162,6 +162,9 @@ Following changes may create regression for some external modules, but were nece
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint". hook specifications so you must return output into "resprint".
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
FIX: Removed a bad symbolic link into custom directory.
FIX: Renaming a resource ref rename also the directory of attached files.
***** ChangeLog for 5.0.5 compared to 5.0.4 ***** ***** ChangeLog for 5.0.5 compared to 5.0.4 *****
FIX: #7075 : bad path for document FIX: #7075 : bad path for document

View File

@ -199,6 +199,9 @@ class Adherent extends CommonObject
$infos.= $langs->transnoentities("Town").": ".$this->town."\n"; $infos.= $langs->transnoentities("Town").": ".$this->town."\n";
$infos.= $langs->transnoentities("Country").": ".$this->country."\n"; $infos.= $langs->transnoentities("Country").": ".$this->country."\n";
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n"; $infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
$infos.= $langs->transnoentities("Login").": ".$this->login."\n"; $infos.= $langs->transnoentities("Login").": ".$this->login."\n";
@ -243,6 +246,11 @@ class Adherent extends CommonObject
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
// For backward compatibility
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, '%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,

View File

@ -3842,6 +3842,9 @@ class Facture extends CommonInvoice
$line->total_ht=-100; $line->total_ht=-100;
$line->total_ttc=-119.6; $line->total_ttc=-119.6;
$line->total_tva=-19.6; $line->total_tva=-19.6;
$line->multicurrency_total_ht=-200;
$line->multicurrency_total_ttc=-239.2;
$line->multicurrency_total_tva=-39.2;
} }
else if ($xnbp == 2) // UP is negative (free line) else if ($xnbp == 2) // UP is negative (free line)
{ {
@ -3850,6 +3853,9 @@ class Facture extends CommonInvoice
$line->total_ttc=-119.6; $line->total_ttc=-119.6;
$line->total_tva=-19.6; $line->total_tva=-19.6;
$line->remise_percent=0; $line->remise_percent=0;
$line->multicurrency_total_ht=-200;
$line->multicurrency_total_ttc=-239.2;
$line->multicurrency_total_tva=-39.2;
} }
else if ($xnbp == 3) // Discount is 50% (product line) else if ($xnbp == 3) // Discount is 50% (product line)
{ {
@ -3858,6 +3864,9 @@ class Facture extends CommonInvoice
$line->total_ht=50; $line->total_ht=50;
$line->total_ttc=59.8; $line->total_ttc=59.8;
$line->total_tva=9.8; $line->total_tva=9.8;
$line->multicurrency_total_ht=100;
$line->multicurrency_total_ttc=119.6;
$line->multicurrency_total_tva=19.6;
$line->remise_percent=50; $line->remise_percent=50;
} }
else // (product line) else // (product line)
@ -3867,15 +3876,23 @@ class Facture extends CommonInvoice
$line->total_ht=100; $line->total_ht=100;
$line->total_ttc=119.6; $line->total_ttc=119.6;
$line->total_tva=19.6; $line->total_tva=19.6;
$line->remise_percent=00; $line->multicurrency_total_ht=200;
$line->multicurrency_total_ttc=239.2;
$line->multicurrency_total_tva=39.2;
$line->remise_percent=0;
} }
$this->lines[$xnbp]=$line; $this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht; $this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva; $this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc; $this->total_ttc += $line->total_ttc;
$this->multicurrency_total_ht += $line->multicurrency_total_ht;
$this->multicurrency_total_tva += $line->multicurrency_total_tva;
$this->multicurrency_total_ttc += $line->multicurrency_total_ttc;
$xnbp++; $xnbp++;
} }
$this->revenuestamp = 0; $this->revenuestamp = 0;
@ -3892,6 +3909,9 @@ class Facture extends CommonInvoice
$line->total_ht=0; $line->total_ht=0;
$line->total_ttc=0; // 90 * 1.196 $line->total_ttc=0; // 90 * 1.196
$line->total_tva=0; $line->total_tva=0;
$line->multicurrency_total_ht=0;
$line->multicurrency_total_ttc=0;
$line->multicurrency_total_tva=0;
$prodid = mt_rand(1, $num_prods); $prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $line->fk_product=$prodids[$prodid];

View File

@ -585,11 +585,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$alreadypayedlabel.'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$remaindertopay.'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>'; print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -659,6 +659,29 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">'; print '<td align="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
print '</td>'; print '</td>';
print '<td align="right">';
// Add remind multicurrency amount
$namef = 'multicurrency_amount_'.$objp->facid;
$nameRemain = 'multicurrency_remain_'.$objp->facid;
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
{
if ($action != 'add_paiement')
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
}
print "</td>";
} }
// Price // Price
@ -695,33 +718,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
print "</td>"; print "</td>";
// Multicurrency Price
if (! empty($conf->multicurrency->enabled))
{
print '<td align="right">';
// Add remind multicurrency amount
$namef = 'multicurrency_amount_'.$objp->facid;
$nameRemain = 'multicurrency_remain_'.$objp->facid;
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
{
if ($action != 'add_paiement')
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
}
print "</td>";
}
// Warning // Warning
print '<td align="center" width="16">'; print '<td align="center" width="16">';
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>"; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
@ -754,6 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>'; print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($sign * $totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
@ -761,7 +758,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</b></td>'; print '</b></td>';
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>'; print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -2264,6 +2264,8 @@ abstract class CommonObject
$error=0; $error=0;
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
// Define constants to find lines to sum // Define constants to find lines to sum
$fieldtva='total_tva'; $fieldtva='total_tva';
$fieldlocaltax1='total_localtax1'; $fieldlocaltax1='total_localtax1';
@ -2316,7 +2318,6 @@ abstract class CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Note: There is no check on detail line and no check on total, if $forcedroundingmode = 'none' // Note: There is no check on detail line and no check on total, if $forcedroundingmode = 'none'
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto' if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
{ {
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx); $localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
@ -2334,11 +2335,14 @@ abstract class CommonObject
} }
} }
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail $this->total_ht += $obj->total_ht; // The field visible at end of line detail
$this->total_tva += $obj->total_tva; $this->total_tva += $obj->total_tva;
$this->total_localtax1 += $obj->total_localtax1; $this->total_localtax1 += $obj->total_localtax1;
$this->total_localtax2 += $obj->total_localtax2; $this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc; $this->total_ttc += $obj->total_ttc;
$this->multicurrency_total_ht += $obj->multicurrency_total_ht; // The field visible at end of line detail
$this->multicurrency_total_tva += $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc += $obj->multicurrency_total_ttc;
if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0; if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0;
if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0; if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0;
@ -2347,7 +2351,7 @@ abstract class CommonObject
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva; $total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc; $total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat. TODO This works on the company currency but not on multicurrency
{ {
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1); $tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1); $diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
@ -2371,26 +2375,25 @@ abstract class CommonObject
} }
// Add revenue stamp to total // Add revenue stamp to total
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
// Situations totals // Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1) { if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {
$prev_sits = $this->get_prev_sits(); $prev_sits = $this->get_prev_sits();
foreach ($prev_sits as $sit) { foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch.
$this->total_ht -= $sit->total_ht; $this->total_ht -= $sit->total_ht;
$this->total_tva -= $sit->total_tva; $this->total_tva -= $sit->total_tva;
$this->total_localtax1 -= $sit->total_localtax1; $this->total_localtax1 -= $sit->total_localtax1;
$this->total_localtax2 -= $sit->total_localtax2; $this->total_localtax2 -= $sit->total_localtax2;
$this->total_ttc -= $sit->total_ttc; $this->total_ttc -= $sit->total_ttc;
$this->multicurrency_total_ht -= $sit->multicurrency_total_ht;
$this->multicurrency_total_tva -= $sit->multicurrency_total_tva;
$this->multicurrency_total_ttc -= $sit->multicurrency_total_ttc;
} }
} }
// Multicurrency
$this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx;
$this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx;
$this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx;
$this->db->free($resql); $this->db->free($resql);
// Now update global field total_ht, total_ttc and tva // Now update global field total_ht, total_ttc and tva
@ -2404,7 +2407,7 @@ abstract class CommonObject
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva'; if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
if ($this->element == 'propal') $fieldttc='total'; if ($this->element == 'propal') $fieldttc='total';
if ($this->element == 'expensereport') $fieldtva='total_tva'; if ($this->element == 'expensereport') $fieldtva='total_tva';
if ($this->element == 'supplier_proposal') $fieldttc='total'; if ($this->element == 'supplier_proposal') $fieldttc='total';
if (empty($nodatabaseupdate)) if (empty($nodatabaseupdate))
{ {

View File

@ -2266,4 +2266,4 @@ function random_color_part($min=0,$max=255) {
*/ */
function random_color($min=0, $max=255) { function random_color($min=0, $max=255) {
return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max);
} }

View File

@ -50,8 +50,8 @@
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param double $multicurrency_tx Currency rate (1 by default) * @param double $multicurrency_tx Currency rate (1 by default)
* @param double $pu_ht_devise Amount in currency * @param double $pu_devise Amount in currency
* @return array [ * @return array [
* 0=total_ht, * 0=total_ht,
* 1=total_vat, (main vat only) * 1=total_vat, (main vat only)
* 2=total_ttc, (total_ht + main vat + local taxes) * 2=total_ttc, (total_ht + main vat + local taxes)
@ -65,15 +65,16 @@
* 10=total_tax2 for total_ht, * 10=total_tax2 for total_ht,
* 11=pu_tax1 for pu_ht, !! should not be used * 11=pu_tax1 for pu_ht, !! should not be used
* 12=pu_tax2 for pu_ht, !! should not be used * 12=pu_tax2 for pu_ht, !! should not be used
* 13=!! should not be used * 13=?? !! should not be used
* 14=total_tax1 for total_ht_without_discount, * 14=total_tax1 for total_ht_without_discount,
* 15=total_tax2 for total_ht_without_discount] * 15=total_tax2 for total_ht_without_discount,
*
* 16=multicurrency_total_ht * 16=multicurrency_total_ht
* 17=multicurrency_total_tva * 17=multicurrency_total_tva
* 18=multicurrency_total_ttc * 18=multicurrency_total_ttc
* 19=multicurrency_pu_ht * 19=multicurrency_pu_ht
*/ */
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_ht_devise=0) function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_devise=0)
{ {
global $conf,$mysoc,$db; global $conf,$mysoc,$db;
@ -101,10 +102,10 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
//dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress); //dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress);
$countryid=$seller->country_id; $countryid=$seller->country_id;
if (is_numeric($uselocaltax1_rate)) $uselocaltax1_rate=(float) $uselocaltax1_rate; if (is_numeric($uselocaltax1_rate)) $uselocaltax1_rate=(float) $uselocaltax1_rate;
if (is_numeric($uselocaltax2_rate)) $uselocaltax2_rate=(float) $uselocaltax2_rate; if (is_numeric($uselocaltax2_rate)) $uselocaltax2_rate=(float) $uselocaltax2_rate;
if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj; if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj;
if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj; if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj;
@ -143,14 +144,15 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
} }
else dol_print_error($db); else dol_print_error($db);
} }
// pu calculation from pu_devise if pu empty // pu calculation from pu_devise if pu empty
if(empty($pu) && !empty($pu_ht_devise)) { if(empty($pu) && !empty($pu_devise)) {
$pu = $pu_ht_devise / $multicurrency_tx; $pu = $pu_devise / $multicurrency_tx;
} else {
$pu_ht_devise = $pu * $multicurrency_tx;
} }
if(empty($pu_devise) && !empty($multicurrency_tx)) {
$pu_devise = $pu * $multicurrency_tx;
}
// initialize total (may be HT or TTC depending on price_base_type) // initialize total (may be HT or TTC depending on price_base_type)
$tot_sans_remise = $pu * $qty * $progress / 100; $tot_sans_remise = $pu * $qty * $progress / 100;
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100)); $tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));
@ -338,13 +340,40 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$result[10]=round($result[10]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT; $result[10]=round($result[10]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT;
} }
} }
// Multicurrency // Multicurrency
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT'); if ($conf->multicurrency->enabled && $multicurrency_tx != 1)
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT'); {
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT'); // Recal function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop.
$result[19] = price2num($pu_ht_devise, 'MU'); $newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0);
$result[16] = $newresult[0];
$result[17] = $newresult[1];
$result[18] = $newresult[2];
$result[19] = $newresult[3];
$result[20] = $newresult[4];
$result[21] = $newresult[5];
$result[22] = $newresult[6];
$result[23] = $newresult[7];
$result[24] = $newresult[8];
$result[25] = $newresult[9];
$result[26] = $newresult[10];
/*
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT');
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
$result[19] = price2num($pu_devise, 'MU');
*/
}
else
{
$result[16] = $result[0];
$result[17] = $result[1];
$result[18] = $result[2];
$result[19] = $result[3];
}
//var_dump($result);
// initialize result array // initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i]; //for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];

View File

@ -1468,8 +1468,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire);
$newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); $newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire);
if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=='none' || $leftmenu=="members" || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);

View File

@ -859,6 +859,8 @@ class pdf_einstein extends ModelePDFCommandes
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1032,7 +1034,6 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }
@ -1045,7 +1046,7 @@ class pdf_einstein extends ModelePDFCommandes
//$creditnoteamount=$object->getSumCreditNotesUsed(); //$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed(); //$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0; if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)

View File

@ -84,7 +84,7 @@ class pdf_rouget extends ModelePdfExpedition
} }
$this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxweightvol-=20; $this->posxweightvol-=20;
@ -92,7 +92,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->posxqtyordered-=20; $this->posxqtyordered-=20;
$this->posxqtytoship-=20; $this->posxqtytoship-=20;
} }
if (! empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) if (! empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
{ {
$this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered); $this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered);
@ -139,17 +139,17 @@ class pdf_rouget extends ModelePdfExpedition
if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE)) if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE))
{ {
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
if (empty($object->lines[$i]->fk_product)) continue; if (empty($object->lines[$i]->fk_product)) continue;
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/"; $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
$realpath=''; $realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj) foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
@ -169,17 +169,17 @@ class pdf_rouget extends ModelePdfExpedition
{ {
$filename=$obj['photo']; $filename=$obj['photo'];
} }
$realpath = $dir.$filename; $realpath = $dir.$filename;
break; break;
} }
if ($realpath) $realpatharray[$i]=$realpath; if ($realpath) $realpatharray[$i]=$realpath;
} }
} }
if (count($realpatharray) == 0) $this->posxpicture=$this->posxweightvol; if (count($realpatharray) == 0) $this->posxpicture=$this->posxweightvol;
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
// Definition de $dir et $file // Definition de $dir et $file
@ -219,7 +219,7 @@ class pdf_rouget extends ModelePdfExpedition
// Set nblignes with the new facture lines content after hook // Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines); $nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 8; // Height reserved to output the info and total part $heightforinfotot = 8; // Height reserved to output the info and total part
@ -282,11 +282,11 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$height_incoterms=$nexY-$tab_top; $height_incoterms=$nexY-$tab_top;
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192); $pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
$tab_top = $nexY+6; $tab_top = $nexY+6;
$height_incoterms += 4; $height_incoterms += 4;
} }
@ -343,7 +343,7 @@ class pdf_rouget extends ModelePdfExpedition
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192); $pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note; $tab_height = $tab_height - $height_note;
$tab_top = $nexY+6; $tab_top = $nexY+6;
} }
@ -400,7 +400,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->startTransaction(); $pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -434,10 +434,10 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->commitTransaction(); $pdf->commitTransaction();
} }
$posYAfterDescription=$pdf->GetY(); $posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore); $pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute); $pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
@ -456,29 +456,29 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetXY($this->posxweightvol, $curY); $pdf->SetXY($this->posxweightvol, $curY);
$weighttxt=''; $weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
{ {
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units,"weight"); $weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units,"weight");
} }
$voltxt=''; $voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
{ {
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume"); $voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume");
} }
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C'); $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
//$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt,'','C'); //$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt,'','C');
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
{ {
$pdf->SetXY($this->posxqtyordered, $curY); $pdf->SetXY($this->posxqtyordered, $curY);
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C'); $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C');
} }
$pdf->SetXY($this->posxqtytoship, $curY); $pdf->SetXY($this->posxqtytoship, $curY);
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT))
{ {
$pdf->SetXY($this->posxpuht, $curY); $pdf->SetXY($this->posxpuht, $curY);
$pdf->MultiCell(($this->posxtotalht - $this->posxpuht-1), 3, price($object->lines[$i]->subprice, 0, $outputlangs),'','R'); $pdf->MultiCell(($this->posxtotalht - $this->posxpuht-1), 3, price($object->lines[$i]->subprice, 0, $outputlangs),'','R');
@ -489,7 +489,7 @@ class pdf_rouget extends ModelePdfExpedition
$nexY+=3; $nexY+=3;
if ($weighttxt && $voltxt) $nexY+=2; if ($weighttxt && $voltxt) $nexY+=2;
// Add line // Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{ {
@ -548,7 +548,7 @@ class pdf_rouget extends ModelePdfExpedition
} }
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);
@ -614,7 +614,7 @@ class pdf_rouget extends ModelePdfExpedition
}*/ }*/
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol); if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
else $largcol2 = ($this->posxqtytoship - $this->posxweightvol); else $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
$useborder=0; $useborder=0;
$index = 0; $index = 0;
@ -628,12 +628,12 @@ class pdf_rouget extends ModelePdfExpedition
$totalOrdered=$tmparray['ordered']; $totalOrdered=$tmparray['ordered'];
$totalToShip=$tmparray['toship']; $totalToShip=$tmparray['toship'];
// Set trueVolume and volume_units not currently stored into database // Set trueVolume and volume_units not currently stored into database
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
{ {
$object->trueVolume=price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); $object->trueVolume=price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
$object->volume_units=$object->size_units * 3; $object->volume_units=$object->size_units * 3;
} }
if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
@ -642,48 +642,48 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetFillColor(255,255,255); $pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1);
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
{ {
$pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0, 'C', 1); $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0, 'C', 1);
} }
$pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1); $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1);
if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) { if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) {
$pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1); $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1);
$pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($object->total_ht, 0, $outputlangs), 0, 'C', 1); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($object->total_ht, 0, $outputlangs), 0, 'C', 1);
} }
// Total Weight // Total Weight
if ($totalWeighttoshow) if ($totalWeighttoshow)
{ {
$pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0, 'C', 1); $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0, 'C', 1);
$index++; $index++;
} }
if ($totalVolumetoshow) if ($totalVolumetoshow)
{ {
$pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index); $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0, 'C', 1); $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0, 'C', 1);
$index++; $index++;
} }
if (! $totalWeighttoshow && ! $totalVolumetoshow) $index++; if (! $totalWeighttoshow && ! $totalVolumetoshow) $index++;
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
return ($tab2_top + ($tab2_hl * $index)); return ($tab2_top + ($tab2_hl * $index));
} }
/** /**
* Show table for lines * Show table for lines
* *
@ -730,7 +730,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetXY($this->posxweightvol-1, $tab_top+1); $pdf->SetXY($this->posxweightvol-1, $tab_top+1);
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"),'','C'); $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"),'','C');
} }
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
{ {
$pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height); $pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
@ -740,14 +740,14 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities("QtyOrdered"),'','C'); $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities("QtyOrdered"),'','C');
} }
} }
$pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height); $pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->SetXY($this->posxqtytoship, $tab_top+1); $pdf->SetXY($this->posxqtytoship, $tab_top+1);
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C'); $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C');
} }
if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) { if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) {
$pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height); $pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height);
@ -756,7 +756,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetXY($this->posxpuht-1, $tab_top+1); $pdf->SetXY($this->posxpuht-1, $tab_top+1);
$pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities("PriceUHT"),'','C');
} }
$pdf->line($this->posxtotalht-1, $tab_top, $this->posxtotalht-1, $tab_top + $tab_height); $pdf->line($this->posxtotalht-1, $tab_top, $this->posxtotalht-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
@ -765,7 +765,7 @@ class pdf_rouget extends ModelePdfExpedition
} }
} }
} }
/** /**
@ -782,7 +782,7 @@ class pdf_rouget extends ModelePdfExpedition
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$langs->load("orders"); $langs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
@ -798,7 +798,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('','B', $default_font_size + 3);
$w = 110; $w = 110;
$posy=$this->marge_haute; $posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-$w; $posx=$this->page_largeur-$this->marge_droite-$w;
@ -865,7 +865,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetFont('','', $default_font_size + 1); $pdf->SetFont('','', $default_font_size + 1);
$posy+=5; $posy+=5;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R'); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R');
@ -878,7 +878,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R'); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
} }
if (! empty($object->thirdparty->code_client)) if (! empty($object->thirdparty->code_client))
{ {
$posy+=4; $posy+=4;
@ -906,7 +906,7 @@ class pdf_rouget extends ModelePdfExpedition
if ($result >= 0) if ($result >= 0)
{ {
//$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects //$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$text=$linkedobject->ref; $text=$linkedobject->ref;
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')'; if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
@ -941,7 +941,7 @@ class pdf_rouget extends ModelePdfExpedition
$hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; $hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
// Show sender frame // Show sender frame
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
@ -952,7 +952,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(255,255,255); $pdf->SetFillColor(255,255,255);
// Show sender name // Show sender name
$pdf->SetXY($posx+2,$posy+3); $pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B',$default_font_size); $pdf->SetFont('','B',$default_font_size);

View File

@ -214,9 +214,9 @@ class pdf_crabe extends ModelePDFFactures
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement(); $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed(); $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed(); $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
// Definition of $dir and $file // Definition of $dir and $file
if ($object->specimen) if ($object->specimen)
@ -773,7 +773,7 @@ class pdf_crabe extends ModelePDFFactures
// Loop on each deposits and credit notes included // Loop on each deposits and credit notes included
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
$sql.= " re.description, re.fk_facture_source,"; $sql.= " re.description, re.fk_facture_source,";
$sql.= " f.type, f.datef"; $sql.= " f.type, f.datef";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re, ".MAIN_DB_PREFIX ."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re, ".MAIN_DB_PREFIX ."facture as f";
@ -798,7 +798,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$pdf->MultiCell(20, 3, $text, 0, 'L', 0); $pdf->MultiCell(20, 3, $text, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
@ -817,7 +817,7 @@ class pdf_crabe extends ModelePDFFactures
// Loop on each payment // Loop on each payment
// TODO Call getListOfPaymentsgetListOfPayments instead of hard coded sql // TODO Call getListOfPaymentsgetListOfPayments instead of hard coded sql
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount,"; $sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
@ -837,7 +837,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price($sign * (($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
@ -1062,6 +1062,8 @@ class pdf_crabe extends ModelePDFFactures
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1272,7 +1274,6 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }
@ -1280,10 +1281,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSumCreditNotesUsed(); $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount=$object->getSumDepositsUsed(); $depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0; if ($object->paye) $resteapayer=0;
if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0)

View File

@ -40,28 +40,28 @@ class pdf_standard extends ModelePDFProduct
* @var DoliDb Database handler * @var DoliDb Database handler
*/ */
public $db; public $db;
/** /**
* @var string model name * @var string model name
*/ */
public $name; public $name;
/** /**
* @var string model description (short text) * @var string model description (short text)
*/ */
public $description; public $description;
/** /**
* @var string document type * @var string document type
*/ */
public $type; public $type;
/** /**
* @var array() Minimum version of PHP required by module. * @var array() Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.3 = array(5, 3) * e.g.: PHP ≥ 5.3 = array(5, 3)
*/ */
public $phpmin = array(5, 2); public $phpmin = array(5, 2);
/** /**
* Dolibarr version of the loaded document * Dolibarr version of the loaded document
* @public string * @public string
@ -77,7 +77,7 @@ class pdf_standard extends ModelePDFProduct
public $marge_basse; public $marge_basse;
public $emetteur; // Objet societe qui emet public $emetteur; // Objet societe qui emet
/** /**
* Constructor * Constructor
@ -105,7 +105,7 @@ class pdf_standard extends ModelePDFProduct
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo
$this->option_codeproduitservice = 0; // Affiche code produit-service $this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
@ -145,7 +145,7 @@ class pdf_standard extends ModelePDFProduct
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$nblignes = count($object->lines); $nblignes = count($object->lines);
if ($conf->produit->dir_output) if ($conf->produit->dir_output)
{ {
// Definition of $dir and $file // Definition of $dir and $file
@ -160,7 +160,7 @@ class pdf_standard extends ModelePDFProduct
$dir = $conf->produit->dir_output . "/" . $objectref; $dir = $conf->produit->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf"; $file = $dir . "/" . $objectref . ".pdf";
} }
$productFournisseur = new ProductFournisseur($this->db); $productFournisseur = new ProductFournisseur($this->db);
$supplierprices = $productFournisseur->list_product_fournisseur_price($object->id); $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id);
$object->supplierprices = $supplierprices; $object->supplierprices = $supplierprices;
@ -191,11 +191,11 @@ class pdf_standard extends ModelePDFProduct
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
$heightforinfotot = 40; // Height reserved to output the info and total part $heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
@ -242,7 +242,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetFont('','B', $default_font_size); $pdf->SetFont('','B', $default_font_size);
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->label), 0, 1); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->label), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetFont('','', $default_font_size); $pdf->SetFont('','', $default_font_size);
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, dol_htmlentitiesbr($object->description), 0, 1); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, dol_htmlentitiesbr($object->description), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
@ -270,7 +270,7 @@ class pdf_standard extends ModelePDFProduct
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
} }
// Affiche notes // Affiche notes
// TODO There is no public note on product yet // TODO There is no public note on product yet
$notetoshow=empty($object->note_public)?'':$object->note_public; $notetoshow=empty($object->note_public)?'':$object->note_public;
@ -424,7 +424,7 @@ class pdf_standard extends ModelePDFProduct
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
else $tvaligne=$object->lines[$i]->total_tva; else $tvaligne=$object->lines[$i]->total_tva;
$localtax1ligne=$object->lines[$i]->total_localtax1; $localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2; $localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx; $localtax1_rate=$object->lines[$i]->localtax1_tx;
@ -518,13 +518,10 @@ class pdf_standard extends ModelePDFProduct
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
} }
*/ */
// Affiche zone infos // Affiche zone infos
//$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); //$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
// Affiche zone totaux
//$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
@ -559,7 +556,7 @@ class pdf_standard extends ModelePDFProduct
} }
} }
/** /**
* Show table for lines * Show table for lines
* *
@ -576,42 +573,42 @@ class pdf_standard extends ModelePDFProduct
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
{ {
global $conf; global $conf;
// Force to disable hidetop and hidebottom // Force to disable hidetop and hidebottom
$hidebottom=0; $hidebottom=0;
if ($hidetop) $hidetop=-1; if ($hidetop) $hidetop=-1;
$currency = !empty($currency) ? $currency : $conf->currency; $currency = !empty($currency) ? $currency : $conf->currency;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1) // Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
if (empty($hidetop)) if (empty($hidetop))
{ {
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
} }
$pdf->SetDrawColor(128,128,128); $pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
// Output Rect // Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
$pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
} }
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{ {
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
@ -621,14 +618,14 @@ class pdf_standard extends ModelePDFProduct
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
} }
} }
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
} }
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
@ -642,7 +639,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
} }
} }
if($conf->global->PRODUCT_USE_UNITS) { if($conf->global->PRODUCT_USE_UNITS) {
$pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
if (empty($hidetop)) { if (empty($hidetop)) {
@ -651,7 +648,7 @@ class pdf_standard extends ModelePDFProduct
'C'); 'C');
} }
} }
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
@ -661,7 +658,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
} }
} }
if ($this->atleastonediscount) if ($this->atleastonediscount)
{ {
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
@ -672,7 +669,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
} }
} }
/** /**
* Show top header of page. * Show top header of page.
* *
@ -686,33 +683,33 @@ class pdf_standard extends ModelePDFProduct
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="")
{ {
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("bills"); $outputlangs->load("bills");
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("companies"); $outputlangs->load("companies");
$outputlangs->load("orders"); $outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
if ($object->type == 1) $titlekey='ServiceSheet'; if ($object->type == 1) $titlekey='ServiceSheet';
else $titlekey='ProductSheet'; else $titlekey='ProductSheet';
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
// Show Draft Watermark // Show Draft Watermark
if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
{ {
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
} }
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('','B', $default_font_size + 3);
$posy=$this->marge_haute; $posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-100; $posx=$this->page_largeur-$this->marge_droite-100;
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
// Logo // Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo) if ($this->emetteur->logo)
@ -735,23 +732,23 @@ class pdf_standard extends ModelePDFProduct
$text=$this->emetteur->name; $text=$this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$title=$outputlangs->transnoentities($titlekey); $title=$outputlangs->transnoentities($titlekey);
$pdf->MultiCell(100, 3, $title, '', 'R'); $pdf->MultiCell(100, 3, $title, '', 'R');
$pdf->SetFont('','B',$default_font_size); $pdf->SetFont('','B',$default_font_size);
$posy+=5; $posy+=5;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$posy+=1; $posy+=1;
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
/*if ($object->ref_client) /*if ($object->ref_client)
{ {
$posy+=5; $posy+=5;
@ -759,13 +756,13 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}*/ }*/
/*$posy+=4; /*$posy+=4;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R');
*/ */
// Get contact // Get contact
/* /*
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
@ -781,24 +778,24 @@ class pdf_standard extends ModelePDFProduct
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
} }
}*/ }*/
$posy+=2; $posy+=2;
// Show list of linked objects // Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress) if ($showaddress)
{ {
/* /*
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender // Show sender
$posy=42; $posy=42;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40; $hautcadre=40;
// Show sender frame // Show sender frame
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
@ -808,23 +805,23 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetFillColor(230,230,230); $pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
// Show sender name // Show sender name
$pdf->SetXY($posx+2,$posy+3); $pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size); $pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY(); $posy=$pdf->getY();
// Show sender information // Show sender information
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/ */
} }
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
/** /**
* Show footer of page. Need this->emetteur object * Show footer of page. Need this->emetteur object
* *
@ -840,6 +837,6 @@ class pdf_standard extends ModelePDFProduct
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
} }
} }

View File

@ -1012,6 +1012,8 @@ class pdf_azur extends ModelePDFPropales
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1188,7 +1190,6 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }

View File

@ -719,6 +719,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$useborder=0; $useborder=0;
// Total TTC
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -729,6 +730,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
$creditnoteamount=0;
$depositsamount=0;
//$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$index++; $index++;
@ -745,7 +754,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
@ -879,6 +888,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
global $conf;
$sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$tab3_posx = 120; $tab3_posx = 120;
$tab3_top = $posy + 8; $tab3_top = $posy + 8;
$tab3_width = 80; $tab3_width = 80;
@ -912,8 +926,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetFont('','', $default_font_size - 4); $pdf->SetFont('','', $default_font_size - 4);
// Loop on each deposits and credit notes included
//
// Loop on each payment // Loop on each payment
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount,"; $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
@ -931,7 +948,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0); $pdf->MultiCell(20, 3, price($sign * (($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);

View File

@ -917,7 +917,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
//$creditnoteamount=$object->getSumCreditNotesUsed(); //$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed(); //$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0; if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
@ -1805,8 +1805,9 @@ class FactureFournisseur extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
$response->label=$langs->trans("SupplierBillsToPay"); $response->label=$langs->trans("SupplierBillsToPay");
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
$response->img=img_object('',"bill"); $response->img=img_object($langs->trans("Bills"),"bill");
$facturestatic = new FactureFournisseur($this->db); $facturestatic = new FactureFournisseur($this->db);

View File

@ -55,7 +55,7 @@ IndependantSubProductStock=Product stock and subproduct stock are independant
QtyDispatched=Quantity dispatched QtyDispatched=Quantity dispatched
QtyDispatchedShort=Qty dispatched QtyDispatchedShort=Qty dispatched
QtyToDispatchShort=Qty to dispatch QtyToDispatchShort=Qty to dispatch
OrderDispatch=Goods Receptions OrderDispatch=Item receipts
RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated) RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated)
RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated) RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated)
DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation

View File

@ -798,13 +798,13 @@ else
if (! empty($arrayfields['p.duration']['checked'])) if (! empty($arrayfields['p.duration']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
if (preg_match('/([0-9]+)[a-z]/i',$obj->duration)) if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration))
{ {
if (preg_match('/([0-9]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([0-9]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([0-9]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([0-9]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
//elseif (preg_match('/([0-9]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
else print $obj->duration; else print $obj->duration;
} }
print '</td>'; print '</td>';

View File

@ -43,6 +43,7 @@ if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('companies'); $langs->load('companies');
$langs->load('propal');
$langs->load('supplier_proposal'); $langs->load('supplier_proposal');
$langs->load('compta'); $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
@ -1024,6 +1025,7 @@ if ($resql)
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->supplier_proposal->lire; $genallowed=$user->rights->supplier_proposal->lire;
$delallowed=$user->rights->supplier_proposal->lire; $delallowed=$user->rights->supplier_proposal->lire;

View File

@ -485,9 +485,10 @@ hr { border: 0; border-top: 1px solid #ccc; }
box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
} }
.button:hover, .buttonDelete:hover { .button:hover, .buttonDelete:hover {
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); /* warning: having a larger shadow has side effect when button is completely on left of a table */
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); -moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
} }
.button:disabled, .buttonDelete:disabled { .button:disabled, .buttonDelete:disabled {
opacity: 0.4; opacity: 0.4;

View File

@ -159,16 +159,16 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205); $result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56, 9.34795),$result1,'Test1 FR'); $this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.57, 9.34795, 0.93479, 10.28274, 18.7, 1.87, 20.57, 0, 0),$result1,'Test1 FR');
// qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100 // qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
$mysoc->country_code='FR'; $mysoc->country_code='FR';
$mysoc->country_id=1; $mysoc->country_id=1;
$result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20); $result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20),$result1,'Test1 FR'); $this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20, 2, 22, 40, 4, 44, 0, 0),$result1,'Test1 FR');
/* /*
* Country Spain * Country Spain
*/ */