Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
Impacc_TVA Class Reference
Collaboration diagram for Impacc_TVA:
Collaboration graph

Public Member Functions

 display_list ()
 
 check_exist ($tva_id)
 The TVA ID must exist. More...
 
 check_valid ($tva_code, $pt_id)
 the TVA Code must be unique More...
 
 insert ($tva_id, $tva_code)
 
 update ($id, $tva_id, $tva_code)
 
 delete ($p_id)
 
 display_modify ($p_tva)
 
 display_add ()
 

Detailed Description

Definition at line 30 of file class_impacc_tva.php.

Member Function Documentation

Impacc_TVA::check_exist (   $tva_id)

The TVA ID must exist.

Definition at line 40 of file class_impacc_tva.php.

41  {
42 
43  }
Impacc_TVA::check_valid (   $tva_code,
  $pt_id 
)

the TVA Code must be unique

Definition at line 45 of file class_impacc_tva.php.

References $cn.

Referenced by insert(), and update().

46  {
47  $cn=Dossier::connect();
48  $count=$cn->get_value(
49  "select
50  count(*)
51  from
52  impacc.parameter_tva
53  where
54  pt_id <> $1
55  and tva_code=$2",
56  array($pt_id,$tva_code)
57  );
58  return $count;
59  }
global $cn
Impacc_TVA::delete (   $p_id)

Definition at line 82 of file class_impacc_tva.php.

References $cn.

83  {
84  $cn=Dossier::connect();
85  $cn->exec_sql("delete from impacc.parameter_tva where pt_id=$1",array($p_id));
86  }
global $cn
Impacc_TVA::display_add ( )

Definition at line 103 of file class_impacc_tva.php.

References $comment, $id, and $tva_id.

104  {
105  $tva_id="";
106  $comment="";
107  $tva_code="";
108  $id=-1;
109  $label="";
110  // Display empty Box
111  require_once DIR_IMPORT_ACCOUNT."/template/tva_parameter_detail.php";
112  }
Impacc_TVA::display_list ( )

Definition at line 32 of file class_impacc_tva.php.

References $cn, $ret, and $sql.

33  {
34  $cn=Dossier::connect();
35  $sql="select * from impacc.parameter_tva left join public.tva_rate using(tva_id) order by tva_code";
36  $ret=$cn->get_array($sql);
37  require_once DIR_IMPORT_ACCOUNT."/template/tva_parameter_list.php";
38  }
$ret
$sql
global $cn
Impacc_TVA::display_modify (   $p_tva)

Definition at line 87 of file class_impacc_tva.php.

References $cn, $comment, $id, $ret, $sql, and $tva_id.

88  {
89  $cn=Dossier::connect();
90 
91  // Load parameter
92  $sql="select * from impacc.parameter_tva left join public.tva_rate using(tva_id) where pt_id=$1";
93  $ret=$cn->get_array($sql,array($p_tva));
94  $tva_id=$ret[0]["tva_id"];
95  $comment=h($ret[0]['tva_comment']);
96  $tva_code=h($ret[0]['tva_code']);
97  $id=$ret[0]['pt_id'];
98  $label=$ret[0]['tva_label'];
99 
100  // Display Box
101  require_once DIR_IMPORT_ACCOUNT."/template/tva_parameter_detail.php";
102  }
$ret
$sql
global $cn
Impacc_TVA::insert (   $tva_id,
  $tva_code 
)

Definition at line 60 of file class_impacc_tva.php.

References $cn, $tva_id, and check_valid().

61  {
62  if ( $this->check_valid($tva_code,-1) > 0)
63  {
64  throw new Exception(_("Duplicate"));
65  }
66  $cn=Dossier::connect();
67 
68  $cn->exec_sql("insert into impacc.parameter_tva(tva_id,tva_code)
69  values ($1,$2)
70  returning pt_id", array($tva_id,$tva_code));
71  }
check_valid($tva_code, $pt_id)
the TVA Code must be unique
global $cn
Impacc_TVA::update (   $id,
  $tva_id,
  $tva_code 
)

Definition at line 72 of file class_impacc_tva.php.

References $cn, $id, $tva_id, and check_valid().

73  {
74  if ( $this->check_valid($tva_code,$id) > 0)
75  {
76  throw new Exception(_("Duplicate"));
77  }
78  $cn=Dossier::connect();
79  $cn->exec_sql("update impacc.parameter_tva set tva_id=$1,tva_code=$2 where pt_id=$3",
80  array($tva_id,$tva_code,$id));
81  }
check_valid($tva_code, $pt_id)
the TVA Code must be unique
global $cn

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