NEW Add total weight and volume on PDF
NEW Can hide column qty ordered.
This commit is contained in:
parent
a95240e33d
commit
b3c3d3aac5
@ -69,9 +69,9 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
// Define position of columns
|
// Define position of columns
|
||||||
$this->posxdesc=$this->marge_gauche+1;
|
$this->posxdesc=$this->marge_gauche+1;
|
||||||
$this->posxweightvol=$this->page_largeur - $this->marge_droite - 80;
|
$this->posxweightvol=$this->page_largeur - $this->marge_droite - 76;
|
||||||
$this->posxqtyordered=$this->page_largeur - $this->marge_droite - 60;
|
$this->posxqtyordered=$this->page_largeur - $this->marge_droite - 56;
|
||||||
$this->posxqtytoship=$this->page_largeur - $this->marge_droite - 30;
|
$this->posxqtytoship=$this->page_largeur - $this->marge_droite - 28;
|
||||||
$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
|
||||||
@ -81,6 +81,13 @@ 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))
|
||||||
|
{
|
||||||
|
$this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered);
|
||||||
|
$this->posxpicture += ($this->posxqtytoship - $this->posxqtyordered);
|
||||||
|
$this->posxqtyordered = $this->posxqtytoship;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,7 +210,7 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
$pdf=pdf_getInstance($this->format);
|
$pdf=pdf_getInstance($this->format);
|
||||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||||
$heightforinfotot = 30; // Height reserved to output the info and total part
|
$heightforinfotot = 8; // 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)
|
||||||
$pdf->SetAutoPageBreak(1,0);
|
$pdf->SetAutoPageBreak(1,0);
|
||||||
@ -449,8 +456,11 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?', ':'').$voltxt,'','C');
|
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?', ':'').$voltxt,'','C');
|
||||||
|
|
||||||
$pdf->SetXY($this->posxqtyordered, $curY);
|
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
|
||||||
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C');
|
{
|
||||||
|
$pdf->SetXY($this->posxqtyordered, $curY);
|
||||||
|
$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->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
|
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
|
||||||
@ -571,7 +581,7 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
$tab2_top = $posy;
|
$tab2_top = $posy;
|
||||||
$tab2_hl = 4;
|
$tab2_hl = 4;
|
||||||
$pdf->SetFont('','', $default_font_size - 1);
|
$pdf->SetFont('','B', $default_font_size - 1);
|
||||||
|
|
||||||
// Tableau total
|
// Tableau total
|
||||||
$col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol;
|
$col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol;
|
||||||
@ -579,7 +589,8 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
{
|
{
|
||||||
$col2x-=20;
|
$col2x-=20;
|
||||||
}*/
|
}*/
|
||||||
$largcol2 = ($this->posxqtyordered - $this->posxweightvol);
|
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
|
||||||
|
else $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
|
||||||
|
|
||||||
$useborder=0;
|
$useborder=0;
|
||||||
$index = 0;
|
$index = 0;
|
||||||
@ -591,6 +602,8 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
$tmparray=$object->getTotalWeightVolume();
|
$tmparray=$object->getTotalWeightVolume();
|
||||||
$totalWeight=$tmparray['weight'];
|
$totalWeight=$tmparray['weight'];
|
||||||
$totalVolume=$tmparray['volume'];
|
$totalVolume=$tmparray['volume'];
|
||||||
|
$totalOrdered=$tmparray['ordered'];
|
||||||
|
$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)
|
||||||
{
|
{
|
||||||
@ -603,31 +616,35 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
|
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
|
||||||
if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
|
if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
|
||||||
|
|
||||||
|
$pdf->SetFillColor(255,255,255);
|
||||||
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1);
|
||||||
|
|
||||||
|
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
|
||||||
|
{
|
||||||
|
$pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
|
||||||
|
$pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0, 'C', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
|
||||||
|
$pdf->MultiCell($this->largeur_page - $this->marge_droite - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1);
|
||||||
|
|
||||||
// Total Weight
|
// Total Weight
|
||||||
if ($totalWeighttoshow)
|
if ($totalWeighttoshow)
|
||||||
{
|
{
|
||||||
$pdf->SetFillColor(255,255,255);
|
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Weigth"), 0, 'L', 1);
|
|
||||||
|
|
||||||
$pdf->SetXY($col2x-20, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x-20, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2+20, $tab2_hl, $totalWeighttoshow, 0, 'R', 1);
|
$pdf->MultiCell($largcol2+20, $tab2_hl, $totalWeighttoshow, 0, 'R', 1);
|
||||||
|
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($totalVolumetoshow)
|
if ($totalVolumetoshow)
|
||||||
{
|
{
|
||||||
// Total Volume
|
|
||||||
$pdf->SetFillColor(255,255,255);
|
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Volume"), 0, 'L', 1);
|
|
||||||
|
|
||||||
$pdf->SetXY($col2x-20, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x-20, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2+20, $tab2_hl, $totalVolumetoshow, 0, 'R', 1);
|
$pdf->MultiCell($largcol2+20, $tab2_hl, $totalVolumetoshow, 0, 'R', 1);
|
||||||
|
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
if (! $totalWeighttoshow && ! $totalVolumetoshow) $index++;
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
@ -681,12 +698,15 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"),'','C');
|
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"),'','C');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
|
if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
|
||||||
if (empty($hidetop))
|
{
|
||||||
{
|
$pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
|
||||||
$pdf->SetXY($this->posxqtyordered-1, $tab_top+1);
|
if (empty($hidetop))
|
||||||
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities("QtyOrdered"),'','C');
|
{
|
||||||
}
|
$pdf->SetXY($this->posxqtyordered-1, $tab_top+1);
|
||||||
|
$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))
|
||||||
|
|||||||
@ -1754,8 +1754,13 @@ class Expedition extends CommonObject
|
|||||||
$volumeUnit=0;
|
$volumeUnit=0;
|
||||||
$totalWeight = '';
|
$totalWeight = '';
|
||||||
$totalVolume = '';
|
$totalVolume = '';
|
||||||
|
$totalOrdered = '';
|
||||||
|
$totalToShip = '';
|
||||||
foreach ($this->lines as $line)
|
foreach ($this->lines as $line)
|
||||||
{
|
{
|
||||||
|
$totalOrdered+=$line->qty_asked;
|
||||||
|
$totalToShip+=$line->qty_shipped;
|
||||||
|
|
||||||
$weightUnit=0;
|
$weightUnit=0;
|
||||||
$volumeUnit=0;
|
$volumeUnit=0;
|
||||||
if (! empty($line->weight_units)) $weightUnit = $line->weight_units;
|
if (! empty($line->weight_units)) $weightUnit = $line->weight_units;
|
||||||
@ -1784,7 +1789,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('weight'=>$totalWeight, 'volume'=>$totalVolume);
|
return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user