Gestion des notes

This commit is contained in:
Rodolphe Quiedeville 2005-04-04 15:03:32 +00:00
parent f085dfaa77
commit 490aab2bfa

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -26,6 +26,7 @@
\ingroup commande \ingroup commande
\brief Fiche commande \brief Fiche commande
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -34,14 +35,12 @@ $langs->load("orders");
$langs->load("suppliers"); $langs->load("suppliers");
$langs->load("companies"); $langs->load("companies");
$user->getrights('fournisseur'); $user->getrights('fournisseur');
if (!$user->rights->fournisseur->commande->lire) if (!$user->rights->fournisseur->commande->lire) accessforbidden();
accessforbidden();
require_once "../../project.class.php"; require_once DOL_DOCUMENT_ROOT."/project.class.php";
require_once "../../propal.class.php"; require_once DOL_DOCUMENT_ROOT."/propal.class.php";
require_once DOL_DOCUMENT_ROOT."/fournisseur.class.php"; require_once DOL_DOCUMENT_ROOT."/fournisseur.class.php";
/* /*
@ -61,6 +60,15 @@ if ($_POST["action"] == 'classin')
$commande->fetch($_GET["id"]); $commande->fetch($_GET["id"]);
$commande->classin($_POST["projetid"]); $commande->classin($_POST["projetid"]);
} }
/*
*
*/
if ($_GET["action"] == 'pdf')
{
$commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]);
$commande->generate_pdf();
}
/* /*
* *
@ -167,18 +175,11 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes && $user->r
$commande->id = $_GET["id"]; $commande->id = $_GET["id"];
$commande->delete(); $commande->delete();
Header("Location: index.php"); Header("Location: index.php");
} }
if ($_GET["action"] == 'pdf') /*
{ * Créé une commande
/*
* Generation de la commande
* définit dans /includes/modules/commande/modules_commande.php
*/ */
commande_pdf_create($db, $_GET["id"]);
}
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
{ {
@ -194,22 +195,18 @@ if ($_GET["action"] == 'create')
llxHeader('',$langs->trans("OrderCard"),"Commande"); llxHeader('',$langs->trans("OrderCard"),"Commande");
$html = new Form($db); $html = new Form($db);
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
$id = $_GET["id"]; if ($_GET["id"] > 0)
if ($id > 0)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
if ( $commande->fetch($id) == 0) if ( $commande->fetch($_GET["id"]) == 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->soc_id); $soc->fetch($commande->soc_id);
@ -223,6 +220,9 @@ if ($id > 0)
$a = $h; $a = $h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Note");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id;
$head[$h][1] = $langs->trans("History"); $head[$h][1] = $langs->trans("History");
@ -236,7 +236,7 @@ if ($id > 0)
*/ */
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$html->form_confirm("fiche.php?id=$id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); $html->form_confirm("fiche.php?id=$commande->id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete");
print '<br />'; print '<br />';
} }
@ -246,7 +246,7 @@ if ($id > 0)
*/ */
if ($_GET["action"] == 'valid') if ($_GET["action"] == 'valid')
{ {
$html->form_confirm("fiche.php?id=$id","Valider la commande","Etes-vous sûr de vouloir valider cette commande ?","confirm_valid"); $html->form_confirm("fiche.php?id=$commande->id","Valider la commande","Etes-vous sûr de vouloir valider cette commande ?","confirm_valid");
print '<br />'; print '<br />';
} }
/* /*
@ -255,7 +255,7 @@ if ($id > 0)
*/ */
if ($_GET["action"] == 'approve') if ($_GET["action"] == 'approve')
{ {
$html->form_confirm("fiche.php?id=$id","Approuver la commande","Etes-vous sûr de vouloir approuver cette commande ?","confirm_approve"); $html->form_confirm("fiche.php?id=$commande->id","Approuver la commande","Etes-vous sûr de vouloir approuver cette commande ?","confirm_approve");
print '<br />'; print '<br />';
} }
/* /*
@ -264,7 +264,7 @@ if ($id > 0)
*/ */
if ($_GET["action"] == 'refuse') if ($_GET["action"] == 'refuse')
{ {
$html->form_confirm("fiche.php?id=$id","Refuser la commande","Etes-vous sûr de vouloir refuser cette commande ?","confirm_refuse"); $html->form_confirm("fiche.php?id=$commande->id","Refuser la commande","Etes-vous sûr de vouloir refuser cette commande ?","confirm_refuse");
print '<br />'; print '<br />';
} }
/* /*
@ -273,7 +273,7 @@ if ($id > 0)
*/ */
if ($_GET["action"] == 'annuler') if ($_GET["action"] == 'annuler')
{ {
$html->form_confirm("fiche.php?id=$id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel");
print '<br />'; print '<br />';
} }
/* /*
@ -295,7 +295,7 @@ if ($id > 0)
print '<td colspan="2">'; print '<td colspan="2">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>'; print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
print '<td width="50%">'; print '<td width="50%" colspan="3">';
print '<img src="statut'.$commande->statut.'.png">&nbsp;'; print '<img src="statut'.$commande->statut.'.png">&nbsp;';
print $commande->statuts[$commande->statut]; print $commande->statuts[$commande->statut];
print "</td></tr>"; print "</td></tr>";
@ -308,31 +308,29 @@ if ($id > 0)
print strftime("%A %d %B %Y",$commande->date_commande)."\n"; print strftime("%A %d %B %Y",$commande->date_commande)."\n";
} }
print '&nbsp;</td><td width="50%">'; print '&nbsp;</td><td width="50%" colspan="3">';
if ($commande->methode_commande) if ($commande->methode_commande)
{ {
print "Méthode : " .$commande->methode_commande; print "Méthode : " .$commande->methode_commande;
} }
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>'; print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
print '<td>'; print '<td colspan="3">';
print "&nbsp;</td></tr>"; print "&nbsp;</td></tr>";
// Ligne de 3 colonnes // Ligne de 3 colonnes
print '<tr><td>'.$langs->trans("AmountHT").'</td>'; print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>'; print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
print '<td>'.$conf->monnaie.'</td>'; print '<td>'.$conf->monnaie.'</td>';
print '<td rowspan="4" valign="top">'.$langs->trans("Note").' :</td></tr>'; print '<td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
print '<td>'.$conf->monnaie.'</td></tr>'; print '<td>'.$conf->monnaie.'</td></tr>';
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>'; print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
print '<td>'.$conf->monnaie.'</td></tr>'; print '<td>'.$conf->monnaie.'</td><td colspan="3">&nbsp;</td></tr>';
if ($commande->note) if ($commande->note)
{ {
print '<tr><td colspan="3">Note : '.nl2br($commande->note)."</td></tr>"; print '<tr><td>Note</td><td colspan="5">'.nl2br($commande->note)."</td></tr>";
} }
print "</table>"; print "</table>";
@ -345,7 +343,7 @@ if ($id > 0)
$sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l "; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l ";
$sql .= " WHERE l.fk_commande = $id ORDER BY l.rowid"; $sql .= " WHERE l.fk_commande = $commande->id ORDER BY l.rowid";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -393,11 +391,11 @@ if ($id > 0)
print '<td align="right">'.price($objp->subprice)."</td>\n"; print '<td align="right">'.price($objp->subprice)."</td>\n";
if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer) if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer)
{/* {/*
print '<td align="right"><a href="fiche.php?id='.$id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">'; print '<td align="right"><a href="fiche.php?id='.$commande->id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
*/ */
print '<td>&nbsp;</td><td align="right"><a href="fiche.php?id='.$id.'&amp;action=deleteline&amp;lineid='.$objp->rowid.'">'; print '<td>&nbsp;</td><td align="right"><a href="fiche.php?id='.$commande->id.'&amp;action=deleteline&amp;lineid='.$objp->rowid.'">';
print img_delete(); print img_delete();
print '</a></td>'; print '</a></td>';
} }
@ -409,7 +407,7 @@ if ($id > 0)
if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid)
{ {
print "<form action=\"fiche.php?id=$id\" method=\"post\">"; print "<form action=\"fiche.php?id=$commande->id\" method=\"post\">";
print '<input type="hidden" name="action" value="updateligne">'; print '<input type="hidden" name="action" value="updateligne">';
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">'; print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">';
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
@ -462,7 +460,7 @@ if ($id > 0)
print $db->error(); print $db->error();
} }
print "<form action=\"fiche.php?id=$id\" method=\"post\">"; print "<form action=\"fiche.php?id=$commande->id\" method=\"post\">";
print '<input type="hidden" name="action" value="addligne">'; print '<input type="hidden" name="action" value="addligne">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -511,7 +509,7 @@ if ($id > 0)
{ {
if ($user->rights->fournisseur->commande->valider) if ($user->rights->fournisseur->commande->valider)
{ {
print '<a class="tabAction" href="fiche.php?id='.$id.'&amp;action=valid">'.$langs->trans("Valid").'</a>'; print '<a class="tabAction" href="fiche.php?id='.$commande->id.'&amp;action=valid">'.$langs->trans("Valid").'</a>';
} }
} }
@ -519,9 +517,9 @@ if ($id > 0)
{ {
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
{ {
print '<a class="tabAction" href="fiche.php?id='.$id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>'; print '<a class="tabAction" href="fiche.php?id='.$commande->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="tabAction" href="fiche.php?id='.$id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>'; print '<a class="tabAction" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
} }
} }
@ -529,7 +527,7 @@ if ($id > 0)
{ {
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
{ {
print '<a class="tabAction" href="fiche.php?id='.$id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>'; print '<a class="tabAction" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
} }
} }
@ -537,7 +535,7 @@ if ($id > 0)
{ {
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
print '<a class="butDelete" href="fiche.php?id='.$id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butDelete" href="fiche.php?id='.$commande->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
} }
} }
@ -695,7 +693,7 @@ if ($id > 0)
else else
{ {
/* Commande non trouvée */ /* Commande non trouvée */
print "Commande inexistante ou accés refusé"; print "Commande inexistante";
} }
} }