Selaa lähdekoodia

Ajuste de objeto para guardar fecha vencimiento en instrumento papel bursatil y deposito

Oscar José Nuñez Chávez 5 vuotta sitten
vanhempi
commit
52abbdc7b1

+ 12 - 9
src/app/components/instruments/dap/dap.component.ts

@@ -63,7 +63,7 @@ export class DAP implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -103,7 +103,7 @@ export class DAP implements InstrumentComponent {
     public datepipe: DatePipe
   ) {
     this.instrument_work = this.formDataService.getWork();
-    this.instrument_exists = this.instrument_work == undefined;
+    this.instrument_null = this.instrument_work == undefined;
     this.general = this.formDataService.getGeneralInfo();
 
     if (
@@ -121,7 +121,7 @@ export class DAP implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       monto_inversion: [
-        this.instrument_exists ? "" : this.instrument_work.monto_inversion,
+        this.instrument_null ? "" : this.instrument_work.monto_inversion,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
@@ -129,28 +129,30 @@ export class DAP implements InstrumentComponent {
       ],
 
       renta_porcentaje: [
-        this.instrument_exists ? 10 : this.instrument_work.renta_porcentaje,
+        this.instrument_null || this.instrument_work.renta_porcentaje == null
+          ? 10
+          : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       tasa_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.tasa_porcentaje,
+        this.instrument_null ? "" : this.instrument_work.tasa_porcentaje,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       plazo: [
-        this.instrument_exists ? "" : this.instrument_work.plazo,
+        this.instrument_null ? "" : this.instrument_work.plazo,
         [Validators.required]
       ],
 
       numero_certificado: [
-        this.instrument_exists ? "" : this.instrument_work.numero_certificado,
+        this.instrument_null ? "" : this.instrument_work.numero_certificado,
         []
       ],
 
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -246,7 +248,8 @@ export class DAP implements InstrumentComponent {
             proyecciones: this.proyecciones,
 
             fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-              .singleDate.formatted
+              .singleDate.formatted,
+            fecha_vencimiento: this.fecha_vencimiento
           };
           this.formDataService.setWork(this.dapObject);
           Swal.close();

+ 2 - 1
src/app/components/instruments/pbur/pbur.component.ts

@@ -347,7 +347,8 @@ export class PBUR implements InstrumentComponent {
               this.investmentProposalForm.value.fecha_ultima_cupon != undefined
                 ? this.investmentProposalForm.value.fecha_ultima_cupon
                     .singleDate.formatted
-                : ""
+                : "",
+            fecha_vencimiento: this.fecha_vencimiento
           };
           this.formDataService.setWork(this.pburObject);
           Swal.close();