Пример #1
0
 protected function private_core()
 {
     $this->mostrar = 'clientes';
     if (isset($_REQUEST['mostrar'])) {
         $this->mostrar = $_REQUEST['mostrar'];
     }
     $this->offset = 0;
     if (isset($_REQUEST['offset'])) {
         $this->offset = intval($_REQUEST['offset']);
     }
     $this->grupo = FALSE;
     $this->tarifa = FALSE;
     if (isset($_REQUEST['cod'])) {
         $grupo = new grupo_clientes();
         $this->grupo = $grupo->get($_REQUEST['cod']);
     }
     if ($this->grupo) {
         $tar0 = new tarifa();
         $this->tarifa = $tar0->get($this->grupo->codtarifa);
         $this->total_clientes = 0;
         $this->total_facturas = 0;
         if ($this->mostrar == 'clientes') {
             $this->resultados = $this->clientes_from_grupo($this->grupo->codgrupo, $this->offset);
         } else {
             $this->resultados = $this->facturas_from_grupo($this->grupo->codgrupo, $this->offset);
         }
     } else {
         $this->new_error_msg('Grupo no encontrado.');
     }
 }
Пример #2
0
 private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $articulo = new articulo();
     $codfamilia = '';
     if (isset($_REQUEST['codfamilia'])) {
         $codfamilia = $_REQUEST['codfamilia'];
     }
     $codfabricante = '';
     if (isset($_REQUEST['codfabricante'])) {
         $codfabricante = $_REQUEST['codfabricante'];
     }
     $con_stock = isset($_REQUEST['con_stock']);
     $this->results = $articulo->search($this->query, 0, $codfamilia, $con_stock, $codfabricante);
     /// añadimos la busqueda, el descuento y la cantidad
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->dtopor = 0;
         $this->results[$i]->cantidad = 1;
     }
     /// ejecutamos las funciones de las extensiones
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'function' and $ext->params == 'new_search') {
             $name = $ext->text;
             $name($this->db, $this->results);
         }
     }
     /// buscamos el grupo de clientes y la tarifa
     if (isset($_REQUEST['codcliente'])) {
         $cliente = $this->cliente->get($_REQUEST['codcliente']);
         if ($cliente->codgrupo) {
             $grupo0 = new grupo_clientes();
             $tarifa0 = new tarifa();
             $grupo = $grupo0->get($cliente->codgrupo);
             if ($grupo) {
                 $tarifa = $tarifa0->get($grupo->codtarifa);
                 if ($tarifa) {
                     $tarifa->set_precios($this->results);
                 }
             }
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
Пример #3
0
 private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $fsvar = new fs_var();
     $multi_almacen = $fsvar->simple_get('multi_almacen');
     $stock = new stock();
     $articulo = new articulo();
     $codfamilia = '';
     if (isset($_REQUEST['codfamilia'])) {
         $codfamilia = $_REQUEST['codfamilia'];
     }
     $codfabricante = '';
     if (isset($_REQUEST['codfabricante'])) {
         $codfabricante = $_REQUEST['codfabricante'];
     }
     $con_stock = isset($_REQUEST['con_stock']);
     $this->results = $articulo->search($this->query, 0, $codfamilia, $con_stock, $codfabricante);
     /// añadimos la busqueda, el descuento, la cantidad, etc...
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->dtopor = 0;
         $this->results[$i]->cantidad = 1;
         $this->results[$i]->coddivisa = $this->empresa->coddivisa;
         /// añadimos el stock del almacén y el general
         $this->results[$i]->stockalm = $this->results[$i]->stockfis;
         if ($multi_almacen and isset($_REQUEST['codalmacen'])) {
             $this->results[$i]->stockalm = $stock->total_from_articulo($this->results[$i]->referencia, $_REQUEST['codalmacen']);
         }
     }
     /// ejecutamos las funciones de las extensiones
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'function' and $ext->params == 'new_search') {
             $name = $ext->text;
             $name($this->db, $this->results);
         }
     }
     /// buscamos el grupo de clientes y la tarifa
     if (isset($_REQUEST['codcliente'])) {
         $cliente = $this->cliente->get($_REQUEST['codcliente']);
         if ($cliente) {
             if ($cliente->codgrupo) {
                 $grupo0 = new grupo_clientes();
                 $tarifa0 = new tarifa();
                 $grupo = $grupo0->get($cliente->codgrupo);
                 if ($grupo) {
                     $tarifa = $tarifa0->get($grupo->codtarifa);
                     if ($tarifa) {
                         $tarifa->set_precios($this->results);
                     }
                 }
             }
         }
     }
     /// convertimos la divisa
     if (isset($_REQUEST['coddivisa'])) {
         if ($_REQUEST['coddivisa'] != $this->empresa->coddivisa) {
             foreach ($this->results as $i => $value) {
                 $this->results[$i]->coddivisa = $_REQUEST['coddivisa'];
                 $this->results[$i]->pvp = $this->divisa_convert($value->pvp, $this->empresa->coddivisa, $_REQUEST['coddivisa']);
             }
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
 private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $articulo = new articulo();
     $codfamilia = '';
     if (isset($_REQUEST['codfamilia'])) {
         $codfamilia = $_REQUEST['codfamilia'];
     }
     $con_stock = isset($_REQUEST['con_stock']);
     $this->results = $articulo->search($this->query, 0, $codfamilia, $con_stock);
     /// añadimos la busqueda
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->dtopor = 0;
     }
     /// buscamos el grupo de clientes y la tarifa
     if (isset($_REQUEST['codcliente'])) {
         $cliente = $this->cliente->get($_REQUEST['codcliente']);
         if ($cliente->codgrupo) {
             $grupo0 = new grupo_clientes();
             $grupo = $grupo0->get($cliente->codgrupo);
             if ($grupo) {
                 $tarifa0 = new tarifa();
                 $tarifa = $tarifa0->get($grupo->codtarifa);
                 if ($tarifa) {
                     foreach ($this->results as $i => $value) {
                         $this->results[$i]->dtopor = 0 - $tarifa->incporcentual;
                     }
                 }
             }
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
Пример #5
0
 private function new_search()
 {
     /// cambiamos la plantilla HTML
     $this->template = 'ajax/tpv_recambios';
     $codfamilia = '';
     if (isset($_POST['codfamilia'])) {
         $codfamilia = $_POST['codfamilia'];
     }
     $con_stock = isset($_POST['con_stock']);
     $this->results = $this->articulo->search($this->query, 0, $codfamilia, $con_stock);
     /// añadimos el descuento y la cantidad
     foreach ($this->results as $i => $value) {
         $this->results[$i]->dtopor = 0;
         $this->results[$i]->cantidad = 1;
     }
     /// ejecutamos las funciones de las extensiones
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'function' and $ext->params == 'new_search') {
             $name = $ext->text;
             $name($this->db, $this->results);
         }
     }
     $cliente = $this->cliente->get($_POST['codcliente']);
     if ($cliente) {
         if ($cliente->regimeniva == 'Exento') {
             foreach ($this->results as $i => $value) {
                 $this->results[$i]->iva = 0;
             }
         }
         if ($cliente->codgrupo) {
             $grupo0 = new grupo_clientes();
             $tarifa0 = new tarifa();
             $grupo = $grupo0->get($cliente->codgrupo);
             if ($grupo) {
                 $tarifa = $tarifa0->get($grupo->codtarifa);
                 if ($tarifa) {
                     $tarifa->set_precios($this->results);
                 }
             }
         }
     }
 }