|
|
@@ -124,6 +124,7 @@ export class TIT implements InstrumentComponent {
|
|
|
neto_despues_impuesto_porcentaje: any;
|
|
|
total_ingresos_recibidos: any;
|
|
|
percentages: any;
|
|
|
+ amortizaciones: string[];
|
|
|
|
|
|
constructor(
|
|
|
private formBuilder: FormBuilder,
|
|
|
@@ -149,7 +150,9 @@ export class TIT implements InstrumentComponent {
|
|
|
} else {
|
|
|
this.hasProjections = false;
|
|
|
}
|
|
|
-
|
|
|
+ if (!this.instrument_exists) {
|
|
|
+ this.amortizaciones = this.instrument_work.amortizacion_porcentajes;
|
|
|
+ }
|
|
|
this.investmentProposalForm = this.formBuilder.group({
|
|
|
costo_transferencia: [
|
|
|
this.instrument_exists ? "" : this.instrument_work.costo_transferencia,
|
|
|
@@ -406,7 +409,6 @@ export class TIT implements InstrumentComponent {
|
|
|
this.instrument_work != undefined &&
|
|
|
this.instrument_work.proyecciones != ""
|
|
|
) {
|
|
|
- console.log("get calcs");
|
|
|
this.getCalculations(this.investmentProposalForm, false);
|
|
|
}
|
|
|
}
|
|
|
@@ -435,46 +437,10 @@ export class TIT implements InstrumentComponent {
|
|
|
const data = XLSX.utils.sheet_to_json(ws, { header: 1 }); // to get 2d array pass 2nd parameter as object {header: 1}
|
|
|
const data2 = data.toString().split(",");
|
|
|
data2.shift();
|
|
|
-
|
|
|
- console.log(data2); // Data will be logged in array format containing objects
|
|
|
+ this.amortizaciones = data2;
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- getDataRecordsArrayFromCSVFile(csvRecordsArray: any, headerLength: any) {
|
|
|
- let csvArr = [];
|
|
|
-
|
|
|
- for (let i = 1; i < csvRecordsArray.length; i++) {
|
|
|
- let curruntRecord = (<string>csvRecordsArray[i]).split(",");
|
|
|
- if (curruntRecord.length == headerLength) {
|
|
|
- let csvRecord: CSVRecord = new CSVRecord();
|
|
|
- csvRecord.id = curruntRecord[0].trim();
|
|
|
- csvArr.push(csvRecord);
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(csvArr);
|
|
|
- this.percentages = csvArr["Porcentajes"];
|
|
|
- console.log(this.percentages);
|
|
|
- return csvArr;
|
|
|
- }
|
|
|
-
|
|
|
- isValidCSVFile(file: any) {
|
|
|
- return true; //file.name.endsWith(".csv");
|
|
|
- }
|
|
|
-
|
|
|
- getHeaderArray(csvRecordsArr: any) {
|
|
|
- let headers = (<string>csvRecordsArr[0]).split(",");
|
|
|
- let headerArray = [];
|
|
|
- for (let j = 0; j < headers.length; j++) {
|
|
|
- headerArray.push(headers[j]);
|
|
|
- }
|
|
|
- return headerArray;
|
|
|
- }
|
|
|
-
|
|
|
- fileReset() {
|
|
|
- this.csvReader.nativeElement.value = "";
|
|
|
- this.records = [];
|
|
|
- }
|
|
|
-
|
|
|
get f() {
|
|
|
return this.investmentProposalForm.controls;
|
|
|
}
|
|
|
@@ -491,7 +457,6 @@ export class TIT implements InstrumentComponent {
|
|
|
getCalculations(form: any, saveForm: boolean) {
|
|
|
this.submitted = true;
|
|
|
|
|
|
- console.log(form);
|
|
|
if (!form.valid) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -502,8 +467,8 @@ export class TIT implements InstrumentComponent {
|
|
|
});
|
|
|
Swal.showLoading();
|
|
|
this.instrumentCalcService
|
|
|
- .bonosCalc(
|
|
|
- "BONO", // Codigo del instrumento
|
|
|
+ .titularizacionCalc(
|
|
|
+ "TIT", // Codigo del instrumento
|
|
|
{
|
|
|
id_tipo_base: +this.general.base_anual,
|
|
|
id_formato_ingreso: +this.general.formato_ingreso,
|
|
|
@@ -545,14 +510,13 @@ export class TIT implements InstrumentComponent {
|
|
|
fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
|
|
|
.singleDate.formatted,
|
|
|
fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
|
|
|
- .singleDate.formatted
|
|
|
+ .singleDate.formatted,
|
|
|
+ fecha_emision: this.f.fecha_emision.value.singleDate.formatted,
|
|
|
+ amortizacion_porcentajes: this.amortizaciones
|
|
|
}
|
|
|
)
|
|
|
.subscribe(
|
|
|
ans => {
|
|
|
- console.log("---------");
|
|
|
- console.log(ans);
|
|
|
-
|
|
|
// Instrumento de compra
|
|
|
this.comision_casa_compra =
|
|
|
ans["result"]["instrumento_compra"]["comision_casa_compra"];
|
|
|
@@ -645,50 +609,6 @@ export class TIT implements InstrumentComponent {
|
|
|
this.dataSource.paginator = this.paginator;
|
|
|
this.dataSource.sort = this.sort;
|
|
|
|
|
|
- /*
|
|
|
- "result": {
|
|
|
- "instrumento_compra": {
|
|
|
- "comision_casa_compra": 201.3,
|
|
|
- "comision_bolsa_compra": 30.194999999999997,
|
|
|
- "fecha_siguiente_cupon_compra": "28/04/2013",
|
|
|
- "dias_vencimiento_compra": 880,
|
|
|
- "dias_acumulados_compra": 32,
|
|
|
- "ytm_vencimiento_comision_porcentaje_compra": 6.565909090909091,
|
|
|
- "interes_acumulado_compra": 533.3333333333334,
|
|
|
- "interes_acumulado_porcentaje_compra": 6.000000000000001,
|
|
|
- "precio_sucio_porcentaje_compra": 106.65,
|
|
|
- "valor_transado_compra": 100650.0,
|
|
|
- "monto_pagar": 101419.82833333334,
|
|
|
- "fecha_inicio_vigencia": "30/4/2013"
|
|
|
- },
|
|
|
- "instrumento_venta": {
|
|
|
- "comision_casa_venta": 50.0,
|
|
|
- "fecha_siguiente_cupon_venta": "28/10/2022",
|
|
|
- "dias_vencimiento_venta": 179,
|
|
|
- "dias_acumulados_venta": 1,
|
|
|
- "ytm_vencimiento_comision_porcentaje_venta": -0.5229050279329608,
|
|
|
- "interes_acumulado_venta": 46.875,
|
|
|
- "interes_acumulado_porcentaje_venta": 6.75,
|
|
|
- "precio_sucio_porcentaje_venta": 106.74999999999999,
|
|
|
- "valor_transado_venta": 250000.0,
|
|
|
- "monto_recibir": 249396.875
|
|
|
- },
|
|
|
- "resultado_operacion": {
|
|
|
- "valor_nominal_compra": 100000.0,
|
|
|
- 1"dias_tenencia_total": 3389,
|
|
|
- "precio_compra": 100.64999999999999,
|
|
|
- "precio_venta": 100.0,
|
|
|
- 1"ganancia_perdida_capital": 149350.0,
|
|
|
- 1"ingresos_intereses": 13726.875,
|
|
|
- 1"costos_totales": -886.495,
|
|
|
- 1"ganancia_perdida_total": 162190.38,
|
|
|
- 1"ganancia_perdida_capital_porcentaje": 15.864856889938034,
|
|
|
- 1"intereses_porcentaje": 1.458151372086161,
|
|
|
- 1"neto_antes_impuesto_porcentaje": 17.22883942165831,
|
|
|
- 1"1neto_despues_impuesto_porcentaje": 17.067375863086458,
|
|
|
- 1"total_ingresos_recibidos": 13680.0
|
|
|
- },
|
|
|
-*/
|
|
|
this.titulosObject = {
|
|
|
costo_transferencia: this.investmentProposalForm.value
|
|
|
.costo_transferencia,
|
|
|
@@ -732,7 +652,7 @@ export class TIT implements InstrumentComponent {
|
|
|
.singleDate.formatted,
|
|
|
fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
|
|
|
.singleDate.formatted,
|
|
|
-
|
|
|
+ fecha_emision: this.f.fecha_emision.value.singleDate.formatted,
|
|
|
// Instrumento de compra
|
|
|
|
|
|
comision_casa_compra: this.comision_casa_compra,
|
|
|
@@ -778,6 +698,7 @@ export class TIT implements InstrumentComponent {
|
|
|
.neto_despues_impuesto_porcentaje,
|
|
|
total_ingresos_recibidos: this.total_ingresos_recibidos,
|
|
|
|
|
|
+ amortizacion_porcentajes: this.amortizaciones,
|
|
|
// Proyecciones
|
|
|
proyecciones: this.proyecciones
|
|
|
};
|