Modid mineures
This commit is contained in:
parent
1720aefe7d
commit
c0dbe03c17
@ -1,5 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -24,128 +24,158 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Tva {
|
class Tva
|
||||||
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $note;
|
var $note;
|
||||||
/*
|
/*
|
||||||
* Initialistation automatique de la classe
|
* Initialistation automatique de la classe
|
||||||
*/
|
*/
|
||||||
Function Tva($DB) {
|
Function Tva($DB)
|
||||||
global $config;
|
{
|
||||||
|
$this->db = $DB;
|
||||||
|
|
||||||
$this->db = $DB;
|
return 1;
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Hum la fonction s'appelle 'Solde' elle doit a mon avis
|
* Hum la fonction s'appelle 'Solde' elle doit a mon avis
|
||||||
* calcluer le solde de TVA, non ?
|
* calcluer le solde de TVA, non ?
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function solde($year = 0) {
|
Function solde($year = 0)
|
||||||
|
{
|
||||||
|
|
||||||
$reglee = $this->tva_sum_reglee($year);
|
$reglee = $this->tva_sum_reglee($year);
|
||||||
|
|
||||||
$payee = $this->tva_sum_payee($year);
|
$payee = $this->tva_sum_payee($year);
|
||||||
$collectee = $this->tva_sum_collectee($year);
|
$collectee = $this->tva_sum_collectee($year);
|
||||||
|
|
||||||
$solde = $reglee - ($collectee - $payee) ;
|
$solde = $reglee - ($collectee - $payee) ;
|
||||||
|
|
||||||
return $solde;
|
return $solde;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Tva collectée
|
* Tva collectée
|
||||||
* Total de la TVA des factures emises par la societe.
|
* Total de la TVA des factures emises par la societe.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function tva_sum_collectee($year = 0) {
|
Function tva_sum_collectee($year = 0)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT sum(f.tva) as amount";
|
$sql = "SELECT sum(f.tva) as amount";
|
||||||
$sql .= " FROM llx_facture as f WHERE f.paye = 1";
|
$sql .= " FROM llx_facture as f WHERE f.paye = 1";
|
||||||
|
|
||||||
if ($year) {
|
if ($year)
|
||||||
$sql .= " AND f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
{
|
||||||
|
$sql .= " AND f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows())
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
return $obj->amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
if ($this->db->num_rows()) {
|
|
||||||
$obj = $this->db->fetch_object(0);
|
|
||||||
return $obj->amount;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
print $this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Tva payée
|
* Tva payée
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function tva_sum_payee($year = 0) {
|
Function tva_sum_payee($year = 0)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT sum(f.amount) as amount";
|
$sql = "SELECT sum(f.amount) as amount";
|
||||||
$sql .= " FROM llx_facture_fourn as f";
|
$sql .= " FROM llx_facture_fourn as f";
|
||||||
|
|
||||||
if ($year) {
|
if ($year)
|
||||||
$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' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows())
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
return $obj->amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
if ($this->db->num_rows()) {
|
|
||||||
$obj = $this->db->fetch_object(0);
|
|
||||||
return $obj->amount;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
print $this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Tva réglée
|
* Tva réglée
|
||||||
* Total de la TVA réglee aupres de qui de droit
|
* Total de la TVA réglee aupres de qui de droit
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function tva_sum_reglee($year = 0) {
|
Function tva_sum_reglee($year = 0)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT sum(f.amount) as amount";
|
$sql = "SELECT sum(f.amount) as amount";
|
||||||
$sql .= " FROM llx_tva as f";
|
$sql .= " FROM llx_tva as f";
|
||||||
|
|
||||||
if ($year) {
|
if ($year)
|
||||||
$sql .= " WHERE f.datev >= '$year-01-01' AND f.datev <= '$year-12-31' ";
|
{
|
||||||
|
$sql .= " WHERE f.datev >= '$year-01-01' AND f.datev <= '$year-12-31' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows())
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
return $obj->amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
if ($this->db->num_rows()) {
|
|
||||||
$obj = $this->db->fetch_object(0);
|
|
||||||
return $obj->amount;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->free();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
print $this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user