<script>
function eliminar_linea(codnotatmp,numlinea,importe)
{
	if (confirm(" Desea eliminar esta linea ? "))

		
		document.getElementById("frame_datos").src="eliminar_linea.php?codnotatmp="+codnotatmp+"&numlinea=" + numlinea;
}

function pon_prefijo(filas,preciotot) {
	parent.document.formulario_lineas.filas.value=filas;
	parent.document.formulario_lineas.preciotot.value=preciotot;
    
}



function nobackbutton(){	
   window.location.hash="no-back-button";	
   window.location.hash="Again-No-back-button" //chrome	
   window.onhashchange=function(){window.location.hash="no-back-button";}	
}

</script>

<html>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
<body onLoad="nobackbutton();">
<?php 
include ("../conexion.php");
?>

<?php
 $codnota=$_POST["codnota"];

	$baseimp=0;
	$baseiva=0;
	$basedescuento=0;
	$contador=0;
	
?>
<div id="xdetalleAW">
  <iframe id="frame_datos" name="frame_datos" width="0%" height="0" frameborder="0">
  <ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
  </iframe>
  <table class="fuente8" width="100%" cellspacing=0 cellpadding=0 border=0 ID="Table1">
<?php
		
	$consulta = "SELECT * FROM notas_proveedores_lineas WHERE codnota='$codnota' ORDER BY numlinea ASC";

if ($resultado = $mysqli->query($consulta)) 
    while ($fila2 = $resultado->fetch_assoc()) {
	
        $numlinea  = $fila2["numlinea"];
        $cdgbar    = $fila2["codigo"];
        $dscart    = $fila2["dscart"];
		$canart    = $fila2["canart"];
		$cosart    = $fila2["cosart"];
		$importe   = $fila2["importe"];
		$impuesto  = $fila2["impuesto"];
		$mondes    = $fila2["mondes"];
		$descuento = $fila2["desfac"];

$consulta3 = "SELECT tarred  FROM web_1001 WHERE CDGBAR='$cdgbar'";
$resultado3 = $mysqli->query($consulta3);
$row3 = $resultado3->fetch_array();
$tarred  = $row3["tarred"];	


	
	$baseimp=$importe+$baseimp;
	$baseiva=$impuesto+$baseiva;
	$basedescuento=$basedescuento+$mondes;

	if ($contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; } ?>
			<tr class="<?php echo $fondolinea?>">
				<td width="14%"><?php echo $cdgbar?></td>
				<td width="40%"><?php echo $dscart?></td>
				<td width="5%" class=""><div align="right"><?php echo $tarred?></div></td>
				<td width="10%" class=""><div align="right"><?php echo $canart?></div></td>
				<td width="10%"><div align="right"><?php echo number_format($cosart,2,".",",")?></div></td>
				<td width="7%" class=""><div align="right"><?php echo number_format($descuento,2,".",",")?></td>
				<td width="11%"><div align="right"><?php echo number_format($importe,2,".",",")?></div></td>
				<td width="8%"></td>
			</tr>
					
					

			
<?php 

$preciotot=$baseimp+$baseiva-$basedescuento;





}


?>





</table>
<blockquote>&nbsp;	</blockquote>
</div>

<div id="ztotalesaw" align="right">
			<table width="98%" border=0 align="right" cellpadding=0 cellspacing=0 class="fuente8">
			  <tr>
			    <td width="70%" class="busqueda"><b>Sub-total</b></td>
				<td width="30%" align="right"><div align="right">
			      <input class="cajaTotales" name="baseimponible" type="text" id="baseimponible" size="12" value="<?php echo number_format($baseimp,2,",",".");?>" align="right" readonly> 
		        </div></td>																					 
	

			  </tr>
			  <tr>
			    <td class="busqueda"><b>Descuento</b></td>
			    <td align="right"><div align="right">
			      <input class="cajaTotales" name="basedescuento2" type="text" id="basedescuento2" size="12" value="<?php echo number_format($basedescuento,2,",",".");?>" align="right" readonly>
		        </div></td>
		      </tr>
			  <tr>
				<td class="busqueda"><b>IVA</b></td>
				<td align="right"><div align="right">
			      <input class="cajaTotales" name="baseimpuestos" type="text" id="baseimpuestos" size="12" align="right" value="<?php echo number_format($baseiva,2,",",".");?>" readonly> 
		        </div></td>
			  </tr>
			  <tr>
				<td class="busqueda"><b>Precio Total</b></td>
			
				<td align="right"><div align="right">
			      <input class="cajaTotales" name="preciototal" type="text" id="preciototal" size="12" align="right" value="<?php echo number_format($preciotot,2,",",".");?>" readonly> 
							  

		        </div></td>
			  </tr>
			</table>

	
	
</div>

	</body>
</html>