26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
31 $langs->loadLangs(array(
"suppliers",
"orders",
"companies"));
34 $socid =
GETPOST(
"socid",
'int');
35 if ($user->socid) $socid = $user->socid;
45 $companystatic =
new Societe($db);
47 llxHeader(
"", $langs->trans(
"SuppliersArea"));
54 print '<div class="fichecenter"><div class="fichethirdleft">';
58 $sql =
"SELECT count(cf.rowid), cf.fk_statut";
59 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf,";
60 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
61 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
62 $sql .=
" WHERE cf.fk_soc = s.rowid ";
63 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND sc.fk_user = ".$user->id;
64 $sql .=
" AND cf.entity = ".$conf->entity;
65 $sql .=
" GROUP BY cf.fk_statut";
70 $num = $db->num_rows(
$resql);
73 print
'<table class="noborder centpercent">';
74 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Orders").
'</td><td class="center">'.$langs->trans(
"Nb").
'</td><td> </td>';
79 $row = $db->fetch_row(
$resql);
81 print
'<tr class="oddeven">';
82 print
'<td>'.$commandestatic->LibStatut($row[1]).
'</td>';
83 print
'<td class="center">'.$row[0].
'</td>';
84 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php?statut='.$row[1].
'">'.$commandestatic->LibStatut($row[1], 3).
'</a></td>';
98 if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))
100 $langs->load(
"orders");
102 $sql =
"SELECT cf.rowid, cf.ref, cf.total_ttc,";
103 $sql .=
" s.nom as name, s.rowid as socid";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
105 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
106 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
107 $sql .=
" WHERE cf.fk_soc = s.rowid";
108 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND sc.fk_user = ".$user->id;
109 $sql .=
" AND cf.entity = ".$conf->entity;
110 $sql .=
" AND cf.fk_statut = 0";
111 if ($socid) $sql .=
" AND cf.fk_soc = ".$socid;
113 $resql = $db->query($sql);
117 $num = $db->num_rows(
$resql);
120 print
'<table class="noborder centpercent">';
121 print
'<tr class="liste_titre">';
122 print
'<td colspan="3">'.$langs->trans(
"DraftOrders").
'<span class="badge marginleftonlyshort">'.$num.
'</span></td></tr>';
127 $obj = $db->fetch_object(
$resql);
129 print
'<tr class="oddeven"><td class="nowrap">';
130 $commandestatic->id = $obj->rowid;
131 $commandestatic->ref = $obj->ref;
132 print $commandestatic->getNomUrl(1,
'', 16);
134 print
'<td class="nowrap">';
135 $companystatic->id = $obj->socid;
136 $companystatic->name = $obj->name;
137 $companystatic->client = 0;
138 print $companystatic->getNomUrl(1,
'', 16);
140 print
'<td class="right nowrap">'.price($obj->total_ttc).
'</td></tr>';
142 $total += $obj->total_ttc;
146 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td colspan="2" class="right">'.
price($total).
"</td></tr>";
155 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
157 $sql =
"SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type";
158 $sql .=
", s.nom as name, s.rowid as socid";
159 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as ff";
160 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
161 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
162 $sql .=
" WHERE s.rowid = ff.fk_soc";
163 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND sc.fk_user = ".$user->id;
164 $sql .=
" AND ff.entity = ".$conf->entity;
165 $sql .=
" AND ff.fk_statut = 0";
166 if ($socid) $sql .=
" AND f.fk_soc = ".$socid;
168 $resql = $db->query($sql);
172 $num = $db->num_rows(
$resql);
175 print
'<table class="noborder centpercent">';
176 print
'<tr class="liste_titre">';
177 print
'<td colspan="3">'.$langs->trans(
"DraftBills").
'<span class="badge marginleftonlyshort">'.$num.
'</span></td></tr>';
181 while ($i < $num && $i < 20)
183 $obj = $db->fetch_object(
$resql);
185 print
'<tr class="oddeven"><td class="nowrap">';
186 $facturestatic->ref = $obj->ref;
187 $facturestatic->id = $obj->rowid;
188 $facturestatic->type = $obj->type;
189 print $facturestatic->getNomUrl(1,
'');
191 print
'<td class="nowrap">';
192 $companystatic->id = $obj->socid;
193 $companystatic->name = $obj->name;
194 $companystatic->client = 0;
195 print $companystatic->getNomUrl(1,
'', 16);
197 print
'<td class="right">'.price($obj->total_ttc).
'</td>';
199 $tot_ttc += $obj->total_ttc;
203 print
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
204 print
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
218 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
225 $sql =
"SELECT s.rowid as socid, s.nom as name, s.town, s.datec, s.tms, s.prefix_comm, s.code_fournisseur, s.code_compta_fournisseur";
226 $sql .=
", st.libelle as stcomm";
227 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
228 $sql .=
", ".MAIN_DB_PREFIX.
"c_stcomm as st";
229 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
230 $sql .=
" WHERE s.fk_stcomm = st.id";
231 $sql .=
" AND s.fournisseur = 1";
232 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
233 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
234 if ($socid) $sql .=
" AND s.rowid = ".$socid;
235 $sql .=
" ORDER BY s.tms DESC";
236 $sql .= $db->plimit($max, 0);
238 $resql = $db->query($sql);
241 $langs->load(
"boxes");
242 $num = $db->num_rows(
$resql);
245 print
'<table class="noborder centpercent">';
246 print
'<tr class="liste_titre">';
247 print
'<td colspan="2">'.$langs->trans(
"BoxTitleLastSuppliers", min($max, $num)).
"</td>\n";
248 print
'<td class="right">'.$langs->trans(
"DateModification").
"</td>\n";
251 while ($obj = $db->fetch_object(
$resql))
253 print
'<tr class="oddeven">';
254 print
'<td><a href="card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowSupplier"),
"company").
'</a>';
255 print
" <a href=\"card.php?socid=".$obj->socid.
"\">".$obj->name.
"</a></td>\n";
256 print
'<td class="left">'.$obj->code_fournisseur.
' </td>';
257 print
'<td class="right">'.dol_print_date($db->jdate($obj->tms),
'day').
'</td>';
271 $companystatic->LoadSupplierCateg();
274 if (count($companystatic->SupplierCategories))
278 print
'<table class="liste centpercent">';
279 print
'<tr class="liste_titre"><td colspan="2">';
280 print $langs->trans(
"Category");
281 print
"</td></tr>\n";
283 foreach ($companystatic->SupplierCategories as $rowid => $label)
285 print
'<tr class="oddeven">'.
"\n";
287 $categstatic->id = $rowid;
288 $categstatic->ref = $label;
289 $categstatic->label = $label;
290 print $categstatic->getNomUrl(1);
305 print
'</div></div></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage suppliers invoices.
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...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage predefined suppliers products.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...