<div class="btn-group pull-right"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-download"></i> Descargar <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="report/onere-word.php?id=<?php echo $_GET["id"]; ?> ">Word 2007 (.docx)</a></li> </ul> </div> <h1>Resumen de Reabastecimiento</h1> <?php if (isset($_GET["id"]) && $_GET["id"] != "") { $sell = SellData::getById($_GET["id"]); $operations = OperationData::getAllProductsBySellId($_GET["id"]); $total = 0; if (isset($_COOKIE["selled"])) { foreach ($operations as $operation) { // print_r($operation); $qx = OperationData::getQYesF($operation->product_id); // print "qx=$qx"; $p = $operation->getProduct(); if ($qx == 0) { echo "<p class='alert alert-danger'>El producto <b style='text-transform:uppercase;'> {$p->name}</b> no tiene existencias en inventario.</p>"; } else { if ($qx <= $p->inventary_min / 2) { echo "<p class='alert alert-danger'>El producto <b style='text-transform:uppercase;'> {$p->name}</b> tiene muy pocas existencias en inventario.</p>"; } else { if ($qx <= $p->inventary_min) { echo "<p class='alert alert-warning'>El producto <b style='text-transform:uppercase;'> {$p->name}</b> tiene pocas existencias en inventario.</p>";
$section1 = $word->AddSection(); $section1->addText("HISTORIAL DE CAJA", array("size" => 22, "bold" => true, "align" => "right")); $boxes = BoxData::getAll(); $products = SellData::getSellsUnBoxed(); $styleTable = array('borderSize' => 6, 'borderColor' => '888888', 'cellMargin' => 40); $styleFirstRow = array('borderBottomColor' => '0000FF', 'bgColor' => 'AAAAAA'); $table1 = $section1->addTable("table1"); $table1->addRow(); $table1->addCell()->addText("Total"); $table1->addCell()->addText("Fecha"); $total_total = 0; foreach ($boxes as $box) { $sells = SellData::getByBoxId($box->id); $total = 0; foreach ($sells as $sell) { $operations = OperationData::getAllProductsBySellId($sell->id); foreach ($operations as $operation) { $product = $operation->getProduct(); $total += $operation->q * $product->price_out; } } $total_total += $total; $table1->addRow(); $table1->addCell(5000)->addText("\$ " . number_format($total, 2, ".", ",")); $table1->addCell(2500)->addText($box->created_at); } $section1->addText(""); $section1->addText("Total: \$" . number_format($total_total, 2, ".", ","), array("size" => 22)); $word->addTableStyle('table1', $styleTable, $styleFirstRow); /// datos bancarios $filename = "boxhistory-" . time() . ".docx";