|
@@ -28,8 +28,8 @@ import {
|
|
|
})
|
|
})
|
|
|
export class VCNCostsComponent implements OnInit {
|
|
export class VCNCostsComponent implements OnInit {
|
|
|
helper = new JwtHelperService();
|
|
helper = new JwtHelperService();
|
|
|
- price:string;
|
|
|
|
|
- value:any;
|
|
|
|
|
|
|
+ price: string;
|
|
|
|
|
+ value: any;
|
|
|
title: string = "Costos para valores comerciales";
|
|
title: string = "Costos para valores comerciales";
|
|
|
|
|
|
|
|
displayedColumns: string[] = [
|
|
displayedColumns: string[] = [
|
|
@@ -112,94 +112,6 @@ export class VCNCostsComponent implements OnInit {
|
|
|
this.instrument_work =
|
|
this.instrument_work =
|
|
|
res["result"]["id_inversion_instrumento"]["instrumento"];
|
|
res["result"]["id_inversion_instrumento"]["instrumento"];
|
|
|
this.instrument_exists = true;
|
|
this.instrument_exists = true;
|
|
|
-
|
|
|
|
|
- this.investmentProposalForm = this.formBuilder.group({
|
|
|
|
|
- valor_par: [
|
|
|
|
|
- !this.instrument_exists ? false : this.instrument_work.valor_par
|
|
|
|
|
- ],
|
|
|
|
|
- valor_nominal: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : 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,
|
|
|
|
|
- [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
|
|
|
|
|
- ],
|
|
|
|
|
- plazo: [
|
|
|
|
|
- !this.instrument_exists ? "" : this.instrument_work.plazo,
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],
|
|
|
|
|
- renta_porcentaje: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.renta_porcentaje,
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],
|
|
|
|
|
- comision_casa_porcentaje: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.comision_casa_porcentaje,
|
|
|
|
|
- [
|
|
|
|
|
- Validators.required,
|
|
|
|
|
- Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
|
|
- ]
|
|
|
|
|
- ],
|
|
|
|
|
- comision_bolsa_porcentaje: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.comision_bolsa_porcentaje,
|
|
|
|
|
- [
|
|
|
|
|
- Validators.required,
|
|
|
|
|
- Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
|
|
- ]
|
|
|
|
|
- ],
|
|
|
|
|
- rendimiento_bruto: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : 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,
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],*/
|
|
|
|
|
- fecha_liquidacion: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.fecha_liquidacion,
|
|
|
|
|
-
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],
|
|
|
|
|
- fecha_vencimiento: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.fecha_vencimiento,
|
|
|
|
|
-
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],
|
|
|
|
|
- fecha_operacion: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.fecha_operacion,
|
|
|
|
|
-
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ],
|
|
|
|
|
- fecha_ultima_cupon: [
|
|
|
|
|
- !this.instrument_exists
|
|
|
|
|
- ? ""
|
|
|
|
|
- : this.instrument_work.fecha_ultima_cupon,
|
|
|
|
|
-
|
|
|
|
|
- [Validators.required]
|
|
|
|
|
- ]
|
|
|
|
|
- });
|
|
|
|
|
},
|
|
},
|
|
|
err => {}
|
|
err => {}
|
|
|
);
|
|
);
|
|
@@ -230,47 +142,50 @@ export class VCNCostsComponent implements OnInit {
|
|
|
Swal.close();
|
|
Swal.close();
|
|
|
}, 1200);
|
|
}, 1200);
|
|
|
}
|
|
}
|
|
|
- clearProyeccion(proyecciones,nombres,tipoDato){
|
|
|
|
|
- let clearPro = []
|
|
|
|
|
|
|
+ clearProyeccion(proyecciones, nombres, tipoDato) {
|
|
|
|
|
+ let clearPro = [];
|
|
|
|
|
|
|
|
- proyecciones.forEach(createNewProyeccion);
|
|
|
|
|
-
|
|
|
|
|
- function createNewProyeccion(arrFila, index) {
|
|
|
|
|
- nombres.forEach(loopNombres);
|
|
|
|
|
-
|
|
|
|
|
- function loopNombres(nombre, index) {
|
|
|
|
|
|
|
+ proyecciones.forEach(createNewProyeccion);
|
|
|
|
|
|
|
|
- arrFila[nombre] = parseFloat(arrFila[nombre].toString().replace(",",""))
|
|
|
|
|
- }
|
|
|
|
|
- clearPro.push(arrFila)
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ function createNewProyeccion(arrFila, index) {
|
|
|
|
|
+ nombres.forEach(loopNombres);
|
|
|
|
|
|
|
|
- return clearPro;
|
|
|
|
|
|
|
+ function loopNombres(nombre, index) {
|
|
|
|
|
+ arrFila[nombre] = parseFloat(
|
|
|
|
|
+ arrFila[nombre].toString().replace(",", "")
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ clearPro.push(arrFila);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return clearPro;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public inputValidator(event: any) {
|
|
public inputValidator(event: any) {
|
|
|
//console.log(event.target.value);
|
|
//console.log(event.target.value);
|
|
|
- const pattern = /^[0-9]*$/;
|
|
|
|
|
|
|
+ const pattern = /^[0-9]*$/;
|
|
|
//let inputChar = String.fromCharCode(event.charCode)
|
|
//let inputChar = String.fromCharCode(event.charCode)
|
|
|
-
|
|
|
|
|
- if (!pattern.test(event.target.value)) {
|
|
|
|
|
|
|
|
|
|
- event.target.value = event.target.value.replace(/[^\d,.]+/g, '');
|
|
|
|
|
|
|
+ if (!pattern.test(event.target.value)) {
|
|
|
|
|
+ event.target.value = event.target.value.replace(/[^\d,.]+/g, "");
|
|
|
// invalid character, prevent input
|
|
// invalid character, prevent input
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
recalculateProjectionChanges() {
|
|
recalculateProjectionChanges() {
|
|
|
- let nombresProyecciones = ["costo_transferencia",
|
|
|
|
|
- "costo_cedeval",
|
|
|
|
|
- "costo_banco",
|
|
|
|
|
- "otros_costos"]
|
|
|
|
|
- let clearPro = this.clearProyeccion(this.form.value,nombresProyecciones,"decimal")
|
|
|
|
|
|
|
+ let nombresProyecciones = [
|
|
|
|
|
+ "costo_transferencia",
|
|
|
|
|
+ "costo_cedeval",
|
|
|
|
|
+ "costo_banco",
|
|
|
|
|
+ "otros_costos"
|
|
|
|
|
+ ];
|
|
|
|
|
+ let clearPro = this.clearProyeccion(
|
|
|
|
|
+ this.form.value,
|
|
|
|
|
+ nombresProyecciones,
|
|
|
|
|
+ "decimal"
|
|
|
|
|
+ );
|
|
|
let objProjection = { proyecciones: clearPro };
|
|
let objProjection = { proyecciones: clearPro };
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Swal.fire({
|
|
Swal.fire({
|
|
|
allowOutsideClick: false,
|
|
allowOutsideClick: false,
|
|
|
icon: "info",
|
|
icon: "info",
|
|
@@ -305,7 +220,7 @@ export class VCNCostsComponent implements OnInit {
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
saveProjection() {
|
|
saveProjection() {
|
|
|
let objProjection = { proyecciones: this.form.value };
|
|
let objProjection = { proyecciones: this.form.value };
|
|
|
Swal.fire({
|
|
Swal.fire({
|