27 require 
'../main.inc.php';
 
   28 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
   29 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
 
   30 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
   32 $langs->loadLangs(array(
"suppliers", 
"orders", 
"companies"));
 
   35 $socid = 
GETPOST(
"socid", 
'int');
 
   37   $socid = $user->socid;
 
   48 $companystatic = 
new Societe($db);
 
   50 llxHeader(
"", $langs->trans(
"SuppliersArea"));
 
   57 print 
'<div class="fichecenter"><div class="fichethirdleft">';
 
   61 $sql = 
"SELECT count(cf.rowid), cf.fk_statut";
 
   62 $sql .= 
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf,";
 
   63 $sql .= 
" ".MAIN_DB_PREFIX.
"societe as s";
 
   64 if (empty($user->rights->societe->client->voir) && !$socid) {
 
   65   $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
 
   67 $sql .= 
" WHERE cf.fk_soc = s.rowid ";
 
   68 if (empty($user->rights->societe->client->voir) && !$socid) {
 
   69   $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
   71 $sql .= 
" AND cf.entity = ".$conf->entity;
 
   72 $sql .= 
" GROUP BY cf.fk_statut";
 
   76   $num = $db->num_rows(
$resql);
 
   79   print 
'<table class="noborder centpercent">';
 
   80   print 
'<tr class="liste_titre"><td>'.$langs->trans(
"Orders").
'</td><td class="center">'.$langs->trans(
"Nb").
'</td><td> </td>';
 
   84     $row = $db->fetch_row(
$resql);
 
   86     print 
'<tr class="oddeven">';
 
   87     print 
'<td>'.$commandestatic->LibStatut($row[1]).
'</td>';
 
   88     print 
'<td class="center">'.$row[0].
'</td>';
 
   89     print 
'<td class="center"><a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php?statut='.$row[1].
'">'.$commandestatic->LibStatut($row[1], 3).
'</a></td>';
 
  103 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || 
isModEnabled(
"supplier_order")) {
 
  104   $langs->load(
"orders");
 
  106   $sql = 
"SELECT cf.rowid, cf.ref, cf.total_ttc,";
 
  107   $sql .= 
" s.nom as name, s.rowid as socid";
 
  108   $sql .= 
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
 
  109   $sql .= 
", ".MAIN_DB_PREFIX.
"societe as s";
 
  110   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  111     $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
 
  113   $sql .= 
" WHERE cf.fk_soc = s.rowid";
 
  114   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  115     $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
  117   $sql .= 
" AND cf.entity = ".$conf->entity;
 
  118   $sql .= 
" AND cf.fk_statut = 0";
 
  120     $sql .= 
" AND cf.fk_soc = ".((int) $socid);
 
  123   $resql = $db->query($sql);
 
  126     $num = $db->num_rows(
$resql);
 
  128       print 
'<table class="noborder centpercent">';
 
  129       print 
'<tr class="liste_titre">';
 
  130       print 
'<td colspan="3">'.$langs->trans(
"DraftOrders").
'<span class="badge marginleftonlyshort">'.$num.
'</span></td></tr>';
 
  134         $obj = $db->fetch_object(
$resql);
 
  136         print 
'<tr class="oddeven"><td  class="nowrap">';
 
  137         $commandestatic->id = $obj->rowid;
 
  138         $commandestatic->ref = $obj->ref;
 
  139         print $commandestatic->getNomUrl(1, 
'', 16);
 
  141         print 
'<td  class="nowrap">';
 
  142         $companystatic->id = $obj->socid;
 
  143         $companystatic->name = $obj->name;
 
  144         $companystatic->client = 0;
 
  145         print $companystatic->getNomUrl(1, 
'', 16);
 
  147         print 
'<td class="right nowrap">'.price($obj->total_ttc).
'</td></tr>';
 
  149         $total += $obj->total_ttc;
 
  152         print 
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td colspan="2" class="right">'.
price($total).
"</td></tr>";
 
  161 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || 
isModEnabled(
"supplier_invoice")) && $user->rights->fournisseur->facture->lire) {
 
  162   $sql = 
"SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type";
 
  163   $sql .= 
", s.nom as name, s.rowid as socid";
 
  164   $sql .= 
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as ff";
 
  165   $sql .= 
", ".MAIN_DB_PREFIX.
"societe as s";
 
  166   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  167     $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
 
  169   $sql .= 
" WHERE s.rowid = ff.fk_soc";
 
  170   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  171     $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
  173   $sql .= 
" AND ff.entity = ".$conf->entity;
 
  174   $sql .= 
" AND ff.fk_statut = 0";
 
  176     $sql .= 
" AND f.fk_soc = ".((int) $socid);
 
  179   $resql = $db->query($sql);
 
  182     $num = $db->num_rows(
$resql);
 
  184       print 
'<table class="noborder centpercent">';
 
  185       print 
'<tr class="liste_titre">';
 
  186       print 
'<td colspan="3">'.$langs->trans(
"DraftBills").
'<span class="badge marginleftonlyshort">'.$num.
'</span></td></tr>';
 
  190       while ($i < $num && $i < 20) {
 
  191         $obj = $db->fetch_object(
$resql);
 
  193         print 
'<tr class="oddeven"><td class="nowrap">';
 
  194         $facturestatic->ref = $obj->ref;
 
  195         $facturestatic->id = $obj->rowid;
 
  196         $facturestatic->type = $obj->type;
 
  197         print $facturestatic->getNomUrl(1, 
'');
 
  199         print 
'<td class="nowrap">';
 
  200         $companystatic->id = $obj->socid;
 
  201         $companystatic->name = $obj->name;
 
  202         $companystatic->client = 0;
 
  203         print $companystatic->getNomUrl(1, 
'', 16);
 
  205         print 
'<td class="right">'.price($obj->total_ttc).
'</td>';
 
  207         $tot_ttc += $obj->total_ttc;
 
  211       print 
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
 
  212       print 
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
 
  225 print 
'</div><div class="fichetwothirdright">';
 
  232 $sql = 
"SELECT s.rowid as socid, s.nom as name, s.town, s.datec, s.tms, s.prefix_comm, s.code_fournisseur";
 
  233 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
 
  234   $sql .= 
", spe.accountancy_code_supplier as code_compta_fournisseur";
 
  236   $sql .= 
", s.code_compta_fournisseur";
 
  238 $sql .= 
", st.libelle as stcomm";
 
  239 $sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
  240 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
 
  241   $sql .= 
" LEFT JOIN " . MAIN_DB_PREFIX . 
"societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
 
  243 $sql .= 
", ".MAIN_DB_PREFIX.
"c_stcomm as st";
 
  244 if (empty($user->rights->societe->client->voir) && !$socid) {
 
  245   $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  247 $sql .= 
" WHERE s.fk_stcomm = st.id";
 
  248 $sql .= 
" AND s.fournisseur = 1";
 
  249 $sql .= 
" AND s.entity IN (".getEntity(
'societe').
")";
 
  250 if (empty($user->rights->societe->client->voir) && !$socid) {
 
  251   $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
  254   $sql .= 
" AND s.rowid = ".((int) $socid);
 
  256 $sql .= 
" ORDER BY s.tms DESC";
 
  257 $sql .= $db->plimit($max, 0);
 
  259 $resql = $db->query($sql);
 
  261   $langs->load(
"boxes");
 
  262   $num = $db->num_rows(
$resql);
 
  265   print 
'<table class="noborder centpercent">';
 
  266   print 
'<tr class="liste_titre">';
 
  267   print 
'<td colspan="2">'.$langs->trans(
"BoxTitleLastSuppliers", min($max, $num)).
"</td>\n";
 
  268   print 
'<td class="right">'.$langs->trans(
"DateModification").
"</td>\n";
 
  271   while ($obj = $db->fetch_object(
$resql)) {
 
  272     print 
'<tr class="oddeven">';
 
  273     print 
'<td><a href="card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowSupplier"), 
"company").
'</a>';
 
  274     print 
" <a href=\"card.php?socid=".$obj->socid.
"\">".$obj->name.
"</a></td>\n";
 
  275     print 
'<td class="left">'.$obj->code_fournisseur.
' </td>';
 
  276     print 
'<td class="right">'.dol_print_date($db->jdate($obj->tms), 
'day').
'</td>';
 
  290 $companystatic->LoadSupplierCateg();
 
  293 if (count($companystatic->SupplierCategories)) {
 
  296   print 
'<table class="liste centpercent">';
 
  297   print 
'<tr class="liste_titre"><td colspan="2">';
 
  298   print $langs->trans(
"Category");
 
  299   print 
"</td></tr>\n";
 
  301   foreach ($companystatic->SupplierCategories as $rowid => $label) {
 
  302     print 
'<tr class="oddeven">'.
"\n";
 
  304     $categstatic->id = $rowid;
 
  305     $categstatic->ref = $label;
 
  306     $categstatic->label = $label;
 
  307     print $categstatic->getNomUrl(1);
 
  321 print 
'</div></div>';
 
Class to manage categories.
Class to manage predefined suppliers products.
Class to manage suppliers invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.