FS#97 add a button to add row in CA OD
This commit is contained in:
parent
f0f98f64c6
commit
f811c5520c
4 changed files with 42 additions and 7 deletions
|
|
@ -114,7 +114,7 @@ function caod_checkTotal() {
|
|||
}// Ajouter getElementById par document.all[str]
|
||||
var total_deb=0.0;
|
||||
var total_cred=0.0;
|
||||
var nb_item=10;
|
||||
var nb_item=g('nbrow').value;
|
||||
|
||||
for (var i=0;i <nb_item ;i++) {
|
||||
var doc_amount=g("pamount"+i);
|
||||
|
|
@ -169,4 +169,29 @@ function op_remove(p_dossier,p_oa_group) {
|
|||
{method:'get',parameters:queryString});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* add a row in misc operation for ANC
|
||||
*@todo if we add a line, the number of lines become variables
|
||||
* the code must be adapted for that
|
||||
*/
|
||||
function anc_add_row(tableid) {
|
||||
style='class="input_text"';
|
||||
var mytable=g(tableid).tBodies[0];
|
||||
var nNumberRow=mytable.rows.length;
|
||||
var oRow=mytable.insertRow(nNumberRow);
|
||||
var rowToCopy=mytable.rows[1];
|
||||
var nNumberCell=rowToCopy.cells.length;
|
||||
var nb=g("nbrow");
|
||||
var oNewRow = mytable.insertRow(nNumberRow);
|
||||
for ( var e=0;e < nNumberCell;e++) {
|
||||
var newCell=oRow.insertCell(e);
|
||||
var tt=rowToCopy.cells[e].innerHTML;
|
||||
new_tt=tt.replace(/pop0/g,"pop"+nb.value);
|
||||
new_tt=new_tt.replace(/pamount0/g,"pamount"+nb.value);
|
||||
new_tt=new_tt.replace(/pdeb0/g,"pdeb"+nb.value);
|
||||
newCell.innerHTML=new_tt;
|
||||
new_tt.evalScripts();
|
||||
}
|
||||
$("pamount"+nb.value).value="0";
|
||||
nb.value++;
|
||||
}
|
||||
|
|
@ -60,6 +60,7 @@ echo '
|
|||
</div>
|
||||
';
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// the pa_id is set
|
||||
//
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ class Anc_Group_Operation
|
|||
$wDescription->input()."</td></tr>";
|
||||
$Plan=new Anc_Plan($this->db);
|
||||
$aPlan=$Plan->get_list();
|
||||
$ret.='</table><table style="border: 2px outset blue; width: 100%;">';
|
||||
$max=(count($this->a_operation)<$this->nMaxRow)?$this->nMaxRow:count($this->a_operation);
|
||||
$ret.='</table><table id="ago" style="border: 2px outset blue; width: 100%;">';
|
||||
/* show 10 rows */
|
||||
$ret.="<tr>";
|
||||
foreach ($aPlan as $d)
|
||||
|
|
@ -127,7 +128,7 @@ class Anc_Group_Operation
|
|||
"<th>Débit</th>".
|
||||
"</tr>";
|
||||
|
||||
for ($i = 0;$i < $this->nMaxRow;$i++)
|
||||
for ($i = 0;$i < $max;$i++)
|
||||
{
|
||||
$ret.="<tr>";
|
||||
|
||||
|
|
@ -170,6 +171,14 @@ class Anc_Group_Operation
|
|||
$ret.="</tr>";
|
||||
}
|
||||
$ret.="</table>";
|
||||
if ( $p_readonly==false) {
|
||||
$add_row=new IButton('Ajouter');
|
||||
$add_row->label=_('Ajouter une ligne');
|
||||
$add_row->javascript='anc_add_row(\'ago\');';
|
||||
$ret.=HtmlInput::hidden('nbrow',$max);
|
||||
|
||||
$ret.=$add_row->input();
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
/*!\brief fill row from $_POST data
|
||||
|
|
@ -180,7 +189,7 @@ class Anc_Group_Operation
|
|||
$aPlan=$Plan->get_list();
|
||||
|
||||
|
||||
for ( $i = 0;$i <$this->nMaxRow;$i++) {
|
||||
for ( $i = 0;$i <$p_array['nbrow'];$i++) {
|
||||
foreach ($aPlan as $d)
|
||||
{
|
||||
$idx=$d['id'];
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ class Anc_Operation
|
|||
|
||||
|
||||
$efface=new IButton();
|
||||
$efface->javascript="op_remove('"."$gDossier,".$oldgroup.")";
|
||||
$efface->javascript="op_remove("."$gDossier,".$oldgroup.")";
|
||||
$efface->name="Efface";
|
||||
$efface->label="Efface";
|
||||
$ret.="<td>".$efface->input()."</td>";
|
||||
|
|
@ -254,7 +254,7 @@ class Anc_Operation
|
|||
$jr_id=$this->get_jrid();
|
||||
if ( $jr_id != 0 ){
|
||||
$detail=new IButton();
|
||||
$detail->javascript="viewOperation($jr_id,'"."$gDossier)";
|
||||
$detail->javascript="modifyOperation($jr_id,'"."$gDossier)";
|
||||
$detail->name="Detail";
|
||||
$detail->label="Detail";
|
||||
$ret.="<td>".$detail->input()."</td>";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue