public function actionOpenbalance() { $model = new Transactions(); if (isset($_POST['account'])) { $year = $_POST['year']; $date = "{$year}-01-01 00:00:01"; $accountArr = $_POST['account']; $balanceArr = $_POST['bal']; foreach ($accountArr as $index => $account) { $sum = $balanceArr[$index]; if ($account) { $submodel = new Transactions(); $submodel->refnum1 = ''; $submodel->valuedate = $date; $submodel->details = Yii::t('app', "Opening Balance"); $submodel->type = \app\helpers\Linet3Helper::getSetting('transactionType.openBalance'); $submodel->currency_id = \app\helpers\Linet3Helper::getSetting('company.cur'); $submodel->owner_id = Yii::$app->user->id; $submodel->linenum = 0; $submodel->addDoubleLine($account, \app\helpers\Linet3Helper::getSetting('company.acc.openbalance'), $sum); //$submodel->num; } } \Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Open Balance saved')); //$this->redirect(array('OpenBalance')); } return $this->render('opbalance', array('model' => $model)); }
public function actionTransaction($id = 200) { $model = new Transactions(); //$model->unsetAttributes(); $model->scenario = 'search'; $model->load(Yii::$app->request->get()); $model->account_id = $id; return $this->render('transaction', array('model' => $model, 'account' => $this->findModel($id))); }
public function save() { //create Match $match = new IntCorrelation(); $match->account_id = $this->account_id; $match->owner = Yii::$app->user->id; $match->save(); //bankbooks foreach ($this->in as $transaction => $true) { $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->intCorrelation = $match->id; $transaction->intType = true; $transaction->save(); } } //transaction foreach ($this->out as $transaction => $true) { $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->intCorrelation = $match->id; $transaction->intType = false; $transaction->save(); } } return $match->id; }
public function transTest() { $trans = Transactions::find()->orderBy(['num' => SORT_ASC, 'linenum' => SORT_ASC])->All(); $num = 0; $linenum = 0; $sum = 0; //$singleLine=true; foreach ($trans as $tran) { if ($tran->num != $num) { if ($tran->num != $num + 1) { $this->errors[] = 'Invalid Transaction number: ' . $tran->num . " id: " . $tran->id; } $num = $tran->num; if (abs($sum) > 0.001 && $linenum == 1) { //spacial case single line $this->errors[] = 'Invalid Transaction sum: ' . $sum . " num: " . ($tran->num - 1); } $sum = $tran->leadsum; $linenum = 1; } else { if ($tran->linenum == $linenum + 1) { $linenum = $tran->linenum; $sum += $tran->leadsum; //$singleLine=false; } else { $this->errors[] = 'Invalid Transaction line in number: ' . $tran->num . " id: " . $tran->id; } } } }
public function save() { //create Match $match = new ExtCorrelation(); $match->account_id = $this->account_id; $match->owner = Yii::$app->user->id; $match->save(); //bankbooks //print_r($this->Bankbooks); //print_r($this->Transactions); foreach ($this->Bankbooks['match'] as $bankbook => $true) { Yii::info("bank:" . $bankbook); $bankbook = Bankbook::findOne($bankbook); if ($bankbook !== null) { $bankbook->extCorrelation = $match->id; $bankbook->save(); } } //transaction foreach ($this->Transactions['match'] as $transaction => $true) { Yii::info("trans:" . $transaction); $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->extCorrelation = $match->id; $transaction->save(); } } return $match->id; }
public function search($id) { //echo $id . uniqid(); $query = Transactions::find(); $query->andFilterWhere(['account_id' => $id]); $query->andFilterWhere(['between', 'valuedate', $this->from_date, $this->to_date]); $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query, "sort" => ['defaultOrder' => ['num' => SORT_DESC]], 'pagination' => false]); return $dataProvider; }
public function save() { //print_r($this->Deposit); $num = 0; //$linenum=1; $tranType = \app\helpers\Linet3Helper::getSetting('transactionType.chequedeposit'); if ($this->refnum == '' || $this->date == '' || !is_array($this->Deposit)) { return false; } $accout = new Transactions(); $accout->type = $tranType; $accout->refnum1 = ''; //$this->refnum; $accout->refnum2 = $this->refnum; $accout->details = Yii::t('app', 'Deposit') . " #" . $this->refnum; $accout->valuedate = $this->date . $this->refnum; $accout->owner_id = Yii::$app->user->id; $accout->linenum = 1; $transaction = Yii::$app->db->beginTransaction(\yii\db\Transaction::READ_UNCOMMITTED); //-shuld start transaction here try { foreach ($this->Deposit as $line => $val) { list($a, $b) = explode(',', $line); $cheq = Doccheques::findOne(array("doc_id" => $a, "line" => $b)); $oppt_acc = PaymentType::findOne($cheq->type)->oppt_account_id; $accout->currency_id = $cheq->currency_id; $accout->addDoubleLine($oppt_acc, $this->account_id, $cheq->sum); $cheq->bank_refnum = $num; $cheq->save(); } $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); $message = $e->getMessage(); $this->addError('refnum', $message); } return true; //num }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Transactions::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'trans_date' => $this->trans_date, 'type_id' => $this->type_id]); $query->andFilterWhere(['like', 'trans_code', $this->trans_code])->andFilterWhere(['like', 'remarks', $this->remarks]); return $dataProvider; }
public function transaction() { if ($this->validate()) { $num = 0; $line = 1; $tranType = \app\helpers\Linet3Helper::getSetting("transactionType.supplierPayment"); $tran = new Transactions(); $tran->num = $num; $tran->type = $tranType; $tran->refnum1 = $this->refnum_ids; $tran->refnum2 = ''; $tran->valuedate = $this->date; $tran->details = $this->details; $tran->currency_id = $this->currency_id; $tran->owner_id = Yii::$app->user->id; $tran->linenum = $line; $trans = Yii::$app->db->beginTransaction(\yii\db\Transaction::READ_UNCOMMITTED); //-shuld start transaction here so lets lock down try { $tran->addSingleLine($this->account_id, $this->sum * -1); $tran->addSingleLine($this->opp_account_id, $this->sum * 1); if ((int) $this->src_tax != 0) { $tran->addDoubleLine(5, $this->account_id, $this->src_tax); } //commit it here $trans->commit(); } catch (\Exception $e) { $trans->rollBack(); $message = $e->getMessage(); $this->addError('details', $message); return false; } $this->saveRef($num, $this->sum); return true; } return false; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Transactions::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith('transEmployee'); $query->andFilterWhere(['trans_date' => $this->trans_date]); $query->andFilterWhere(['like', 'CONCAT(employees.employee_name)', $this->trans_employee]); $query->andFilterWhere(['like', 'trans_id', $this->trans_id])->andFilterWhere(['like', 'trans_status', $this->trans_status]); return $dataProvider; }
public function actionProducts() { $posted_data = Yii::$app->request->post(); $data = ['transactions' => []]; if (Yii::$app->request->getQueryParam('page')) { $posted_data = Yii::$app->session['posted_data']; } if (!empty($posted_data)) { Yii::$app->session['posted_data'] = $posted_data; $date_range = $posted_data['date_range']; $player_select = $posted_data['player_select']; $category_select = $posted_data['category_select']; $warehouse_select = $posted_data['warehouse_select']; $products_select = $posted_data['products_select']; $query = TransactionItems::find(); $query->joinWith(['transaction', 'product', 'transaction.userAccount']); if ($player_select > 0) { $query->andWhere([Transactions::tableName() . '.user_id' => $player_select]); } if ($date_range != '') { $date_range = explode(' to ', $date_range); $start_date = $date_range[0]; $end_date = $date_range[1]; $query->andWhere(['BETWEEN', 'transaction_date', Yii::$app->formatter->asDate($start_date, 'php:Y-m-d') . ' 00:00:00', Yii::$app->formatter->asDate($end_date, 'php:Y-m-d') . ' 23:59:59']); } if ($category_select > 0) { $query->andWhere([Products::tableName() . '.category_id' => $category_select]); } if ($warehouse_select > 0) { $query->andWhere([Products::tableName() . '.warehouse_id' => $warehouse_select]); } if ($products_select > 0) { $query->andWhere(['product_id' => $products_select]); } $pagination = new Pagination(['totalCount' => $query->count(), 'pageSize' => 10]); $total_quantity = $query->sum(TransactionItems::tableName() . '.quantity'); $total_buy_price = $query->sum(TransactionItems::tableName() . '.buy_price'); $total_sell_price = $query->sum(TransactionItems::tableName() . '.sell_price'); $total_amount = $query->sum(TransactionItems::tableName() . '.quantity * ' . TransactionItems::tableName() . '.sell_price'); // echo $query->prepare(Yii::$app->db->queryBuilder)->createCommand()->rawSql; $transactions = $query->offset($pagination->offset)->limit($pagination->limit)->all(); $data = ['transactions' => $transactions, 'g_total_quantity' => $total_quantity, 'g_total_buy_price' => $total_buy_price, 'g_total_sell_price' => $total_sell_price, 'g_total_amount' => $total_amount, 'pagination' => $pagination, 'posted_data' => $posted_data]; } return $this->render('products', $data); }
public function index($s = null) { $greencoin = new Greencoin('http://' . GREENCOIN_WALLET_SERVER . ':' . GREENCOIN_WALLET_PORT, GREENCOIN_WALLET_USERNAME, GREENCOIN_WALLET_PASSWORD); $paytxfee = Parameters::find('first'); $txfee = $paytxfee['payxgctxfee']; $getrawtransaction = $greencoin->getrawtransaction($s); $decoderawtransaction = $greencoin->decoderawtransaction($getrawtransaction); foreach ($decoderawtransaction['vout'] as $out) { foreach ($out['scriptPubKey']['addresses'] as $address) { $username = $greencoin->getaccount($address); $Amount = (double) $out['value']; if ($greencoin->getaccount($address) != "") { $Transactions = Transactions::find('first', array('conditions' => array('TransactionHash' => $s))); if ($Transactions['_id'] == "") { $t = Transactions::create(); $Amount = $Amount; $comment = "Move from User: "******"; Address: " . GREENCOINX_ADDRESS . "; Amount:" . $Amount . ";"; $transfer = $greencoin->sendfrom($username, GREENCOINX_ADDRESS, (double) $Amount, (int) 0, $comment); if (isset($transfer['error'])) { $error = $transfer['error']; } else { $error = $transfer; } $data = array('DateTime' => new \MongoDate(), 'TransactionHash' => $s, 'username' => $username, 'address' => $address, 'Currency' => 'XGC', 'Amount' => $Amount, 'Added' => true, 'Transfer' => $comment); $t->save($data); $userName = str_replace("SiiCrypto-", "", $username); $details = Details::find('first', array('conditions' => array('username' => (string) $userName))); $dataDetails = array('balance.XGC' => (double) ((double) $details['balance.XGC'] + (double) $Amount), 'XGCnewaddress' => 'Yes'); $details = Details::find('all', array('conditions' => array('username' => (string) $userName)))->save($dataDetails); } else { $Transactions = Transactions::find('first', array('conditions' => array('TransactionHash' => $s)))->save($data); } } } } }
private function calc($accounts = array(), $types = array()) { $sum = 0; /* $criteria = new CDbCriteria; $criteria->condition = "date BETWEEN :from_date AND :to_date"; $criteria->params = array( ':from_date' => $from_date, ':to_date' => $to_date, ); $criteria->compare('type', $types); $criteria->compare('account_id', $accounts); */ $trans = Transactions::find()->where(['BETWEEN', 'valuedate', $this->from_date, $this->to_date])->andWhere(['type' => $types, 'account_id' => $accounts])->All(); $sum = 0; $data = array(); foreach ($trans as $tran) { $sum = $tran->sum; if ($sum != 0) { $data[] = array('id' => $tran->id, 'name' => $tran->account_id, 'sum' => $sum, 'id6111' => $tran->id); } } return $data; }
public function sumTransactions() { $mongodb = Connections::get('default')->connection; $transactions = Transactions::connection()->connection->command(array('aggregate' => 'transactions', 'pipeline' => array(array('$project' => array('_id' => 0, 'amount' => '$amount', 'category' => '$category', 'account' => '$account', 'address' => '$address')), array('$group' => array('_id' => array('account' => '$account', 'category' => '$category', 'address' => '$address'), 'amount' => array('$sum' => '$amount'), 'count' => array('$sum' => 1))), array('$sort' => array('account' => 1, 'category' => 1))))); return compact('transactions'); }
public function search($params) { $query = Tasks::find(); //формируем провайдер $dataProvider = new ActiveDataProvider(['query' => $query]); //задание сортировки по умолчанию $dataProvider->sort->attributes = ['TASKS.ID' => ['asc' => ['TASKS.ID' => SORT_ASC], 'desc' => ['TASKS.ID' => SORT_DESC]]]; $dataProvider->sort->defaultOrder = ['TASKS.ID' => SORT_DESC]; //overdue issues filter if (isset($params['overdue']) && $params['overdue'] == 1) { $tasks = \app\models\Tasks::find()->all(); $list = []; foreach ($tasks as $task) { $id = $task->ID; $persons = \app\models\PersTasks::find()->where(['TASK_ID' => $id, 'DEL_TRACT_ID' => 0])->all(); if ($persons) { $states_array = []; foreach ($persons as $person) { $pers_tasks = \app\models\PersTasks::find()->where(['TASK_ID' => $id, 'TN' => $person->TN, 'DEL_TRACT_ID' => 0])->one(); $task_state = \app\models\TaskStates::find()->where(['IS_CURRENT' => 1, 'PERS_TASKS_ID' => $pers_tasks->ID, 'TASK_ID' => $id])->one(); if ($task_state) { $states_array[] = $task_state->STATE_ID; } else { $list[] = $id; } } if (!empty($states_array)) { $min_state = min($states_array); $state = \app\models\States::findOne($min_state); } } if (isset($state)) { if ($state->ID != 7 || $state->ID != 9) { $list[] = $id; } } } $list = array_unique($list); $query->andFilterWhere(['TASKS.ID' => $list]); $now = date("Y-m-d"); $query->andFilterWhere(['<', 'TASKS.DEADLINE', new \yii\db\Expression("to_date('" . $now . "','{$this->dateFormat}')")]); $query->joinWith('perstasks'); $query->andFilterWhere(['PERS_TASKS.TN' => \Yii::$app->user->id]); } //own issues filter if (isset($params['own_issues']) && $params['own_issues'] == 1) { $query->joinWith('perstasks'); $query->andFilterWhere(['PERS_TASKS.TN' => \Yii::$app->user->id]); } if (isset($params['for_person']) && $params['for_person'] != '') { $query->joinWith('perstasks'); $query->andFilterWhere(['PERS_TASKS.TN' => $params['for_person']]); } if (isset($params['for_podr']) && $params['for_podr'] != '') { $query->joinWith('podrtasks'); $query->andFilterWhere(['PODR_TASKS.KODZIFR' => $params['for_podr']]); } //podr issues filter if (isset($params['podr_issues']) && $params['podr_issues'] == 1) { //check permission $permissions_podr_tasks_my = \app\models\Permissions::find()->where('(SUBJECT_TYPE = :subject_type and SUBJECT_ID = :user_id and DEL_TRACT_ID = :del_tract and PERM_LEVEL != :perm_level and ACTION_ID = :action) or (SUBJECT_TYPE = :subject_type_dolg and SUBJECT_ID = :id_dolg and DEL_TRACT_ID = :del_tract and PERM_LEVEL != :perm_level and ACTION_ID = :action)', ['subject_type_dolg' => 1, 'id_dolg' => \Yii::$app->session->get('user.user_iddolg'), 'action' => 21, 'subject_type' => 2, 'user_id' => \Yii::$app->user->id, 'del_tract' => 0, 'perm_level' => 0])->one(); if ($permissions_podr_tasks_my) { if ($permissions_podr_tasks_my->PERM_LEVEL == 1 || $permissions_podr_tasks_my->PERM_LEVEL == 2) { //get podr id of this user $query_dao = new \yii\db\Query(); $query_dao->select('*')->from('STIGIT.V_F_PERS')->where('TN = \'' . \Yii::$app->user->id . '\''); $command = $query_dao->createCommand(); $data = $command->queryOne(); //вот тут решить что означает выданные моему подразделению $query->joinWith('podrtasks'); $query->andFilterWhere(['PODR_TASKS.KODZIFR' => trim($data['KODZIFR'])]); } else { throw new \yii\web\ForbiddenHttpException('У Вас нет прав на "Выданные любым задания"'); } } else { throw new \yii\web\ForbiddenHttpException('У Вас нет прав на "Выданные любым задания"'); } } //tasks my filter if (isset($params['tasks_my']) && $params['tasks_my'] == 1) { //check permission $permissions_podr_tasks_my = \app\models\Permissions::find()->where('(SUBJECT_TYPE = :subject_type and SUBJECT_ID = :user_id and DEL_TRACT_ID = :del_tract and PERM_LEVEL != :perm_level and ACTION_ID = :action) or (SUBJECT_TYPE = :subject_type_dolg and SUBJECT_ID = :id_dolg and DEL_TRACT_ID = :del_tract and PERM_LEVEL != :perm_level and ACTION_ID = :action)', ['subject_type_dolg' => 1, 'id_dolg' => \Yii::$app->session->get('user.user_iddolg'), 'action' => 23, 'subject_type' => 2, 'user_id' => \Yii::$app->user->id, 'del_tract' => 0, 'perm_level' => 0])->one(); if ($permissions_podr_tasks_my) { if ($permissions_podr_tasks_my->PERM_LEVEL == 1 || $permissions_podr_tasks_my->PERM_LEVEL == 2) { //get all current user transactions $transactions = \app\models\Transactions::find()->where(['TN' => \Yii::$app->user->id])->all(); if ($transactions) { $transactions_array = []; foreach ($transactions as $transaction) { $transactions_array[] = $transaction->ID; } $query->andFilterWhere(['TRACT_ID' => $transactions_array]); } } else { throw new \yii\web\ForbiddenHttpException('У Вас нет прав на "Выданные лично задания"'); } } else { throw new \yii\web\ForbiddenHttpException('У Вас нет прав на "Выданные лично задания"'); } } if (!($this->load($params) && $this->validate())) { return $dataProvider; } //проверяем существует ли фильтр и добавляем его в запрос провайдера для каждого из полей фильтра if (!empty($this->states)) { $query->joinWith('taskstates'); $query->andFilterWhere(['TASK_STATES.STATE_ID' => $this->states]); } if (!empty($this->podr_list)) { $podr_list = array_map('trim', explode(',', $this->podr_list)); $query->joinWith('podrtasks'); $query->andFilterWhere(['PODR_TASKS.KODZIFR' => $podr_list]); } if (!empty($this->agreed_podr_list)) { $agreed_podr_list = array_map('trim', explode(',', $this->agreed_podr_list)); $query->joinWith('taskconfirms'); $query->andFilterWhere(['TASK_CONFIRMS.KODZIFR' => $agreed_podr_list]); } if (!empty($this->persons_list)) { $persons_list = array_map('trim', explode(',', $this->persons_list)); $query->joinWith('perstasks'); $query->andFilterWhere(['PERS_TASKS.TN' => $persons_list]); } if (!empty($this->documentation)) { $query->joinWith('taskdocs'); $query->andFilterWhere(['TASK_DOCS.DOC_CODE' => $this->documentation]); } if ($this->deadline_from != '' && $this->deadline_to != '') { $deadline_from = explode('-', $this->deadline_from); $deadline_from_formatted = $deadline_from[2] . '-' . $deadline_from[1] . '-' . $deadline_from[0]; $deadline_to = explode('-', $this->deadline_to); $deadline_to_formatted = $deadline_to[2] . '-' . $deadline_to[1] . '-' . $deadline_to[0]; $query->andFilterWhere(['>=', 'DEADLINE', new \yii\db\Expression("to_date('" . $deadline_from_formatted . "','{$this->dateFormat}')")])->andFilterWhere(['<=', 'DEADLINE', new \yii\db\Expression("to_date('" . $deadline_to_formatted . "','{$this->dateFormat}')")]); } else { if ($this->deadline_from != '' && $this->deadline_to == '') { $deadline_from = explode('-', $this->deadline_from); $deadline_from_formatted = $deadline_from[2] . '-' . $deadline_from[1] . '-' . $deadline_from[0]; $query->andFilterWhere(['>=', 'DEADLINE', new \yii\db\Expression("to_date('" . $deadline_from_formatted . "','{$this->dateFormat}')")]); } else { if ($this->deadline_from == '' && $this->deadline_to != '') { $deadline_to = explode('-', $this->deadline_to); $deadline_to_formatted = $deadline_to[2] . '-' . $deadline_to[1] . '-' . $deadline_to[0]; $query->andFilterWhere(['<=', 'DEADLINE', new \yii\db\Expression("to_date('" . $deadline_to_formatted . "','{$this->dateFormat}')")]); } } } if ($this->task_type_date_3_from != '' && $this->task_type_date_3_to != '') { $query->joinWith('datetype3'); $task_type_date_3_from = explode('-', $this->task_type_date_3_from); $task_type_date_3_from_formatted = $task_type_date_3_from[2] . '-' . $task_type_date_3_from[1] . '-' . $task_type_date_3_from[0]; $task_type_date_3_to = explode('-', $this->task_type_date_3_to); $task_type_date_3_to_formatted = $task_type_date_3_to[2] . '-' . $task_type_date_3_to[1] . '-' . $task_type_date_3_to[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_3_from_formatted . "','{$this->dateFormat}')")])->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_3_to_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_3_from != '' && $this->task_type_date_3_to == '') { $query->joinWith('datetype3'); $task_type_date_3_from = explode('-', $this->task_type_date_3_from); $task_type_date_3_from_formatted = $task_type_date_3_from[2] . '-' . $task_type_date_3_from[1] . '-' . $task_type_date_3_from[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_3_from_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_3_from == '' && $this->task_type_date_3_to != '') { $query->joinWith('datetype3'); $task_type_date_3_to = explode('-', $this->task_type_date_3_to); $task_type_date_3_to_formatted = $task_type_date_3_to[2] . '-' . $task_type_date_3_to[1] . '-' . $task_type_date_3_to[0]; $query->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_3_to_formatted . "','{$this->dateFormat}')")]); } } } if ($this->task_type_date_1_from != '' && $this->task_type_date_1_to != '') { $query->joinWith('datetype1'); $task_type_date_1_from = explode('-', $this->task_type_date_1_from); $task_type_date_1_from_formatted = $task_type_date_1_from[2] . '-' . $task_type_date_1_from[1] . '-' . $task_type_date_1_from[0]; $task_type_date_1_to = explode('-', $this->task_type_date_1_to); $task_type_date_1_to_formatted = $task_type_date_1_to[2] . '-' . $task_type_date_1_to[1] . '-' . $task_type_date_1_to[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_1_from_formatted . "','{$this->dateFormat}')")])->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_1_to_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_1_from != '' && $this->task_type_date_1_to == '') { $query->joinWith('datetype1'); $task_type_date_1_from = explode('-', $this->task_type_date_1_from); $task_type_date_1_from_formatted = $task_type_date_1_from[2] . '-' . $task_type_date_1_from[1] . '-' . $task_type_date_1_from[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_1_from_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_1_from == '' && $this->task_type_date_1_to != '') { $query->joinWith('datetype1'); $task_type_date_1_to = explode('-', $this->task_type_date_1_to); $task_type_date_1_to_formatted = $task_type_date_1_to[2] . '-' . $task_type_date_1_to[1] . '-' . $task_type_date_1_to[0]; $query->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_1_to_formatted . "','{$this->dateFormat}')")]); } } } if ($this->task_type_date_4_from != '' && $this->task_type_date_4_to != '') { $query->joinWith('datetype4'); $task_type_date_4_from = explode('-', $this->task_type_date_4_from); $task_type_date_4_from_formatted = $task_type_date_4_from[2] . '-' . $task_type_date_4_from[1] . '-' . $task_type_date_4_from[0]; $task_type_date_4_to = explode('-', $this->task_type_date_4_to); $task_type_date_4_to_formatted = $task_type_date_4_to[2] . '-' . $task_type_date_4_to[1] . '-' . $task_type_date_4_to[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_4_from_formatted . "','{$this->dateFormat}')")])->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_4_to_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_4_from != '' && $this->task_type_date_4_to == '') { $query->joinWith('datetype4'); $task_type_date_4_from = explode('-', $this->task_type_date_4_from); $task_type_date_4_from_formatted = $task_type_date_4_from[2] . '-' . $task_type_date_4_from[1] . '-' . $task_type_date_4_from[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_4_from_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_4_from == '' && $this->task_type_date_4_to != '') { $query->joinWith('datetype4'); $task_type_date_4_to = explode('-', $this->task_type_date_4_to); $task_type_date_4_to_formatted = $task_type_date_4_to[2] . '-' . $task_type_date_4_to[1] . '-' . $task_type_date_4_to[0]; $query->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_4_to_formatted . "','{$this->dateFormat}')")]); } } } if ($this->task_type_date_2_from != '' && $this->task_type_date_2_to != '') { $query->joinWith('datetype2'); $task_type_date_2_from = explode('-', $this->task_type_date_2_from); $task_type_date_2_from_formatted = $task_type_date_2_from[2] . '-' . $task_type_date_2_from[1] . '-' . $task_type_date_2_from[0]; $task_type_date_2_to = explode('-', $this->task_type_date_2_to); $task_type_date_2_to_formatted = $task_type_date_2_to[2] . '-' . $task_type_date_2_to[1] . '-' . $task_type_date_2_to[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_2_from_formatted . "','{$this->dateFormat}')")])->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_2_to_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_2_from != '' && $this->task_type_date_2_to == '') { $query->joinWith('datetype2'); $task_type_date_2_from = explode('-', $this->task_type_date_2_from); $task_type_date_2_from_formatted = $task_type_date_2_from[2] . '-' . $task_type_date_2_from[1] . '-' . $task_type_date_2_from[0]; $query->andFilterWhere(['>=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_2_from_formatted . "','{$this->dateFormat}')")]); } else { if ($this->task_type_date_2_from == '' && $this->task_type_date_2_to != '') { $query->joinWith('datetype2'); $task_type_date_2_to = explode('-', $this->task_type_date_2_to); $task_type_date_2_to_formatted = $task_type_date_2_to[2] . '-' . $task_type_date_2_to[1] . '-' . $task_type_date_2_to[0]; $query->andFilterWhere(['<=', 'TASK_DATES.TASK_TYPE_DATE', new \yii\db\Expression("to_date('" . $task_type_date_2_to_formatted . "','{$this->dateFormat}')")]); } } } $query->andFilterWhere(['like', 'SOURCENUM', $this->SOURCENUM]); $query->andFilterWhere(['like', 'TASK_TEXT', $this->TASK_TEXT]); $query->andFilterWhere(['or like', 'PEOORDERNUM', $this->PEOORDERNUM]); $query->andFilterWhere(['or like', 'ORDERNUM', $this->ORDERNUM]); $query->andFilterWhere(['like', 'TASK_NUMBER', $this->TASK_NUMBER]); $query->andFilterWhere(['like', 'LOWER(DESIGNATION)', mb_strtolower($this->DESIGNATION, 'UTF-8')]); return $dataProvider; }
public function pay() { $this->dates(); $date = $this->to_date; /* $tnum = Transaction(0, TRAN_PRETAX, IRS, $ref1, $ref2, $date, $details, $this->tax_sum); $tnum = Transaction($tnum, TRAN_PRETAX, PRETAX, $ref1, $ref2, $date, $details, $this->tax_sum * -1.0); $tnum = Transaction($tnum, TRAN_PRETAX, IRS, $ref1, $ref2, $date, $details, $this->custtax_total); $tnum = Transaction($tnum, TRAN_PRETAX, CUSTTAX, $ref1, $ref2, $date, $details, $this->custtax_total * -1.0); */ $irs = \app\helpers\Linet3Helper::getSetting('company.acc.irs'); $pretax = \app\helpers\Linet3Helper::getSetting('company.acc.pretax'); $custtax = \app\helpers\Linet3Helper::getSetting('company.acc.custtax'); $cur = \app\helpers\Linet3Helper::getSetting('company.cur'); $owner = Yii::$app->user->id; $line = 1; $accout = new Transactions(); $accout->account_id = $irs; //IRS $accout->type = 14; //$accout->refnum1 = $this->from_date; //$accout->refnum2 = $this->to_date; $accout->valuedate = $date; $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year; $accout->currency_id = $cur; $accout->owner_id = $owner; $accout->linenum = $line; $accout->sum = $this->tax_sum; $line++; $num = $accout->save(); $accout = new Transactions(); $accout->account_id = $pretax; //PRETAX $accout->type = 14; $accout->num = $num; //$accout->refnum1 = $this->from_date; //$accout->refnum2 = $this->to_date; $accout->valuedate = $date; $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year; $accout->currency_id = $cur; $accout->owner_id = $owner; $accout->linenum = $line; $accout->sum = $this->tax_sum * -1; $line++; $accout->save(); $accout = new Transactions(); $accout->account_id = $irs; //IRS $accout->type = 14; $accout->num = $num; //$accout->refnum1 = $this->from_date; //$accout->refnum2 = $this->to_date; $accout->valuedate = $date; $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year; $accout->currency_id = $cur; $accout->owner_id = $owner; $accout->linenum = $line; $accout->sum = $this->custtax_total; $line++; $accout->save(); $accout = new Transactions(); $accout->account_id = $custtax; //CUSTTAX $accout->type = 14; $accout->num = $num; //$accout->refnum1 = $this->from_date; //$accout->refnum2 = $this->to_date; $accout->valuedate = $date; $accout->details = Yii::t('app', 'tax') . " " . $this->from_month . "-" . $this->to_month . "/" . $this->year; $accout->currency_id = $cur; $accout->owner_id = $owner; $accout->linenum = $line; $accout->sum = $this->custtax_total * -1.0; $line++; $accout->save(); }
public function actionChangestatus() { if (Yii::$app->request->isAjax) { $status_id = $_POST['status']; $selected_issues = $_POST['selected_issues']; $user_cant_permissions_on = []; $user_have_permission_and_status_changed_on = []; foreach (json_decode($selected_issues) as $issue) { $pers_tasks_this = \app\models\PersTasks::find()->where(['TASK_ID' => $issue, 'TN' => \Yii::$app->user->id, 'DEL_TRACT_ID' => 0])->one(); //проверяем имеет ли доступ пользователь к заданию и входит ли вообще в него if ($pers_tasks_this) { $task_state = \app\models\TaskStates::find()->where(['PERS_TASKS_ID' => $pers_tasks_this->ID, 'IS_CURRENT' => 1])->one(); if ($task_state) { // проверяем есть ли статус $last_state = $task_state->STATE_ID; } else { // иначе устанавливаем значние даты null $last_state = null; } if ($last_state != $status_id) { $transactions = \app\models\Transactions::find()->where(['TN' => \Yii::$app->user->id])->orderBy('ID DESC')->one(); $new_state = new \app\models\TaskStates(); $new_state->TASK_ID = $issue; $new_state->STATE_ID = $status_id; $new_state->TRACT_ID = $transactions->ID; $new_state->IS_CURRENT = 1; $pers_tasks_this = \app\models\PersTasks::find()->where(['TASK_ID' => $issue, 'TN' => \Yii::$app->user->id, 'DEL_TRACT_ID' => 0])->one(); $new_state->PERS_TASKS_ID = $pers_tasks_this->ID; $new_state->save(); $user_have_permission_and_status_changed_on[] = $issue; //обновление поля IS_CURRENT для предыдущего состояния if ($last_state != null) { $task_state->IS_CURRENT = 0; $task_state->save(); } } } else { $user_cant_permissions_on[] = $issue; } } $string_status_changed = ''; if (!empty($user_have_permission_and_status_changed_on)) { foreach ($user_have_permission_and_status_changed_on as $issue) { $task = \app\models\Tasks::findOne($issue); $string_status_changed .= 'Задание №' . $task->TASK_NUMBER . ','; } } $string_status_not_changed = ''; if (!empty($user_cant_permissions_on)) { foreach ($user_cant_permissions_on as $issue) { $task = \app\models\Tasks::findOne($issue); $string_status_not_changed .= 'Задание №' . $task->TASK_NUMBER . ','; } } Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return ['string_status_changed' => $string_status_changed, 'string_status_not_changed' => $string_status_not_changed]; } }
public function getTransactions() { return $this->hasMany(Transactions::className(), array('account_id' => 'id')); }
public function getTransactions() { return $this->hasMany(Transactions::className(), array('extCorrelation' => 'id')); }
public function getTransactions() { return $this->hasMany(\app\models\Transactions::className(), ['TN' => 'ID']); }
public function search($params) { $query = Transactions::find(); $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query, "sort" => ['defaultOrder' => ['num' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { var_dump($this->errors); // return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'num' => $this->num, 'account_id' => $this->account_id, 'type' => $this->type, 'refnum1' => $this->refnum1]); $query->andFilterWhere(['like', 'details', $this->details]); /* $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]); */ /*if (!empty($this->from_date) && empty($this->to_date)) { $query->andFilterWhere(['>=', 'valuedate', $this->from_date]); } elseif (!empty($this->to_date) && empty($this->from_date)) { $query->andFilterWhere(['>=', 'valuedate', $this->to_date]); } elseif (!empty($this->to_date) && !empty($this->from_date)) { $query->andFilterWhere(['between', 'valuedate', $this->from_date, $this->to_date]); }*/ if (!is_null($this->valuedate)) { $tmp = explode(" to ", $this->valuedate); if (isset($tmp[0]) && isset($tmp[1])) { $query->andFilterWhere(['between', 'valuedate', $tmp[0], $tmp[1]]); } } if (!is_null($this->reg_date)) { $tmp = explode(" to ", $this->reg_date); if (isset($tmp[0]) && isset($tmp[1])) { $query->andFilterWhere(['between', 'reg_date', $tmp[0], $tmp[1]]); } } return $dataProvider; }
public function removetransaction($TransactionID, $ID, $url, $currency) { $Transaction = Transactions::find('first', array('conditions' => array('_id' => new MongoID($ID)))); if (String::hash($Transaction['_id']) == $TransactionID) { $Remove = Transactions::remove(array('_id' => new MongoID($ID))); } return $this->redirect('/Users/' . $url . '/' . $currency); }
public function Transactionhistory($key = null) { if (!$this->request->data) { return $this->render(array('json' => array('success' => 0, 'now' => time(), 'error' => "Not submitted through POST."))); } if ($key == null) { return $this->render(array('json' => array('success' => 0, 'now' => time(), 'error' => "Key not specified. Please get your key from your settings page under security."))); } else { $details = Details::find('first', array('conditions' => array('key' => $key))); if (count($details) == 0) { return $this->render(array('json' => array('success' => 0, 'now' => time(), 'error' => "Incorrect Key! Please get your key from your settings page under security."))); } else { if (!$this->requestAPI("transactionhistory", $details['username'])) { return $this->render(array('json' => array('success' => 0, 'now' => time(), 'error' => "Too many requests from your IP. Try after some time."))); } $count = $this->request->data['count']; if ($count == "") { $count = 1000; } $currency = $this->request->data['currency']; if ($currency == "") { $currency = 'All'; } $order = $this->request->data['order']; if ($order == "") { $order = 'DESC'; } $start = $this->request->data['start']; if ($start == "") { $start = '2013-10-01'; } $end = $this->request->data['end']; if ($end == "") { $currency = gmdate('Y-m-d', time()); } $type = $this->request->data['type']; if ($type == "") { $type = "All"; } $StartDate = new MongoDate(strtotime($start)); $EndDate = new MongoDate(strtotime($end)); if ($type == "Deposit") { $typeofTran = array(true); } if ($type == "Withdrawal") { $typeofTran = array(false); } if ($type == "All") { $typeofTran = array('$in' => array(true, false)); } elseif ($type == "Deposit") { $typeofTran = array('$in' => array(true)); } elseif ($type == "Withdrawal") { $typeofTran = array('$in' => array(false)); } switch ($currency) { case "All": $currencyType = array('$in' => array('BTC', 'USD', 'GBP', 'EUR')); break; case "BTC": $currencyType = array('$in' => array('BTC')); break; case "Other": $currencyType = array('$in' => array('USD', 'GBP', 'EUR')); break; case "USD": $currencyType = array('$in' => array('USD')); break; case "GBP": $currencyType = array('$in' => array('GBP')); break; case "EUR": $currencyType = array('$in' => array('EUR')); break; } $conditions = array('username' => $details['username'], 'DateTime' => array('$gte' => $StartDate, '$lte' => $EndDate), 'Added' => $typeofTran, 'Currency' => $currencyType); $transactions = Transactions::find('all', array('conditions' => $conditions, 'limit' => $count, 'order' => array('Datetime' => $order))); $i = 0; foreach ($transactions as $tx) { $result[$i]['DateTime'] = $tx['DateTime']->sec; $result[$i]['Amount'] = $tx['Amount']; $result[$i]['Currency'] = $tx['Currency']; if ($tx['Added'] == true) { $result[$i]['Type'] = "Deposit"; } else { $result[$i]['Type'] = "Withdrawal"; } if ($tx['Currency'] != "BTC") { $result[$i]['Approved'] = $tx['Approved']; $result[$i]['Reference'] = $tx['Reference']; if ($tx['Approved'] == "Rejected") { $result[$i]['Reason'] = $tx['Reason']; } if ($tx['Approved'] == "Yes") { $result[$i]['AmountApproved'] = $tx['AmountApproved']; } } else { $result[$i]['TransactionHash'] = $tx['TransactionHash']; $result[$i]['Address'] = $tx['address']; if ($tx['Added'] == false) { $result[$i]['txFee'] = $tx['txFee']; $result[$i]['Transfer'] = $tx['Transfer']; } } $i++; } return $this->render(array('json' => array('success' => 1, 'now' => time(), 'result' => $result))); } } }
/** * Finds the Transactions model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Transactions the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Transactions::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getTrans() { return $this->hasMany(Transactions::className(), ['trans_id' => 'trans_id'])->viaTable('transaction_detail', ['trans_service_id' => 'service_id']); }
public function import() { //add warehouse $array = $this->read(); //companies $company = $this->parseLine($array['companies'][0]); $prefix = $company[1]; //echo $prefix; $this->saveSetting('company.name', $company[0]); $this->saveSetting('company.vat.id', $company[3]); $this->saveSetting('company.address', $company[4]); $this->saveSetting('company.city', $company[5]); $this->saveSetting('company.zip', $company[6]); $this->saveSetting('company.phone', $company[7]); $this->saveSetting('company.fax', $company[8]); $this->saveSetting('company.website', $company[9]); $this->saveSetting('company.tax.rate', $company[10]); $this->saveSetting('company.tax.irs', $company[11]); //$this->saveSetting('account.100.srctax', $company[12]); $this->saveSetting('company.tax.vat', $company[13]); //exit; ///* if (isset($array['accounts'])) { $this->imprtAccounts($array['accounts'], $prefix); } if (isset($array['items'])) { $this->imprtItems($array['items'], $prefix); } if (isset($array['docs'])) { $this->imprtDocs($array['docs'], $prefix); } if (isset($array['cheques'])) { $this->imprtCheques($array['cheques'], $prefix); } if (isset($array['docdetails'])) { $this->imprtDocdetails($array['docdetails'], $prefix); } if (isset($array['transactions'])) { $this->imprtTransactions($array['transactions'], $prefix); } if (isset($array['bankbook'])) { $this->imprtBankbooks($array['bankbook'], $prefix); } if (isset($array['correlation'])) { $this->imprtCorrelations($array['correlation'], $prefix); } //*/ //vat rate $acc = Accounts::findOne(100); $acc->src_tax = $company[12]; $acc->save(); $acc = Accounts::findOne(101); $acc->src_tax = $company[12]; $acc->save(); //add warehouse //add genral item //get transaction num $this->saveSetting('company.transaction', Transactions::getMax() + 1); //get docnums $types = Doctype::find()->All(); foreach ($types as $type) { $type->last_docnum = Docs::getMax($type->id); $type->save(); } //contacthist //contacts?? //tranrep?? }
use yii\helpers\Html; use yii\grid\GridView; use app\models\TransactionDetail; use app\models\Transactions; /* @var $this yii\web\View */ /* @var $searchModel app\models\TransactionsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ echo $this->render('@app/views/layouts/_modules/_title', Yii::$app->controller->_pagetitle); ?> <div class="box box-primary"> <?php echo $this->render('@app/views/layouts/_modules/_menu-crud', ['title' => 'Daftar Transaksi', 'buttons' => Yii::$app->controller->_buttons]); ?> <div class="box-body"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'showFooter' => TRUE, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Aksi', 'template' => '{update} {delete}', 'headerOptions' => ['width' => '60', 'style' => 'text-align:center;'], 'contentOptions' => ['class' => 'table_class', 'style' => 'text-align:center;'], 'buttons' => ['update' => function ($url, $model) { return Html::a('<span class="fa fa-pencil"></span>', $url); }, 'link' => function ($url, $model, $key) { return Html::a('Action', $url); }]], 'trans_id', 'trans_date', ['attribute' => 'trans_employee', 'label' => Yii::t('app', 'Nama Karyawan'), 'value' => function ($data) { $name = ''; $name .= $data->transEmployee->employee_title . ' ' . $data->transEmployee->employee_name; $name .= !empty($data->transEmployee->employee_code) ? ' (' . $data->transEmployee->employee_code . ')' : ''; return $name; }], ['attribute' => 'trans_total', 'label' => Yii::t('app', 'Jumlah'), 'value' => function ($data) { return number_format($data->trans_total, 0, ",", "."); }, 'value' => 'trans_total', 'contentOptions' => ['class' => 'table_class', 'style' => 'text-align:right;'], 'footerOptions' => ['class' => 'table_class', 'style' => 'text-align:right;'], 'footer' => Transactions::pageTotal($dataProvider->models, 'trans_total'), 'format' => ['decimal', 2]]]]); ?> </div> </div>
public function actionBuyItems() { /* @var $product Products */ Yii::$app->response->format = 'json'; $return_data = ['status' => 'error', 'data' => []]; $basket = Yii::$app->request->post('data'); $items = []; if (isset($basket['items'])) { $items = $basket['items']; } $amount_paid = 0; if (isset($basket['amount_paid'])) { $amount_paid = $basket['amount_paid']; } $total_amount = 0; if (isset($basket['total_amount'])) { $total_amount = $basket['total_amount']; } if (!empty($items)) { $transaction = new Transactions(); $transaction->total_quantity = 0; $transaction->amount_paid = $amount_paid; $transaction->user_id = Yii::$app->user->id; $transaction->reason_id = Transactions::SELL; $transaction->total_amount = $total_amount; if ($transaction->save()) { $total_quantity = 0; foreach ($items as $item) { $transaction_item = new TransactionItems(); $transaction_item->product_id = $item['id']; $transaction_item->transaction_id = $transaction->id; $transaction_item->quantity = $item['quantity']; $total_quantity += intval($transaction_item->quantity); $transaction_item->buy_price = $item['buy_price']; $transaction_item->sell_price = $item['sell_price']; $transaction_item->name = $item['name']; if ($transaction_item->save()) { $product = Products::findOne($transaction_item->product_id); $product->quantity = $product->quantity - $transaction_item->quantity; $product->save(); } } $transaction->total_quantity = $total_quantity; $transaction->save(); Yii::$app->getSession()->setFlash('success', 'Transaction was successfully saved.'); $return_data = ['status' => 'success', 'data' => ['bill_num' => str_pad($transaction->id, 8, 0, STR_PAD_LEFT)]]; } else { $return_data = ['status' => 'error', 'data' => ['Error in Transaction']]; } } return $return_data; }
<?php use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use app\assets\AppAsset; use yii\web\View; use yii\helpers\Url; $transactions = \app\models\Transactions::find()->where(['TN' => \Yii::$app->user->id])->orderBy('ID DESC')->one(); /* @var $this \yii\web\View */ /* @var $content string */ AppAsset::register($this); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php echo Html::csrfMetaTags(); ?> <title><?php echo Html::encode($this->title);
public function greencointransaction() { if ($this->__init() == false) { $this->redirect('ex::dashboard'); } if ($this->request->data) { $StartDate = new MongoDate(strtotime($this->request->data['StartDate'])); $EndDate = new MongoDate(strtotime($this->request->data['EndDate'])); } else { $StartDate = new MongoDate(strtotime(gmdate('Y-m-d H:i:s', mktime(0, 0, 0, gmdate('m', time()), gmdate('d', time()), gmdate('Y', time())) - 60 * 60 * 24 * 30))); $EndDate = new MongoDate(strtotime(gmdate('Y-m-d H:i:s', mktime(0, 0, 0, gmdate('m', time()), gmdate('d', time()), gmdate('Y', time())) + 60 * 60 * 24 * 1))); } $transactions = Transactions::find('all', array('conditions' => array('Currency' => 'XGC', 'DateTime' => array('$gte' => $StartDate, '$lte' => $EndDate)), 'order' => array('DateTime' => -1))); $title = "Greencoin Transactions"; $keywords = "Greencoin Transactions"; $description = "Admin panel for Litecoin transactions"; return compact('transactions', 'StartDate', 'EndDate', 'title', 'keywords', 'description'); }