<?php
include("conexion.php");
													
//$r=mysqli_query($conexion,"SELECT o.*, p.*, pt.*, SUM(ordcomdet_precio * ordcomdet_cantidad) AS monto, SUM(ordcomdet_cantidad) AS cantidad_total FROM orden_compra o INNER JOIN personas p ON o.per_codi_fk=p.per_codi INNER JOIN pago_tipo pt ON o.pagtip_codi_fk=pt.pagtip_codi INNER JOIN orden_compra_detalle ocd ON ocd.ordcom_codi_fk=o.ordcom_codi GROUP BY o.ordcom_codi ORDER BY o.ordcom_fecha desc, ordcom_numero desc;");	
												
$r=mysqli_query($conexion,"SELECT *, SUM(ocd.ordcomdet_precio * ocd.ordcomdet_cantidad) AS monto, SUM(ocd.ordcomdet_cantidad) AS cantidad_total FROM orden_compra o INNER JOIN orden_compra_detalle ocd ON ocd.ordcom_codi_fk=o.ordcom_codi INNER JOIN documento_pago dp ON dp.docpag_codi=o.docpag_codi_fk GROUP BY o.ordcom_codi ORDER BY o.ordcom_fecha desc, o.ordcom_numero desc;");	

//$nregistros = mysqli_num_rows($result1);

while($row1=mysqli_fetch_array($r)){
//$nn=$nn+1;
	echo  $row1['ordcom_numero']. '<br>';


}

?>
