コード例 #1
7
ファイル: MailsController.php プロジェクト: OckiFals/iniforum
 public static function compose()
 {
     self::login_required();
     if ("POST" == Request::method()) {
         $from = Request::user()->id;
         $to = Request::POST()->to_account;
         $subject = isset(Request::POST()->subject) ? Request::POST()->subject : '';
         $text = Request::POST()->text;
         Messages::create($from, $to, $subject, $text);
         Response::redirect('mail/sent');
     } else {
         $inboxes_count = Messages::countMsg('to');
         $outboxes_count = Messages::countMsg('from');
         $users = Accounts::all();
         View::render('mails/compose', ['inboxes_count' => $inboxes_count, 'outboxes_count' => $outboxes_count, 'users' => $users]);
     }
 }
コード例 #2
0
ファイル: FormMincout.php プロジェクト: chaimvaid/linet3
 private function calc($account_type)
 {
     $accounts = Accounts::find()->where(['type' => $account_type])->All();
     $sum = 0;
     $data = array();
     $stime = "00:00:01";
     $etime = "23:59:59";
     $from_date = "{$this->year}-01-01 {$stime}";
     $to_date = "{$this->year}-12-31 {$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("{$this->year}-{$a}-01 {$stime}", "{$this->year}-{$a}-{$last} {$etime}");
             }
             $data[] = $accounty;
         }
     }
     return $data;
 }
コード例 #3
0
 public function actionCreate($type = 0)
 {
     $model = new FormOutcome();
     if ($type == 1) {
         $model->account_id = \app\helpers\Linet3Helper::getSetting("company.acc.payvat");
         $model->sum = Accounts::findOne($model->account_id)->getBalance();
     }
     if ($type == 2) {
         $model->account_id = \app\helpers\Linet3Helper::getSetting("company.acc.natinspay");
         $model->sum = Accounts::findOne($model->account_id)->getBalance();
     }
     if ($type == 3) {
         $model->account_id = \app\helpers\Linet3Helper::getSetting("company.acc.pretax");
         $model->sum = Accounts::findOne($model->account_id)->getBalance();
     }
     // Uncomment the following line if AJAX validation is needed
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         return \yii\widgets\ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post())) {
         if ($model->transaction()) {
             \Yii::$app->getSession()->setFlash('success', Yii::t('app', 'transaction Success'));
         }
     }
     return $this->render('create', array('model' => $model));
 }
コード例 #4
0
ファイル: PostsController.php プロジェクト: OckiFals/iniforum
 /**
  * @param $id
  */
 public static function edit($id)
 {
     $post = Posts::findByPK($id);
     if (!Request::is_authenticated()) {
         Session::push('flash-message', 'You must login before!');
         Response::redirect('login?next=post/edit/' . $id);
     } else {
         if (Request::user()->id !== $post['id_account']) {
             Session::push('flash-message', 'You does not have permission to edit the other Member\'s post!');
             Response::redirect('');
         }
     }
     if ("POST" == Request::method()) {
         $id_member = Request::user()->id;
         $data = Request::POST()->post;
         $title = Request::POST()->title;
         $cat = Request::POST()->category;
         Posts::edit($id, $id_member, $title, $data, $cat);
         # set flash messages
         Session::push('flash-message', 'Your post has changed successfully!');
         Response::redirect('post/read/' . $id);
     } else {
         $users = Accounts::find(['type' => 2]);
         $categories = Categories::all();
         View::render('member/edit-post', ['post' => $post, 'users' => $users, 'categories' => $categories]);
     }
 }
コード例 #5
0
ファイル: AccountsSearch.php プロジェクト: chaimvaid/linet3
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Accounts::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'id6111' => $this->id6111, 'cat_id' => $this->cat_id, 'pay_terms' => $this->pay_terms, 'src_tax' => $this->src_tax, 'src_date' => $this->src_date, 'parent_account_id' => $this->parent_account_id, 'system_acc' => $this->system_acc, 'owner' => $this->owner, 'modified' => $this->modified, 'created' => $this->created]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'contact', $this->contact])->andFilterWhere(['like', 'department', $this->department])->andFilterWhere(['like', 'vatnum', $this->vatnum])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'dir_phone', $this->dir_phone])->andFilterWhere(['like', 'cellular', $this->cellular])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'web', $this->web])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'zip', $this->zip])->andFilterWhere(['like', 'currency_id', $this->currency_id])->andFilterWhere(['like', 'comments', $this->comments]);
     return $dataProvider;
 }
コード例 #6
0
ファイル: TransactionType.php プロジェクト: chaimvaid/linet3
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search($params)
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $query = Accounts::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $criteria->compare('id', $this->id);
     $criteria->compare('name', $this->name, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
コード例 #7
0
ファイル: Download.php プロジェクト: chaimvaid/linet3
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($params)
 {
     $query = Accounts::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $criteria->compare('id', $this->id, true);
     $criteria->compare('company_id', $this->company_id, true);
     $criteria->compare('file_id', $this->file_id, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
コード例 #8
0
ファイル: FormReportPcn874.php プロジェクト: chaimvaid/linet3
 private function calc($account_type)
 {
     $accounts = Accounts::find()->where(['type' => $account_type])->All();
     $sum = 0;
     $data = array();
     foreach ($accounts as $account) {
         $sum = $account->getTotal($this->from_date . " 00:00:01", $this->to_date . " 23:59:59");
         if ($sum != 0) {
             $data[] = array('id' => $account->id, 'name' => $account->name, 'sum' => $sum, 'id6111' => $account->id6111);
         }
     }
     return $data;
 }
コード例 #9
0
 public function accounts()
 {
     $accountQ = Accounts::find();
     if (substr_count($this->acc, ",") != 0) {
         $accs = explode(",", $this->acc);
         foreach ($accs as $acc) {
             $accountQ = $this->between($acc, $accountQ);
         }
     } else {
         $accountQ = $this->between($this->acc, $accountQ);
     }
     return $this->chkType($accountQ)->asArray()->all();
 }
コード例 #10
0
ファイル: Controller.php プロジェクト: OckiFals/iniforum
 /**
  * Use this function for authenticated member and ustadz
  * if the authenticated is failure, the user will be redirect to
  * warning page that they can input username and pass again
  *
  * @param $username : username user
  * @param $password : password user
  * @return bool
  */
 public static function auth($username, $password)
 {
     $data = Accounts::find(['username' => $username, 'password' => md5($password)]);
     if ($data) {
         # validate was successed
         # Set a session ID
         $account = array($data['id'], $data['username'], $data['name'], $data['type']);
         $session = new Session();
         $session->set('id_account', implode('|', $account));
         return TRUE;
     }
     # validate was failure
     return FALSE;
 }
コード例 #11
0
ファイル: AccTemplateItem.php プロジェクト: chaimvaid/linet3
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($params)
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $query = Accounts::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $criteria->compare('id', $this->id);
     $criteria->compare('AccTemplate_id', $this->AccTemplate_id);
     $criteria->compare('eavFields_id', $this->eavFields_id);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
コード例 #12
0
 public function search($input)
 {
     $query = Accounts::query();
     $columns = Schema::getColumnListing('accounts');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
コード例 #13
0
ファイル: FormProfloss.php プロジェクト: chaimvaid/linet3
 private function calc($account_type)
 {
     $accounts = Accounts::find()->where(['type' => $account_type])->All();
     $sum = 0;
     $data = array();
     foreach ($accounts as $account) {
         $line = $account->getTotal($this->from_date . " 00:00:00", $this->to_date . " 23:59:59");
         if ($line != 0) {
             $data[] = array('id' => $account->id, 'name' => $account->name, 'sum' => $line, 'id6111' => $account->id6111);
             $sum += $line;
         }
     }
     $data[] = array('id' => '', 'name' => Yii::t('app', 'Total'), 'sum' => $sum, 'id6111' => '');
     return $data;
 }
コード例 #14
0
ファイル: Item.php プロジェクト: chaimvaid/linet3
 public static function findByPk($id, $date = null)
 {
     $model = self::findOne($id);
     if ($model !== null) {
         if (isset(Yii::$app->user)) {
             $uid = Yii::$app->user->id;
         } else {
             $uid = Yii::$app->params['uid'];
         }
         $incomeMap = UserIncomeMap::findOne(array('user_id' => $uid, 'itemVatCat_id' => $model->itemVatCat_id));
         if ($incomeMap !== null) {
             $model->vat = Accounts::SrcTax($incomeMap->account_id, $date);
         } else {
             $model->vat = 0;
         }
     }
     return $model;
 }
コード例 #15
0
 public static function index()
 {
     # if user was login before and the session is still valid
     if (Request::is_authenticated()) {
         if (Request::is_admin()) {
             AdminController::index();
         } else {
             MemberController::index();
         }
     } else {
         $posts = Posts::all((new DbCriteria())->order_by('created_at')->DESC());
         # set criteria
         $criteria = (new DbCriteria())->order_by('viewers')->DESC()->LIMIT(5);
         $hotposts = Posts::all($criteria)->fetchAll();
         $users = Accounts::find(['type' => 2]);
         $categories = Categories::all();
         # /app/views/home.php
         View::render('home', ['hotposts' => $hotposts, 'posts' => $posts, 'users' => $users, 'categories' => $categories]);
     }
 }
コード例 #16
0
ファイル: FormOwe.php プロジェクト: chaimvaid/linet3
 public function find()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $filter = 1;
     //small change
     $type = 0;
     //$type = (int) $this->type;
     $accounts = Accounts::findAllByType($type);
     // or using: $rawData=User::find()->All();
     $list = [];
     foreach ($accounts as $account) {
         $transBalance = $account->getBalance();
         $docBalance = $this->getDocs($account->id);
         if ($transBalance > $filter || $transBalance < $filter * -1) {
             $list[] = array('id' => $account->id, 'name' => $account->name, 'transactions' => $transBalance, 'doc' => $docBalance, 'sum' => $transBalance - $docBalance);
         }
     }
     $dataProvider = new \yii\data\ArrayDataProvider(array('allModels' => $list, 'id' => 'user', 'sort' => array('attributes' => ['id', 'name', 'transactions', 'doc', 'sum']), 'pagination' => false));
     return $dataProvider;
     // $dataProvider->getData() will return a list of arrays.
 }
コード例 #17
0
ファイル: AdminController.php プロジェクト: OckiFals/iniforum
 public static function addMember()
 {
     if ("POST" == Request::method()) {
         $username = Request::POST()->username;
         $email = Request::POST()->email;
         $pass = Request::POST()->password;
         $name = Request::POST()->name;
         $type = Request::POST()->type;
         $photo = File::upload('img', 'photo');
         # if username has used by another member
         if (Accounts::find(['username' => $username])) {
             Session::push('flash-message', 'That username has used by other member, please use another!');
             Response::redirect('accounts/add');
         }
         Accounts::create($username, $pass, $name, $email, $photo, $type);
         # push flash-message
         Session::push('flash-message', 'That members has successfuly added!');
         Response::redirect('accounts');
     } else {
         $categories = Categories::all()->fetchAll(\PDO::FETCH_CLASS);
         View::render('admin/account-add', ['categories' => $categories]);
     }
 }
コード例 #18
0
ファイル: create.php プロジェクト: chaimvaid/linet3
                                </tr>
                            </tfoot>
                            <tbody id="det">

                            </tbody>

                        </table>

                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<?php 
$this->registerJs("var baseAddress='" . yii\helpers\BaseUrl::base() . "';" . "var accountSelect='" . str_replace("\n", "", $form->field($model, 'ops', ['template' => '{input}'])->dropDownList(\yii\helpers\ArrayHelper::map(Accounts::find()->All(), 'id', 'name'))) . "';" . "var msg='" . Yii::t('app', 'sum is not 0') . "';", \yii\web\View::POS_HEAD);
$this->registerJsFile(yii\helpers\BaseUrl::base() . '/assets/transaction.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
?>


<div class="form-actions">
    <?php 
echo \yii\helpers\Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']);
?>
</div>

<?php 
kartik\form\ActiveForm::end();
?>

<?php 
コード例 #19
0
ファイル: journal.php プロジェクト: chaimvaid/linet3
use app\models\Transactions;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
/* * *********************************************************************************
 * The contents of this file are subject to the GNU AFFERO GENERAL PUBLIC LICENSE Version 3
 * ("License"); You may not use this file except in compliance with the GNU AFFERO GENERAL PUBLIC LICENSE Version 3
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 * ********************************************************************************** */
app\widgets\MiniForm::begin(array('header' => Yii::t('app', "Transactions")));
echo app\widgets\GridView::widget(['dataProvider' => $model->search([]), 'filterModel' => $model, 'id' => 'transactions-grid', 'columns' => array(array('attribute' => 'num'), 'linenum', array('attribute' => 'type', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\TransactionType::find()->All(), 'id', 'name'), 'value' => function ($data) {
    return Yii::t("app", $data->ttype->name);
}), array('attribute' => 'account_id', 'value' => function ($data) {
    return \yii\helpers\Html::a(\app\models\Accounts::findName($data->account_id), yii\helpers\BaseUrl::base() . ("/accounts/transaction/" . $data->account_id));
}, 'format' => 'raw'), array('attribute' => 'refnum1', 'value' => function ($data) {
    return $data->refnumDocsLink();
}, 'format' => 'raw'), 'refnum2', 'details', ['attribute' => 'valuedate', 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['convertFormat' => true, 'useWithAddon' => true, 'pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to '], 'hideInput' => true, 'presetDropdown' => false], 'width' => '150px', 'value' => function ($data) {
    return $data->readDateFormat($data->valuedate);
}], ['attribute' => 'reg_date', 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['convertFormat' => true, 'useWithAddon' => true, 'pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to '], 'hideInput' => true, 'presetDropdown' => false], 'width' => '150px', 'value' => function ($data) {
    return $data->readDateFormat($data->reg_date);
}], array('header' => Yii::t('app', 'Debit'), 'attribute' => 'sum', 'filter' => '', 'value' => function ($data) {
    return $data->sum < 0 ? $data->sum : "";
}), array('header' => Yii::t('app', 'Credit'), 'attribute' => 'sum', 'filter' => '', 'value' => function ($data) {
    return $data->sum > 0 ? $data->sum : "";
}))]);
?>

<?php 
app\widgets\MiniForm::end();
コード例 #20
0
<tr>
    <td>
        <?php 
use app\models\ItemVatCat;
use app\models\Accounts;
echo ItemVatCat::findName($model->itemVatCat_id);
//echo $form->hiddenField($model, "[$i]itemVatCat_id");
?>
    </td>
    <td>
        <?php 
echo Accounts::findName($model->account_id);
?>
    </td> 
</tr>
コード例 #21
0
ファイル: Network.php プロジェクト: Nosthertus/SM
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAccounts()
 {
     return $this->hasOne(Accounts::className(), ['id' => 'accounts_id']);
 }
コード例 #22
0
 public static function register()
 {
     # if user was login before
     if (Request::is_authenticated()) {
         # redirect to main page
         Response::redirect('');
     }
     if ("POST" == Request::method()) {
         $username = Request::POST()->username;
         $email = Request::POST()->email;
         $pass = Request::POST()->password;
         $name = Request::POST()->name;
         $photo = File::upload('img', 'photo');
         # if username has used by another member
         if (Accounts::find(['username' => $username])) {
             Session::push('flash-message', 'That username has used by other member, please use another!');
             Response::redirect('register');
         }
         Accounts::create($username, $pass, $name, $email, $photo);
         # set a session
         self::auth($username, $pass);
         Session::push('flash-message-info', "Welcome to iniForum, <strong>{$name}</strong>!");
         Response::redirect('');
     } else {
         View::render('member/register');
     }
 }
コード例 #23
0
ファイル: _form.php プロジェクト: chaimvaid/linet3
?>
            <div>
                <?php 
echo \app\widgets\Refnum::widget(['model' => $model, 'attribute' => 'refnum']);
?>
            </div>



            <?php 
echo $form->field($model, 'date')->widget(DateControl::classname(), ['type' => 'date']);
?>
            

            <?php 
echo $form->field($model, 'opp_account_id')->widget(Select2::className(), ['data' => \yii\helpers\ArrayHelper::map(Accounts::find()->where(array('type' => 7))->all(), 'id', 'name')]);
//7=banks
?>



            <div class="form-actions">
                <?php 
echo \yii\helpers\Html::submitButton(Yii::t('app', 'Create'), ['class' => 'btn btn-success']);
?>
            </div>

            <?php 
kartik\form\ActiveForm::end();
?>
            
コード例 #24
0
ファイル: opbalance.php プロジェクト: chaimvaid/linet3
<table class='formy'>
    <tr>

        <th><?php 
echo Yii::t('app', "Account");
?>
</th>

        <th><?php 
echo Yii::t('app', "Acct. balance");
?>
</th>
    </tr>

    <?php 
$temp = \yii\helpers\ArrayHelper::map(\app\models\Accounts::find()->All(), 'id', 'name');
$temp[0] = Yii::t('app', 'Chose Account');
for ($i = 0; $i < 10; $i++) {
    echo "<tr>\n<td>\n";
    echo \yii\helpers\Html::dropDownList('account[]', 0, $temp);
    echo "</td><td>\n";
    echo "<input type=\"text\" class=\"bal\" name=\"bal[]\" dir=\"ltr\" />\n";
    echo "</td>\n</tr>\n";
}
?>

</table>



コード例 #25
0
ファイル: admin.php プロジェクト: chaimvaid/linet3
<?php

use kartik\select2\Select2;
use kartik\datecontrol\DateControl;
use app\models\Accounts;
$this->params["menu"] = array();
app\widgets\MiniForm::begin(array('header' => Yii::t('app', "Create deposit")));
?>

<?php 
$form = kartik\form\ActiveForm::begin(array('id' => 'deposit-form', 'enableAjaxValidation' => true));
$temp = \yii\helpers\ArrayHelper::map(Accounts::findAllByType(7), 'id', 'name');
$temp[''] = Yii::t('app', 'Choose Bank');
//$model->account_id = 0;
?>


<div class='row'>
    <div class='col-md-3'>

        <?php 
echo $form->field($model, "account_id")->widget(Select2::className(), ['data' => $temp]);
?>
        <?php 
echo $form->field($model, 'refnum');
?>
        <?php 
echo $form->field($model, 'date')->widget(DateControl::classname(), ['type' => 'date']);
?>

    </div>
コード例 #26
0
ファイル: _form.php プロジェクト: chaimvaid/linet3
<div class="form">

    <?php 
use yii\helpers\ArrayHelper;
use kartik\select2\Select2;
$form = kartik\form\ActiveForm::begin(array('id' => 'accounts-form' . $model->type, 'options' => array('enctype' => 'multipart/form-data')));
$id6111 = ArrayHelper::map(\app\models\AccId6111::find()->All(), 'id', 'name');
$id6111[0] = Yii::t('app', 'None');
$currncies = ArrayHelper::map(\app\models\Currates::GetRateList(), 'currency_id', 'name');
$accounts = ArrayHelper::map(\app\models\Accounts::find()->all(), 'id', 'name');
$accounts[0] = Yii::t('app', 'None');
$acccat = ArrayHelper::map(\app\models\AccCat::find()->where(["type_id" => $model->type])->all(), 'id', 'name');
?>

    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->field($model, 'type', ['template' => '{input}'])->hiddenInput();
?>
    <div class="col-md-4 col-sm-6">
        <?php 
app\widgets\TbPanel::begin(array('header' => Yii::t('app', "Account General Details")));
?>
        <?php 
echo $form->field($model, 'name');
?>
        <?php 
echo $form->field($model, 'cat_id')->dropDownList($acccat);
?>
      
コード例 #27
0
 public function updateAccount(Request $request, $id)
 {
     $input = $request->all();
     $data = Accounts::updateAccount($id, $input);
     return response()->json($data);
 }
コード例 #28
0
ファイル: Accounts.php プロジェクト: chaimvaid/linet3
 public function getAccs()
 {
     return $this->hasMany(Accounts::className(), array('parent_account_id' => 'id'));
 }
コード例 #29
0
ファイル: Functions.php プロジェクト: nilamdoc/OxOPDF
 public function sumAccounts($user_id)
 {
     $mongodb = Connections::get('default')->connection;
     $account = Accounts::connection()->connection->command(array('aggregate' => 'accounts', 'pipeline' => array(array('$project' => array('_id' => 0, 'amount' => '$amount', 'user_id' => '$user_id', 'username' => '$username')), array('$match' => array('user_id' => $user_id)), array('$group' => array('_id' => array('user_id' => '$user_id', 'username' => '$username'), 'amount' => array('$sum' => '$amount'))))));
     return compact('account');
 }
コード例 #30
0
ファイル: FormReportTaxrep.php プロジェクト: chaimvaid/linet3
 public function calcPay()
 {
     $this->step = 1;
     $this->dates();
     $this->income_sum = Acctype::findOne(3)->getTotal($this->from_date, $this->to_date);
     $this->tax_rate = \app\helpers\Linet3Helper::getSetting('company.tax.rate');
     //$tax
     $this->tax_sum = $this->income_sum * ($this->tax_rate / 100);
     $this->custtax_acc = \app\helpers\Linet3Helper::getSetting('company.acc.custtax');
     $this->custtax_sum = Accounts::findOne($this->custtax_acc)->getTotal($this->from_date, $this->to_date);
     //*-1
     $this->custtax_total = Accounts::findOne($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;
 }