Просмотр исходного кода

Correciones en instrumento de titularizacion, filtros para listado de ingresos, correcciones

Oscar José Nuñez Chávez 5 лет назад
Родитель
Сommit
671a3c6d6c
21 измененных файлов с 254 добавлено и 328 удалено
  1. 48 15
      src/app/components/incomes/incomes.component.html
  2. 44 38
      src/app/components/incomes/incomes.component.ts
  3. 0 6
      src/app/components/instruments/bonos/bonos.component.html
  4. 0 49
      src/app/components/instruments/bonos/bonos.component.ts
  5. 0 6
      src/app/components/instruments/certificados/certificados.component.html
  6. 0 2
      src/app/components/instruments/certificados/certificados.component.ts
  7. 0 6
      src/app/components/instruments/eurobonos/eurobonos.component.html
  8. 0 49
      src/app/components/instruments/eurobonos/eurobonos.component.ts
  9. 2 2
      src/app/components/instruments/titulos/titulos.component.html
  10. 12 91
      src/app/components/instruments/titulos/titulos.component.ts
  11. 21 6
      src/app/components/investment-proposals/investment-proposals.component.html
  12. 47 0
      src/app/components/investment-proposals/payment-info/payment-info.component.html
  13. 33 3
      src/app/components/investment-proposals/payment-info/payment-info.component.ts
  14. 1 29
      src/app/components/investments/costs/dap/dap.costs.component.ts
  15. 0 4
      src/app/components/investments/costs/pbur/pbur.costs.component.ts
  16. 0 5
      src/app/components/investments/costs/vcn/vcn.costs.component.ts
  17. 21 9
      src/app/components/investments/investments.component.html
  18. 1 6
      src/app/components/investments/investments.component.ts
  19. 0 1
      src/app/components/shared/sidebar/sidebar.component.spec.ts
  20. 4 1
      src/app/layouts/admin/admin.module.ts
  21. 20 0
      src/app/models/i18n-paginator.ts

+ 48 - 15
src/app/components/incomes/incomes.component.html

@@ -15,13 +15,14 @@
           </nav>
         </div>
       </div>
-
+    </div>
+    <br />
+    <div class="row">
       <div class="col-12">
         <div class="align-container">
           <h4><b>Listado de inversiones</b></h4>
-          <br />
           <div class="row">
-            <div class="col-lg-4 col-sm-4 mr-1">
+            <div class="col-lg-4 col-sm-6">
               <div class="form-group">
                 <label for="instrumento">Instrumento: </label>
 
@@ -40,8 +41,21 @@
                 </select>
               </div>
             </div>
+            <div class="col-lg-4 col-sm-6">
+              <div class="form-group">
+                <label for="instrumento">Ver ingresos: </label>
 
-            <div class="col-lg-4 col-sm-6 ml-1">
+                <select
+                  class="custom-select"
+                  name="instrumento"
+                  (change)="filter_by_income_status($event)"
+                >
+                  <option value="1">Activos</option>
+                  <option value="0">Todos</option>
+                </select>
+              </div>
+            </div>
+            <div class="col-lg-4 col-sm-6">
               <div class="form-group">
                 <label for="instrumento">Rango de fechas: </label>
 
@@ -63,7 +77,6 @@
               </div>
             </div>
           </div>
-          <br />
 
           <div class="form-group">
             <label for="filter" class="control-label">Filtro rápido: </label>
@@ -78,40 +91,55 @@
 
           <div class="example-container mat-elevation-z8">
             <div class="example-table-container table-responsive">
-              <table mat-table [dataSource]="dataSource" class="example-table">
+              <table
+                mat-table
+                [dataSource]="dataSource"
+                matSort
+                class="example-table"
+              >
                 <!-- Name Column -->
                 <ng-container matColumnDef="codigo_inversion">
-                  <th mat-header-cell *matHeaderCellDef>Codigo</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Codigo
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.codigo_inversion }}
                   </td>
                 </ng-container>
                 <!-- Country Column -->
                 <ng-container matColumnDef="nombre_inversion">
-                  <th mat-header-cell *matHeaderCellDef>Nombre inversión</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Nombre inversión
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.nombre_inversion }}
                   </td>
                 </ng-container>
 
                 <!-- Country Column -->
-                <ng-container matColumnDef="fecha_pago">
-                  <th mat-header-cell *matHeaderCellDef>Fecha de pago</th>
+                <ng-container matColumnDef="fecha_proyeccion_pago">
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Fecha de pago
+                  </th>
                   <td mat-cell *matCellDef="let row">
-                    {{ row.fecha_pago }}
+                    {{ row.fecha_proyeccion_pago }}
                   </td>
                 </ng-container>
 
                 <!-- Country Column -->
                 <ng-container matColumnDef="tipo_instrumento">
-                  <th mat-header-cell *matHeaderCellDef>Instrumento</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Instrumento
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.tipo_instrumento }}
                   </td>
                 </ng-container>
                 <!-- Country Column -->
                 <ng-container matColumnDef="empresa">
-                  <th mat-header-cell *matHeaderCellDef>Empresa</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Empresa
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.empresa }}
                   </td>
@@ -119,7 +147,9 @@
 
                 <!-- Country Column -->
                 <ng-container matColumnDef="estado">
-                  <th mat-header-cell *matHeaderCellDef>Estado</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Estado
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.estado }}
                   </td>
@@ -162,7 +192,10 @@
                     </div>
                   </td>
                 </ng-container>
-                <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
+                <tr
+                  mat-header-row
+                  *matHeaderRowDef="displayedColumns; sticky: true"
+                ></tr>
                 <tr
                   mat-row
                   *matRowDef="let row; columns: displayedColumns"

+ 44 - 38
src/app/components/incomes/incomes.component.ts

@@ -50,7 +50,7 @@ export class IncomesComponent implements OnInit {
   };
   myDpOptions: IAngularMyDpOptions = {
     dateRange: true,
-    dateFormat: "yyyy-mm-dd",
+    dateFormat: "dd/mm/yyyy",
     dayLabels: this.daysLabels,
     monthLabels: this.monthsLabels
   };
@@ -60,7 +60,7 @@ export class IncomesComponent implements OnInit {
   displayedColumns: string[] = [
     "codigo_inversion",
     "nombre_inversion",
-    "fecha_pago",
+    "fecha_proyeccion_pago",
     "tipo_instrumento",
     "empresa",
     "estado",
@@ -93,20 +93,6 @@ export class IncomesComponent implements OnInit {
       this.authService.getJwtToken()
     );
     this.userRole = decodedToken.groups;
-    //    console.log("User role");
-    //  console.log(this.userRole);
-    //console.log(this.userRole.length == 0);
-    /*  
-    this.dataSource.filterPredicate = (data, filter) => {
-      const dataStr =
-        data.id_inversion_instrumento.id_tipo_instrumento.nombre +
-        data.codigo_inversion +
-        data.nombre_inversion +
-        data.asunto +
-        data.comentario +
-        data.justificacion;
-      return dataStr.indexOf(filter) != -1;
-    };*/
 
     Swal.fire({
       allowOutsideClick: false,
@@ -124,10 +110,7 @@ export class IncomesComponent implements OnInit {
     this.incomesService.getProjectionsIncomeList().subscribe(
       ans => {
         this.listProposals = ans.result;
-
-        console.log(this.listProposals);
         this.dataSource.data = this.listProposals;
-
         this.dataSource.paginator = this.paginator;
         this.dataSource.sort = this.sort;
       },
@@ -151,9 +134,34 @@ export class IncomesComponent implements OnInit {
     if (this.dataSource.paginator) {
       this.dataSource.paginator.firstPage();
     }
+    this.dataSource.sort = this.sort;
   }
 
   filter_by_date(event: any) {
+    let dateFormat = event.dateRange.formatted.split(" - ", 2);
+
+    let date0 = dateFormat[0].split("/");
+    let date1 = dateFormat[1].split("/");
+
+    let dateStart = Number(date0[2] + date0[1] + date0[0]);
+    let dateFinish = Number(date1[2] + date1[1] + date1[0]);
+
+    this.dataSource.filterPredicate = (data, filter) => {
+      if (dateFormat[0] && dateFormat[1]) {
+        let date2 = data["fecha_proyeccion_pago"].split("/");
+        let payment_date = Number(date2[2] + date2[1] + date2[0]);
+        return payment_date >= dateStart && payment_date <= dateFinish;
+      }
+      return true;
+    };
+    this.dataSource.filter = "" + Math.random();
+    if (this.dataSource.paginator) {
+      this.dataSource.paginator.firstPage();
+    }
+    this.dataSource.sort = this.sort;
+  }
+
+  filter_by_income_status(event: any) {
     Swal.fire({
       allowOutsideClick: false,
       icon: "info",
@@ -161,26 +169,24 @@ export class IncomesComponent implements OnInit {
     });
     Swal.showLoading();
 
-    let dateFormat = event.dateRange.formatted.split(" - ", 2);
+    let active = event.target.value;
 
-    this.incomesService
-      .searchProjectionsIncomeByDate(dateFormat[0], dateFormat[1])
-      .subscribe(
-        ans => {
-          this.listProposals = ans["result"];
-          this.dataSource.data = this.listProposals;
-          this.dataSource.paginator = this.paginator;
-          this.dataSource.sort = this.sort;
-          Swal.close();
-        },
-        err => {
-          Swal.fire({
-            icon: "error",
-            title: "Error en el servidor",
-            text: err.message
-          });
-        }
-      );
+    this.incomesService.getProjectionsIncomeList(active).subscribe(
+      ans => {
+        this.listProposals = ans["result"];
+        this.dataSource.data = this.listProposals;
+        this.dataSource.paginator = this.paginator;
+        this.dataSource.sort = this.sort;
+        Swal.close();
+      },
+      err => {
+        Swal.fire({
+          icon: "error",
+          title: "Error en el servidor",
+          text: err.message
+        });
+      }
+    );
   }
 
   applyFilter(event: Event) {

+ 0 - 6
src/app/components/instruments/bonos/bonos.component.html

@@ -1508,12 +1508,6 @@
             <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
             <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
           </table>
-
-          <mat-paginator
-            [pageSizeOptions]="[10, 15, 25]"
-            [pageIndex]="0"
-            [pageSize]="10"
-          ></mat-paginator>
         </div>
       </div>
     </div>

+ 0 - 49
src/app/components/instruments/bonos/bonos.component.ts

@@ -387,7 +387,6 @@ export class BONO implements InstrumentComponent {
       this.instrument_work != undefined &&
       this.instrument_work.proyecciones != ""
     ) {
-      console.log("get calcs");
       this.getCalculations(this.investmentProposalForm, false);
     }
   }
@@ -408,7 +407,6 @@ export class BONO implements InstrumentComponent {
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
 
-    console.log(form);
     if (!form.valid) {
       return false;
     }
@@ -467,9 +465,6 @@ export class BONO implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log("---------");
-          console.log(ans);
-
           // Instrumento de compra
           this.comision_casa_compra =
             ans["result"]["instrumento_compra"]["comision_casa_compra"];
@@ -562,50 +557,6 @@ export class BONO implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
-          /*
- "result": {
-        "instrumento_compra": {
-            "comision_casa_compra": 201.3,
-            "comision_bolsa_compra": 30.194999999999997,
-            "fecha_siguiente_cupon_compra": "28/04/2013",
-            "dias_vencimiento_compra": 880,
-            "dias_acumulados_compra": 32,
-            "ytm_vencimiento_comision_porcentaje_compra": 6.565909090909091,
-            "interes_acumulado_compra": 533.3333333333334,
-            "interes_acumulado_porcentaje_compra": 6.000000000000001,
-            "precio_sucio_porcentaje_compra": 106.65,
-            "valor_transado_compra": 100650.0,
-            "monto_pagar": 101419.82833333334,
-            "fecha_inicio_vigencia": "30/4/2013"
-        },
-        "instrumento_venta": {
-            "comision_casa_venta": 50.0,
-            "fecha_siguiente_cupon_venta": "28/10/2022",
-            "dias_vencimiento_venta": 179,
-            "dias_acumulados_venta": 1,
-            "ytm_vencimiento_comision_porcentaje_venta": -0.5229050279329608,
-            "interes_acumulado_venta": 46.875,
-            "interes_acumulado_porcentaje_venta": 6.75,
-            "precio_sucio_porcentaje_venta": 106.74999999999999,
-            "valor_transado_venta": 250000.0,
-            "monto_recibir": 249396.875
-        },
-        "resultado_operacion": {
-            "valor_nominal_compra": 100000.0,
-            1"dias_tenencia_total": 3389,
-            "precio_compra": 100.64999999999999,
-            "precio_venta": 100.0,
-            1"ganancia_perdida_capital": 149350.0,
-            1"ingresos_intereses": 13726.875,
-            1"costos_totales": -886.495,
-            1"ganancia_perdida_total": 162190.38,
-            1"ganancia_perdida_capital_porcentaje": 15.864856889938034,
-            1"intereses_porcentaje": 1.458151372086161,
-            1"neto_antes_impuesto_porcentaje": 17.22883942165831,
-            1"1neto_despues_impuesto_porcentaje": 17.067375863086458,
-            1"total_ingresos_recibidos": 13680.0
-        },
-*/
           this.bonosObject = {
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,

+ 0 - 6
src/app/components/instruments/certificados/certificados.component.html

@@ -1508,12 +1508,6 @@
             <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
             <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
           </table>
-
-          <mat-paginator
-            [pageSizeOptions]="[10, 15, 25]"
-            [pageIndex]="0"
-            [pageSize]="10"
-          ></mat-paginator>
         </div>
       </div>
     </div>

+ 0 - 2
src/app/components/instruments/certificados/certificados.component.ts

@@ -387,7 +387,6 @@ export class CINV implements InstrumentComponent {
       this.instrument_work != undefined &&
       this.instrument_work.proyecciones != ""
     ) {
-      console.log("get calcs");
       this.getCalculations(this.investmentProposalForm, false);
     }
   }
@@ -408,7 +407,6 @@ export class CINV implements InstrumentComponent {
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
 
-    console.log(form);
     if (!form.valid) {
       return false;
     }

+ 0 - 6
src/app/components/instruments/eurobonos/eurobonos.component.html

@@ -1508,12 +1508,6 @@
             <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
             <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
           </table>
-
-          <mat-paginator
-            [pageSizeOptions]="[10, 15, 25]"
-            [pageIndex]="0"
-            [pageSize]="10"
-          ></mat-paginator>
         </div>
       </div>
     </div>

+ 0 - 49
src/app/components/instruments/eurobonos/eurobonos.component.ts

@@ -387,7 +387,6 @@ export class EURB implements InstrumentComponent {
       this.instrument_work != undefined &&
       this.instrument_work.proyecciones != ""
     ) {
-      console.log("get calcs");
       this.getCalculations(this.investmentProposalForm, false);
     }
   }
@@ -408,7 +407,6 @@ export class EURB implements InstrumentComponent {
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
 
-    console.log(form);
     if (!form.valid) {
       return false;
     }
@@ -467,9 +465,6 @@ export class EURB implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log("---------");
-          console.log(ans);
-
           // Instrumento de compra
           this.comision_casa_compra =
             ans["result"]["instrumento_compra"]["comision_casa_compra"];
@@ -562,50 +557,6 @@ export class EURB implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
-          /*
- "result": {
-        "instrumento_compra": {
-            "comision_casa_compra": 201.3,
-            "comision_bolsa_compra": 30.194999999999997,
-            "fecha_siguiente_cupon_compra": "28/04/2013",
-            "dias_vencimiento_compra": 880,
-            "dias_acumulados_compra": 32,
-            "ytm_vencimiento_comision_porcentaje_compra": 6.565909090909091,
-            "interes_acumulado_compra": 533.3333333333334,
-            "interes_acumulado_porcentaje_compra": 6.000000000000001,
-            "precio_sucio_porcentaje_compra": 106.65,
-            "valor_transado_compra": 100650.0,
-            "monto_pagar": 101419.82833333334,
-            "fecha_inicio_vigencia": "30/4/2013"
-        },
-        "instrumento_venta": {
-            "comision_casa_venta": 50.0,
-            "fecha_siguiente_cupon_venta": "28/10/2022",
-            "dias_vencimiento_venta": 179,
-            "dias_acumulados_venta": 1,
-            "ytm_vencimiento_comision_porcentaje_venta": -0.5229050279329608,
-            "interes_acumulado_venta": 46.875,
-            "interes_acumulado_porcentaje_venta": 6.75,
-            "precio_sucio_porcentaje_venta": 106.74999999999999,
-            "valor_transado_venta": 250000.0,
-            "monto_recibir": 249396.875
-        },
-        "resultado_operacion": {
-            "valor_nominal_compra": 100000.0,
-            1"dias_tenencia_total": 3389,
-            "precio_compra": 100.64999999999999,
-            "precio_venta": 100.0,
-            1"ganancia_perdida_capital": 149350.0,
-            1"ingresos_intereses": 13726.875,
-            1"costos_totales": -886.495,
-            1"ganancia_perdida_total": 162190.38,
-            1"ganancia_perdida_capital_porcentaje": 15.864856889938034,
-            1"intereses_porcentaje": 1.458151372086161,
-            1"neto_antes_impuesto_porcentaje": 17.22883942165831,
-            1"1neto_despues_impuesto_porcentaje": 17.067375863086458,
-            1"total_ingresos_recibidos": 13680.0
-        },
-*/
           this.bonosObject = {
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,

+ 2 - 2
src/app/components/instruments/titulos/titulos.component.html

@@ -153,9 +153,9 @@
                 placeholder="Seleccione una fecha"
                 angular-mydatepicker
                 formControlName="fecha_emision"
-                (click)="dp6.toggleCalendar()"
+                (click)="dp.toggleCalendar()"
                 [options]="myDpOptions"
-                #dp6="angular-mydatepicker"
+                #dp="angular-mydatepicker"
                 [ngClass]="{
                   'is-invalid': submitted && f.fecha_emision.errors
                 }"

+ 12 - 91
src/app/components/instruments/titulos/titulos.component.ts

@@ -124,6 +124,7 @@ export class TIT implements InstrumentComponent {
   neto_despues_impuesto_porcentaje: any;
   total_ingresos_recibidos: any;
   percentages: any;
+  amortizaciones: string[];
 
   constructor(
     private formBuilder: FormBuilder,
@@ -149,7 +150,9 @@ export class TIT implements InstrumentComponent {
     } else {
       this.hasProjections = false;
     }
-
+    if (!this.instrument_exists) {
+      this.amortizaciones = this.instrument_work.amortizacion_porcentajes;
+    }
     this.investmentProposalForm = this.formBuilder.group({
       costo_transferencia: [
         this.instrument_exists ? "" : this.instrument_work.costo_transferencia,
@@ -406,7 +409,6 @@ export class TIT implements InstrumentComponent {
       this.instrument_work != undefined &&
       this.instrument_work.proyecciones != ""
     ) {
-      console.log("get calcs");
       this.getCalculations(this.investmentProposalForm, false);
     }
   }
@@ -435,46 +437,10 @@ export class TIT implements InstrumentComponent {
       const data = XLSX.utils.sheet_to_json(ws, { header: 1 }); // to get 2d array pass 2nd parameter as object {header: 1}
       const data2 = data.toString().split(",");
       data2.shift();
-
-      console.log(data2); // Data will be logged in array format containing objects
+      this.amortizaciones = data2;
     };
   }
 
-  getDataRecordsArrayFromCSVFile(csvRecordsArray: any, headerLength: any) {
-    let csvArr = [];
-
-    for (let i = 1; i < csvRecordsArray.length; i++) {
-      let curruntRecord = (<string>csvRecordsArray[i]).split(",");
-      if (curruntRecord.length == headerLength) {
-        let csvRecord: CSVRecord = new CSVRecord();
-        csvRecord.id = curruntRecord[0].trim();
-        csvArr.push(csvRecord);
-      }
-    }
-    console.log(csvArr);
-    this.percentages = csvArr["Porcentajes"];
-    console.log(this.percentages);
-    return csvArr;
-  }
-
-  isValidCSVFile(file: any) {
-    return true; //file.name.endsWith(".csv");
-  }
-
-  getHeaderArray(csvRecordsArr: any) {
-    let headers = (<string>csvRecordsArr[0]).split(",");
-    let headerArray = [];
-    for (let j = 0; j < headers.length; j++) {
-      headerArray.push(headers[j]);
-    }
-    return headerArray;
-  }
-
-  fileReset() {
-    this.csvReader.nativeElement.value = "";
-    this.records = [];
-  }
-
   get f() {
     return this.investmentProposalForm.controls;
   }
@@ -491,7 +457,6 @@ export class TIT implements InstrumentComponent {
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
 
-    console.log(form);
     if (!form.valid) {
       return false;
     }
@@ -502,8 +467,8 @@ export class TIT implements InstrumentComponent {
     });
     Swal.showLoading();
     this.instrumentCalcService
-      .bonosCalc(
-        "BONO", // Codigo del instrumento
+      .titularizacionCalc(
+        "TIT", // Codigo del instrumento
         {
           id_tipo_base: +this.general.base_anual,
           id_formato_ingreso: +this.general.formato_ingreso,
@@ -545,14 +510,13 @@ export class TIT implements InstrumentComponent {
           fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
             .singleDate.formatted,
           fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
-            .singleDate.formatted
+            .singleDate.formatted,
+          fecha_emision: this.f.fecha_emision.value.singleDate.formatted,
+          amortizacion_porcentajes: this.amortizaciones
         }
       )
       .subscribe(
         ans => {
-          console.log("---------");
-          console.log(ans);
-
           // Instrumento de compra
           this.comision_casa_compra =
             ans["result"]["instrumento_compra"]["comision_casa_compra"];
@@ -645,50 +609,6 @@ export class TIT implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
-          /*
- "result": {
-        "instrumento_compra": {
-            "comision_casa_compra": 201.3,
-            "comision_bolsa_compra": 30.194999999999997,
-            "fecha_siguiente_cupon_compra": "28/04/2013",
-            "dias_vencimiento_compra": 880,
-            "dias_acumulados_compra": 32,
-            "ytm_vencimiento_comision_porcentaje_compra": 6.565909090909091,
-            "interes_acumulado_compra": 533.3333333333334,
-            "interes_acumulado_porcentaje_compra": 6.000000000000001,
-            "precio_sucio_porcentaje_compra": 106.65,
-            "valor_transado_compra": 100650.0,
-            "monto_pagar": 101419.82833333334,
-            "fecha_inicio_vigencia": "30/4/2013"
-        },
-        "instrumento_venta": {
-            "comision_casa_venta": 50.0,
-            "fecha_siguiente_cupon_venta": "28/10/2022",
-            "dias_vencimiento_venta": 179,
-            "dias_acumulados_venta": 1,
-            "ytm_vencimiento_comision_porcentaje_venta": -0.5229050279329608,
-            "interes_acumulado_venta": 46.875,
-            "interes_acumulado_porcentaje_venta": 6.75,
-            "precio_sucio_porcentaje_venta": 106.74999999999999,
-            "valor_transado_venta": 250000.0,
-            "monto_recibir": 249396.875
-        },
-        "resultado_operacion": {
-            "valor_nominal_compra": 100000.0,
-            1"dias_tenencia_total": 3389,
-            "precio_compra": 100.64999999999999,
-            "precio_venta": 100.0,
-            1"ganancia_perdida_capital": 149350.0,
-            1"ingresos_intereses": 13726.875,
-            1"costos_totales": -886.495,
-            1"ganancia_perdida_total": 162190.38,
-            1"ganancia_perdida_capital_porcentaje": 15.864856889938034,
-            1"intereses_porcentaje": 1.458151372086161,
-            1"neto_antes_impuesto_porcentaje": 17.22883942165831,
-            1"1neto_despues_impuesto_porcentaje": 17.067375863086458,
-            1"total_ingresos_recibidos": 13680.0
-        },
-*/
           this.titulosObject = {
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,
@@ -732,7 +652,7 @@ export class TIT implements InstrumentComponent {
               .singleDate.formatted,
             fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
               .singleDate.formatted,
-
+            fecha_emision: this.f.fecha_emision.value.singleDate.formatted,
             // Instrumento de compra
 
             comision_casa_compra: this.comision_casa_compra,
@@ -778,6 +698,7 @@ export class TIT implements InstrumentComponent {
               .neto_despues_impuesto_porcentaje,
             total_ingresos_recibidos: this.total_ingresos_recibidos,
 
+            amortizacion_porcentajes: this.amortizaciones,
             // Proyecciones
             proyecciones: this.proyecciones
           };

+ 21 - 6
src/app/components/investment-proposals/investment-proposals.component.html

@@ -39,17 +39,26 @@
           <br />
           <div class="example-container mat-elevation-z8">
             <div class="example-table-container">
-              <table mat-table [dataSource]="dataSource" class="example-table">
+              <table
+                mat-table
+                [dataSource]="dataSource"
+                matSort
+                class="example-table"
+              >
                 <!-- Name Column -->
                 <ng-container matColumnDef="codigo_inversion">
-                  <th mat-header-cell *matHeaderCellDef>Codigo</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Codigo
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.codigo_inversion }}
                   </td>
                 </ng-container>
                 <!-- Country Column -->
                 <ng-container matColumnDef="asunto">
-                  <th mat-header-cell *matHeaderCellDef>Asunto</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Asunto
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.asunto }}
                   </td>
@@ -57,7 +66,9 @@
 
                 <!-- Country Column -->
                 <ng-container matColumnDef="id_empresa">
-                  <th mat-header-cell *matHeaderCellDef>Empresa</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Empresa
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{
                       row.id_empresa == "" || row.id_empresa == undefined
@@ -69,7 +80,9 @@
 
                 <!-- Country Column -->
                 <ng-container matColumnDef="id_inversion_instrumento">
-                  <th mat-header-cell *matHeaderCellDef>Instrumento</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Instrumento
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{
                       row.id_inversion_instrumento.id_tipo_instrumento == "" ||
@@ -83,7 +96,9 @@
                 </ng-container>
 
                 <ng-container matColumnDef="id_estado_inversion">
-                  <th mat-header-cell *matHeaderCellDef>Estado</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Estado
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{
                       row.id_estado_inversion == "" ||

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

@@ -76,11 +76,14 @@
 
                     <select
                       class="custom-select"
+                      (change)="onChangePaymentType($event.target.value)"
                       formControlName="tipo_pago"
                       [ngClass]="{
                         'is-invalid': submitted && f.tipo_pago.errors
                       }"
                     >
+                      <option value=""></option>
+
                       <option
                         *ngFor="let item of payment_types"
                         [value]="item.id_tipo_pago"
@@ -129,6 +132,50 @@
                   </div>
                 </div>
 
+                <div class="col-lg-6 col-sm-12 pr-xl-3" *ngIf="payment_check">
+                  <div class="form-group">
+                    <label for="emitir_nombre">Emitir a nombre: </label>
+                    <div class="input-box-container">
+                      <p>
+                        <i class="fas fa-dollar-sign"></i>
+                      </p>
+                      <input
+                        type="text"
+                        formControlName="emitir_nombre"
+                        class="form-control"
+                      />
+                    </div>
+                  </div>
+                </div>
+
+                <div
+                  class="col-lg-6 col-sm-12 pr-xl-3"
+                  *ngIf="payment_transfer"
+                >
+                  <div class="form-group">
+                    <label for="cuenta_bancaria_destino"
+                      >Cuenta bancaria destino:
+                    </label>
+
+                    <select
+                      class="custom-select"
+                      formControlName="cuenta_bancaria_destino"
+                      [ngClass]="{
+                        'is-invalid':
+                          submitted && f.cuenta_bancaria_destino.errors
+                      }"
+                    >
+                      <option
+                        *ngFor="let item of accounts"
+                        [value]="item.id_cuenta_bancaria_destino"
+                      >
+                        {{ nameBankAccounts(item.id_banco) }} -
+                        {{ item.nombre }}</option
+                      >
+                    </select>
+                  </div>
+                </div>
+
                 <!-- Fecha vencimiento -->
                 <div class="col-lg-6 col-sm-12 pr-xl-3">
                   <div class="form-group">

+ 33 - 3
src/app/components/investment-proposals/payment-info/payment-info.component.ts

@@ -75,6 +75,8 @@ export class PaymentInfoComponent implements OnInit {
   generated_inputs_next: any;
   userListNext: any;
   investmentService: any;
+  payment_check: boolean;
+  payment_transfer: boolean;
 
   constructor(
     private router: Router,
@@ -128,7 +130,9 @@ export class PaymentInfoComponent implements OnInit {
             monto: this.inversionAmount,
             tipo_pago: "",
             cuenta_bancaria: "",
-            fecha_vencimiento: ""
+            fecha_vencimiento: "",
+            cuenta_bancaria_destino: "",
+            emitir_nombre: ""
           });
         },
         err => {
@@ -164,10 +168,25 @@ export class PaymentInfoComponent implements OnInit {
       ],
       tipo_pago: ["", Validators.required],
       cuenta_bancaria: ["", Validators.required],
-      fecha_vencimiento: ["", Validators.required]
+      fecha_vencimiento: ["", Validators.required],
+      cuenta_bancaria_destino: [""],
+      emitir_nombre: [""]
     });
   }
 
+  onChangePaymentType(event: any) {
+    if (event == 2) {
+      this.payment_check = true;
+      this.payment_transfer = false;
+    } else if (event == 3) {
+      this.payment_transfer = true;
+      this.payment_check = false;
+    } else {
+      this.payment_check = false;
+      this.payment_transfer = false;
+    }
+  }
+
   get f() {
     return this.investmentProposalForm.controls;
   }
@@ -237,14 +256,25 @@ export class PaymentInfoComponent implements OnInit {
               this.paymentObject = {
                 monto: this.investmentProposalForm.value.monto,
                 id_tipo_pago: this.investmentProposalForm.value.tipo_pago,
-                id_cuenta_bancaria_destino: this.investmentProposalForm.value
+                id_cuenta_bancaria: this.investmentProposalForm.value
                   .cuenta_bancaria,
+
                 //fecha_pago: this.investmentProposalForm.value.fecha_pago.singleDate.formatted,
                 fecha_vencimiento: this.investmentProposalForm.value
                   .fecha_vencimiento.singleDate.formatted,
                 id_inversion: this.investmentProposalID
               };
 
+              if (this.investmentProposalForm.value.tipo_pago == 2) {
+                this.paymentObject[
+                  "emitir_nombre"
+                ] = this.investmentProposalForm.value.emitir_nombre;
+              } else if (this.investmentProposalForm.value.tipo_pago == 3) {
+                this.paymentObject[
+                  "id_cuenta_bancaria_destino"
+                ] = this.investmentProposalForm.value.cuenta_bancaria_destino;
+              }
+
               this.investmentsService
                 .sendPaymentInfoProposalInvestment(
                   this.investmentProposalID,

+ 1 - 29
src/app/components/investments/costs/dap/dap.costs.component.ts

@@ -79,9 +79,6 @@ export class DAPCostsComponent implements OnInit {
       this.authService.getJwtToken()
     );
     this.userRole = decodedToken.groups;
-    //    console.log("User role");
-    //  console.log(this.userRole);
-    //console.log(this.userRole.length == 0);
 
     Swal.fire({
       allowOutsideClick: false,
@@ -176,29 +173,7 @@ export class DAPCostsComponent implements OnInit {
 
             this.form = new FormArray(this.buildForm(this.proyecciones));
             this.dataRetrieved = true;
-            /*
-            this.array1 = [];
-            this.array2 = [];
-
-            for (var i = 0; i < this.proyecciones.length; i++) {
-              this.array2 = [];
-              for (const prop2 of Object.keys(this.proyecciones[i])) {
-                this.array3 = [];
-                formDataObj[prop2] = new FormControl(
-                  this.proyecciones[i][prop2]
-                );
-                this.proyeccionesProps.push(prop2);
-
-                this.array3.push(prop2);
-                this.array2.push(this.array3);
-              }
-              this.array1.push(this.array2);
-            }
-            console.log(this.array1);
-
-            this.form = new FormGroup(formDataObj);
-            console.log(this.form);
-            */
+
             this.dataRetrieved = true;
           },
           err => {
@@ -219,8 +194,6 @@ export class DAPCostsComponent implements OnInit {
   submitInstrumentChanges() {}
 
   submitProjectionChanges() {
-    console.log("submit");
-    console.log(this.form.value);
     let objProjection = { proyecciones: this.form.value };
     Swal.fire({
       allowOutsideClick: false,
@@ -241,7 +214,6 @@ export class DAPCostsComponent implements OnInit {
               title: "Exito",
               confirmButtonText: "La información ha sido actualizada"
             }).then(result => {
-              console.log(result);
               Swal.close();
               //window.location.reload();
             });

+ 0 - 4
src/app/components/investments/costs/pbur/pbur.costs.component.ts

@@ -233,8 +233,6 @@ export class PBURCostsComponent implements OnInit {
   submitInstrumentChanges() {}
 
   submitProjectionChanges() {
-    console.log("submit");
-    console.log(this.form.value);
     let objProjection = { proyecciones: this.form.value };
     Swal.fire({
       allowOutsideClick: false,
@@ -247,7 +245,6 @@ export class PBURCostsComponent implements OnInit {
       .projectionCalc(this.investmentProposalID, this.form.value)
       .subscribe(
         resp => {
-          console.log(resp);
           this.investmentsService
             .updateInstrumentProjection(
               this.investmentProposalID,
@@ -263,7 +260,6 @@ export class PBURCostsComponent implements OnInit {
                     title: "Exito",
                     confirmButtonText: "La información ha sido actualizada"
                   }).then(result => {
-                    console.log(result);
                     Swal.close();
                     //window.location.reload();
                   });

+ 0 - 5
src/app/components/investments/costs/vcn/vcn.costs.component.ts

@@ -108,7 +108,6 @@ export class VCNCostsComponent implements OnInit {
         .subscribe(
           res => {
             this.investment = res["result"];
-            console.log(this.investment);
             this.instrument_work =
               res["result"]["id_inversion_instrumento"]["instrumento"];
             this.instrument_exists = true;
@@ -234,8 +233,6 @@ export class VCNCostsComponent implements OnInit {
   submitInstrumentChanges() {}
 
   submitProjectionChanges() {
-    console.log("submit");
-    console.log(this.form.value);
     let objProjection = { proyecciones: this.form.value };
     Swal.fire({
       allowOutsideClick: false,
@@ -248,7 +245,6 @@ export class VCNCostsComponent implements OnInit {
       .projectionCalc(this.investmentProposalID, this.form.value)
       .subscribe(
         resp => {
-          console.log(resp);
           this.investmentsService
             .updateInstrumentProjection(
               this.investmentProposalID,
@@ -264,7 +260,6 @@ export class VCNCostsComponent implements OnInit {
                     title: "Exito",
                     confirmButtonText: "La información ha sido actualizada"
                   }).then(result => {
-                    console.log(result);
                     Swal.close();
                     //window.location.reload();
                   });

+ 21 - 9
src/app/components/investments/investments.component.html

@@ -32,38 +32,50 @@
           <br />
           <div class="example-container mat-elevation-z8">
             <div class="example-table-container table-responsive">
-              <table mat-table [dataSource]="dataSource" class="example-table">
+              <table
+                mat-table
+                [dataSource]="dataSource"
+                matSort
+                class="example-table"
+              >
                 <!-- Name Column -->
                 <ng-container matColumnDef="codigo_inversion">
-                  <th mat-header-cell *matHeaderCellDef>Codigo</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Codigo
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.codigo_inversion }}
                   </td>
                 </ng-container>
                 <!-- Country Column -->
                 <ng-container matColumnDef="asunto">
-                  <th mat-header-cell *matHeaderCellDef>Asunto</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Asunto
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{ row.asunto }}
                   </td>
                 </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 mat-sort-header>
+                    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>
 
                 <!-- Country Column -->
                 <ng-container matColumnDef="id_inversion_instrumento">
-                  <th mat-header-cell *matHeaderCellDef>Instrumento</th>
+                  <th mat-header-cell *matHeaderCellDef mat-sort-header>
+                    Instrumento
+                  </th>
                   <td mat-cell *matCellDef="let row">
                     {{
                       row.id_inversion_instrumento.id_tipo_instrumento == "" ||

+ 1 - 6
src/app/components/investments/investments.component.ts

@@ -25,7 +25,7 @@ export class InvestmentsComponent implements OnInit {
   displayedColumns: string[] = [
     "codigo_inversion",
     "asunto",
-    "id_tipo_mercado",
+    "id_empresa",
     "id_inversion_instrumento",
     "id"
   ];
@@ -54,9 +54,6 @@ export class InvestmentsComponent implements OnInit {
       this.authService.getJwtToken()
     );
     this.userRole = decodedToken.groups;
-    //    console.log("User role");
-    //  console.log(this.userRole);
-    //console.log(this.userRole.length == 0);
 
     this.dataSource.filterPredicate = (data, filter) => {
       const dataStr =
@@ -88,9 +85,7 @@ export class InvestmentsComponent implements OnInit {
             proposals["id_estado_inversion"]["codigo"] == "FINAL"
         );
 
-        console.log(this.listProposals);
         this.dataSource.data = this.listProposals;
-
         this.dataSource.paginator = this.paginator;
         this.dataSource.sort = this.sort;
       },

+ 0 - 1
src/app/components/shared/sidebar/sidebar.component.spec.ts

@@ -39,7 +39,6 @@ describe("SidebarComponent", () => {
     let existe = false;
 
     for (const elem of elementos) {
-      console.log(elem.attributes);
       if (elem.attributes["ng-reflect-router-link"] === "/dashboard") {
         existe = true;
         break;

+ 4 - 1
src/app/layouts/admin/admin.module.ts

@@ -12,7 +12,7 @@ import { ProfileComponent } from "../../components/profile/profile.component";
 
 import { PluginsModule } from "../../components/plugins/plugins.module";
 
-import { MatDialogModule } from "@angular/material";
+import { MatDialogModule, MatPaginatorIntl } from "@angular/material";
 import { BrowserModule } from "@angular/platform-browser";
 import { NoopAnimationsModule } from "@angular/platform-browser/animations";
 
@@ -80,6 +80,7 @@ import { PaymentApprovalComponent } from "@app/components/investment-proposals/p
 import { TIT } from "@app/components/instruments/titulos/titulos.component";
 import { EURB } from "@app/components/instruments/eurobonos/eurobonos.component";
 import { CINV } from "@app/components/instruments/certificados/certificados.component";
+import { MatPaginatorIntlSpa } from "@app/models/i18n-paginator";
 
 // This array defines which "componentId" maps to which lazy-loaded module.
 
@@ -108,6 +109,8 @@ import { CINV } from "@app/components/instruments/certificados/certificados.comp
     WavesModule
   ],
   providers: [
+    { provide: MatPaginatorIntl, useClass: MatPaginatorIntlSpa },
+
     WorkflowGuard,
     {
       provide: FormInvestmentProposalService,

+ 20 - 0
src/app/models/i18n-paginator.ts

@@ -0,0 +1,20 @@
+import { MatPaginatorIntl } from "@angular/material";
+export class MatPaginatorIntlSpa extends MatPaginatorIntl {
+  itemsPerPageLabel = "Registros por página";
+  nextPageLabel = "Siguiente";
+  previousPageLabel = "Anterior";
+
+  getRangeLabel = function(page, pageSize, length) {
+    if (length === 0 || pageSize === 0) {
+      return "0 de " + length;
+    }
+    length = Math.max(length, 0);
+    const startIndex = page * pageSize;
+    // If the start index exceeds the list length, do not try and fix the end index to the end.
+    const endIndex =
+      startIndex < length
+        ? Math.min(startIndex + pageSize, length)
+        : startIndex + pageSize;
+    return startIndex + 1 + " - " + endIndex + " de " + length;
+  };
+}