function ImprovedTable($data) { $service = BuyData::getByCode($_GET["code"]); $products = BuyProductData::getAllByBuyId($service->id); $client = ClientData::getById($service->client_id); $this->setY(31); $this->setX(20); $this->setY(31); $this->setX(20); $this->SetFont('Arial', 'B', 8); $this->setY(33); $this->setX(20); $this->setY(40); $this->setX(20); $this->SetFont('Arial', 'B', 8); // $this->Cell(0,35,"",1); $this->setY(38); $this->setX(20); $this->Cell(0, 10, " NOMBRE: " . $client->name); $this->setY(43); $this->setX(20); $this->Cell(0, 10, " DIRECCION: " . $client->address); $this->setY(48); $this->setX(20); $this->Cell(0, 10, "TEL: " . $client->phone); $this->setY(53); $this->setX(20); $this->setY(80); $this->setX(20); $this->SetFont('Arial', '', 14); $this->Cell(0, 10, " DETALLES DE LA COMPRA "); $this->SetFont('Arial', 'B', 10); $starty = 0; $total = 0; // $inventary_item = InventaryData::getAllBySII($service->id,$ii->id); $this->setY(95 + $starty); $this->setX(20); //// omito el super trabajo /// $this->Cell(0,10,strtoupper($w->getWork()->name)); $this->setY(95 + $starty); $this->setX(65); // $starty+=5; //////////////////////// materiales if (count($products)) { $starty += 5; foreach ($products as $itemx) { $item = $itemx->getProduct(); $mtx = null; $this->setY(95 + $starty); $this->setX(20); $this->Cell(0, 10, strtoupper($itemx->q)); $this->setX(30); $this->Cell(0, 10, strtoupper($item->getUnit()->name)); $this->setX(50); $this->Cell(0, 10, strtoupper($item->name)); $this->setX(180); $this->Cell(0, 10, "\$ " . number_format($item->price, 2, ".", ",")); $total += $itemx->q * $item->price; $this->setY(95 + $starty); $this->setX(65); $starty += 5; } } //////////////////////// //////////////////////// materiales /*if(count($subworks)){ $this->setX(20); $this->Cell(0,(count($subworks)*5)+10,"",1); $this->setY(95+$starty); $this->setX(20); $this->Cell(0,10,strtoupper("**MATERIALES")); $starty+=5; foreach($subworks as $item){ $mtx=null; foreach($mts as $mt){ if($mt->material_id==$item->id){ $mtx = $mt; }} if($mtx!=null&& $mtx->material_id==$item->id){ $this->setY(95+$starty); $this->setX(20); $this->Cell(0,10,strtoupper($item->name)); $this->setX(180); $this->Cell(0,10,"$ ".number_format($item->price,2,".",",")); $this->setY(95+$starty); $this->setX(65); $starty+=5; } } } */ //////////////////////// // $this->Cell(0,10,"|X|__| "); // $this->Cell(0,10,"|__|X| "); $starty += 5; ///////////////////////////////////////////////////////////// Total $this->SetFont('Arial', '', 12); $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "SubTotal: \$ " . number_format($total * 0.84, 2, ".", ",")); $starty += 5; $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "IVA: \$ " . number_format($total * 0.16, 2, ".", ",")); $starty += 5; $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "Total: \$ " . number_format($total, 2, ".", ",")); ///////////////////////////////////////////////////////////// //////////////////////////////////////////////////// }
function ImprovedTable($data) { $iva = ConfigurationData::getByPreffix("general_iva")->val; $iva_txt = ConfigurationData::getByPreffix("general_iva_txt")->val; $coin = ConfigurationData::getByPreffix("general_coin")->val; $service = BuyData::getByCode($_GET["code"]); $products = BuyProductData::getAllByBuyId($service->id); $client = ClientData::getById($service->client_id); $this->setY(31); $this->setX(20); $this->setY(31); $this->setX(20); $this->SetFont('Arial', 'B', 8); $this->setY(33); $this->setX(20); $this->setY(40); $this->setX(20); $this->SetFont('Arial', 'B', 8); // $this->Cell(0,35,"",1); $this->setY(38); $this->setX(20); $this->Cell(0, 10, " NOMBRE: " . $client->getFullname()); $this->setY(43); $this->setX(20); $this->Cell(0, 10, " DIRECCION: " . $client->address); $this->setY(48); $this->setX(20); $this->Cell(0, 10, "TEL: " . $client->phone); $this->setY(53); $this->setX(20); $this->setY(80); $this->setX(20); $this->SetFont('Arial', '', 14); $this->Cell(0, 10, " DETALLES DE LA COMPRA "); $this->SetFont('Arial', 'B', 10); $starty = 0; $total = 0; // $inventary_item = InventaryData::getAllBySII($service->id,$ii->id); $this->setY(95 + $starty); $this->setX(20); //// omito el super trabajo /// $this->Cell(0,10,strtoupper($w->getWork()->name)); $this->setY(95 + $starty); $this->setX(65); // $starty+=5; //////////////////////// materiales if (count($products)) { $starty += 5; foreach ($products as $itemx) { $item = $itemx->getProduct(); $mtx = null; $this->setY(95 + $starty); $this->setX(20); $this->Cell(0, 10, strtoupper($itemx->q)); $this->setX(30); $this->Cell(0, 10, strtoupper($item->getUnit()->name)); $this->setX(50); $this->Cell(0, 10, strtoupper($item->name)); $this->setX(180); $this->Cell(0, 10, utf8_decode($coin) . " " . number_format($item->price, 2, ".", ",")); $total += $itemx->q * $item->price; $this->setY(95 + $starty); $this->setX(65); $starty += 5; } } $starty += 5; ///////////////////////////////////////////////////////////// Total $this->SetFont('Arial', '', 12); $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "SubTotal: " . utf8_decode($coin) . " " . number_format($total * (1 - $iva / 100), 2, ".", ",")); $starty += 5; $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "{$iva_txt}: " . utf8_decode($coin) . " " . number_format($total * ($iva / 100), 2, ".", ",")); $starty += 5; $this->setY(125 + $starty); $this->setX(20); $this->Cell(0, 10, "Total: " . utf8_decode($coin) . " " . number_format($total, 2, ".", ",")); ///////////////////////////////////////////////////////////// //////////////////////////////////////////////////// }
<?php if (isset($_SESSION["client_id"])) { $client = ClientData::getById($_SESSION["client_id"]); ?> <?php $buy = BuyData::getByCode($_GET["code"]); $products = BuyProductData::getAllByBuyId($buy->id); ?> <div class="container"> <div class="row"> <div class="col-md-12"> <h3>Bienvenido, <?php echo $client->name . " " . $client->lastname; ?> </h3> <a href="./index.php?view=client" class="btn btn-default"><i class="fa fa-chevron-left"></i> Regresar</a> <a href="./invoice.php?code=<?php echo $buy->code; ?> " class="btn btn-default"><i class="fa fa-file-o"></i> Imprimir</a> <br></div> </div> </div> <div class="container"> <div class="row"> <div class="col-md-12">