Ver Mensaje Individual
  #13 (permalink)  
Antiguo 08/09/2015, 19:27
Derzz
 
Fecha de Ingreso: enero-2011
Mensajes: 112
Antigüedad: 13 años, 2 meses
Puntos: 4
Respuesta: Problema con URL de Controlador

Facturar Model
Código PHP:
<?php
class Facturar_model extends CI_Model{
    public function 
__construct(){
        
parent::__construct();
    }

    public function 
listar_documentos(){

        
$this->db->order_by("id""desc"); 
        
$consulta $this->db->get('facturacion');
        return 
$consulta->result();

    }

    
//Consulta los datos de la tabla de facturacion en la Base de Datos
    
public function consultar_factura($valor){
        
$this->db->select('id_factura');
        
$this->db->where('id_factura'$valor);
        
$query$this->db->get('facturacion');

        
//si no hay datos de serie en la Base de datos devolvera "nodata"
        
if ($query->num_rows() > 0):
            echo 
"true";
        else:
            echo 
"false";
        endif;

    }

    public function 
actualizar_factura($id,$estado){
        
$data = array(
                       
'estado' => $estado
                    
);

        
$this->db->where('id'$id);
        
$this->db->update('facturacion'$data); 
    }

    public function 
obtener_datos($id){
        
$this->db->where('id'$id);
        
$consulta $this->db->get('facturacion');

        if (
$consulta->num_rows() > 0):
            return 
$consulta->row();
        else:
            return 
false;
        endif;

    }

    
//Graba los datos de faturacion en la Base de Datos
    
public function grabar_factura($codigounico$idcliente$cliente$tipodoc$fecha$moneda$serie$correlativo$precio_total$igv){
        
$datos = array(
            
'id_factura'    => $codigounico,
            
'id_cliente'    => $idcliente,
            
'razon_social'     => $cliente,
            
'tipo_documento'=> $tipodoc,
            
'serie'            => $serie,
            
'correlativo'     => $correlativo,
            
'fecha'            => $fecha,
            
'moneda'        => $moneda,
            
'monto'            => $precio_total,
            
'estado'        => "1",
            
'igv'            => $igv
             
);

        
$this->db->insert('facturacion',$datos);

    }

    public function 
grabar_producto($codigounico,$array){

        
$datos = array(); //abre el array

        
for($i=0$i<count($array); $i++){
            
$datos[] = array(
                
'id_factura'    => $codigounico,
                
'producto'        => $array[$i]['producto'],
                
'cantidad'        => $array[$i]['cantidad'],
                
'precio_unit'    => $array[$i]['precio_unit'],
                
'precio'        => $array[$i]['precio']
            );
        }

        
$this->db->insert_batch('items',$datos);

    }
}
?>
Autoload
Código PHP:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it.  This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
|
*/

/*
| -------------------------------------------------------------------
|  Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
|  $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/

$autoload['packages'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
|    $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array('database','session','breadcrumbs');


/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array('url');


/*
| -------------------------------------------------------------------
|  Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files.  Otherwise, leave it blank.
|
*/

$autoload['config'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file.  For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/

$autoload['language'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['model'] = array('model1', 'model2');
|
*/

$autoload['model'] = array();


/* End of file autoload.php */
/* Location: ./application/config/autoload.php */