Go to the documentation of this file.
27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
31 $langs->load(
"propal");
33 if ($user->socid > 0) {
34 $socid = $user->socid;
38 $socid =
GETPOST(
'socid',
'int');
41 $socid = $user->socid;
51 $companystatic =
new Societe($db);
59 print
'<div class="fichecenter"><div class="fichethirdleft">';
62 if (!empty($conf->propal->enabled)) {
64 print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/propal/card.php">';
65 print
'<input type="hidden" name="token" value="'.newToken().
'">';
66 print
'<table class="noborder nohover centpercent">';
67 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"SearchAProposal").
'</td></tr>';
68 print
'<tr class="oddeven"><td>';
69 print $langs->trans(
"Ref").
':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
70 print
'<tr class="oddeven"><td class="nowrap">'.$langs->trans(
"Other").
':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
72 print
"</table></form><br>\n";
80 $sql =
"SELECT count(*) as cc, st.libelle as stcomm, st.picto, st.id";
81 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
82 $sql .=
", ".MAIN_DB_PREFIX.
"c_stcomm as st ";
83 if (empty($user->rights->societe->client->voir) && !$socid) {
84 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
86 $sql .=
" WHERE s.fk_stcomm = st.id";
87 $sql .=
" AND s.client IN (2, 3)";
88 $sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
89 if (empty($user->rights->societe->client->voir) && !$socid) {
90 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
92 $sql .=
" GROUP BY st.id";
93 $sql .=
" ORDER BY st.id";
97 $num = $db->num_rows(
$resql);
100 print
'<table class="noborder centpercent">';
101 print
'<tr class="liste_titre">';
102 print
'<td colspan="2">'.$langs->trans(
"ProspectsByStatus").
'</td></tr>';
104 $obj = $db->fetch_object(
$resql);
106 print
'<tr class="oddeven"><td>';
107 print
'<a href="prospects.php?page=0&stcomm='.$obj->id.
'">';
108 print
img_action($langs->trans(
"Show"), $obj->id, $obj->picto).
' ';
109 print $langs->trans(
"StatusProspect".$obj->id);
110 print
'</a></td><td class="right">'.$obj->cc.
'</td></tr>';
113 print
"</table><br>";
121 if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
122 $sql =
"SELECT p.rowid, p.ref, p.price, s.nom as sname";
123 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
124 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
125 if (empty($user->rights->societe->client->voir) && !$socid) {
126 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
128 $sql .=
" WHERE p.fk_statut = 0";
129 $sql .=
" AND p.fk_soc = s.rowid";
130 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
131 if (empty($user->rights->societe->client->voir) && !$socid) {
132 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
135 $resql = $db->query($sql);
138 $num = $db->num_rows(
$resql);
141 print
'<table class="noborder"" width="100%">';
142 print
'<tr class="liste_titre">';
143 print
'<td colspan="2">'.$langs->trans(
"ProposalsDraft").
'</td></tr>';
146 $obj = $db->fetch_object(
$resql);
148 print
'<tr class="oddeven"><td>';
149 print
'<a href="'.DOL_URL_ROOT.
'/comm/propal/card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a>';
150 print
'</td><td class="right">';
151 print
price($obj->price);
154 $total += $obj->price;
157 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
"</td><td align=\"right\">".
price($total).
"</td></tr>";
159 print
"</table><br>";
166 print
'</div><div class="fichetwothirdright">';
179 if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
180 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
181 $sql .=
" p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
182 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
183 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
184 $sql .=
", ".MAIN_DB_PREFIX.
"c_propalst as c";
185 if (empty($user->rights->societe->client->voir) && !$socid) {
186 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
188 $sql .=
" WHERE p.fk_soc = s.rowid";
189 $sql .=
" AND p.fk_statut = c.id";
190 $sql .=
" AND p.fk_statut = 1";
191 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
192 if (empty($user->rights->societe->client->voir) && !$socid) {
193 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
196 $sql .=
" AND s.rowid = ".((int) $socid);
198 $sql .=
" ORDER BY p.rowid DESC";
199 $sql .= $db->plimit(5, 0);
201 $resql = $db->query($sql);
204 $num = $db->num_rows(
$resql);
207 print
'<table class="noborder centpercent">';
208 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"ProposalsOpened").
'</td></tr>';
211 $obj = $db->fetch_object(
$resql);
213 print
'<tr class="oddeven"><td>';
214 print
'<a href="../propal.php?id='.$obj->propalid.
'">';
215 print
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a></td>';
218 $companystatic->id = $obj->socid;
219 $companystatic->name = $obj->name;
220 $companystatic->client = $obj->client;
221 $companystatic->canvas = $obj->canvas;
222 print $companystatic->getNomUrl(1,
'', 44);
224 print
"<td align=\"right\">";
226 print
"<td align=\"right\">".price($obj->total_ttc).
"</td></tr>\n";
228 $total += $obj->price;
231 print
'<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans(
"Total").
"</td><td class=\"right\">".
price($total).
"</td></tr>";
233 print
"</table><br>";
244 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
245 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
246 if (empty($user->rights->societe->client->voir) && !$socid) {
247 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
249 $sql .=
" WHERE s.fk_stcomm = 1";
250 $sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
251 if (empty($user->rights->societe->client->voir) && !$socid) {
252 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
254 $sql .=
" ORDER BY s.tms ASC";
255 $sql .= $db->plimit(15, 0);
257 $resql = $db->query($sql);
259 $num = $db->num_rows(
$resql);
262 print
'<table class="noborder centpercent">';
263 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ProspectToContact").
'</td></tr>';
266 $obj = $db->fetch_object(
$resql);
268 print
'<tr class="oddeven"><td width="12%">';
269 $companystatic->id = $obj->socid;
270 $companystatic->name = $obj->name;
271 $companystatic->client = $obj->client;
272 $companystatic->canvas = $obj->canvas;
273 print $companystatic->getNomUrl(1,
'prospect', 44);
277 print
"</table><br>";
282 print
'</div></div>';
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=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.
img_action($titlealt, $numaction, $picto='')
Show logo action.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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.
show_array_actions_to_do($max=5)
Show actions to do array.