当前位置: 首页>>代码示例>>PHP>>正文


PHP OperationData::getAllByDateAndCategoryId方法代码示例

本文整理汇总了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) {
开发者ID:evilnapsis,项目名称:cazueliyas,代码行数:31,代码来源:widget-default.php

示例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">
开发者ID:evilnapsis,项目名称:cazueliyas,代码行数:31,代码来源:widget-default.php


注:本文中的OperationData::getAllByDateAndCategoryId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。