|
@@ -28,7 +28,8 @@ import {
|
|
|
})
|
|
})
|
|
|
export class VCNCostsComponent implements OnInit {
|
|
export class VCNCostsComponent implements OnInit {
|
|
|
helper = new JwtHelperService();
|
|
helper = new JwtHelperService();
|
|
|
-
|
|
|
|
|
|
|
+ price:string;
|
|
|
|
|
+ value:any;
|
|
|
title: string = "Costos para valores comerciales";
|
|
title: string = "Costos para valores comerciales";
|
|
|
|
|
|
|
|
displayedColumns: string[] = [
|
|
displayedColumns: string[] = [
|
|
@@ -229,9 +230,47 @@ export class VCNCostsComponent implements OnInit {
|
|
|
Swal.close();
|
|
Swal.close();
|
|
|
}, 1200);
|
|
}, 1200);
|
|
|
}
|
|
}
|
|
|
|
|
+ clearProyeccion(proyecciones,nombres,tipoDato){
|
|
|
|
|
+ let clearPro = []
|
|
|
|
|
+
|
|
|
|
|
+ proyecciones.forEach(createNewProyeccion);
|
|
|
|
|
+
|
|
|
|
|
+ function createNewProyeccion(arrFila, index) {
|
|
|
|
|
+ nombres.forEach(loopNombres);
|
|
|
|
|
+
|
|
|
|
|
+ function loopNombres(nombre, index) {
|
|
|
|
|
+
|
|
|
|
|
+ arrFila[nombre] = parseFloat(arrFila[nombre].toString().replace(",",""))
|
|
|
|
|
+ }
|
|
|
|
|
+ clearPro.push(arrFila)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return clearPro;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public inputValidator(event: any) {
|
|
|
|
|
+ //console.log(event.target.value);
|
|
|
|
|
+ const pattern = /^[0-9]*$/;
|
|
|
|
|
+ //let inputChar = String.fromCharCode(event.charCode)
|
|
|
|
|
+
|
|
|
|
|
+ if (!pattern.test(event.target.value)) {
|
|
|
|
|
+
|
|
|
|
|
+ event.target.value = event.target.value.replace(/[^\d,.]+/g, '');
|
|
|
|
|
+ // invalid character, prevent input
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
recalculateProjectionChanges() {
|
|
recalculateProjectionChanges() {
|
|
|
- let objProjection = { proyecciones: this.form.value };
|
|
|
|
|
|
|
+ let nombresProyecciones = ["costo_transferencia",
|
|
|
|
|
+ "costo_cedeval",
|
|
|
|
|
+ "costo_banco",
|
|
|
|
|
+ "otros_costos"]
|
|
|
|
|
+ let clearPro = this.clearProyeccion(this.form.value,nombresProyecciones,"decimal")
|
|
|
|
|
+ let objProjection = { proyecciones: clearPro };
|
|
|
|
|
+
|
|
|
Swal.fire({
|
|
Swal.fire({
|
|
|
allowOutsideClick: false,
|
|
allowOutsideClick: false,
|
|
|
icon: "info",
|
|
icon: "info",
|
|
@@ -253,6 +292,7 @@ export class VCNCostsComponent implements OnInit {
|
|
|
this.proyecciones.pop();
|
|
this.proyecciones.pop();
|
|
|
this.form.clear();
|
|
this.form.clear();
|
|
|
this.form = new FormArray(this.buildForm(this.proyecciones));
|
|
this.form = new FormArray(this.buildForm(this.proyecciones));
|
|
|
|
|
+
|
|
|
Swal.close();
|
|
Swal.close();
|
|
|
//window.location.reload();
|
|
//window.location.reload();
|
|
|
},
|
|
},
|
|
@@ -265,7 +305,7 @@ export class VCNCostsComponent implements OnInit {
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
saveProjection() {
|
|
saveProjection() {
|
|
|
let objProjection = { proyecciones: this.form.value };
|
|
let objProjection = { proyecciones: this.form.value };
|
|
|
Swal.fire({
|
|
Swal.fire({
|