瀏覽代碼

Correccion en ingresos

Oscar José Nuñez Chávez 5 年之前
父節點
當前提交
9a76ed46c6

+ 17 - 11
src/app/components/incomes/general-form/general-form.component.html

@@ -112,7 +112,10 @@
                               type="text"
                               formControlName="capital"
                               class="form-control"
-                              [value]="investmentProposalForm.get('capital').value | numberPipe" 
+                              [value]="
+                                investmentProposalForm.get('capital').value
+                                  | numberPipe
+                              "
                               (input)="inputValidator($event)"
                               [ngClass]="{
                                 'is-invalid': submitted && f.capital.errors
@@ -144,7 +147,10 @@
                             <input
                               type="text"
                               formControlName="ingreso_bruto"
-                              [value]="investmentProposalForm.get('ingreso_bruto').value | numberPipe" 
+                              [value]="
+                                investmentProposalForm.get('ingreso_bruto')
+                                  .value | numberPipe
+                              "
                               (input)="inputValidator($event)"
                               class="form-control"
                               [ngClass]="{
@@ -178,7 +184,10 @@
                             <input
                               type="text"
                               formControlName="ingreso_neto"
-                              [value]="investmentProposalForm.get('ingreso_neto').value | numberPipe" 
+                              [value]="
+                                investmentProposalForm.get('ingreso_neto')
+                                  .value | numberPipe
+                              "
                               (input)="inputValidator($event)"
                               class="form-control"
                               [ngClass]="{
@@ -299,27 +308,24 @@
                           </div>
                         </div>
                       </div>
-
                       <div class="col-lg-6 col-sm-12 pr-xl-3">
                         <div class="form-group">
-                          <label for="cuenta_bancaria">Cuenta bancaria: </label>
+                          <label for="cuenta_bancaria"
+                            >Cuenta bancaria destino:
+                          </label>
 
                           <select
                             class="custom-select"
                             formControlName="cuenta_bancaria"
-                            [ngClass]="{
-                              'is-invalid':
-                                submitted && f.cuenta_bancaria.errors
-                            }"
                           >
                             <option
-                              *ngFor="let item of accounts"
+                              *ngFor="let item of accounts_destination"
                               [value]="item.id_cuenta_bancaria"
                             >
-                              {{ nameBankAccounts(item.id_banco) }} -
                               {{ item.nombre }}</option
                             >
                           </select>
+
                           <div
                             *ngIf="submitted && f.cuenta_bancaria.errors"
                             class="invalid-feedback"

+ 14 - 13
src/app/components/incomes/general-form/general-form.component.ts

@@ -118,6 +118,8 @@ export class GeneralIncomeFormComponent implements OnInit {
   conciliateObject: any;
   has_conciliate: boolean;
   showIncomeForm: boolean = false;
+  accounts_origin: any;
+  accounts_destination: any;
 
   constructor(
     private catalogService: CatalogsService,
@@ -142,12 +144,6 @@ export class GeneralIncomeFormComponent implements OnInit {
     Swal.showLoading();
   }
 
-  nameBankAccounts(id: string) {
-    let bank;
-    bank = this.banks.find(e => e.id_banco == id);
-    return bank.nombre;
-  }
-
   ngOnInit() {
     this.partial = false;
 
@@ -161,6 +157,18 @@ export class GeneralIncomeFormComponent implements OnInit {
       this.idProjection = params["id_proyeccion_ingreso"];
     });
 
+    this.catalogService
+      .getBankAccounts("origen", this.idInversion)
+      .subscribe(res => {
+        this.accounts_origin = res["result"];
+      });
+
+    this.catalogService
+      .getBankAccounts("destino", this.idInversion)
+      .subscribe(res => {
+        this.accounts_destination = res["result"];
+      });
+
     this.incomesService
       .getProjection(
         this.idInversion,
@@ -214,13 +222,6 @@ export class GeneralIncomeFormComponent implements OnInit {
     this.catalogService.getCountries().subscribe(res => {
       this.funds = res;
     });
-    this.catalogService.getCatalogInfo("bancos").subscribe(res => {
-      this.banks = res;
-      this.catalogService.getCatalogInfo("cuentas-bancarias").subscribe(res => {
-        this.accounts = res;
-      });
-      //this.payment_types = res;
-    });
 
     this.investmentProposalForm = this.formBuilder.group({
       capital: [