소스 검색

merge con development

Oscar José Nuñez Chávez 5 년 전
부모
커밋
883faa022e

+ 25 - 37
src/app/components/instruments/cete/cete.component.html

@@ -256,42 +256,6 @@
         </div>
       </div>
 
-      <!-- Fecha vencimiento -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="fecha_vencimiento">Fecha vencimiento: </label>
-
-          <div class="input-box-container">
-            <div>
-              <p>
-                <i class="far fa-calendar" aria-hidden="true"></i>
-              </p>
-              <input
-                class="input-box form-control"
-                placeholder="Seleccione una fecha"
-                angular-mydatepicker
-                formControlName="fecha_vencimiento"
-                (click)="dp2.toggleCalendar()"
-                [options]="myDpOptions"
-                #dp2="angular-mydatepicker"
-                [ngClass]="{
-                  'is-invalid': submitted && f.fecha_vencimiento.errors
-                }"
-              />
-            </div>
-          </div>
-
-          <div
-            *ngIf="submitted && f.fecha_vencimiento.errors"
-            class="invalid-feedback"
-          >
-            <div *ngIf="f.fecha_vencimiento.errors.required">
-              Campo requerido
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- Ultima fecha cupón -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -386,6 +350,10 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
       </div>
     </div>
     <br />
@@ -426,7 +394,16 @@
                 }}
               </td>
             </ng-container>
-
+            <ng-container matColumnDef="ingreso_bruto">
+              <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
+              <td mat-cell *matCellDef="let row">
+                {{
+                  row.ingreso_bruto == "" || row.ingreso_bruto == undefined
+                    ? "-"
+                    : row.ingreso_bruto
+                }}
+              </td>
+            </ng-container>
             <!-- Country Column -->
             <ng-container matColumnDef="ingreso_neto">
               <th mat-header-cell *matHeaderCellDef>Ingreso neto</th>
@@ -627,6 +604,17 @@
             </ng-container>
 
             <!-- Country Column -->
+            <ng-container matColumnDef="ingreso_bruto">
+              <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
+              <td mat-cell *matCellDef="let row">
+                {{
+                  row.ingreso_bruto == "" || row.ingreso_bruto == undefined
+                    ? "-"
+                    : row.ingreso_bruto
+                }}
+              </td>
+            </ng-container>
+
             <ng-container matColumnDef="ingreso_neto">
               <th mat-header-cell *matHeaderCellDef>Ingreso neto</th>
               <td mat-cell *matCellDef="let row">

+ 13 - 10
src/app/components/instruments/cete/cete.component.ts

@@ -28,6 +28,7 @@ export class CETE implements InstrumentComponent {
     "posicion",
     "plazo",
     "fecha_pago",
+    "ingreso_bruto",
     "ingreso_neto"
   ];
 
@@ -93,6 +94,7 @@ export class CETE implements InstrumentComponent {
   dataSource = new MatTableDataSource(this.proyecciones);
   dataSource2 = new MatTableDataSource(this.proyecciones);
   hasProjections: boolean;
+  fecha_vencimiento: any;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -176,7 +178,7 @@ export class CETE implements InstrumentComponent {
               }
             },
         Validators.required
-      ],
+      ] /*
       fecha_vencimiento: [
         this.instrument_exists
           ? ""
@@ -192,7 +194,7 @@ export class CETE implements InstrumentComponent {
               }
             },
         Validators.required
-      ],
+      ],*/,
       fecha_operacion: [
         this.instrument_exists
           ? ""
@@ -242,6 +244,8 @@ export class CETE implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
     if (!form.valid) {
       return false;
     }
@@ -255,9 +259,9 @@ export class CETE implements InstrumentComponent {
       .ceteCalc(
         "CETE", // Codigo del instrumento
         {
-          id_tipo_base: this.general.base_anual,
-          id_formato_ingreso: this.general.formato_ingreso,
-          id_periodicidad: this.general.periodicidad
+          id_tipo_base: +this.general.base_anual,
+          id_formato_ingreso: +this.general.formato_ingreso,
+          id_periodicidad: +this.general.periodicidad
         },
         {
           valor_nominal: +this.f.valor_nominal.value,
@@ -270,13 +274,12 @@ export class CETE implements InstrumentComponent {
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate
             .formatted,
           fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate
-            .formatted,
-          fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
+            .formatted
+          //fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
         }
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -286,6 +289,7 @@ export class CETE implements InstrumentComponent {
           this.comision_bolsa = ans["result"]["comision_bolsa"];
           this.comision_casa = ans["result"]["comision_casa"];
           this.proyecciones = ans["result"]["proyecciones"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
 
           this.dataSource.data = this.proyecciones;
           this.dataSource.paginator = this.paginator;
@@ -308,8 +312,7 @@ export class CETE implements InstrumentComponent {
               .formatted,
             fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate
               .formatted,
-            fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate
-              .formatted,
+            fecha_vencimiento: this.fecha_vencimiento,
             ingreso_bruto: this.ingreso_bruto,
             ingreso_neto: this.ingreso_neto,
             valor_transado: this.valor_transado,

+ 8 - 38
src/app/components/instruments/dap/dap.component.html

@@ -158,42 +158,6 @@
         </div>
       </div>
 
-      <!-- Fecha vencimiento -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="fecha_vencimiento">Fecha vencimiento: </label>
-
-          <div class="input-box-container">
-            <div>
-              <p>
-                <i class="far fa-calendar" aria-hidden="true"></i>
-              </p>
-              <input
-                class="input-box form-control"
-                placeholder="Seleccione una fecha"
-                angular-mydatepicker
-                formControlName="fecha_vencimiento"
-                (click)="dp2.toggleCalendar()"
-                [options]="myDpOptions"
-                #dp2="angular-mydatepicker"
-                [ngClass]="{
-                  'is-invalid': submitted && f.fecha_vencimiento.errors
-                }"
-              />
-            </div>
-          </div>
-
-          <div
-            *ngIf="submitted && f.fecha_vencimiento.errors"
-            class="invalid-feedback"
-          >
-            <div *ngIf="f.fecha_vencimiento.errors.required">
-              Campo requerido
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- # de certificado -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -266,6 +230,10 @@
           <h4>Renta:</h4>
           <div class="field">$USD {{ renta | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
         <div class="col-sm-6">
           <h4>Fecha inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>
@@ -321,11 +289,12 @@
             <ng-container matColumnDef="renta">
               <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.renta == "" || row.renta == undefined
                     ? "-"
                     : (row.renta | number: "1.2-4")
-                }}%
+                }}
               </td>
             </ng-container>
             <ng-container matColumnDef="ingreso_neto">
@@ -515,11 +484,12 @@
             <ng-container matColumnDef="renta">
               <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.renta == "" || row.renta == undefined
                     ? "-"
                     : (row.renta | number: "1.2-4")
-                }}%
+                }}
               </td>
             </ng-container>
             <ng-container matColumnDef="ingreso_neto">

+ 20 - 35
src/app/components/instruments/dap/dap.component.ts

@@ -63,7 +63,7 @@ export class DAP implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -92,6 +92,7 @@ export class DAP implements InstrumentComponent {
   renta: any;
   hasProjections: boolean;
   numero_certificado: any;
+  fecha_vencimiento: any;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -102,7 +103,7 @@ export class DAP implements InstrumentComponent {
     public datepipe: DatePipe
   ) {
     this.instrument_work = this.formDataService.getWork();
-    this.instrument_exists = this.instrument_work == undefined;
+    this.instrument_null = this.instrument_work == undefined;
     this.general = this.formDataService.getGeneralInfo();
 
     if (
@@ -120,7 +121,7 @@ export class DAP implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       monto_inversion: [
-        this.instrument_exists ? "" : this.instrument_work.monto_inversion,
+        this.instrument_null ? "" : this.instrument_work.monto_inversion,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
@@ -128,44 +129,30 @@ export class DAP implements InstrumentComponent {
       ],
 
       renta_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        this.instrument_null || this.instrument_work.renta_porcentaje == null
+          ? 10
+          : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       tasa_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.tasa_porcentaje,
+        this.instrument_null ? "" : this.instrument_work.tasa_porcentaje,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       plazo: [
-        this.instrument_exists ? "" : this.instrument_work.plazo,
+        this.instrument_null ? "" : this.instrument_work.plazo,
         [Validators.required]
       ],
 
       numero_certificado: [
-        this.instrument_exists ? "" : this.instrument_work.numero_certificado,
+        this.instrument_null ? "" : this.instrument_work.numero_certificado,
         []
       ],
 
-      fecha_vencimiento: [
-        this.instrument_exists
-          ? ""
-          : {
-              isRange: false,
-              singleDate: {
-                jsDate: parse(
-                  this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy",
-                  new Date()
-                ),
-                formatted: this.instrument_work.fecha_vencimiento
-              }
-            },
-        Validators.required
-      ],
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -197,6 +184,8 @@ export class DAP implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
     if (!form.valid) {
       return false;
     }
@@ -211,9 +200,9 @@ export class DAP implements InstrumentComponent {
       .dapCalc(
         "DAP", // Codigo del instrumento
         {
-          id_tipo_base: this.general.base_anual,
-          id_periodicidad: this.general.periodicidad,
-          id_formato_ingreso: this.general.formato_ingreso
+          id_tipo_base: +this.general.base_anual,
+          id_periodicidad: +this.general.periodicidad,
+          id_formato_ingreso: +this.general.formato_ingreso
         },
         {
           monto_inversion: +this.f.monto_inversion.value,
@@ -221,8 +210,7 @@ export class DAP implements InstrumentComponent {
           renta_porcentaje: +this.f.renta_porcentaje.value,
           plazo: +this.f.plazo.value,
           //id_formato_ingreso: this.f.formato_ingreso.value,
-          fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
-          fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
+          fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted
         }
       )
       .subscribe(
@@ -237,6 +225,8 @@ export class DAP implements InstrumentComponent {
           this.renta = ans["result"]["renta"];
           this.proyecciones = ans["result"]["proyecciones"];
           this.numero_certificado = ans["result"]["numero_certificado"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
+
           this.dataSource.data = this.proyecciones;
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
@@ -258,12 +248,7 @@ export class DAP implements InstrumentComponent {
             proyecciones: this.proyecciones,
 
             fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-              .singleDate.formatted,
-            fecha_vencimiento:
-              this.investmentProposalForm.value.fecha_vencimiento != undefined
-                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-                    .formatted
-                : ""
+              .singleDate.formatted
           };
           this.formDataService.setWork(this.dapObject);
           Swal.close();

+ 4 - 40
src/app/components/instruments/pbur/pbur.component.html

@@ -257,40 +257,6 @@
           </div>
         </div>
       </div>
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="fecha_vencimiento">Fecha vencimiento: </label>
-
-          <div class="input-box-container">
-            <div>
-              <p>
-                <i class="far fa-calendar" aria-hidden="true"></i>
-              </p>
-              <input
-                class="input-box form-control"
-                placeholder="Seleccione una fecha"
-                angular-mydatepicker
-                formControlName="fecha_vencimiento"
-                (click)="dp2.toggleCalendar()"
-                [options]="myDpOptions"
-                #dp2="angular-mydatepicker"
-                [ngClass]="{
-                  'is-invalid': submitted && f.fecha_vencimiento.errors
-                }"
-              />
-            </div>
-          </div>
-
-          <div
-            *ngIf="submitted && f.fecha_vencimiento.errors"
-            class="invalid-feedback"
-          >
-            <div *ngIf="f.fecha_vencimiento.errors.required">
-              Campo requerido
-            </div>
-          </div>
-        </div>
-      </div>
 
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -364,12 +330,6 @@
             $USD {{ interes_acumulado | number: "1.2-4" }}
           </div>
         </div>
-        <div class="col-sm-6">
-          <h4>Plazo:</h4>
-          <div class="field">
-            {{ plazo }}
-          </div>
-        </div>
         <div class="col-sm-6">
           <h4>Valor transado:</h4>
           <div class="field">$USD {{ valor_transado | number: "1.2-4" }}</div>
@@ -398,6 +358,10 @@
           <h4>Fecha de inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
       </div>
     </div>
 

+ 35 - 41
src/app/components/instruments/pbur/pbur.component.ts

@@ -62,7 +62,7 @@ export class PBUR implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -94,6 +94,7 @@ export class PBUR implements InstrumentComponent {
   dataSource2 = new MatTableDataSource(this.proyecciones);
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
   @ViewChild(MatSort, { static: true }) sort: MatSort;
+  fecha_vencimiento: any;
   constructor(
     private formBuilder: FormBuilder,
     private router: Router,
@@ -103,7 +104,7 @@ export class PBUR implements InstrumentComponent {
     public datepipe: DatePipe
   ) {
     this.instrument_work = this.formDataService.getWork();
-    this.instrument_exists = this.instrument_work == undefined;
+    this.instrument_null = this.instrument_work == undefined;
     this.general = this.formDataService.getGeneralInfo();
 
     if (
@@ -126,25 +127,32 @@ export class PBUR implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       valor_par: [
-        this.instrument_exists ? false : this.instrument_work.valor_par
+        this.instrument_null || this.instrument_work.valor_par == null
+          ? false
+          : this.instrument_work.valor_par
       ],
       valor_nominal: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal,
+        this.instrument_null ? "" : this.instrument_work.valor_nominal,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
+        this.instrument_null || this.instrument_work.otros_costos == null
+          ? 0
+          : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
+
       renta_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        this.instrument_null || this.instrument_work.renta_porcentaje == null
+          ? 10
+          : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       comision_casa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_casa_porcentaje,
         [
@@ -153,7 +161,7 @@ export class PBUR implements InstrumentComponent {
         ]
       ],
       comision_bolsa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_bolsa_porcentaje,
         [
@@ -161,19 +169,23 @@ export class PBUR implements InstrumentComponent {
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
+      plazo: [
+        this.instrument_null ? "" : this.instrument_work.plazo,
+        [Validators.required]
+      ],
       rendimiento_bruto: [
-        this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
+        this.instrument_null ? "" : this.instrument_work.rendimiento_bruto,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       /*formato_ingreso: [
-        this.instrument_exists ? "" : this.instrument_work.formato_ingreso,
+        this.instrument_null ? "" : this.instrument_work.formato_ingreso,
         [Validators.required]
       ],*/
       fecha_liquidacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -188,24 +200,8 @@ export class PBUR implements InstrumentComponent {
             },
         Validators.required
       ],
-      fecha_vencimiento: [
-        this.instrument_exists
-          ? ""
-          : {
-              isRange: false,
-              singleDate: {
-                jsDate: parse(
-                  this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy",
-                  new Date()
-                ),
-                formatted: this.instrument_work.fecha_vencimiento
-              }
-            },
-        Validators.required
-      ],
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -221,7 +217,7 @@ export class PBUR implements InstrumentComponent {
         Validators.required
       ],
       fecha_ultima_cupon: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -252,6 +248,9 @@ export class PBUR implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
+
     if (!form.valid) {
       return false;
     }
@@ -263,16 +262,17 @@ export class PBUR implements InstrumentComponent {
     Swal.showLoading();
 
     this.instrumentCalcService
-      .vcnCalc(
+      .pburCalc(
         "PBUR", // Codigo del instrumento
         {
-          id_tipo_base: this.general.base_anual,
-          id_periodicidad: this.general.periodicidad,
-          id_formato_ingreso: this.general.formato_ingreso
+          id_tipo_base: +this.general.base_anual,
+          id_periodicidad: +this.general.periodicidad,
+          id_formato_ingreso: +this.general.formato_ingreso
         },
         {
           valor_par: this.f.valor_par.value,
           valor_nominal: +this.f.valor_nominal.value,
+          plazo: +this.f.plazo.value,
           comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
           comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
           rendimiento_bruto: this.f.rendimiento_bruto.value,
@@ -283,8 +283,7 @@ export class PBUR implements InstrumentComponent {
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate
             .formatted,
           fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate
-            .formatted,
-          fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
+            .formatted
         }
       )
       .subscribe(
@@ -297,10 +296,10 @@ export class PBUR implements InstrumentComponent {
           this.total_pagar = ans["result"]["total_pagar"];
           this.comision_bolsa = ans["result"]["comision_bolsa"];
           this.comision_casa = ans["result"]["comision_casa"];
-          this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
           this.proyecciones = ans["result"]["proyecciones"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
 
           if (this.f.valor_par.value == true) {
             this.hasProjections = true;
@@ -348,11 +347,6 @@ export class PBUR implements InstrumentComponent {
               this.investmentProposalForm.value.fecha_ultima_cupon != undefined
                 ? this.investmentProposalForm.value.fecha_ultima_cupon
                     .singleDate.formatted
-                : "",
-            fecha_vencimiento:
-              this.investmentProposalForm.value.fecha_vencimiento != undefined
-                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-                    .formatted
                 : ""
           };
           this.formDataService.setWork(this.pburObject);

+ 1 - 1
src/app/components/instruments/vcn/vcn.component.html

@@ -362,7 +362,7 @@
         <div class="col-sm-6">
           <h4>Interes acumulado:</h4>
           <div class="field">
-            {{ interes_acumulado | number: "1.2-4" }}
+            $USD {{ interes_acumulado | number: "1.2-4" }}
           </div>
         </div>
         <div class="col-sm-6">

+ 24 - 17
src/app/components/instruments/vcn/vcn.component.ts

@@ -62,7 +62,7 @@ export class VCN implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -104,7 +104,7 @@ export class VCN implements InstrumentComponent {
     public datepipe: DatePipe
   ) {
     this.instrument_work = this.formDataService.getWork();
-    this.instrument_exists = this.instrument_work == undefined;
+    this.instrument_null = this.instrument_work == undefined;
     this.general = this.formDataService.getGeneralInfo();
 
     if (
@@ -126,25 +126,31 @@ export class VCN implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       valor_par: [
-        this.instrument_exists ? false : this.instrument_work.valor_par
+        this.instrument_null || this.instrument_work.valor_par == null
+          ? false
+          : this.instrument_work.valor_par
       ],
       valor_nominal: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal,
+        this.instrument_null ? "" : this.instrument_work.valor_nominal,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
+        this.instrument_null || this.instrument_work.otros_costos == null
+          ? 0
+          : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
       renta_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        this.instrument_null || this.instrument_work.renta_porcentaje == null
+          ? 10
+          : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       comision_casa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_casa_porcentaje,
         [
@@ -153,7 +159,7 @@ export class VCN implements InstrumentComponent {
         ]
       ],
       comision_bolsa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_bolsa_porcentaje,
         [
@@ -162,18 +168,18 @@ export class VCN implements InstrumentComponent {
         ]
       ],
       rendimiento_bruto: [
-        this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
+        this.instrument_null ? "" : this.instrument_work.rendimiento_bruto,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       /*formato_ingreso: [
-        this.instrument_exists ? "" : this.instrument_work.formato_ingreso,
+        this.instrument_null ? "" : this.instrument_work.formato_ingreso,
         [Validators.required]
       ],*/
       fecha_liquidacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -189,7 +195,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_vencimiento: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -205,7 +211,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -221,7 +227,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_ultima_cupon: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -254,6 +260,7 @@ export class VCN implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+
     if (!form.valid) {
       return false;
     }
@@ -268,9 +275,9 @@ export class VCN implements InstrumentComponent {
       .vcnCalc(
         "VCN", // Codigo del instrumento
         {
-          id_tipo_base: this.general.base_anual,
-          id_periodicidad: this.general.periodicidad,
-          id_formato_ingreso: this.general.formato_ingreso
+          id_tipo_base: +this.general.base_anual,
+          id_periodicidad: +this.general.periodicidad,
+          id_formato_ingreso: +this.general.formato_ingreso
         },
         {
           valor_par: this.f.valor_par.value,

+ 0 - 1
src/app/components/investment-proposals/change-history/change-history.component.ts

@@ -65,7 +65,6 @@ export class ChangeHistoryComponent implements OnInit {
       .subscribe(
         res => {
           this.logs = res["result"];
-          console.log(this.logs);
         },
         error => {}
       );

+ 2 - 2
src/app/components/investment-proposals/general-info/general-info.component.html

@@ -286,8 +286,8 @@
                             *ngFor="let item of base_types"
                             [value]="item.id_tipo_base"
                             [selected]="item.id_tipo_base == general.base_anual"
-                            >{{ item.tipo_base }}/{{
-                              item.tipo_base_dias
+                            >{{ item.tipo_base_dias }}/{{
+                              item.tipo_base
                             }}</option
                           >
                         </select>

+ 4 - 5
src/app/components/investment-proposals/investment-proposals.component.html

@@ -56,14 +56,13 @@
                 </ng-container>
 
                 <!-- Country Column -->
-                <ng-container matColumnDef="id_tipo_mercado">
-                  <th mat-header-cell *matHeaderCellDef>Tipo de mercado</th>
+                <ng-container matColumnDef="id_empresa">
+                  <th mat-header-cell *matHeaderCellDef>Empresa</th>
                   <td mat-cell *matCellDef="let row">
                     {{
-                      row.id_tipo_mercado == "" ||
-                      row.id_tipo_mercado == undefined
+                      row.id_empresa == "" || row.id_empresa == undefined
                         ? "-"
-                        : row.id_tipo_mercado.nombre
+                        : row.id_empresa.nombre
                     }}
                   </td>
                 </ng-container>

+ 9 - 3
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -25,7 +25,7 @@ export class InvestmentProposalsComponent implements OnInit {
   displayedColumns: string[] = [
     "codigo_inversion",
     "asunto",
-    "id_tipo_mercado",
+    "id_empresa",
     "id_inversion_instrumento",
     "id_estado_inversion",
     "id"
@@ -62,6 +62,7 @@ export class InvestmentProposalsComponent implements OnInit {
         data.codigo_inversion.toLowerCase() +
         data.nombre_inversion.toLowerCase() +
         data.asunto.toLowerCase() +
+        data.id_empresa.nombre.toLowerCase() +
         data.comentario.toLowerCase() +
         data.justificacion.toLowerCase();
       return dataStr.indexOf(filter) != -1;
@@ -117,7 +118,7 @@ export class InvestmentProposalsComponent implements OnInit {
 
     setTimeout(() => {
       Swal.close();
-    }, 1200);
+    }, 2000);
   }
 
   applyFilter(event: Event) {
@@ -245,6 +246,7 @@ export class InvestmentProposalsComponent implements OnInit {
         showCancelButton: true,
         confirmButtonText: "Enviar propuesta",
         cancelButtonText: "Cancelar",
+        showLoaderOnConfirm: true,
         // inputValidator: value => {
         //   if (!value) {
         //     return "Debe ingresar un comentario";
@@ -283,7 +285,8 @@ export class InvestmentProposalsComponent implements OnInit {
                 });
               }
             );
-        }
+        },
+        allowOutsideClick: () => !Swal.isLoading()
       });
     })();
   }
@@ -299,6 +302,9 @@ export class InvestmentProposalsComponent implements OnInit {
         showCancelButton: true,
         confirmButtonText: "Finalizar",
         cancelButtonText: "Cancelar",
+        onOpen: () => {
+          Swal.showLoading();
+        },
         preConfirm: comentario => {
           let reviewProposal = {
             id_inversion: investmentProposalID,

+ 1 - 1
src/app/components/investment-proposals/payment-info/payment-info.component.html

@@ -42,7 +42,7 @@
                 <!-- Valor nominal -->
                 <div class="col-lg-6 col-sm-12 pr-xl-3">
                   <div class="form-group">
-                    <label for="monto">Monto: </label>
+                    <label for="monto">Monto a pagar: </label>
                     <div class="input-box-container">
                       <p>
                         <i class="fas fa-dollar-sign"></i>

+ 6 - 5
src/app/components/investment-proposals/payment-info/payment-info.component.ts

@@ -92,12 +92,13 @@ export class PaymentInfoComponent implements OnInit {
       .getProposalInvestment(this.investmentProposalID)
       .subscribe(
         res => {
-          let instrumentType =
+          this.inversionCode = res["result"]["codigo_inversion"];
+
+          if (
             res["result"]["id_inversion_instrumento"]["id_tipo_instrumento"][
               "codigo"
-            ];
-          this.inversionCode = res["result"]["codigo_inversion"];
-          if (instrumentType == "DAP") {
+            ] == "DAP"
+          ) {
             this.inversionAmount =
               res["result"]["id_inversion_instrumento"]["instrumento"][
                 "monto_inversion"
@@ -105,7 +106,7 @@ export class PaymentInfoComponent implements OnInit {
           } else {
             this.inversionAmount =
               res["result"]["id_inversion_instrumento"]["instrumento"][
-                "valor_nominal"
+                "total_pagar"
               ];
           }
           this.investmentProposalForm.setValue({

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

@@ -48,7 +48,7 @@
                       <div class="field">{{ codigo_inversion }}</div>
                     </div>
                     <div class="col-sm-6">
-                      <h4>Monto:</h4>
+                      <h4>Monto a pagar:</h4>
                       <div class="field">
                         $USD {{ monto | number: "1.2-4" }}
                       </div>

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

@@ -133,7 +133,7 @@ export class ResultComponent implements OnInit {
       );
       this.base_types =
         this.base_types != undefined
-          ? ` ${this.base_types.tipo_base} / ${this.base_types.tipo_base_dias}`
+          ? `${this.base_types.tipo_base_dias}  / ${this.base_types.tipo_base}`
           : "-";
     });
 

+ 4 - 4
src/app/components/plugins/navbar-inv-proposals/navbar-inv-proposals.html

@@ -6,8 +6,8 @@
     <li>
       <a
         (click)="goToStep('general')"
-        title="general"
         [ngClass]="activeLink == 'general' ? 'active' : ''"
+        title="Información general"
       >
         <span class="round-tabs one">
           <i class="material-icons">post_add</i>
@@ -19,7 +19,7 @@
     <li>
       <a
         (click)="goToStep('instrument')"
-        title="instrument"
+        title="Instrumento"
         [ngClass]="activeLink == 'instrument' ? 'active' : ''"
       >
         <span class="round-tabs two">
@@ -33,7 +33,7 @@
       <a
         (click)="goToStep('other_info')"
         [ngClass]="activeLink == 'other_info' ? 'active' : ''"
-        title="address"
+        title="Información complementaria"
       >
         <span class="round-tabs three">
           <i class="material-icons">library_books</i>
@@ -46,7 +46,7 @@
       <a
         (click)="goToStep('result')"
         [ngClass]="activeLink == 'result' ? 'active' : ''"
-        title="completed"
+        title="Resumen de la propuesta"
       >
         <span class="round-tabs four">
           <i class="material-icons">check_box</i>

+ 48 - 12
src/app/services/instrument-calculations.service.ts

@@ -44,9 +44,9 @@ export class InstrumentCalculations {
   ceteCalc(
     codigo_instrumento: string,
     info_inversion: {
-      id_tipo_base: string;
-      id_periodicidad: string;
-      id_formato_ingreso: string;
+      id_tipo_base: number;
+      id_periodicidad: number;
+      id_formato_ingreso: number;
     },
     info_instrumento: {
       valor_nominal: number;
@@ -58,7 +58,7 @@ export class InstrumentCalculations {
       fecha_operacion: string;
       fecha_liquidacion: string;
       fecha_ultima_cupon: string;
-      fecha_vencimiento: string;
+      //fecha_vencimiento: string;
     }
   ): Observable<boolean> {
     return this.http
@@ -74,13 +74,13 @@ export class InstrumentCalculations {
         catchError(this.errorHandl)
       );
   }
-  // Para vcn y papel bursatil
+  // Para vcn
   vcnCalc(
     codigo_instrumento: string,
     info_inversion: {
-      id_tipo_base: string;
-      id_periodicidad: string;
-      id_formato_ingreso: string;
+      id_tipo_base: number;
+      id_periodicidad: number;
+      id_formato_ingreso: number;
     },
     info_instrumento: {
       valor_par: boolean;
@@ -110,12 +110,48 @@ export class InstrumentCalculations {
       );
   }
 
+  // Para pbur
+  pburCalc(
+    codigo_instrumento: string,
+    info_inversion: {
+      id_tipo_base: number;
+      id_periodicidad: number;
+      id_formato_ingreso: number;
+    },
+    info_instrumento: {
+      valor_par: boolean;
+      valor_nominal: number;
+      comision_casa_porcentaje: number;
+      comision_bolsa_porcentaje: number;
+      rendimiento_bruto: number;
+      otros_costos: number;
+      plazo: number;
+      renta_porcentaje: number;
+      fecha_operacion: string;
+      fecha_liquidacion: string;
+      fecha_ultima_cupon: string;
+    }
+  ): Observable<boolean> {
+    return this.http
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
+        codigo_instrumento,
+        info_inversion,
+        info_instrumento
+      })
+      .pipe(
+        map(response => {
+          return response;
+        }),
+        catchError(this.errorHandl)
+      );
+  }
+
   dapCalc(
     codigo_instrumento: string,
     info_inversion: {
-      id_tipo_base: string;
-      id_periodicidad: string;
-      id_formato_ingreso: string;
+      id_tipo_base: number;
+      id_periodicidad: number;
+      id_formato_ingreso: number;
     },
     info_instrumento: {
       monto_inversion: number;
@@ -123,7 +159,7 @@ export class InstrumentCalculations {
       renta_porcentaje: number;
       plazo: number;
       fecha_operacion: string;
-      fecha_vencimiento: string;
+      //fecha_vencimiento: string;
     }
   ): Observable<boolean> {
     return this.http