Exemple #1
0
 private function getSamplesInformation()
 {
     $this->SetFillColor(245, 245, 245);
     $this->SetLineWidth(0.1);
     $fill = true;
     $this->Cell(25, 10, 'Id Npd Sheet', 'TB', 0, 'C', $fill);
     $this->Cell(25, 10, 'Description', 'TB', 0, 'L', $fill);
     $this->Cell(25, 10, 'Supplier', 'TB', 0, 'R', $fill);
     $this->Cell(25, 10, 'Color', 'TB', 0, 'R', $fill);
     $this->Cell(25, 10, 'Quantity', 'TB', 0, 'R', $fill);
     $this->Cell(35, 10, 'Cost', 'TB', 0, 'R', $fill);
     $this->Cell(30, 10, 'Ammount', 'TB', 0, 'R', $fill);
     $this->Ln();
     $fill = false;
     $this->SetFillColor(225, 225, 225);
     $borders = 'T';
     $height = 6;
     while ($sample = $this->samples->read()) {
         if (NpdSheetQuery::create()->whereAdd(NpdSheet::ID_NPD_SHEET, $sample->getIdNpdSheet())->count()) {
             $npd = NpdSheetQuery::create()->findByPK($sample->getIdNpdSheet());
         } else {
             $npd = new NpdSheet();
         }
         if (ColorQuery::create()->whereAdd(Color::ID_COLOR, $sample->getIdColor())->count()) {
             $color = ColorQuery::create()->findByPK($sample->getIdColor());
         } else {
             $color = new Color();
             $color->setName('Any');
         }
         $rowHeight = 0;
         $x = $this->GetX();
         $y = $this->GetY();
         $this->MultiCell(25, $height, $npd->getIdNpdSheet(), $borders, 'R', $fill, 0);
         $x += 25;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(30, $height, $npd->getName(), $borders, 'R', $fill, 0);
         $x += 30;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(20, $height, $sample->getIdSupplier(), $borders, 'R', $fill);
         $x += 20;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(25, $height, $color->getName(), $borders, 'R', $fill);
         $x += 25;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(25, $height, $sample->getQuantity(), $borders, 'R', $fill);
         $x += 25;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(35, $height, "\$" . number_format($sample->getCost(), 4) . $npd->getIdCurrency(), $borders, 'R', $fill);
         $x += 35;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->MultiCell(30, $height, "\$" . number_format($sample->getTotalAmmount(), 4) . $npd->getIdCurrency(), $borders, 'R', $fill);
         $x += 30;
         $y2 = $this->GetY();
         $this->SetXY($x, $y);
         $currentCellHeight = $y2 - $y;
         if ($rowHeight < $currentCellHeight) {
             $rowHeight = $currentCellHeight;
         }
         $this->Ln($rowHeight);
     }
     $this->samples->rewind();
     $this->Cell(25, $height, ' ', 'TB', 0, 'C', $fill);
     $this->Cell(25, $height, '', 'TB', 0, 'L', $fill);
     $this->Cell(25, $height, '', 'TB', 0, 'R', $fill);
     $this->Cell(25, $height, '', 'TB', 0, 'R', $fill);
     $this->Cell(25, $height, '', 'TB', 0, 'R', $fill);
     $this->Cell(35, $height, 'Total', 'TB', 0, 'R', $fill);
     $this->Cell(30, $height, "\$" . number_format($this->samples->getTotalAmmount(), 4) . $npd->getIdCurrency(), 'TB', 0, 'R', $fill);
     $this->Ln();
 }