25require_once NOALYSS_INCLUDE.
'/constant.php';
37#[AllowDynamicProperties]
43 "ledger_target"=>
"mp_jrn_def_id",
44 "ledger_source"=>
"jrn_def_id",
45 "fiche_def"=>
"mp_fd_id");
61 if ( array_key_exists($p_string,self::$variable) )
63 $idx=self::$variable[$p_string];
68 throw new Exception(
"Attribut inexistant $p_string");
73 if ( array_key_exists($p_string,self::$variable) )
75 $idx=self::$variable[$p_string];
79 throw new Exception(
"Attribut inexistant $p_string");
85 return var_export(self::$variable,
true);
88 public function load():bool
90 $sql=
'select mp_id,mp_lib,mp_fd_id,mp_jrn_def_id,mp_qcode,jrn_def_id from payment_method '.
100 $a_index=array_values(self::$variable);
101 foreach ($a_index as
$idx)
114 $sql=
'select mp_id,mp_lib '.
115 ' from payment_method order by mp_lib';
136 $sql=
'select mp_id '.
137 ' from payment_method '.
138 ' where jrn_def_id=$1 and mp_jrn_def_id is not null and '.
139 ' (mp_fd_id is not null or mp_qcode is not null)';
160 $lib=
new IText(
'mp_lib');
162 $f_lib=$lib->input();
165 $ledger_source=
new ISelect(
'jrn_def_id');
166 $ledger_source->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
167 jrn_def where jrn_def_type in ('ACH','VEN') order by jrn_def_name");
169 $f_source=$ledger_source->input();
172 $tcard=
new ISelect(
'mp_fd_id');
173 $tcard->value=$this->
cn->make_array(
'select fd_id,fd_label from fiche_def join fiche_def_ref '.
174 ' using (frd_id) where frd_id in (25,4) order by fd_label');
177 $f_type_fiche=$tcard->input();
178 $ledger_record=
new ISelect(
'mp_jrn_def_id');
179 $ledger_record->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
180 jrn_def where jrn_def_type in ('ODS','FIN')");
181 $ledger_record->selected=$this->mp_jrn_def_id;
182 $f_ledger_record=$ledger_record->input();
188 $list=$this->
cn->make_list(
'select fd_id from fiche_def where frd_id in (25,4)');
190 $qcode->dblclick=
'fill_ipopcard(this);';
195 $msg=
"Modification de ".$this->mp_lib;
197 require_once NOALYSS_TEMPLATE.
'/new_mod_payment.php';
198 $r=ob_get_contents();
217 $r.=HtmlInput::hidden(
'gDossier',dossier::id());
219 if ( empty(
$array)==
false ) {
220 $date_pay=
new IDate(
'mp_date');
222 $r.=sprintf(
_(
"Date %s"),
226 $r.=
_(
" Acompte à déduire");
229 $e_comm_paiement=
new IText(
'e_comm_paiement');
230 $e_comm_paiement->value=$p_comm;
231 $e_comm_paiement->table = 0;
232 $e_comm_paiement->setReadOnly(
false);
233 $e_comm_paiement->size = 60;
234 $e_comm_paiement->tabindex = 3;
235 $r.=
_(
" Libellé du paiement");
236 $r.=$e_comm_paiement->input();
241 $r.=
'<li ><input type="radio" name="e_mp" value="0" checked>'._(
'Paiement encodé plus tard');
243 if ( empty(
$array ) ==
false )
250 if (
$row->mp_qcode==NULL)
253 $a->jrn=
$row->mp_jrn_def_id;
254 $a->set_attribute(
'typecard',
$row->mp_fd_id);
255 $a->name=
'e_mp_qcode_'.$row->mp_id;
256 $a->set_dblclick(
"fill_ipopcard(this);");
257 $a->set_callback(
'filter_card');
258 $a->set_function(
'fill_data');
259 $a->set_attribute(
'ipopup',
'ipopcard');
260 $a->set_attribute(
'label',
$a->name.
'_label');
261 if ( $p_select ==
$row->mp_id ) {
262 $a->value=
$http->request(
"e_mp_qcode_".$p_select,
"string",
"");
265 $s->name=
$a->name.
'_label';
266 $f=
_(
" paiement par ").$a->input().$s->input().$a->search();
276 $f=HtmlInput::hidden(
'e_mp_qcode_'.
$row->mp_id,
$row->mp_qcode);
280 $check=( $p_select ==
$row->mp_id)?
" checked " :
"unchecked";
281 $r.=
'<li><input type="radio" name="e_mp" value="'.$row->mp_id.
'" '.
$check.
'>';
295 $a_index=array_values(self::$variable);
297 foreach ($a_index as
$l) {
307 $lib=
new IText(
'mp_lib');
308 $f_lib=$lib->input();
310 $ledger_source=
new ISelect(
'jrn_def_id');
311 $ledger_source->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
312 jrn_def where jrn_def_type in ('ACH','VEN') order by jrn_def_name");
313 $f_source=$ledger_source->input();
316 $tcard=
new ISelect(
'mp_fd_id');
317 $tcard->value=$this->
cn->make_array(
'select fd_id,fd_label from fiche_def join fiche_def_ref '.
318 ' using (frd_id) where frd_id in (25,4) order by fd_label');
319 $f_type_fiche=$tcard->input();
320 $ledger_record=
new ISelect(
'mp_jrn_def_id');
321 $ledger_record->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
322 jrn_def where jrn_def_type in ('ODS','FIN')");
323 $f_ledger_record=$ledger_record->input();
329 $list=$this->
cn->make_list(
'select fd_id from fiche_def where frd_id in (25,4)');
331 $qcode->dblclick=
'fill_ipopcard(this);';
334 $msg=
"Ajout d'un nouveau moyen de paiement";
336 require_once NOALYSS_TEMPLATE.
'/new_mod_payment.php';
337 $r=ob_get_contents();
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
_("actif, passif,charge,...")
Handle the table payment_method.
from_array($p_array)
convert an array into an Acc_Payment object
form()
return a string with a form (into a table)
set_parameter($p_string, $p_value)
blank()
return an html with a form to add a new middle of payment
__construct($p_cn, $p_init=0)
get_valide()
retrieve all the data for a ledger but filter on the valid record (jrn and fd not null
select($p_select, $p_amount, $p_date, $p_comm)
show several lines with radio button to select the payment method we want to use, the $_POST['e_mp'] ...
get_all()
retrieve all the data for all ledgers
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
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...