Explorar el Código

Correccion en guardado de titulos

Oscar José Nuñez Chávez hace 5 años
padre
commit
5fbe6b4662
Se han modificado 1 ficheros con 78 adiciones y 44 borrados
  1. 78 44
      src/app/components/instruments/titulos/titulos.component.ts

+ 78 - 44
src/app/components/instruments/titulos/titulos.component.ts

@@ -503,15 +503,6 @@ export class TIT implements InstrumentComponent {
           comision_bolsa_porcentaje_compra: this.f
             .comision_bolsa_porcentaje_compra.value,
 
-          valor_nominal_venta: +this.f.valor_nominal_venta.value,
-          precio_venta: +this.f.precio_venta.value,
-          precio_vencimiento_venta: +this.f.precio_vencimiento_venta.value,
-          cupon_porcentaje_venta: +this.f.cupon_porcentaje_venta.value,
-          comision_casa_porcentaje_venta: this.f.comision_casa_porcentaje_venta
-            .value,
-          comision_bolsa_porcentaje_venta: this.f
-            .comision_bolsa_porcentaje_venta.value,
-
           fecha_vencimiento_compra:
             this.f.fecha_vencimiento_compra.value == ""
               ? ""
@@ -525,6 +516,14 @@ export class TIT implements InstrumentComponent {
               ? ""
               : this.f.fecha_liquidacion_compra.value.singleDate.formatted,
 
+          valor_nominal_venta: +this.f.valor_nominal_venta.value,
+          precio_venta: +this.f.precio_venta.value,
+          precio_vencimiento_venta: +this.f.precio_vencimiento_venta.value,
+          cupon_porcentaje_venta: +this.f.cupon_porcentaje_venta.value,
+          comision_casa_porcentaje_venta: this.f.comision_casa_porcentaje_venta
+            .value,
+          comision_bolsa_porcentaje_venta: this.f
+            .comision_bolsa_porcentaje_venta.value,
           fecha_vencimiento_venta:
             this.f.fecha_vencimiento_venta.value == ""
               ? ""
@@ -688,24 +687,6 @@ export class TIT implements InstrumentComponent {
             fecha_liquidacion_compra: this.f.fecha_liquidacion_compra.value
               .singleDate.formatted,
 
-            valor_nominal_venta: this.investmentProposalForm.value
-              .valor_nominal_venta,
-            precio_venta: this.investmentProposalForm.value.precio_venta,
-            precio_vencimiento_venta: this.investmentProposalForm.value
-              .precio_vencimiento_venta,
-            cupon_porcentaje_venta: this.investmentProposalForm.value
-              .cupon_porcentaje_venta,
-            comision_casa_porcentaje_venta: this.investmentProposalForm.value
-              .comision_casa_porcentaje_venta,
-            comision_bolsa_porcentaje_venta: this.investmentProposalForm.value
-              .comision_bolsa_porcentaje_venta,
-            fecha_vencimiento_venta: this.f.fecha_vencimiento_venta.value
-              .singleDate.formatted,
-            fecha_ultima_cupon_venta: this.f.fecha_ultima_cupon_venta.value
-              .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,
@@ -724,24 +705,7 @@ export class TIT implements InstrumentComponent {
             valor_transado_compra: this.valor_transado_compra,
             monto_pagar: this.monto_pagar,
             fecha_inicio_vigencia: this.fecha_inicio_vigencia,
-            // Instrumento de venta
 
-            comision_casa_venta: this.comision_casa_venta,
-            comision_bolsa_venta: this.comision_bolsa_venta,
-
-            fecha_siguiente_cupon_venta: this.fecha_siguiente_cupon_venta,
-            dias_vencimiento_venta: this.dias_vencimiento_venta,
-            dias_acumulados_venta: this.dias_acumulados_venta,
-            ytm_vencimiento_porcentaje_venta: this
-              .ytm_vencimiento_porcentaje_venta,
-            ytm_vencimiento_comision_porcentaje_venta: this
-              .ytm_vencimiento_comision_porcentaje_venta,
-
-            interes_acumulado_venta: this.interes_acumulado_venta,
-            interes_acumulado_porcentaje_venta: this
-              .interes_acumulado_porcentaje_venta,
-            precio_sucio_porcentaje_venta: this.precio_sucio_porcentaje_venta,
-            valor_transado_venta: this.valor_transado_venta,
             // Resultado de la operacion
             /*
             monto_recibir: this.monto_recibir,
@@ -763,6 +727,76 @@ export class TIT implements InstrumentComponent {
             proyecciones: this.proyecciones
           };
 
+          if (this.tipoEjecucion == 1) {
+            this.titulosObject[
+              "valor_nominal_venta"
+            ] = this.investmentProposalForm.value.valor_nominal_venta;
+            this.titulosObject[
+              "precio_venta"
+            ] = this.investmentProposalForm.value.precio_venta;
+            this.titulosObject[
+              "precio_vencimiento_venta"
+            ] = this.investmentProposalForm.value.precio_vencimiento_venta;
+            this.titulosObject[
+              "cupon_porcentaje_venta"
+            ] = this.investmentProposalForm.value.cupon_porcentaje_venta;
+            this.titulosObject[
+              "comision_casa_porcentaje_venta"
+            ] = this.investmentProposalForm.value.comision_casa_porcentaje_venta;
+            this.titulosObject[
+              "comision_bolsa_porcentaje_venta"
+            ] = this.investmentProposalForm.value.comision_bolsa_porcentaje_venta;
+            this.titulosObject[
+              "fecha_vencimiento_venta"
+            ] = this.f.fecha_vencimiento_venta.value.singleDate.formatted;
+            this.titulosObject[
+              "fecha_ultima_cupon_venta"
+            ] = this.f.fecha_ultima_cupon_venta.value.singleDate.formatted;
+            this.titulosObject[
+              "fecha_liquidacion_venta"
+            ] = this.f.fecha_liquidacion_venta.value.singleDate.formatted;
+            this.titulosObject[
+              "fecha_emision"
+            ] = this.f.fecha_emision.value.singleDate.formatted;
+            // Instrumento de venta
+
+            this.titulosObject[
+              "comision_casa_venta"
+            ] = this.comision_casa_venta;
+            this.titulosObject[
+              "comision_bolsa_venta"
+            ] = this.comision_bolsa_venta;
+
+            this.titulosObject[
+              "fecha_siguiente_cupon_venta"
+            ] = this.fecha_siguiente_cupon_venta;
+            this.titulosObject[
+              "dias_vencimiento_venta"
+            ] = this.dias_vencimiento_venta;
+            this.titulosObject[
+              "dias_acumulados_venta"
+            ] = this.dias_acumulados_venta;
+            this.titulosObject[
+              "ytm_vencimiento_porcentaje_venta"
+            ] = this.ytm_vencimiento_porcentaje_venta;
+            this.titulosObject[
+              "ytm_vencimiento_comision_porcentaje_venta"
+            ] = this.ytm_vencimiento_comision_porcentaje_venta;
+
+            this.titulosObject[
+              "interes_acumulado_venta"
+            ] = this.interes_acumulado_venta;
+            this.titulosObject[
+              "interes_acumulado_porcentaje_venta"
+            ] = this.interes_acumulado_porcentaje_venta;
+            this.titulosObject[
+              "precio_sucio_porcentaje_venta"
+            ] = this.precio_sucio_porcentaje_venta;
+            this.titulosObject[
+              "valor_transado_venta"
+            ] = this.valor_transado_venta;
+          }
+
           this.formDataService.setWork(this.titulosObject);
           Swal.close();
           if (saveForm == true) {