47 $this->date=date(
"d.m.Y");
58 foreach ($this->a_operation as
$row)
60 $add=round(
$row->oa_amount,2);
61 $add=(
$row->oa_debit==
't')?$add:$add*(-1);
65 if (
$amount != 0 )
throw new Exception (_(
'Operation non equilibrée'));
71 $this->
db->rollback();
72 throw new Exception(
$e);
87 $wDescription=
new IText(
"pdesc");
88 $wDescription->table=0;
89 $wDescription->size=80;
93 if ( isset ($this->a_operation[0]))
95 $wDate->value=$this->a_operation[0]->oa_date;
96 $wDescription->value=$this->a_operation[0]->oa_description;
101 $ret.=
'<table style="result" >';
103 $ret.=
"<TR>".td(_(
"Date")).td(
$wDate->input()).
"</tr>";
104 $ret.=
'<tr><td>Description</td>'.
106 $wDescription->input().
"</td></tr>";
108 $aPlan=$Plan->get_list();
109 $this->a_operation=(empty($this->a_operation))?[]:$this->a_operation;
110 $max=(count($this->a_operation)<$this->nMaxRow)?$this->nMaxRow:count($this->a_operation);
111 $ret.=
'</table><table id="ago" style="width: 100%;">';
114 $ret.=
th(_(
"Fiche"),
'style="text-align:left"').th(
"");
115 foreach ($aPlan as $d)
119 $aPoste[
$idx]=$this->
db->make_array(
"select 0 as value,'-' as label "
120 .
" union select po_id as value,".
121 " po_name||':'||coalesce(po_description,'-') as label ".
122 " from poste_analytique ".
123 " where pa_id = ".
$idx.
126 $ret.=
"<th style=\"text-align:left\">".$d[
'name'].
"</th>";
129 "<th style=\"text-align:left\">"._(
'Montant') .
"</th>".
130 "<th style=\"text-align:left\">"._(
"Débit").
"</th>".
135 if (
$p_readonly == 1 && isset($this->a_operation[
$i]) && $this->a_operation[
$i]->po_id ==0 )
continue;
139 $card->set_attribute(
"typecard", sprintf(
"[sql] fd_id in (select fd_id from jnt_fic_attr where ad_id=%s)",
ATTR_DEF_ACCOUNT));
140 $card->set_attribute(
'label',
"qcode{$i}_label");
142 $card->value=(isset($this->a_operation[
$i]->card))?$this->a_operation[
$i]->card:
"";
149 $label->style=
"vertical-align:top";
152 foreach ($aPlan as $d)
157 $wSelect->value=$aPoste[
$idx];
161 if ( isset($this->a_operation[
$i]))
163 $wSelect->selected=$this->a_operation[
$i]->po_id;
165 $ret.=
td($wSelect->input());
167 $wAmount=
new INum(
"pamount$i",0.0);
170 $wAmount->javascript=
" onChange=format_number(this);caod_checkTotal()";
175 $wDebit->javascript=
" onChange=caod_checkTotal()";
176 if ( isset ($this->a_operation[
$i]))
178 $wSelect->selected=$this->a_operation[
$i]->po_id;
179 $wAmount->value=$this->a_operation[
$i]->oa_amount;
180 $wDebit->value=$this->a_operation[
$i]->oa_debit;
181 if ( $wDebit->value==
't')
183 $wDebit->selected=
true;
191 $ret.=$wAmount->input();
192 $ret.=
td($wDebit->input());
199 $add_row=
new IButton(
'Ajouter');
200 $add_row->label=_(
'Ajouter une ligne');
201 $add_row->javascript=
'anc_add_row(\'ago\');';
204 $ret.=$add_row->input();
214 $aPlan=$Plan->get_list();
219 foreach ($aPlan as $d)
223 $p->oa_amount=$p_array[
"pamount$i"];
229 $p->oa_debit=(isset (
$p_array[
"pdeb$i"]))?
't':
'f';
234 $this->a_operation[]=clone
$p;
246 for (
$i=0;
$i<count($this->a_operation);
$i++)
248 if ( $this->a_operation[
$i]->po_id == 0 )
continue;
250 $this->a_operation[
$i]->add();
253 catch (Exception
$ex)
256 echo
'<span class="error">'.
257 'Erreur dans l\'enregistrement '.
258 __FILE__.
':'.__LINE__.
' '.
261 throw new Exception(
"Erreur ".
$ex->getMessage());
269 return $this->
form(1);
284 echo
'<form method="post">';
286 echo dossier::hidden();
287 echo
'<input type="submit" name="go">';
th($p_string, $p_extra='', $raw='')
record_log($p_message)
Record an error message into the log file of the server.
td($p_string='', $p_extra='')
surround the string with td
group of object operations, used for misc operation
save()
save the group of operation but only if the amount is balanced
form($p_readonly=0)
show a form for the operation (several rows)
__construct($p_cn, $p_id=0)
constructor
get_from_array($p_array)
fill row from $_POST data
this class is used to show the form for entering an operation only FOR analytic operation to save it,...
Concerns the Analytic plan (table plan_analytique)
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
This class handles only the numeric input, the input will call a javascript to change comma to period...
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...