noalyss Version-9
Public Member Functions | Private Attributes
Periode_Ledger_Table Class Reference

Display the periode per ledger: close : reopen ... the close , open must be done thanks Periode. More...

+ Collaboration diagram for Periode_Ledger_Table:

Public Member Functions

 __construct ($p_id)
 
 display_row ($pa_row, $p_num, $p_js)
 Display one row from jrn_periode with supplemental info. More...
 
 display_table ($p_resource_psql, $p_js)
 Display all the periode for a specific ledger the ledger is in m_jrn_periode_sql. More...
 
 get_a_member ()
 
 get_resource_periode_ledger ($p_ledger_id)
 
 load ()
 Load a row and return it as an array. More...
 
 set_id ($p_id)
 

Private Attributes

 $a_member
 
 $cn
 
 $sql
 

Detailed Description

Display the periode per ledger: close : reopen ... the close , open must be done thanks Periode.

See also
Periode

Definition at line 35 of file periode_ledger_table.class.php.

Constructor & Destructor Documentation

◆ __construct()

Periode_Ledger_Table::__construct (   $p_id)

Definition at line 42 of file periode_ledger_table.class.php.

43 {
44 $this->a_member["id"]=$p_id;
45 $this->sql="select id,p_id,status,p_id,p_start,p_end,p_closed,p_exercice,jrn_def_id
46 from
47 jrn_periode
48 join parm_periode using (p_id)";
49 $this->cn=Dossier::connect();
50 $this->a_member=$this->cn->get_row($this->sql." where id = $1",
51 [$this->a_member["id"]]);
52
53 }
$input_from cn
Definition: balance.inc.php:66
static connect()

References $p_id, cn, and Dossier\connect().

+ Here is the call graph for this function:

Member Function Documentation

◆ display_row()

Periode_Ledger_Table::display_row (   $pa_row,
  $p_num,
  $p_js 
)

Display one row from jrn_periode with supplemental info.

Parameters
type$pa_rowis an array corresponding to a_member
type$p_numnumber of rows , for color
type$p_jsname of the js variable passed to ajax

Display a checkbox to select several month to close

Can close if open

Definition at line 121 of file periode_ledger_table.class.php.

122 {
123 $class=($p_num%2==0)?"even":"odd";
124 printf('<tr id="row_per_%d" per_ledger="%s" per_exercice="%s" jrn_ledger_id="%s" class="%s"> ',
125 $pa_row["id"], $pa_row["jrn_def_id"], $pa_row["p_exercice"],
126 $pa_row["id"], $class
127 );
128 /**
129 * Display a checkbox to select several month to close
130 */
131 if ($pa_row["status"] == "OP") {
132 $checkbox=new ICheckBox("sel_per_close[]");
133 $checkbox->set_attribute("per_id", $pa_row['id']);
134 $checkbox->set_range("sel_per_close_ck");
135 $checkbox->value=$pa_row['id'];
136 echo "<td>".$checkbox->input()."</td>";
137 }else {
138 echo td("");
139 }
140 echo td(format_date($pa_row["p_start"], "YYYY-MM-DD", "DD.MM.YYYY"));
141 echo td(format_date($pa_row["p_end"], "YYYY-MM-DD", "DD.MM.YYYY"));
142 echo td($pa_row["p_exercice"]);
143 $status=($pa_row['p_closed']=='t')?_("Fermée"):_("Ouvert");
144 echo "<td>";
145 if ($pa_row["status"] == "OP") { echo _("Ouvert"); }
146 if ($pa_row["status"] == "CL") { echo _("Fermé"); }
147 echo "</td>";
148 /// Can close if open
149 echo "<td>";
150 if ($pa_row['status']=='OP')
151 {
152 $javascript=sprintf("%s.close_periode('%d')", $p_js, $pa_row['id']);
153 echo Icon_Action::iconon(uniqid(), $javascript);
154 }
155 elseif ($pa_row['status']=='CL')
156 {
157 $javascript=sprintf("%s.open_periode('%d')", $p_js, $pa_row['id']);
158 echo Icon_Action::iconoff(uniqid(), $javascript);
159 }
160 echo "</td>";
161 echo "</tr>";
162 }
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
Definition: ac_common.php:852
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$class
Html Input.
static iconoff($p_id, $p_javascript, $p_style="")
Display a icon OFF.
static iconon($p_id, $p_javascript, $p_style="")
Display a icon ON.
if( $delta< 0) elseif( $delta==0)

References $checkbox, $class, $status, elseif, format_date(), Icon_Action\iconoff(), Icon_Action\iconon(), and td().

Referenced by display_table().

+ Here is the call graph for this function:

◆ display_table()

Periode_Ledger_Table::display_table (   $p_resource_psql,
  $p_js 
)

Display all the periode for a specific ledger the ledger is in m_jrn_periode_sql.

Parameters
type$p_resource_psqlresource SQL
type$p_js
Returns
type
See also
Periode_Ledger_Table::get_resource_periode_ledger

Definition at line 88 of file periode_ledger_table.class.php.

89 {
90 $nb_periode=Database::num_row($p_resource_psql);
91
92 if ($nb_periode==0)
93 return;
94 echo '<table class="result" id="periode_tbl">';
95 echo "<thead>";
96 echo "<tr>";
97 echo th("");
98 echo th(_("Date Début"));
99 echo th(_("Date Fin"));
100 echo th(_("Exercice"));
101 echo th("");
102 echo "</tr>";
103 echo "</thead>";
104 echo '<tbody>';
105
106 for ($i=0; $i<$nb_periode; $i++)
107 {
108 $obj=Database::fetch_array($p_resource_psql, $i);
109 $this->display_row($obj, $i, $p_js);
110 }
111 echo '</tbody>';
112 echo '</table>';
113 }
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
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
display_row($pa_row, $p_num, $p_js)
Display one row from jrn_periode with supplemental info.

References $i, $obj, display_row(), DatabaseCore\fetch_array(), DatabaseCore\num_row(), and th().

+ Here is the call graph for this function:

◆ get_a_member()

Periode_Ledger_Table::get_a_member ( )

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

References $a_member.

◆ get_resource_periode_ledger()

Periode_Ledger_Table::get_resource_periode_ledger (   $p_ledger_id)

Definition at line 74 of file periode_ledger_table.class.php.

75 {
76 $ret=$this->cn->exec_sql($this->sql." where jrn_def_id = $1 order by p_start asc",[$p_ledger_id]);
77 return $ret;
78 }
$p_ledger_id
Definition: periode.inc.php:33

References $p_ledger_id, $ret, and cn.

◆ load()

Periode_Ledger_Table::load ( )

Load a row and return it as an array.

Returns
type

Definition at line 68 of file periode_ledger_table.class.php.

69 {
70 $this->a_member=$this->cn->get_row($this->sql." where id = $1",
71 [$this->a_member["id"]]);
72 return $this->a_member;
73 }

References $a_member, and cn.

◆ set_id()

Periode_Ledger_Table::set_id (   $p_id)

Definition at line 60 of file periode_ledger_table.class.php.

61 {
62 $a_member['id']=$p_id;
63 }

References $a_member, and $p_id.

Field Documentation

◆ $a_member

Periode_Ledger_Table::$a_member
private

Definition at line 39 of file periode_ledger_table.class.php.

Referenced by get_a_member(), load(), and set_id().

◆ $cn

Periode_Ledger_Table::$cn
private

Definition at line 40 of file periode_ledger_table.class.php.

◆ $sql

Periode_Ledger_Table::$sql
private

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


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