36 'amount_tva'=>
'amount_tva',
39 'start_periode'=>
'start_periode',
40 'end_periode'=>
'end_periode',
43 function __construct ($p_init,$p_dir,$p_start_periode,$p_end_periode) {
45 $this->start_periode=$p_start_periode;
46 $this->end_periode=$p_end_periode;
50 if ( array_key_exists($p_string,self::$variable) ) {
51 $idx=self::$variable[$p_string];
55 throw new Exception(
"Attribut inexistant $p_string");
58 if ( array_key_exists($p_string,self::$variable) ) {
59 $idx=self::$variable[$p_string];
63 throw new Exception(
"Attribut inexistant $p_string");
67 public function get_info() {
return var_export(self::$variable,
true); }
76 $ctva=$this->db->get_array(
"select tva_id,pcm_val from tva_belge.parameter_chld where pcode=$1",array($this->grid));
77 if ( count($ctva)== 0 ) {
94 for ($i=0;$i<count($this->param);$i++)
96 $tmp_calc=$this->
get_amount_filter($this->param[$i][
'tva_id'],$this->param[$i][
'pcm_val']);
97 $result=bcadd($result,$tmp_calc);
100 return round($result,2);
109 for ($i=0;$i<count($this->param);$i++)
111 $tmp_calc=$this->
get_vat_filter($this->param[$i][
'tva_id'],$this->param[$i][
'pcm_val']);
112 $result=bcadd($result,$tmp_calc);
115 return round($result,2);
125 if ( $this->dir ==
'out' && trim($p_account) !=
'' && trim($p_code) !=
'' ) {
126 $sql=
"select coalesce(sum(qs_price),0) as amount from quant_sold
127 join jrnx using (j_id)
128 where qs_vat_code=$1 and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
129 and j_poste::text like ($4)";
130 $res=$this->db->get_array(
$sql,array($p_code,
131 $this->start_periode,
134 return $res[0][
'amount'];
137 if ( $this->dir ==
'in' && trim($p_account) !=
'' && trim($p_code) !=
'' ) {
138 $sql=
"select coalesce(sum(qp_price),0) as amount from quant_purchase join jrnx using (j_id)
139 where qp_vat_code=$1 and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
140 and j_poste::text like ($4)";
141 $res=$this->db->get_array(
$sql,array($p_code,
142 $this->start_periode,
145 return $res[0][
'amount'];
157 if ( $this->dir ==
'out' && trim($p_account) !=
'' && trim($p_code) !=
'' ) {
158 $sql=
"select coalesce(sum(qs_vat),0) as amount from quant_sold join jrnx using (j_id)
159 where qs_vat_code=$1 and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
160 and j_poste::text like ($4)";
161 $res=$this->db->get_array(
$sql,array($p_code,
162 $this->start_periode,
165 return $res[0][
'amount'];
168 if ( $this->dir ==
'in' && trim($p_account) !=
'' && trim($p_code) !=
'' ) {
169 $sql=
"select coalesce(sum(qp_vat),0) as amount from quant_purchase join jrnx using (j_id)
170 where qp_vat_code=$1 and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
171 and j_poste::text like ($4)";
172 $res=$this->db->get_array(
$sql,array($p_code,
173 $this->start_periode,
176 return $res[0][
'amount'];
__construct($p_init, $p_dir, $p_start_periode, $p_end_periode)
get_amount_filter($p_code, $p_account)
get the amount of operation from the table quant_sold or quant_purchase
amount_operation()
get the amount of vat thanks its code
record_ledger()
record into the ledger the operation for purging the the vat accouting
set_parameter($p_string, $p_value)
get_vat_filter($p_code, $p_account)
get the amount of VAT from the table quant_sold or quant_purchase
load_parameter()
load parameters and set param to a array of value from parameter_chld