Guest User

Untitled

a guest
Aug 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if($token=="eceea3ed7aae80789d282149d650c477" && $contratoenbia !="")
  5. {
  6.  
  7. mysql_select_db($database_seguro, $conexion_estable);
  8. $query_deudasregi = "SELECT * FROM deudas WHERE id_contrato = '$contratoenbia' AND id_cliente = '$clientefinldt' AND estado IN (1,3) ";
  9. $deudasregi = mysql_query($query_deudasregi, $conexion_estable) or die(mysql_error());
  10. $row_deudasregi = mysql_fetch_assoc($deudasregi);
  11. $totalRows_deudasregi = mysql_num_rows($deudasregi);
  12.  
  13. ?>
  14. <br>
  15.  
  16.  
  17.  
  18. <table class="table">
  19. <thead>
  20. <tr>
  21. <th>ID / Factura</th>
  22. <th>Servicio</th>
  23. <th>Servicio / Contrato</th>
  24. <th>Periodo</th>
  25. <th>Total</th>
  26. <th>Abonos</th>
  27. <th>Nuevo Valor</th>
  28. <th>AUX</th>
  29. <th>Eliminar</th>
  30. <th>Guardar</th>
  31. </tr>
  32. </thead>
  33. <tbody>
  34. <?php
  35. do
  36. {
  37.  
  38. $value=$row_deudasregi['id_deuda'];
  39.  
  40. $direcciondeestadeudacontrato=contato_direccion($row_deudasregi['id_contrato'],$conexion_estable,$database_seguro);
  41. ?>
  42. <tr>
  43. <td><?php echo $value; ?></td>
  44. <td><?php echo nombredeunservicio($row_deudasregi['id_servicio'],$conexion_estable,$database_seguro).' / '.concepto_aux_deuda($row_deudasregi['id_deuda'],$conexion_estable,$database_seguro); ?></td>
  45. <td><?php echo nombredeunservicio($row_deudasregi['id_servicio'],$conexion_estable,$database_seguro).' '.$row_deudasregi['id_contrato'].' / '.direcciondecliente($direcciondeestadeudacontrato,$conexion_estable,$database_seguro); ?></td>
  46. <td><?php echo $row_deudasregi['mes_servicio']; ?></td>
  47. <td><?php echo number_format($row_deudasregi['valor_total']); ?></td>
  48. <td><?php echo number_format($row_deudasregi['valor_parcial']); ?></td>
  49. <td><div class="form-group row">
  50.  
  51. <div class="col-lg-12">
  52. <input type="number" id="nuevovalor" name="nuevovalor[]"
  53. value="<?php echo $row_deudasregi['valor_total']-$row_deudasregi['valor_parcial']; ?>"
  54. min="<?php echo $row_deudasregi['valor_parcial']; ?>"
  55. required="" class="form-control valorapagar">
  56. </div>
  57.  
  58. </div>
  59. </td>
  60. <td>
  61. <div class="form-group row">
  62. <div class="col-lg-12">
  63. <input id="conceotodeuda" type="text" name="conceotodeuda[]" value="<?php echo $row_deudasregi['concepto_aux']; ?>" class="form-control valorapagar">
  64. </div>
  65. </div>
  66. </td>
  67. <td>
  68. <div class="checkbox checkbox-switchery">
  69. <label>
  70. <input id="elimina" name="elimina[]" value="1" type="checkbox" class="switchery">
  71. </label>
  72. </div>
  73. </td>
  74. <td>
  75.  
  76. <div class="checkbox checkbox-switchery">
  77. <label>
  78. <input required="" id="aprueba" name="aprueba[]" value="1" type="checkbox" class="switchery">
  79. </label>
  80. </div>
  81.  
  82. <input type="hidden" id="id_deuda_paga" name="id_deuda_paga[]" value="<?php echo $row_deudasregi['id_deuda']; ?>" >
  83. </td>
  84. </tr>
  85. <?php } while ($row_deudasregi = mysql_fetch_assoc($deudasregi)); ?>
  86. </tbody>
  87. </table>
  88.  
  89. <?php
  90.  
  91. /////recorrido del array con la info
  92. if(is_array($_POST['nuevovalor']))
  93. {
  94. ////iniciamos el recorrido
  95. while(list($key,$value) = each($_POST['nuevovalor']))
  96. {
  97.  
  98. @list($key,$valueb) = each($_POST['id_deuda_paga']);
  99. {
  100. @$ideladeudapagada=$valueb;
  101. }
  102. @list($key,$valuec) = each($_POST['conceotodeuda']);
  103. {
  104. @$conceptodeuda=$valuec;
  105. }
  106. @list($key,$valued) = each($_POST['elimina']);
  107. {
  108. @$eliminadeuda=$valued;
  109. }
  110. @list($key,$valuee) = each($_POST['aprueba']);
  111. {
  112. @$apruebadeuda=$valuee;
  113. }
  114.  
  115.  
  116.  
  117. if($apruebadeuda>0)
  118. {
  119.  
  120.  
  121. if($eliminadeuda>0)
  122. {
  123.  
  124.  
  125. //////REGISTRANDO PAGOS
  126. ///selecionamos la base de datos
  127. mysql_select_db($database_seguro, $conexion_estable);
  128. $nuevousuarioguardar = "DELETE FROM deudas WHERE id_deuda ='$ideladeudapagada' ";
  129. $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>');
  130. }
  131. else
  132. {
  133.  
  134. ///selecionamos la base de datos para la consulta
  135. mysql_select_db($database_seguro, $conexion_estable);
  136. $nuevousuarioguardartdescuadre = "UPDATE deudas SET valor_total='$value', concepto_aux='$conceptodeuda'
  137. WHERE id_deuda = '$ideladeudapagada' ";
  138. $nuevousuariotdes = mysql_query($nuevousuarioguardartdescuadre, $conexion_estable) or die
  139. ('<div class="alert alert-danger"><strong>Oh no!</strong> Lo Sentimos pero algo ha fallado. Detalles del error: '.mysql_error().'</div>');
  140.  
  141. }
  142. }
  143. }
  144. }
  145. ?>
Add Comment
Please, Sign In to add comment