28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
32$langs->load(
"propal");
34if ($user->socid > 0) {
35 $socid = $user->socid;
39$socid =
GETPOST(
'socid',
'int');
42 $socid = $user->socid;
52$companystatic =
new Societe($db);
60print
'<div class="fichecenter"><div class="fichethirdleft">';
63if (isModEnabled(
"propal")) {
65 print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/propal/card.php">';
66 print
'<input type="hidden" name="token" value="'.newToken().
'">';
67 print
'<table class="noborder nohover centpercent">';
68 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"SearchAProposal").
'</td></tr>';
69 print
'<tr class="oddeven"><td>';
70 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>';
71 print
'<tr class="oddeven"><td class="nowrap">'.$langs->trans(
"Other").
':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
73 print
"</table></form><br>\n";
81$sql =
"SELECT count(*) as cc, st.libelle as stcomm, st.picto, st.id";
82$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
83$sql .=
", ".MAIN_DB_PREFIX.
"c_stcomm as st ";
84if (empty($user->rights->societe->client->voir) && !$socid) {
85 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
87$sql .=
" WHERE s.fk_stcomm = st.id";
88$sql .=
" AND s.client IN (2, 3)";
89$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
90if (empty($user->rights->societe->client->voir) && !$socid) {
91 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
93$sql .=
" GROUP BY st.id";
94$sql .=
" ORDER BY st.id";
96$resql = $db->query($sql);
98 $num = $db->num_rows($resql);
101 print
'<table class="noborder centpercent">';
102 print
'<tr class="liste_titre">';
103 print
'<td colspan="2">'.$langs->trans(
"ProspectsByStatus").
'</td></tr>';
105 $obj = $db->fetch_object($resql);
107 print
'<tr class="oddeven"><td>';
108 print
'<a href="prospects.php?page=0&stcomm='.$obj->id.
'">';
109 print
img_action($langs->trans(
"Show"), $obj->id, $obj->picto).
' ';
110 print $langs->trans(
"StatusProspect".$obj->id);
111 print
'</a></td><td class="right">'.$obj->cc.
'</td></tr>';
114 print
"</table><br>";
122if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
123 $sql =
"SELECT p.rowid, p.ref, p.price, s.nom as sname";
124 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
125 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
126 if (empty($user->rights->societe->client->voir) && !$socid) {
127 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
129 $sql .=
" WHERE p.fk_statut = 0";
130 $sql .=
" AND p.fk_soc = s.rowid";
131 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
132 if (empty($user->rights->societe->client->voir) && !$socid) {
133 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
136 $resql = $db->query($sql);
139 $num = $db->num_rows($resql);
142 print
'<table class="noborder"" width="100%">';
143 print
'<tr class="liste_titre">';
144 print
'<td colspan="2">'.$langs->trans(
"ProposalsDraft").
'</td></tr>';
147 $obj = $db->fetch_object($resql);
149 print
'<tr class="oddeven"><td>';
150 print
'<a href="'.DOL_URL_ROOT.
'/comm/propal/card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a>';
151 print
'</td><td class="right">';
152 print
price($obj->price);
155 $total += $obj->price;
158 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
"</td><td align=\"right\">".
price($total).
"</td></tr>";
160 print
"</table><br>";
167print
'</div><div class="fichetwothirdright">';
173if (isModEnabled(
'agenda')) {
180if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
181 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
182 $sql .=
" p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
183 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
184 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
185 $sql .=
", ".MAIN_DB_PREFIX.
"c_propalst as c";
186 if (empty($user->rights->societe->client->voir) && !$socid) {
187 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
189 $sql .=
" WHERE p.fk_soc = s.rowid";
190 $sql .=
" AND p.fk_statut = c.id";
191 $sql .=
" AND p.fk_statut = 1";
192 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
193 if (empty($user->rights->societe->client->voir) && !$socid) {
194 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
197 $sql .=
" AND s.rowid = ".((int) $socid);
199 $sql .=
" ORDER BY p.rowid DESC";
200 $sql .= $db->plimit(5, 0);
202 $resql = $db->query($sql);
205 $num = $db->num_rows($resql);
208 print
'<table class="noborder centpercent">';
209 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"ProposalsOpened").
'</td></tr>';
212 $obj = $db->fetch_object($resql);
214 print
'<tr class="oddeven"><td>';
215 print
'<a href="../propal.php?id='.$obj->propalid.
'">';
216 print
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a></td>';
219 $companystatic->id = $obj->socid;
220 $companystatic->name = $obj->name;
221 $companystatic->client = $obj->client;
222 $companystatic->canvas = $obj->canvas;
223 print $companystatic->getNomUrl(1,
'', 44);
225 print
"<td align=\"right\">";
227 print
"<td align=\"right\">".price($obj->total_ttc).
"</td></tr>\n";
229 $total += $obj->price;
232 print
'<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans(
"Total").
"</td><td class=\"right\">".
price($total).
"</td></tr>";
234 print
"</table><br>";
245$sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
246$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
247if (empty($user->rights->societe->client->voir) && !$socid) {
248 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
250$sql .=
" WHERE s.fk_stcomm = 1";
251$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
252if (empty($user->rights->societe->client->voir) && !$socid) {
253 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
255$sql .=
" ORDER BY s.tms ASC";
256$sql .= $db->plimit(15, 0);
258$resql = $db->query($sql);
260 $num = $db->num_rows($resql);
263 print
'<table class="noborder centpercent">';
264 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ProspectToContact").
'</td></tr>';
267 $obj = $db->fetch_object($resql);
269 print
'<tr class="oddeven"><td width="12%">';
270 $companystatic->id = $obj->socid;
271 $companystatic->name = $obj->name;
272 $companystatic->client = $obj->client;
273 $companystatic->canvas = $obj->canvas;
274 print $companystatic->getNomUrl(1,
'prospect', 44);
278 print
"</table><br>";
show_array_actions_to_do($max=5)
Show actions to do array.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
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.
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)
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.