/* * This file is part of NOALYSS. * * NOALYSS is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * NOALYSS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Revision$ */ // Copyright Author Dany De Bontridder danydb@aevalys.eu /** * @brief javascript for the analytic accountancy */ /*!\brief add a row for the CA * \param p_table_id * \param p_amount amount to reach */ function add_row(p_table,p_seq) { var mytable=g(p_table).tBodies[0]; var max=parseFloat(g('amount_t'+p_seq).value); if ( ! mytable ) { return; } var new_value=mytable.rows.length+1; if ( mytable.rows.length > 15 ) { alert("Maximum 15 lignes "); return; } amount=compute_total_table(p_table,p_seq); if ( max < amount ) { alert('Montant incorrect : max = '+max+" calculé="+amount); return; } // For the detail view (modify_op) there is several form and then several time the // element var rowToCopy=mytable.rows[1]; var row=mytable.insertRow(mytable.rows.length); for ( var i=0;i< rowToCopy.cells.length;i++) { var cell=row.insertCell(i); var txt=rowToCopy.cells[i].innerHTML; // txt=txt.replace(/row_1/g,"row_"+new_value); cell.innerHTML=txt; } var col=document.getElementsByName("val["+p_seq+"][]"); col[col.length-1].value=max-amount; anc_refresh_remain(p_table,p_seq); } /** *Compute total of a form from Anc_Operation::display_form_plan *@param p_table table id *@param seq sequence of the line *@see Anc_Operation::display_form_plan */ function compute_total_table(p_table,seq) { try{ var i=0;var tot=0; var col=document.getElementsByName("val["+seq+"][]"); for (i=0;i