예제 #1
0
 public static function uploadFileByApplication($id_application, $sourcePath, $fileName, $id_document_type, $source = 0)
 {
     $FileName = $id_application . '_' . $fileName;
     $key = DictDocument::$documentPath[$id_document_type];
     if (Yii::$app->params['s3_upload']) {
         try {
             $s3 = Yii::$app->aws->createS3();
             $result = $s3->putObject(['SourceFile' => $sourcePath, 'Key' => $key . $FileName, 'ACL' => 'private', 'ServerSideEncryption' => 'AES256']);
         } catch (HttpException $e) {
             throw new BadRequestHttpException("RequestTimesout,please try again.");
         }
     }
     if (in_array($id_document_type, [1, 5, 6, 7])) {
         $appDocument = AppDocument::find()->andWhere(['id_application' => $id_application, 'id_document_type' => $id_document_type])->one();
     } else {
         $appDocument = AppDocument::find()->andWhere(['id_application' => $id_application, 'name' => $fileName, 'id_document_type' => $id_document_type])->one();
     }
     if (!$appDocument) {
         $appDocument = new AppDocument();
     }
     $appDocument->id_application = $id_application;
     $appDocument->name = $fileName;
     $appDocument->path = isset($result['ObjectURL']) ? $result['ObjectURL'] : 'outpdf/';
     $appDocument->id_document_type = $id_document_type;
     $appDocument->source = $source;
     $appDocument->save();
     return ['url' => isset($result['ObjectURL']) ? $result['ObjectURL'] : 'outpdf/', 'file_name' => str_replace(' ', '', $fileName)];
 }
예제 #2
0
    echo $w9['name'];
    ?>
</a></span>
						<a href="<?php 
    echo Url::to(['application/down-load', 'id_application' => $w9['id_application'], 'file_name' => $w9['name'], 'type' => $w9['id_document_type']]);
    ?>
" target="_blank"><span class="ico-01 pl10 ico-download">&#xe60c;</span></a>
					</dd>
				<?php 
}
?>
				</dl>

				<dl>
				<?php 
$control_agreement = AppDocument::find()->andWhere(['id_application' => $id_application, 'id_document_type' => DictDocument::TYPE_CONTROL_AGREEMENT])->orderBy(['id_app_document' => SORT_DESC])->all();
?>
					<dt style="margin-bottom:20px;display: <?php 
echo empty($control_agreement) ? 'none' : 'block';
?>
"><?php 
echo DictDocument::$documentType[DictDocument::TYPE_CONTROL_AGREEMENT];
?>
<button  type="button" class="btn btn-default fr ico-download" style="display:<?php 
echo Yii::$app->user->getIdentity()->id_user_role == Dict::USER_ROLE_BETTERDEBT ? 'inline' : 'none';
?>
" data-toggle="modal" data-target="#myModal1" data-whatever="8">Add  Document</button></dt>
				<?php 
if (!empty($control_agreement)) {
    foreach ($control_agreement as $val) {
        ?>
 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 actionCheck($id_app_task)
 {
     $model = AppTask::findOne($id_app_task);
     //find by document type
     $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();
     return $this->renderAjax('check', ['model' => $model, 'loanAgreements' => $loanAgreements, 'g3' => $g3, 'w9' => $w9]);
 }