!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.4.18 (Ubuntu). PHP/7.0.33-0ubuntu0.16.04.16 

uname -a: Linux digifus 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/antonella/application/controllers/   drwxr-xr-x
Free 10.04 GB of 29.4 GB (34.16%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     Home.php (12.12 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Home extends CI_Controller {
    
    function 
__construct()
    {
        
parent::__construct();
        
$this->load->model('consultas_model');
        
/* Cargamos la base de datos */
        
$this->load->database();
        
$this->load->library('javascript');
        
/* Cargamos la libreria*/
        
$this->load->library('session');
        
$this->load->library('Grocery_Crud');
        
/* Añadimos el helper al controlador */
        
$this->load->helper('url');
        
error_reporting(E_ALL ^ (E_NOTICE E_WARNING));
    }
    
    public function 
index() {
        if(
$this->session->userdata('loginuser') == TRUE)
        {
            
$data = array(
                    
"contenido" => "inicio",
                    
"titulo" =>"INICIO"
            
);
            
$this->load->view('template',$data);
        }
        else {
            
            
redirect(base_url().'login''refresh');
        }
    }

    

    public function 
logout(){
        
$this->session->sess_destroy();
        
redirect(base_url().'login''refresh');
    }
    
    function 
reporteVentasDiariasExcel(){
    
        
$this->load->library('pHPExcel');
    
        
$PHPExcel = new PHPExcel();
        
$PHPExcel->getProperties()->setTitle("VENTAS MENSUALES"); //Título del Excel
        
$fechaInicial=$_POST["datapicker4"];
        
$fechaFinal=$_POST["datapicker5"];
        
$campo_excel 1;
        
$letra 'A';
        
$tipo_string = array();
    
        
$query ="select id_pedido,fecha,observacion,total from pedidos ";
    
        if((
$fechaInicial != null)||($fechaFinal != null)){
            
$query.=" where fecha >= '".$fechaInicial."' and fecha <= '".$fechaFinal."'";
    
        }

        
$query =$this->db->query($query);
        
#Imprimo los títulos
        
foreach($query->result() as $filas) {
            
$columna_excel     '0';
            foreach(
$filas AS $titulo=>$fila) {
                
#Las columnas todas en String
                
$PHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($columna_excel$campo_excel$tituloPHPExcel_Cell_DataType::TYPE_STRING);
                
#Si la columna la queremos en string la metemos en el array
                
if ($titulo=='codigo' || $titulo=='refprov' || $titulo=='CODIGO_' || $titulo=='ean' || $titulo=='CODIGO') {
                    
$tipo_string[] = $columna_excel//Esta columna será tipo String
                
}
                
$columna_excel++;
                
$letra++; //Para saber cuantas columnas tengo (en letra) y al final adelante usar un loop para autoajustar el texto
            
}
            
$campo_excel++;
            break;
        }
    
        function 
tipo_string($columna$tipo_string) {
            
#Si la columna está en el array convertimos la celda a String
            
if (empty($tipo_string)) return false;
    
            foreach(
$tipo_string AS $string) {
                if (
$columna == $string)
                    return 
true;
            }
        }
    
        
#Imprimo los campos
        
foreach($query->result() AS $filas) {
        
$columna_excel '0';
                foreach(
$filas AS $fila) {
                if (
tipo_string($columna_excel$tipo_string)) {
                
$PHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($columna_excel$campo_excel$filaPHPExcel_Cell_DataType::TYPE_STRING);
                }
                else {
                    
$PHPExcel->getActiveSheet()->SetCellValueByColumnAndRow($columna_excel$campo_excel$fila);
                }
    
                
$columna_excel++;
                }
                
$campo_excel++;
        }
    
        
#Ajusto ancho de las columnas al texto
        
for ($col 'A'$col != $letra$col++) {
        
$PHPExcel->getActiveSheet()->getColumnDimension($col)->setAutoSize(true);
        }
    
        
$fecha DATE('Y-m-d');
        
        
//Excel 2007
        /*
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Disposition: attachment;filename="'.$fecha.'_informe_'.$nombre.'.xlsx"');
        header('Cache-Control: max-age=0');
        $PHPExcel = PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel2007');
        */
    
        //Excel 2003
        
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        
header('Content-Disposition: attachment;filename="Informe_Ventas.xls"');
                        
header('Cache-Control: max-age=0');
                        
$PHPExcel PHPExcel_IOFactory::createWriter($PHPExcel'Excel5');
    
                            
//Creamos el Archivo
        
$PHPExcel->save('php://output');
        }
        
        
        function 
reporteProductosExcel(){
        
            
$this->load->library('pHPExcel');
        
            
$PHPExcel = new PHPExcel();
            
$PHPExcel->getProperties()->setTitle("PEDIDOS MARZO"); //Título del Excel
            
$fechaInicial=$_POST["datapicker7"];
            
$fechaFinal=$_POST["datapicker8"];
            
$campo_excel 1;
            
$letra 'A';
            
$tipo_string = array();
            
$query ="select c.nombre as NOMBRE,c.descripcion as DESCRIPCION,e.nombre as PROVEEDOR,g.modelo as MODELO,d.stock as stock,sum(a.cantidad) as VENDIDOS,c.precio as PRECIO_INGRESO,c.precio_venta as PRECIO_VENTA, (sum(a.cantidad)*c.precio_venta) as sumarizado
from detalle_pedido a 
left join pedidos b ON b.id_pedido=a.id_pedido 

left join productos c ON c.nombre=a.nombre_producto 
left join stock_productos d ON c.nombre=d.nombre_producto 
left join proveedores e ON e.id=c.id_proveedor

left join categorias_productos f ON c.id_categoria=f.id
left join modelos g ON c.id_modelo=g.id "
;
            
        
            if((
$fechaInicial != null) && ($fechaFinal != null)){
                
$query.=" where  b.fecha >= '".$fechaInicial."' and b.fecha <= '".$fechaFinal."'";
            }
        
            
$query .=" group by 1 order by 3 desc";
            
$query =$this->db->query($query);
            
#Imprimo los títulos
            
foreach($query->result() as $filas) {
                
$columna_excel     '0';
                foreach(
$filas AS $titulo=>$fila) {
                    
#Las columnas todas en String
                    
$PHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($columna_excel$campo_excel$tituloPHPExcel_Cell_DataType::TYPE_STRING);
                    
#Si la columna la queremos en string la metemos en el array
                    
if ($titulo=='codigo' || $titulo=='refprov' || $titulo=='CODIGO_' || $titulo=='ean' || $titulo=='CODIGO') {
                        
$tipo_string[] = $columna_excel//Esta columna será tipo String
                    
}
                    
$columna_excel++;
                    
$letra++; //Para saber cuantas columnas tengo (en letra) y al final adelante usar un loop para autoajustar el texto
                
}
                
$campo_excel++;
                break;
            }
        
            function 
tipo_string($columna$tipo_string) {
                
#Si la columna está en el array convertimos la celda a String
                
if (empty($tipo_string)) return false;
        
                foreach(
$tipo_string AS $string) {
                    if (
$columna == $string)
                        return 
true;
                }
            }
        
            
#Imprimo los campos
            
foreach($query->result() AS $filas) {
            
$columna_excel '0';
                    foreach(
$filas AS $fila) {
                    if (
tipo_string($columna_excel$tipo_string)) {
                    
$PHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($columna_excel$campo_excel$filaPHPExcel_Cell_DataType::TYPE_STRING);
                    }
                    else {
                    
$PHPExcel->getActiveSheet()->SetCellValueByColumnAndRow($columna_excel$campo_excel$fila);
                    }
        
                    
$columna_excel++;
                    }
                    
$campo_excel++;
            }
        
            
#Ajusto ancho de las columnas al texto
            
for ($col 'A'$col != $letra$col++) {
            
$PHPExcel->getActiveSheet()->getColumnDimension($col)->setAutoSize(true);
            }
        
            
$fecha DATE('d-m-Y');
        
            
//Excel 2007
        /*
            header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
            header('Content-Disposition: attachment;filename="'.$fecha.'_informe_'.$nombre.'.xlsx"');
            header('Cache-Control: max-age=0');
            $PHPExcel = PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel2007');
            */
        
            //Excel 2003
            
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        
header('Content-Disposition: attachment;filename="'.$fecha.'_informe_productos_vendidos.xls"');
                        
header('Cache-Control: max-age=0');
            
$PHPExcel PHPExcel_IOFactory::createWriter($PHPExcel'Excel5');
        
            
//Creamos el Archivo
            
$PHPExcel->save('php://output');
        }
    public function 
productos() {
        if(
$this->session->userdata('loginuser') == TRUE)
        {
            try{
            
                
/* Creamos el objeto */
                
$crud = new grocery_CRUD();
            
                
/* Seleccionamos el tema */
                //$crud->set_theme('flexigrid');
                
$crud->set_theme('datatables');
                
/* Seleccionmos el nombre de la tabla de nuestra base de datos*/
                
$crud->set_table('productos');
                
            
//    $crud->set_relation('nombre','stock_productos','stock');
                /* Le asignamos un nombre */
                
$crud->set_subject('productos');
            
                
/* Asignamos el idioma español */
                
$crud->set_language('spanish');
            
                
/* Aqui le decimos a grocery que estos campos son obligatorios */
                
$crud->required_fields(
                        
'nombre',
                        
'descripcion',
                        
'precio',
                        
'stock'
                
);
            
                
/* Aqui le indicamos que campos deseamos mostrar */
                
$crud->columns(
                        
'nombre',
                        
'descripcion',
                        
'precio',
                        
'stock'
                
);
                    
                
/* Generamos la tabla */
                
$output $crud->render();
                
$data = array("pepe"=>$output,
                        
"contenido" =>"productos/administracion",
                        
"titulo" =>"ADMINISTRACION PRODUCTOS"
                
);
    
                
/* La cargamos en la vista situada en
                 /applications/views/productos/administracion.php */
                
$this->load->view('template',$data);
                    
            }catch(
Exception $e){
            
/* Si algo sale mal cachamos el error y lo mostramos */
                
show_error($e->getMessage().' --- '.$e->getTraceAsString());
            }
        }
        else {
                
            
redirect(base_url().'login''refresh');
        }
    }
    
    public function 
clientes() {
        if(
$this->session->userdata('loginuser') == TRUE)
        {
            try{
                
/* Creamos el objeto */
                
$crud = new grocery_CRUD();
        
                
/* Seleccionamos el tema */
                
$crud->set_theme('datatables');
        
                
/* Seleccionmos el nombre de la tabla de nuestra base de datos*/
                
$crud->set_table('clientes');
        
                
/* Le asignamos un nombre */
                
$crud->set_subject('Clientes');
                
$crud->order_by('nombre','asc');
                
/* Asignamos el idioma español */
                
$crud->set_language('spanish');
        
                
/* Aqui le decimos a grocery que estos campos son obligatorios */
                
$crud->required_fields(
                        
'id',
                        
'nombre',
                        
'razon_social',
                        
'direccion',
                        
'telefono',
                        
'localidad',
                        
'mail',
                        
'iva',
                        
'cuit',
                        
'telefono'
                
);
        
                
/* Aqui le indicamos que campos deseamos mostrar */
                
$crud->columns(
                        
'nombre',
                        
'razon_social',
                        
'direccion',
                        
'telefono',
                        
'localidad',
                        
'mail',
                        
'iva',
                        
'cuit',
                        
'telefono'
                
);
        
                
/* Generamos la tabla */
                
$output $crud->render();
                
$data = array("pepe"=>$output,
                        
"contenido" =>"productos/administracion",
                        
"titulo" =>"ADMINISTRACION CLIENTES"
                
);
        
                
/* La cargamos en la vista situada en
                 /applications/views/productos/administracion.php */
                
$this->load->view('template',$data);
        
            }catch(
Exception $e){
                
/* Si algo sale mal cachamos el error y lo mostramos */
                
show_error($e->getMessage().' --- '.$e->getTraceAsString());
            }
        }
        else {
        
            
redirect(base_url().'login''refresh');
        }
    }


    public function 
reporteCobros() {
        
$buscador $this->input->post('comboCliente');
        
$idCliente=null;
        if(
$buscador !=null){
            
$idCliente=$this->consultas_model->consulta_clientesByName($buscador);
        }
        
        
        
$data = array(
                
"contenido" =>"reporte_cobros",
                
"filtro"=>$idCliente[0]->id,
                
"nombre"=>$buscador,
                
"titulo" =>"REPORTE COBRANZA"
        
);
        
$this->load->view('template',$data);
    }
    
    public function 
reporteVentas() {
        
        
$buscador $this->input->post('comboCliente');
        
$idCliente=null;
        if(
$buscador !=null){
            
$idCliente=$this->consultas_model->consulta_clientesByName($buscador);
        }
        
        
$data = array(
                
"contenido" =>"reportes_ventas_view",
                
"nombre"=>$buscador,
                
"filtro"=>$idCliente[0]->id,
                
"titulo" =>"REPORTE DE PEDIDOS"
        
);
        
$this->load->view('template',$data);
    }
    
    public function 
reporteCompras() {
    
        
$buscador $this->input->post('comboCliente');
        
$idCliente=null;
        if(
$buscador !=null){
            
$idCliente=$this->consultas_model->consulta_ProveedoresById($buscador);
        }
    
        
$data = array(
                
"contenido" =>"reportes_compras_view",
                
"nombre"=>$buscador,
                
"filtro"=>$idCliente[0]->id,
                
"titulo" =>"REPORTE DE COMPRAS"
        
);
        
$this->load->view('template',$data);
    }
    
    public function 
ventaExcel() {
    
        
$data = array(
                
"contenido" => "reporte_ventas_excel",
                
"titulo" =>"LISTADOS EN EXCEL"
        
);
        
$this->load->view('template',$data);
    
    }
    public function 
reporteProductos() {
        
$buscador $this->input->post('comboCliente');
        
$idCliente=null;
        if(
$buscador !=null){
            
$idCliente=$this->consultas_model->consulta_clientesByName($buscador);
        }
        
$data = array(
                
"contenido" =>"reporte_productos_view",
                
"nombre"=>$buscador,
                
"filtro"=>$idCliente[0]->id,
                
"titulo" =>"REPORTE DE PRODUCTOS MAS VENDIDOS"
        
);
        
$this->load->view('template',$data);
    }

    
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0074 ]--