Esempio n. 1
0
 protected function private_core()
 {
     //cargamos configuración de servicios
     $fsvar = new fs_var();
     $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_marca' => 0, 'servicos_codmarca' => 0, 'servicios_mostrar_modelo' => 0, 'servicios_codmodelo' => 0, 'servicios_mostrar_tipo' => 0, 'servicios_tipo' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0), FALSE);
     /*Cargamos traduccion*/
     $fsvar = new fs_var();
     $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_marca' => "Marca del aparato", 'st_modelo' => "Modelo del aparato", 'st_tipo' => "Tipo de aparato"), FALSE);
     $servicio = new servicio_cliente();
     $this->agente = new agente();
     $this->serie = new serie();
     $this->estados = new estados_servicios();
     $this->mostrar = 'todo';
     if (isset($_GET['mostrar'])) {
         $this->mostrar = $_GET['mostrar'];
         setcookie('ventas_serv_mostrar', $this->mostrar, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['ventas_serv_mostrar'])) {
             $this->mostrar = $_COOKIE['ventas_serv_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';
                     } else {
                         if ($_GET['order'] == 'prioridad_desc') {
                             $this->order = 'prioridad DESC';
                         } else {
                             if ($_GET['order'] == 'prioridad_asc') {
                                 $this->order = 'prioridad ASC';
                             }
                         }
                     }
                 }
             }
         }
         setcookie('ventas_serv_order', $this->order, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['ventas_serv_order'])) {
             $this->order = $_COOKIE['ventas_serv_order'];
         }
     }
     if (isset($_POST['buscar_lineas'])) {
         $this->buscar_lineas();
     } else {
         if (isset($_REQUEST['buscar_cliente'])) {
             $this->buscar_cliente();
         } else {
             if ($this->mostrar == 'rechazados') {
                 $this->resultados = $servicio->all_rechazados($this->offset);
             } else {
                 if (isset($_GET['ref'])) {
                     $this->template = 'extension/ventas_servicios_articulo';
                     $articulo = new articulo();
                     $this->articulo = $articulo->get($_GET['ref']);
                     $linea = new linea_servicio_cliente();
                     $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset);
                 } else {
                     $this->share_extension();
                     $this->cliente = FALSE;
                     $this->codagente = '';
                     $this->estado = '';
                     $this->codserie = '';
                     $this->desde = '';
                     $this->hasta = '';
                     $this->num_resultados = '';
                     $this->total_resultados = '';
                     $this->total_resultados_txt = '';
                     if (isset($_POST['delete'])) {
                         $this->delete_servicio();
                     } else {
                         if (isset($_REQUEST['codagente']) or isset($_REQUEST['codcliente']) or isset($_REQUEST['estado'])) {
                             $this->mostrar = 'buscar';
                         }
                         if (isset($_REQUEST['codcliente'])) {
                             if ($_REQUEST['codcliente'] != '') {
                                 $cli0 = new cliente();
                                 $this->cliente = $cli0->get($_REQUEST['codcliente']);
                             }
                         }
                         if (isset($_REQUEST['codagente'])) {
                             $this->codagente = $_REQUEST['codagente'];
                         }
                         if (isset($_REQUEST['estado'])) {
                             $this->estado = $_REQUEST['estado'];
                         }
                         if (isset($_REQUEST['codserie'])) {
                             $this->codserie = $_REQUEST['codserie'];
                             $this->desde = $_REQUEST['desde'];
                             $this->hasta = $_REQUEST['hasta'];
                         }
                     }
                     if ($this->mostrar == 'pendientes') {
                         $this->resultados = $servicio->all_ptealbaran($this->offset, $this->order);
                         if ($this->offset == 0) {
                             $this->total_resultados = 0;
                             $this->total_resultados_txt = 'Suma total de esta página:';
                             foreach ($this->resultados as $serv) {
                                 $this->total_resultados += $serv->total;
                             }
                         }
                     } else {
                         if ($this->mostrar == 'buscar') {
                             $this->buscar();
                         } else {
                             $this->resultados = $servicio->all($this->offset, $this->order);
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 protected function private_core()
 {
     //cargamos configuración de servicios
     $fsvar = new fs_var();
     $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'cal_inicio' => "09:00", 'usar_direccion' => 0), FALSE);
     /*Cargamos traduccion*/
     $fsvar = new fs_var();
     $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_fechainicio' => "Fecha de inicio", 'st_fechafin' => "Fecha de fin", 'st_solucion' => "Solución", 'st_garantia' => "Garantía"), FALSE);
     $this->avisosat = '0';
     if (class_exists('registro_sat')) {
         $this->avisosat = '1';
     }
     if (isset($_GET['importar'])) {
         $this->importar_sat();
     }
     $this->servicio = new servicio_cliente();
     $this->agente = new agente();
     $this->serie = new serie();
     $this->estados = new estado_servicio();
     $this->estado = '';
     $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';
                     } else {
                         if ($_GET['order'] == 'prioridad_desc') {
                             $this->order = 'prioridad DESC';
                         } else {
                             if ($_GET['order'] == 'prioridad_asc') {
                                 $this->order = 'prioridad ASC';
                             } else {
                                 if ($_GET['order'] == 'total_desc') {
                                     $this->order = 'total DESC';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         setcookie('ventas_serv_order', $this->order, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['ventas_serv_order'])) {
             $this->order = $_COOKIE['ventas_serv_order'];
         }
     }
     if (isset($_POST['buscar_lineas'])) {
         $this->buscar_lineas();
     } else {
         if (isset($_REQUEST['buscar_cliente'])) {
             $this->buscar_cliente();
         } else {
             if (isset($_GET['ref'])) {
                 $this->template = 'extension/ventas_servicios_articulo';
                 $articulo = new articulo();
                 $this->articulo = $articulo->get($_GET['ref']);
                 $linea = new linea_servicio_cliente();
                 $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset);
             } else {
                 $this->share_extension();
                 $this->cliente = FALSE;
                 $this->codagente = '';
                 $this->codserie = '';
                 $this->desde = '';
                 $this->hasta = '';
                 $this->num_resultados = '';
                 $this->total_resultados = '';
                 $this->total_resultados_txt = '';
                 $this->editable = FALSE;
                 $this->fechainicio = '';
                 $this->fechafin = '';
                 if (isset($_POST['delete'])) {
                     $this->delete_servicio();
                 } else {
                     if (isset($_REQUEST['codcliente'])) {
                         if ($_REQUEST['codcliente'] != '') {
                             $cli0 = new cliente();
                             $this->cliente = $cli0->get($_REQUEST['codcliente']);
                         }
                     }
                     if (isset($_REQUEST['codagente'])) {
                         $this->codagente = $_REQUEST['codagente'];
                     }
                     if (isset($_REQUEST['estado'])) {
                         $this->estado = $_REQUEST['estado'];
                     }
                     if (isset($_REQUEST['editable'])) {
                         $this->editable = TRUE;
                     }
                     if (isset($_REQUEST['codserie'])) {
                         $this->codserie = $_REQUEST['codserie'];
                     }
                     if (isset($_REQUEST['fechainicio'])) {
                         $this->fechainicio = $_REQUEST['fechainicio'];
                     }
                     if (isset($_REQUEST['fechafin'])) {
                         $this->fechafin = $_REQUEST['fechafin'];
                     }
                     if (isset($_REQUEST['garantia'])) {
                         $this->garantia = TRUE;
                     }
                     if (isset($_REQUEST['desde'])) {
                         $this->desde = $_REQUEST['desde'];
                     }
                     if (isset($_REQUEST['hasta'])) {
                         $this->hasta = $_REQUEST['hasta'];
                     }
                 }
                 $this->buscar();
             }
         }
     }
 }