Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2005-04-14 15:30:37 +00:00
parent db20f74f46
commit 95403ee192
2 changed files with 311 additions and 0 deletions

View File

@ -0,0 +1,170 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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$
*/
/**
\file htdocs/compta/commande/liste.php
\ingroup commande
\brief Page liste des commandes
\version $Revision$
*/
require("./pre.inc.php");
if (!$user->rights->commande->lire) accessforbidden();
/*
* Sécurité accés client
*/
$socidp = $_GET["socidp"];
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
llxHeader();
$begin=$_GET["begin"];
$sortorder=$_GET["sortorder"];
$sortfield=$_GET["sortfield"];
if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="DESC";
$limit = $conf->liste_limit;
$offset = $limit * $_GET["page"] ;
$sql = "SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande, c.fk_statut" ;
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c WHERE c.fk_soc = s.idp";
if ($socidp)
{
$sql .= " AND s.idp = $socidp";
}
if ($_GET["month"] > 0)
{
$sql .= " AND date_format(c.date_commande, '%Y-%m') = '$year-$month'";
}
if ($_GET["year"] > 0)
{
$sql .= " AND date_format(c.date_commande, '%Y') = $year";
}
if (isset($_GET["status"]))
{
$sql .= " AND fk_statut = ".$_GET["status"];
}
if (strlen($_POST["sf_ref"]) > 0)
{
$sql .= " AND c.ref like '%".$_POST["sf_ref"] . "%'";
}
$sql .= " ORDER BY $sortfield $sortorder";
$sql .= $db->plimit($limit + 1,$offset);
$resql = $db->query($sql);
if ($resql)
{
if ($socidp)
{
$soc = new Societe($db);
$soc->fetch($socidp);
$title = $langs->trans("ListOfOrders") . " - ".$soc->nom;
}
else
{
$title = $langs->trans("ListOfOrders");
}
// Si page des commandes à facturer
$link=DOL_URL_ROOT."/compta/commande.php";
$title.=" - ".$langs->trans("StatusOrderToBill");
$num = $db->num_rows($resql);
print_barre_liste($title, $_GET["page"], "listecommande.php","&amp;socidp=$socidp",$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"listecommande.php","c.ref","","&amp;socidp=$socidp",'width="15%"',$sortfield);
print_liste_field_titre($langs->trans("Company"),"listecommande.php","s.nom","","&amp;socidp=$socidp",'width="30%"',$sortfield);
print_liste_field_titre($langs->trans("Date"),"listecommande.php","c.date_commande","","&amp;socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield);
print_liste_field_titre($langs->trans("Status"),"listecommande.php","c.fk_statut","","&amp;socidp=$socidp",'width="10%" align="center"',$sortfield);
print "</tr>\n";
$var=True;
$generic_commande = new Commande($db);
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<td><a href=\"".$link."?id=$objp->rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$objp->ref."</a></td>\n";
print "<td><a href=\"../comm/fiche.php?socid=$objp->idp\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a></td>\n";
$now = time();
$lim = 3600 * 24 * 15 ;
if ( ($now - $objp->date_commande) > $lim && $objp->statutid == 1 )
{
print "<td><b> &gt; 15 jours</b></td>";
}
else
{
print "<td>&nbsp;</td>";
}
print "<td align=\"right\">";
$y = strftime("%Y",$objp->date_commande);
$m = strftime("%m",$objp->date_commande);
print strftime("%d",$objp->date_commande)."\n";
print " <a href=\"liste.php?year=$y&amp;month=$m\">";
print strftime("%B",$objp->date_commande)."</a>\n";
print " <a href=\"liste.php?year=$y\">";
print strftime("%Y",$objp->date_commande)."</a></td>\n";
print '<td align="center">'.$generic_commande->statuts[$objp->fk_statut].'</td>';
print "</tr>\n";
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
$i++;
}
print "</table>";
$db->free($resql);
}
else
{
print dolibarr_print_error($db);
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,141 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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$
*
*/
/**
\file htdocs/compta/pre.inc.php
\ingroup compta
\brief Fichier gestionnaire du menu compta
*/
require("../../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php';
$langs->load("orders");
$user->getrights('commande');
function llxHeader($head = "", $title="", $help_url='')
{
global $user, $conf, $langs;
$user->getrights('banque');
top_menu($head, $title);
$menu = new Menu();
// Les recettes
$menu->add(DOL_URL_ROOT."/compta/clients.php", $langs->trans("Customers"));
if ($conf->propal->enabled)
{
$langs->load("propal");
$menu->add(DOL_URL_ROOT."/compta/propal.php",$langs->trans("Prop"));
}
if ($conf->contrat->enabled)
{
$langs->load("contracts");
$menu->add(DOL_URL_ROOT."/contrat/",$langs->trans("Contracts"));
}
if ($conf->don->enabled)
{
$langs->load("donations");
$menu->add(DOL_URL_ROOT."/compta/dons/",$langs->trans("Donations"));
}
if ($conf->facture->enabled)
{
$langs->load("bills");
$menu->add(DOL_URL_ROOT."/compta/facture.php",$langs->trans("Bills"));
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php",$langs->trans("Unpayed"));
$menu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php",$langs->trans("Payments"));
if (! defined(FACTURE_DISABLE_RECUR) || ! FACTURE_DISABLE_RECUR)
{
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php","Récurrentes");
}
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/stats/", $langs->trans("Statistics"));
}
if ($conf->commande->enabled && $conf->facture->enabled)
{
$langs->load("orders");
$menu->add(DOL_URL_ROOT."/compta/listecommande.php?leftmenu=orders&status=3", $langs->trans("MenuOrdersToBill"));
}
// Les dépenses
if ($conf->fournisseur->enabled)
{
$langs->load("suppliers");
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
}
if ($conf->deplacement->enabled && $user->societe_id == 0)
{
$menu->add(DOL_URL_ROOT."/compta/deplacement/", "Déplacement");
}
if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0)
{
$menu->add(DOL_URL_ROOT."/compta/tva/index.php",$langs->trans("VAT"));
}
if ($conf->compta->enabled)
{
$menu->add(DOL_URL_ROOT."/compta/charges/index.php",$langs->trans("Charges"));
}
// Vision des recettes-dépenses
if ($conf->banque->enabled && $user->rights->banque->lire)
{
$langs->load("banks");
$menu->add(DOL_URL_ROOT."/compta/bank/",$langs->trans("Bank"));
}
$menu->add(DOL_URL_ROOT."/compta/stats/","CA / Résultats");
if ($conf->prelevement->enabled)
{
$menu->add(DOL_URL_ROOT."/compta/prelevement/",$langs->trans("StandingOrders"));
}
$menu->add(DOL_URL_ROOT."/compta/ventilation/",$langs->trans("Ventilation"));
if ($user->rights->compta->ventilation->parametrer)
{
$menu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Param"));
}
left_menu($menu->liste, $help_url);
}
?>