/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = AppFormCollateralAccount::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id_app_form_collateral_account' => $this->id_app_form_collateral_account, 'id_application' => $this->id_application, 'id_collateral_account_type' => $this->id_collateral_account_type, 'has_regular_distribution' => $this->has_regular_distribution, 'regular_distribution_amount' => $this->regular_distribution_amount, 'is_trust_account' => $this->is_trust_account, 'is_revocable' => $this->is_revocable, 'tax_id_type' => $this->tax_id_type, 'address_state_where_organized' => $this->address_state_where_organized, 'delete' => $this->delete, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'account_name_title', $this->account_name_title])->andFilterWhere(['like', 'registration', $this->registration])->andFilterWhere(['like', 'custodian', $this->custodian])->andFilterWhere(['like', 'account_number', $this->account_number])->andFilterWhere(['like', 'payee', $this->payee])->andFilterWhere(['like', 'trust_name', $this->trust_name])->andFilterWhere(['like', 'names_of_trustees', $this->names_of_trustees])->andFilterWhere(['like', 'tax_id', $this->tax_id])->andFilterWhere(['like', 'address_street', $this->address_street])->andFilterWhere(['like', 'address_city', $this->address_city])->andFilterWhere(['like', 'trustee_phone_number', $this->trustee_phone_number]); return $dataProvider; }
public function afterSave($insert, $changeAttributes) { if ($insert) { $applicationModel = $this->application; $primaryAppApplicant = $applicationModel->primaryAppApplicant; $coAppApplicant = $applicationModel->coAppApplicant; $loanBorrowerModel = new LoanBorrower(); $loanBorrowerModel->id_loan = $this->id_loan; $loanBorrowerModel->id_user = $primaryAppApplicant->id_user; $loanBorrowerModel->type = 1; $loanBorrowerModel->save(); if ($applicationModel->coAppApplicant) { $loanBorrowerModel = new LoanBorrower(); $loanBorrowerModel->id_loan = $this->id_loan; $loanBorrowerModel->id_user = $coAppApplicant->id_user; $loanBorrowerModel->type = 0; $loanBorrowerModel->save(); } $loanPaymentPreferenceModel = new LoanPaymentPreference(); $loanPaymentPreferenceModel->id_loan = $this->id_loan; $loanPaymentPreferenceModel->type = 2; $loanPaymentPreferenceModel->ach_max_debtied_amount = 0; $loanPaymentPreferenceModel->ach_id_loan_bank_acount = 0; $loanPaymentPreferenceModel->save(); $loanCollateralAccountModel = new LoanCollateralAccount(); $loanCollateralAccountModel->id_loan = $this->id_loan; $loanCollateralAccountModel->id_institution = Advisor::findOne(['id_user' => $applicationModel->primaryAdvisor->id_user])->id_institution; $loanCollateralAccountModel->id_group = $applicationModel->id_group; $appFormCollateralAccountModels = AppFormCollateralAccount::find()->andWhere(['id_application' => $this->id_application])->all(); foreach ($appFormCollateralAccountModels as $appFormCollateralAccountModel) { $newLoanCollateralAccountModel = clone $loanCollateralAccountModel; $newLoanCollateralAccountModel->load([$newLoanCollateralAccountModel->formName() => $appFormCollateralAccountModel->getAttributes()]); $newLoanCollateralAccountModel->save(); } } }
public function checkAppForm() { $form = $this->appForm; $appModel = $this->primaryAppApplicant; $coAppModel = $this->coAppApplicant; $errorCount = 0; $totalCount = 1; $errorList = []; $tmpModel = new AppForm(['scenario' => 'complate-rate-check', 'id_application' => $this->id_application]); $tmpModel->validate(); $totalCount += count($tmpModel->getErrors()); $tmpModel = new AppApplicant(['scenario' => 'complate-rate-check']); $tmpModel->validate(); $totalCount += count($tmpModel->getErrors()); if ($coAppModel) { $tmpModel = new AppApplicant(['scenario' => 'co-complate-rate-check']); $tmpModel->validate(); $totalCount += count($tmpModel->getErrors()); } $form->setScenario('complate-rate-check'); $form->validate(); $errorCount += count($form->getErrors()); $errorList = array_merge($errorList, $form->getErrors()); $appModel->setScenario('complate-rate-check'); $appModel->validate(); $errorCount += count($appModel->getErrors()); $errorList = array_merge($errorList, $appModel->getErrors()); if ($coAppModel) { $coAppModel->setScenario('co-complate-rate-check'); $coAppModel->validate(); $errorCount += count($coAppModel->getErrors()); $errorList = array_merge($errorList, $coAppModel->getErrors()); } $collateralAccount = AppFormCollateralAccount::find()->andWhere(['id_application' => $this->id_application])->all(); if (!$collateralAccount) { $errorCount += 1; $errorList['collateral_account'] = ['need add one collateral account']; } return ['totalCount' => $totalCount, 'errorCount' => $errorCount, 'errorList' => $errorList]; }
} ?> </li> </ul> <?php } ?> </div> </div> <?php } ?> <?php $list = AppFormCollateralAccount::find()->andWhere(['id_application' => $model->id_application])->all(); if (!empty($list)) { foreach ($list as $value) { if ($value->is_trust_account == 1) { ?> <div class="account-form2 pb20"> <div class="layout frame"> <div class="layout-your-list por"> <h2><?php echo Yii::t('app', 'TRUSTEE CERTIFICATION'); ?> </h2> <p class="color-ba" style="padding-right: 135px"><?php echo Yii::t('app', 'Please upload your Trustee Certification.'); ?> </p>
public function actionCheck($id_app_task) { $model = AppTask::findOne($id_app_task); //find by document type $loanStatements = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_LOAN_STATEMENT, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->all(); //display loan statement? $application = Application::find()->andWhere(['id_application' => $model->id_application])->one(); if ($application->have_existing_loan == 1) { $loanStatements_display = 'list-item'; //method of display } $accountStatements = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_ACCOUNT_STATEMENT, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->all(); $photos = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_PHOTO_ID, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->all(); $certification = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_TRUSTEE_CERTIFICATION, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->all(); $account = AppFormCollateralAccount::find()->andWhere(['id_application' => $model->id_application])->one(); if ($account->is_trust_account == 1) { $certification_display = 'list-item'; //method of display } return $this->renderAjax('check', ['model' => $model, 'loanStatements' => $loanStatements, 'accountStatements' => $accountStatements, 'photos' => $photos, 'certification' => $certification, 'loanStatements_display' => isset($loanStatements_display) ? $loanStatements_display : 'none', 'certification_display' => isset($certification_display) ? $certification_display : 'none']); }
public function actionUploadWebSigned($id_app_task) { $model = AppTask::findOne($id_app_task); $UploadModel = new AppDocument(); if (Yii::$app->request->post()) { //upload signed file // $type = intval(Yii::$app->request->get('type')); $type = intval(Yii::$app->request->post()['AppDocument']['id_document_type']); //$result = Upload::getFileUpload($id_app_task, $model->id_application, $type); $result = Upload::uploadFileByApplication($model->id_application, $_FILES['AppDocument']['tmp_name']['path'], $_FILES['AppDocument']['name']['path'], $type, 1); if (!empty($result)) { //delete local file(in file outpdf) switch ($type) { case 5: $outpdf_file = Yii::getAlias('@frontend') . "/web/outpdf/" . $model->id_application . '_loan_agreements.pdf'; if (file_exists($outpdf_file)) { unlink($outpdf_file); } break; case 6: $outpdf_file = Yii::getAlias('@frontend') . "/web/outpdf/" . $model->id_application . '_g3.pdf'; if (file_exists($outpdf_file)) { unlink($outpdf_file); } break; case 7: $outpdf_file = Yii::getAlias('@frontend') . "/web/outpdf/" . $model->id_application . '_w9.pdf'; if (file_exists($outpdf_file)) { unlink($outpdf_file); } break; } //delete control file $collateral_account = AppFormCollateralAccount::find()->andWhere(['id_application' => $model->id_application])->one(); $outpdf_file = Yii::getAlias('@frontend') . "/web/outpdf/" . $model->id_application . '_control_agreement_schwab_' . $collateral_account['account_number'] . '.pdf'; if (file_exists($outpdf_file)) { unlink($outpdf_file); } //active log (supernova upload line-agreements file) foreach (DictDocument::$documentType as $key => $val) { switch ($type) { case $key: Active::operationLog($model->id_application, [Yii::$app->user->getIdentity()->first_name, Yii::$app->user->getIdentity()->last_name, DictDocument::$documentType[$type]], DictActive::USER_UPLOADED_WET_SIGNED_FILE, Yii::$app->user->getIdentity()->id); break; } } //render to index(exit submit) return $this->redirect(['task-agreements/index', 'id_app_task' => $id_app_task]); //delete the same file before upload a new one /* $app_document = AppDocument::find()->andWhere(['id_application' => $model->id_application,'name' => $result['file_name'],'id_document_type' => $type])->one(); if (!empty($app_document)) { $app_document->delete = Dict::DELETE_YES; $app_document->save(); } $UploadModel->id_application = $model->id_application; $UploadModel->path = $result['url']; $UploadModel->name = $result['file_name']; $UploadModel->id_document_type = $type; $UploadModel->source = 1; $UploadModel->save(); */ } //关闭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); } //find the latest one by document type and id_application $loanAgreements = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_LINE_AGREEMENT, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->one(); $g3 = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_G3, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->one(); $w9 = AppDocument::find()->andWhere(['id_document_type' => DictDocument::TYPE_W9, 'id_application' => $model->id_application])->orderBy(['id_app_document' => SORT_DESC])->one(); // check $finished_ctrl = true; if ($loanAgreements->source == 1 && $g3->source == 1 && $w9->source == 1) { $finished_ctrl = true; } else { $finished_ctrl = false; } return $this->render('index', ['model' => $model, 'UploadModel' => $UploadModel, 'loanAgreements' => $loanAgreements, 'g3' => $g3, 'w9' => $w9, 'finished_ctrl' => $finished_ctrl]); }