本文整理汇总了PHP中OperationData::getAllByDateAndCategoryId方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationData::getAllByDateAndCategoryId方法的具体用法?PHP OperationData::getAllByDateAndCategoryId怎么用?PHP OperationData::getAllByDateAndCategoryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationData
的用法示例。
在下文中一共展示了OperationData::getAllByDateAndCategoryId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date_default_timezone_set
<?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) {
示例2: array
<?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">