noalyss
Version-9
include
class
gestion_sold.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_sold
24
*/
25
26
/*! \brief this object handles the table quant_sold
27
*
28
*/
29
30
31
32
class
gestion_sold
extends
gestion_table
33
{
34
var
$qs_id
;
/*!< $qs_id primary key */
35
var
$qs_internal
;
/*!< qs_internal */
36
var
$qs_fiche
;
/*!< f_id code */
37
var
$qs_quantite
;
/*!< quantity of the card */
38
var
$qs_price
;
/*!< price */
39
var
$qs_vat
;
/*!< vat_amount */
40
var
$qs_vat_code
;
/*!< vat_code */
41
var
$qs_client
;
/*!< f_id of the customer */
42
var
$qs_valid
;
/*!< will not be used */
43
var
$j_id
;
/*!< jrnx.j_id */
44
var
$qs_vat_sided
;
45
/*!\brief return an array of gestion_table, the object are
46
* retrieved thanks the qs_internal
47
*/
48
function
get_list
()
49
{
50
if
($this->qs_internal==
""
)
51
throw
new
Exception(__FILE__.__LINE__.
" qs_internal est vide"
);
52
$sql
=
"select qs_id,
53
qs_internal,
54
qs_fiche,
55
qs_quantite,
56
qs_price,
57
qs_vat,
58
tva_label,
59
tva_rate,
60
qs_vat_code,
61
qs_client,
62
j_id,
63
qs_vat_sided
64
from quant_sold left join tva_rate on (qs_vat_code=tva_id)
65
where qs_internal='"
.$this->qs_internal.
"'"
;
66
$ret
=$this->
db
->exec_sql(
$sql
);
67
// $res contains all the line
68
$res
=
Database::fetch_all
(
$ret
);
69
70
if
(
$res
== FALSE ||
sizeof
(
$res
)==0)
return
null
;
71
$count
=0;
72
73
foreach
(
$res
as
$row
)
74
{
75
$t_gestion_sold=
new
gestion_sold
($this->
db
);
76
foreach
($row as
$idx
=>
$value
)
77
$t_gestion_sold->$idx=
$value
;
78
$array
[
$count
]=clone $t_gestion_sold;
79
$count
++;
80
}
81
return
$array
;
82
}
83
function
search_by_jid
($p_jid)
84
{
85
$res
=$this->
db
->exec_sql(
"select qs_id from quant_sold where j_id="
.$p_jid);
86
87
if
(
Database::num_row
(
$res
) == 1)
88
$this->qs_id=
Database::fetch_result
(
$res
,0,0);
89
else
90
$this->qs_id=0;
91
}
92
function
load
()
93
{
94
$sql
=
" select qs_id,
95
qs_internal,
96
qs_fiche,
97
qs_quantite,
98
qs_price,
99
qs_vat,
100
qs_vat_code,
101
qs_client,
102
j_id,
103
qs_vat_sided
104
from quant_sold
105
where qs_id=$1"
;
106
$ret
=$this->
db
->exec_sql(
$sql
,array($this->qs_id));
107
// $res contains all the line
108
$res
=
Database::fetch_all
(
$ret
);
109
110
if
(
$res
==FALSE || empty(
$res
) )
return
null
;
111
foreach
(
$res
[0] as
$idx
=>
$value
)
112
$this->
$idx
=
$value
;
113
}
114
}
$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
gestion_sold\$qs_vat
$qs_vat
Definition:
gestion_sold.class.php:39
db
$SecUser db
Definition:
export_security_pdf.php:118
gestion_sold\$qs_vat_sided
$qs_vat_sided
Definition:
gestion_sold.class.php:44
gestion_sold\$qs_vat_code
$qs_vat_code
Definition:
gestion_sold.class.php:40
$sql
$sql
Definition:
ajax_add_concerned_card.php:100
gestion_sold\$qs_internal
$qs_internal
Definition:
gestion_sold.class.php:35
$array
$array
Definition:
ajax_add_concerned_card.php:115
gestion_table
mother class for gestion
Definition:
gestion_table.class.php:29
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
$value
$value
Definition:
export_document.php:41
gestion_sold\$j_id
$j_id
Definition:
gestion_sold.class.php:43
gestion_sold\$qs_fiche
$qs_fiche
Definition:
gestion_sold.class.php:36
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_NumRows
Definition:
database_core.class.php:734
gestion_sold\search_by_jid
search_by_jid($p_jid)
Definition:
gestion_sold.class.php:83
gestion_sold\$qs_id
$qs_id
Definition:
gestion_sold.class.php:34
gestion_sold\$qs_valid
$qs_valid
Definition:
gestion_sold.class.php:42
gestion_sold\$qs_client
$qs_client
Definition:
gestion_sold.class.php:41
gestion_sold\load
load()
Definition:
gestion_sold.class.php:92
$idx
$idx
Definition:
ajax_bookmark.php:79
$count
$count
Definition:
modele.inc.php:251
gestion_sold\$qs_quantite
$qs_quantite
Definition:
gestion_sold.class.php:37
gestion_sold\get_list
get_list()
return an array of gestion_table, the object are retrieved thanks the qs_internal
Definition:
gestion_sold.class.php:48
$row
$row
Definition:
ajax_anc_detail_operation.php:33
$res
$res
Definition:
ajax_preference.php:49
gestion_sold\$qs_price
$qs_price
Definition:
gestion_sold.class.php:38
gestion_sold
this object handles the table quant_sold
Definition:
gestion_sold.class.php:32