/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CollateralAccount::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_collateral_account_pk' => $this->id_collateral_account_pk, 'data_date' => $this->data_date, 'line_type' => $this->line_type, 'id_line' => $this->id_line, 'id_collateral_account' => $this->id_collateral_account, 'is_matched' => $this->is_matched, 'is_ssn_matched' => $this->is_ssn_matched, 'holdings' => $this->holdings, 'included_holdings' => $this->included_holdings, 'included_exceptional_holdings' => $this->included_exceptional_holdings, 'exceptional_holdings' => $this->exceptional_holdings, 'original_value' => $this->original_value, 'caculated_value' => $this->caculated_value, 'delete' => $this->delete, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'master_account_id', $this->master_account_id])->andFilterWhere(['like', 'account_number', $this->account_number])->andFilterWhere(['like', 'account_name', $this->account_name])->andFilterWhere(['like', 'ssn', $this->ssn]); return $dataProvider; }
public function actionCollateralAccounts() { // 读取参数 $line_type = (int) Yii::$app->request->get('line_type'); $id_line = (int) Yii::$app->request->get('id_line'); $account_number = trim(Yii::$app->request->get('account_number')); $data_date = Yii::$app->request->get('data_date'); $query = CollateralAccount::find()->andWhere(['line_type' => $line_type, 'id_line' => $id_line, 'data_date' => $data_date])->orderBy(['data_date' => SORT_DESC]); if ($account_number != '') { $query = CollateralAccount::find()->andWhere(['line_type' => $line_type, 'id_line' => $id_line, 'account_number' => $account_number])->orderBy(['id_collateral_account_pk' => SORT_DESC]); } $dataProvider = new ActiveDataProvider(['query' => $query]); return $this->render('collateral_accounts', ['line_type' => $line_type, 'id_line' => $id_line, 'account_number' => $account_number, 'dataProvider' => $dataProvider]); }
public function actionIndex($id_app_task) { $model = AppTask::findOne($id_app_task); $loanModel = Loan::find()->where(['id_application' => $model->id_application])->one(); // 如果 loan 不存在,则新建 if (is_null($loanModel)) { $loanModel = new Loan(); $loanModel->loan_number = ''; $loanModel->id_application = $model->id_application; $loanModel->status = 0; $loanModel->loc = $model->application->loc; $loanModel->balance = 0; $loanModel->advance_rate = 50; $loanModel->maintainance_rate = 70; $loanModel->collateral_value = $model->application->collateral_value; $loanModel->save(false); } // 读取所以检查项 $checkPointsData = AppTaskCheckpoint::find()->where(['id_app_task' => $id_app_task])->all(); $checkPoints = []; $check_points_ctrl = true; foreach ($checkPointsData as $val) { $checkPoints[$val['id_app_task_checkpoint_type']] = $val; if (!$val->status) { $check_points_ctrl = false; } } // 判断是否可以 approve $loanModel->setScenario('review'); $loanCheck = clone $loanModel; $loan_ctrl = $loanCheck->validate(); if (Yii::$app->request->post()) { // 如果选择 wetsigned $post = Yii::$app->request->post(); if ($post['type'] == 'wetsigned') { //关闭sign agreements $task_e_sign_box = AppTask::findOne(['id_application' => $model->id_application, 'id_app_task_type' => DictTask::TYPE_SIGN_AGREEMENTS_BOX]); AppTask::close($task_e_sign_box->id_app_task); } // 确认 Application Review and Check 结束 $applicationModel = $model->application; //g3 AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_G3); //control_agreement AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_CONTROL_AGREEMENT); //line_agreements AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_LINE_AGREEMENT); //w9 AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_W9); $loanModel->id_application = $applicationModel->id_application; $id_application = $loanModel->id_application; //active log.loan officer approved the application. Active::operationLog($id_application, [Yii::$app->user->getIdentity()->first_name, Yii::$app->user->getIdentity()->last_name], DictActive::APPROVED_APPLICATION, Yii::$app->user->getIdentity()->id); AppTask::taskFinish($id_app_task); //find Control Agreement--type--schwab(control agreement->id_application->id_group->Coustidian) $application = Application::find()->andWhere(['id_application' => $id_application])->one(); $group = Group::find()->andWhere(['id_group' => $application->id_group])->one(); //judge for id_custodian //send application approval email to client and cc to advisor(email($email_type,[$task_type,$id_app_task,$loan,$group])) $res = SendEmail::email(DictEmail::EMAIL_LETTER_ABOUT_LINE, [DictEmail::LETTER_APPLICATION_APPROVAL, $id_app_task, $loanModel, $group]); if ($res) { //判断是否有两个client参与 $user = SendEmail::findUserByApplication($id_application); if (is_null($user['co_applicant'])) { Active::operationLog($id_application, [$user['applicant']->first_name, $user['applicant']->last_name, '', $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_APPROVAL_LETTER, 0); } else { Active::operationLog($id_application, [$user['applicant']->first_name, $user['applicant']->last_name, ',' . $user['co_applicant']->first_name . ' ' . $user['co_applicant']->last_name, $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_APPROVAL_LETTER, 0); } } //active.system geneerated all the line agreements Active::operationLog($id_application, [], DictActive::SYSTEM_GENERATED_LINE_AGREEMENTS, 0); //find user $user = SendEmail::findUserByApplication($id_application); //create a task line-agreement to loan officer Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_LINE_AGREEMENTS], $user['supernova']->first_name, $user['supernova']->last_name], DictActive::SYSTEM_CREATE_TASK_TO_USER, 0); //system created task line-agreements //System send email new task "Line Agrrements Notification" to betterdebt($email_type,[$task_type,$id_application,$id_app_task]) SendEmail::email(DictEmail::EMAIL_TASK_NOTIFICATION, [DictTask::TYPE_LINE_AGREEMENTS, $id_application, $id_app_task + 2]); if ($post['type'] != 'wetsigned') { // docusign $result_docusign = SendDocuSign::appReview($id_application); } //crate a task sign-line-agreement to client Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_SIGN_AGREEMENTS], $user['applicant']->first_name, $user['applicant']->last_name], DictActive::SYSTEM_CREATE_TASK_TO_USER, 0); //system created task line-agreements Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_LINE_AGREEMENTS], $user['applicant']->first_name, $user['applicant']->last_name], DictActive::SYSTEM_SEND_DOCUSIGN_EMAIL, 0); //system send sign agreement docusign email to client return $this->redirect(['/application/view', 'id' => $model->id_application]); } $data = CollateralAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application])->orderBy(['data_date' => SORT_DESC])->one(); if ($data) { $account = CollateralAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application, 'data_date' => $data['data_date']])->orderBy(['data_date' => SORT_DESC])->all(); $line_account = LineAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application, 'data_date' => $data['data_date']])->orderBy(['data_date' => SORT_DESC])->one(); } else { $account = ''; $line_account = ''; } //credit score $applicant = AppApplicant::find()->andWhere(['id_application' => $model->id_application])->all(); return $this->render('index', ['model' => $model, 'loanModel' => $loanModel, 'checkPoints' => $checkPoints, 'approve_ctrl' => $check_points_ctrl && $loan_ctrl, 'collateral_account' => $account, 'line_account' => $line_account, 'date' => empty($data) ? '' : $data['data_date'], 'applicant' => empty($applicant) ? '' : $applicant]); }
public function actionIndex($id_app_task) { $model = AppTask::findOne($id_app_task); // loan $loan = Loan::find()->where(['id_application' => $model->id_application])->one(); // application $application = Application::findOne($model->id_application); // applicants $app_applicants = $application->appApplicants; $applicants = []; foreach ($app_applicants as $val) { $applicants[] = $val->first_name; } // advisors $advisors = []; foreach ($model->application->advisors as $advisor) { if (isset($advisor->user)) { $advisors[] = $advisor->user->first_name; } } // 读取所以检查项 $checkPointsData = AppTaskCheckpoint::find()->where(['id_app_task' => $id_app_task])->all(); $checkPoints = []; $check_ctrl = true; foreach ($checkPointsData as $val) { $checkPoints[$val['id_app_task_checkpoint_type']] = $val; } if ($application->have_existing_loan) { $check_ctrl = $checkPoints[4]->status && $checkPoints[5]->status ? true : false; } else { $check_ctrl = $checkPoints[4]->status ? true : false; } if (Yii::$app->request->post()) { $loanModel = Loan::find()->andWhere(['id_application' => $model->id_application])->one(); $loanModel->status = 1; $loanModel->save(); if (AppTask::taskFinish($id_app_task)) { //active log.loan officer finished the task line set-up Active::operationLog($model->id_application, [Yii::$app->user->getIdentity()->first_name, Yii::$app->user->getIdentity()->last_name, 'finished', DictTask::$taskType[DictTask::TYPE_LINE_SETUP]], DictActive::USER_FINISH_TASK, Yii::$app->user->getIdentity()->id); } // 拷贝 form/financial info/LOC Disbursement $app_form = AppForm::find()->andWhere(['id_application' => $model->id_application])->one(); $LoanBankAcount = new LoanBankAcount(); $LoanBankAcount->account_type = 1; $LoanBankAcount->id_loan = $loanModel->id_loan; $LoanBankAcount->bank_name = $app_form->bank_name; $LoanBankAcount->routing_number = $app_form->routing_number; $LoanBankAcount->account_name = $app_form->account_name; $LoanBankAcount->account_number = $app_form->account_number; $LoanBankAcount->save(); // 拷贝 collateral_data 数据 LineAccount::copyData($model->id_application, $loanModel->id_loan); CollateralAccount::copyData($model->id_application, $loanModel->id_loan); //send loan approval email to client and cc to advisor(email($email_type,[$task_type,$id_app_task,$loan])) $res = SendEmail::email(DictEmail::EMAIL_LETTER_ABOUT_LINE, [DictEmail::LETTER_TASK_LOAN_APPROVAL, $id_app_task, $loan]); if ($res) { //active log.system sent an email 'Your Line is Live' to client and advisor //判断是否有两个client参与 $user = SendEmail::findUserByApplication($model->id_application); if (is_null($user['co_applicant'])) { Active::operationLog($model->id_application, [$user['applicant']->first_name, $user['applicant']->last_name, '', $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_LINE_ALIVE_LETTER, 0); } else { Active::operationLog($model->id_application, [$user['applicant']->first_name, $user['applicant']->last_name, ',' . $user['co_applicant']->first_name . ' ' . $user['co_applicant']->last_name, $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_LINE_ALIVE_LETTER, 0); } } //active log.system closed the application Active::operationLog($model->id_application, [], DictActive::SYSTEM_CLOSED_THE_APPLICATION, 0); // collateral_data 拷贝 Line $application = Application::findOne($model->id_application); $application->id_application_status = DictApplication::STATUS_CLOSED; $application->save(false); return $this->redirect(['/application/view', 'id' => $model->id_application]); } return $this->render('index', ['model' => $model, 'application' => $application, 'loan' => $loan, 'applicants' => $applicants, 'advisors' => $advisors, 'checkPoints' => $checkPoints, 'check_ctrl' => $check_ctrl]); }
public function getCollateralAccount() { return $this->hasOne(CollateralAccount::className(), ['id_collateral_account' => 'id_collateral_account']); }