protected function process()
 {
     $this->cuenta = new cuenta();
     $this->ejercicio = new ejercicio();
     $this->custom_search = TRUE;
     $this->buttons[] = new fs_button('b_nueva_cuenta', 'Nueva');
     $this->buttons[] = new fs_button('b_cuentas_especiales', 'Cuentas especiales', 'index.php?page=cuentas_especiales');
     $this->buttons[] = new fs_button('b_balances', 'Balances', 'index.php?page=contabilidad_balances');
     $this->offset = 0;
     if (isset($_GET['offset'])) {
         $this->offset = intval($_GET['offset']);
     }
     if (isset($_GET['delete'])) {
         $cuenta2 = $this->cuenta->get($_GET['delete']);
         if ($cuenta2) {
             if ($cuenta2->delete()) {
                 $this->new_message('Cuenta eliminada correctamente.');
             } else {
                 $this->new_error_msg('Error al eliminar la cuenta.');
             }
         } else {
             $this->new_error_msg('Cuenta no encontrada.');
         }
         $this->resultados = $this->cuenta->all_from_ejercicio($this->default_items->codejercicio(), $this->offset);
         $this->resultados2 = array();
     } else {
         if (isset($_POST['codejercicio'])) {
             $this->nueva_cuenta();
         } else {
             if ($this->query != '') {
                 $this->resultados = $this->cuenta->search($this->query);
                 $subc = new subcuenta();
                 $this->resultados2 = $subc->search($this->query);
             } else {
                 if (isset($_POST['ejercicio'])) {
                     $this->save_codejercicio($_POST['ejercicio']);
                     $this->resultados = $this->cuenta->all_from_ejercicio($_POST['ejercicio'], $this->offset);
                     $this->resultados2 = array();
                 } else {
                     $this->resultados = $this->cuenta->all_from_ejercicio($this->default_items->codejercicio(), $this->offset);
                     $this->resultados2 = array();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 protected function process()
 {
     $this->cuenta = new cuenta();
     $this->ejercicio = new ejercicio();
     $this->offset = 0;
     if (isset($_GET['offset'])) {
         $this->offset = intval($_GET['offset']);
     }
     if (isset($_GET['delete'])) {
         $cuenta2 = $this->cuenta->get($_GET['delete']);
         if ($cuenta2) {
             if ($cuenta2->delete()) {
                 $this->new_message('Cuenta eliminada correctamente.');
             } else {
                 $this->new_error_msg('Error al eliminar la cuenta.');
             }
         } else {
             $this->new_error_msg('Cuenta no encontrada.');
         }
         $this->resultados = $this->cuenta->all_from_ejercicio($this->default_items->codejercicio(), $this->offset);
         $this->resultados2 = array();
     } else {
         if (isset($_POST['codejercicio'])) {
             $this->nueva_cuenta();
         } else {
             if ($this->query != '') {
                 $this->resultados = $this->cuenta->search($this->query);
                 $subc = new subcuenta();
                 $this->resultados2 = $subc->search($this->query);
             } else {
                 if (isset($_POST['ejercicio'])) {
                     $this->save_codejercicio($_POST['ejercicio']);
                     $this->resultados = $this->cuenta->all_from_ejercicio($_POST['ejercicio'], $this->offset);
                     $this->resultados2 = array();
                 } else {
                     $this->resultados = $this->cuenta->all_from_ejercicio($this->default_items->codejercicio(), $this->offset);
                     $this->resultados2 = array();
                 }
             }
         }
     }
 }