<?php

session_start();

if(isset($_SESSION['Usuario'])){
    //Valido si es Admin para dejarlo en Registro
  

 
}else{

    //Si no le muestro otra página, puede ser la de Login
    header("Location: /MauricioCorrea/incorrecto.html");
}


?>

<!DOCTYPE html>





<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Registro Proveedor</title>
                         <link rel="icon" type="image/png" href="imagenes/compra.png" />
          
        <script type="text/javascript" src="Js/jquery.min.js" ></script>
        <link rel="stylesheet" type="text/css" href="estilos.css">
        <link rel="stylesheet" type="text/css" href="fonts.css">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <script src="menu.js"></script>
        
    </head>
    <body>
        
        <header>
<?php
if(isset($_SESSION['Usuario'])){

echo '<a class="datosusuario icon-exit" href="/MauricioCorrea/Cerrar.php"> - Salir</a>';
echo '<span class="datosusuario icon-users"> - Bienvenido '.$_SESSION['Nombre'].'</span>';


}else{
    header("Location: /MauricioCorrea/incorrecto.html");
}


?>


       <div class="menu_bar">
        <a href="#" class="bt-menu"><span class="icon-newspaper"></span>Menu</a>
        </div>
            <nav>
                <ul>
                    <li><a href="inicio.php"><span class="icon-home"> </span>Inicio</a></li>  
                    <li class="submenu">
                    <a href="#"><span class="icon-user-tie"></span>Admin<span class="caret icon-circle-down"></span></a>    
                    <ul class="children">
                        <li><a href="Registro.php" ><span class="icon-user-plus"></span>Crea Vendedor</a></li>
                        <li><a href="ModificaVendedor.php" ><span class="icon-pencil"></span>Modifica Vendedor</a></li>
                        <li><a href="RegistroCliente.php" ><span class="icon-user-plus"></span>Crea Cliente <span class="user-plus"></a></li>
                        <li><a href="RegistroProveedor.php" ><span class="icon-user-plus"></span>Crea Proveedor <span class="user-plus"></a></li>
                       

                    </ul>
                    </li>


                    <li class="submenu">
                     <a href="#"><span class="icon-cart"> </span>Vend<span class="caret icon-circle-down"></span></a>
                      <ul class="children">
                        <li><a href="RegistroCliente.php" ><span class="icon-user-plus"></span>Crea Cliente <span class=""></a></li>
                        <li><a href="RegistroVenta.php" ><span class="icon-cart"></span>Crea Factura <span class=""></a></li>
                        <li><a href="RegistroRemision.php" ><span class="icon-file-text2"></span>Crea Remision <span class=""></a></li>
                        <li><a href="RegistroNota.php" ><span class="icon-files-empty"></span>Crea Nota <span class=""></a></li>
                    </ul>
                    </li>    





                     <li class="submenu">
                    <a href="#.php"><span class="icon-users"> </span>Clientes<span class="caret icon-circle-down"></span></a>    
                   <ul class="children">  
                    
                    <li><a href="RegistraCongelador.php"><span class="icon-credit-card"> </span>Registra Congelador</a></li>  
                    <li><a href="ModificaCliente.php"><span class="icon-user-check"> </span>Modificar Cliente</a></li>  
                    <li><a href="InformesClientes.php"><span class="icon-profile"> </span>Informe Clientes</a></li> 
                    <li><a href="InformesVentas.php"><span class="icon-calculator"> </span>Informe Ventas</a></li> 
                    </ul> 
                     </li>        

                       <li class="submenu">
                    <a href="#"><span class="icon-user-tie"></span>Proveedores<span class="caret icon-circle-down"></span></a>    
                    <ul class="children">
                    <li><a href="RegistroCompra.php" ><span class="icon-plus"></span>Carga Compra <span class="plus"></a></li>
                        <li><a href="ModificaProveedor.php" ><span class="icon-user-plus"></span>Modificar Proveedor</a></li>
                        
                        <li><a href="InformesCompras.php" ><span class="icon-stats-bars2"></span>Informe Compras <span class="plus"></a></li>

                    </ul>
                    </li>



                                        
                    <li class="submenu">
                    <a href="#.php"><span class="icon-droplet"> </span>Prod<span class="caret icon-circle-down"></span></a>    
                   <ul class="children">
                        <li><a href="CrearProducto.php" ><span class="icon-barcode"></span>Crea Producto <span class=""></a></li>
                        <li><a href="ModificarProducto.php" ><span class="icon-qrcode"></span>Modifica Producto <span class=""></a></li>
                        <li><a href="InformesInventarios.php" ><span class="icon-files-empty"></span>Informe Inventario <span class=""></a></li>
                    </ul> 
                     </li>    
                    <li><a href="Cerrar.php"><span class="icon-exit"> </span>Salir</a></li>                    
                </ul>
            </nav>
        
        </header>
        <section id="TablaLog1">
            
            <p>
            <form method="get" name="Registro" action="RegistroProveedor.php">
            <div><p id="Titulo"> Nuevo proveedor</p></div>
            <br>
            <div class="txtRight mvm"><p class="fss required"><span class="required">*</span> Campos obligatorios</p></div>
            
          <table    cellspacing="35"  style="margin: 0 auto;" >
                <tr>
                    <td>
                        <span class="required"><div>
                            NIT*
                        </div></span>
                        <input type="number" name="nit" min="100000" max="9999999999" autofocus="autofocus" required="required" class="required" style="width:370px; height:30px;">
                        
                    </td>

                     

                     <td>
                        <span class="required"><div>
                            Razon social*
                        </div></span>
                        <input type="text" name="razon"  autofocus="autofocus" required="required" class="required" style="width:370px; height:30px;">
                        
                    </td>

                    
                </tr>
                 <tr>

                  <td>
                        <span class="required"><div>
                            Direccion*
                        </div></span>
                        <input type="text" name="direccion"  autofocus="autofocus" required="required" class="required" style="width:370px; height:30px;">
                        
                    </td>
                    <td>
                        <span class="required"><div>
                            Telefono*
                        </div></span>
                        <input type="number" name="telefono" autofocus="autofocus" required="required" class="required" style="width:370px; height:30px;">
                        
                    </td>

                    
                
                <tr>
                <td colspan="3">
                 <input type="submit" name="Registrar" Value="Registrar" style="width:370px; height:40px; " >
                 </td> </tr>
            </table>
            <span></span>
            
           
                    <br>
                        
           
</div>
                <br>
                                          
                
        </form>
        
         <script type="text/javascript"> 
            function controltag(e) {
                tecla = (document.all) ? e.keyCode : e.which;
                if (tecla==8) return true;
                else if (tecla==0||tecla==9)  return true;
                patron =/[0-9\s]/;
                te = String.fromCharCode(tecla);
                return patron.test(te);
            }
	</script>    
                        </p>
        </section>
           
            
        
           
        </section> 
        <?php
       error_reporting(E_ERROR || E_WARNING);
       
       
       if(isset($_GET['Registrar'])){  

      
 
          include './ConexionII.php';
          include './GestionDB.php';

                $Conexion = new Conexion();
         
                $DB = new GestionDBProveedor();
           
           $Con = $Conexion->conect();


           
$DB->ingresarProveedor(($DB->arregloProveedor($_GET['nit'], $_GET['razon'], $_GET['direccion'], $_GET['telefono'])), $Con);


        print '<script language="JavaScript">'; 
        print 'alert("El proveedor ha sido registrado correctamente." )'; 
        print '</script>'; 


        
           
           $Conexion->Cerrar($C);
           

                //http://www.desarrolloweb.com/articulos/880.php
            }
                    
          
          
       
        ?>
    </body>
</html>