noalyss
Version-9
include
class
gestion_purchase.class.php
Go to the documentation of this file.
1
<?php
2
/*
3
* This file is part of NOALYSS.
4
*
5
* NOALYSS 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
* NOALYSS 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 NOALYSS; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*/
19
20
// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22
/*!\file
23
* \brief Definition of the class gestion_purchase
24
*/
25
26
/*! \brief this object handles the table quant_purchase
27
*
28
*/
29
30
31
class
gestion_purchase
extends
gestion_table
32
{
33
var
$qp_id
;
/*!< id */
34
var
$qp_internal
;
/*!< internal code */
35
var
$qp_fiche
;
/*!< card id (fiche.f_id) */
36
var
$qp_quantite
;
/*!< quantity */
37
var
$qp_price
;
/*!< quantity */
38
var
$qp_vat
;
/*!< vat amount */
39
var
$qp_vat_code
;
/*!< vat_code */
40
var
$qp_nd_amount
;
/*!< no deductible */
41
var
$qp_nd_tva
;
/*!< tva not deductible */
42
var
$qp_nd_tva_recup
;
/*!< tva ded via taxe */
43
var
$qp_supplier
;
/*!< supplier code (f_id) */
44
var
$qp_valid
;
45
var
$j_id
;
/*!< jrnx.j_id
46
*/
47
var
$qp_dep_priv
;
/*!< private purchase */
48
var
$qp_vat_sided
;
/* autoliquidation */
49
/*!\brief return an array of gestion_table, the object are
50
* retrieved thanks the qs_internal
51
*/
52
function
get_list
()
53
{
54
if
($this->qp_internal==
""
)
55
throw
new
Exception(__FILE__.__LINE__.
" qs_internal est vide"
);
56
$sql
=
"select qp_id,
57
qp_internal,
58
qp_fiche,
59
qp_quantite,
60
qp_price,
61
qp_vat,
62
qp_vat_code,
63
tva_rate,
64
tva_label,
65
qp_nd_amount,
66
qp_nd_tva,
67
qp_nd_tva_recup,
68
qp_supplier,
69
j_id,
70
qp_dep_priv,
71
qp_vat_sided
72
from quant_purchase left join tva_rate on (qp_vat_code=tva_id)
73
where qp_internal='"
.$this->qp_internal.
"'"
;
74
$ret
=$this->
db
->exec_sql(
$sql
);
75
// $res contains all the line
76
$res
=
Database::fetch_all
(
$ret
);
77
78
if
(
sizeof
(
$res
)==0)
return
null
;
79
$count
=0;
80
foreach
(
$res
as
$row
)
81
{
82
$t_gestion_purchase=
new
gestion_purchase
($this->
db
);
83
foreach
($row as
$idx
=>
$value
)
84
$t_gestion_purchase->$idx=
$value
;
85
$array
[
$count
]=clone $t_gestion_purchase;
86
$count
++;
87
}
88
return
$array
;
89
}
90
function
search_by_jid
($p_jid)
91
{
92
$res
=$this->
db
->exec_sql(
"select qp_id from quant_purchase where j_id="
.$p_jid);
93
94
if
(
Database::num_row
(
$res
) == 1)
95
$this->qp_id=
Database::fetch_result
(
$res
,0,0);
96
else
97
$this->qp_id=0;
98
}
99
function
load
()
100
{
101
$sql
=
"select qp_id,
102
qp_internal,
103
qp_fiche,
104
qp_quantite,
105
qp_price,
106
qp_vat,
107
qp_vat_code,
108
qp_nd_amount,
109
qp_nd_tva,
110
qp_nd_tva_recup,
111
qp_supplier,
112
j_id,
113
qp_dep_priv,
114
qp_vat_sided
115
from quant_purchase
116
where qp_id="
.$this->qp_id;
117
$ret
=$this->
db
->exec_sql(
$sql
);
118
// $res contains all the line
119
$res
=
Database::fetch_all
(
$ret
);
120
121
if
( empty(
$res
) )
return
null
;
122
foreach
(
$res
[0] as
$idx
=>
$value
)
123
$this->
$idx
=
$value
;
124
125
}
126
127
}
$ret
$ret
Definition:
ajax_display_letter.php:51
DatabaseCore\fetch_all
static fetch_all($ret)
wrapper for the function pg_fetch_all
Definition:
database_core.class.php:755
db
$SecUser db
Definition:
export_security_pdf.php:118
gestion_purchase\$qp_vat
$qp_vat
Definition:
gestion_purchase.class.php:38
gestion_purchase\load
load()
Definition:
gestion_purchase.class.php:99
gestion_purchase\$qp_nd_tva_recup
$qp_nd_tva_recup
Definition:
gestion_purchase.class.php:42
gestion_purchase\$qp_nd_tva
$qp_nd_tva
Definition:
gestion_purchase.class.php:41
gestion_purchase\$qp_vat_sided
$qp_vat_sided
Definition:
gestion_purchase.class.php:48
gestion_purchase\$qp_id
$qp_id
Definition:
gestion_purchase.class.php:33
$sql
$sql
Definition:
ajax_add_concerned_card.php:100
gestion_purchase\$j_id
$j_id
Definition:
gestion_purchase.class.php:45
gestion_purchase\$qp_valid
$qp_valid
Definition:
gestion_purchase.class.php:44
$array
$array
Definition:
ajax_add_concerned_card.php:115
gestion_table
mother class for gestion
Definition:
gestion_table.class.php:29
gestion_purchase\$qp_quantite
$qp_quantite
Definition:
gestion_purchase.class.php:36
DatabaseCore\fetch_result
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all
Definition:
database_core.class.php:767
gestion_purchase\search_by_jid
search_by_jid($p_jid)
Definition:
gestion_purchase.class.php:90
$value
$value
Definition:
export_document.php:41
gestion_purchase\get_list
get_list()
return an array of gestion_table, the object are retrieved thanks the qs_internal
Definition:
gestion_purchase.class.php:52
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_NumRows
Definition:
database_core.class.php:734
gestion_purchase\$qp_fiche
$qp_fiche
Definition:
gestion_purchase.class.php:35
$idx
$idx
Definition:
ajax_bookmark.php:79
gestion_purchase\$qp_nd_amount
$qp_nd_amount
Definition:
gestion_purchase.class.php:40
$count
$count
Definition:
modele.inc.php:251
gestion_purchase\$qp_internal
$qp_internal
Definition:
gestion_purchase.class.php:34
gestion_purchase
this object handles the table quant_purchase
Definition:
gestion_purchase.class.php:31
$row
$row
Definition:
ajax_anc_detail_operation.php:33
gestion_purchase\$qp_supplier
$qp_supplier
Definition:
gestion_purchase.class.php:43
gestion_purchase\$qp_price
$qp_price
Definition:
gestion_purchase.class.php:37
$res
$res
Definition:
ajax_preference.php:49
gestion_purchase\$qp_vat_code
$qp_vat_code
Definition:
gestion_purchase.class.php:39
gestion_purchase\$qp_dep_priv
$qp_dep_priv
Definition:
gestion_purchase.class.php:47