<?php
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
$CONT=0;
$s="SELECT * FROM cobroz_ventas WHERE cv_cob_anu='NO' ORDER BY id_cv";
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	$ID_CV=$r['id_cv'];
	$VEN_ID=$r['cv_id_ven'];
	$COB_ID=$r['cv_id_cob'];
	$VX=gn("count(*)","ventas","id_venta=$VEN_ID");
	$CX=gn("count(*)","cobroz","id_cobro=$COB_ID");
	if($VX==0){
		echo "VNR=".$VEN_ID."<br>";
	}
	if($CX==0){
		$RE=gn("count(*)","cobroz_ventas","cv_id_ven=$VEN_ID AND cv_cob_anu='NO'");
		$KX=gn("count(*)","cotizaciones","id_cotizacion=$COB_ID");
		$CONT++;
		$SYS_FEC=gs("cv_sys_fec","cobroz_ventas","id_cv=$ID_CV");
		//if($RE>1){
			echo "CNR=".$COB_ID." FEC=".$SYS_FEC." COT=".$KX." RE=".$RE." VEN_ID=".$VEN_ID."<br>";
		//}
	}
}
echo "FIN=".$CONT;
?>