34 global $db, $langs, $conf, $user;
35 $langs->loadLangs(array(
'propal',
'compta',
'companies'));
40 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/card.php?id='.$object->id;
41 $head[$h][1] = $langs->trans(
'Proposal');
42 $head[$h][2] =
'comm';
45 if ((empty($conf->commande->enabled) && ((
isModEnabled(
"expedition") &&
isModEnabled(
'expedition_bon') && $user->rights->expedition->lire)
46 || (
isModEnabled(
"expedition") && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire)))) {
47 $langs->load(
"sendings");
49 $head[$h][0] = DOL_URL_ROOT.
'/expedition/propal.php?id='.$object->id;
50 if ($conf->expedition_bon->enabled) {
51 $text = $langs->trans(
"Shipment");
53 if ($conf->delivery_note->enabled) {
54 $text .=
'/'.$langs->trans(
"Receivings");
57 $head[$h][2] =
'shipping';
61 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
62 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
63 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/contact.php?id='.$object->id;
64 $head[$h][1] = $langs->trans(
'ContactsAddresses');
66 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
68 $head[$h][2] =
'contact';
78 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
80 if (!empty($object->note_private)) {
83 if (!empty($object->note_public)) {
86 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/note.php?id='.$object->id;
87 $head[$h][1] = $langs->trans(
'Notes');
89 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
91 $head[$h][2] =
'note';
95 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
96 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
97 $upload_dir = $conf->propal->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
98 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
99 $nbLinks =
Link::count($db, $object->element, $object->id);
100 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/document.php?id='.$object->id;
101 $head[$h][1] = $langs->trans(
'Documents');
102 if (($nbFiles + $nbLinks) > 0) {
103 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
105 $head[$h][2] =
'document';
108 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/info.php?id='.$object->id;
109 $head[$h][1] = $langs->trans(
'Info');
110 $head[$h][2] =
'info';
127 global $langs, $conf, $user, $db;
130 $extrafields->fetch_name_optionals_label(
'propal');
131 $extrafields->fetch_name_optionals_label(
'propaldet');
136 $head[$h][0] = DOL_URL_ROOT.
'/admin/propal.php';
137 $head[$h][1] = $langs->trans(
"Miscellaneous");
138 $head[$h][2] =
'general';
147 $head[$h][0] = DOL_URL_ROOT.
'/comm/admin/propal_extrafields.php';
148 $head[$h][1] = $langs->trans(
"ExtraFields");
149 $nbExtrafields = $extrafields->attributes[
'propal'][
'count'];
150 if ($nbExtrafields > 0) {
151 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
153 $head[$h][2] =
'attributes';
156 $head[$h][0] = DOL_URL_ROOT.
'/comm/admin/propaldet_extrafields.php';
157 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
158 $nbExtrafields = $extrafields->attributes[
'propaldet'][
'count'];
159 if ($nbExtrafields > 0) {
160 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
162 $head[$h][2] =
'attributeslines';
180 global $conf, $db, $langs, $user;
184 if (!
isModEnabled(
'propal') || empty($user->rights->propal->lire)) {
190 $propalstatic =
new Propal($db);
192 $sql =
"SELECT count(p.rowid) as nb, p.fk_statut as status";
193 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
194 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
195 if (empty($user->rights->societe->client->voir) && !$socid) {
196 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
198 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
199 $sql .=
" AND p.fk_soc = s.rowid";
201 $sql .=
' AND p.fk_soc = '.((int) $user->socid);
203 if (empty($user->rights->societe->client->voir) && !$socid) {
204 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
206 $sql .=
" AND p.fk_statut IN (".$db->sanitize(implode(
" ,", $listofstatus)).
")";
207 $sql .=
" GROUP BY p.fk_statut";
208 $resql = $db->query($sql);
210 $num = $db->num_rows(
$resql);
214 $dataseries = array();
215 $colorseries = array();
219 $obj = $db->fetch_object(
$resql);
221 $vals[$obj->status] = $obj->nb;
222 $totalinprocess += $obj->nb;
230 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
232 $result =
'<div class="div-table-responsive-no-min">';
233 $result .=
'<table class="noborder nohover centpercent">';
235 $result .=
'<tr class="liste_titre">';
236 $result .=
'<td colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Proposals").
'</td>';
239 foreach ($listofstatus as $status) {
240 $dataseries[] = array($propalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
242 $colorseries[$status] =
'-'.$badgeStatus0;
245 $colorseries[$status] = $badgeStatus1;
248 $colorseries[$status] = $badgeStatus4;
251 $colorseries[$status] = $badgeStatus9;
254 $colorseries[$status] = $badgeStatus6;
257 if (empty($conf->use_javascript_ajax)) {
258 $result .=
'<tr class="oddeven">';
259 $result .=
'<td>'.$propalstatic->LibStatut($status, 0).
'</td>';
260 $result .=
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
261 $result .=
"</tr>\n";
265 if ($conf->use_javascript_ajax) {
267 $result .=
'<td align="center" colspan="2">';
269 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
271 $dolgraph->SetData($dataseries);
272 $dolgraph->SetDataColor(array_values($colorseries));
273 $dolgraph->setShowLegend(2);
274 $dolgraph->setShowPercent(1);
275 $dolgraph->SetType(array(
'pie'));
276 $dolgraph->setHeight(
'150');
277 $dolgraph->setWidth(
'300');
278 $dolgraph->draw(
'idgraphthirdparties');
279 $result .= $dolgraph->show($total ? 0 : 1);
293 $result .=
'<tr class="liste_total">';
294 $result .=
'<td>'.$langs->trans(
"Total").
'</td>';
295 $result .=
'<td class="right">'.$total.
'</td>';
298 $result .=
'</table>';
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage proposals.
const STATUS_DRAFT
Draft status.
const STATUS_SIGNED
Signed quote.
const STATUS_NOTSIGNED
Not signed quote.
const STATUS_BILLED
Billed or processed quote.
const STATUS_VALIDATED
Validated status.
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.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
isModEnabled($module)
Is Dolibarr module enabled.
propal_admin_prepare_head()
Return array head with list of tabs to view object informations.
getCustomerProposalPieChart($socid=0)
Return a HTML table that contains a pie chart of customer proposals.
propal_prepare_head($object)
Prepare array with list of tabs.