function SecondTable($order) { $company = new company($order->getId_company()); $this->SetFillColor(82, 189, 236); $this->SetTextColor(255); $this->SetDrawColor(183, 183, 183); $this->SetLineWidth(0.3); $this->SetFont('Arial', '', 10); //////////////////////////////////////////////////////// //Header $this->Cell(10, 6, 'Pos', 1, 0, 'L', true); $this->Cell(20, 6, 'Quantity', 1, 0, 'L', true); $this->Cell(12, 6, 'Unity', 1, 0, 'L', true); $this->Cell(107, 6, 'Product', 1, 0, 'L', true); $this->Cell(18, 6, 'Price/u', 1, 0, 'R', true); $this->Cell(18, 6, 'Price', 1, 0, 'R', true); $this->Ln(); //////////////////////////////////////////////////////// //Ligne en plus $this->SetFillColor(224, 235, 255); $this->SetTextColor(0); $fill = false; $this->SetFont('Arial', '', 9); $count = 1; if ($order->getCustomer_order_id() != NULL && $order->getCustomer_order_id() != "") { $this->Cell(185, 6, '>>> ' . utf8_decode($order->getCustomer_order_id()), 1, 0, 'C'); $this->Ln(); } //////////////////////////////////////////////////////// //Détails de la commande produit par produit foreach ($order->getLine_product() as $lp) { $xline = $this->getX(); $yline = $this->getY(); $marge = 42; $this->setX($xline + $marge); $chaineproduct = $lp->getProduct()->getNameDes(); if ($lp->getId_parameter() != "") { $parameter = $lp->getParameter(); $chaineproduct = $chaineproduct . " " . $parameter->getName(); } if ($lp->getRef_batch() != "") { $chaineproduct = $chaineproduct . ' || ' . $lp->getRef_batch(); } $this->MultiCell(107, 6, utf8_decode($chaineproduct), 1, 'L', $fill); $newy = $this->getY() - $yline; $this->setX($xline); $this->setY($yline); $this->Cell(10, $newy, $count, 1, 0, 'L', $fill); $this->Cell(20, $newy, $lp->getAmount(), 1, 0, 'L', $fill); $this->Cell(12, $newy, utf8_decode($lp->getProduct()->getUnit()), 1, 0, 'L', $fill); $this->setX($this->getX() + 107); $this->Cell(18, $newy, number_format($lp->getPrice_bis(), 2, ',', ' '), 1, 0, 'R', $fill); $this->Cell(18, $newy, number_format($lp->getPrice_bis() * $lp->getAmount(), 2, ',', ' '), 1, 0, 'R', $fill); $fill = !$fill; $count++; $this->Ln(); } //////////////////////////////////////////////////////////// //Somme des produits $this->SetFont('Arial', 'B', 10); $this->Cell(167, 6, 'Sum in euro', 1, 0, 'R'); $this->Cell(18, 6, number_format($order->getPrice(), 2, ',', ' '), 1, 0, 'R'); $this->Ln(); //////////////////////////////////////////////////////// //TVA $this->SetFont('Arial', 'I', 8); $this->Cell(167, 6, 'TVA 19%', 1, 0, 'R'); /* Calcul de la tva */ $tva = 0; if ($order->getForce_tva() == "yes") { $tva = round(19 * $order->getPrice() / 100, 2); } if (!($company->getUst_id() != "" && $company->getNationality() != "GER")) { $tva = round(19 * $order->getPrice() / 100, 2); } $this->Cell(18, 6, $tva, 1, 0, 'R'); $this->Ln(); //Display $this->SetFillColor(82, 189, 236); $this->SetTextColor(255); $this->SetFont('Arial', 'B', 10); $this->Cell(167, 6, 'Total in euro', 1, 0, 'R', true); $this->Cell(18, 6, number_format($order->getPrice() + $tva, 2, ',', ' '), 1, 0, 'R', true); $this->Ln(); }
function SecondTable($order) { $company = new company($order->getId_company()); $this->SetFillColor(82, 189, 236); $this->SetTextColor(255); $this->SetDrawColor(183, 183, 183); $this->SetLineWidth(0.3); $this->SetFont('Arial', '', 10); //Header $this->Cell(10, 6, 'Pos', 1, 0, 'L', true); $this->Cell(20, 6, 'Quantity', 1, 0, 'L', true); $this->Cell(12, 6, 'Unity', 1, 0, 'L', true); $this->Cell(107, 6, 'Product', 1, 0, 'L', true); $this->Cell(18, 6, 'Price/u', 1, 0, 'R', true); $this->Cell(18, 6, 'Price', 1, 0, 'R', true); $this->Ln(); //Body $this->SetFillColor(224, 235, 255); $this->SetTextColor(0); $fill = false; $this->SetFont('Arial', '', 9); $count = 1; if ($order->getCustomer_order_id() != NULL && $order->getCustomer_order_id() != "") { $this->Cell(185, 6, '>>> ' . $order->getCustomer_order_id(), 1, 0, 'C'); $this->Ln(); } foreach ($order->getLine_product() as $lp) { $xline = $this->getX(); $yline = $this->getY(); $marge = 42; $this->setX($xline + $marge); $this->MultiCell(107, 6, $lp->getProduct()->getNameDes() . ' | batch number : ' . $lp->getRef_batch(), 1, 'L', $fill); $newy = $this->getY() - $yline; $this->setX($xline); $this->setY($yline); $this->Cell(10, $newy, $count, 1, 0, 'L', $fill); $this->Cell(20, $newy, $lp->getAmount(), 1, 0, 'L', $fill); $this->Cell(12, $newy, $lp->getProduct()->getUnit(), 1, 0, 'L', $fill); $this->setX($this->getX() + 107); $this->Cell(18, $newy, $lp->getPrice_bis(), 1, 0, 'R', $fill); $this->Cell(18, $newy, $lp->getPrice_bis() * $lp->getAmount(), 1, 0, 'R', $fill); $fill = !$fill; $count++; $this->Ln(); } $this->SetFont('Arial', 'B', 10); $this->Cell(167, 6, 'Sum in euro', 1, 0, 'R'); $this->Cell(18, 6, $order->getPrice(), 1, 0, 'R'); $this->Ln(); //TVA $this->SetFont('Arial', 'I', 8); $this->Cell(167, 6, 'TVA 19%', 1, 0, 'R'); //Ajouter condition sur la tva ! $tva = 0; if ($company->getUst_id() != "" && $company->getNationality() != "GER") { $this->Cell(18, 6, $tva, 1, 0, 'R'); } else { $tva = round(19 * $order->getPrice() / 100, 2); $this->Cell(18, 6, $tva, 1, 0, 'R'); } $this->Ln(); //Ajouter la condition ici aussi $this->SetFillColor(82, 189, 236); $this->SetTextColor(255); $this->SetFont('Arial', 'B', 10); $this->Cell(167, 6, 'Total in euro', 1, 0, 'R', true); $this->Cell(18, 6, $order->getPrice() + $tva, 1, 0, 'R', true); $this->Ln(); }