</div> </div> <br><!--- --> <div class="row"> <div class="col-md-12"> <?php if (isset($_GET["sd"]) && isset($_GET["ed"])) { if ($_GET["sd"] != "" && $_GET["ed"] != "") { ?> <?php $operations = array(); if ($_GET["product_id"] == "") { $operations = OperationData::getAllByDateOfficial($_GET["sd"], $_GET["ed"]); } else { $operations = OperationData::getAllByDateOfficialBP($_GET["product_id"], $_GET["sd"], $_GET["ed"]); } ?> <?php if (count($operations) > 0) { ?> <table class="table table-bordered"> <thead> <th>Id</th> <th>Producto</th> <th>Cantidad</th> <th>Operacion</th> <th>Fecha</th> </thead> <?php
?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php ?> </div> <div class="col-md-4"> <?php $ototal = -1 * OperationData::GetOutputQNoF($product->id, $cut->id); ?> <div class="jumbotron"> <center> <h2>Salidas</h2> <h1><?php echo $ototal; ?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php
$go = true; if (strtotime($_POST["start_at"]) > strtotime($_POST["finish_at"])) { $go = false; } if ($go && isset($_SESSION["cart"])) { $cart = $_SESSION["cart"]; if (count($cart) > 0) { /* $sell = new SellData(); $sell->user_id = $_SESSION["user_id"]; $sell->total = $_POST["total"]; $sell->discount = $_POST["discount"]; $s = $sell->add(); */ foreach ($cart as $c) { $op = new OperationData(); $op->item_id = $c["item_id"]; $op->client_id = $_POST["client_id"]; $op->start_at = $_POST["start_at"]; $op->finish_at = $_POST["finish_at"]; $op->user_id = $_SESSION["user_id"]; $add = $op->add(); $item = ItemData::getById($c["item_id"]); $item->unavaiable(); unset($_SESSION["cart"]); setcookie("selled", "selled"); } //////////////////// } } if ($go) {
<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>"; } } } } setcookie("selled", "", time() - 18600);
<?php $sell = SellData::getById($_GET["id"]); $operations = OperationData::getAllProductsBySellId($_GET["id"]); foreach ($operations as $op) { $op->del(); } $sell->del(); Core::redir("./index.php?view=res");
<?php $operations = OperationData::getAllByProductId($_GET["id"]); foreach ($operations as $op) { $op->del(); } $product = ProductData::getById($_GET["id"]); $product->del(); Core::redir("./index.php?view=products");
?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php ?> </div> <div class="col-md-4"> <?php $ototal = -1 * OperationData::GetOutputQYesF($product->id); ?> <div class="jumbotron"> <center> <h2>Salidas</h2> <h1><?php echo $ototal; ?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php
} if ($process == false) { unset($_SESSION["cartn"]); $_SESSION["errorsn"] = $errors; ?> <script> window.location="index.php?view=selln"; </script> <?php } } else { $found = false; $cart = $_SESSION["cartn"]; $index = 0; $q = OperationData::getQYesF($_POST["product_id"], $cut->id); $can = true; if ($_POST["q"] <= $q) { } else { $error = array("product_id" => $_POST["product_id"], "message" => "No hay suficiente cantidad de producto en inventario."); $errors[count($errors)] = $error; $can = false; } if ($can == false) { $_SESSION["errors"] = $errors; ?> <script> window.location="index.php?view=selln"; </script> <?php
">Adelante <i class="glyphicon glyphicon-chevron-right"></i></a> <?php } ?> </div> <div class="clearfix"></div> <br><table class="table table-bordered table-hover"> <thead> <th>Codigo</th> <th>Nombre</th> <th>Disponible</th> <th></th> </thead> <?php foreach ($curr_products as $product) { $q = OperationData::getQYesF($product->id, $_GET["id"]); ?> <tr class="<?php if ($q == 0) { echo "danger"; } else { if ($q <= 5) { echo "warning"; } } ?> "> <td><?php echo $product->id; ?> </td>
<div class="alert alert-danger" id="alert"> <strong></strong> </div> </div> </div> </div> <!--- --> <div class="row"> <div class="col-md-12"> <?php if (isset($_GET["sd"]) && isset($_GET["ed"])) { if ($_GET["sd"] != "" && $_GET["ed"] != "") { ?> <?php $operations = OperationData::getAllByDateOfficial($_GET["sd"], $_GET["ed"]); ?> <?php if (count($operations) > 0) { ?> <script> $("#wellcome").hide(); </script> <table class="table table-bordered"> <thead> <th>Id</th> <th>Producto</th> <th>Cant.</th> <th>Tipo</th> <th>Fecha</th>
if (isset($_GET["finish_at"]) && $_GET["finish_at"] != "") { echo $_GET["finish_at"]; } ?> " class="form-control" placeholder="Palabra clave"> </div> </div> <div class="col-lg-6"> <button class="btn btn-primary btn-block">Procesar</button> </div> </div> </form> <?php if (isset($_GET["start_at"]) && $_GET["start_at"] != "" && isset($_GET["finish_at"]) && $_GET["finish_at"] != "") { $users = OperationData::getByRange($_GET["start_at"], $_GET["finish_at"]); if (count($users) > 0) { // si hay usuarios $_SESSION["report_data"] = $users; ?> <div class="panel panel-default"> <div class="panel-heading"> Reportes</div> <table class="table table-bordered table-hover"> <thead> <th>Ejemplar</th> <th>Titulo</th> <th>Cliente</th> <th>Fecha</th> </thead> <?php
?> <h3>Resultados de la Busqueda</h3> <table class="table table-bordered table-hover"> <thead> <th>Codigo</th> <th>Nombre</th> <th>Unidad</th> <th>Precio unitario</th> <th>En inventario</th> <th>Cantidad</th> <th style="width:100px;"></th> </thead> <?php $products_in_cero = 0; foreach ($products as $product) { $q = OperationData::getQNoF($product->id, $cut->id); ?> <?php if ($q > 0) { ?> <form method="post" action="index.php?view=addtocartn"> <tr class="<?php if ($q <= 5) { echo "danger"; } ?> "> <td style="width:80px;"><?php echo $product->id; ?> </td>
</div> </div> <div class="col-lg-6"> <button class="btn btn-primary btn-block">Procesar</button> </div> </div> </form> <?php $products = array(); if (isset($_GET["start_at"]) && $_GET["start_at"] != "" && isset($_GET["finish_at"]) && $_GET["finish_at"] != "") { if ($_GET["start_at"] < $_GET["finish_at"]) { $products = OperationData::getAllByClientIdAndRange($client->id, $_GET["start_at"], $_GET["finish_at"]); } } else { $products = OperationData::getAllByClientId($client->id); } if (count($products) > 0) { ?> <br> <table class="table table-bordered table-hover "> <thead> <th>Ejemplar</th> <th>Libro</th> <th>Cliente</th> <th>Inicio</th> <th>Fin</th> <th>Regreso</th> </thead> <?php foreach ($products as $sell) {
">Adelante <i class="glyphicon glyphicon-chevron-right"></i></a> <?php } ?> </div> <div class="clearfix"></div> <br><table class="table table-bordered table-hover"> <thead> <th>Codigo</th> <th>Nombre</th> <th>Disponible</th> <th></th> </thead> <?php foreach ($curr_products as $product) { $q = OperationData::getQYesF($product->id); ?> <tr class="<?php if ($q <= $product->inventary_min / 2) { echo "danger"; } else { if ($q <= $product->inventary_min) { echo "warning"; } } ?> "> <td><?php echo $product->id; ?> </td>
<section class="content-header"> <h1>Historial de ventas</h1> </section> <section class="content"> <div class="row"> <div class="col-md-10 col-md-offset-1"> <?php $all = OperationData::getAllDates(); if (count($all) > 0) { ?> <div class="box box-solid box-primary"> <div class="box-header"> <h3 class="box-title"></h3> <div class="box-tools pull-right"> <button class="btn btn-primary btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button> <button class="btn btn-primary btn-sm" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body table-responsive"><table class="table table-bordered table-hover datatable"> <thead> <th></th> <th>Fecha</th> </thead> <?php foreach ($all as $a) { ?> <tr> <td style="width:50px;"> <a href="index.php?view=sellbydate&date=<?php echo $a->d;
$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";
<?php $user = UserData::getById(Session::getUID()); $operations = null; $category = null; if (!isset($_GET["cat_id"])) { $operations = OperationData::getAllByDate($_GET["date"]); $spents = SpentData::getAllByDate($_GET["date"]); } else { $operations = OperationData::getAllByDateAndCategoryId($_GET["date"], $_GET["cat_id"]); $spents = SpentData::getAllByDateAndCategoryId($_GET["date"], $_GET["cat_id"]); $category = CategoryData::getById($_GET["cat_id"]); } $sell = 0; $spent = 0; $money = 0; foreach ($operations as $career) { $sell += $career->q * $career->price; } foreach ($spents as $career) { $spent += $career->price; } $money = $sell - $spent; ?> <section class="content-header"> <h1>Resumen <small><?php $months = array("01" => "Enero", "02" => "Febrero", "03" => "Marzo", "04" => "Abril", "05" => "Mayo", "06" => "Junio", "07" => "Julio", "08" => "Agosto", "09" => "Septiembre", "10" => "Octubre", "11" => "Noviembre", "12" => "Diciembre"); echo "<b>" . date("d", strtotime($_GET["date"])) . " de " . $months[date("m", strtotime($_GET["date"]))] . " del " . date("Y", strtotime($_GET["date"])) . "</b>"; ?> </small></h1> <ol class="breadcrumb">
include "../core/autoload.php"; include "../core/modules/index/model/ProductData.php"; include "../core/modules/index/model/CategoryData.php"; include "../core/modules/index/model/OperationData.php"; include "../core/modules/index/model/OperationTypeData.php"; require_once '../PhpWord/Autoloader.php'; use PhpOffice\PhpWord\Autoloader; use PhpOffice\PhpWord\Settings; Autoloader::register(); $word = new PhpOffice\PhpWord\PhpWord(); $product = ProductData::getById($_GET["id"]); $operations = OperationData::getAllByProductId($product->id); $entradas = OperationData::GetInputQYesF($product->id); $disponibles = OperationData::GetQYesF($product->id); $salidas = -1 * OperationData::GetOutputQYesF($product->id); $section1 = $word->AddSection(); $section1->addText($product->name, array("size" => 22, "bold" => true, "align" => "right")); $section1->addText("Historial del Producto", array("size" => 14, "bold" => true, "align" => "right")); $styleTable = array('borderSize' => 6, 'borderColor' => '888888', 'cellMargin' => 40); $styleFirstRow = array('borderBottomColor' => '0000FF', 'bgColor' => 'AAAAAA'); $table0 = $section1->addTable("table0"); $table0->addRow(); $table0->addCell()->addText("Entradas"); $table0->addCell()->addText("Disponibles"); $table0->addCell()->addText("Salidas"); $table0->addRow(); $table0->addCell(4000)->addText($entradas); $table0->addCell(4000)->addText($disponibles); $table0->addCell(4000)->addText($salidas); $word->addTableStyle('table0', $styleTable, $styleFirstRow);
///// por dia $sellsdayli = SellData::getAllDayliByMesero($mesero->id); $totaldayli = 0; foreach ($sellsdayli as $selldayli) { $totaldayli += $selldayli->total; } ///// totales $sellstotal = SellData::getAllTotalByMesero($mesero->id); $totaltotal = 0; foreach ($sellstotal as $selltotal) { $totaltotal += $selltotal->total; } $operations = null; $category = null; if (!isset($_GET["cat_id"])) { $operations = OperationData::getAllByDate(date("Y-m-d", time())); $spents = SpentData::getAllByDate(date("Y-m-d", time())); } $sell = 0; $spent = 0; $money = 0; foreach ($operations as $career) { $sell += $career->q * $career->price; } foreach ($spents as $career) { $spent += $career->price; } $money = $sell - $spent; ?>
<?php $thejson = array(); $events = OperationData::getRents(); foreach ($events as $event) { $item = ItemData::getById($event->item_id); $book = $item->getBook(); $thejson[] = array("title" => $item->code . " - " . $book->title, "url" => "", "start" => $event->start_at, "end" => $event->finish_at); } // print_r(json_encode($thejson)); ?> <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: '<?php echo date("Y-m-d"); ?> ', editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?>
<?php if (!isset($_SESSION["reabastecer"])) { $product = array("product_id" => $_POST["product_id"], "q" => $_POST["q"]); $_SESSION["reabastecer"] = array($product); $cart = $_SESSION["reabastecer"]; /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// $process = true; } else { $found = false; $cart = $_SESSION["reabastecer"]; $index = 0; $q = OperationData::getQYesF($_POST["product_id"]); $can = true; ?> <?php if ($can == true) { foreach ($cart as $c) { if ($c["product_id"] == $_POST["product_id"]) { echo "found"; $found = true; break; } $index++; // print_r($c); // print "<br>"; } if ($found == true) { $q1 = $cart[$index]["q"];
if ($_POST["inventary_min"] != "") { $inventary_min = $_POST["inventary_min"]; } $product->category_id = $category_id; $product->inventary_min = $inventary_min; $product->user_id = Session::getUID(); if (isset($_FILES["image"])) { $image = new Upload($_FILES["image"]); if ($image->uploaded) { $image->Process("storage/products/"); if ($image->processed) { $product->image = $image->file_dst_name; $product->add_with_image(); } } else { $product = $product->add(); } } else { $product = $product->add(); } if ($_POST["q"] != "" || $_POST["q"] != "0") { $op = new OperationData(); $op->product_id = $product[1]; $op->operation_type_id = OperationTypeData::getByName("entrada")->id; $op->q = $_POST["q"]; $op->sell_id = "NULL"; $op->is_oficial = 1; $op->add(); } print "<script>window.location='index.php?view=products';</script>"; }
</div> </div> <div class="col-lg-6"> <button class="btn btn-primary btn-block">Procesar</button> </div> </div> </form> <?php $products = array(); if (isset($_GET["start_at"]) && $_GET["start_at"] != "" && isset($_GET["finish_at"]) && $_GET["finish_at"] != "") { if ($_GET["start_at"] < $_GET["finish_at"]) { $products = OperationData::getRentsByRange($_GET["start_at"], $_GET["finish_at"]); } } else { $products = OperationData::getRents(); } if (count($products) > 0) { ?> <br> <table class="table table-bordered table-hover "> <thead> <th>Ejemplar</th> <th>Libro</th> <th>Cliente</th> <th>Inicio</th> <th>Fin</th> <th></th> <th></th> </thead> <?php
<?php date_default_timezone_set("America/Hermosillo"); $user = UserData::getById(Session::getUID()); $operations = null; $category = null; if (!isset($_GET["cat_id"])) { $operations = OperationData::getAllByDate(date("Y-m-d", time())); $spents = SpentData::getAllByDate(date("Y-m-d", time())); } else { $operations = OperationData::getAllByDateAndCategoryId(date("Y-m-d", time()), $_GET["cat_id"]); $spents = SpentData::getAllByDateAndCategoryId(date("Y-m-d", time()), $_GET["cat_id"]); $category = CategoryData::getById($_GET["cat_id"]); } $sell = 0; $spent = 0; $money = 0; foreach ($operations as $career) { $sell += $career->q * $career->price; } foreach ($spents as $career) { $spent += $career->price; } $money = $sell - $spent; ?> <section class="content-header"> <h1>Resumen</h1> <ol class="breadcrumb"> <li> Categoria</li> <li class="active"><?php if ($category == null) {
<?php // print_r($_POST); $operation = new OperationData(); $operation->product_id = $_POST["product_id"]; $operation->operation_type_id = 1; $operation->is_oficial = 1; $operation->q = $_POST["q"]; $operation->sell_id = $_POST["sell_id"]; $operation->add(); header("Location: index.php?view=onesell&id={$_POST['sell_id']}"); // header("Location: index.php?view=categories");
<?php // print_r($_POST); $operation = OperationData::getById($_GET["operation_id"]); $operation->del(); header("Location: index.php?view=onesell&id=" . $_GET["sell_id"]);
%</b> </div> <div class="clearfix"></div> <br> <?php ?> </div> <div class="col-md-4"> <?php $ototal = -1 * OperationData::GetOutputQ($product->id, $cut->id); $ono_oficial = -1 * OperationData::GetOutputQNoF($product->id, $cut->id); $ooficial = -1 * OperationData::GetOutputQYesF($product->id, $cut->id); $nof100 = 0; $of100 = 0; if ($ono_oficial > 0) { $nof100 = $ono_oficial / $ototal; } if ($ooficial > 0) { $of100 = $ooficial / $ototal; } ?> <h1 class="pull-right"><?php echo $ototal; ?> </h1> <h2>Salidas</h2>
?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php ?> </div> <div class="col-md-4"> <?php $ototal = -1 * OperationData::GetOutputQNoF($product->id, $_GET["cutid"]); ?> <div class="jumbotron"> <center> <h2>Salidas</h2> <h1><?php echo $ototal; ?> </h1> </center> </div> <div class="clearfix"></div> <br> <?php
</div> </div> <div class="col-lg-6"> <button class="btn btn-primary btn-block">Procesar</button> </div> </div> </form> <?php $products = array(); if (isset($_GET["start_at"]) && $_GET["start_at"] != "" && isset($_GET["finish_at"]) && $_GET["finish_at"] != "") { if ($_GET["start_at"] < $_GET["finish_at"]) { $products = OperationData::getAllByItemIdAndRange($item->id, $_GET["start_at"], $_GET["finish_at"]); } } else { $products = OperationData::getAllByItemId($item->id); } if (count($products) > 0) { ?> <br> <table class="table table-bordered table-hover "> <thead> <th>Ejemplar</th> <th>Libro</th> <th>Cliente</th> <th>Inicio</th> <th>Fin</th> <th>Regreso</th> </thead> <?php foreach ($products as $sell) {