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


PHP AppHelper::range_week方法代码示例

本文整理汇总了PHP中AppHelper::range_week方法的典型用法代码示例。如果您正苦于以下问题:PHP AppHelper::range_week方法的具体用法?PHP AppHelper::range_week怎么用?PHP AppHelper::range_week使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppHelper的用法示例。


在下文中一共展示了AppHelper::range_week方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_report

 public function get_report()
 {
     $account_id = Input::get('account_id');
     $periode = Input::get('periode', 'weekly');
     $date = Input::get('date');
     $end_date = Input::get('end_date');
     $today = strtotime(date('Y-m-d'));
     if (is_null($date) || empty($date)) {
         $last_week = $today - 3600 * 24 * 7;
         $date = date('Y-m-d', $last_week);
     }
     if ('daily' == $periode) {
         $range = array('start' => $date, 'end' => $date);
     } else {
         if ('weekly' == $periode) {
             $range = AppHelper::range_week($date);
         } else {
             if ('monthly' == $periode) {
                 $range = AppHelper::range_month($date);
             } else {
                 if ('custom' == $periode) {
                     $range = array('start' => $date, 'end' => $end_date);
                 }
             }
         }
     }
     $account = Account::find($account_id);
     $donations = Donation::where_between('donation_date', $range['start'], $range['end'])->where_account_id($account_id)->order_by('donation_date', 'asc')->get();
     $expenses = Expense::where_between('expense_date', $range['start'], $range['end'])->where_account_id($account_id)->order_by('expense_date', 'asc')->get();
     $transactions = Transaction::where_between('date', $range['start'], $range['end'])->where_account_id($account_id)->order_by('date', 'asc')->get();
     if (isset($donations[0]) || isset($expenses[0])) {
         $last_transaction = Transaction::earlier_than($transactions[0])->where_account_id($account_id)->first();
     } else {
         $last_transaction = Transaction::earlier_than_date($range['start'])->where_account_id($account_id)->first();
     }
     // var_dump($last_transaction); die;
     if (is_null($last_transaction)) {
         $last_transaction_balance = 0;
     } else {
         $last_transaction_balance = $last_transaction->balance->balance_amount;
     }
     $end_transaction = Transaction::where_between('date', $range['start'], $range['end'])->where_account_id($account_id)->order_by('date', 'desc')->order_by('id', 'desc')->first();
     if (is_null($end_transaction)) {
         $end_balance = 0;
     } else {
         $end_balance = $end_transaction->balance->balance_amount;
     }
     $data = array('range' => $range, 'account' => $account, 'donations' => $donations, 'expenses' => $expenses, 'last_transaction_balance' => $last_transaction_balance, 'end_balance' => $end_balance, 'periode' => $periode);
     return View::make('account.report', $data);
     // echo var_dump($end_balance);
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:51,代码来源:accounts.php


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