25 require_once NOALYSS_INCLUDE.
'/lib/class_iselect.php';
26 require_once NOALYSS_INCLUDE.
'/lib/class_icard.php';
27 require_once NOALYSS_INCLUDE.
'/lib/class_ispan.php';
28 require_once NOALYSS_INCLUDE.
'/class/class_acc_ledger.php';
29 require_once NOALYSS_INCLUDE.
'/class/class_fiche.php';
30 require_once NOALYSS_INCLUDE.
'/class/class_fiche_def.php';
31 require_once NOALYSS_INCLUDE.
'/constant.php';
47 "ledger_target"=>
"mp_jrn_def_id",
48 "ledger_source"=>
"jrn_def_id",
49 "fiche_def"=>
"mp_fd_id");
65 if ( array_key_exists($p_string,self::$variable) )
67 $idx=self::$variable[$p_string];
72 throw new Exception(
"Attribut inexistant $p_string");
77 if ( array_key_exists($p_string,self::$variable) )
79 $idx=self::$variable[$p_string];
83 throw new Exception(
"Attribut inexistant $p_string");
89 return var_export(self::$variable,
true);
106 if ( $this->
verify() != 0 )
return;
107 $sql=
'INSERT INTO mod_payment(
108 mp_lib, mp_jrn_def_id, mp_fd_id, mp_qcode,jrn_def_id)
109 VALUES ($1, $2, $3, upper($4),$5) returning mp_id';
110 $this->mp_id=$this->
cn->exec_sql(
$sql,array(
112 $this->mp_jrn_def_id,
120 if ( $this->
verify() != 0 )
return;
122 $sql=
"update mod_payment set mp_lib=$1,mp_qcode=$2,mp_jrn_def_id=$3,mp_fd_id=$4,jrn_def_id=$5 ".
128 $this->mp_jrn_def_id,
133 if ( strlen (
trim($this->mp_jrn_def_id))==0)
135 'update mod_payment '.
136 'set mp_jrn_def_id = null where mp_id=$1',
137 array($this->mp_id));
138 if ( strlen (
trim($this->jrn_def_id))==0)
140 'update mod_payment '.
141 'set mp_jrn_def_id = null where mp_id=$1',
142 array($this->mp_id));
143 if ( strlen (
trim($this->mp_qcode))==0)
145 'update mod_payment '.
146 'set mp_qcode = null where mp_id=$1',
147 array($this->mp_id));
148 if ( strlen (
trim($this->mp_fd_id))==0)
150 'update mod_payment '.
151 'set mp_fd_id = null where mp_id=$1',
152 array($this->mp_id));
158 $sql=
'select mp_id,mp_lib,mp_fd_id,mp_jrn_def_id,mp_qcode,jrn_def_id from mod_payment '.
176 public function delete()
178 $sql=
"delete from mod_payment where mp_id=$1";
179 $this->
cn->exec_sql(
$sql,array($this->mp_id));
187 $sql=
'select mp_id,mp_lib '.
188 ' from mod_payment order by mp_lib';
209 $sql=
'select mp_id '.
210 ' from mod_payment '.
211 ' where jrn_def_id=$1 and mp_jrn_def_id is not null and '.
212 ' (mp_fd_id is not null or mp_qcode is not null)';
213 $array=$this->
cn->get_array(
$sql,array($this->jrn_def_id));
235 $f_lib=
$lib->input();
238 $ledger_source=
new ISelect(
'jrn_def_id');
239 $ledger_source->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
240 jrn_def where jrn_def_type in ('ACH','VEN') order by jrn_def_name");
242 $f_source=$ledger_source->input();
245 $tcard=
new ISelect(
'mp_fd_id');
246 $tcard->value=$this->
cn->make_array(
'select fd_id,fd_label from fiche_def join fiche_def_ref '.
247 ' using (frd_id) where frd_id in (25,4) order by fd_label');
250 $f_type_fiche=$tcard->input();
251 $ledger_record=
new ISelect(
'mp_jrn_def_id');
252 $ledger_record->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
253 jrn_def where jrn_def_type in ('ODS','FIN')");
254 $ledger_record->selected=$this->mp_jrn_def_id;
255 $f_ledger_record=$ledger_record->input();
261 $list=$this->
cn->make_list(
'select fd_id from fiche_def where frd_id in (25,4)');
263 $qcode->dblclick=
'fill_ipopcard(this);';
268 $msg=
"Modification de ".$this->mp_lib;
270 require_once NOALYSS_TEMPLATE.
'/new_mod_payment.php';
271 $r=ob_get_contents();
287 if ( empty(
$array)==
false ) {
288 $acompte=
new INum(
'acompte');
290 $r.=_(
" Acompte à déduire");
291 $r.=$acompte->input();
293 $e_comm_paiement=
new IText(
'e_comm_paiement');
294 $e_comm_paiement->table = 0;
295 $e_comm_paiement->setReadOnly(
false);
296 $e_comm_paiement->size = 60;
297 $e_comm_paiement->tabindex = 3;
298 $r.=_(
" Libellé du paiement");
299 $r.=$e_comm_paiement->input();
304 $r.=
'<li ><input type="radio" name="e_mp" value="0" checked>'._(
'Paiement encodé plus tard');
305 if ( empty(
$array ) ==
false )
312 if ( $row->mp_qcode==NULL)
315 $a->jrn=$row->mp_jrn_def_id;
316 $a->set_attribute(
'typecard',$row->mp_fd_id);
317 $a->name=
'e_mp_qcode_'.$row->mp_id;
318 $a->set_dblclick(
"fill_ipopcard(this);");
319 $a->set_callback(
'filter_card');
320 $a->set_function(
'fill_data');
321 $a->set_attribute(
'ipopup',
'ipopcard');
322 $a->set_attribute(
'label',
$a->name.
'_label');
323 if ( $p_select == $row->mp_id ) {
327 $s->name=
$a->name.
'_label';
328 $f=_(
" paiement par ").$a->input().$s->input();
337 $fiche->get_by_qcode($row->mp_qcode);
342 $check=( $p_select == $row->mp_id)?
" checked " :
"unchecked";
343 $r.=
'<li><input type="radio" name="e_mp" value="'.$row->mp_id.
'" '.
$check.
'>';
344 $r.=$row->mp_lib.
' '.
$f;
357 $idx=array(
'mp_id',
'mp_lib',
'mp_fd_id',
'mp_jrn_def_id',
'mp_qcode',
'jrn_def_id');
368 $f_lib=
$lib->input();
370 $ledger_source=
new ISelect(
'jrn_def_id');
371 $ledger_source->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
372 jrn_def where jrn_def_type in ('ACH','VEN') order by jrn_def_name");
373 $f_source=$ledger_source->input();
376 $tcard=
new ISelect(
'mp_fd_id');
377 $tcard->value=$this->
cn->make_array(
'select fd_id,fd_label from fiche_def join fiche_def_ref '.
378 ' using (frd_id) where frd_id in (25,4) order by fd_label');
379 $f_type_fiche=$tcard->input();
380 $ledger_record=
new ISelect(
'mp_jrn_def_id');
381 $ledger_record->value=$this->
cn->make_array(
"select jrn_def_id,jrn_Def_name from
382 jrn_def where jrn_def_type in ('ODS','FIN')");
383 $f_ledger_record=$ledger_record->input();
389 $list=$this->
cn->make_list(
'select fd_id from fiche_def where frd_id in (25,4)');
391 $qcode->dblclick=
'fill_ipopcard(this);';
394 $msg=
"Ajout d'un nouveau moyen de paiement";
396 require_once NOALYSS_TEMPLATE.
'/new_mod_payment.php';
397 $r=ob_get_contents();
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)
static num_row($ret)
wrapper for the function pg_NumRows
from_array($p_array)
convert an array into an Acc_Payment object
select($p_select)
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)
wrapper for the function pg_fetch_array
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
get_valide()
retrieve all the data for a ledger but filter on the valid record (jrn and fd not null ...
form()
return a string with a form (into a table)
static test_me()
test function
function trim(s)
remove trailing and heading space
if(!isset($_REQUEST['p_jrn'])) else $Ledger id
Input HTML for the card show buttons, in the file, you have to add card.js How to use : ...
Handle the table mod_payment.
This class handles only the numeric input, the input will call a javascript to change comma to period...