<?php
include_once("../php/config.php");
$secuencia = $_GET['id'];


$sql = mysql_query("select id, monto, secuencia, id_factura from pagos_credito where secuencia='$secuencia'") or die(mysql_error());
while($r = mysql_fetch_array($sql)){
	$monto = $r["monto"];
	$id_factura = $r["id_factura"];
	$id_pagos = $r["id"];
    mysql_query("update ventas set balance = balance + '$monto', pagado = pagado - '$monto' where id_venta = '$id_factura'") or die(mysql_error());
    mysql_query("delete from ingresos where id='$secuencia'") or die(mysql_error());
    mysql_query("delete from pagos_credito where id='$id_pagos'") or die(mysql_error());
  
}


echo 1;
   
   


