public function execute()
 {
     try {
         $where = null;
         if (request::getInstance()->hasPost('filter')) {
             $filter = request::getInstance()->getPost('filter');
             if (isset($filter['fecha_inicio']) and $filter['fecha_inicio'] !== null and $filter['fecha_inicio'] !== '' and isset($filter['fecha_final']) and $filter['fecha_fina'] !== null and $filter['fecha_final'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::FECHA_HORA_VENTA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicial'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_final'] . ' 23.59.59')));
             }
             //close if
             if (isset($filter['cliente']) and $filter['cliente'] !== null and $filter['cliente'] !== '') {
                 $where[procesoVentaTableClass::CLIENTE_ID] = $filter['cliente'];
             }
             //close if
             session::getInstance()->setAttribute('facturaVentaFilter', $where);
         } elseif (session::getInstance()->hasAttribute('facturaVentaFilter')) {
             $where = session::getInstance()->getAttribute('facturaVentaFilter');
         }
         //close if
         $fieldsEmple = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE);
         $fieldsCli = array(clienteTableClass::ID, clienteTableClass::NOMBRE);
         $fieldsFacturaVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA, procesoVentaTableClass::ACTIVA);
         $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
         $fieldsCliente = array(clienteTableClass::NOMBRE);
         $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID);
         $fieldsCliente2 = array(clienteTableClass::NOMBRE, clienteTableClass::ID);
         $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO);
         $fJoin1 = procesoVentaTableClass::EMPLEADO_ID;
         $fJoin2 = empleadoTableClass::ID;
         $fJoin3 = procesoVentaTableClass::CLIENTE_ID;
         $fJoin4 = clienteTableClass::ID;
         $orderBy = array(procesoVentaTableClass::FECHA_HORA_VENTA);
         $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false);
         $this->objCliente = clienteTableClass::getAll($fieldsCliente2, false);
         $page = 0;
         if (request::getInstance()->hasGet('page')) {
             $page = request::getInstance()->getGet('page') - 1;
             $page = $page * config::getRowGrid();
         }
         //close if
         $f = array(procesoVentaTableClass::ID);
         $lines = config::getRowGrid();
         $this->cntPages = procesoVentaTableClass::getAllCount($f, true, $lines, $where);
         if (request::getInstance()->hasGet('page')) {
             $this->page = request::getInstance()->getGet('page');
         } else {
             $this->page = $page;
         }
         //close if
         $this->objCliente = clienteTableClass::getAll($fieldsCli, true);
         $this->objEmpleado = empleadoTableClass::getAll($fieldsEmple, true);
         $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true);
         $this->objFacturaVenta = procesoVentaTableClass::getAllJoin($fieldsFacturaVenta, $fieldsEmpleado, $fieldsCliente, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where);
         log::register(i18n::__('ver', null, 'facturaVenta'), procesoVentaTableClass::getNameTable());
         $this->defineView('index', 'facturaVenta', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $where = null;
         $idVacunacion = request::getInstance()->getRequest(procesoVentaTableClass::ID);
         if (request::getInstance()->hasRequest('report')) {
             $report = request::getInstance()->getPost('report');
             //                if (isset($report['fecha']) and $report['fecha'] !== null and $report['fecha'] !== '') {
             //                    $where[detalleVacunacionTableClass::FECHA] = $report['fecha'];
             //                }//close if
             //                if (isset($report['tipo']) and $report['tipo'] !== null and $report['tipo'] !== '') {
             //                    $where[detalleProcesoCompraTableClass::TIPO_INSUMO] = $report['tipo'];
             //                }//close if
             if (isset($report['numero']) and $report['numero'] !== null and $report['numero'] !== '') {
                 $where[detalleProcesoVentaTableClass::ID] = $report['numero'];
             }
             //close if
             if (isset($report['animal']) and $report['animal'] !== null and $report['animal'] !== '') {
                 $where[detalleProcesoVentaTableClass::ANIMAL] = $report['animal'];
             }
             //close if
             if (isset($report['valor']) and $report['valor'] !== null and $report['valor'] !== '') {
                 $where[detalleProcesoVentaTableClass::VALOR] = $report['valor'];
             }
             //close if
         }
         //close if
         $where[detalleProcesoVentaTableClass::VENTA] = $idVacunacion;
         $fieldsDetalleProcesoVenta = array(detalleProcesoVentaTableClass::ID, detalleProcesoVentaTableClass::VENTA, detalleProcesoVentaTableClass::VALOR, detalleProcesoVentaTableClass::ANIMAL);
         $fieldsAnimal = array(animalTableClass::NUMERO);
         $fJoin1 = detalleProcesoVentaTableClass::ANIMAL;
         $fJoin2 = animalTableClass::ID;
         $fieldsProcesoVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA);
         $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
         $fieldsCliente = array(clienteTableClass::NOMBRE);
         $fJoinVacunacion1 = procesoVentaTableClass::EMPLEADO_ID;
         $fJoinVacunacion2 = empleadoTableClass::ID;
         $fJoin3 = procesoVentaTableClass::CLIENTE_ID;
         $fJoin4 = clienteTableClass::ID;
         $whereVacunacion = array(procesoVentaTableClass::getNameTable() . "." . procesoVentaTableClass::ID => $idVacunacion);
         $this->objDetalleProcesoVenta = detalleProcesoVentaTableClass::getAllJoin($fieldsDetalleProcesoVenta, $fieldsAnimal, null, null, $fJoin1, $fJoin2, null, null, null, null, false, null, null, null, null, $where);
         $this->objProcesoVenta = procesoVentaTableClass::getAllJoin($fieldsProcesoVenta, $fieldsEmpleado, $fieldsCliente, null, $fJoinVacunacion1, $fJoinVacunacion2, $fJoin3, $fJoin4, null, null, true, null, null, null, null, $whereVacunacion);
         $this->mensajeDetalle = "Informe de Detalles de Factura de Venta";
         log::register(i18n::__('reporte'), detalleProcesoVentaTableClass::getNameTable());
         $this->defineView('reportDetalle', 'facturaVenta', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $where = null;
         if (request::getInstance()->hasRequest('filter')) {
             $report = request::getInstance()->getPost('filter');
             if (isset($report['fecha_inicio']) and $report['fecha_inicio'] !== null and $report['fecha_inicio'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::FECHA_HORA_COMPRA] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($report['fecha_fin'] . ' 23.59.59')));
             }
             //close if
             if (isset($report['empleado']) and $report['empleado'] !== null and $report['empleado'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::EMPLEADO_ID] = $report['empleado'];
             }
             if (isset($report['proveedor']) and $report['proveedor'] !== null and $report['proveedor'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::CLIENTE_ID] = $report['proveedor'];
             }
             if (isset($report['peso']) and $report['peso'] !== null and $report['peso'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::PESO] = $report['peso'];
             }
             if (isset($report['animal']) and $report['animal'] !== null and $report['animal'] !== '') {
                 $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::ANIMAL] = $report['animal'];
             }
         }
         $fieldsFacturaVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA, procesoVentaTableClass::ACTIVA, procesoVentaTableClass::PESO, procesoVentaTableClass::SUBTOTAL);
         $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE);
         $fieldsCliente = array(clienteTableClass::ID, clienteTableClass::NOMBRE);
         $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO);
         $fJoin1 = procesoVentaTableClass::EMPLEADO_ID;
         $fJoin2 = empleadoTableClass::ID;
         $fJoin3 = procesoVentaTableClass::CLIENTE_ID;
         $fJoin4 = clienteTableClass::ID;
         $fJoin5 = procesoVentaTableClass::ANIMAL;
         $fJoin6 = animalTableClass::ID;
         $orderBy = array(procesoVentaTableClass::FECHA_HORA_VENTA);
         $this->objFacturaVenta = procesoVentaTableClass::getAllJoin($fieldsFacturaVenta, $fieldsEmpleado, $fieldsCliente, $fieldsAnimal, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, $orderBy, 'ASC', null, null, $where);
         $this->mensaje = "Informe de Facturas de Venta";
         log::register(i18n::__('reporte'), procesoVentaTableClass::getNameTable());
         $this->defineView('report', 'facturaVenta', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     /* $where = array(
        'campo' => 'valor',
        'campo' => array(
        'valor de rango inicial',
        'valor de rango final'
        ),
        'campo LIKE "hola%" OR campo LIKE "%hola" OR campo "%valor%"'
        ); */
     try {
         if (request::getInstance()->hasRequest(procesoVentaTableClass::ID)) {
             $idFactura = request::getInstance()->getRequest(procesoVentaTableClass::ID);
             //                if (request::getInstance()->hasPost('filter')) {
             //                    $where = null;
             //                    $filter = request::getInstance()->getPost('filter');
             //
             //                   if (isset($filter['numero']) and $filter['numero'] !== null and $filter['numero'] !== '') {
             //                        $where[detalleProcesoVentaTableClass::ID] = $filter['numero'];
             //                    }//close if
             //                    if (isset($filter['animal']) and $filter['animal'] !== null and $filter['animal'] !== '') {
             //                        $where[detalleProcesoVentaTableClass::ANIMAL] = $filter['animal'];
             //                    }//close if
             //                    if (isset($filter['valor']) and $filter['valor'] !== null and $filter['valor'] !== '') {
             //                        $where[detalleProcesoVentaTableClass::VALOR] = $filter['valor'];
             //                    }//close if
             //
             ////                    if (isset($filter['accion']) and $filter['accion'] !== null and $filter['accion'] !== '') {
             ////                        $where[detalleVacunacionTableClass::ACCION] = $filter['accion'];
             ////                    }
             //
             ////                    $where[detalleVacunacionTableClass::ID_REGISTRO] = $idVacunacion;
             //
             //                    session::getInstance()->setAttribute('detalleFacturaVentaFilters');
             //                } elseif (session::getInstance()->hasAttribute('detalleFacturaVentaFilters')) {
             //                    $where = session::getInstance()->getAttribute('detalleFacturaVentaFilters');
             //                }//close if
             $fieldsFacturaVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA, procesoVentaTableClass::EMPLEADO_ID, procesoVentaTableClass::CLIENTE_ID, procesoVentaTableClass::ACTIVA);
             $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
             $fieldsCliente = array(clienteTableClass::NOMBRE);
             $fJoin1 = procesoVentaTableClass::EMPLEADO_ID;
             $fJoin2 = empleadoTableClass::ID;
             $fJoin3 = procesoVentaTableClass::CLIENTE_ID;
             $fJoin4 = clienteTableClass::ID;
             $whereVenta = array(procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::ID => $idFactura);
             $page = 0;
             //                if (request::getInstance()->hasGet('page')) {
             //                    $page = request::getInstance()->getGet('page') - 1;
             //                    $page = $page * config::getRowGrid();
             //                }
             //
             //                $f = array(
             //                    detalleProcesoCompraTableClass::ID
             //                );
             //
             //                $lines = config::getRowGrid();
             //                $this->cntPages = detalleVacunacionTableClass::getAllCount($f, true, $lines, $whereCnt);
             $fieldsDetalle = array(detalleProcesoVentaTableClass::ID, detalleProcesoVentaTableClass::VENTA, detalleProcesoVentaTableClass::VALOR, detalleProcesoVentaTableClass::ANIMAL, detalleProcesoVentaTableClass::PESO, detalleProcesoVentaTableClass::SUBTOTAL);
             //                $fieldsProcesoVenta= array(
             //                procesoVentaTableClass::ID
             //                );
             $fieldsAnimal = array(animalTableClass::NUMERO, animalTableClass::LOTE_ID);
             $fieldsFactura = array(procesoVentaTableClass::ID);
             $fJoinDetalle = detalleProcesoVentaTableClass::ANIMAL;
             $fJoinAnimal = animalTableClass::ID;
             $fFactura = detalleProcesoVentaTableClass::VENTA;
             $fVenta = procesoVentaTableClass::ID;
             $whereDetalle = array(detalleProcesoVentaTableClass::VENTA => $idFactura);
             $orderByDetalle = array(detalleProcesoVentaTableClass::ID);
             $this->objFacturaVenta = procesoVentaTableClass::getAllJoin($fieldsFacturaVenta, $fieldsEmpleado, $fieldsCliente, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, null, null, null, null, $whereVenta);
             $this->objDetalleFacturaVenta = detalleProcesoVentaTableClass::getAllJoin($fieldsDetalle, $fieldsAnimal, $fieldsFactura, null, $fJoinDetalle, $fJoinAnimal, $fFactura, $fVenta, null, null, false, $orderByDetalle, 'ASC', 10, $page, $whereDetalle);
             log::register(i18n::__('ver1', null, 'facturaVenta'), detalleProcesoVentaTableClass::getNameTable());
             $this->defineView('view', 'facturaVenta', session::getInstance()->getFormatOutput());
         } else {
             session::getInstance()->setError('pailas');
             routing::getInstance()->redirect('factura', 'viewFacturaVenta');
         }
         //close if
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }