28require_once NOALYSS_INCLUDE.
'/database/acc_plan_sql.class.php';
39 $this->
table = $p_table;
40 parent::__construct($p_table);
49 $this->
set_col_label(
"pcm_direct_use", _(
"Utilisation directe"));
54 [
"label"=>_(
"Actif"),
"value"=>
"ACT"],
55 [
"label"=>_(
"Actif inversé"),
"value"=>
"ACTINV"],
56 [
"label"=>_(
"Passif"),
"value"=>
"PAS"],
57 [
"label"=>_(
"Passif Inversé"),
"value"=>
"PASINV"],
58 [
"label"=>_(
"Charge"),
"value"=>
"CHA"],
59 [
"label"=>_(
"Charge inversé"),
"value"=>
"CHAINV"],
60 [
"label"=>_(
"Produit"),
"value"=>
"PRO"],
61 [
"label"=>_(
"Produit inversé"),
"value"=>
"PROINV"],
62 [
"label"=>_(
"Contexte"),
"value"=>
"CON"]
65 array([
"label" => _(
"Oui"),
"value" =>
"Y"], [
"label" =>
"Non",
"value" =>
"N"]));
67 $this->a_order = [
"pcm_val",
"pcm_lib",
"parent_accounting",
"pcm_direct_use",
"pcm_type",
"fiche_qcode"];
78 printf(
'<tr id="%s_%s">',
80 $p_row[$this->
table->primary_key])
84 $nb_order=count($this->a_order);
85 for (
$i=0;
$i<$nb_order;
$i++)
87 $v=$this->a_order[
$i];
90 $nb_used=
$cn->get_value(
"select count(*) from jrnx where j_poste=$1",[$p_row[
'pcm_val']]);
91 $nb_plan=
$cn->get_value(
"select count(*) from tmp_pcmn where pcm_val_parent=$1",[$p_row[
'pcm_val']]);
95 $js=sprintf(
"onclick=\"%s.input('%s','%s');\"", $this->object_name,
96 $p_row[$this->
table->primary_key], $this->object_name);
97 echo sprintf(
'<td sort_type="text" sort_value="X%s">%s',
98 htmlspecialchars($p_row[$v]),
102 elseif ($v ==
"fiche_qcode") {
103 $count=$this->
table->cn->get_value(
"select count(*) from fiche_detail where ad_id=5 and ad_value=$1"
104 ,array($p_row[
'pcm_val']));
114 $a_code=explode(
",",$p_row[$v]);
115 $nb_code=count($a_code);
116 for ($xx = 0;$xx < $nb_code;$xx++)
133 $used=sprintf (
' (%s)',$nb_used);
136 echo
h($p_row[
"pcm_lib"]);
151 else echo
td(
" ");
166 $count=
$cn->get_value(
"select count(*) from tmp_pcmn where pcm_val = $1 and id <> $2",
167 array($this->
table->pcm_val,$this->table->id));
169 $this->
set_error(
"pcm_val", _(
"Poste comptable est unique"));
171 if ( trim($this->
table->pcm_val) ==
"") {
172 $this->
set_error(
"pcm_val", _(
"Poste comptable ne peut être vide"));
176 $this->
set_error(
"pcm_val", _(
"Poste comptable trop long"));
178 if ( trim($this->
table->parent_accounting) ==
"") {
179 $this->
set_error(
"parent_accounting", _(
"Poste comptable dépendant ne peut pas être vide"));
184 $exist_parent=
$cn->get_value(
"select count(*) from tmp_pcmn where pcm_val = $1 ",
185 array($this->
table->parent_accounting));
186 if ($exist_parent == 0) {
187 $this->
set_error(
"parent_accounting", _(
"Compte parent n'existe pas"));
192 $old_accounting =
$cn->get_value(
"select pcm_val from tmp_pcmn where id = $1",
193 array($this->
table->id));
195 if ($old_accounting !=
"" && $old_accounting != $this->
table->pcm_val) {
197 if (
$cn->get_value(
"select count(*) from jrnx where j_poste=$1",
198 [$old_accounting]) > 0) {
199 $this->
set_error(
"pcm_val", _(
"Poste utilisé"));
202 if (count($this->aerror) > 0)
return false;
231 ($p_value !=
"" &&
$cn->get_value(
"select count(*) from jrnx where j_poste=$1",[$p_value]) == 0 )
238 $text->value=$p_value;
239 $min_size=(strlen($p_value)<30)?30:strlen($p_value)+5;
240 $text->size=$min_size;
noalyss_strlentrim($p_string)
td($p_string='', $p_extra='')
surround the string with td
h( $row[ 'oa_description'])
this instance extends Manage_Table_SQL and aims to manage the Table tmp_pcmn thanks a web interface (...
check()
Check that the entered data are valid before recording them into tmp_pcmn, the errors are stored into...
input()
display into a dialog box the datarow in order to be appended or modified.
input_custom($p_key, $p_value)
if pcm_val already used then it cannot be modified
display_row($p_row)
Display a row.
__construct(Acc_Plan_SQL $p_table)
this class is above tmp_pcmn_sql and is a view of tmp_pcmn
static id()
return the 'gDossier' value after a check
static more($p_id, $p_javascript)
Purpose is to propose a librairy to display a table content and allow to update and delete row ,...
set_icon_mod($pString)
Set the icon to modify at the right ,the first col or left of the row, if the mod if custom ,...
set_property_updatable($p_key, $p_value)
set a column of the data row updatable or not
set_col_type($p_key, $p_value, $p_array=NULL)
set the type of a column , it will change in the input db box , the select must supply an array of po...
get_property_visible($p_key)
return True if the column is visible otherwise false
set_dialogbox_style($db_style)
Dialog box style , by default {position: "fixed", top: '15', width: "auto", "margin-left": "20%"}.
set_property_visible($p_key, $p_value)
set a column of the data row visible or not
set_error($p_col, $p_message)
set the error message for a wrong input
set_col_label($p_key, $p_display)
set the name to display for a column
if( $delta< 0) elseif( $delta==0)