

<?php include ("../conectar.php");


 ?>
<?php

$cdgart=$_GET["cdgart"];

$query="SELECT * FROM WEB_1001 WHERE cdgart='$cdgart'";
$rs_query=mysql_query($query);

?>
<html>
	<head>
		<title>Principal</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="../funciones/validar.js"></script>
		<script language="javascript">
		
		function calcular_precio001()
			{
				var cosart=document.getElementById("cosart").value;
				var utlart1=document.getElementById("utlart1").value;
				//var cob_iv=document.getElementById("cob_iv").value;
				var desart=document.getElementById("desart").value;
				
					if (document.getElementById("cob_iv").value==1){
				
				descuento= cosart*(desart/100);
				costo1= cosart-descuento;
				impuesto= costo1*(13/100);
				costo2= costo1+impuesto;
				utilidad= costo2*(utlart1/100);
				costofinal=costo2+utilidad;
				
				document.getElementById("pre001").value=costofinal;
				//document.getElementById("impuesto").value=impuesto;
				
				} else {
					
				//descuento=descuento/100;
//				total=preivi*cantidad;
//				descuento=total*descuento;
//				total=total-descuento;
//				var original=parseFloat(total);
//				var result=Math.round(original*100)/100 ;
//				document.getElementById("importe").value=result;
					
			
			}
			}
		function cancelar() {
			location.href="index.php?cadena_busqueda=<? echo $cadena_busqueda?>";
		}
		
		var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		
		function limpiar() {
			document.getElementById("formulario").reset();
		}
	
		</script>
	</head>
	<body>
		<div id="pagina">
			<div id="zonaContenido">
				<div align="center">
				  <p>&nbsp;</p>
				  <div id="tituloForm" class="header">Modificar Artículo </div>
				  <p>&nbsp;</p>
				  <div id="frmBusqueda" class="contenido">
				  
				  <form id="formulario" name="formulario" method="post" action="guardar_articulo.php">
					<table class="fuente8" width="101%" cellspacing=0 cellpadding=3 border=0>
						<tr>
						  <td>Código </td>
							<td colspan="3"><?php echo $cdgart?></td>
					        <td width="42%" colspan="2" rowspan="6">						  <ul id="lista-errores">
				            </ul></td>
			            </tr>
						<tr>
						  <td width="12%">Cód Barras </td>
				            <td colspan="3"><input name="Acdgbar" type="text" class="cajaGrandeNombre" id="cdgbar" 
							value="<?php echo mysql_result($rs_query,0,"cdgbar")?>" size="55" maxlength="55"  onFocus="siguienteCampo ='adscart';"></td>
					    </tr>
						<tr>
						  <td>Descripcion</td>
						  <td colspan="3"><input id="Adscart" type="text" class="cajaGrandeNombre" NAME="Adscart" maxlength="45" value="<?php echo mysql_result($rs_query,0,"dscart")?>"  onFocus="siguienteCampo ='comboestatus';"></td>
			          </tr>
						<tr>
						  <td>tipo</td>
						  <td><select id="select" name="select" class="comboPequeno"  onFocus="siguienteCampo ='Atipart';">
                            <?php
						$tip=mysql_result($rs_query,0,"estart");
					  	$query_tip="SELECT * FROM tipocliente ORDER BY dsctipcli ASC";
						$res_estatus=mysql_query($query_tip);
						$contador=0;
					  ?>
                            <?php
								while ($contador < mysql_num_rows($res_tip)) { 
									if ($estart == mysql_result($res_tip,$contador,"estart")) { ?>
                            <option value="<?php echo mysql_result($res_estatus,$contador,"dsctipcli")?>" selected="selected"><?php echo mysql_result($res_estatus,$contador,"dsctipcli")?></option>
                            <? } else { ?>
                            <option value="<?php echo mysql_result($res_estatus,$contador,"dsctipcli")?>"><?php echo mysql_result($res_estatus,$contador,"dsctipcli")?></option>
                            <? } $contador++;
								} ?>
                          </select>                        
						  <td>Costo                        
						  <td><input id="cosart" name="Acosart" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"cosart")?>" onFocus="siguienteCampo ='ADescripcionBus';">					  </tr>
						<tr>
						  <td>Estatus</td>
						  <td><select id="comboestatus" name="comboestatus" class="comboPequeno"  onFocus="siguienteCampo ='Atipart';">
                            <?php
						$estcli=mysql_result($rs_query,0,"estcli");
					  	$query_estatus="SELECT * FROM estatus ORDER BY nomest ASC";
						$res_estatus=mysql_query($query_estatus);
						$contador=0;
					  ?>
                            <?php
								while ($contador < mysql_num_rows($res_estatus)) { 
									if ($estcli == mysql_result($res_estatus,$contador,"estart")) { ?>
                            <option value="<?php echo mysql_result($res_estatus,$contador,"nomest")?>" selected="selected"><?php echo mysql_result($res_estatus,$contador,"nomest")?></option>
                            <? } else { ?>
                            <option value="<?php echo mysql_result($res_estatus,$contador,"nomest")?>"><?php echo mysql_result($res_estatus,$contador,"nomest")?></option>
                            <? } $contador++;
								} ?>
                          </select>
						  <td>Utilidad 1
					    <td width="17%"><input id="Autiart1" name="Autiart1" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"utiart2")?>" onFocus="siguienteCampo ='ADescripcionBus';">					      </tr>
                      		<tr>
                   		    <td>Descuento</td>
							<td><input id="Adesart" name="Adesart" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"desart")?>"  onFocus="siguienteCampo ='Aexiart';"></td>
							<td>Utilidad 2 </td>
				            <td><input id="Autiart2" name="Autiart2" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"utiart2")?>" onFocus="siguienteCampo ='ADescripcionBus';"></td>
				        </tr>
					    
					<tr>
                   		    <td>Existencia</td>
							<td><input id="exiart" name="Aexiart" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"exiact")?>" onFocus="siguienteCampo ='Acosart';"></td>
							<td>Impuesto</td>
				            <td colspan="2"><input id="Autiart2" name="Autiart22" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"utiart2")?>" onFocus="siguienteCampo ='ADescripcionBus';"></td>
					</tr>
					    
				
				        <tr>
				          <td>&nbsp;</td>
				          <td>&nbsp;</td>
				          <td>Precio Venta</td>
				          <td colspan="2"><input id="pre001" name="pre001" type="text" class="cajaPequena" maxlength="14" value="<?php echo mysql_result($rs_query,0,"pre001")?>" onFocus="siguienteCampo ='ADescripcionBus';"></td>
			          </tr>
			          <tr>
                   		    <td>&nbsp;</td>
							<td width="12%">&nbsp;</td>
				            <td width="17%">&nbsp;</td>
				            <td colspan="2">&nbsp;</td>
				</tr>
					</table>
			        <div id="botonBusqueda">
					  <div align="center"><img src="../img/Symbol-Check_48x48-32.png" width="48" height="48" onClick="validar(formulario,true)" border="0" onMouseOver="style.cursor=cursor" title="Guardar Cambios">
					    <img src="../img/Symbol-Refresh_48x48-32.png" width="48" height="48" onClick="limpiar()" border="0" onMouseOver="style.cursor=cursor" title="Limpiar">
					    <img src="../img/Symbol-Delete_48x48-32.png" width="48" height="48" onClick="cancelar()" border="0" onMouseOver="style.cursor=cursor" title=" Cancelar">
					    <input id="accion" name="accion" value="modificar" type="hidden">
					    <input id="id" name="id" value="" type="hidden">
					    <input id="numbus" name="numbus" value="<?php echo $numbus?>" type="hidden">
				      </div>
			        </div>
			  </form>
		  </div>
		  </div>
		</div>
	</body>
</html>
