*** empty log message ***
This commit is contained in:
parent
7e978062d5
commit
a50b449eef
@ -26,8 +26,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
|
|
||||||
require("./bank.lib.php3");
|
require("./bank.lib.php3");
|
||||||
|
|
||||||
|
require("../../tva.class.php3");
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
|
|
||||||
@ -51,13 +53,10 @@ if ($result) {
|
|||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
|
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
|
||||||
print "<TR class=\"liste_titre\">";
|
print "<TR class=\"liste_titre\">";
|
||||||
print "<td>Label</td><td>Banque</TD>";
|
print "<td>Label</td><td>Banque</TD>";
|
||||||
print "<td align=\"left\">Numéro</a></TD><td align=\"right\">Solde</td>";
|
print "<td align=\"left\">Numéro</a></TD><td align=\"right\">Solde</td><td> </td>";
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
$total = 0;
|
$total = 0;
|
||||||
for ($i = 0 ; $i < sizeof($accounts) ; $i++) {
|
for ($i = 0 ; $i < sizeof($accounts) ; $i++) {
|
||||||
@ -65,22 +64,37 @@ for ($i = 0 ; $i < sizeof($accounts) ; $i++) {
|
|||||||
$acc->fetch($accounts[$i]);
|
$acc->fetch($accounts[$i]);
|
||||||
|
|
||||||
$solde = $acc->solde();
|
$solde = $acc->solde();
|
||||||
|
|
||||||
|
|
||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print '<a href="account.php3?account='.$acc->id.'">'.$acc->label.'</a>';
|
print '<a href="account.php3?account='.$acc->id.'">'.$acc->label.'</a>';
|
||||||
|
|
||||||
print "</td><td>$acc->bank</td><td>$acc->number</td>";
|
print "</td><td>$acc->bank</td><td>$acc->number</td>";
|
||||||
|
|
||||||
|
print '</td><td align="right">'.price($solde).'</td><td> </td></tr>';
|
||||||
|
|
||||||
print '</td><td align="right">'.price($solde).'</td></tr>';
|
|
||||||
|
|
||||||
$total += $solde;
|
$total += $solde;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="3" align="right">Total</td><td align="right">'.price($total).'</td></tr>';
|
print '<tr><td colspan="3" align="right"><b>Total</b></td><td align="right"><b>'.price($total).'</b></td><td>euros HT</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre"><td colspan="5">Dettes</td></tr>';
|
||||||
|
/*
|
||||||
|
* TVA
|
||||||
|
*/
|
||||||
|
$tva = new Tva($db);
|
||||||
|
|
||||||
|
$tva_solde = $tva->solde();
|
||||||
|
|
||||||
|
$total = $total + $tva_solde;
|
||||||
|
|
||||||
|
print '<tr><td colspan="3">TVA</td><td align="right">'.price($tva_solde).'</td><td> </td></tr>';
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
print '<tr><td colspan="3" align="right"><b>Total</b></td><td align="right"><b>'.price($total).'</b></td><td>euros HT</td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,8 @@ function llxHeader($head = "") {
|
|||||||
|
|
||||||
$menu->add_submenu("casoc.php3","Par société");
|
$menu->add_submenu("casoc.php3","Par société");
|
||||||
$menu->add_submenu("pointmort.php3","Point mort");
|
$menu->add_submenu("pointmort.php3","Point mort");
|
||||||
$menu->add_submenu("tva.php3","TVA");
|
|
||||||
|
$menu->add("tva/index.php3","TVA");
|
||||||
|
|
||||||
$menu->add("/compta/propal.php3","Propales");
|
$menu->add("/compta/propal.php3","Propales");
|
||||||
|
|
||||||
|
|||||||
131
htdocs/compta/tva/index.php3
Normal file
131
htdocs/compta/tva/index.php3
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
require("./pre.inc.php3");
|
||||||
|
require("../../tva.class.php3");
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function pt ($db, $sql, $date) {
|
||||||
|
global $bc;
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $db->num_rows();
|
||||||
|
$i = 0; $total = 0 ;
|
||||||
|
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||||
|
print "<TR class=\"liste_titre\">";
|
||||||
|
print "<TD width=\"60%\">$date</TD>";
|
||||||
|
print "<TD align=\"right\">Montant</TD>";
|
||||||
|
print "<td> </td>\n";
|
||||||
|
print "</TR>\n";
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num) {
|
||||||
|
$obj = $db->fetch_object( $i);
|
||||||
|
$var=!$var;
|
||||||
|
print "<TR $bc[$var]>";
|
||||||
|
print "<TD>$obj->dm</TD>\n";
|
||||||
|
print "<TD align=\"right\">".price($obj->amount)."</TD><td> </td>\n";
|
||||||
|
print "</TR>\n";
|
||||||
|
|
||||||
|
$total = $total + $obj->amount;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print "<tr><td align=\"right\">Total :</td><td align=\"right\"><b>".price($total)."</b></td><td>euros HT</td></tr>";
|
||||||
|
|
||||||
|
print "</TABLE>";
|
||||||
|
$db->free();
|
||||||
|
} else {
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$db = new Db();
|
||||||
|
|
||||||
|
$tva = new Tva($db);
|
||||||
|
|
||||||
|
print "Solde :" . price($tva->solde());
|
||||||
|
|
||||||
|
$yearc = strftime("%Y",time());
|
||||||
|
|
||||||
|
|
||||||
|
echo '<table width="100%">';
|
||||||
|
echo '<tr><td width="50%" valign="top"><b>TVA collectée</b></td>';
|
||||||
|
echo '<td>Tva Payée</td></tr>';
|
||||||
|
|
||||||
|
for ($y = $yearc ; $y >= $conf->years ; $y=$y-1 ) {
|
||||||
|
|
||||||
|
echo '<tr><td width="50%" valign="top">';
|
||||||
|
/*
|
||||||
|
* Collectée
|
||||||
|
*/
|
||||||
|
print "<table width=\"100%\">";
|
||||||
|
print "<tr><td valign=\"top\">";
|
||||||
|
|
||||||
|
$sql = "SELECT sum(f.tva) as amount , date_format(f.datef,'%Y-%m') as dm";
|
||||||
|
$sql .= " FROM llx_facture as f WHERE f.paye = 1 AND f.datef >= '$y-01-01' AND f.datef <= '$y-12-31' ";
|
||||||
|
$sql .= " GROUP BY dm DESC";
|
||||||
|
|
||||||
|
pt($db, $sql,"Année $y");
|
||||||
|
|
||||||
|
print "</td></tr></table>";
|
||||||
|
|
||||||
|
echo '</td><td valign="top" width="50%">';
|
||||||
|
/*
|
||||||
|
* Payée
|
||||||
|
*/
|
||||||
|
|
||||||
|
print "<table width=\"100%\">";
|
||||||
|
print "<tr><td valign=\"top\">";
|
||||||
|
|
||||||
|
$sql = "SELECT amount, date_format(f.datev,'%Y-%m') as dm";
|
||||||
|
$sql .= " FROM llx_tva as f WHERE f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
|
||||||
|
$sql .= " GROUP BY dm DESC";
|
||||||
|
|
||||||
|
pt($db, $sql,"Année $y");
|
||||||
|
|
||||||
|
print "</td></tr></table>";
|
||||||
|
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
?>
|
||||||
50
htdocs/compta/tva/pre.inc.php3
Normal file
50
htdocs/compta/tva/pre.inc.php3
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
require("../../main.inc.php3");
|
||||||
|
|
||||||
|
function llxHeader($head = "") {
|
||||||
|
global $user, $conf;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
top_menu($head);
|
||||||
|
|
||||||
|
$menu = new Menu();
|
||||||
|
|
||||||
|
$menu->add("/compta/facture.php3","Factures");
|
||||||
|
|
||||||
|
|
||||||
|
$menu->add("../ca.php3","Chiffres d'affaires");
|
||||||
|
|
||||||
|
$menu->add("index.php3","TVA");
|
||||||
|
|
||||||
|
|
||||||
|
$menu->add("/compta/bank/index.php3","Bank");
|
||||||
|
|
||||||
|
left_menu($menu->liste);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
122
htdocs/tva.class.php3
Normal file
122
htdocs/tva.class.php3
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* La tva collectée n'est calculée que sur les factures payées.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Tva {
|
||||||
|
var $db;
|
||||||
|
|
||||||
|
var $note;
|
||||||
|
|
||||||
|
Function Tva($DB) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$this->db = $DB;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Function solde($year = 0) {
|
||||||
|
|
||||||
|
$payee = $this->tva_sum_payee($year);
|
||||||
|
$collectee = $this->tva_sum_collectee($year);
|
||||||
|
|
||||||
|
$solde = $payee - $collectee;
|
||||||
|
|
||||||
|
return $solde;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Tva collectée
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function tva_sum_collectee($year = 0) {
|
||||||
|
|
||||||
|
$sql = "SELECT sum(f.tva) as amount";
|
||||||
|
$sql .= " FROM llx_facture as f WHERE f.paye = 1";
|
||||||
|
|
||||||
|
if ($year) {
|
||||||
|
$sql .= " AND f.datef >= '$y-01-01' AND f.datef <= '$y-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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Tva payée
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function tva_sum_payee($year = 0) {
|
||||||
|
|
||||||
|
$sql = "SELECT sum(f.amount) as amount";
|
||||||
|
$sql .= " FROM llx_tva as f";
|
||||||
|
|
||||||
|
if ($year) {
|
||||||
|
$sql .= " WHERE f.datev >= '$y-01-01' AND f.datev <= '$y-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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user