コード例 #1
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;
 }
コード例 #2
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]);
     }
 }
コード例 #3
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;
 }
コード例 #4
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();
 }
コード例 #5
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));
 }
コード例 #6
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;
 }
コード例 #7
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));
 }
コード例 #8
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;
 }
コード例 #9
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;
 }
コード例 #10
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));
 }
コード例 #11
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]);
     }
 }
コード例 #12
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]);
     }
 }
コード例 #13
0
ファイル: Accounts.php プロジェクト: chaimvaid/linet3
 public static function findAllByType($type)
 {
     return Accounts::find()->where(array('type' => $type))->All();
 }
コード例 #14
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>



コード例 #15
0
 public function actionSearch($q = null, $id = null, $type = 0)
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $out = ['results' => ['id' => '', 'text' => '']];
     if (!is_null($q)) {
         $query = new \yii\db\Query();
         $query->select('id, name AS text')->from('{{%accounts}}')->where('name LIKE "%' . $q . '%"')->andWhere(['type' => $type])->limit(20);
         $command = $query->createCommand();
         $data = $command->queryAll();
         $out['results'] = array_values($data);
     } elseif ($id > 0) {
         $out['results'] = ['id' => $id, 'text' => Accounts::find($id)->name];
     }
     return $out;
 }
コード例 #16
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');
     }
 }
コード例 #17
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();
?>
            
コード例 #18
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);
?>
      
コード例 #19
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 
コード例 #20
0
ファイル: FormOpenfrmt.php プロジェクト: chaimvaid/linet3
 public function make($cid)
 {
     $this->id = rand(0, 999999);
     //$this->iniArr=array('b110'=>0,'b100'=>0,'m100'=>0,'c100'=>0,'d100'=>0,'d110'=>0,'d120'=>0,);
     //$this->docArr=array(0=>0,305=>0,300=>0,);
     $bkmv = '';
     //$this->line=1;
     //$yiidatetimesec=Yii::$app->locale->getDateFormat('yiidatetimesec');
     //$phpdbdatetime=Yii::$app->locale->getDateFormat('phpdbdatetime');
     $from_date = $this->from_date . " 00:00:00";
     $to_date = $this->to_date . " 23:59:59";
     //$types=array(3,4,9,11,13,14);
     //accounts
     $accounts = Accounts::find()->All();
     $record = array('id' => 'B110', 'name' => OpenFormatType::getDesc('B110'), 'count' => 0);
     foreach ($accounts as $account) {
         $this->line++;
         $bkmv .= $account->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //items
     $items = Item::find()->All();
     $record = array('id' => 'M100', 'name' => OpenFormatType::getDesc('M100'), 'count' => 0);
     foreach ($items as $item) {
         $this->line++;
         $bkmv .= $item->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //
     //transactions
     $transactions = Transactions::find()->where(['BETWEEN', 'valuedate', $from_date, $to_date])->All();
     $record = array('id' => 'B100', 'name' => OpenFormatType::getDesc('B100'), 'count' => 0);
     foreach ($transactions as $transaction) {
         $this->line++;
         $bkmv .= $transaction->openfrmt($this->line, $from_date, $to_date);
         $record['count']++;
     }
     $this->iniArr[] = $record;
     //docs
     $docs = Docs::find()->where(['BETWEEN', 'due_date', $from_date, $to_date])->All();
     //OpenFormatType::getDesc('C100')
     $record = array('id' => 'C100', 'name' => OpenFormatType::getDesc('C100'), 'count' => 0);
     $d110 = array('id' => 'D110', 'name' => OpenFormatType::getDesc('D110'), 'count' => 0);
     $d120 = array('id' => 'D120', 'name' => OpenFormatType::getDesc('D120'), 'count' => 0);
     foreach ($docs as $doc) {
         if ($doc->docType->openformat != '0') {
             $this->line++;
             $bkmv .= $doc->openfrmt($this->line, $from_date, $to_date);
             foreach ($doc->docDetailes as $detial) {
                 $this->line++;
                 $bkmv .= $detial->openfrmt($this->line, $from_date, $to_date);
                 $d110['count']++;
             }
             foreach ($doc->docCheques as $detial) {
                 $this->line++;
                 $bkmv .= $detial->openfrmt($this->line, $from_date, $to_date);
                 $d120['count']++;
             }
             $type = $doc->OpenfrmtType();
             $this->docArr[$type] = isset($this->docArr[$type]) ? $this->docArr[$type] + 1 : 0;
             $this->docSumArr[$type] = isset($this->docSumArr[$type]) ? $this->docSumArr[$type] + $doc->total : $doc->total;
             $record['count']++;
         }
     }
     $this->iniArr[] = $record;
     $this->iniArr[] = $d110;
     $this->iniArr[] = $d120;
     $company = \app\models\Settings::findOne(['company.name']);
     //A100
     $bkmv = $company->a100(1, $this->id, $from_date, $to_date) . $bkmv;
     //Z900
     $bkmv = $bkmv . $company->z900($this->line + 1, $this->id, $this->line + 1);
     $bkmvFile = new Files();
     $bkmvFile->name = 'bkmvdata.txt';
     $bkmvFile->path = 'openformat/';
     //
     $bkmvFile->expire = 360;
     $bkmvFile->save();
     $bkmvFile->writeFile($bkmv);
     $this->bkmvId = $bkmvFile->id;
     //A000
     $ini = $company->a000(1, $this->id, $this->line + 1, $from_date, $to_date);
     foreach ($this->iniArr as $line) {
         $ini .= $line['id'] . sprintf("%015d", $line['count']) . "\r\n";
     }
     //Z
     $iniFile = new Files();
     $iniFile->name = 'ini.txt';
     $iniFile->path = 'openformat/';
     //
     $iniFile->expire = 360;
     $iniFile->save();
     $iniFile->writeFile($ini);
     $this->iniId = $iniFile->id;
     return $this->id;
 }