|
@@ -73,6 +73,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
plazo: number = 0;
|
|
plazo: number = 0;
|
|
|
interes_acumulado: number = 0;
|
|
interes_acumulado: number = 0;
|
|
|
fecha_inicio_vigencia: string;
|
|
fecha_inicio_vigencia: string;
|
|
|
|
|
+ instrumentSaved: boolean;
|
|
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
|
private formBuilder: FormBuilder,
|
|
private formBuilder: FormBuilder,
|
|
@@ -84,7 +85,9 @@ export class PBUR implements InstrumentComponent {
|
|
|
) {
|
|
) {
|
|
|
this.instrument_work = this.formDataService.getWork();
|
|
this.instrument_work = this.formDataService.getWork();
|
|
|
this.instrument_exists = this.instrument_work == undefined;
|
|
this.instrument_exists = this.instrument_work == undefined;
|
|
|
-
|
|
|
|
|
|
|
+ console.log(this.instrument_work);
|
|
|
|
|
+ console.log("instrument exists");
|
|
|
|
|
+ console.log(this.instrument_exists);
|
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
|
|
|
|
|
|
//getIncomeFormat
|
|
//getIncomeFormat
|
|
@@ -149,7 +152,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
singleDate: {
|
|
singleDate: {
|
|
|
jsDate: parse(
|
|
jsDate: parse(
|
|
|
this.instrument_work.fecha_liquidacion,
|
|
this.instrument_work.fecha_liquidacion,
|
|
|
- "dd/MM/yyyy HH:mm:ss",
|
|
|
|
|
|
|
+ "dd/MM/yyyy",
|
|
|
new Date()
|
|
new Date()
|
|
|
),
|
|
),
|
|
|
formatted: this.instrument_work.fecha_liquidacion
|
|
formatted: this.instrument_work.fecha_liquidacion
|
|
@@ -165,7 +168,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
singleDate: {
|
|
singleDate: {
|
|
|
jsDate: parse(
|
|
jsDate: parse(
|
|
|
this.instrument_work.fecha_vencimiento,
|
|
this.instrument_work.fecha_vencimiento,
|
|
|
- "dd/MM/yyyy HH:mm:ss",
|
|
|
|
|
|
|
+ "dd/MM/yyyy",
|
|
|
new Date()
|
|
new Date()
|
|
|
),
|
|
),
|
|
|
formatted: this.instrument_work.fecha_vencimiento
|
|
formatted: this.instrument_work.fecha_vencimiento
|
|
@@ -181,7 +184,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
singleDate: {
|
|
singleDate: {
|
|
|
jsDate: parse(
|
|
jsDate: parse(
|
|
|
this.instrument_work.fecha_operacion,
|
|
this.instrument_work.fecha_operacion,
|
|
|
- "dd/MM/yyyy HH:mm:ss",
|
|
|
|
|
|
|
+ "dd/MM/yyyy",
|
|
|
new Date()
|
|
new Date()
|
|
|
),
|
|
),
|
|
|
formatted: this.instrument_work.fecha_operacion
|
|
formatted: this.instrument_work.fecha_operacion
|
|
@@ -197,7 +200,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
singleDate: {
|
|
singleDate: {
|
|
|
jsDate: parse(
|
|
jsDate: parse(
|
|
|
this.instrument_work.fecha_ultima_cupon,
|
|
this.instrument_work.fecha_ultima_cupon,
|
|
|
- "dd/MM/yyyy HH:mm:ss",
|
|
|
|
|
|
|
+ "dd/MM/yyyy",
|
|
|
new Date()
|
|
new Date()
|
|
|
),
|
|
),
|
|
|
formatted: this.instrument_work.fecha_ultima_cupon
|
|
formatted: this.instrument_work.fecha_ultima_cupon
|
|
@@ -215,40 +218,10 @@ export class PBUR implements InstrumentComponent {
|
|
|
if (!form.valid) {
|
|
if (!form.valid) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- this.pburObject = {
|
|
|
|
|
- valor_nominal: this.investmentProposalForm.value.valor_nominal,
|
|
|
|
|
- renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
|
|
|
|
|
- comision_casa_porcentaje: this.investmentProposalForm.value
|
|
|
|
|
- .comision_casa_porcentaje,
|
|
|
|
|
- comision_bolsa_porcentaje: this.investmentProposalForm.value
|
|
|
|
|
- .comision_bolsa_porcentaje,
|
|
|
|
|
- rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
|
|
|
|
|
- otros_costos: this.investmentProposalForm.value.otros_costos,
|
|
|
|
|
- plazo: this.investmentProposalForm.value.plazo,
|
|
|
|
|
- //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
|
|
|
|
|
-
|
|
|
|
|
- fecha_operacion: this.investmentProposalForm.value.fecha_operacion
|
|
|
|
|
- .singleDate.formatted,
|
|
|
|
|
- fecha_liquidacion:
|
|
|
|
|
- this.investmentProposalForm.value.fecha_liquidacion.singleDate
|
|
|
|
|
- .formatted || "",
|
|
|
|
|
- fecha_ultima_cupon:
|
|
|
|
|
- this.investmentProposalForm.value.fecha_ultima_cupon != undefined
|
|
|
|
|
- ? this.investmentProposalForm.value.fecha_ultima_cupon.singleDate
|
|
|
|
|
- .formatted
|
|
|
|
|
- : "",
|
|
|
|
|
- fecha_vencimiento:
|
|
|
|
|
- this.investmentProposalForm.value.fecha_vencimiento != undefined
|
|
|
|
|
- ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
|
|
|
|
|
- .formatted
|
|
|
|
|
- : ""
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- this.formDataService.setWork(this.pburObject);
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- getCalculations(form: any) {
|
|
|
|
|
|
|
+ getCalculations(form: any, saveForm: boolean) {
|
|
|
this.submitted = true;
|
|
this.submitted = true;
|
|
|
if (!form.valid) {
|
|
if (!form.valid) {
|
|
|
return false;
|
|
return false;
|
|
@@ -271,10 +244,9 @@ export class PBUR implements InstrumentComponent {
|
|
|
{
|
|
{
|
|
|
valor_par: false,
|
|
valor_par: false,
|
|
|
valor_nominal: +this.f.valor_nominal.value,
|
|
valor_nominal: +this.f.valor_nominal.value,
|
|
|
- comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
|
|
|
|
|
- comision_bolsa_porcentaje:
|
|
|
|
|
- this.f.comision_bolsa_porcentaje.value / 100,
|
|
|
|
|
- rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
|
|
|
|
|
|
|
+ comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
|
|
|
|
|
+ comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
|
|
|
|
|
+ rendimiento_bruto: this.f.rendimiento_bruto.value,
|
|
|
otros_costos: this.f.otros_costos.value,
|
|
otros_costos: this.f.otros_costos.value,
|
|
|
plazo: this.f.plazo.value,
|
|
plazo: this.f.plazo.value,
|
|
|
renta_porcentaje: this.f.renta_porcentaje.value,
|
|
renta_porcentaje: this.f.renta_porcentaje.value,
|
|
@@ -289,7 +261,6 @@ export class PBUR implements InstrumentComponent {
|
|
|
)
|
|
)
|
|
|
.subscribe(
|
|
.subscribe(
|
|
|
ans => {
|
|
ans => {
|
|
|
- console.log(ans);
|
|
|
|
|
this.ingreso_bruto = ans["result"]["ingreso_bruto"];
|
|
this.ingreso_bruto = ans["result"]["ingreso_bruto"];
|
|
|
this.ingreso_neto = ans["result"]["ingreso_neto"];
|
|
this.ingreso_neto = ans["result"]["ingreso_neto"];
|
|
|
this.valor_transado = ans["result"]["valor_transado"];
|
|
this.valor_transado = ans["result"]["valor_transado"];
|
|
@@ -301,8 +272,59 @@ export class PBUR implements InstrumentComponent {
|
|
|
this.plazo = ans["result"]["plazo"];
|
|
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"];
|
|
|
- console.log(ans);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.pburObject = {
|
|
|
|
|
+ valor_nominal: this.investmentProposalForm.value.valor_nominal,
|
|
|
|
|
+ renta_porcentaje: this.investmentProposalForm.value
|
|
|
|
|
+ .renta_porcentaje,
|
|
|
|
|
+ comision_casa_porcentaje: this.investmentProposalForm.value
|
|
|
|
|
+ .comision_casa_porcentaje,
|
|
|
|
|
+ comision_bolsa_porcentaje: this.investmentProposalForm.value
|
|
|
|
|
+ .comision_bolsa_porcentaje,
|
|
|
|
|
+ comision_casa: ans["result"]["comision_casa"],
|
|
|
|
|
+ comision_bolsa: ans["result"]["comision_bolsa"],
|
|
|
|
|
+ rendimiento_bruto: this.investmentProposalForm.value
|
|
|
|
|
+ .rendimiento_bruto,
|
|
|
|
|
+ otros_costos: this.investmentProposalForm.value.otros_costos,
|
|
|
|
|
+ ingreso_bruto: ans["result"]["ingreso_bruto"],
|
|
|
|
|
+ ingreso_neto: ans["result"]["ingreso_neto"],
|
|
|
|
|
+
|
|
|
|
|
+ valor_transado: ans["result"]["valor_transado"],
|
|
|
|
|
+ precio_porcentaje: ans["result"]["precio_porcentaje"],
|
|
|
|
|
+ rendimiento_neto: ans["result"]["rendimiento_neto"],
|
|
|
|
|
+ total_pagar: ans["result"]["total_pagar"],
|
|
|
|
|
+ interes_acumulado: ans["result"]["interes_acumulado"],
|
|
|
|
|
+ fecha_inicio_vigencia: ans["result"]["fecha_inicio_vigencia"],
|
|
|
|
|
+ plazo: this.investmentProposalForm.value.plazo,
|
|
|
|
|
+ //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
|
|
|
|
|
+
|
|
|
|
|
+ fecha_operacion: this.investmentProposalForm.value.fecha_operacion
|
|
|
|
|
+ .singleDate.formatted,
|
|
|
|
|
+ fecha_liquidacion:
|
|
|
|
|
+ this.investmentProposalForm.value.fecha_liquidacion.singleDate
|
|
|
|
|
+ .formatted || "",
|
|
|
|
|
+ fecha_ultima_cupon:
|
|
|
|
|
+ this.investmentProposalForm.value.fecha_ultima_cupon != undefined
|
|
|
|
|
+ ? this.investmentProposalForm.value.fecha_ultima_cupon
|
|
|
|
|
+ .singleDate.formatted
|
|
|
|
|
+ : "",
|
|
|
|
|
+ fecha_vencimiento:
|
|
|
|
|
+ this.investmentProposalForm.value.fecha_vencimiento != undefined
|
|
|
|
|
+ ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
|
|
|
|
|
+ .formatted
|
|
|
|
|
+ : ""
|
|
|
|
|
+ };
|
|
|
|
|
+ this.formDataService.setWork(this.pburObject);
|
|
|
Swal.close();
|
|
Swal.close();
|
|
|
|
|
+ if (saveForm == true) {
|
|
|
|
|
+ if (this.investmentID != undefined) {
|
|
|
|
|
+ this.router.navigate(["/investment-proposal/complement-info"], {
|
|
|
|
|
+ queryParams: { id: this.investmentID }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.router.navigate(["/investment-proposal/complement-info"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
err => {
|
|
err => {
|
|
|
Swal.fire({
|
|
Swal.fire({
|
|
@@ -310,11 +332,12 @@ export class PBUR implements InstrumentComponent {
|
|
|
title: "Error en el servidor",
|
|
title: "Error en el servidor",
|
|
|
text: "No su pudo obtener la informacion"
|
|
text: "No su pudo obtener la informacion"
|
|
|
});
|
|
});
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- goToPrevious(form: any) {
|
|
|
|
|
|
|
+ goToPrevious() {
|
|
|
this.submitted = true;
|
|
this.submitted = true;
|
|
|
if (this.investmentID != undefined) {
|
|
if (this.investmentID != undefined) {
|
|
|
this.router.navigate(["/investment-proposal/general-info"], {
|
|
this.router.navigate(["/investment-proposal/general-info"], {
|
|
@@ -326,17 +349,6 @@ export class PBUR implements InstrumentComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
goToNext(form: any) {
|
|
goToNext(form: any) {
|
|
|
- this.submitted = true;
|
|
|
|
|
-
|
|
|
|
|
- if (this.save(form)) {
|
|
|
|
|
- if (this.investmentID != undefined) {
|
|
|
|
|
- console.log("paramsID");
|
|
|
|
|
- this.router.navigate(["/investment-proposal/complement-info"], {
|
|
|
|
|
- queryParams: { id: this.investmentID }
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- this.router.navigate(["/investment-proposal/complement-info"]);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.getCalculations(form, true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|