Example #1
0
<?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) {
Example #2
0
<?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">