Bläddra i källkod

Merge branch 'features-o' of onunez/frontend-inversiones into development

Oscar José Nuñez Chávez 5 år sedan
förälder
incheckning
2520ce0ab3

+ 9 - 0
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.html

@@ -80,6 +80,15 @@
                       <h4>Fecha de vencimiento:</h4>
                       <div class="field">{{ fecha_vencimiento }}</div>
                     </div>
+
+                    <div class="col-sm-6">
+                      <h4>Descargar información del instrumento:</h4>
+                      <div class="field">
+                        <app-investment-print
+                          [investmentID]="investmentProposalID"
+                        ></app-investment-print>
+                      </div>
+                    </div>
                   </div>
                 </div>
 

+ 0 - 1
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.ts

@@ -105,7 +105,6 @@ export class PaymentRequirementComponent implements OnInit {
     this.investmentService
       .getAvailableUsers(this.investmentProposalID)
       .subscribe(res => {
-        console.log(res);
         this.userListPrevious = res["usuarios_previous"];
         this.generated_inputs_previous = "";
 

+ 6 - 7
src/app/components/investment-proposals/result/result.component.ts

@@ -120,7 +120,6 @@ export class ResultComponent implements OnInit {
     this.general = this.formDataService.getGeneralInfo();
     this.instrument = this.formDataService.getWork();
     this.complement = this.formDataService.getComplementInfo();
-    console.log(this.instrument);
     this.catalogService.getFinancialEntities().subscribe(res => {
       this.financials = res.find(
         e => e.id_entidad_financiera == this.general.casa
@@ -413,7 +412,7 @@ export class ResultComponent implements OnInit {
                 }
               },
               err => {
-                if(err.code==405){
+                if (err.code == 405) {
                   Swal.fire({
                     icon: "error",
                     title: "Operacion no permitida",
@@ -422,13 +421,13 @@ export class ResultComponent implements OnInit {
                     Swal.close();
                     window.location.href = "#/investment-proposals";
                   });
-                }else{
+                } else {
                   Swal.fire({
                     icon: "error",
                     title: "Error al guardar",
                     text: err.message
                   });
-                }      
+                }
               }
             );
         });
@@ -579,7 +578,7 @@ export class ResultComponent implements OnInit {
                 }
               },
               err => {
-                if(err.code==405){
+                if (err.code == 405) {
                   Swal.fire({
                     icon: "error",
                     title: "Operacion no permitida",
@@ -588,13 +587,13 @@ export class ResultComponent implements OnInit {
                     Swal.close();
                     window.location.href = "#/investment-proposals";
                   });
-                }else{
+                } else {
                   Swal.fire({
                     icon: "error",
                     title: "Error al guardar",
                     text: err.message
                   });
-                }              
+                }
               }
             );
         });

+ 105 - 6
src/app/components/plugins/investment-print/investment-print.ts

@@ -18,6 +18,16 @@ export class InvestmentPrint implements OnInit {
   rates: any;
   instrumentName: any;
 
+  allowedStateForPayment = ["PGAPR", "LIQUI", "FINAL"];
+  monto: any;
+  codigo_inversion: any;
+  codigo: any;
+  tipo_pago: any;
+  cuenta_bancaria: any;
+  cuenta_bancaria_destino: any;
+  emitir_nombre: any;
+  fecha_vencimiento: any;
+
   constructor(
     private scriptService: PdfmakeScriptService,
     private investmentService: InvestmentsService,
@@ -34,17 +44,39 @@ export class InvestmentPrint implements OnInit {
           this.investmentResult = res["result"];
           this.instrumentName = this.investmentResult.id_inversion_instrumento.id_tipo_instrumento.codigo;
           this.investmentInstrument = this.investmentResult.id_inversion_instrumento.instrumento;
+
           this.getInstrumentColumns(
             this.instrumentName,
             this.investmentInstrument
           );
 
-          this.catalogService.getRateTypes().subscribe(res => {
-            this.rates = res.find(
-              e => e.id_tipo_tasa == this.investmentResult.id_tipo_tasa
-            );
-            this.rates = this.rates != undefined ? this.rates.nombre : "-";
-          });
+          if (
+            this.allowedStateForPayment.includes(
+              this.investmentResult["id_estado_inversion"]["codigo"]
+            )
+          ) {
+            this.investmentService
+              .getPaymentInfoProposalInvestment(this.investmentID)
+              .subscribe(resp => {
+                this.monto = resp["result"]["monto"];
+                this.codigo_inversion =
+                  resp["result"]["id_inversion"]["codigo_inversion"];
+                this.codigo = resp["result"]["codigo"];
+                this.tipo_pago = resp["result"]["id_tipo_pago"]["nombre"];
+                this.cuenta_bancaria =
+                  resp["result"]["id_cuenta_bancaria"]["nombre"];
+
+                if (resp["result"]["id_cuenta_bancaria_destino"] != undefined) {
+                  this.cuenta_bancaria_destino =
+                    resp["result"]["id_cuenta_bancaria_destino"]["nombre"];
+                }
+                if (resp["result"]["emitir_nombre"] != undefined) {
+                  this.emitir_nombre = resp["result"]["emitir_nombre"];
+                }
+
+                this.fecha_vencimiento = resp["result"]["fecha_vencimiento"];
+              });
+          }
         });
     }
   }
@@ -1043,6 +1075,73 @@ export class InvestmentPrint implements OnInit {
             widths: [150, 200],
             body: [[this.columnKey, this.columnValue]]
           }
+        },
+
+        { text: "Información de pago", style: "subheader", margin: [0, 10] },
+        {
+          style: "tableExample",
+          table: {
+            widths: [100, 200],
+            body: [
+              /*[
+                "Estado de inversión: ",
+                {
+                  text: this.investmentResult.,
+                  italics: true,
+                  color: "gray"
+                }
+              ],*/
+
+              [
+                "Monto: ",
+                {
+                  text: this.monto,
+                  italics: true,
+                  color: "gray"
+                }
+              ],
+              [
+                "Tipo pagp: ",
+                {
+                  text: this.tipo_pago,
+                  italics: true,
+                  color: "gray"
+                }
+              ],
+              [
+                "Cuenta bancaria: ",
+                {
+                  text: this.cuenta_bancaria,
+                  italics: true,
+                  color: "gray"
+                }
+              ],
+              [
+                "Cuenta bancaria destino: ",
+                {
+                  text: this.cuenta_bancaria_destino,
+                  italics: true,
+                  color: "gray"
+                }
+              ],
+              [
+                "Emisión a nombre de: ",
+                {
+                  text: this.emitir_nombre,
+                  italics: true,
+                  color: "gray"
+                }
+              ],
+              [
+                "Fecha vencimiento: ",
+                {
+                  text: this.fecha_vencimiento,
+                  italics: true,
+                  color: "gray"
+                }
+              ]
+            ]
+          }
         }
       ],
       info: {