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


PHP Prefs::latestPeriod方法代码示例

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


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

示例1: getIndex

 public function getIndex()
 {
     $this->heads = array(array('Period', array('search' => true, 'sort' => true, 'style' => 'min-width:90px;', 'daterange' => true)), array('Date', array('search' => true, 'sort' => true, 'style' => 'min-width:100px;', 'daterange' => true)), array('JV Ref', array('search' => true, 'sort' => true, 'style' => 'min-width:120px;')), array('Account', array('search' => true, 'style' => 'min-width:100px;', 'sort' => true)), array('Account Description', array('search' => true, 'style' => 'min-width:125px;', 'sort' => true)), array('Reference Doc.', array('search' => true, 'sort' => true)), array('Orig. Currency', array('search' => true, 'sort' => true)), array('Orig. Amount', array('search' => true, 'sort' => true)), array('Conversion Rate', array('search' => true, 'sort' => true)), array('Base Amount', array('search' => true, 'sort' => true)), array('Transaction Description', array('search' => true, 'sort' => true)));
     //print $this->model->where('docFormat','picture')->get()->toJSON();
     $this->title = 'Statement of Operation Account Balance';
     $this->place_action = 'none';
     $this->can_add = false;
     $this->show_select = false;
     Breadcrumbs::addCrumb('Cost Report', URL::to(strtolower($this->controller_name)));
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     //print $prior_year;
     $company = strtolower($company);
     if ($company == '') {
         $company = Config::get('lundin.default_company');
     }
     $companylist = Prefs::getCompany(array('key' => 'DB_CODE', 'sign' => '=', 'value' => $company))->CompanyToArray()->toArray();
     if (count($companylist) > 0) {
         $companyname = $companylist[0]['DESCR'];
     } else {
         $companyname = '';
     }
     $afe = Input::get('acc-afe');
     if ($afe == '' || is_null($afe)) {
         $afes = Prefs::getAfe($company)->AfeToArray();
         $afe = $afes[0]->ANL_CODE;
     }
     $company = strtolower($company);
     $maxperiod = Prefs::latestPeriod($company . '_a_salfldg');
     $period_from = Input::get('acc-period-from');
     $period_to = Input::get('acc-period-to');
     if ($period_from == '' || is_null($period_from)) {
         $period_from = $maxperiod;
     }
     // test value
     //$period_from = '2015001';
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y0m', time());
     }
     $prior_year = substr($period_from, 0, 4);
     $prior_year = $prior_year - 1;
     $prior_year .= '012';
     $this->additional_filter = View::make(strtolower($this->controller_name) . '.addfilter')->with('maxperiod', $period_from)->with('submit_url', 'jvsoab')->render();
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->sql_key = 'TRANS_DATETIME';
     $this->sql_table_name = $company . '_a_salfldg';
     $this->sql_connection = 'mysql2';
     /* Start custom queries */
     $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
     $tables = array();
     //current month
     $currentmonthset = array();
     $titlekeys = array();
     $sectiontitle = array();
     foreach (Config::get('accgroup.jvsoab') as $sec => $data) {
         $sectiontitle[$data['key']] = $sec;
         $section = $data['key'];
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $titlekeys[$section][$v['key']] = $h;
             }
         }
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
                         $vals = $v['val'];
                         $model = $model->where(function ($q) use($vals, $company) {
                             foreach ($vals as $nval) {
                                 $q = $q->whereOr($company . '_a_salfldg.ACCNT_CODE', 'like', $nval);
                             }
                         });
                     } else {
                         $model = $model->where($company . '_a_salfldg.ACCNT_CODE', 'like', $v['val']);
                     }
                 }
                 $res = $model->where($company . '_a_salfldg.PERIOD', '=', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
                 $currentmonthset[$section][$v['key']] = $res;
             }
         }
         //priormonth ITD
         $priormonthset = array();
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:JvsoabController.php


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