how to load an xls file and update the records in the database with php

0

hi community I am developing an information system where you have an inventory module the idea is to download the inventory in xlsx format

I have the code that I downloaded the file but in xls format but I want to format xlsx

This is the code of the report that I have and the library that I am using is phpexcel

$filename = "equiv1.xls";

header( 'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8' );
header( 'Content-Disposition: attachment; filename=export.xls' );


        include 'conexion.php';     

$hoy= getdate();
$fecha_hoy=$hoy[year].'-'.$hoy[mon].'-'.$hoy[mday]; 
$hora=$hoy[hours].':'.$hoy[minutes].':'.$hoy[seconds];      

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reporte materiales de formacion</title>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="4" bgcolor="skyblue"><CENTER><strong>INVENTARIO MATERIALES DE CONSUMO SIGMA</strong></CENTER></td>
    <td bgcolor="skyblue"><CENTER><strong><?php echo $fecha_hoy;?></strong></CENTER></td>
    <td bgcolor="skyblue"><CENTER><strong><?php echo $hora;?></strong></CENTER></td>
  </tr>
  <tr>
    <td align="center"><strong>Id</strong></td>
    <td align="center"><strong>Cod Elemento</strong></td>
    <td align="center"><strong>Elemento</strong></td>
    <td align="center"><strong>Consecutivo</strong></td>
    <td align="center"><strong>Calificadores</strong></td>
    <td align="center"><strong>Cantidad</strong></td>
  </tr>

<?PHP

$sql=mysql_query("select id_matge,descri_matg,cod_mat,descripcion,dispo_inve   from material inner join material_general inner join inventario  on cod_uni=id_matge and cod_mat=cod_prod order by descri_matg ;");
while($res=mysql_fetch_array($sql)){        
    $i++;
    $id_matge=$res["id_matge"];
    $descri_matg=$res["descri_matg"];
    $cod_mat=$res["cod_mat"];
    $descripcion=$res["descripcion"];
    $dispo_inve=$res["dispo_inve"];                                 
?>  
 <tr>
    <td align="center"><?php echo $i; ?></td>
    <td bgcolor="#fdf651"align="center"><?php echo $id_matge; ?></td>
    <td align="center"><?php echo $descri_matg; ?></td>
    <td bgcolor="#ff9051"align="center"><?php echo $cod_mat; ?></td>
    <td align="center"><?php echo $descripcion; ?></td>
    <?php
    if($dispo_inve<=5)
    {
        ?>
        <td bgcolor="#e86868" align="center"><?php echo $dispo_inve; ?></td>
        <?php
    }
    else
    {
      ?>
      <td bgcolor="#5be571" align="center"><?php echo $dispo_inve; ?></td>
    <?php
    }
    ?>

 </tr> 
  <?php
}
  ?>
</table>
</body>
</html>

if someone can help me thanks

    
asked by Bairon Imbacuan 04.05.2017 в 18:38
source

0 answers