/** * @return \yii\db\ActiveQuery */ public function getAccount() { return $this->hasOne(AccountAccount::className(), ['id' => 'account_id']); }
/** * @return \yii\db\ActiveQuery */ public function getValuationOutAccount() { return $this->hasOne(AccountAccount::className(), ['id' => 'valuation_out_account_id']); }
public function actionReportaccount() { $this->layout = 'dashboard'; $model = new AccountingReportForm(); $account = AccountAccount::find()->where(['type' => ['view', 'other', 'receivable', 'payable', 'liquidity', 'consolidation', 'closed']])->all(); $SelectAccount = ArrayHelper::map($account, 'id', 'name'); $model->load(Yii::$app->request->get()); if ($model->load(Yii::$app->request->get())) { $this->layout = 'report'; $query = new Query(); if ($model->account == null) { $query->select(' aml.account_id as account_id, aa.code as code, aa.name as account_name')->distinct('aml.account_id')->from('account_move_line as aml')->join('LEFT JOIN', 'account_account as aa', 'aa.id=aml.account_id')->where(['>=', 'aml.date', $model->date_from])->andWhere(['<=', 'aml.date', $model->date_to])->addOrderBy(['aml.account_id' => SORT_ASC]); } else { $query->select(' aml.account_id as account_id, aa.code as code, aa.name as account_name')->distinct('aml.account_id')->from('account_move_line as aml')->join('LEFT JOIN', 'account_account as aa', 'aa.id=aml.account_id')->where(['>=', 'aml.date', $model->date_from])->andWhere(['<=', 'aml.date', $model->date_to])->andWhere(['aml.account_id' => explode(',', $model->account)])->addOrderBy(['aml.account_id' => SORT_ASC]); } $queryline = new Query(); $queryline->select(' aml.account_id as account_id, aa.name as account_name, aml.ref as ref, aml.name as name, aml.date as date, aml.debit as debit, aml.credit as credit')->from('account_move_line aml')->join('LEFT JOIN', 'account_move as am', 'am.id=aml.move_id')->join('LEFT JOIN', 'account_account as aa', 'aa.id=aml.account_id')->where(['>=', 'aml.date', $model->date_from])->andWhere(['<=', 'aml.date', $model->date_to])->addOrderBy(['aml.account_id' => SORT_ASC])->addOrderBy(['aml.date' => SORT_ASC]); return $this->render('report/transaksiaccount', ['data' => $queryline->all(), 'array' => $query->all(), 'from' => $model->date_from, 'to' => $model->date_to]); } return $this->render('reportaccount', ['model' => $model, 'SelectAccount' => $SelectAccount]); }
/** * @return \yii\db\ActiveQuery */ public function getAccountAccounts() { return $this->hasMany(AccountAccount::className(), ['parent_id' => 'id']); }