Deplacement des fichiers
This commit is contained in:
parent
95403ee192
commit
2f6493a8f2
@ -1,357 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-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.php
|
||||
\ingroup commande
|
||||
\brief Fiche commande
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$langs->load("orders");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
$user->getrights('commande');
|
||||
$user->getrights('facture');
|
||||
|
||||
if (! $user->rights->commande->lire) accessforbidden();
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/project.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/propal.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/commande/commande.class.php";
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'facturee')
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
$commande->classer_facturee();
|
||||
}
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("OrderCard"),"Commande");
|
||||
|
||||
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($_GET["id"] > 0)
|
||||
{
|
||||
$commande = New Commande($db);
|
||||
if ( $commande->fetch($_GET["id"]) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->soc_id);
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
$head[0][0] = DOL_URL_ROOT.'/compta/commande.php?id='.$commande->id;
|
||||
$head[0][1] = $langs->trans("Order").": ".$commande->ref;
|
||||
$h = 1;
|
||||
$a = 0;
|
||||
|
||||
dolibarr_fiche_head($head, $a, $soc->nom);
|
||||
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
||||
print '<td colspan="2">';
|
||||
print '<b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
|
||||
|
||||
print '<td width="50%">';
|
||||
print $commande->statuts[$commande->statut];
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print "<td colspan=\"2\">".strftime("%A %d %B %Y",$commande->date)."</td>\n";
|
||||
|
||||
print '<td width="50%">'.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ;
|
||||
if ($commande->source == 0)
|
||||
{
|
||||
/* Propale */
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($commande->propale_id);
|
||||
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($conf->projet->enabled) {
|
||||
print $langs->trans("Project").' : ';
|
||||
if ($commande->projet_id > 0)
|
||||
{
|
||||
$projet = New Project($db);
|
||||
$projet->fetch($commande->projet_id);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$commande->projet_id.'">'.$projet->title.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="fiche.php?id='.$id.'&action=classer">Classer la commande</a>';
|
||||
}
|
||||
}
|
||||
print " </td></tr>";
|
||||
|
||||
// Ligne de 3 colonnes
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
|
||||
print '<td>'.$conf->monnaie.'</td>';
|
||||
print '<td rowspan="4" valign="top">'.$langs->trans("Note").' :<br>'.nl2br($commande->note).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td><td align="right">';
|
||||
print $commande->remise_percent.' %</td><td> ';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
|
||||
print '<td>'.$conf->monnaie.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||
print '<td>'.$conf->monnaie.'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Lignes de commandes
|
||||
*
|
||||
*/
|
||||
echo '<br><table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l WHERE l.fk_commande =".$commande->id." ORDER BY l.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="54%">'.$langs->trans("Description").'</td>';
|
||||
print '<td width="8%" align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td width="8%" align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td width="8%" align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td width="12%" align="right">'.$langs->trans("PriceU").'</td>';
|
||||
print '<td width="10%"> </td><td width="10%"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
print "<tr $bc[$var]>";
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.stripslashes(nl2br($objp->description)).'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
||||
}
|
||||
print '<td align="center">'.$objp->tva_tx.' %</td>';
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
|
||||
print '<td> </td><td> </td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
|
||||
$i++;
|
||||
$var=!$var;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
* Documents générés
|
||||
*
|
||||
*/
|
||||
$file = $conf->facture->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
|
||||
$relativepath = $commande->ref."/".$commande->ref.".pdf";
|
||||
|
||||
$var=true;
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
||||
print_titre("Documents");
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
print '</td><td valign="top" width="50%">';
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "</td></tr></table>";
|
||||
}
|
||||
|
||||
/*
|
||||
* Factures associees
|
||||
*/
|
||||
$sql = "SELECT f.facnumber, f.total,".$db->pdate("f.datef")." as df, f.rowid as facid, f.fk_user_author, f.paye";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."co_fa as fp WHERE fp.fk_facture = f.rowid AND fp.fk_commande = ".$commande->id;
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num_fac_asso = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
|
||||
if ($num_fac_asso > 0)
|
||||
{
|
||||
print "<br>";
|
||||
if ($num_fac_asso > 1)
|
||||
{
|
||||
print_titre("Factures associées");
|
||||
}
|
||||
else
|
||||
{
|
||||
print_titre("Facture associée");
|
||||
}
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Author").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num_fac_asso)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr bgcolor=\"#E0E0E0\">";
|
||||
print "<td><a href=\"../compta/facture.php?facid=$objp->facid\">$objp->facnumber</a>";
|
||||
if ($objp->paye)
|
||||
{
|
||||
print " (<b>payée</b>)";
|
||||
}
|
||||
print "</td>\n";
|
||||
print "<td>".strftime("%d %B %Y",$objp->df)."</td>\n";
|
||||
if ($objp->fk_user_author <> $user->id)
|
||||
{
|
||||
$fuser = new User($db, $objp->fk_user_author);
|
||||
$fuser->fetch();
|
||||
print "<td>".$fuser->fullname."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".$user->fullname."</td>\n";
|
||||
}
|
||||
print '<td align="right">'.price($objp->total).'</td>';
|
||||
print "</tr>";
|
||||
$total = $total + $objp->total;
|
||||
$i++;
|
||||
}
|
||||
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("TotalHT").": <b>$total</b> ".$conf->monnaie."</td></tr>\n";
|
||||
print "</table>";
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print '<br></div>';
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
if (! $user->societe_id && ! $commande->facturee)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&commandeid='.$commande->id.'&socidp='.$commande->soc_id.'">'.$langs->trans("GenerateBill").'</a>';
|
||||
}
|
||||
|
||||
if ($num_fac_asso)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/commande.php?action=facturee&id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Commande non trouvée */
|
||||
print "Commande inexistante ou accés refusé";
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -1,177 +0,0 @@
|
||||
<?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/commande/liste.php
|
||||
\ingroup commande
|
||||
\brief Page liste des commandes
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once('../commande/commande.class.php');
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
$user->getrights('commande');
|
||||
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","&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","","&socidp=$socidp",'width="15%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Company"),"listecommande.php","s.nom","","&socidp=$socidp",'width="30%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Date"),"listecommande.php","c.date_commande","","&socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"listecommande.php","c.fk_statut","","&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> > 15 jours</b></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td> </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&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ère modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user