bonos.component.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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. constructor(
  123. private formBuilder: FormBuilder,
  124. private router: Router,
  125. private formDataService: FormInvestmentProposalService,
  126. private catalogService: CatalogsService,
  127. private instrumentCalcService: InstrumentCalculations,
  128. public datepipe: DatePipe
  129. ) {
  130. this.instrument_work = this.formDataService.getWork();
  131. this.instrument_exists = this.instrument_work == undefined;
  132. this.general = this.formDataService.getGeneralInfo();
  133. if (
  134. this.instrument_work != undefined &&
  135. this.instrument_work.proyecciones != ""
  136. ) {
  137. this.hasProjections = true;
  138. this.operation_results_work = this.instrument_work["resultado_operacion"];
  139. if (this.instrument_work["instrumento"] != undefined) {
  140. this.instrument_work = this.instrument_work["instrumento"];
  141. }
  142. this.instrument_work_summary = this.instrument_work;
  143. this.dataSource2.data = this.instrument_work.proyecciones;
  144. this.dataSource2.paginator = this.paginator;
  145. this.dataSource2.sort = this.sort;
  146. } else {
  147. this.hasProjections = false;
  148. }
  149. if (
  150. this.operation_results_work != undefined &&
  151. this.operation_results_work != ""
  152. ) {
  153. this.operation_result = true;
  154. }
  155. this.investmentProposalForm = this.formBuilder.group({
  156. costo_transferencia: [
  157. this.instrument_exists ? "" : this.instrument_work.costo_transferencia,
  158. [
  159. Validators.required,
  160. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  161. ]
  162. ],
  163. precio_compra: [
  164. this.instrument_exists ? "" : this.instrument_work.precio_compra,
  165. [
  166. Validators.required,
  167. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  168. ]
  169. ],
  170. valor_nominal_compra: [
  171. this.instrument_exists ? "" : this.instrument_work.valor_nominal_compra,
  172. [
  173. Validators.required,
  174. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  175. ]
  176. ],
  177. precio_vencimiento_compra: [
  178. this.instrument_exists
  179. ? ""
  180. : this.instrument_work.precio_vencimiento_compra,
  181. [
  182. Validators.required,
  183. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  184. ]
  185. ],
  186. cupon_porcentaje_compra: [
  187. this.instrument_exists
  188. ? ""
  189. : this.instrument_work.cupon_porcentaje_compra,
  190. [
  191. Validators.required,
  192. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  193. ]
  194. ],
  195. comision_casa_porcentaje_compra: [
  196. this.instrument_exists
  197. ? ""
  198. : this.instrument_work.comision_casa_porcentaje_compra,
  199. [
  200. Validators.required,
  201. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  202. ]
  203. ],
  204. comision_bolsa_porcentaje_compra: [
  205. this.instrument_exists
  206. ? ""
  207. : this.instrument_work.comision_bolsa_porcentaje_compra,
  208. [
  209. Validators.required,
  210. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  211. ]
  212. ],
  213. precio_venta: [
  214. this.instrument_exists ? "" : this.instrument_work.precio_venta,
  215. [
  216. Validators.required,
  217. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  218. ]
  219. ],
  220. valor_nominal_venta: [
  221. this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta,
  222. [
  223. Validators.required,
  224. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  225. ]
  226. ],
  227. precio_vencimiento_venta: [
  228. this.instrument_exists
  229. ? ""
  230. : this.instrument_work.precio_vencimiento_venta,
  231. [
  232. Validators.required,
  233. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  234. ]
  235. ],
  236. cupon_porcentaje_venta: [
  237. this.instrument_exists
  238. ? ""
  239. : this.instrument_work.cupon_porcentaje_venta,
  240. [
  241. Validators.required,
  242. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  243. ]
  244. ],
  245. comision_casa_porcentaje_venta: [
  246. this.instrument_exists
  247. ? ""
  248. : this.instrument_work.comision_casa_porcentaje_venta,
  249. [
  250. Validators.required,
  251. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  252. ]
  253. ],
  254. comision_bolsa_porcentaje_venta: [
  255. this.instrument_exists
  256. ? ""
  257. : this.instrument_work.comision_bolsa_porcentaje_venta,
  258. [
  259. Validators.required,
  260. Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
  261. ]
  262. ],
  263. fecha_ultima_cupon_compra: [
  264. this.instrument_exists
  265. ? ""
  266. : {
  267. isRange: false,
  268. singleDate: {
  269. jsDate: parse(
  270. this.instrument_work.fecha_ultima_cupon_compra,
  271. "dd/MM/yyyy",
  272. new Date()
  273. ),
  274. formatted: this.instrument_work.fecha_ultima_cupon_compra
  275. }
  276. },
  277. Validators.required
  278. ],
  279. fecha_liquidacion_compra: [
  280. this.instrument_exists
  281. ? ""
  282. : {
  283. isRange: false,
  284. singleDate: {
  285. jsDate: parse(
  286. this.instrument_work.fecha_liquidacion_compra,
  287. "dd/MM/yyyy",
  288. new Date()
  289. ),
  290. formatted: this.instrument_work.fecha_liquidacion_compra
  291. }
  292. },
  293. Validators.required
  294. ],
  295. fecha_vencimiento_compra: [
  296. this.instrument_exists
  297. ? ""
  298. : {
  299. isRange: false,
  300. singleDate: {
  301. jsDate: parse(
  302. this.instrument_work.fecha_vencimiento_compra,
  303. "dd/MM/yyyy",
  304. new Date()
  305. ),
  306. formatted: this.instrument_work.fecha_vencimiento_compra
  307. }
  308. },
  309. Validators.required
  310. ],
  311. fecha_ultima_cupon_venta: [
  312. this.instrument_exists
  313. ? ""
  314. : {
  315. isRange: false,
  316. singleDate: {
  317. jsDate: parse(
  318. this.instrument_work.fecha_ultima_cupon_venta,
  319. "dd/MM/yyyy",
  320. new Date()
  321. ),
  322. formatted: this.instrument_work.fecha_ultima_cupon_venta
  323. }
  324. },
  325. Validators.required
  326. ],
  327. fecha_liquidacion_venta: [
  328. this.instrument_exists
  329. ? ""
  330. : {
  331. isRange: false,
  332. singleDate: {
  333. jsDate: parse(
  334. this.instrument_work.fecha_liquidacion_venta,
  335. "dd/MM/yyyy",
  336. new Date()
  337. ),
  338. formatted: this.instrument_work.fecha_liquidacion_venta
  339. }
  340. },
  341. Validators.required
  342. ],
  343. fecha_vencimiento_venta: [
  344. this.instrument_exists
  345. ? ""
  346. : {
  347. isRange: false,
  348. singleDate: {
  349. jsDate: parse(
  350. this.instrument_work.fecha_vencimiento_venta,
  351. "dd/MM/yyyy",
  352. new Date()
  353. ),
  354. formatted: this.instrument_work.fecha_vencimiento_venta
  355. }
  356. },
  357. Validators.required
  358. ]
  359. });
  360. }
  361. get f() {
  362. return this.investmentProposalForm.controls;
  363. }
  364. save(form: any): boolean {
  365. if (!form.valid) {
  366. return false;
  367. }
  368. this.formDataService.setWork(this.bonosObject);
  369. return true;
  370. }
  371. getCalculations(form: any, saveForm: boolean) {
  372. this.submitted = true;
  373. if (!form.valid) {
  374. return false;
  375. }
  376. Swal.fire({
  377. allowOutsideClick: false,
  378. icon: "info",
  379. text: "Espere por favor..."
  380. });
  381. Swal.showLoading();
  382. this.instrumentCalcService
  383. .bonosCalc(
  384. "BONO", // Codigo del instrumento
  385. {
  386. id_tipo_base: +this.general.base_anual,
  387. id_formato_ingreso: +this.general.formato_ingreso,
  388. id_periodicidad: +this.general.periodicidad
  389. },
  390. {
  391. costo_transferencia: +this.f.costo_transferencia.value,
  392. valor_nominal_compra: +this.f.valor_nominal_compra.value,
  393. precio_compra: +this.f.precio_compra.value,
  394. precio_vencimiento_compra: +this.f.precio_vencimiento_compra.value,
  395. cupon_porcentaje_compra: +this.f.cupon_porcentaje_compra.value,
  396. comision_casa_porcentaje_compra: this.f
  397. .comision_casa_porcentaje_compra.value,
  398. comision_bolsa_porcentaje_compra: this.f
  399. .comision_bolsa_porcentaje_compra.value,
  400. valor_nominal_venta: +this.f.valor_nominal_venta.value,
  401. precio_venta: +this.f.precio_venta.value,
  402. precio_vencimiento_venta: +this.f.precio_vencimiento_venta.value,
  403. cupon_porcentaje_venta: +this.f.cupon_porcentaje_venta.value,
  404. comision_casa_porcentaje_venta: this.f.comision_casa_porcentaje_venta
  405. .value,
  406. comision_bolsa_porcentaje_venta: this.f
  407. .comision_bolsa_porcentaje_venta.value,
  408. fecha_vencimiento_compra: this.f.fecha_vencimiento_compra.value
  409. .singleDate.formatted,
  410. fecha_ultima_cupon_compra: this.f.fecha_ultima_cupon_compra.value
  411. .singleDate.formatted,
  412. fecha_liquidacion_compra: this.f.fecha_liquidacion_compra.value
  413. .singleDate.formatted,
  414. fecha_vencimiento_venta: this.f.fecha_vencimiento_venta.value
  415. .singleDate.formatted,
  416. fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
  417. .singleDate.formatted,
  418. fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
  419. .singleDate.formatted
  420. }
  421. )
  422. .subscribe(
  423. ans => {
  424. // Instrumento de compra
  425. this.comision_casa_compra =
  426. ans["result"]["instrumento_compra"]["comision_casa_compra"];
  427. this.comision_bolsa_compra =
  428. ans["result"]["instrumento_compra"]["comision_bolsa_compra"];
  429. this.fecha_siguiente_cupon_compra =
  430. ans["result"]["instrumento_compra"]["fecha_siguiente_cupon_compra"];
  431. this.dias_vencimiento_compra =
  432. ans["result"]["instrumento_compra"]["dias_vencimiento_compra"];
  433. this.dias_acumulados_compra =
  434. ans["result"]["instrumento_compra"]["dias_acumulados_compra"];
  435. this.ytm_vencimiento_comision_porcentaje_compra =
  436. ans["result"]["instrumento_compra"][
  437. "ytm_vencimiento_comision_porcentaje_compra"
  438. ];
  439. this.ytm_vencimiento_porcentaje_compra =
  440. ans["result"]["instrumento_compra"][
  441. "ytm_vencimiento_porcentaje_compra"
  442. ];
  443. this.interes_acumulado_compra =
  444. ans["result"]["instrumento_compra"]["interes_acumulado_compra"];
  445. this.interes_acumulado_porcentaje_compra =
  446. ans["result"]["instrumento_compra"][
  447. "interes_acumulado_porcentaje_compra"
  448. ];
  449. this.precio_sucio_porcentaje_compra =
  450. ans["result"]["instrumento_compra"][
  451. "precio_sucio_porcentaje_compra"
  452. ];
  453. this.valor_transado_compra =
  454. ans["result"]["instrumento_compra"]["valor_transado_compra"];
  455. this.monto_pagar = ans["result"]["instrumento_compra"]["monto_pagar"];
  456. this.fecha_inicio_vigencia =
  457. ans["result"]["instrumento_compra"]["fecha_inicio_vigencia"];
  458. // Instrumento de venta
  459. this.comision_casa_venta =
  460. ans["result"]["instrumento_venta"]["comision_casa_venta"];
  461. this.comision_bolsa_venta =
  462. ans["result"]["instrumento_venta"]["comision_bolsa_venta"];
  463. this.fecha_siguiente_cupon_venta =
  464. ans["result"]["instrumento_venta"]["fecha_siguiente_cupon_venta"];
  465. this.dias_vencimiento_venta =
  466. ans["result"]["instrumento_venta"]["dias_vencimiento_venta"];
  467. this.dias_acumulados_venta =
  468. ans["result"]["instrumento_venta"]["dias_acumulados_venta"];
  469. this.ytm_vencimiento_comision_porcentaje_venta =
  470. ans["result"]["instrumento_venta"][
  471. "ytm_vencimiento_comision_porcentaje_venta"
  472. ];
  473. this.ytm_vencimiento_porcentaje_venta =
  474. ans["result"]["instrumento_venta"][
  475. "ytm_vencimiento_porcentaje_venta"
  476. ];
  477. this.interes_acumulado_venta =
  478. ans["result"]["instrumento_venta"]["interes_acumulado_venta"];
  479. this.interes_acumulado_porcentaje_venta =
  480. ans["result"]["instrumento_venta"][
  481. "interes_acumulado_porcentaje_venta"
  482. ];
  483. this.precio_sucio_porcentaje_venta =
  484. ans["result"]["instrumento_venta"]["precio_sucio_porcentaje_venta"];
  485. this.valor_transado_venta =
  486. ans["result"]["instrumento_venta"]["valor_transado_venta"];
  487. this.monto_recibir =
  488. ans["result"]["instrumento_venta"]["monto_recibir"];
  489. // Resultado de la operacion
  490. this.dias_tenencia_total =
  491. ans["result"]["resultado_operacion"]["dias_tenencia_total"];
  492. this.ganancia_perdida_capital =
  493. ans["result"]["resultado_operacion"]["ganancia_perdida_capital"];
  494. this.ingresos_intereses =
  495. ans["result"]["resultado_operacion"]["ingresos_intereses"];
  496. this.costos_totales =
  497. ans["result"]["resultado_operacion"]["costos_totales"];
  498. this.ganancia_perdida_total =
  499. ans["result"]["resultado_operacion"]["ganancia_perdida_total"];
  500. this.ganancia_perdida_capital_porcentaje =
  501. ans["result"]["resultado_operacion"][
  502. "ganancia_perdida_capital_porcentaje"
  503. ];
  504. this.intereses_porcentaje =
  505. ans["result"]["resultado_operacion"]["intereses_porcentaje"];
  506. this.neto_antes_impuesto_porcentaje =
  507. ans["result"]["resultado_operacion"][
  508. "neto_antes_impuesto_porcentaje"
  509. ];
  510. this.neto_despues_impuesto_porcentaje =
  511. ans["result"]["resultado_operacion"][
  512. "neto_despues_impuesto_porcentaje"
  513. ];
  514. this.total_ingresos_recibidos =
  515. ans["result"]["resultado_operacion"]["total_ingresos_recibidos"];
  516. // Proyecciones
  517. this.proyecciones = ans["result"]["proyecciones"];
  518. this.operation_result = true;
  519. this.dataSource.data = this.proyecciones;
  520. this.dataSource2.data = this.proyecciones;
  521. this.dataSource.paginator = this.paginator;
  522. this.dataSource.sort = this.sort;
  523. this.bonosObject = {
  524. costo_transferencia: this.investmentProposalForm.value
  525. .costo_transferencia,
  526. valor_nominal_compra: this.investmentProposalForm.value
  527. .valor_nominal_compra,
  528. precio_compra: this.investmentProposalForm.value.precio_compra,
  529. precio_vencimiento_compra: this.investmentProposalForm.value
  530. .precio_vencimiento_compra,
  531. cupon_porcentaje_compra: this.investmentProposalForm.value
  532. .cupon_porcentaje_compra,
  533. comision_casa_porcentaje_compra: this.investmentProposalForm.value
  534. .comision_casa_porcentaje_compra,
  535. comision_bolsa_porcentaje_compra: this.investmentProposalForm.value
  536. .comision_bolsa_porcentaje_compra,
  537. valor_nominal_venta: this.investmentProposalForm.value
  538. .valor_nominal_venta,
  539. precio_venta: this.investmentProposalForm.value.precio_venta,
  540. precio_vencimiento_venta: this.investmentProposalForm.value
  541. .precio_vencimiento_venta,
  542. cupon_porcentaje_venta: this.investmentProposalForm.value
  543. .cupon_porcentaje_venta,
  544. comision_casa_porcentaje_venta: this.investmentProposalForm.value
  545. .comision_casa_porcentaje_venta,
  546. comision_bolsa_porcentaje_venta: this.investmentProposalForm.value
  547. .comision_bolsa_porcentaje_venta,
  548. fecha_vencimiento_compra: this.f.fecha_vencimiento_compra.value
  549. .singleDate.formatted,
  550. fecha_ultima_cupon_compra: this.f.fecha_ultima_cupon_compra.value
  551. .singleDate.formatted,
  552. fecha_liquidacion_compra: this.f.fecha_liquidacion_compra.value
  553. .singleDate.formatted,
  554. fecha_vencimiento_venta: this.f.fecha_vencimiento_venta.value
  555. .singleDate.formatted,
  556. fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
  557. .singleDate.formatted,
  558. fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
  559. .singleDate.formatted,
  560. // Instrumento de compra
  561. comision_casa_compra: this.comision_casa_compra,
  562. comision_bolsa_compra: this.comision_bolsa_compra,
  563. fecha_siguiente_cupon_compra: this.fecha_siguiente_cupon_compra,
  564. dias_vencimiento_compra: this.dias_vencimiento_compra,
  565. dias_acumulados_compra: this.dias_acumulados_compra,
  566. ytm_vencimiento_porcentaje_compra: this
  567. .ytm_vencimiento_porcentaje_compra,
  568. ytm_vencimiento_comision_porcentaje_compra: this
  569. .ytm_vencimiento_comision_porcentaje_compra,
  570. interes_acumulado_compra: this.interes_acumulado_compra,
  571. interes_acumulado_porcentaje_compra: this
  572. .interes_acumulado_porcentaje_compra,
  573. precio_sucio_porcentaje_compra: this.precio_sucio_porcentaje_compra,
  574. valor_transado_compra: this.valor_transado_compra,
  575. monto_pagar: this.monto_pagar,
  576. fecha_inicio_vigencia: this.fecha_inicio_vigencia,
  577. // Instrumento de venta
  578. comision_casa_venta: this.comision_casa_venta,
  579. comision_bolsa_venta: this.comision_bolsa_venta,
  580. fecha_siguiente_cupon_venta: this.fecha_siguiente_cupon_venta,
  581. dias_vencimiento_venta: this.dias_vencimiento_venta,
  582. dias_acumulados_venta: this.dias_acumulados_venta,
  583. ytm_vencimiento_porcentaje_venta: this
  584. .ytm_vencimiento_porcentaje_venta,
  585. ytm_vencimiento_comision_porcentaje_venta: this
  586. .ytm_vencimiento_comision_porcentaje_venta,
  587. interes_acumulado_venta: this.interes_acumulado_venta,
  588. interes_acumulado_porcentaje_venta: this
  589. .interes_acumulado_porcentaje_venta,
  590. precio_sucio_porcentaje_venta: this.precio_sucio_porcentaje_venta,
  591. valor_transado_venta: this.valor_transado_venta,
  592. // Resultado de la operacion
  593. /*
  594. monto_recibir: this.monto_recibir,
  595. dias_tenencia_total: this.dias_tenencia_total,
  596. ganancia_perdida_capital: this.ganancia_perdida_capital,
  597. ingresos_intereses: this.ingresos_intereses,
  598. costos_totales: this.costos_totales,
  599. ganancia_perdida_total: this.ganancia_perdida_total,
  600. ganancia_perdida_capital_porcentaje: this
  601. .ganancia_perdida_capital_porcentaje,
  602. intereses_porcentaje: this.intereses_porcentaje,
  603. neto_antes_impuesto_porcentaje: this.neto_antes_impuesto_porcentaje,
  604. neto_despues_impuesto_porcentaje: this
  605. .neto_despues_impuesto_porcentaje,
  606. total_ingresos_recibidos: this.total_ingresos_recibidos,
  607. */
  608. // Proyecciones
  609. proyecciones: this.proyecciones
  610. };
  611. this.formDataService.setWork(this.bonosObject);
  612. Swal.close();
  613. if (saveForm == true) {
  614. if (this.investmentID != undefined) {
  615. this.router.navigate(["/investment-proposal/complement-info"], {
  616. queryParams: { id: this.investmentID }
  617. });
  618. } else {
  619. this.router.navigate(["/investment-proposal/complement-info"]);
  620. }
  621. }
  622. },
  623. err => {
  624. Swal.fire({
  625. icon: "error",
  626. title: "Error en el servidor",
  627. text: "No su pudo obtener la informacion"
  628. });
  629. return false;
  630. }
  631. );
  632. }
  633. goToPrevious() {
  634. this.submitted = true;
  635. if (this.investmentID != undefined) {
  636. this.router.navigate(["/investment-proposal/general-info"], {
  637. queryParams: { id: this.investmentID }
  638. });
  639. } else {
  640. this.router.navigate(["/investment-proposal/general-info"]);
  641. }
  642. }
  643. goToNext(form: any) {
  644. this.getCalculations(form, true);
  645. }
  646. }