Ver código fonte

ajuste en guardado de proyecciones en propuestas de inversion

Oscar José Nuñez Chávez 5 anos atrás
pai
commit
8d13b64847

+ 10 - 5
src/app/components/instruments/bonos/bonos.component.ts

@@ -147,7 +147,10 @@ export class BONO implements InstrumentComponent {
       this.instrument_work.proyecciones != ""
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
       this.operation_results_work = this.instrument_work["resultado_operacion"];
 
       if (this.instrument_work["instrumento"] != undefined) {
@@ -537,13 +540,15 @@ export class BONO implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
             this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           this.operation_result = true;
-          this.dataSource.data = this.proyecciones;
-          this.dataSource2.data = this.proyecciones;
+          this.dataSource.data = this.proyecciones.slice(0, -1);
+          this.dataSource2.data = this.proyecciones.slice(0, -1);
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 

+ 8 - 4
src/app/components/instruments/certificados/certificados.component.ts

@@ -147,7 +147,10 @@ export class CINV implements InstrumentComponent {
       this.instrument_work.proyecciones != ""
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
       this.operation_results_work = this.instrument_work["resultado_operacion"];
 
       if (this.instrument_work["instrumento"] != undefined) {
@@ -538,9 +541,10 @@ export class CINV implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
-            this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           this.operation_result = true;

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

@@ -95,7 +95,10 @@ export class CETE implements InstrumentComponent {
   dataSource2 = new MatTableDataSource(this.proyecciones);
   hasProjections: boolean;
   fecha_vencimiento: any;
-  consolidado_proyeccion: any;
+  consolidado_proyeccion = {
+    total_ingreso_bruto: 0,
+    total_ingreso_neto: 0
+  };
 
   constructor(
     private formBuilder: FormBuilder,
@@ -115,10 +118,13 @@ export class CETE implements InstrumentComponent {
         this.instrument_work != undefined)
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
       this.dataSource2.data = this.instrument_work.proyecciones;
       this.dataSource2.paginator = this.paginator;
       this.dataSource2.sort = this.sort;
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
     } else {
       this.hasProjections = false;
     }
@@ -292,13 +298,14 @@ export class CETE implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
           this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
 
-          this.dataSource.data = this.proyecciones;
-          this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
             this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
+          this.dataSource.data = this.proyecciones.slice(0, -1);
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 

+ 15 - 5
src/app/components/instruments/dap/dap.component.ts

@@ -93,7 +93,11 @@ export class DAP implements InstrumentComponent {
   hasProjections: boolean;
   numero_certificado: any;
   fecha_vencimiento: any;
-  consolidado_proyeccion: any;
+  consolidado_proyeccion = {
+    total_ingreso_bruto: 0,
+    total_renta: 0,
+    total_ingreso_neto: 0
+  };
 
   constructor(
     private formBuilder: FormBuilder,
@@ -113,10 +117,13 @@ export class DAP implements InstrumentComponent {
         this.instrument_work != undefined)
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
       this.dataSource2.data = this.instrument_work.proyecciones;
       this.dataSource2.paginator = this.paginator;
       this.dataSource2.sort = this.sort;
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
     } else {
       this.hasProjections = false;
     }
@@ -227,13 +234,16 @@ export class DAP implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
           this.numero_certificado = ans["result"]["numero_certificado"];
           this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
+
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
             this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
-          this.dataSource.data = this.proyecciones;
+          this.dataSource.data = this.proyecciones.slice(0, -1);
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 

+ 10 - 6
src/app/components/instruments/eurobonos/eurobonos.component.ts

@@ -147,7 +147,10 @@ export class EURB implements InstrumentComponent {
       this.instrument_work.proyecciones != ""
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
       this.operation_results_work = this.instrument_work["resultado_operacion"];
 
       if (this.instrument_work["instrumento"] != undefined) {
@@ -537,14 +540,15 @@ export class EURB implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
-            this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           this.operation_result = true;
-          this.dataSource.data = this.proyecciones;
-          this.dataSource2.data = this.proyecciones;
+          this.dataSource.data = this.proyecciones.slice(0, -1);
+          this.dataSource2.data = this.proyecciones.slice(0, -1);
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 

+ 4 - 2
src/app/components/instruments/fondos/fondos.component.ts

@@ -322,8 +322,10 @@ export class FINV implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
             this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           this.operation_result = true;

+ 12 - 4
src/app/components/instruments/pbur/pbur.component.ts

@@ -92,7 +92,15 @@ export class PBUR implements InstrumentComponent {
 
   dataSource = new MatTableDataSource(this.proyecciones);
   dataSource2 = new MatTableDataSource(this.proyecciones);
-  consolidado_proyeccion: any;
+  consolidado_proyeccion = {
+    total_ingreso_bruto: 0,
+    total_ingreso_neto: 0,
+    total_costo_cedeval: 0,
+    total_renta: 0,
+    total_costo_transferencia: 0,
+    total_costo_banco: 0,
+    total_otros_costos: 0
+  };
 
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
   @ViewChild(MatSort, { static: true }) sort: MatSort;
@@ -115,10 +123,10 @@ export class PBUR implements InstrumentComponent {
       this.instrument_work.proyecciones != undefined
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
       this.dataSource2.data = this.instrument_work.proyecciones;
       this.dataSource2.paginator = this.paginator;
       this.dataSource2.sort = this.sort;
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
     } else {
       this.hasProjections = false;
     }
@@ -305,8 +313,8 @@ export class PBUR implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
 
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            this.consolidado_proyeccion = this.proyecciones.pop();
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           if (this.f.valor_par.value == true) {

+ 10 - 6
src/app/components/instruments/titulos/titulos.component.ts

@@ -156,7 +156,10 @@ export class TIT implements InstrumentComponent {
       this.instrument_work.proyecciones != ""
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
       this.operation_results_work = this.instrument_work["resultado_operacion"];
 
       if (this.instrument_work["instrumento"] != undefined) {
@@ -605,13 +608,14 @@ export class TIT implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
-            this.hasProjections = true;
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            let proyecciones_temp = this.proyecciones;
+            this.consolidado_proyeccion =
+              proyecciones_temp[proyecciones_temp.length - 1];
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
-          this.dataSource.data = this.proyecciones;
-          this.dataSource2.data = this.proyecciones;
+          this.dataSource.data = this.proyecciones.slice(0, -1);
+          this.dataSource2.data = this.proyecciones.slice(0, -1);
 
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;

+ 15 - 4
src/app/components/instruments/vcn/vcn.component.ts

@@ -94,7 +94,15 @@ export class VCN implements InstrumentComponent {
   @ViewChild(MatSort, { static: true }) sort: MatSort;
   dataSource = new MatTableDataSource(this.proyecciones);
   dataSource2 = new MatTableDataSource(this.proyecciones);
-  consolidado_proyeccion: any;
+  consolidado_proyeccion = {
+    total_ingreso_bruto: 0,
+    total_ingreso_neto: 0,
+    total_costo_cedeval: 0,
+    total_renta: 0,
+    total_costo_transferencia: 0,
+    total_costo_banco: 0,
+    total_otros_costos: 0
+  };
 
   constructor(
     private formBuilder: FormBuilder,
@@ -114,10 +122,13 @@ export class VCN implements InstrumentComponent {
       this.instrument_work.proyecciones != undefined
     ) {
       this.hasProjections = true;
-      this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
       this.dataSource2.data = this.instrument_work.proyecciones;
       this.dataSource2.paginator = this.paginator;
       this.dataSource2.sort = this.sort;
+      this.consolidado_proyeccion = this.instrument_work.proyecciones.slice(
+        0,
+        -1
+      );
     } else {
       this.hasProjections = false;
     }
@@ -314,8 +325,8 @@ export class VCN implements InstrumentComponent {
           this.proyecciones = ans["result"]["proyecciones"];
 
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
-            //this.consolidado_proyeccion = this.proyecciones.pop();
-            this.proyecciones;
+            this.consolidado_proyeccion = this.proyecciones.slice(0, -1);
+            this.proyecciones = ans["result"]["proyecciones"];
           }
 
           if (this.f.valor_par.value == true) {