FIX PDF Total Ordered

This commit is contained in:
atm-quentin 2018-10-17 17:17:11 +02:00
parent dd0a57d39e
commit 8ef7c29d19
3 changed files with 17 additions and 9 deletions

View File

@ -352,7 +352,8 @@ class pdf_squille extends ModelePdfReception
$iniY = $tab_top + 7; $iniY = $tab_top + 7;
$curY = $tab_top + 7; $curY = $tab_top + 7;
$nexY = $tab_top + 7; $nexY = $tab_top + 7;
$fk_commandefourndet=0;
$totalOrdered=0;
// Loop on each lines // Loop on each lines
for ($i = 0; $i < $nblignes; $i++) for ($i = 0; $i < $nblignes; $i++)
{ {
@ -470,7 +471,11 @@ class pdf_squille extends ModelePdfReception
if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) if (empty($conf->global->RECEPTION_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'); if($object->lines[$i]->fk_commandefourndet!=$fk_commandefourndet){
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C');
$totalOrdered+=$object->lines[$i]->qty_asked;
}
$fk_commandefourndet = $object->lines[$i]->fk_commandefourndet;
} }
$pdf->SetXY($this->posxqtytoship, $curY); $pdf->SetXY($this->posxqtytoship, $curY);
@ -546,7 +551,7 @@ class pdf_squille extends ModelePdfReception
} }
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs,$totalOrdered);
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);
@ -590,7 +595,7 @@ class pdf_squille extends ModelePdfReception
* @param Translate $outputlangs Objet langs * @param Translate $outputlangs Objet langs
* @return int Position pour suite * @return int Position pour suite
*/ */
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs,$totalOrdered)
{ {
global $conf,$mysoc; global $conf,$mysoc;
@ -621,9 +626,11 @@ class pdf_squille extends ModelePdfReception
$tmparray=$object->getTotalWeightVolume(); $tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight']; $totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume']; $totalVolume=$tmparray['volume'];
$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)
{ {
@ -924,6 +931,7 @@ class pdf_squille extends ModelePdfReception
// Add internal contact of origin element if defined // Add internal contact of origin element if defined
$arrayidcontact=array(); $arrayidcontact=array();
if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL'); if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL');
if(empty($arrayidcontact)) $arrayidcontact=$object->$origin->getIdContact('internal','SHIPPING');
if (count($arrayidcontact) > 0) if (count($arrayidcontact) > 0)
{ {
$object->fetch_user(reset($arrayidcontact)); $object->fetch_user(reset($arrayidcontact));
@ -951,9 +959,6 @@ class pdf_squille extends ModelePdfReception
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(255,255,255); $pdf->SetFillColor(255,255,255);
// If RECEPTION contact defined, we use it // If RECEPTION contact defined, we use it
$usecontact=false; $usecontact=false;
$arrayidcontact=$object->$origin->getIdContact('external','SHIPPING'); $arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');

View File

@ -386,6 +386,7 @@ class pdf_canelle_reception extends ModelePDFSuppliersInvoices
// Reception // Reception
$object->fetchObjectLinked();
$reception_content = ''; $reception_content = '';
if(!empty($object->linkedObjects['reception'])){ if(!empty($object->linkedObjects['reception'])){
if(count($object->linkedObjects['reception']) == 1){ if(count($object->linkedObjects['reception']) == 1){

View File

@ -1847,6 +1847,7 @@ class Reception extends CommonObject
$this->error = $mouvS->error; $this->error = $mouvS->error;
$this->errors = $mouvS->errors; $this->errors = $mouvS->errors;
$error++; break; $error++; break;
} }
} }
else else
@ -1861,6 +1862,7 @@ class Reception extends CommonObject
$error++; break; $error++; break;
} }
} }
} }
} }
else else