コード例 #1
0
 protected function process()
 {
     $albaran = new albaran_proveedor();
     /// desactivamos la barra de botones
     $this->show_fs_toolbar = FALSE;
     $this->offset = 0;
     if (isset($_GET['offset'])) {
         $this->offset = intval($_GET['offset']);
     }
     if (isset($_POST['buscar_lineas'])) {
         $this->buscar_lineas();
     } else {
         if (isset($_GET['codagente'])) {
             $this->template = 'extension/compras_albaranes_agente';
             $agente = new agente();
             $this->agente = $agente->get($_GET['codagente']);
             $this->resultados = $albaran->all_from_agente($_GET['codagente'], $this->offset);
         } else {
             if (isset($_GET['codproveedor'])) {
                 $this->template = 'extension/compras_albaranes_proveedor';
                 $proveedor = new proveedor();
                 $this->proveedor = $proveedor->get($_GET['codproveedor']);
                 $this->resultados = $albaran->all_from_proveedor($_GET['codproveedor'], $this->offset);
             } else {
                 if (isset($_GET['ref'])) {
                     $this->template = 'extension/compras_albaranes_articulo';
                     $articulo = new articulo();
                     $this->articulo = $articulo->get($_GET['ref']);
                     $linea = new linea_albaran_proveedor();
                     $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset);
                 } else {
                     $this->share_extension();
                     if (isset($_POST['delete'])) {
                         $this->delete_albaran();
                     }
                     if ($this->query != '') {
                         $this->resultados = $albaran->search($this->query, $this->offset);
                     } else {
                         if (isset($_GET['ptefactura'])) {
                             $this->resultados = $albaran->all_ptefactura($this->offset);
                         } else {
                             $this->resultados = $albaran->all($this->offset);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
 private function test_models()
 {
     $last_errores = array();
     switch ($this->informe['model']) {
         default:
             /// tablas
             $this->test_tablas();
             break;
         case 'asiento':
             $asiento = new asiento();
             $asientos = $asiento->all($this->informe['offset']);
             if ($asientos) {
                 if ($this->informe['offset'] == 0) {
                     foreach ($this->check_partidas_erroneas() as $err) {
                         $last_errores[] = $err;
                     }
                 }
                 foreach ($asientos as $asi) {
                     if ($asi->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$asi->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $asi->codejercicio, 'id' => $asi->numero, 'url' => $asi->url(), 'fecha' => $asi->fecha, 'fix' => $asi->fix());
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura cliente':
             $factura = new factura_cliente();
             $facturas = $factura->all($this->informe['offset']);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura proveedor':
             $factura = new factura_proveedor();
             $facturas = $factura->all($this->informe['offset']);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran cliente':
             $albaran = new albaran_cliente();
             $albaranes = $albaran->all($this->informe['offset']);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran proveedor':
             $albaran = new albaran_proveedor();
             $albaranes = $albaran->all($this->informe['offset']);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         $this->informe['model'] = 'fin';
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 $this->informe['model'] = 'dirclientes';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'dirclientes':
             $dircli0 = new direccion_cliente();
             $direcciones = $dircli0->all($this->informe['offset']);
             if ($direcciones) {
                 foreach ($direcciones as $dir) {
                     /// simplemente guardamos para que se eliminen espacios de ciudades, provincias, etc...
                     $dir->save();
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 $this->informe['model'] = 'fin';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'fin':
             break;
     }
     return $last_errores;
 }
コード例 #3
0
 protected function private_core()
 {
     $albaran = new albaran_proveedor();
     $this->agente = new agente();
     $this->serie = new serie();
     $this->mostrar = 'todo';
     if (isset($_GET['mostrar'])) {
         $this->mostrar = $_GET['mostrar'];
         setcookie('compras_alb_mostrar', $this->mostrar, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['compras_alb_mostrar'])) {
             $this->mostrar = $_COOKIE['compras_alb_mostrar'];
         }
     }
     $this->offset = 0;
     if (isset($_REQUEST['offset'])) {
         $this->offset = intval($_REQUEST['offset']);
     }
     $this->order = 'fecha DESC';
     if (isset($_GET['order'])) {
         if ($_GET['order'] == 'fecha_desc') {
             $this->order = 'fecha DESC';
         } else {
             if ($_GET['order'] == 'fecha_asc') {
                 $this->order = 'fecha ASC';
             } else {
                 if ($_GET['order'] == 'codigo_desc') {
                     $this->order = 'codigo DESC';
                 } else {
                     if ($_GET['order'] == 'codigo_asc') {
                         $this->order = 'codigo ASC';
                     }
                 }
             }
         }
         setcookie('compras_alb_order', $this->order, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['compras_alb_order'])) {
             $this->order = $_COOKIE['compras_alb_order'];
         }
     }
     if (isset($_POST['buscar_lineas'])) {
         $this->buscar_lineas();
     } else {
         if (isset($_REQUEST['buscar_proveedor'])) {
             $this->buscar_proveedor();
         } else {
             if (isset($_GET['ref'])) {
                 $this->template = 'extension/compras_albaranes_articulo';
                 $articulo = new articulo();
                 $this->articulo = $articulo->get($_GET['ref']);
                 $linea = new linea_albaran_proveedor();
                 $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset);
             } else {
                 $this->share_extension();
                 $this->codagente = '';
                 $this->codserie = '';
                 $this->desde = '';
                 $this->hasta = '';
                 $this->num_resultados = '';
                 $this->proveedor = FALSE;
                 $this->total_resultados = '';
                 $this->total_resultados_txt = '';
                 if (isset($_POST['delete'])) {
                     $this->delete_albaran();
                 } else {
                     if (!isset($_GET['mostrar']) and (isset($_REQUEST['codagente']) or isset($_REQUEST['codproveedor']))) {
                         /**
                          * si obtenermos un codagente o un codproveedor pasamos direcatemente
                          * a la pestaña de búsqueda, a menos que tengamos un mostrar, que
                          * entonces nos indica donde tenemos que estar.
                          */
                         $this->mostrar = 'buscar';
                     }
                     if (isset($_REQUEST['codproveedor'])) {
                         if ($_REQUEST['codproveedor'] != '') {
                             $pro0 = new proveedor();
                             $this->proveedor = $pro0->get($_REQUEST['codproveedor']);
                         }
                     }
                     if (isset($_REQUEST['codagente'])) {
                         $this->codagente = $_REQUEST['codagente'];
                     }
                     if (isset($_REQUEST['codserie'])) {
                         $this->codserie = $_REQUEST['codserie'];
                         $this->desde = $_REQUEST['desde'];
                         $this->hasta = $_REQUEST['hasta'];
                     }
                 }
                 /// añadimos segundo nivel de ordenación
                 $order2 = '';
                 if ($this->order == 'fecha DESC') {
                     $order2 = ', codigo DESC';
                 } else {
                     if ($this->order == 'fecha ASC') {
                         $order2 = ', codigo ASC';
                     }
                 }
                 if ($this->mostrar == 'pendientes') {
                     $this->resultados = $albaran->all_ptefactura($this->offset, $this->order . $order2);
                     if ($this->offset == 0) {
                         $this->total_resultados = 0;
                         $this->total_resultados_txt = 'Suma total de esta página:';
                         foreach ($this->resultados as $alb) {
                             $this->total_resultados += $alb->total;
                         }
                     }
                 } else {
                     if ($this->mostrar == 'buscar') {
                         $this->buscar($order2);
                     } else {
                         $this->resultados = $albaran->all($this->offset, $this->order . $order2);
                     }
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: informe_errores.php プロジェクト: ramikat/ERPSISFS
 private function test_models()
 {
     $mpp = 100;
     $last_errores = array();
     switch ($this->informe['model']) {
         default:
             /// tablas
             $this->test_tablas();
             break;
         case 'asiento':
             $asiento = new asiento();
             $asientos = $asiento->all($this->informe['offset'], $mpp);
             if ($asientos) {
                 if ($this->informe['offset'] == 0) {
                     foreach ($this->check_partidas_erroneas() as $err) {
                         $last_errores[] = $err;
                     }
                 }
                 foreach ($asientos as $asi) {
                     if ($asi->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$asi->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $asi->codejercicio, 'id' => $asi->numero, 'url' => $asi->url(), 'fecha' => $asi->fecha, 'fix' => $asi->fix());
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura cliente':
             $factura = new factura_cliente();
             $facturas = $factura->all($this->informe['offset'], $mpp);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura proveedor':
             $factura = new factura_proveedor();
             $facturas = $factura->all($this->informe['offset'], $mpp);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran cliente':
             $albaran = new albaran_cliente();
             $albaranes = $albaran->all($this->informe['offset'], $mpp);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran proveedor':
             $albaran = new albaran_proveedor();
             $albaranes = $albaran->all($this->informe['offset'], $mpp);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         $this->informe['model'] = 'fin';
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 $this->informe['model'] = 'fin';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'fin':
             break;
     }
     return $last_errores;
 }