113 |
function tva_sum_payee($year = 0) |
function tva_sum_payee($year = 0) |
114 |
{ |
{ |
115 |
|
|
116 |
$sql = "SELECT sum(f.amount) as amount"; |
$sql = "SELECT sum(f.total_tva) as total_tva"; |
117 |
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
118 |
|
|
119 |
if ($year) |
if ($year) |
120 |
{ |
{ |
121 |
$sql .= " WHERE f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' "; |
$sql .= " WHERE f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' "; |
122 |
} |
} |
123 |
|
echo $sql; |
124 |
$result = $this->db->query($sql); |
$result = $this->db->query($sql); |
125 |
|
|
126 |
if ($result) |
if ($result) |
128 |
if ($this->db->num_rows()) |
if ($this->db->num_rows()) |
129 |
{ |
{ |
130 |
$obj = $this->db->fetch_object($result); |
$obj = $this->db->fetch_object($result); |
131 |
return $obj->amount; |
return $obj->total_tva; |
132 |
} |
} |
133 |
else |
else |
134 |
{ |
{ |