<?php

session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
$com = "A";
include("DF30000.inc");
include("DF80000.php");
include("DFJSISCI.inc");
require_once("DFJQUERY.inc");
$sql=mysqli_query($con ,"SELECT codfre FROM frecomart order by nparte1 desc limit 1");
$row=mysqli_fetch_array($sql);
?>
<html>
<head>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
</head>
<body>
<table width="894" height="43" border="0">
  <tr>
    <th colspan="12" scope="col">ORDEN DE COMPRA No. <?php
 echo $row['codfre']; ?> </th>
  </tr>
  <tr>
    <th width="20" scope="col"><input type='checkbox' name='checkbox' onClick="todos(this)"></th>
    <th width="39" scope="col">Clave</th>
    <th width="95" scope="col">Articulo</th>
    <th width="73" scope="col">Marca</th>
    <th width="96" scope="col">Proveedor</th>
    <th width="63" scope="col">Cantidad</th>
    <th width="78" scope="col">Unidad de medida </th>
    <th width="77" scope="col">Costo Promedio</th>
    <th width="69" scope="col">Costo por Unidad</th>
    <th width="64" scope="col">Subtotal</th>
    <th width="87" scope="col">Fecha Inicio</th>
    <th width="83" scope="col">Fecha Final</th>
  </tr>
  <?php

	$sql2=mysqli_query($con ,"SELECT * FROM frecomart where codfre=(SELECT nparte1 FROM frecomp order by nparte1 desc limit 1) order by nparte1 asc");
while($row2 = mysqli_fetch_array($sql2)){

?>
  <div align="center">
    <tr align="center">
      <input name='txtnot' type='hidden'  id='txtnot' value=" <?php
 echo $row2["codfre"]; ?>" />
      <td width="20" align="right"><?php

	echo " <input type='checkbox' name='txtcod[".$row2["nparte1"]."]'>"; ?></td>
      <td width="39" height="22"><?php
 echo $row2['codart']; ?></td>
      <td width="95"><?php
 echo $row2['desc_art']; ?></td>
      <td width="73"><?php
 echo $row2['nom_mar']; ?></td>
      <td width="96"><?php
 echo $row2['nom_prov']; ?></td>
      <td width="63" align="right"><?php
 echo number_format($row2['cant'],2,'.',','); ?></td>
      <td width="78"><?php
 echo $row2['uni_med']; ?></td>
      <td width="77" align="right"><?php
 echo number_format($row2['cos_prom'],2,'.',','); ?></td>
      <td width="69" align="right"><?php
 echo number_format($row2['precio'],2,'.',','); ?></td>
      <td width="64" align="right"><?php
 echo number_format($row2['subpre'],2,'.',',');?></td>
      <td width="87"><?php
 echo date('d/m/Y', strtotime( $row2['fec_ini'])); ?></td>
      <td width="83"><?php
 echo date('d/m/Y', strtotime( $row2['fec_fin'])); ?></td>
    </tr>
  </div>
  <?php
	
	$total +=$row2["subpre"];
} ?>
  <tr>
    <div id="total" style="display:none">
    <th colspan="11" scope="col" align="right"><div id="tot" align="right" style="display:none">TOTAL:</div></th>
    <th scope="col"><div align="right" id="tot2" style="display:none"><?php
 echo number_format($total,2,'.',',');?> </div></th>
	</div>
  </tr>
</table>
</body>
</html>