<?php
 
session_cache_limiter('private');
session_start();
include("DMMYSQLG.php");
require_once("DF80000.php");
$name="Catalogo_De_Articulos.xls"; 
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
	header('Content-Type: application/force-download');
else
	header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="'.$name.'"');

?>

  <table width="748" border='1'>
         <tr>
       
        <th width="60"  nowrap><div align="center">CLAVE</div></th>
		<th width="200"  nowrap><div align="center">DESCRIPCION</div></th>
		<!--<th width="250"  nowrap><div align="center">SUB-AGRUPADOR</div></th>
		<th width="250"  nowrap><div align="center">AGRUPADOR</div></th>-->
		<th width="80"  nowrap><div align="center">EXISTENCIA</div></th>
		<th width="90"  nowrap><div align="center">COSTO PROM.</div></th>
		<th width="90"  nowrap><div align="center">FECHA ALTA</div></th>
      </tr>
      <?php


if($_POST['r1']=="clave") $sql ="SELECT * FROM farticulos WHERE farticulos.modulo='".$_SESSION['mod_sis']."' AND   nparte1 = '".$_POST['b1']."' order by nparte1 ";
elseif($_POST['r1']=="n") $sql="SELECT * FROM farticulos order by nparte1";
else $sql = "SELECT * FROM farticulos ORDER BY nparte1";
	echo mysqli_error($con);
	$sq=mysqli_query($con ,$sql);
	while($reg = mysqli_fetch_array($sq)){
	  	echo "<tr>";
		echo "<td> <div align='center'>" . $reg["nparte1"] . "</div></td>";
		echo "<td> <div align='center'>" . utf8_decode($reg["np_desc1"]) . "</div></td>";
		/*echo "<td> <div align='center'>" . utf8_decode($reg["t7"]) . "</div></td>";
		echo "<td> <div align='center'>" . $reg["t8"] . "</div></td>";*/
		echo "<td> <div align='center'>" .$reg["t5"] . "</div></td>";
		echo "<td> <div align='center'>" . '$ ' . number_format($reg["cos_prom"], 2, '.', ',') . "</div></td>";
		$fec1=$reg["acc_fec"];
		include('DF20000.php');
		echo "<td> <div align='center'>" . $f_f . "&nbsp</div></td>";
	
		
		echo "</tr>";
	}
	mysqli_close($con);   
	?>
    </table>
