* Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2007 Régis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Auguria SARL * * 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/product/fiche.php * \ingroup product * \brief Page de la fiche produit * \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); $langs->load("bills"); $langs->load("other"); $mesg = ''; if (!$user->rights->produit->lire) accessforbidden(); /* * */ if ($_GET["action"] == 'fastappro') { $product = new Product($db); $product->fetch($_GET["id"]); $result = $product->fastappro($user); Header("Location: fiche.php?id=".$_GET["id"]); exit; } // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { if ($_POST["canvas"] <> '' && file_exists('canvas/product.'.$_POST["canvas"].'.class.php') ) { $class = 'Product'.ucfirst($_POST["canvas"]); include_once('canvas/product.'.$_POST["canvas"].'.class.php'); $product = new $class($db); } else { $product = new Product($db); } $product->ref = $_POST["ref"]; $product->libelle = $_POST["libelle"]; $product->price = $_POST["price"]; $product->price_base_type = $_POST["price_base_type"]; $product->tva_tx = $_POST["tva_tx"]; $product->type = $_POST["type"]; $product->status = $_POST["statut"]; $product->description = $_POST["desc"]; $product->note = $_POST["note"]; $product->duration_value = $_POST["duration_value"]; $product->duration_unit = $_POST["duration_unit"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; $product->canvas = $_POST["canvas"]; $product->new_weight = $_POST["weight"]; $product->new_weight_units = $_POST["weight_units"]; $product->new_volume = $_POST["volume"]; $product->new_volume_units = $_POST["volume_units"]; // MultiPrix if($conf->global->PRODUIT_MULTIPRICES == 1) { for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { if($_POST["price_".$i]) { $price = price2num($_POST["price_".$i]); $product->multiprices["$i"] = $price; $product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; } else { $product->multiprices["$i"] = ""; } } } if ( $value != $current_lang ) $e_product = $product; // Produit spécifique // $_POST n'est pas utilise dans la classe Product // mais dans des classes qui hérite de Product $id = $product->create($user, $_POST); if ($id > 0) { Header("Location: fiche.php?id=$id"); exit; } else { $mesg='
'.$langs->trans($product->error()).'
'; $_GET["action"] = "create"; $_GET["canvas"] = $product->canvas; $_GET["type"] = $_POST["type"]; } } // Action mise a jour d'un produit ou service if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->produit->creer) { $product = new Product($db); if ($product->fetch($_POST["id"])) { $product->ref = $_POST["ref"]; $product->libelle = $_POST["libelle"]; if ( isset( $_POST["price"] ) ) $product->price = $_POST["price"]; $product->tva_tx = $_POST["tva_tx"]; $product->description = $_POST["desc"]; $product->note = $_POST["note"]; $product->status = $_POST["statut"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; $product->stock_loc = $_POST["stock_loc"]; $product->duration_value = $_POST["duration_value"]; $product->duration_unit = $_POST["duration_unit"]; $product->canvas = $_POST["canvas"]; $product->new_weight = $_POST["weight"]; $product->new_weight_units = $_POST["weight_units"]; $product->new_volume = $_POST["volume"]; $product->new_volume_units = $_POST["volume_units"]; if ($product->check()) { if ($product->update($product->id, $user) > 0) { $_GET["action"] = ''; $_GET["id"] = $_POST["id"]; } else { $_GET["action"] = 'edit'; $_GET["id"] = $_POST["id"]; $mesg = $product->error; } } else { $_GET["action"] = 'edit'; $_GET["id"] = $_POST["id"]; $mesg = $langs->trans("ErrorProductBadRefOrLabel"); } // Produit spécifique if ($product->canvas <> '' && file_exists('canvas/product.'.$product->canvas.'.class.php') ) { $class = 'Product'.ucfirst($product->canvas); include_once('canvas/product.'.$product->canvas.'.class.php'); $product = new $class($db); if ($product->FetchCanvas($_POST["id"])) { $product->UpdateCanvas($_POST); } } } } // clone d'un produit if ($_GET["action"] == 'clone' && $user->rights->produit->creer) { $db->begin(); $product = new Product($db); $originalId = $_GET["id"]; if ($product->fetch($_GET["id"]) > 0) { $product->ref = "Clone ".$product->ref; $product->status = 0; $product->id = null; if ($product->check()) { $id = $product->create($user); if ($id > 0) { // $product->clone_fournisseurs($originalId, $id); $db->commit(); Header("Location: fiche.php?id=$id"); $db->close(); exit; } else if ($id == -3) { $db->rollback(); $_error = 1; $_GET["action"] = ""; dolibarr_print_error($product->db); } else { $db->rollback(); dolibarr_print_error($product->db); } } } else { $db->rollback(); dolibarr_print_error($product->db); } } /* * Suppression d'un produit/service pas encore affect */ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->produit->supprimer) { $product = new Product($db); $product->fetch($_GET["id"]); $result = $product->delete($_GET["id"]); if ($result == 0) { llxHeader(); print '
'.$langs->trans("ProductDeleted",$product->ref).'
'; llxFooter(); exit ; } else { $reload = 0; $_GET["action"]=''; } } /* * Ajout du produit dans une propal */ if ($_POST["action"] == 'addinpropal') { $propal = New Propal($db); $result=$propal->fetch($_POST["propalid"]); if ($result <= 0) { dolibarr_print_error($db,$propal->error); exit; } $soc = new Societe($db); $soc->fetch($propal->socid,$user); $prod = new Product($db, $_GET['id']); $result=$prod->fetch($_GET['id']); if ($result <= 0) { dolibarr_print_error($db,$prod->error); exit; } // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) { $pu = $prod->multiprices[$soc->price_level]; } else { $pu=$prod->price; } $desc = $prod->description; $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); $result = $propal->addline($propal->id, $desc, $pu, $_POST["qty"], $tva_tx, $prod->id, $_POST["remise_percent"]); if ($result > 0) { Header("Location: ../comm/propal.php?propalid=".$propal->id); return; } $mesg = $langs->trans("ErrorUnknown").": $result"; } /* * Ajout du produit dans une commande */ if ($_POST["action"] == 'addincommande') { $product = new Product($db); $result = $product->fetch($_GET["id"]); $commande = New Commande($db); $commande->fetch($_POST["commandeid"]); $soc = new Societe($db); $soc->fetch($commande->socid,$user); // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) { $pu = $product->multiprices[$soc->price_level]; } else { $pu=$product->price; } $tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx); $result = $commande->addline($commande->id, $product->description, $pu, $_POST["qty"], $tva_tx, $product->id, $_POST["remise_percent"]); Header("Location: ../commande/fiche.php?id=".$commande->id); exit; } /* * Ajout du produit dans une facture */ if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer) { $product = new Product($db); $result = $product->fetch($_GET["id"]); $facture = New Facture($db); $facture->fetch($_POST["factureid"]); $soc = new Societe($db); $soc->fetch($facture->socid,$user); // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) { $pu = $product->multiprices[$soc->price_level]; } else { $pu=$product->price; } $tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx); $facture->addline($facture->id, $product->description, $pu, $_POST["qty"], $tva_tx, $product->id, $_POST["remise_percent"]); Header("Location: ../compta/facture.php?facid=".$facture->id); exit; } if ($_POST["cancel"] == $langs->trans("Cancel")) { $action = ''; Header("Location: fiche.php?id=".$_POST["id"]); exit; } $html = new Form($db); /* * Fiche création du produit */ if ($_GET["action"] == 'create' && $user->rights->produit->creer) { if ( !isset($product) ) { if ($_GET["canvas"] <> '' && file_exists('canvas/product.'.$_GET["canvas"].'.class.php') ) { $class = 'Product'.ucfirst($_GET["canvas"]); include_once('canvas/product.'.$_GET["canvas"].'.class.php'); $product = new $class($db,0,$user); } else { $product = new Product($db); } } $product->assign_smarty_values($smarty, 'create'); if ($_error == 1) { $product = $e_product; } llxHeader("","",$langs->trans("CardProduct".$product->type)); if ($mesg) print "$mesg\n"; if ($_GET["canvas"] == '') { print '
'; print ''; print ''."\n"; if ($_GET["type"]==1) $title=$langs->trans("NewService"); else $title=$langs->trans("NewProduct"); print_fiche_titre($title); print ''; print ''; print ''; print ''; if($conf->global->PRODUIT_MULTIPRICES == 1) { print ''; print ''; for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { print ''; print ''; } } // PRIX else { print ''; print ''; } print ''; print ''; if ($_GET["type"] != 1 && $conf->stock->enabled) { print ''; } else { print ''; } // Description (utilisé dans facture, propale...) print '"; if ($_GET["type"] == 1) { print ''; } else { // Le poids et le volume ne concerne que les produits et pas les services print ''; print ''; } // Note (invisible sur facture, propales...) print '"; print ''; print '
'.$langs->trans("Ref").''; if ($_error == 1) { print $langs->trans("RefAlreadyExists"); } print '
'.$langs->trans("Label").'
'.$langs->trans("SellingPrice").' 1'; print $html->select_PriceBaseType($product->price_base_type, "price_base_type"); print '
'.$langs->trans("SellingPrice").' '.$i.''; print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i); print '
'.$langs->trans("SellingPrice").''; print $html->select_PriceBaseType($product->price_base_type, "price_base_type"); print '
'.$langs->trans("VATRate").''; print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,''); print '
'.$langs->trans("Status").''; print ''; print '
Seuil stock'; print ''; print '
'.$langs->trans("Description").''; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('desc','',160,'dolibarr_notes','',false); $doleditor->Create(); } else { print ''; } print "
'.$langs->trans("Duration").'  '; print ''.$langs->trans("Day").' '; print ''.$langs->trans("Week").' '; print ''.$langs->trans("Month").' '; print ''.$langs->trans("Year").' '; print '
'.$langs->trans("Weight").''; print ''; print $html->select_measuring_units("weight_units","weight"); print '
'.$langs->trans("volume").''; print ''; print $html->select_measuring_units("volume_units","volume"); print '
'.$langs->trans("NoteNotVisibleOnBill").''; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note','',200,'dolibarr_notes','',false); $doleditor->Create(); } else { print ''; } print "
'; print '
'; } else { //RODO // On assigne les valeurs meme en creation car elles sont definies si // on revient en erreur // $smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/'; $null = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,''); $smarty->assign('tva_taux_value', $html->tva_taux_value); $smarty->assign('tva_taux_libelle', $html->tva_taux_libelle); $smarty->display($_GET["canvas"].'-create.tpl'); } } /** * * Fiche produit * */ if ($_GET["id"] || $_GET["ref"]) { $product = new Product($db); if ($_GET["ref"]) { $result = $product->fetch('',$_GET["ref"]); $_GET["id"] = $product->id; } elseif ($_GET["id"]) { $result = $product->fetch($_GET["id"]); } // Gestion des produits specifiques if ($product->canvas <> '' && file_exists('canvas/product.'.$product->canvas.'.class.php') ) { $class = 'Product'.ucfirst($product->canvas); include_once('canvas/product.'.$product->canvas.'.class.php'); $product = new $class($db); $result = $product->FetchCanvas($_GET["id"],'',$_GET["action"]); $smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/'; $product->assign_smarty_values($smarty,$_GET["action"]); } else { $product->canvas = ''; } // END TODO RODO FINISH THIS PART llxHeader("","",$langs->trans("CardProduct".$product->type)); if ( $result ) { if ($_GET["action"] <> 'edit') { $head=product_prepare_head($product, $user); $titre=$langs->trans("CardProduct".$product->type); dolibarr_fiche_head($head, 'card', $titre); print "\n\n"; // Confirmation de la suppression de la facture if ($_GET["action"] == 'delete') { $html = new Form($db); $html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete"); print "
\n"; } print($mesg); } if ($_GET["action"] <> 'edit' && $product->canvas <> '') { /* * Smarty en mode visu */ $smarty->assign('fiche_cursor_prev',$previous_ref); $smarty->assign('fiche_cursor_next',$next_ref); // Photo //$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0); $smarty->display($product->canvas.'-view.tpl'); print "\n\n"; } if ($_GET["action"] <> 'edit' && $product->canvas == '') { /* * En mode visu */ print ''; // Reference print ''; $nblignes=6; if ($product->isproduct() && $conf->stock->enabled) $nblignes++; if ($product->isservice()) $nblignes++; if ($product->is_photo_available($conf->produit->dir_output)) { // Photo print ''; } print ''; // Libelle print ''; // MultiPrix if($conf->global->PRODUIT_MULTIPRICES == 1) { print ''; if ($product->price_base_type == 'TTC') { print ''; for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { print ''; if ($product->multiprices_base_type["$i"] == 'TTC') { print ''; } } // Prix else { print ''; } // Statut print ''; // TVA print ''; // Stock if ($product->isproduct() && $conf->stock->enabled) { print ''; if ($product->no_stock) { print "'; } // Description print ''; // Durée if ($product->isservice()) { print ''; } else { print '\n"; print '\n"; } // Note print ''; print "
'.$langs->trans("Ref").''; print $html->showrefnav($product,'ref'); print ''; $nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0); print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").' 1'.price($product->price_ttc); } else { print ''.price($product->price); } print ' '.$langs->trans($product->price_base_type); print '
'.$langs->trans("SellingPrice").' '.$i.''.price($product->multiprices_ttc["$i"]); } else { print ''.price($product->multiprices["$i"]); } if ($product->multiprices_base_type["$i"]) { print ' '.$langs->trans($product->multiprices_base_type["$i"]); } else { print ' '.$langs->trans($product->price_base_type); } print '
'.$langs->trans("SellingPrice").''; if ($product->price_base_type == 'TTC') { print price($product->price_ttc).' '.$langs->trans($product->price_base_type); } else { print price($product->price).' '.$langs->trans($product->price_base_type); } print '
'.$langs->trans("Status").''; print $product->getLibStatut(2); print '
'.$langs->trans("VATRate").''.price2num($product->tva_tx,'MU').'%
'.$langs->trans("Stock").'".$langs->trans("NoStockForThisProduct"); } else { if ($product->stock_reel <= $product->seuil_stock_alerte) { print ''.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte; } else { print "".$product->stock_reel; } } print '
'.$langs->trans("Description").''.nl2br($product->description).'
'.$langs->trans("Duration").''.$product->duration_value.' '; if ($product->duration_value > 1) { $dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); } else { $dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); } print $langs->trans($dur[$product->duration_unit])." "; print '
'.$langs->trans("Weight").''; if ($product->weight != '') { print $product->weight." ".measuring_units_string($product->weight_units,"weight"); } else { print ' '; } print "
'.$langs->trans("Volume").''; if ($product->volume != '') { print $product->volume." ".measuring_units_string($product->volume_units,"volume"); } else { print ' '; } print "
'.$langs->trans("Note").''.nl2br($product->note).'
\n"; print "\n\n"; } } /* * Fiche en mode edition */ if ($_GET["action"] == 'edit' && $user->rights->produit->creer) { if ($product->isservice()) { print_fiche_titre($langs->trans('Edit').' '.$langs->trans('Service').' : '.$product->ref, ""); } else { print_fiche_titre($langs->trans('Edit').' '.$langs->trans('Product').' : '.$product->ref, ""); } if ($mesg) { print '
'.$mesg.'

'; } if ( $product->canvas == '') { print "\n"; print "
\n"; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if ($product->isproduct() && $conf->stock->enabled) { print "".''; } else { print ''; } // Description (utilisé dans facture, propale...) print '"; print "\n"; if ($product->isservice()) { print ''; } else { // Le poids et le volume ne concerne que les produits et pas les services print ''; print ''; } // Note print '"; print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("VATRate").''; print $html->select_tva("tva_tx", $product->tva_tx, $mysoc, '', $product->tva_tx); print '
'.$langs->trans("Status").''; print '
Seuil stock'; print ''; print '
'.$langs->trans("Description").''; print "\n"; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('desc',$product->description,160,'dolibarr_notes','',false); $doleditor->Create(); } else { print '"; } print "
'.$langs->trans("Duration").''; print '  '; print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); print '  '; print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); print '  '; print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); print '  '; print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); print '
'.$langs->trans("Weight").''; print ''; print $html->select_measuring_units("weight_units", "weight", $product->weight_units); print '
'.$langs->trans("Volume").''; print ''; print $html->select_measuring_units("volume_units", "volume", $product->volume_units); print '
'.$langs->trans("NoteNotVisibleOnBill").''; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note',$product->note,200,'dolibarr_notes','',false); $doleditor->Create(); } else { print '"; } print "
 '; print '
'; print '
'; print "\n"; } else { $null = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,''); $smarty->assign('tva_taux_value', $html->tva_taux_value); $smarty->assign('tva_taux_libelle', $html->tva_taux_libelle); $smarty->display($product->canvas.'-edit.tpl'); } } } else if (!$_GET["action"] == 'create') { Header("Location: index.php"); exit; } /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ print "\n
\n"; if ($_GET["action"] == '') { if ( $user->rights->produit->creer) { if ($product->no_button_edit <> 1) print ''.$langs->trans("Edit").''; if ($product->no_button_copy <> 1) print ''.$langs->trans("CreateCopy").''; } /* if ($product->isproduct() && $user->rights->commande->creer) { $langs->load('orders'); print ''; print $langs->trans("CreateCustomerOrder").''; } if ($product->isproduct() && $user->rights->fournisseur->commande->creer) { $langs->load('orders'); print ''; print $langs->trans("CreateSupplierOrder").''; } */ $product_is_used = $product->verif_prod_use($product->id); if ($user->rights->produit->supprimer && ! $product_is_used && $product->no_button_delete <> 1) { print ''.$langs->trans("Delete").''; } } print "\n

\n"; if ($_GET["id"] && $_GET["action"] == '' && $product->status) { $propal = New Propal($db); print ''; // Propals if($conf->propal->enabled && $user->rights->propale->creer) { $langs->load("propal"); print ''; if ($user->rights->commercial->client->voir) { print ''; } else { print ''; } print ''; // Liste de "Mes propals" print ''; if ($user->rights->commercial->client->voir) { // Liste de "Other propals" print ''; } print ''; } $commande = New Commande($db); // Commande if($conf->commande->enabled && $user->rights->commande->creer) { $langs->load("orders"); print ''; if ($user->rights->commercial->client->voir) { print ''; } else { print ''; } print ''; // Liste de "Mes commandes" print ''; if ($user->rights->commercial->client->voir) { // Liste de "Other orders" print ''; print ''; } // Factures if($conf->facture->enabled && $user->rights->facture->creer) { print ''; if ($user->rights->commercial->client->voir) { print ''; } else { print ''; } print ''; // Liste de Mes factures print ''; if ($user->rights->commercial->client->voir) { print ''; } print '
'; print $langs->trans("AddToMyProposals") . ''; print $langs->trans("AddToOtherProposals").' 
'; $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.ref,".$db->pdate("p.datep")." as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; $sql .=" WHERE p.fk_soc = s.rowid AND p.fk_statut = 0 AND p.fk_user_author = ".$user->id; $sql .= " ORDER BY p.datec DESC, tms DESC"; $result=$db->query($sql); if ($result) { $var=true; $num = $db->num_rows($result); print ''; if ($num) { $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $var=!$var; print ''; print ""; print "\n"; print "\n"; print "\n"; print ''; print ''; print ''; $i++; } } else { print ""; } print "
"; print ''; print "propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."socid."\">".dolibarr_trunc($objp->nom,18)."".dolibarr_print_date($objp->dp,"%d %b")."'; print ''.$langs->trans("ReductionShort"); print '%'; print " ".$product->stock_proposition; print ''; print ''; print '
"; print $langs->trans("NoOpenedPropals"); print "
"; $db->free($result); } print '
'; $var=true; $otherprop = $propal->liste_array(1, ' <> '.$user->id); print ''; if (is_array($otherprop) && sizeof($otherprop)) { $var=!$var; print ''; print ''; print ''; print ''; } else { print "'; } print '
'; print ''; print $langs->trans("OtherPropals").''; $html->select_array("propalid", $otherprop); print '
'.$langs->trans("Qty"); print ''.$langs->trans("ReductionShort"); print '%'; print ''; print ''; print '
"; print $langs->trans("NoOtherOpenedPropals"); print '
'; print '
'; print $langs->trans("AddToMyOrders").''; print $langs->trans("AddToOtherOrders").' 
'; $sql = "SELECT s.nom, s.rowid as socid, c.rowid as commandeid, c.ref,".$db->pdate("c.date_commande")." as dc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql .=" WHERE c.fk_soc = s.rowid AND c.fk_statut = 0 AND c.fk_user_author = ".$user->id; $sql .= " ORDER BY c.date_creation DESC"; $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); $var=true; print ''; if ($num) { $i = 0; while ($i < $num) { $objc = $db->fetch_object($result); $var=!$var; print ''; print ""; print "\n"; print "\n"; print "\n"; print ''; print ''; print ''; $i++; } } else { print "'; } print "
"; print ''; print "commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."socid."\">".dolibarr_trunc($objc->nom,18)."".dolibarr_print_date($objc->dc,"%d %b")."'; print ''.$langs->trans("ReductionShort"); print '%'; print " ".$product->stock_proposition; print ''; print ''; print '
"; print $langs->trans("NoOpenedOrders"); print '
"; $db->free($result); } print '
'; $var=true; $othercom = $commande->liste_array(1, ' <> '.$user->id); print ''; if (is_array($othercom) && sizeof($othercom)) { $var=!$var; print ''; print ''; print ''; print ''; } else { print "'; } print '
'; print ''; print $langs->trans("OtherOrders").''; $html->select_array("commandeid", $othercom); print '
'.$langs->trans("Qty"); print ''.$langs->trans("ReductionShort"); print '%'; print ''; print ''; print '
"; print $langs->trans("NoOtherOpenedOrders"); print '
'; } print '
'; print $langs->trans("AddToMyBills").''; print $langs->trans("AddToOtherBills").' 
'; $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; $sql .=" WHERE f.fk_soc = s.rowid AND f.fk_statut = 0 AND f.fk_user_author = ".$user->id; $sql .= " ORDER BY f.datec DESC, f.rowid DESC"; $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); $var=true; print ''; if ($num) { $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $var=!$var; print ''; print ""; print "\n"; print "\n"; print "\n"; print ''; print ''; print ''; $i++; } } else { print "'; } print "
"; print ''; print "factureid."\">".img_object($langs->trans("ShowBills"),"bill")." ".$objp->facnumber."socid."\">".dolibarr_trunc($objp->nom,18)."".dolibarr_print_date($objp->df,"%d %b")."'; print ''.$langs->trans("ReductionShort"); print '%'; print ''; print ''; print '
"; print $langs->trans("NoDraftBills"); print '
"; $db->free($result); } else { dolibarr_print_error($db); } print '
'; // Liste de Autres factures $var=true; $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; $sql .=" WHERE f.fk_soc = s.rowid AND f.fk_statut = 0 AND f.fk_user_author <> ".$user->id; $sql .= " ORDER BY f.datec DESC, f.rowid DESC"; $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); $var=true; print ''; if ($num) { $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $var=!$var; print ''; print ""; print "\n"; print "\n"; print ""; print ''; print ''; print ''; $i++; } } else { print "'; } print "
factureid."\">$objp->facnumbersocid."\">".dolibarr_trunc($objp->nom,24)."".$langs->trans("Qty"); print ''; print "'; print ''.$langs->trans("ReductionShort"); print '%'; print ''; print ''; print '
"; print $langs->trans("NoOtherDraftBills"); print '
"; $db->free($result); } else { dolibarr_print_error($db); } } print '
'; print '
'; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>