Filtre acces client
This commit is contained in:
parent
f040449329
commit
2d7ba68d49
@ -1,5 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-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
|
||||||
@ -21,6 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socidp = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
@ -61,41 +71,47 @@ print_titre(translate("Espace compta"));
|
|||||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="33%">';
|
print '<tr><td valign="top" width="33%">';
|
||||||
/*
|
|
||||||
* Charges a payer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
$sql = "SELECT c.amount, cc.libelle";
|
|
||||||
$sql .= " FROM llx_chargesociales as c, c_chargesociales as cc";
|
|
||||||
$sql .= " WHERE c.fk_type = cc.id AND c.paye=0";
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ($user->societe_id == 0)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
|
||||||
if ($num)
|
|
||||||
|
/*
|
||||||
|
* Charges a payer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$sql = "SELECT c.amount, cc.libelle";
|
||||||
|
$sql .= " FROM llx_chargesociales as c, c_chargesociales as cc";
|
||||||
|
$sql .= " WHERE c.fk_type = cc.id AND c.paye=0";
|
||||||
|
|
||||||
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
$num = $db->num_rows();
|
||||||
print "<TR class=\"liste_titre\">";
|
if ($num)
|
||||||
print "<TD colspan=\"2\">Charges à payer</td>";
|
|
||||||
print "</TR>\n";
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object( $i);
|
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||||
$var = !$var;
|
print "<TR class=\"liste_titre\">";
|
||||||
print "<tr $bc[$var]>";
|
print "<TD colspan=\"2\">Charges à payer</td>";
|
||||||
print '<td>'.$obj->libelle.'</td>';
|
print "</TR>\n";
|
||||||
print '<td align="right">'.price($obj->amount).'</td>';
|
$i = 0;
|
||||||
print '</tr>';
|
|
||||||
$i++;
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object( $i);
|
||||||
|
$var = !$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td>'.$obj->libelle.'</td>';
|
||||||
|
print '<td align="right">'.price($obj->amount).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
print '</table><br>';
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
print $db->error();
|
||||||
print $db->error();
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Propales
|
* Propales
|
||||||
@ -108,6 +124,10 @@ if ($user->comm > 0 && $conf->commercial )
|
|||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 2";
|
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 2";
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND fk_soc = $socidp";
|
||||||
|
}
|
||||||
if (valeur($sql))
|
if (valeur($sql))
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -125,6 +145,10 @@ print '<td colspan="2">'.translate("Bills").'</td>';
|
|||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
|
|
||||||
$sql = "SELECT facnumber, rowid FROM llx_facture WHERE paye = 0";
|
$sql = "SELECT facnumber, rowid FROM llx_facture WHERE paye = 0";
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND fk_soc = $socidp";
|
||||||
|
}
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
@ -204,41 +228,45 @@ if ( $result ) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges a payer
|
* Charges a payer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT ff.amount, ff.libelle";
|
if ($user->societe_id == 0)
|
||||||
$sql .= " FROM llx_facture_fourn as ff";
|
|
||||||
$sql .= " WHERE ff.paye=0";
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$sql = "SELECT ff.amount, ff.libelle";
|
||||||
if ($num)
|
$sql .= " FROM llx_facture_fourn as ff";
|
||||||
|
$sql .= " WHERE ff.paye=0";
|
||||||
|
|
||||||
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">';
|
$num = $db->num_rows();
|
||||||
print '<TR class="liste_titre">';
|
if ($num)
|
||||||
print '<TD colspan="2">Charges à payer</td>';
|
|
||||||
print "</TR>\n";
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object( $i);
|
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
$var = !$var;
|
print '<TR class="liste_titre">';
|
||||||
print "<tr $bc[$var]>";
|
print '<TD colspan="2">Charges à payer</td>';
|
||||||
print '<td>'.$obj->libelle.'</td>';
|
print "</TR>\n";
|
||||||
print '<td align="right">'.price($obj->amount).'</td>';
|
$i = 0;
|
||||||
print '</tr>';
|
|
||||||
$i++;
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object( $i);
|
||||||
|
$var = !$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td>'.$obj->libelle.'</td>';
|
||||||
|
print '<td align="right">'.price($obj->amount).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
print '</table><br>';
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
print $db->error();
|
||||||
print $db->error();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td><td width="40%"> </td></tr>';
|
print '</td><td width="40%"> </td></tr>';
|
||||||
|
|||||||
@ -22,15 +22,18 @@
|
|||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
require("../contact.class.php3");
|
require("../contact.class.php3");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socidp = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
if ($sortorder == "") {
|
|
||||||
$sortorder="ASC";
|
|
||||||
}
|
|
||||||
if ($sortfield == "") {
|
|
||||||
$sortfield="nom";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'note') {
|
if ($action == 'note') {
|
||||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||||
@ -86,21 +89,24 @@ if ($mode == 'search') {
|
|||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($socid > 0) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode Liste
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
|
$sortorder="ASC";
|
||||||
|
}
|
||||||
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
|
$sortfield="nom";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print_barre_liste("Liste des fournisseurs",$page, $PHP_SELF);
|
print_barre_liste("Liste des fournisseurs",$page, $PHP_SELF);
|
||||||
|
|
||||||
$sql = "SELECT s.idp, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.fournisseur=1";
|
$sql = "SELECT s.idp, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.fournisseur=1";
|
||||||
@ -109,6 +115,10 @@ if ($socid > 0) {
|
|||||||
$sql .= " AND s.fk_stcomm=$stcomm";
|
$sql .= " AND s.fk_stcomm=$stcomm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($socidp) {
|
||||||
|
$sql .= " AND s.idp=$socidp";
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($begin)) {
|
if (strlen($begin)) {
|
||||||
$sql .= " AND upper(s.nom) like '$begin%'";
|
$sql .= " AND upper(s.nom) like '$begin%'";
|
||||||
}
|
}
|
||||||
@ -159,7 +169,7 @@ if ($socid > 0) {
|
|||||||
} else {
|
} else {
|
||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user