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

	
		document.getElementById("frame_datos").src="eliminar_linea.php?codfacturatmp="+codfacturatmp+"&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'); 
 $codord=$_POST["codord"];
?>
<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
$sel_lineas="SELECT * FROM orden_compra_lineas WHERE codorden='$codord' ORDER BY numlinea ASC";
if ($resultado = $mysqli->query($sel_lineas))
$i=0;
$simbolomoneda="₡";
$preciotot=0;
	$baseimp=0;
	$baseiva=0;
	$basedescuento=0;
 while ($fila = $resultado->fetch_assoc()) {
	$numlinea = $fila["numlinea"];
	$cdgbar = $fila["codigo"];
	$dscart = $fila["dscart"];
	$cantidad = $fila["cantidad"];
	$importe = $fila["importe"];
	$impuesto = $fila["impuesto"];
	$mondes = $fila["mondes"];
	$precos=$importe/$cantidad;
	$baseimp=$importe+$baseimp;
	$baseiva=$impuesto+$baseiva;
	$basedescuento=$basedescuento+$mondes;
	$descuento = $fila["dcto"];
	if ($i % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; } ?>
			<tr class="<?php  echo $fondolinea?>">
				<td width="16%"><?php  echo $cdgbar?></td>
				<td width="45%"><?php  echo $dscart?></td>
				<td width="8%" class=""><div align="right"><?php  echo $cantidad?></div></td>
				<td width="10%"><div align="right"><?php  echo number_format($precos,2,".",",")?></div></td>
				<td width="8%" class=""><div align="right"><?php  echo number_format($descuento,2,".",",")?></td>
				<td width="15%"><div align="right"><?php  echo number_format($importe,2,".",",")?></div></td>

				<td width="2%"><div align="center"></div></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"><?php  echo $simbolomoneda ?>
			      <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>IVA</b></td>
				<td align="right"><div align="right"><?php  echo $simbolomoneda ?>
			      <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> Total</b></td>
			
				<td align="right"><div align="right"><?php  echo $simbolomoneda ?>
			      <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>