';
-
- /*
- * 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 '| '.$langs->trans("Ref").' | ';
+ print ''.$commande->ref.' | ';
+ print ' ';
+
+ // Fournisseur
+ print '| '.$langs->trans("Supplier")." | ";
+ print '';
+ print '';
+ print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.' | ';
+ print ' ';
+
+ // Statut
+ print '';
+ print '| '.$langs->trans("Status").' | ';
+ print '';
+ print $commande->getLibStatut(4);
+ print " | ";
+
+ if ($commande->methode_commande_id > 0)
+ {
+ print '| '.$langs->trans("Date").' | ';
+
+ if ($commande->date_commande)
{
- print_titre($langs->trans('Documents'));
- print '';
- print '| '.$langs->trans('Order').' PDF | ';
- print ''.$commande->ref.'.pdf | ';
- print ''.filesize($file). ' bytes | ';
- print ''.strftime('%d %b %Y %H:%M:%S',filemtime($file)).' | ';
- print ' ';
- print ' ';
- 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 " | ";
+ }
+
+ // Auteur
+ print '| '.$langs->trans("Author").' | '.$author->fullname.' | ';
+ print '';
+ print " | ";
+
+ // Ligne de 3 colonnes
+ print '| '.$langs->trans("AmountHT").' | ';
+ print ''.price($commande->total_ht).' | ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' | | ';
+ print '| '.$langs->trans("AmountVAT").' | '.price($commande->total_tva).' | ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' | | ';
+
+ print '| '.$langs->trans("AmountTTC").' | '.price($commande->total_ttc).' | ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' | | ';
+
+ print " ";
+
+ 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 '| '.$langs->trans("Ref").' | ';
+ print ''.$langs->trans("Description").' | ';
+ print ''.$langs->trans("VAT").' | ';
+ print ''.$langs->trans("Qty").' | ';
+ print ''.$langs->trans("Discount").' | ';
+ print ''.$langs->trans("PriceU").' | ';
+ print ' | | ';
+ print " \n";
+ }
+ $var=false;
+ while ($i < $num_lignes)
+ {
+ $objp = $db->fetch_object($resql);
+ print "";
+ print '| '.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.' | ';
+ if ($objp->fk_product > 0)
+ {
+ print '';
+ print ''.stripslashes(nl2br($objp->description)).' | ';
+ }
+ else
+ {
+ print "".stripslashes(nl2br($objp->description))." | \n";
+ }
+ print ''.$objp->tva_tx.'% | ';
+ print ''.$objp->qty.' | ';
+ if ($objp->remise_percent > 0)
+ {
+ print ''.$objp->remise_percent."% | \n";
+ }
+ else
+ {
+ print ' | ';
+ }
+ print ''.price($objp->subprice)." | \n";
+ if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && $_GET["action"] <> 'valid')
+ {
+ print ' | ';
+ print img_delete();
+ print ' | ';
+ }
+ else
+ {
+ print ' | | ';
+ }
+ print " ";
+
+ if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid)
+ {
+ 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 '';
+
+ /**
+ * Boutons actions
+ */
+ if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc'))
+ {
+ 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 '| '.$langs->trans('Order').' PDF | ';
+ print ''.$commande->ref.'.pdf | ';
+ print ''.filesize($file). ' bytes | ';
+ print ''.strftime('%d %b %Y %H:%M:%S',filemtime($file)).' | ';
+ print ' ';
+ print ' ';
+ 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 '';
+ }
+
+ /*
+ *
+ *
+ */
+ 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 '';
+ }
+
+ /*
+ *
+ *
+ */
+ if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 ))
+ {
+ /**
+ * Réceptionner
+ */
+ $form = new Form($db);
+
+ print ' ';
+ print '\n";
+ }
+ print ' | ';
}
-
- /*
- *
- *
- */
- if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
+ else
{
- /**
- * Commander
- */
- $form = new Form($db);
-
- print ' ';
- 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 '\n";
- }
- print ' |