include "../core/autoload.php"; include "../core/app/model/BoxData.php"; include "../core/app/model/SellData.php"; include "../core/app/model/PersonData.php"; include "../core/app/model/OperationData.php"; include "../core/app/model/ProductData.php"; require_once '../PhpWord/Autoloader.php'; use PhpOffice\PhpWord\Autoloader; use PhpOffice\PhpWord\Settings; Autoloader::register(); $word = new PhpOffice\PhpWord\PhpWord(); $clients = PersonData::getClients(); $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;
<?php $sells = SellData::getSellsUnBoxed(); if (count($sells)) { $box = new BoxData(); $b = $box->add(); foreach ($sells as $sell) { $sell->box_id = $b[1]; $sell->update_box(); } Core::redir("./index.php?view=b&id=" . $b[1]); }