bonos.component.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. import { Component, OnInit, Input, ViewChild } from "@angular/core";
  2. import { InstrumentComponent } from "@app/components/investment-proposals/instrument/instrument.component";
  3. import { FormBuilder, FormGroup, Validators } from "@angular/forms";
  4. import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
  5. import { formatDate, DatePipe } from "@angular/common";
  6. import { Router } from "@angular/router";
  7. import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
  8. import { CatalogsService } from "@app/services/catalogs.service";
  9. import { InstrumentCalculations } from "@app/services/instrument-calculations.service";
  10. import Swal from "sweetalert2";
  11. import { GeneralInfo } from "@app/models/investment-proposal-form";
  12. import { parse } from "date-fns";
  13. import { MatPaginator } from "@angular/material/paginator";
  14. import { MatSort } from "@angular/material/sort";
  15. import { MatTableDataSource } from "@angular/material/table";
  16. @Component({
  17. selector: "app-bonos",
  18. templateUrl: "./bonos.component.html"
  19. })
  20. export class BONO implements InstrumentComponent {
  21. title: string = "Bonos";
  22. @Input() data: any;
  23. @Input() summary: boolean;
  24. @Input() investmentID: string;
  25. displayedColumns: string[] = [
  26. "posicion",
  27. "plazo",
  28. "fecha_pago",
  29. "ingreso_bruto",
  30. "ingreso_neto",
  31. "impuesto"
  32. ];
  33. @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
  34. @ViewChild(MatSort, { static: true }) sort: MatSort;
  35. form: any;
  36. general: GeneralInfo;
  37. // For daterange
  38. daysLabels: any = {
  39. su: "Dom",
  40. mo: "Lun",
  41. tu: "Mar",
  42. we: "Mie",
  43. th: "Jue",
  44. fr: "Vie",
  45. sa: "Sab"
  46. };
  47. monthsLabels: any = {
  48. 1: "Ene",
  49. 2: "Feb",
  50. 3: "Mar",
  51. 4: "Abr",
  52. 5: "May",
  53. 6: "Jun",
  54. 7: "Jul",
  55. 8: "Ago",
  56. 9: "Sep",
  57. 10: "Oct",
  58. 11: "Nov",
  59. 12: "Dic"
  60. };
  61. investmentProposalForm: FormGroup;
  62. myDpOptions: IAngularMyDpOptions = {
  63. dateRange: false,
  64. dateFormat: "dd/mm/yyyy",
  65. dayLabels: this.daysLabels,
  66. monthLabels: this.monthsLabels
  67. };
  68. myDateInit: boolean = true;
  69. m_fecha_vencimiento_compra: IMyDateModel;
  70. m_fecha_ultima_cupon_compra: IMyDateModel;
  71. m_fecha_rendencion: IMyDateModel;
  72. m_fecha_liquidacion_compra: IMyDateModel;
  73. submitted: boolean = false;
  74. instrument_exists: boolean;
  75. instrument_work: any = [];
  76. financials: any;
  77. base_types: any;
  78. proyecciones: any;
  79. bonosObject: {};
  80. dataSource = new MatTableDataSource(this.proyecciones);
  81. dataSource2 = new MatTableDataSource(this.proyecciones);
  82. hasProjections: boolean;
  83. fecha_vencimiento: any;
  84. comision_casa_compra: any;
  85. comision_bolsa_compra: any;
  86. fecha_siguiente_cupon_compra: any;
  87. dias_vencimiento_compra: any;
  88. dias_acumulados_compra: any;
  89. ytm_vencimiento_comision_porcentaje_compra: any;
  90. interes_acumulado_compra: any;
  91. interes_acumulado_porcentaje_compra: any;
  92. precio_sucio_porcentaje_compra: any;
  93. valor_transado_compra: any;
  94. monto_pagar: any;
  95. fecha_inicio_vigencia: any;
  96. comision_casa_venta: any;
  97. fecha_siguiente_cupon_venta: any;
  98. dias_vencimiento_venta: any;
  99. dias_acumulados_venta: any;
  100. ytm_vencimiento_comision_porcentaje_venta: any;
  101. interes_acumulado_venta: any;
  102. interes_acumulado_porcentaje_venta: any;
  103. precio_sucio_porcentaje_venta: any;
  104. valor_transado_venta: any;
  105. monto_recibir: any;
  106. dias_tenencia_total: any;
  107. ganancia_perdida_capital: any;
  108. ingresos_intereses: any;
  109. costos_totales: any;
  110. ganancia_perdida_total: any;
  111. ganancia_perdida_capital_porcentaje: any;
  112. intereses_porcentaje: any;
  113. neto_antes_impuesto_porcentaje: any;
  114. neto_despues_impuesto_porcentaje: any;
  115. total_ingresos_recibidos: any;
  116. operation_result: boolean = false;
  117. operation_results_work: any = [];
  118. instrument_work_summary: any = [];
  119. ytm_vencimiento_porcentaje_compra: any;
  120. ytm_vencimiento_porcentaje_venta: any;
  121. comision_bolsa_venta: any;
  122. consolidado_proyeccion: any;
  123. constructor(
  124. private formBuilder: FormBuilder,
  125. private router: Router,
  126. private formDataService: FormInvestmentProposalService,
  127. private catalogService: CatalogsService,
  128. private instrumentCalcService: InstrumentCalculations,
  129. public datepipe: DatePipe
  130. ) {
  131. this.instrument_work = this.formDataService.getWork();
  132. this.instrument_exists = this.instrument_work == undefined;
  133. this.general = this.formDataService.getGeneralInfo();
  134. if (
  135. this.instrument_work != undefined &&
  136. this.instrument_work.proyecciones != ""
  137. ) {
  138. this.hasProjections = true;
  139. this.consolidado_proyeccion = this.instrument_work.proyecciones.pop();
  140. this.operation_results_work = this.instrument_work["resultado_operacion"];
  141. if (this.instrument_work["instrumento"] != undefined) {
  142. this.instrument_work = this.instrument_work["instrumento"];
  143. }
  144. this.instrument_work_summary = this.instrument_work;
  145. this.dataSource2.data = this.instrument_work.proyecciones;
  146. this.dataSource2.paginator = this.paginator;
  147. this.dataSource2.sort = this.sort;
  148. } else {
  149. this.hasProjections = false;
  150. }
  151. if (
  152. this.operation_results_work != undefined &&
  153. this.operation_results_work != ""
  154. ) {
  155. this.operation_result = true;
  156. }
  157. this.investmentProposalForm = this.formBuilder.group({
  158. costo_cedeval: [
  159. this.instrument_exists ? "" : this.instrument_work.costo_cedeval,
  160. [
  161. Validators.required,
  162. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  163. ]
  164. ],
  165. costo_transferencia: [
  166. this.instrument_exists ? "" : this.instrument_work.costo_transferencia,
  167. [
  168. Validators.required,
  169. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  170. ]
  171. ],
  172. precio_compra: [
  173. this.instrument_exists ? "" : this.instrument_work.precio_compra,
  174. [
  175. Validators.required,
  176. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  177. ]
  178. ],
  179. valor_nominal_compra: [
  180. this.instrument_exists ? "" : this.instrument_work.valor_nominal_compra,
  181. [
  182. Validators.required,
  183. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  184. ]
  185. ],
  186. precio_vencimiento_compra: [
  187. this.instrument_exists
  188. ? ""
  189. : this.instrument_work.precio_vencimiento_compra,
  190. [
  191. Validators.required,
  192. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  193. ]
  194. ],
  195. cupon_porcentaje_compra: [
  196. this.instrument_exists
  197. ? ""
  198. : this.instrument_work.cupon_porcentaje_compra,
  199. [
  200. Validators.required,
  201. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  202. ]
  203. ],
  204. comision_casa_porcentaje_compra: [
  205. this.instrument_exists
  206. ? ""
  207. : this.instrument_work.comision_casa_porcentaje_compra,
  208. [
  209. Validators.required,
  210. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  211. ]
  212. ],
  213. comision_bolsa_porcentaje_compra: [
  214. this.instrument_exists
  215. ? ""
  216. : this.instrument_work.comision_bolsa_porcentaje_compra,
  217. [
  218. Validators.required,
  219. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  220. ]
  221. ],
  222. precio_venta: [
  223. this.instrument_exists ? "" : this.instrument_work.precio_venta
  224. ],
  225. valor_nominal_venta: [
  226. this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta
  227. ],
  228. precio_vencimiento_venta: [
  229. this.instrument_exists
  230. ? ""
  231. : this.instrument_work.precio_vencimiento_venta
  232. ],
  233. cupon_porcentaje_venta: [
  234. this.instrument_exists
  235. ? ""
  236. : this.instrument_work.cupon_porcentaje_venta
  237. ],
  238. comision_casa_porcentaje_venta: [
  239. this.instrument_exists
  240. ? ""
  241. : this.instrument_work.comision_casa_porcentaje_venta
  242. ],
  243. comision_bolsa_porcentaje_venta: [
  244. this.instrument_exists
  245. ? ""
  246. : this.instrument_work.comision_bolsa_porcentaje_venta
  247. ],
  248. fecha_ultima_cupon_compra: [
  249. this.instrument_exists
  250. ? ""
  251. : {
  252. isRange: false,
  253. singleDate: {
  254. jsDate: parse(
  255. this.instrument_work.fecha_ultima_cupon_compra,
  256. "dd/MM/yyyy",
  257. new Date()
  258. ),
  259. formatted: this.instrument_work.fecha_ultima_cupon_compra
  260. }
  261. },
  262. Validators.required
  263. ],
  264. fecha_liquidacion_compra: [
  265. this.instrument_exists
  266. ? ""
  267. : {
  268. isRange: false,
  269. singleDate: {
  270. jsDate: parse(
  271. this.instrument_work.fecha_liquidacion_compra,
  272. "dd/MM/yyyy",
  273. new Date()
  274. ),
  275. formatted: this.instrument_work.fecha_liquidacion_compra
  276. }
  277. },
  278. Validators.required
  279. ],
  280. fecha_vencimiento_compra: [
  281. this.instrument_exists
  282. ? ""
  283. : {
  284. isRange: false,
  285. singleDate: {
  286. jsDate: parse(
  287. this.instrument_work.fecha_vencimiento_compra,
  288. "dd/MM/yyyy",
  289. new Date()
  290. ),
  291. formatted: this.instrument_work.fecha_vencimiento_compra
  292. }
  293. },
  294. Validators.required
  295. ],
  296. fecha_ultima_cupon_venta: [
  297. this.instrument_exists
  298. ? ""
  299. : {
  300. isRange: false,
  301. singleDate: {
  302. jsDate: parse(
  303. this.instrument_work.fecha_ultima_cupon_venta,
  304. "dd/MM/yyyy",
  305. new Date()
  306. ),
  307. formatted: this.instrument_work.fecha_ultima_cupon_venta
  308. }
  309. }
  310. ],
  311. fecha_liquidacion_venta: [
  312. this.instrument_exists
  313. ? ""
  314. : {
  315. isRange: false,
  316. singleDate: {
  317. jsDate: parse(
  318. this.instrument_work.fecha_liquidacion_venta,
  319. "dd/MM/yyyy",
  320. new Date()
  321. ),
  322. formatted: this.instrument_work.fecha_liquidacion_venta
  323. }
  324. }
  325. ],
  326. fecha_vencimiento_venta: [
  327. this.instrument_exists
  328. ? ""
  329. : {
  330. isRange: false,
  331. singleDate: {
  332. jsDate: parse(
  333. this.instrument_work.fecha_vencimiento_venta,
  334. "dd/MM/yyyy",
  335. new Date()
  336. ),
  337. formatted: this.instrument_work.fecha_vencimiento_venta
  338. }
  339. }
  340. ]
  341. });
  342. }
  343. get f() {
  344. return this.investmentProposalForm.controls;
  345. }
  346. save(form: any): boolean {
  347. if (!form.valid) {
  348. return false;
  349. }
  350. this.formDataService.setWork(this.bonosObject);
  351. return true;
  352. }
  353. getCalculations(form: any, saveForm: boolean) {
  354. this.submitted = true;
  355. if (!form.valid) {
  356. return false;
  357. }
  358. Swal.fire({
  359. allowOutsideClick: false,
  360. icon: "info",
  361. text: "Espere por favor..."
  362. });
  363. Swal.showLoading();
  364. this.instrumentCalcService
  365. .bonosCalc(
  366. "BONO", // Codigo del instrumento
  367. {
  368. id_tipo_base: +this.general.base_anual,
  369. id_formato_ingreso: +this.general.formato_ingreso,
  370. id_periodicidad: +this.general.periodicidad
  371. },
  372. {
  373. costo_cedeval: +this.f.costo_cedeval.value,
  374. costo_transferencia: +this.f.costo_transferencia.value,
  375. valor_nominal_compra: +this.f.valor_nominal_compra.value,
  376. precio_compra: +this.f.precio_compra.value,
  377. precio_vencimiento_compra: +this.f.precio_vencimiento_compra.value,
  378. cupon_porcentaje_compra: +this.f.cupon_porcentaje_compra.value,
  379. comision_casa_porcentaje_compra: this.f
  380. .comision_casa_porcentaje_compra.value,
  381. comision_bolsa_porcentaje_compra: this.f
  382. .comision_bolsa_porcentaje_compra.value,
  383. valor_nominal_venta: +this.f.valor_nominal_venta.value,
  384. precio_venta: +this.f.precio_venta.value,
  385. precio_vencimiento_venta: +this.f.precio_vencimiento_venta.value,
  386. cupon_porcentaje_venta: +this.f.cupon_porcentaje_venta.value,
  387. comision_casa_porcentaje_venta: this.f.comision_casa_porcentaje_venta
  388. .value,
  389. comision_bolsa_porcentaje_venta: this.f
  390. .comision_bolsa_porcentaje_venta.value,
  391. fecha_vencimiento_compra: this.f.fecha_vencimiento_compra.value
  392. .singleDate.formatted,
  393. fecha_ultima_cupon_compra: this.f.fecha_ultima_cupon_compra.value
  394. .singleDate.formatted,
  395. fecha_liquidacion_compra: this.f.fecha_liquidacion_compra.value
  396. .singleDate.formatted,
  397. fecha_vencimiento_venta: this.f.fecha_vencimiento_venta.value
  398. .singleDate.formatted,
  399. fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
  400. .singleDate.formatted,
  401. fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
  402. .singleDate.formatted
  403. }
  404. )
  405. .subscribe(
  406. ans => {
  407. // Instrumento de compra
  408. this.comision_casa_compra =
  409. ans["result"]["instrumento_compra"]["comision_casa_compra"];
  410. this.comision_bolsa_compra =
  411. ans["result"]["instrumento_compra"]["comision_bolsa_compra"];
  412. this.fecha_siguiente_cupon_compra =
  413. ans["result"]["instrumento_compra"]["fecha_siguiente_cupon_compra"];
  414. this.dias_vencimiento_compra =
  415. ans["result"]["instrumento_compra"]["dias_vencimiento_compra"];
  416. this.dias_acumulados_compra =
  417. ans["result"]["instrumento_compra"]["dias_acumulados_compra"];
  418. this.ytm_vencimiento_comision_porcentaje_compra =
  419. ans["result"]["instrumento_compra"][
  420. "ytm_vencimiento_comision_porcentaje_compra"
  421. ];
  422. this.ytm_vencimiento_porcentaje_compra =
  423. ans["result"]["instrumento_compra"][
  424. "ytm_vencimiento_porcentaje_compra"
  425. ];
  426. this.interes_acumulado_compra =
  427. ans["result"]["instrumento_compra"]["interes_acumulado_compra"];
  428. this.interes_acumulado_porcentaje_compra =
  429. ans["result"]["instrumento_compra"][
  430. "interes_acumulado_porcentaje_compra"
  431. ];
  432. this.precio_sucio_porcentaje_compra =
  433. ans["result"]["instrumento_compra"][
  434. "precio_sucio_porcentaje_compra"
  435. ];
  436. this.valor_transado_compra =
  437. ans["result"]["instrumento_compra"]["valor_transado_compra"];
  438. this.monto_pagar = ans["result"]["instrumento_compra"]["monto_pagar"];
  439. this.fecha_inicio_vigencia =
  440. ans["result"]["instrumento_compra"]["fecha_inicio_vigencia"];
  441. // Instrumento de venta
  442. this.comision_casa_venta =
  443. ans["result"]["instrumento_venta"]["comision_casa_venta"];
  444. this.comision_bolsa_venta =
  445. ans["result"]["instrumento_venta"]["comision_bolsa_venta"];
  446. this.fecha_siguiente_cupon_venta =
  447. ans["result"]["instrumento_venta"]["fecha_siguiente_cupon_venta"];
  448. this.dias_vencimiento_venta =
  449. ans["result"]["instrumento_venta"]["dias_vencimiento_venta"];
  450. this.dias_acumulados_venta =
  451. ans["result"]["instrumento_venta"]["dias_acumulados_venta"];
  452. this.ytm_vencimiento_comision_porcentaje_venta =
  453. ans["result"]["instrumento_venta"][
  454. "ytm_vencimiento_comision_porcentaje_venta"
  455. ];
  456. this.ytm_vencimiento_porcentaje_venta =
  457. ans["result"]["instrumento_venta"][
  458. "ytm_vencimiento_porcentaje_venta"
  459. ];
  460. this.interes_acumulado_venta =
  461. ans["result"]["instrumento_venta"]["interes_acumulado_venta"];
  462. this.interes_acumulado_porcentaje_venta =
  463. ans["result"]["instrumento_venta"][
  464. "interes_acumulado_porcentaje_venta"
  465. ];
  466. this.precio_sucio_porcentaje_venta =
  467. ans["result"]["instrumento_venta"]["precio_sucio_porcentaje_venta"];
  468. this.valor_transado_venta =
  469. ans["result"]["instrumento_venta"]["valor_transado_venta"];
  470. this.monto_recibir =
  471. ans["result"]["instrumento_venta"]["monto_recibir"];
  472. // Resultado de la operacion
  473. this.dias_tenencia_total =
  474. ans["result"]["resultado_operacion"]["dias_tenencia_total"];
  475. this.ganancia_perdida_capital =
  476. ans["result"]["resultado_operacion"]["ganancia_perdida_capital"];
  477. this.ingresos_intereses =
  478. ans["result"]["resultado_operacion"]["ingresos_intereses"];
  479. this.costos_totales =
  480. ans["result"]["resultado_operacion"]["costos_totales"];
  481. this.ganancia_perdida_total =
  482. ans["result"]["resultado_operacion"]["ganancia_perdida_total"];
  483. this.ganancia_perdida_capital_porcentaje =
  484. ans["result"]["resultado_operacion"][
  485. "ganancia_perdida_capital_porcentaje"
  486. ];
  487. this.intereses_porcentaje =
  488. ans["result"]["resultado_operacion"]["intereses_porcentaje"];
  489. this.neto_antes_impuesto_porcentaje =
  490. ans["result"]["resultado_operacion"][
  491. "neto_antes_impuesto_porcentaje"
  492. ];
  493. this.neto_despues_impuesto_porcentaje =
  494. ans["result"]["resultado_operacion"][
  495. "neto_despues_impuesto_porcentaje"
  496. ];
  497. this.total_ingresos_recibidos =
  498. ans["result"]["resultado_operacion"]["total_ingresos_recibidos"];
  499. // Proyecciones
  500. this.proyecciones = ans["result"]["proyecciones"];
  501. if (this.proyecciones != undefined && this.proyecciones.length > 0) {
  502. this.hasProjections = true;
  503. this.consolidado_proyeccion = this.proyecciones.pop();
  504. this.proyecciones;
  505. }
  506. this.operation_result = true;
  507. this.dataSource.data = this.proyecciones;
  508. this.dataSource2.data = this.proyecciones;
  509. this.dataSource.paginator = this.paginator;
  510. this.dataSource.sort = this.sort;
  511. this.bonosObject = {
  512. costo_cedeval: this.investmentProposalForm.value.costo_cedeval,
  513. costo_transferencia: this.investmentProposalForm.value
  514. .costo_transferencia,
  515. valor_nominal_compra: this.investmentProposalForm.value
  516. .valor_nominal_compra,
  517. precio_compra: this.investmentProposalForm.value.precio_compra,
  518. precio_vencimiento_compra: this.investmentProposalForm.value
  519. .precio_vencimiento_compra,
  520. cupon_porcentaje_compra: this.investmentProposalForm.value
  521. .cupon_porcentaje_compra,
  522. comision_casa_porcentaje_compra: this.investmentProposalForm.value
  523. .comision_casa_porcentaje_compra,
  524. comision_bolsa_porcentaje_compra: this.investmentProposalForm.value
  525. .comision_bolsa_porcentaje_compra,
  526. valor_nominal_venta: this.investmentProposalForm.value
  527. .valor_nominal_venta,
  528. precio_venta: this.investmentProposalForm.value.precio_venta,
  529. precio_vencimiento_venta: this.investmentProposalForm.value
  530. .precio_vencimiento_venta,
  531. cupon_porcentaje_venta: this.investmentProposalForm.value
  532. .cupon_porcentaje_venta,
  533. comision_casa_porcentaje_venta: this.investmentProposalForm.value
  534. .comision_casa_porcentaje_venta,
  535. comision_bolsa_porcentaje_venta: this.investmentProposalForm.value
  536. .comision_bolsa_porcentaje_venta,
  537. fecha_vencimiento_compra: this.f.fecha_vencimiento_compra.value
  538. .singleDate.formatted,
  539. fecha_ultima_cupon_compra: this.f.fecha_ultima_cupon_compra.value
  540. .singleDate.formatted,
  541. fecha_liquidacion_compra: this.f.fecha_liquidacion_compra.value
  542. .singleDate.formatted,
  543. fecha_vencimiento_venta: this.f.fecha_vencimiento_venta.value
  544. .singleDate.formatted,
  545. fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
  546. .singleDate.formatted,
  547. fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
  548. .singleDate.formatted,
  549. // Instrumento de compra
  550. comision_casa_compra: this.comision_casa_compra,
  551. comision_bolsa_compra: this.comision_bolsa_compra,
  552. fecha_siguiente_cupon_compra: this.fecha_siguiente_cupon_compra,
  553. dias_vencimiento_compra: this.dias_vencimiento_compra,
  554. dias_acumulados_compra: this.dias_acumulados_compra,
  555. ytm_vencimiento_porcentaje_compra: this
  556. .ytm_vencimiento_porcentaje_compra,
  557. ytm_vencimiento_comision_porcentaje_compra: this
  558. .ytm_vencimiento_comision_porcentaje_compra,
  559. interes_acumulado_compra: this.interes_acumulado_compra,
  560. interes_acumulado_porcentaje_compra: this
  561. .interes_acumulado_porcentaje_compra,
  562. precio_sucio_porcentaje_compra: this.precio_sucio_porcentaje_compra,
  563. valor_transado_compra: this.valor_transado_compra,
  564. monto_pagar: this.monto_pagar,
  565. fecha_inicio_vigencia: this.fecha_inicio_vigencia,
  566. // Instrumento de venta
  567. comision_casa_venta: this.comision_casa_venta,
  568. comision_bolsa_venta: this.comision_bolsa_venta,
  569. fecha_siguiente_cupon_venta: this.fecha_siguiente_cupon_venta,
  570. dias_vencimiento_venta: this.dias_vencimiento_venta,
  571. dias_acumulados_venta: this.dias_acumulados_venta,
  572. ytm_vencimiento_porcentaje_venta: this
  573. .ytm_vencimiento_porcentaje_venta,
  574. ytm_vencimiento_comision_porcentaje_venta: this
  575. .ytm_vencimiento_comision_porcentaje_venta,
  576. interes_acumulado_venta: this.interes_acumulado_venta,
  577. interes_acumulado_porcentaje_venta: this
  578. .interes_acumulado_porcentaje_venta,
  579. precio_sucio_porcentaje_venta: this.precio_sucio_porcentaje_venta,
  580. valor_transado_venta: this.valor_transado_venta,
  581. // Resultado de la operacion
  582. /*
  583. monto_recibir: this.monto_recibir,
  584. dias_tenencia_total: this.dias_tenencia_total,
  585. ganancia_perdida_capital: this.ganancia_perdida_capital,
  586. ingresos_intereses: this.ingresos_intereses,
  587. costos_totales: this.costos_totales,
  588. ganancia_perdida_total: this.ganancia_perdida_total,
  589. ganancia_perdida_capital_porcentaje: this
  590. .ganancia_perdida_capital_porcentaje,
  591. intereses_porcentaje: this.intereses_porcentaje,
  592. neto_antes_impuesto_porcentaje: this.neto_antes_impuesto_porcentaje,
  593. neto_despues_impuesto_porcentaje: this
  594. .neto_despues_impuesto_porcentaje,
  595. total_ingresos_recibidos: this.total_ingresos_recibidos,
  596. */
  597. // Proyecciones
  598. proyecciones: this.proyecciones
  599. };
  600. this.formDataService.setWork(this.bonosObject);
  601. Swal.close();
  602. if (saveForm == true) {
  603. if (this.investmentID != undefined) {
  604. this.router.navigate(["/investment-proposal/complement-info"], {
  605. queryParams: { id: this.investmentID }
  606. });
  607. } else {
  608. this.router.navigate(["/investment-proposal/complement-info"]);
  609. }
  610. }
  611. },
  612. err => {
  613. Swal.fire({
  614. icon: "error",
  615. title: "Error en el servidor",
  616. text: "No su pudo obtener la informacion"
  617. });
  618. return false;
  619. }
  620. );
  621. }
  622. goToPrevious() {
  623. this.submitted = true;
  624. if (this.investmentID != undefined) {
  625. this.router.navigate(["/investment-proposal/general-info"], {
  626. queryParams: { id: this.investmentID }
  627. });
  628. } else {
  629. this.router.navigate(["/investment-proposal/general-info"]);
  630. }
  631. }
  632. goToNext(form: any) {
  633. this.getCalculations(form, true);
  634. }
  635. }