private function toList(SampleCollection $samples) { $this->view->samples = $samples; $npdIds = SampleQuery::create()->removeColumn()->addColumn("Sample." . Sample::ID_NPD_SHEET)->innerJoinNpdSheet()->whereAdd('Sample.id_sample', array_keys($samples->toArray()), SampleQuery::IN)->fetchCol(); $npds = NpdSheetQuery::create()->whereAdd(NpdSheet::ID_NPD_SHEET, $npdIds, NpdSheetQuery::IN)->find()->toObjectArray(); $npdSupplierIds = NpdSheetSupplierQuery::create()->removeColumn()->addColumn(NpdSheetSupplier::ID_SUPPLIER)->innerJoinNpdSheet()->whereAdd('NpdSheetSupplier.id_npd_sheet', array_keys($npds), NpdSheetSupplierQuery::IN)->fetchCol(); $this->view->suppliers = SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $npdSupplierIds, SapSupplierQuery::IN)->find()->toCombo(); $this->view->colors = array("" => $this->i18n->_("Any")) + \Application\Query\ColorQuery::create()->find()->toCombo(); $this->view->orderSamples = $orderSamples; $this->view->npds = $npds; }
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(); }