<?php print_r($_POST); $spent = new SpentData(); $spent->q = $_POST["q"]; $spent->name = $_POST["name"]; $spent->unit = $_POST["unit"]; $spent->price = $_POST["price_out"]; $spent->category_id = $_POST["category_id"]; $spent->add(); header("Location: index.php?view=spents");
<?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) {
$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 $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">
<section class="content-header"> <h1>Historial de gastos</h1> </section> <section class="content"> <div class="row"> <div class="col-md-10 col-md-offset-1"> <?php $all = SpentData::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=spentbydate&date=<?php
<?php $spent = SpentData::getById($_GET["id"]); // print_r($spent); $spent->del(); Core::redir("index.php?view=spents"); // print "<script>w</script>";