<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");

include("DF80000.php");
//include("DF30000.inc");

//require_once("DFJQUERY.inc");

?>
<html>
<link rel="stylesheet" href="ALM_CSS.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<?php

$click = $_REQUEST["bot"];
if ($_REQUEST["bot"] == ""){
$click = $_GET['n_reg'];
}else{
$click = $_REQUEST["bot"];
}

	if(!isset($_REQUEST['tap2'])){
		include('AL10500_CL.php');
		$varible_clase = new clase();
		$res=$varible_clase->lista_busqueda($click);
		$reg=mysqli_fetch_array($res);
		$_REQUEST['nparte1']=$reg['nparte1'];
		$_REQUEST['id_pro']=$reg['id_pro'];
		$_REQUEST['tap2']=$reg['np_desc1'];
		$_REQUEST['precio']=$reg['lim_vta1'];
		$_REQUEST['tel1']=$reg['tel1'];
		$_REQUEST['tel2']=$reg['tel2'];
		$_REQUEST['calle']=$reg['calle'];
		$_REQUEST['estado']=$reg['estado'];
		$_REQUEST['postal']=$reg['postal'];
		$_REQUEST['colonia']=$reg['colonia'];
		$_REQUEST['delegacion']=$reg['delegacion'];
		$_REQUEST['fax']=$reg['fax'];
		$_REQUEST['curp']=$reg['curp'];
		$_REQUEST['web']=$reg['web'];
		$_REQUEST['mail']=$reg['mail'];
		$_REQUEST['rfc']=$reg['rfc'];
		$_REQUEST['contacto']=$reg['contacto'];
		$_REQUEST['proveedor']=$reg['proveedor'];
		$_REQUEST['dias']=$reg['dias'];
		$_REQUEST['numero']=$reg['numero'];
		//$_REQUEST['fic_tec']=$reg['fic_tec'];
		$_REQUEST['acc_fec']=chfecha($reg['acc_fec'],'Y-m-d','d/m/Y');
		$_REQUEST['pais']=$reg['pais'];
		//$_REQUEST['proteinas']=$reg['proteinas'];
		$_REQUEST['t1']=$reg['t1'];
		$_REQUEST['t2']=$reg['t2'];
		$_REQUEST['t3']=$reg['t3'];
		$_REQUEST['t4']=$reg['t4'];
		$_REQUEST['t5']=$reg['t5'];
		$_REQUEST['t6']=$reg['t6'];
		$_REQUEST['t7']=$reg['t7'];
		$_REQUEST['t8']=$reg['t8'];
		$_REQUEST['t9']=$reg['t9'];
		$_REQUEST['t10']=$reg['t10'];
		$_REQUEST['seccion']=$reg['seccion'];
		$_REQUEST['anaquel']=$reg['anaquel'];
		$_REQUEST['cubo']=$reg['cubo'];
		$_REQUEST['max']=$reg['max'];
		$_REQUEST['cos_prom']=$reg['cos_prom'];
		$_REQUEST['marca']=$reg['marca'];
		$_REQUEST['estante']=$reg['estante'];
		$_REQUEST['min']=$reg['min'];
		$_REQUEST['sub']=$reg['sub'];
	}
?>
<style type="text/css">
<!--
.Estilo18 {color: #FFFFFF}
.Estilo24 {font-size: 11px; font-weight: bold; }
.Estilo26 {font-size: 12px; font-weight: bold; }
-->
</style>

<body>

<form name="frm1" method="post" action="" enctype="multipart/form-data">
    
      <input name="bot" type="hidden" value="<?php
 echo $_REQUEST['bot'];?>"> 
      
    
    <div id="width_cabe" align="center">
	<table align="center" >
    <tr>
      <td colspan="6" class="titulo">CONSUMO PROMEDIO </td>
    </tr>
    <tr>
      <th width="92" style="#FFCC00"><span class="Estilo24">DESCRIPCION      </span></th>
      <td colspan="5"><input name="tap2" id="tap2" type="text" tabindex="1"
		  onBlur="may(this)" size="40"
		<?php

			if(isset($_REQUEST['tap2'])){ 
				echo 'value="' . $_REQUEST['tap2'] .  '"';
			}
		?>>
	  <input name="nparte1" id="nparte1" type="hidden" tabindex="1"
		  onBlur="may(this)" size="10"
		<?php

			if(isset($_REQUEST['nparte1'])){ 
				echo 'value="' . $_REQUEST['nparte1'] .  '"';
			}
		?>>	  </td>
      </tr>
 
      
      <tr>
        <th style="#FFCC00"><div align="right" class="Estilo24">SUB-AGRUPADOR</div></th>
        <td><input name="agrupador" type="text" id="agrupador" onKeyPress="return validar(event)" size="30"  value="<?php
 echo $_REQUEST['t7'];?>"></td>
        <th style="#FFCC00"><span class="Estilo24">CAPACIDAD</span></th>
        <td><input name="t6" type="text" id="t6" tabindex="3" size="5"  value="<?php
 echo $_REQUEST['t6'];?>">
          <span class="Estilo18">
          <select name="t10" id="t10" onChange="javascript: document.getElementById('frm1').submit()" tabindex="6">
            <option value="">-SEL-</option>
            <?php
 
$sql = mysqli_query($con ,"SELECT * FROM dgmedida");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['t10']==$reg['np_desc1'] ){
		echo '<option value="' . $reg['np_desc1'] . '" selected>' . $reg['np_desc1'] . '</option>';
	}else{
		echo '<option value="' . $reg['np_desc1'] . '">' . $reg['np_desc1'] . '</option>';
	}
}
?>
          </select>
        </span></td>
        <th style="#FFCC00"><div align="center" class="Estilo24">MAX</div></th>
        <td><span class="Estilo24">
          <input name="max" type="text" id="max" tabindex="21" size="10"  value="<?php
 echo $_REQUEST['max'];?>">
        </span></td>
      </tr>
      <tr>
        <th width="103" style="#FFCC00"><div align="right" class="Estilo24">AGRUPADOR</div></th>
		<td><span class="Estilo18">
		  &nbsp;
		  <input name="t8" type="text" id="t8" onKeyPress="return validar(event)" size="30"  value="<?php
 echo $_REQUEST['t8'];?>">
		</span></td>
		<th style="#FFCC00"><span class="Estilo24">UNIDAD DE MEDIDA</span></th>
		<td><select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()" tabindex="5">
          <option value="">---SELECCIONE---</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM dgmedida");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['pais']==$reg['np_desc1'] ){
		echo '<option value="' . $reg['np_desc1'] . '" selected>' . $reg['np_desc1'] . '</option>';
	}else{
		echo '<option value="' . $reg['np_desc1'] . '">' . $reg['np_desc1'] . '</option>';
	}
}
?>
        </select></td>
        <th style="#FFCC00"><div align="center" class="Estilo24">MIN</div></th>
        <td><span class="Estilo24">
  <label></label>
        <input name="min" type="text" id="min" tabindex="22" size="10"  value="<?php
 echo $_REQUEST['min'];?>">
        </span></td></tr>
    <tr>
      <th height="29" style="#FFCC00"><div align="right" class="Estilo24">ALMACEN</div></th>
      <td><label>
      &nbsp;
      <input name="sub" type="text" id="sub" onKeyPress="return validar(event)" size="30"  value="<?php
 echo $_REQUEST['sub'];?>">
      </label></td>
      <th style="#FFCC00"><span class="Estilo24">MARCA</span></th>
      <td><span class="Estilo18">
        <label></label>
        <select name="marca" id="marca" onChange="javascript: document.getElementById('frm1').submit()" tabindex="6">
          <option value="">---SELECCIONE---</option>
          <?php
 
$sql = mysqli_query($con ,"SELECT * FROM comar WHERE descripcion = 'ACTIVO'");
while($reg=mysqli_fetch_array($sql)){
	if($_REQUEST['marca']==$reg['np_desc1'] ){
		echo '<option value="' . $reg['np_desc1'] . '" selected>' . $reg['np_desc1'] . '</option>';
	}else{
		echo '<option value="' . $reg['np_desc1'] . '">' . $reg['np_desc1'] . '</option>';
	}
}
?>
        </select>
      </span></td>
      <th style="#FFCC00"><label><span class="Estilo24">EXISTENCIAS</span></label></th>
      <td><span class="Estilo24">
        <label></label>
        <input name="t5" type="text" id="t5" tabindex="26" size="10" value="<?php
 echo $_REQUEST['t5'];?>">
      </span></td>
      </tr>
    <tr>
      <th height="29" style="#FFCC00">&nbsp;</th>
      <td><label>
      &nbsp;
      </label></td>
      <th style="#FFCC00"><span class="Estilo24">ULTIMO COSTO $</span></th>
      <td><label><span class="Estilo24">
        <input name="t3" type="text" id="t3" tabindex="24" size="10"  value="<?php
 echo $_REQUEST['t3'];?>">
      </span></label></td>
      <th style="#FFCC00"><label><span class="Estilo24">COSTO PROMEDIO</span></label></th>
      <td><input name="cos_prom" type="text" id="cos_prom" tabindex="25" size="10" value="<?php
 echo $_REQUEST['cos_prom'];?>"></td>
    </tr>
	
    <tr>
      <th height="29" style="#FFCC00"><div align="right" class="Estilo24">A&Ntilde;O :</div></th>
      <td><span class="Estilo18">
		<select name="ano" id="ano" onChange="javascript: document.getElementById('frm1').submit()">
            <option value="2013"<?php
 if($_REQUEST['ano']=="2013") echo 'selected';?>>2013</option>
            <option value="2014"<?php
 if($_REQUEST['ano']=="2014") echo 'selected';?>>2014</option>
          </select>
      </span></td>
      <th style="#FFCC00">&nbsp;</th>
      <td>&nbsp;</td>
      <th style="#FFCC00">&nbsp;</th>
      <td>&nbsp;</td>
    </tr>
	
	<?php

	$armes=array(1=>"1","2","3","4","5","6","7","8","9","10","11","12");
	
	$array = array(1, 2);
$count = count($armes);

$proXlin=3;
$auxNumLin=-1;

for ($i = 1; $i <= $count; $i++) {
    
	
	$auxNumLin++;
	if($auxNumLin==-1 || $auxNumLin%$proXlin==0){
		if($auxNumLin==-1){
			echo "<tr>";
		}else{
			echo "</tr><tr>";
		}
	}
	
	$mes = mesLetra($armes[$i]);
	echo "<th style='#FFCC00'><div align='right' class='Estilo24'>".$mes."</div></th>";
	$sqlExi=mysqli_fetch_array(mysqli_query($con ,"SELECT tot_ent FROM alconprom WHERE id_art='".$_REQUEST['nparte1']."' and mes='$armes[$i]' and ano='".$_POST['ano']."'"));
	echo "<td > <input name='cos_prom2' type='text' id='cos_prom2' tabindex='25' size='10' value=" .number_format($sqlExi['tot_ent'],2,'.',',')." ></td>";
	
		
}


?>
	  
      <tr>
        <td height="29" colspan="6">
          <div align="center">
            <input name="bot4" type="button" class="bot_WsW" tabindex="28" onClick="cargapag('AL34000_PR.php','_self')" value="Regresar"/>
          </div></td>
      </tr>
    </table>
	</div>

  
</form>
</body>
</html>
<?php
 mysqli_close($con);?>

</body>
</html>



