Ver Mensaje Individual
  #5 (permalink)  
Antiguo 17/07/2013, 10:33
calbornozd
 
Fecha de Ingreso: junio-2013
Ubicación: Santiago
Mensajes: 13
Antigüedad: 10 años, 10 meses
Puntos: 0
Respuesta: Suma y resta Array con Jquery

alberto510a
En el ejemplo que mandaste esta super bueno, pero aun no puedo lograr ir sumando los demas input dinamicos que se generan en la segunda linea y sucesivamente, ya que me suman la primera linea de input.

Código PHP:
<?
                
/*  Set some variables  */
                
$date=01;
                
$day=01;
                
$off=0;
                 
                
/*  The month and year variables can (should) be passed from a preceding
                    web page rather than hard coded  */
                
$month $_POST['mes'];
                
$year $_POST['anio'];
                 
                
/*  Figure out how many days are in this month  */
                
while (checkdate($month,$date,$year)):
                
$date++;
                endwhile;
                
?>
<?
                
while ($day<$date):
                 
                
?>
                <tr>

<td><? echo $day ?></td>
    <td><input  type="text" name="pendientes" ></td>
    <td><input  type="text" name="provisionado[]"  onKeyDown="sumar();" onKeyUp="sumar();" onkeypress="sumar();" placeholder="sumando1" id="1"></td>
    <td><input  type="text" name="siniestrado_q[]" ></td>
    <td><input  type="text" name="siniestrado_s[]"  onKeyDown="sumar();" onKeyUp="sumar();" onkeypress="sumar();" placeholder="sumando1" id="2"></td>
    <td><input  type="text" name="pagado_q[]" ></td>
    <td><input  type="text" name="pagado_s[]"  onKeyDown="sumar();" onKeyUp="sumar();" onkeypress="sumar();" placeholder="sumando1" id="3"></td>
    <td><input type="text" name="rechazos_q[]" ></td>
    <td><input type="text" name="rechazos_s[]" onKeyDown="sumar();" onKeyUp="sumar();" onkeypress="sumar();" placeholder="sumando1" id="4"></td>
<? 
                
/*  Increment the day and increment the cells that go before the end of the row
                    and end the row when appropriate */
                
$day++;
                
$off++;
                 
                                 
                endwhile;
                
                
                
?>
Como para entender mejor el problema tengo 28 input que se generan dinamicamente en relación a los dias del mes, este caso febrero que tiene 28 días. Necesito sumar y restar los 28 input para el final mandarlo como un total.
Lo que trato de hacer es la siguiente operación matematica "provisionado + siniestrado_s - pagados_s - rechazos_s"