noalyss
Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
include
class
acc_other_tax_mtable.class.php
Go to the documentation of this file.
1
<?php
2
/*
3
* This file is part of NOALYSS.
4
*
5
* PhpCompta is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* PhpCompta is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with PhpCompta; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
* Copyright (2002-2022) Author Dany De Bontridder <danydb@noalyss.eu>
19
*/
20
class
Acc_Other_Tax_MTable
extends
Manage_Table_SQL
21
{
22
/**
23
* @brief Build and returns an object
24
* @param int $p_id
25
*/
26
static
public
function
build
(
$p_id
=-1)
27
{
28
$cn
=Dossier::connect();
29
$object_sql=
new
Acc_Other_Tax_SQL
(
$cn
,
$p_id
);
30
31
$object
=
new
Acc_Other_Tax_MTable
($object_sql);
32
$object
->set_object_name(
"other_tax_ctl"
);
33
$object
->set_callback(
"ajax_misc.php"
);
34
$object
->add_json_param(
"op"
,
"other_tax"
);
35
$object
->set_order([
"ac_label"
,
"ac_rate"
,
"ac_accounting"
,
"ajrn_def_id"
]);
36
37
$object
->set_col_label(
"ac_label"
,
_
(
"Nom"
));
38
$object
->set_col_label(
"ajrn_def_id"
,
_
(
"Journaux"
));
39
$object
->set_col_label(
"ac_rate"
,
_
(
"Taux"
));
40
$object
->set_col_tips(
"ac_rate"
,82);
41
$object
->set_col_label(
"ac_accounting"
,
_
(
"Poste comptable"
));
42
$object
->set_col_tips(
"ac_accounting"
,81);
43
$object
->set_col_type(
"ac_accounting"
,
"custom"
);
44
$object
->set_col_type(
"ajrn_def_id"
,
"custom"
);
45
$object
->set_property_visible(
"ajrn_def_id"
,
false
);
46
return
$object
;
47
}
48
function
input_custom
($p_key,$p_value) {
49
switch
($p_key) {
50
case
"ac_accounting"
:
51
$accounting
=
new
IPoste
(
"ac_accounting"
,$p_value);
52
$accounting
->set_attribute(
'gDossier'
,Dossier::id());
53
$accounting
->set_attribute(
'jrn'
,0);
54
$accounting
->set_attribute(
'account'
,
'ac_accounting'
);
55
echo
$accounting
->input();
56
break
;
57
case
"ajrn_def_id"
:
58
$cn
=Dossier::connect();
59
$a_ledger
=
$cn
->get_array(
"select
60
jrn_def_id,jrn_def_name ,
61
coalesce ( (select array_position(ajrn_def_id,jrn_def_id) from acc_other_tax
62
where ac_id=$1
63
),0) as in_array
64
from jrn_def
65
where
66
jrn_enable=1
67
and jrn_def_type in ('ACH','VEN')
68
order by jrn_def_name"
,[$this->
get_table
()->
get
(
"ac_id"
)]);
69
if
(empty(
$a_ledger
) ) {
70
echo
_
(
"Aucun journal disponible"
);
71
return
;
72
}
73
$nb_ledger=count(
$a_ledger
);
74
echo
'<ul class="tab_row">'
;
75
for
(
$i
=0;
$i
<$nb_ledger;
$i
++) {
76
$icheckbox
=
new
ICheckBox
(
"check[]"
,
$a_ledger
[
$i
][
'jrn_def_id'
]);
77
if
(
$a_ledger
[
$i
][
'in_array'
]!=0) {
78
$icheckbox
->set_check(
$a_ledger
[
$i
][
'jrn_def_id'
]);
79
}
80
echo
'<li>'
,
81
$icheckbox
->input(),
82
h
(
$a_ledger
[
$i
][
'jrn_def_name'
]),
83
'</li>'
;
84
85
}
86
echo
'</ul>'
;
87
break
;
88
}
89
}
90
function
display_row_custom
($p_key, $p_value,
$p_id
= 0)
91
{
92
$cn
=Dossier::connect();
93
switch
($p_key)
94
{
95
case
'ac_accounting'
:
96
$label
=
$cn
->get_value(
"select pcm_lib from tmp_pcmn where pcm_val=$1"
,
97
[$p_value]);
98
echo
'<td>'
,
99
h
($p_value),
100
" "
,
101
h
(
$label
),
102
'</td>'
;
103
break
;
104
}
105
106
}
107
108
function
check
()
109
{
110
$row
=$this->
get_table
();
111
$cn
=
$row
->get_cn();
112
113
if
( trim(
$row
->getp(
"ac_rate"
)) ==
""
) {
114
$row
->setp(
"ac_rate"
,0);
115
}
116
117
if
(
$row
->getp(
"ac_rate"
)>100 ||
$row
->getp(
"ac_rate"
)< 0 ) {
118
$this->
set_error
(
"ac_rate"
,
_
(
"Valeur invalide"
));
119
}
120
121
$accounting
=
$row
->getp(
"ac_accounting"
);
122
$nb_accounting=
$cn
->get_value(
"select count(*) from tmp_pcmn where pcm_val =format_account($1)"
,
123
[
$accounting
]);
124
if
(empty(
$accounting
)||$nb_accounting == 0) {
125
$this->
set_error
(
"ac_accounting"
,
_
(
"Poste comptable inexistant"
));
126
}
127
128
$ledger
=
$row
->get(
"ajrn_def_id"
);
129
if
(
$ledger
!=
"{}"
&& ! empty (
$ledger
))
130
{
131
$ledger
=trim(
$ledger
,
'{'
);
132
$ledger
=trim(
$ledger
,
'}'
);
133
$a_ledger
=explode(
","
,
$ledger
);
134
135
$nb_ledger=count(
$a_ledger
);
136
$pk=
$row
->get(
"ac_id"
);
137
for
(
$i
=0;
$i
<$nb_ledger;
$i
++) {
138
if
(
$cn
->get_value(
"select count(*) from acc_other_tax
139
where
140
array_position(ajrn_def_id,$1) is not null
141
and ac_id != $2
142
"
,[
$a_ledger
[
$i
],$pk]) > 0)
143
{
144
$this->
set_error
(
"ajrn_def_id"
,
_
(
"Journal déjà utilisé dans autre taxe"
));
145
}
146
}
147
}
148
149
150
if
($this->
count_error
()>0) {
151
return
false
;
152
}
153
return
true
;
154
}
155
function
input
()
156
{
157
$this->
set_property_visible
(
"ajrn_def_id"
,
true
);
158
return
parent::input();
159
}
160
161
function
from_request
()
162
{
163
parent::from_request();
// TODO: Change the autogenerated stub
164
$http
=
new
HttpInput
();
165
$this->
table
->set(
"ajrn_def_id"
,
"{"
.join(
","
,
$http
->post(
"check"
,
"array"
,array())).
"}"
);
166
}
167
}
$http
$http
Definition
action.common.inc.php:33
$i
$i
Definition
action_document_type_mtable_input.php:83
$p_id
$p_id
Definition
ajax_accounting.php:33
$cn
$cn
Definition
ajax_anc_accounting.php:30
$accounting
$accounting
Definition
ajax_anc_accounting.php:41
h
h( $row[ 'oa_description'])
Definition
ajax_anc_detail_operation.php:46
$row
$row
Definition
ajax_anc_detail_operation.php:33
$ledger
$ledger
Definition
ajax_anc_key_choice.php:36
$object
catch(Exception $e) $object
Definition
ajax_mobile_device_menu.php:45
_
_("actif, passif,charge,...")
Definition
balance.inc.php:195
Acc_Other_Tax_MTable
Definition
acc_other_tax_mtable.class.php:21
Acc_Other_Tax_MTable\display_row_custom
display_row_custom($p_key, $p_value, $p_id=0)
When displaying a row, if a column has the type "custom" , we can call this function to display prope...
Definition
acc_other_tax_mtable.class.php:90
Acc_Other_Tax_MTable\from_request
from_request()
get the data from http request strip the not update or not visible data to their initial value.
Definition
acc_other_tax_mtable.class.php:161
Acc_Other_Tax_MTable\input_custom
input_custom($p_key, $p_value)
this function let you create your own input , for example for a ITEXT , a IRADIO ,...
Definition
acc_other_tax_mtable.class.php:48
Acc_Other_Tax_MTable\check
check()
Definition
acc_other_tax_mtable.class.php:108
Acc_Other_Tax_MTable\build
static build($p_id=-1)
Build and returns an object.
Definition
acc_other_tax_mtable.class.php:26
Acc_Other_Tax_MTable\input
input()
display into a dialog box the datarow in order to be appended or modified.
Definition
acc_other_tax_mtable.class.php:155
Acc_Other_Tax_SQL
ORM public.acc_other_tax.
Definition
acc_other_tax_sql.class.php:32
HttpInput
manage the http input (get , post, request) and extract from an array
Definition
http_input.class.php:38
ICheckBox
Html Input.
Definition
icheckbox.class.php:31
IPoste
show a button, for selecting a account and a input text for manually inserting an account the differe...
Definition
iposte.class.php:75
Manage_Table_SQL
Purpose is to propose a librairy to display a table content and allow to update and delete row ,...
Definition
manage_table_sql.class.php:101
Manage_Table_SQL\count_error
count_error()
returns the nb of errors found
Definition
manage_table_sql.class.php:331
Manage_Table_SQL\get_table
get_table()
Definition
manage_table_sql.class.php:299
Manage_Table_SQL\set_property_visible
set_property_visible($p_key, $p_value)
set a column of the data row visible or not
Definition
manage_table_sql.class.php:699
Manage_Table_SQL\set_error
set_error($p_col, $p_message)
set the error message for a wrong input
Definition
manage_table_sql.class.php:324
table
$all table
Definition
company.inc.php:142
$label
$label
Definition
impress_jrn.inc.php:115
$icheckbox
$icheckbox
Definition
tag_detail.php:19
$a_ledger
$a_ledger
Definition
tax_detail-display_form.php:57
Generated on Wed Jun 25 2025 09:57:47 for noalyss by
1.13.2