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