diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 4b104665fb7..122c64eecf2 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -256,453 +256,463 @@ $html = new Form($db); if ($_GET["id"] > 0) { - if ($mesg) print $mesg; - $commande = new CommandeFournisseur($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(); - - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $a = $h; - $h++; + // if ($mesg) print $mesg; + $commande = new CommandeFournisseur($db); - $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][1] = $langs->trans("OrderFollow"); - $h++; - - $title=$langs->trans("Order").": $commande->ref"; - dolibarr_fiche_head($head, $a, $title); - - /* - * Confirmation de la suppression de la commande - * - */ - if ($_GET["action"] == 'delete') + if ( $commande->fetch($_GET["id"]) == 0) { - $html->form_confirm("fiche.php?id=$commande->id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); - print '
'; - } - - /* - * Confirmation de la validation - * - */ - if ($_GET["action"] == 'valid') - { - $html->form_confirm("fiche.php?id=$commande->id","Valider la commande","Etes-vous sûr de vouloir valider cette commande ?","confirm_valid"); - print '
'; - } - /* - * Confirmation de l'approbation - * - */ - if ($_GET["action"] == 'approve') - { - $html->form_confirm("fiche.php?id=$commande->id","Approuver la commande","Etes-vous sûr de vouloir approuver cette commande ?","confirm_approve"); - print '
'; - } - /* - * Confirmation de l'approbation - * - */ - if ($_GET["action"] == 'refuse') - { - $html->form_confirm("fiche.php?id=$commande->id","Refuser la commande","Etes-vous sûr de vouloir refuser cette commande ?","confirm_refuse"); - print '
'; - } - /* - * Confirmation de l'annulation - * - */ - if ($_GET["action"] == 'cancel') - { - $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); - print '
'; - } - - /* - * Confirmation de l'envoi de la commande - * - */ - if ($_GET["action"] == 'commande') - { - $date_com = mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); - $html->form_confirm("fiche.php?id=".$commande->id."&datecommande=".$date_com."&methode=".$_POST["methodecommande"], - "Envoi de la commande","Etes-vous sûr de vouloir confirmer cette commande en date du ".strftime("%d/%m/%Y",$date_com)." ?","confirm_commande"); - print '
'; - } + $soc = new Societe($db); + $soc->fetch($commande->soc_id); + $author = new User($db); + $author->id = $commande->user_author_id; + $author->fetch(); - /* - * Commande - */ - print ''; - print '"; - print ''; - print ''; - - print ''; - print ''; - print '"; - - if ($commande->methode_commande_id > 0) - { - print '"; - } - - // Auteur - print ''; - print '"; + $h = 0; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderCard"); + $a = $h; + $h++; - // Ligne de 3 colonnes - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - - print "
'.$langs->trans("Supplier")."'; - print ''; - print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; - print ' '; - print $commande->statuts[$commande->statut]; - print "
'.$langs->trans("Date").''; - - if ($commande->date_commande) - { - print dolibarr_print_date($commande->date_commande,"%A %d %B %Y")."\n"; - } - - print ''; - if ($commande->methode_commande) - { - print "Méthode : " .$commande->methode_commande; - } - print "
'.$langs->trans("Author").''.$author->fullname.''; - print " 
'.$langs->trans("AmountHT").''.price($commande->total_ht).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountVAT").''.price($commande->total_tva).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountTTC").''.price($commande->total_ttc).''.$langs->trans("Currency".$conf->monnaie).' 
"; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Note"); + $h++; - if ($mesg) print $mesg; - else print '
'; - - /* - * Lignes de commandes - */ - print ''; - - $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.= " WHERE l.fk_commande = $commande->id"; - $sql.= " ORDER BY l.rowid"; - - $resql = $db->query($sql); - if ($resql) - { - $num_lignes = $db->num_rows($resql); - $i = 0; $total = 0; - - if ($num_lignes) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - $var=false; - while ($i < $num_lignes) - { - $objp = $db->fetch_object($resql); - print ""; - print ''; - if ($objp->fk_product > 0) - { - print ''; - } - else - { - print "\n"; - } - print ''; - print ''; - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } - print '\n"; - if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && $_GET["action"] <> 'valid') - { - print ''; - } - else - { - print ''; - } - print ""; - - if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) - { - print "id\" method=\"post\">"; - print ''; - print ''; - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print '' . "\n"; - print "\n"; - } - $i++; - $var=!$var; - } - $db->free(); - } - else - { - print $db->error(); - } - - /* - * Ajouter une ligne - */ - if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) - { - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - - $var=false; - print "".''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ""; - } - - print "
'.$langs->trans("Ref").''.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; - print ''.stripslashes(nl2br($objp->description)).'".stripslashes(nl2br($objp->description))."'.$objp->tva_tx.'%'.$objp->qty.''.$objp->remise_percent."% '.price($objp->subprice)." '; - print img_delete(); - print '  
 %
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'; - $html->select_produits_fournisseurs($commande->fourn_id,'','p_idprod',$filtre); - print '% 
"; - print ''; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderFollow"); + $h++; - /** - * Boutons actions - */ - if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) - { - print '
'; - - if ($commande->statut == 0 && $num_lignes > 0) - { - if ($user->rights->fournisseur->commande->valider) - { - print ''.$langs->trans("Valid").''; - } - } - - if ($commande->statut == 1) - { - if ($user->rights->fournisseur->commande->annuler) - { - print ''.$langs->trans("CancelOrder").''; - } - - if ($user->rights->fournisseur->commande->approuver) - { - print ''.$langs->trans("ApproveOrder").''; - - print ''.$langs->trans("RefuseOrder").''; - } - } - - if ($commande->statut == 2) - { - if ($user->rights->fournisseur->commande->approuver) - { - print ''.$langs->trans("RefuseOrder").''; - } - } - - if ($commande->statut == 0) - { - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("Delete").''; - } - } - // Build PDF - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("BuildPDF").''; - } - - print "
"; - } + $title=$langs->trans("SupplierOrder"); + dolibarr_fiche_head($head, $a, $title); + /* + * Confirmation de la suppression de la commande + * + */ + if ($_GET["action"] == 'delete') + { + $html->form_confirm("fiche.php?id=$commande->id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); + print '
'; + } + /* + * Confirmation de la validation + * + */ + if ($_GET["action"] == 'valid') + { + $html->form_confirm("fiche.php?id=$commande->id","Valider la commande","Etes-vous sûr de vouloir valider cette commande ?","confirm_valid"); + print '
'; + } + /* + * Confirmation de l'approbation + * + */ + if ($_GET["action"] == 'approve') + { + $html->form_confirm("fiche.php?id=$commande->id","Approuver la commande","Etes-vous sûr de vouloir approuver cette commande ?","confirm_approve"); + print '
'; + } + /* + * Confirmation de l'approbation + * + */ + if ($_GET["action"] == 'refuse') + { + $html->form_confirm("fiche.php?id=$commande->id","Refuser la commande","Etes-vous sûr de vouloir refuser cette commande ?","confirm_refuse"); + print '
'; + } + /* + * Confirmation de l'annulation + * + */ + if ($_GET["action"] == 'cancel') + { + $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); + print '
'; + } - print '
'; - - /* - * Documents générés - * - */ - $comfournref = sanitize_string($commande->ref); - $comfournref = str_replace("(","",$comfournref); - $comfournref = str_replace(")","",$comfournref); - $file = $conf->fournisseur->commande->dir_output . '/' . $comfournref . '/' . $comfournref . '.pdf'; - $relativepath = $comfournref.'/'.$comfournref.'.pdf'; - $filedir = $conf->fournisseur->commande->dir_output . '/' . $comfournref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; - $genallowed=$user->rights->fournisseur->commande->creer; - $delallowed=$user->rights->fournisseur->commande->supprimer; + /* + * Confirmation de l'envoi de la commande + * + */ + if ($_GET["action"] == 'commande') + { + $date_com = mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); + $html->form_confirm("fiche.php?id=".$commande->id."&datecommande=".$date_com."&methode=".$_POST["methodecommande"], + "Envoi de la commande","Etes-vous sûr de vouloir confirmer cette commande en date du ".strftime("%d/%m/%Y",$date_com)." ?","confirm_commande"); + print '
'; + } - $var=true; - /* - if (file_exists($file)) + /* + * Commande + */ + print ''; + + // Ref + print ''; + print ''; + print ''; + + // Fournisseur + print '"; + print ''; + print ''; + + // Statut + print ''; + print ''; + print '"; + + if ($commande->methode_commande_id > 0) + { + print '"; + } + + // Auteur + print ''; + print '"; + + // Ligne de 3 colonnes + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + + print "
'.$langs->trans("Ref").''.$commande->ref.'
'.$langs->trans("Supplier")."'; + print ''; + print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; + print $commande->getLibStatut(4); + print "
'.$langs->trans("Date").''; + + if ($commande->date_commande) { - print_titre($langs->trans('Documents')); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans('Order').' PDF'.$commande->ref.'.pdf'.filesize($file). ' bytes'.strftime('%d %b %Y %H:%M:%S',filemtime($file)).'
'; - print '
'; + print dolibarr_print_date($commande->date_commande,"%A %d %B %Y")."\n"; } + + print '
'; + if ($commande->methode_commande) + { + print "Méthode : " .$commande->methode_commande; + } + print "
'.$langs->trans("Author").''.$author->fullname.''; + print " 
'.$langs->trans("AmountHT").''.price($commande->total_ht).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountVAT").''.price($commande->total_tva).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountTTC").''.price($commande->total_ttc).''.$langs->trans("Currency".$conf->monnaie).' 
"; + + if ($mesg) print $mesg; + else print '
'; + + /* + * Lignes de commandes + */ + print ''; + + $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.= " WHERE l.fk_commande = $commande->id"; + $sql.= " ORDER BY l.rowid"; + + $resql = $db->query($sql); + if ($resql) + { + $num_lignes = $db->num_rows($resql); + $i = 0; $total = 0; + + if ($num_lignes) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=false; + while ($i < $num_lignes) + { + $objp = $db->fetch_object($resql); + print ""; + print ''; + if ($objp->fk_product > 0) + { + print ''; + } + else + { + print "\n"; + } + print ''; + print ''; + if ($objp->remise_percent > 0) + { + print '\n"; + } + else + { + print ''; + } + print '\n"; + if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && $_GET["action"] <> 'valid') + { + print ''; + } + else + { + print ''; + } + print ""; + + if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) + { + print "id\" method=\"post\">"; + print ''; + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print '' . "\n"; + print "\n"; + } + $i++; + $var=!$var; + } + $db->free(); + } + else + { + print $db->error(); + } + + /* + * Ajouter une ligne + */ + if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) + { + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''."\n"; + + $var=false; + print "".''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + print ""; + } + + print "
'.$langs->trans("Ref").''.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; + print ''.stripslashes(nl2br($objp->description)).'".stripslashes(nl2br($objp->description))."'.$objp->tva_tx.'%'.$objp->qty.''.$objp->remise_percent."% '.price($objp->subprice)." '; + print img_delete(); + print '  
 %
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'; + $html->select_produits_fournisseurs($commande->fourn_id,'','p_idprod',$filtre); + print '% 
"; + print ''; + + /** + * Boutons actions + */ + if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) + { + print '
'; + + if ($commande->statut == 0 && $num_lignes > 0) + { + if ($user->rights->fournisseur->commande->valider) + { + print ''.$langs->trans("Valid").''; + } + } + + if ($commande->statut == 1) + { + if ($user->rights->fournisseur->commande->approuver) + { + print ''.$langs->trans("ApproveOrder").''; + + print ''.$langs->trans("RefuseOrder").''; + } + + if ($user->rights->fournisseur->commande->annuler) + { + print ''.$langs->trans("CancelOrder").''; + } + } + + if ($commande->statut == 2) + { + if ($user->rights->fournisseur->commande->approuver) + { + print ''.$langs->trans("RefuseOrder").''; + } + } + + if ($commande->statut == 0) + { + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("Delete").''; + } + } + + // Build PDF + if ($commande->statut > 0) + { + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("BuildPDF").''; + } + } + print "
"; + } + + + + print ''; + print ''; + print ''; + print '
'; + + /* + * Documents générés + * + */ + $comfournref = sanitize_string($commande->ref); + $comfournref = str_replace("(","",$comfournref); + $comfournref = str_replace(")","",$comfournref); + $file = $conf->fournisseur->commande->dir_output . '/' . $comfournref . '/' . $comfournref . '.pdf'; + $relativepath = $comfournref.'/'.$comfournref.'.pdf'; + $filedir = $conf->fournisseur->commande->dir_output . '/' . $comfournref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; + $genallowed=$user->rights->fournisseur->commande->creer; + $delallowed=$user->rights->fournisseur->commande->supprimer; + + $var=true; + /* + if (file_exists($file)) + { + print_titre($langs->trans('Documents')); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Order').' PDF'.$commande->ref.'.pdf'.filesize($file). ' bytes'.strftime('%d %b %Y %H:%M:%S',filemtime($file)).'
'; + print '
'; + } + */ + //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); + $html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf); + + + print '
'; + + /* + * + * + */ + if ($_GET["action"] == 'classer') + { + print '
'; + print ''; + print ''; + print '"; + print '
Projet'; + + $proj = new Project($db); + $html->select_array("projetid",$proj->liste_array($commande->soc_id)); + + print "
'; + } + + /* + * + * + */ + if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2) + { + /** + * Commander */ - //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); - $html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); - + $form = new Form($db); - print '
'; + print '
'; + print '
'; + print ''; + print ''; + print ''; - /* - * - * - */ - if ($_GET["action"] == 'classer') - { - print ''; - print ''; - print '
Commander
Date commande'; + print $form->select_date('','','','','',"commande"); + print '
'; - print '"; - print '
Projet'; - - $proj = new Project($db); - $html->select_array("projetid",$proj->liste_array($commande->soc_id)); - - print "
'; + $commande->get_methodes_commande(); + + print '
Méthode de commande'; + + print $form->select_array("methodecommande",$commande->methodes_commande); + + print '
Commentaire
'; + print ''; + } + + /* + * + * + */ + if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 )) + { + /** + * Réceptionner + */ + $form = new Form($db); + + print '
'; + print '
'; + print ''; + print ''; + print ''; + print '\n"; + + print "'; + print ''; + print ''; + print "
Réceptionner
Date de livraison'; + print $form->select_date('','','','','',"commande"); + print "
Livraison\n"; + $liv = array(); + $liv['par'] = "Partielle"; + $liv['tot'] = "Totale"; + + print $form->select_array("type",$liv); + + print '
Commentaire
\n"; + print "
\n"; + } + print '
'; } - - /* - * - * - */ - if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2) + else { - /** - * Commander - */ - $form = new Form($db); - - print '
'; - print '
'; - print ''; - print ''; - print ''; - - $commande->get_methodes_commande(); - - print ''; - print ''; - print ''; - print '
Commander
Date commande'; - print $form->select_date('','','','','',"commande"); - print '
Méthode de commande'; - - print $form->select_array("methodecommande",$commande->methodes_commande); - - print '
Commentaire
'; - print '
'; + /* Commande non trouvée */ + print "Commande inexistante"; } - - /* - * - * - */ - if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 )) - { - /** - * Réceptionner - */ - $form = new Form($db); - - print '
'; - print '
'; - print ''; - print ''; - print ''; - print '\n"; - - print "'; - print ''; - print ''; - print "
Réceptionner
Date de livraison'; - print $form->select_date('','','','','',"commande"); - print "
Livraison\n"; - $liv = array(); - $liv['par'] = "Partielle"; - $liv['tot'] = "Totale"; - - print $form->select_array("type",$liv); - - print '
Commentaire
\n"; - print "
\n"; - } - print ''; - } - else - { - /* Commande non trouvée */ - print "Commande inexistante"; - } -} +} $db->close(); diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index 0da82a6c157..e2a4aa0b063 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -46,124 +46,132 @@ if (!$user->rights->fournisseur->commande->lire) accessforbidden(); if ($_GET["id"] > 0) { - $soc = new Societe($db); - $commande = new CommandeFournisseur($db); + $soc = new Societe($db); + $commande = new CommandeFournisseur($db); - if ( $commande->fetch($_GET["id"]) == 0) - { - $soc->fetch($commande->soc_id); + if ( $commande->fetch($_GET["id"]) == 0) + { + $soc->fetch($commande->soc_id); - $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; - $addons[0][1] = $soc->nom; + $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; + $addons[0][1] = $soc->nom; - llxHeader('',$langs->trans("History"),"CommandeFournisseur",$addons); + llxHeader('',$langs->trans("History"),"CommandeFournisseur",$addons); - $author = new User($db); - $author->id = $commande->user_author_id; - $author->fetch(); - - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; + $author = new User($db); + $author->id = $commande->user_author_id; + $author->fetch(); - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Note"); - $h++; + $h = 0; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderCard"); + $h++; - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderFollow"); - $a = $h; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Note"); + $h++; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderFollow"); + $a = $h; - $title=$langs->trans("Order").": $commande->ref"; - dolibarr_fiche_head($head, $a, $title); + $h++; - - /* - * Commande - */ + $title=$langs->trans("SupplierOrder"); + dolibarr_fiche_head($head, $a, $title); - print ''; - print '"; - print ''; - print ''; - - print '"; - if ($commande->methode_commande_id > 0) - { - print ''; - print '\n"; - print '"; + /* + * Commande + */ + + print '
'.$langs->trans("Supplier")."'; - print ''.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; - print ' '; - print $commande->statuts[$commande->statut]; - print "
'.$langs->trans("Date").''.dolibarr_print_date($commande->date_commande,"%A %d %B %Y")." '; - print "
'; + + // Ref + print ''; + print ''; + print ''; + + // Fournisseur + print '"; + print ''; + print ''; + + print '"; + + if ($commande->methode_commande_id > 0) + { + print ''; + print '\n"; + print '"; + } + + print "
'.$langs->trans("Ref").''.$commande->ref.'
'.$langs->trans("Supplier")."'; + print ''.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; + print $commande->getLibStatut(4); + print "
'.$langs->trans("Date").''.dolibarr_print_date($commande->date_commande,"%A %d %B %Y")." '; + print "
\n"; + print "
"; + + /* + * Suivi historique + * Date - Statut - Auteur + */ + print ''; + + print ''; + print ''; + print ''; + print ''; + + $sql = "SELECT l.fk_statut, ".$db->pdate("l.datelog") ."as dl, u.rowid, u.code, u.firstname, u.name"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l "; + $sql .= " , ".MAIN_DB_PREFIX."user as u "; + $sql .= " WHERE l.fk_commande = ".$commande->id." AND u.rowid = l.fk_user"; + $sql .= " ORDER BY l.rowid DESC"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + $var=True; + while ($i < $num) + { + $var=!$var; + + $obj = $db->fetch_object($resql); + print ""; + + print '\n"; + + // Statut + print '\n"; + + // User + print ''; + + print ''; + + $i++; + } + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } + print "
'.$langs->trans("Date").''.$langs->trans("Status").''.$langs->trans("Author").'
'.dolibarr_print_date($obj->dl,"%a %d %b %Y %H:%M:%S")."'.$commande->LibStatut($obj->fk_statut,4)."'; + print img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'
"; + + print ''; + } + else + { + /* Commande non trouvée */ + print "Commande inexistante ou accés refusé"; } - - print "\n"; - print "
"; - - /* - * Suivi historique - * Date - Statut - Auteur - */ - print ''; - - print ''; - print ''; - print ''; - - $sql = "SELECT l.fk_statut, ".$db->pdate("l.datelog") ."as dl, u.rowid, u.code, u.firstname, u.name"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l "; - $sql .= " , ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE l.fk_commande = ".$commande->id." AND u.rowid = l.fk_user"; - $sql .= " ORDER BY l.rowid DESC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) - { - $var=!$var; - - $obj = $db->fetch_object($resql); - print ""; - - print '\n"; - - print '\n"; - - print ''; - print ''; - - $i++; - } - $db->free($resql); - } - else - { - dolibarr_print_error($db); - } - print "
'.$langs->trans("Date").''.$langs->trans("Status").''.$langs->trans("Author").'
'.dolibarr_print_date($obj->dl,"%a %d %b %Y %H:%M:%S")." '; - - print $commande->statuts[$obj->fk_statut]."'; - print img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'
"; - - print ''; - } - else - { - /* Commande non trouvée */ - print "Commande inexistante ou accés refusé"; - } } $db->close(); diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index af09307ce97..ed1a96df2fc 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -69,87 +69,93 @@ $html = new Form($db); if ($_GET["id"] > 0) { - $commande = new CommandeFournisseur($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(); - - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Note"); - $a = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderFollow"); - $h++; - - $title=$langs->trans("Order").": $commande->ref"; - dolibarr_fiche_head($head, $a, $title); - - - /* - * Commande - */ - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print '"; - - if ($commande->methode_commande_id > 0) + $commande = new CommandeFournisseur($db); + if ( $commande->fetch($_GET["id"]) == 0) { - print ''; - print '"; - } - + $soc = new Societe($db); + $soc->fetch($commande->soc_id); + $author = new User($db); + $author->id = $commande->user_author_id; + $author->fetch(); + + $h = 0; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderCard"); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Note"); + $a = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderFollow"); + $h++; + + $title=$langs->trans("SupplierOrder"); + dolibarr_fiche_head($head, $a, $title); + + + /* + * Commande + */ + print ''; + print ''; + + print '
'.$langs->trans("Supplier").''; - print ''.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; - print ' '; - print $commande->statuts[$commande->statut]; - print "
'.$langs->trans("Date").''; - - if ($commande->date_commande) - { - print strftime("%A %d %B %Y",$commande->date_commande)."\n"; - } - - print ' '; - if ($commande->methode_commande) - { - print "Méthode : " .$commande->methode_commande; - } - print "
'; + + // Ref + print ''; + print ''; + print ''; + + // Fournisseur + print ''; + print ''; + print ''; + + print ''; + print ''; + print '"; + + if ($commande->methode_commande_id > 0) + { + print ''; + print '"; + } + // Auteur - print ''; + print ''; print '"; - + // Ligne de 3 colonnes print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - - + + print ''; print '
'.$langs->trans("Ref").''.$commande->ref.'
'.$langs->trans("Supplier").''; + print ''.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'
'.$langs->trans("Status").''; + print $commande->getLibStatut(4); + print "
'.$langs->trans("Date").''; + + if ($commande->date_commande) + { + print strftime("%A %d %B %Y",$commande->date_commande)."\n"; + } + + print ' '; + if ($commande->methode_commande) + { + print "Méthode : " .$commande->methode_commande; + } + print "
'.$langs->trans("Author").''.$author->fullname.'
'.$langs->trans("Author").''.$author->fullname.''; print " 
'.$langs->trans("AmountHT").''.price($commande->total_ht).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountVAT").''.price($commande->total_tva).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("AmountTTC").''.price($commande->total_ttc).''.$langs->trans("Currency".$conf->monnaie).' 
'.$langs->trans("NotePrivate").''; if ($user->rights->fournisseur->commande->creer) print '