Exemple #1
0
 /**
  * 
  * @param NpdSheet $npd
  * @param SapSupplier $supplier
  * @param Color $color
  * @return array
  */
 public function toArrayForList()
 {
     if (!empty($this->idNpdSheet)) {
         $npd = NpdSheetQuery::create()->findByPK($this->getIdNpdSheet());
     }
     if (!$npd instanceof NpdSheet) {
         $npd = new NpdSheet();
     }
     if (!empty($this->idSupplier)) {
         $supplier = SapSupplierQuery::create()->findByPK($this->getIdSupplier());
     }
     if (!$supplier instanceof SapSupplier) {
         $supplier = new SapSupplier();
     }
     if (!empty($this->idColor)) {
         $color = ColorQuery::create()->findByPK($this->getIdColor());
     }
     if (!$color instanceof Color) {
         $color = new Color();
     }
     return array('npd_status' => $npd->getStatusName(), 'name' => utf8_encode($npd->getName()), 'reference' => utf8_encode($npd->getReference()), 'supplier' => utf8_encode($supplier->getName()), 'color' => utf8_encode($color->getName()), 'id_sample' => $this->getIdSample(), 'id_npd_sheet' => $this->getIdNpdSheet(), 'quantity' => $this->getQuantity(), 'folio' => $this->getFolio(), 'notes' => utf8_encode($this->getNotes()), 'status' => $this->getStatus(), 'status_name' => $this->getStatusName(), 'deadline' => $this->getDeadline(), 'shipped_quantity' => $this->getShippedQuantity(), 'is_ordered' => $this->isOrdered(), 'is_requested_to_supplier' => $this->isRequestedToSupplier(), 'is_sent' => $this->isSent());
 }
Exemple #2
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();
 }