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


PHP Accounts::model方法代码示例

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


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

示例1: calc

 private function calc($account_type)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "type = :type";
     $criteria->params = array(':type' => $account_type);
     $accounts = Accounts::model()->findAll($criteria);
     $sum = 0;
     $data = array();
     $data[] = array("id" => '', 'name' => Acctype::model()->getName($account_type), 'neg' => '', 'pos' => '', 'sum' => '', 'id6111' => '');
     $total = array("id" => '', 'name' => Yii::t("app", "Total"), 'neg' => 0, 'pos' => 0, 'sum' => 0, 'id6111' => '');
     foreach ($accounts as $account) {
         //echo $this->from_date.":00<br>";
         $sum = $account->getTotal($this->from_date . ":00", $this->to_date . ":00");
         $neg = $account->getNeg($this->from_date . ":00", $this->to_date . ":00");
         $pos = $account->getPos($this->from_date . ":00", $this->to_date . ":00");
         $total['sum'] += $sum;
         $total['neg'] += $neg;
         $total['pos'] += $pos;
         if ($sum != 0 || $neg != 0 || $pos != 0) {
             $data[] = array('id' => $account->id, 'name' => $account->name, 'neg' => $neg, 'pos' => $pos, 'sum' => $sum, 'id6111' => $account->id6111);
         }
     }
     $data[] = $total;
     return $data;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:25,代码来源:FormReportBalance.php

示例2: calc

 private function calc($account_type)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "type = :type";
     $criteria->params = array(':type' => $account_type);
     $accounts = Accounts::model()->findAll($criteria);
     $sum = 0;
     $data = array();
     $stime = "00:00:01";
     $etime = "23:59:59";
     $from_date = "01/01/{$this->year} {$stime}";
     $to_date = "31/12/{$this->year} {$etime}";
     foreach ($accounts as $account) {
         $sum = $account->getTotal($from_date, $to_date);
         if ($sum != 0) {
             $accounty = array('id' => $account->id, 'name' => $account->name, 'sum' => $sum, 'id6111' => $account->id6111);
             for ($x = 1; $x <= 12; $x++) {
                 if ($x <= 9) {
                     $a = "0{$x}";
                 } else {
                     $a = $x;
                 }
                 $last = 31;
                 while (!checkdate($x, $last, $this->year)) {
                     $last--;
                 }
                 $accounty[$x] = $account->getTotal("01/{$a}/{$this->year} {$stime}", "{$last}/{$a}/{$this->year} {$etime}");
             }
             $data[] = $accounty;
         }
     }
     return $data;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:33,代码来源:FormMincout.php

示例3: assertAccountCreated

 protected function assertAccountCreated()
 {
     $lead = Accounts::model()->findByAttributes(array('name' => 'testAccount'));
     $this->assertTrue($lead !== null);
     X2_TEST_DEBUG_LEVEL > 1 && println('account created');
     return $lead;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:WebLeadFormTest.php

示例4: loadModel

 public function loadModel($id)
 {
     $model = Accounts::model()->visible()->with('role_groups')->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:thehiddennepali,项目名称:Sample-Code,代码行数:8,代码来源:AccountsController.php

示例5: UpdateAccount

 public function UpdateAccount()
 {
     $account = Accounts::model()->findByPk(Yii::app()->user->getAccountid());
     $model = new TimezoneForm();
     $model->timezone = $account->timezone_id;
     $model->account_id = $account->account_id;
     return $model;
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:8,代码来源:TimezoneForm.php

示例6: getSrcTax

 public function getSrcTax($id)
 {
     $model = Accounts::model()->findByPk($id);
     if ($model === null) {
         return false;
     } else {
         return $model->src_tax;
     }
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:9,代码来源:Accounts.php

示例7: masterAdmin

 public static function masterAdmin()
 {
     $result = false;
     $reader = Accounts::model()->findAll();
     if (count($reader) > 0) {
         $result = true;
     }
     return $result;
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:9,代码来源:AppTools.php

示例8: actionIndex

 public function actionIndex()
 {
     Yii::import("application.models.*");
     set_time_limit(0);
     $accounts = Accounts::model()->findAll();
     foreach ($accounts as $currentValue) {
         $currentValue->checkWebsiteStatus();
     }
 }
开发者ID:branJakJak,项目名称:dienSiSystem,代码行数:9,代码来源:WebsiteCheckerCommand.php

示例9: getTotal

 public function getTotal($from_date, $to_date)
 {
     $sum = 0;
     $criteria = new CDbCriteria();
     $criteria->condition = "type = :type";
     $criteria->params = array(':type' => $this->id);
     $accounts = Accounts::model()->findAll($criteria);
     foreach ($accounts as $account) {
         $sum += $account->getTotal($from_date, $to_date);
     }
     return $sum;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:12,代码来源:Acctype.php

示例10: findByPk

 public function findByPk($id, $condition = '', $params = array())
 {
     $model = parent::findByPk($id, $condition = '', $params = array());
     if ($model !== null) {
         $incomeMap = UserIncomeMap::model()->findByPk(array('user_id' => Yii::app()->user->id, 'itemVatCat_id' => $model->itemVatCat_id));
         if ($incomeMap !== null) {
             $model->vat = Accounts::model()->getSrcTax($incomeMap->account_id);
         } else {
             $model->vat = 0;
         }
     }
     return $model;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:13,代码来源:Item.php

示例11: chkType

 private function chkType($account_id)
 {
     $model = Accounts::model()->findByPk($account_id);
     if ($model === NULL) {
         return NULL;
     }
     if ($model->type == $this->type) {
         return $account_id;
     } elseif ($this->type == '') {
         return $account_id;
     } else {
         return null;
     }
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:14,代码来源:FormReportAccounts.php

示例12: calc

 private function calc($account_type)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "type = :type";
     $criteria->params = array(':type' => $account_type);
     $accounts = Accounts::model()->findAll($criteria);
     $sum = 0;
     $data = array();
     foreach ($accounts as $account) {
         $sum = $account->getTotal($this->from_date . ":00", $this->to_date . ":00");
         if ($sum != 0) {
             $data[] = array('id' => $account->id, 'name' => $account->name, 'sum' => $sum, 'id6111' => $account->id6111);
         }
     }
     return $data;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:16,代码来源:FormReportPcn874.php

示例13: actionWhatsNew

 public function actionWhatsNew()
 {
     if (!Yii::app()->user->isGuest) {
         $user = User::model()->findByPk(Yii::app()->user->getId());
         $lastLogin = $user->lastLogin;
         $contacts = Contacts::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $actions = Actions::model()->findAll("lastUpdated > {$lastLogin} AND (assignedTo='" . Yii::app()->user->getName() . "' OR assignedTo='Anyone') ORDER BY lastUpdated DESC LIMIT 50");
         $sales = Sales::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $accounts = Accounts::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $arr = array_merge($contacts, $actions, $sales, $accounts);
         $records = Record::convert($arr);
         $dataProvider = new CArrayDataProvider($records, array('id' => 'id', 'pagination' => array('pageSize' => ProfileChild::getResultsPerPage()), 'sort' => array('attributes' => array('lastUpdated', 'name'))));
         $this->render('whatsNew', array('records' => $records, 'dataProvider' => $dataProvider));
     } else {
         $this->redirect('login');
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:17,代码来源:SiteController.php

示例14: save

 public function save($runValidation = true, $attributes = NULL)
 {
     $class = get_class($this);
     if ($class == 'Accounts') {
         if (Accounts::model()->findByPk($this->id)) {
             $this->isNewRecord = false;
         }
     }
     $a = parent::save($runValidation, $attributes);
     if ($a) {
         //if (isset($_POST['Files'])) {
         //$this->attributes = $_POST['Files'];
         $tmps = CUploadedFile::getInstancesByName('Files');
         // proceed if the images have been set
         if (isset($tmps) && count($tmps) > 0) {
             Yii::log('saved', 'info', 'app');
             // go through each uploaded image
             $configPath = Yii::app()->user->settings["company.path"];
             foreach ($tmps as $image => $pic) {
                 $img_add = new Files();
                 $img_add->name = $pic->name;
                 //it might be $img_add->name for you, filename is just what I chose to call it in my model
                 $img_add->path = "files/";
                 $img_add->parent_type = get_class($this);
                 $img_add->parent_id = $this->id;
                 // this links your picture model to the main model (like your user, or profile model)
                 $img_add->save();
                 // DONE
                 if ($pic->saveAs($img_add->getFullFilePath())) {
                     // add it to the main model now
                 } else {
                     echo 'Cannot upload!';
                 }
             }
             if (isset($_FILES)) {
                 Yii::log(print_r($_FILES, true), 'info', 'app');
                 unset($_FILES);
                 $tmps = CUploadedFile::reset();
             }
             //}
         }
     }
     //endFile
     return $a;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:45,代码来源:fileRecord.php

示例15: calcPay

 public function calcPay()
 {
     $this->step = 1;
     $this->dates();
     $this->income_sum = Acctype::model()->findByPk(3)->getTotal($this->from_date, $this->to_date);
     $this->tax_rate = Yii::app()->user->settings['company.tax.rate'];
     //$tax
     $this->tax_sum = $this->income_sum * ($this->tax_rate / 100);
     $this->custtax_acc = Yii::app()->user->settings['company.acc.custtax'];
     $this->custtax_sum = Accounts::model()->findByPk($this->custtax_acc)->getTotal($this->from_date, $this->to_date);
     //*-1
     $this->custtax_total = Accounts::model()->findByPk($this->custtax_acc)->getTotal(0, $this->to_date);
     if ($this->custtax_total > $this->tax_sum) {
         $this->custtax_total = $this->tax_sum;
     }
     $this->tax_total = $this->tax_sum + $this->custtax_total;
     return $this->tax_total;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:18,代码来源:FormReportTaxrep.php


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