bonos.component.ts 24 KB

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