本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: getSrcTax
public function getSrcTax($id)
{
$model = Accounts::model()->findByPk($id);
if ($model === null) {
return false;
} else {
return $model->src_tax;
}
}
示例7: masterAdmin
public static function masterAdmin()
{
$result = false;
$reader = Accounts::model()->findAll();
if (count($reader) > 0) {
$result = true;
}
return $result;
}
示例8: actionIndex
public function actionIndex()
{
Yii::import("application.models.*");
set_time_limit(0);
$accounts = Accounts::model()->findAll();
foreach ($accounts as $currentValue) {
$currentValue->checkWebsiteStatus();
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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');
}
}
示例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;
}
示例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;
}