Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($token=="eceea3ed7aae80789d282149d650c477" && $contratoenbia !="")
- {
- mysql_select_db($database_seguro, $conexion_estable);
- $query_deudasregi = "SELECT * FROM deudas WHERE id_contrato = '$contratoenbia' AND id_cliente = '$clientefinldt' AND estado IN (1,3) ";
- $deudasregi = mysql_query($query_deudasregi, $conexion_estable) or die(mysql_error());
- $row_deudasregi = mysql_fetch_assoc($deudasregi);
- $totalRows_deudasregi = mysql_num_rows($deudasregi);
- ?>
- <br>
- <table class="table">
- <thead>
- <tr>
- <th>ID / Factura</th>
- <th>Servicio</th>
- <th>Servicio / Contrato</th>
- <th>Periodo</th>
- <th>Total</th>
- <th>Abonos</th>
- <th>Nuevo Valor</th>
- <th>AUX</th>
- <th>Eliminar</th>
- <th>Guardar</th>
- </tr>
- </thead>
- <tbody>
- <?php
- do
- {
- $value=$row_deudasregi['id_deuda'];
- $direcciondeestadeudacontrato=contato_direccion($row_deudasregi['id_contrato'],$conexion_estable,$database_seguro);
- ?>
- <tr>
- <td><?php echo $value; ?></td>
- <td><?php echo nombredeunservicio($row_deudasregi['id_servicio'],$conexion_estable,$database_seguro).' / '.concepto_aux_deuda($row_deudasregi['id_deuda'],$conexion_estable,$database_seguro); ?></td>
- <td><?php echo nombredeunservicio($row_deudasregi['id_servicio'],$conexion_estable,$database_seguro).' '.$row_deudasregi['id_contrato'].' / '.direcciondecliente($direcciondeestadeudacontrato,$conexion_estable,$database_seguro); ?></td>
- <td><?php echo $row_deudasregi['mes_servicio']; ?></td>
- <td><?php echo number_format($row_deudasregi['valor_total']); ?></td>
- <td><?php echo number_format($row_deudasregi['valor_parcial']); ?></td>
- <td><div class="form-group row">
- <div class="col-lg-12">
- <input type="number" id="nuevovalor" name="nuevovalor[]"
- value="<?php echo $row_deudasregi['valor_total']-$row_deudasregi['valor_parcial']; ?>"
- min="<?php echo $row_deudasregi['valor_parcial']; ?>"
- required="" class="form-control valorapagar">
- </div>
- </div>
- </td>
- <td>
- <div class="form-group row">
- <div class="col-lg-12">
- <input id="conceotodeuda" type="text" name="conceotodeuda[]" value="<?php echo $row_deudasregi['concepto_aux']; ?>" class="form-control valorapagar">
- </div>
- </div>
- </td>
- <td>
- <div class="checkbox checkbox-switchery">
- <label>
- <input id="elimina" name="elimina[]" value="1" type="checkbox" class="switchery">
- </label>
- </div>
- </td>
- <td>
- <div class="checkbox checkbox-switchery">
- <label>
- <input required="" id="aprueba" name="aprueba[]" value="1" type="checkbox" class="switchery">
- </label>
- </div>
- <input type="hidden" id="id_deuda_paga" name="id_deuda_paga[]" value="<?php echo $row_deudasregi['id_deuda']; ?>" >
- </td>
- </tr>
- <?php } while ($row_deudasregi = mysql_fetch_assoc($deudasregi)); ?>
- </tbody>
- </table>
- <?php
- /////recorrido del array con la info
- if(is_array($_POST['nuevovalor']))
- {
- ////iniciamos el recorrido
- while(list($key,$value) = each($_POST['nuevovalor']))
- {
- @list($key,$valueb) = each($_POST['id_deuda_paga']);
- {
- @$ideladeudapagada=$valueb;
- }
- @list($key,$valuec) = each($_POST['conceotodeuda']);
- {
- @$conceptodeuda=$valuec;
- }
- @list($key,$valued) = each($_POST['elimina']);
- {
- @$eliminadeuda=$valued;
- }
- @list($key,$valuee) = each($_POST['aprueba']);
- {
- @$apruebadeuda=$valuee;
- }
- if($apruebadeuda>0)
- {
- if($eliminadeuda>0)
- {
- //////REGISTRANDO PAGOS
- ///selecionamos la base de datos
- mysql_select_db($database_seguro, $conexion_estable);
- $nuevousuarioguardar = "DELETE FROM deudas WHERE id_deuda ='$ideladeudapagada' ";
- $nuevousuario = mysql_query($nuevousuarioguardar, $conexion_estable) or die('<div class="alert alert-danger"><strong>Oh no!</strong> Lo Sentimos pero algo ha fallado. Detalles del error: '.mysql_error().'</div>');
- }
- else
- {
- ///selecionamos la base de datos para la consulta
- mysql_select_db($database_seguro, $conexion_estable);
- $nuevousuarioguardartdescuadre = "UPDATE deudas SET valor_total='$value', concepto_aux='$conceptodeuda'
- WHERE id_deuda = '$ideladeudapagada' ";
- $nuevousuariotdes = mysql_query($nuevousuarioguardartdescuadre, $conexion_estable) or die
- ('<div class="alert alert-danger"><strong>Oh no!</strong> Lo Sentimos pero algo ha fallado. Detalles del error: '.mysql_error().'</div>');
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment