noalyss Version-9
Public Member Functions | Data Fields
Pre_op_fin Class Reference

concerns the predefined operation for FIN ledger More...

+ Inheritance diagram for Pre_op_fin:
+ Collaboration diagram for Pre_op_fin:

Public Member Functions

 __construct ($cn)
 
 compute_array ()
 compute an array accordingly with the FormVenView function More...
 
 get_post ()
 
 load ()
 load the data from the database and return an array More...
 
 save ()
 save the detail and op in the database More...
 
 set_od_id ($p_id)
 
 __construct ($p_cn)
 

Data Fields

 $op
 

Additional Inherited Members

- Static Public Member Functions inherited from Pre_operation_detail
static build_detail ($p_jrn_type, Database $database)
 

Detailed Description

concerns the predefined operation for FIN ledger

Definition at line 29 of file pre_op_fin.class.php.

Constructor & Destructor Documentation

◆ __construct()

Pre_op_fin::__construct (   $cn)

Reimplemented from Pre_operation_detail.

Definition at line 32 of file pre_op_fin.class.php.

33 {
34 parent::__construct($cn);
35 $this->operation->od_direct='f';
36 }

References $cn.

Member Function Documentation

◆ compute_array()

Pre_op_fin::compute_array ( )

compute an array accordingly with the FormVenView function

Definition at line 96 of file pre_op_fin.class.php.

97 {
98 $count=0;
99 $a_op=$this->operation->load();
100 $array=$this->operation->compute_array($a_op);
101 $p_array=$this->load();
102 foreach ($p_array as $row)
103 {
104 if ( $row['opd_debit']=='t')
105 {
106 $array+=array('e_bank_account'=>$row['opd_poste']);
107 }
108 else
109 {
110 $array+=array("e_other".$count=>$row['opd_poste'],
111 "e_other".$count."_amount"=>$row['opd_amount'],
112 "e_other".$count."_comment"=>$row['opd_comment']
113 );
114 $count++;
115 }
116 }
117 return $array;
118 }
load()
load the data from the database and return an array
$count

References $array, $count, $p_array, $row, and load().

+ Here is the call graph for this function:

◆ get_post()

Pre_op_fin::get_post ( )

Definition at line 38 of file pre_op_fin.class.php.

39 {
40 parent::get_post();
41 $this->operation->od_direct='f';
42 $this->e_bank_account=$_POST['e_bank_account'];
43 for ($i=0;$i<$this->operation->nb_item;$i++)
44 {
45 $this->{"e_other".$i}=$_POST['e_other'.$i];
46 $this->{"e_other".$i."_comment"}=$_POST['e_other'.$i.'_comment'];
47 $this->{"e_other".$i."_amount"}=$_POST['e_other'.$i."_amount"];
48 }
49 }
$_POST['ac']
Definition: do.php:310

References $_POST, and $i.

◆ load()

Pre_op_fin::load ( )

load the data from the database and return an array

Returns
an array or FALSE is nothing found

Definition at line 122 of file pre_op_fin.class.php.

123 {
124 $sql="select opd_id,opd_poste,opd_amount,opd_comment,opd_debit".
125 " from op_predef_detail where od_id=$1 ".
126 " order by opd_id";
127 $res=$this->db->exec_sql($sql,[$this->operation->od_id]);
129 return $array;
130 }
static fetch_all($ret)
wrapper for the function pg_fetch_all
$SecUser db

References $array, $res, $sql, db, and DatabaseCore\fetch_all().

Referenced by compute_array().

+ Here is the call graph for this function:

◆ save()

Pre_op_fin::save ( )

save the detail and op in the database

Definition at line 54 of file pre_op_fin.class.php.

55 {
56 try
57 {
58 $this->db->start();
59 if ($this->operation->save() == false )
60 return;
61 // save the client
62 $sql=sprintf('insert into op_predef_detail (od_id,opd_poste,opd_debit)'.
63 ' values '.
64 "(%d,'%s','%s')",
65 $this->operation->od_id,
66 $this->e_bank_account,
67 "t");
68 $this->db->exec_sql($sql);
69 // save the selling
70 for ($i=0;$i<$this->operation->nb_item;$i++)
71 {
72 $sql=sprintf('insert into op_predef_detail (opd_poste,'.
73 'opd_amount,opd_comment,'.
74 'opd_debit,od_id)'.
75 ' values '.
76 "('%s',%.2f,'%s','%s',%d)",
77 $this->{"e_other".$i},
78 $this->{"e_other".$i."_amount"},
79 $this->{"e_other".$i."_comment"},
80 'f',
81 $this->operation->od_id
82 );
83 $this->db->exec_sql($sql);
84 }
85 }
86 catch (Exception $e)
87 {
89 echo ($e->getMessage());
90 $this->db->rollback();
91 }
92
93 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342

References $e, $i, $sql, db, and record_log().

+ Here is the call graph for this function:

◆ set_od_id()

Pre_op_fin::set_od_id (   $p_id)

Definition at line 131 of file pre_op_fin.class.php.

132 {
133 $this->operation->od_id=$p_id;
134 }

References $p_id.

Field Documentation

◆ $op

Pre_op_fin::$op

Definition at line 31 of file pre_op_fin.class.php.


The documentation for this class was generated from the following file: