<?php
session_start();
include("../cls_conexion.php");$CNN=new ClsMySQL();include("../conexion23.php");
//++++++
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("../login.php");	return;}
///////////////////////////////////////////////////////
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
//
$HOR_ID=0;
include("ventas_control_fun.php");
//+++++
$VP_RegXPag=12;
$LStrTR=gn("count(*)","vis_ventas_control","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Control de ventas</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="e3/funciones.js"></script>
<script type="text/javascript" src="e3/ventas_control.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="e2/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="e2/basic.css"  />
<style type="text/css">
.cF {height:600px;width:1000px;position:relative;top:0px}
</style>
<script>
$(document).ready(function(){  
   Inicializar();
});
</script>
</head>

<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" action="ventas_control.php">
<!--INI_TITULO-->
<div id="DivT" class="dT" >
<img src="../png/vi_ventas_internas.png" class="iT" />
<div class="tT">CONTROL DE VENTAS</div>
</div>
<!--FIN_TITULO-->

<div class="s10" style="left:35px; top:109px; width: 85px; height: 18px;">
EMPRESA</div>
<select name="Emp" id="Emp" 
class="lt" style="left:35px; top:126px; width: 126px;"
tabindex="<?php echo ++$TI;?>">
<?php
	echo FCBO("emp_nomc","empresas","id_emp>0",$Emp,"N","S");
?>
</select>

<?php if(strlen($Mes)==0)$Mes=gs("mes","meses","id_mes=".date("m"));?>
<div class="s10" style="left:170px; top:109px; width: 85px; height: 18px;">
MES</div>
<select name="Mes" id="Mes" 
class="lt" style="left:170px; top:126px; width: 126px;"
tabindex="<?php echo ++$TI;?>">
<?php
echo FCBOO("mes","meses","id_mes>0",$Mes,"N","S","id_mes");
?>
</select>

<?php if(strlen($Ani)==0)$Ani=date("Y");?>
<div class="s10" style="left:304px; top:109px; width: 85px; height: 18px;">
AÑO</div>
<select name="Ani" id="Ani" 
class="lt" style="left:304px; top:126px; width: 80px;"
tabindex="<?php echo ++$TI;?>">
<?php
echo FCBO("a_anio","anios","id_a>0",$Ani,"N","S");
?>
</select>

<div class="s10" style="left:394px; top: 109px; width: 120px; height: 18px;">
TOTAL OBJETIVO</div>
<input name="Tot"  type="text" 
class="ndd"  id="Tot" style="left:392px; top: 126px; width: 96px;"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Tot;?>"  />

<div class="s10" style="left:498px; top: 109px; width: 120px; height: 18px;"> OBSERVACION
</div>
<input name="Obs"  type="text" 
class="lt"  id="Obs" style="left:498px; top: 126px; width: 262px;"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Obs;?>"  />

<!--INI_BOTONES----->
<?php 
	$BUSCAR="ventas_control_b.php";
	$F_N="flNuevo()";
?>
<?php include("botones.php");?>;
<!--FIN_BOTONES-->
<!--INI_TABLA----->
<div class="datagrid" 
style="position:absolute; left: 35px; top: 168px; width: 931px; height: 400px;">
<table width="75%">
<thead>
<tr>
<td colspan="10" height="18" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<th width="18%">EMPRESA</th>
<th width="9%">MES</th>
<th width="8%">AÑO</th>
<th width="10%">TOTAL</th>
<th width="52%">OBSERVACION</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$s="SELECT * FROM vis_ventas_control WHERE ID>0 ORDER BY ANI_ DESC,MES_ DESC ";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);	  				
$rs=grs($s);
while($r=$rs->fetch_assoc()){
?>
	<tr onDblClick="fActivar(<?php echo $r['ID'];?>);">
	<!----------------------------------------------->
    <td ><?php echo $r['EMP'];?></td>
	<td ><?php echo $r['MES'];?></td>
    <td ><?php echo $r['ANI_'];?></td>
    <td ><?php echo $r['TOT'];?></td>
    <td ><?php echo $r['OBS'];?></td>
	<!----------------------------------------------->
	<td bgcolor="#FFFFFF" align="center">
	<a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
	<img src="../img/b_edit.png"  border="0"/></a></td>
	</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="s1" id="DivDoc" style="left:157px; top:562px; width: 251px; height: 18px;">
  
</div>
<div class="s1" id="DivDocN" style="left:660px; top:562px; width: 307px; height: 18px;">
  
</div>

<!--FIN_TABLA----->
<!--INI_OCULTOS-------------------------------->
<?php include("ocultos.php");?>
<!--FIN_OCULTOS-------------------------------->
</form>
</div>
</div>
</body>
</html>
