27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
34 $hookmanager->initHooks(array(
'suppliersproposalsindex'));
37 $langs->loadLangs(array(
'supplier_proposal',
'companies'));
40 $socid =
GETPOST(
'socid',
'int');
41 if (isset($user->socid) && $user->socid > 0)
44 $socid = $user->socid;
54 $companystatic =
new Societe($db);
55 $form =
new Form($db);
57 $help_url =
"EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
59 llxHeader(
"", $langs->trans(
"SupplierProposalArea"), $help_url);
63 print '<div class="fichecenter"><div class="fichethirdleft">';
68 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))
70 print
'<form method="post" action="'.DOL_URL_ROOT.
'/supplier_proposal/list.php">';
71 print
'<input type="hidden" name="token" value="'.newToken().
'">';
72 print
'<div class="div-table-responsive-no-min">';
73 print
'<table class="noborder nohover centpercent">';
74 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
75 print
'<tr class="oddeven"><td>';
76 print $langs->trans(
"SupplierProposal").
':</td><td><input type="text" class="flat" name="sall" size="18"></td><td><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
78 print
"</table></div></form><br>\n";
84 $sql =
"SELECT count(p.rowid), p.fk_statut";
85 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
86 $sql .=
", ".MAIN_DB_PREFIX.
"supplier_proposal as p";
87 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
88 $sql .=
" WHERE p.fk_soc = s.rowid";
89 $sql .=
" AND p.entity IN (".getEntity(
'supplier_proposal').
")";
90 if ($user->socid) $sql .=
' AND p.fk_soc = '.$user->socid;
91 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
92 $sql .=
" AND p.fk_statut IN (0,1,2,3,4)";
93 $sql .=
" GROUP BY p.fk_statut";
97 $num = $db->num_rows(
$resql);
102 $dataseries = array();
103 $colorseries = array();
108 $row = $db->fetch_row(
$resql);
113 $vals[$row[1]] = $row[0];
114 $totalinprocess += $row[0];
122 include_once DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
124 print
'<div class="div-table-responsive-no-min">';
125 print
'<table class="noborder centpercent">';
126 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"CommRequests").
'</th></tr>'.
"\n";
127 $listofstatus = array(0, 1, 2, 3, 4);
128 foreach ($listofstatus as $status)
130 $dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
137 if (empty($conf->use_javascript_ajax))
139 print
'<tr class="oddeven">';
140 print
'<td>'.$supplier_proposalstatic->LibStatut($status, 0).
'</td>';
141 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
145 if ($conf->use_javascript_ajax)
147 print
'<tr><td class="center" colspan="2">';
149 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
151 $dolgraph->SetData($dataseries);
152 $dolgraph->SetDataColor(array_values($colorseries));
153 $dolgraph->setShowLegend(2);
154 $dolgraph->setShowPercent(1);
155 $dolgraph->SetType(array(
'pie'));
156 $dolgraph->setHeight(
'200');
157 $dolgraph->draw(
'idgraphstatus');
158 print $dolgraph->show($total ? 0 : 1);
163 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
164 print
"</table></div><br>";
173 if (!empty($conf->supplier_proposal->enabled))
175 $sql =
"SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client";
176 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal as c";
177 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
178 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
179 $sql .=
" WHERE c.fk_soc = s.rowid";
180 $sql .=
" AND c.entity = ".$conf->entity;
181 $sql .=
" AND c.fk_statut = 0";
182 if ($socid) $sql .=
" AND c.fk_soc = ".$socid;
183 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
185 $resql = $db->query($sql);
188 print
'<div class="div-table-responsive-no-min">';
189 print
'<table class="noborder centpercent">';
190 print
'<tr class="liste_titre">';
191 print
'<th colspan="2">'.$langs->trans(
"DraftRequests").
'</th></tr>';
192 $langs->load(
"supplier_proposal");
193 $num = $db->num_rows(
$resql);
199 $obj = $db->fetch_object(
$resql);
201 print
'<tr class="oddeven">';
202 $supplier_proposalstatic->id = $obj->rowid;
203 $supplier_proposalstatic->ref = $obj->ref;
204 print
'<td class="nowrap">'.$supplier_proposalstatic->getNomUrl(1).
'</td>';
206 $companystatic->id = $obj->socid;
207 $companystatic->name = $obj->socname;
208 $companystatic->client = $obj->client;
209 $companystatic->canvas = $obj->canvas;
210 print
'<td>'.$companystatic->getNomUrl(1,
'customer', 24).
'</td>';
216 print
"</table></div><br>";
220 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
229 $sql =
"SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
230 $sql .=
" date_cloture as datec";
231 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal as c";
232 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
233 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
234 $sql .=
" WHERE c.fk_soc = s.rowid";
235 $sql .=
" AND c.entity = ".$conf->entity;
237 if ($socid) $sql .=
" AND c.fk_soc = ".$socid;
238 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
239 $sql .=
" ORDER BY c.tms DESC";
240 $sql .= $db->plimit($max, 0);
242 $resql = $db->query($sql);
245 print
'<div class="div-table-responsive-no-min">';
246 print
'<table class="noborder centpercent">';
247 print
'<tr class="liste_titre">';
248 print
'<th colspan="4">'.$langs->trans(
"LastModifiedRequests", $max).
'</th></tr>';
250 $num = $db->num_rows(
$resql);
256 $obj = $db->fetch_object(
$resql);
258 print
'<tr class="oddeven">';
259 print
'<td width="20%" class="nowrap">';
261 $supplier_proposalstatic->id = $obj->rowid;
262 $supplier_proposalstatic->ref = $obj->ref;
264 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
265 print
'<td width="96" class="nobordernopadding nowrap">';
266 print $supplier_proposalstatic->getNomUrl(1);
269 print
'<td width="16" class="nobordernopadding nowrap">';
273 print
'<td width="16" class="right nobordernopadding">';
276 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
277 print $formfile->getDocumentsLink($supplier_proposalstatic->element, $filename, $filedir);
278 print
'</td></tr></table>';
282 $companystatic->id = $obj->socid;
283 $companystatic->name = $obj->socname;
284 $companystatic->client = $obj->client;
285 $companystatic->canvas = $obj->canvas;
286 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
288 print
'<td>'.dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
289 print
'<td class="right">'.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).
'</td>';
294 print
"</table></div><br>";
301 if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
303 $langs->load(
"supplier_proposal");
307 $sql =
"SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp";
308 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
309 $sql .=
", ".MAIN_DB_PREFIX.
"supplier_proposal as p";
310 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
311 $sql .=
" WHERE p.fk_soc = s.rowid";
312 $sql .=
" AND p.entity IN (".getEntity(
'supplier_proposal').
")";
313 $sql .=
" AND p.fk_statut = 1";
314 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
315 if ($socid) $sql .=
" AND s.rowid = ".$socid;
316 $sql .=
" ORDER BY p.rowid DESC";
318 $result = $db->query($sql);
322 $num = $db->num_rows($result);
326 print
'<div class="div-table-responsive-no-min">';
327 print
'<table class="noborder centpercent">';
328 print
'<tr class="liste_titre"><th colspan="5">'.$langs->trans(
"RequestsOpened").
' <a href="'.DOL_URL_ROOT.
'/supplier_proposal/list.php?search_status=1"><span class="badge">'.$num.
'</span></a></th></tr>';
330 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
331 while ($i < $nbofloop)
333 $obj = $db->fetch_object($result);
335 print
'<tr class="oddeven">';
338 print
'<td class="nowrap" width="140">';
340 $supplier_proposalstatic->id = $obj->supplier_proposalid;
341 $supplier_proposalstatic->ref = $obj->ref;
343 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
344 print
'<td class="nobordernopadding nowrap">';
345 print $supplier_proposalstatic->getNomUrl(1);
347 print
'<td width="18" class="nobordernopadding nowrap">';
348 if ($db->jdate($obj->dfv) < ($now - $conf->supplier_proposal->cloture->warning_delay)) print
img_warning($langs->trans(
"Late"));
350 print
'<td width="16" class="center nobordernopadding">';
353 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->supplier_proposalid;
354 print $formfile->getDocumentsLink($supplier_proposalstatic->element, $filename, $filedir);
355 print
'</td></tr></table>';
359 $companystatic->id = $obj->socid;
360 $companystatic->name = $obj->socname;
361 $companystatic->client = $obj->client;
362 $companystatic->canvas = $obj->canvas;
363 print
'<td class="left">'.$companystatic->getNomUrl(1,
'customer', 44).
'</td>'.
"\n";
365 print
'<td class="right">';
367 print
'<td class="right">'.price($obj->total_ttc).
'</td>';
368 print
'<td class="center" width="14">'.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).
'</td>'.
"\n";
371 $total += $obj->total_ttc;
373 if ($num > $nbofloop)
375 print
'<tr class="liste_total"><td colspan="5">'.$langs->trans(
"XMoreLines", ($num - $nbofloop)).
"</td></tr>";
376 } elseif ($total > 0)
378 print
'<tr class="liste_total"><td colspan="3">'.$langs->trans(
"Total").
'</td><td class="right">'.
price($total).
"</td><td> </td></tr>";
380 print
"</table></div><br>";
387 print
'</div></div></div>';
389 $parameters = array(
'user' => $user);
390 $reshook = $hookmanager->executeHooks(
'dashboardSupplierProposal', $parameters, $object);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
const STATUS_NOTSIGNED
Not signed quote, canceled.
dol_now($mode= 'auto')
Return date for now.
const STATUS_CLOSE
Billed or closed/processed quote.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
const STATUS_SIGNED
Signed quote.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
const STATUS_VALIDATED
Validated status.
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.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
const STATUS_DRAFT
Draft status.
Class to manage price ask supplier.
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...