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;
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";
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$sql .=
" WHERE s.fk_stcomm = st.id";
84$sql .=
" AND s.client IN (2, 3)";
85$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
88if (!$user->hasRight(
'societe',
'client',
'voir')) {
89 $search_sale = $user->id;
92if ($search_sale && $search_sale !=
'-1') {
93 if ($search_sale == -2) {
94 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
95 } elseif ($search_sale > 0) {
96 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user = ".((int) $search_sale).
")";
101 $sql .=
" AND s.rowid = ".((int) $socid);
103$sql .=
" GROUP BY st.id";
104$sql .=
" ORDER BY st.id";
106$resql = $db->query($sql);
108 $num = $db->num_rows($resql);
111 print
'<table class="noborder centpercent">';
112 print
'<tr class="liste_titre">';
113 print
'<td colspan="2">'.$langs->trans(
"ProspectsByStatus").
'</td></tr>';
115 $obj = $db->fetch_object($resql);
117 print
'<tr class="oddeven"><td>';
118 print
'<a href="prospects.php?page=0&stcomm='.$obj->id.
'">';
119 print
img_action($langs->trans(
"Show"), $obj->id, $obj->picto).
' ';
120 print $langs->trans(
"StatusProspect".$obj->id);
121 print
'</a></td><td class="right">'.$obj->cc.
'</td></tr>';
124 print
"</table><br>";
132if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
133 $sql =
"SELECT p.rowid, p.ref, p.price, s.nom as sname";
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
135 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
136 $sql .=
" WHERE p.fk_statut = 0";
137 $sql .=
" AND p.fk_soc = s.rowid";
138 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
141 if (!$user->hasRight(
'societe',
'client',
'voir')) {
142 $search_sale = $user->id;
145 if ($search_sale && $search_sale !=
'-1') {
146 if ($search_sale == -2) {
147 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
148 } elseif ($search_sale > 0) {
149 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user = ".((int) $search_sale).
")";
154 $sql .=
" AND s.rowid = ".((int) $socid);
157 $resql = $db->query($sql);
160 $num = $db->num_rows($resql);
163 print
'<table class="noborder"" width="100%">';
164 print
'<tr class="liste_titre">';
165 print
'<td colspan="2">'.$langs->trans(
"ProposalsDraft").
'</td></tr>';
168 $obj = $db->fetch_object($resql);
170 print
'<tr class="oddeven"><td>';
171 print
'<a href="'.DOL_URL_ROOT.
'/comm/propal/card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a>';
172 print
'</td><td class="right">';
173 print
price($obj->price);
176 $total += $obj->price;
179 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
"</td><td align=\"right\">".
price($total).
"</td></tr>";
181 print
"</table><br>";
188print
'</div><div class="fichetwothirdright">';
194if (isModEnabled(
'agenda')) {
201if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
202 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
203 $sql .=
" p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
204 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
205 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
206 $sql .=
", ".MAIN_DB_PREFIX.
"c_propalst as c";
207 $sql .=
" WHERE p.fk_soc = s.rowid";
208 $sql .=
" AND p.fk_statut = c.id";
209 $sql .=
" AND p.fk_statut = 1";
210 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
213 if (!$user->hasRight(
'societe',
'client',
'voir')) {
214 $search_sale = $user->id;
217 if ($search_sale && $search_sale !=
'-1') {
218 if ($search_sale == -2) {
219 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
220 } elseif ($search_sale > 0) {
221 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
226 $sql .=
" AND p.fk_soc = ".((int) $socid);
228 $sql .=
" ORDER BY p.rowid DESC";
229 $sql .= $db->plimit(5, 0);
231 $resql = $db->query($sql);
234 $num = $db->num_rows($resql);
237 print
'<table class="noborder centpercent">';
238 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"ProposalsOpened").
'</td></tr>';
241 $obj = $db->fetch_object($resql);
243 print
'<tr class="oddeven"><td>';
244 print
'<a href="../propal.php?id='.$obj->propalid.
'">';
245 print
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a></td>';
248 $companystatic->id = $obj->socid;
249 $companystatic->name = $obj->name;
250 $companystatic->client = $obj->client;
251 $companystatic->canvas = $obj->canvas;
252 print $companystatic->getNomUrl(1,
'', 44);
254 print
"<td align=\"right\">";
256 print
"<td align=\"right\">".price($obj->total_ttc).
"</td></tr>\n";
258 $total += $obj->price;
261 print
'<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans(
"Total").
"</td><td class=\"right\">".
price($total).
"</td></tr>";
263 print
"</table><br>";
273$sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
274$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
275$sql .=
" WHERE s.fk_stcomm = 1";
276$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
279if (!$user->hasRight(
'societe',
'client',
'voir')) {
280 $search_sale = $user->id;
283if ($search_sale && $search_sale !=
'-1') {
284 if ($search_sale == -2) {
285 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
286 } elseif ($search_sale > 0) {
287 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user = ".((int) $search_sale).
")";
292 $sql .=
" AND s.rowid = ".((int) $socid);
294$sql .=
" ORDER BY s.tms ASC";
295$sql .= $db->plimit(15, 0);
297$resql = $db->query($sql);
299 $num = $db->num_rows($resql);
302 print
'<table class="noborder centpercent">';
303 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ProspectToContact").
'</td></tr>';
306 $obj = $db->fetch_object($resql);
308 print
'<tr class="oddeven"><td width="12%">';
309 $companystatic->id = $obj->socid;
310 $companystatic->name = $obj->name;
311 $companystatic->client = $obj->client;
312 $companystatic->canvas = $obj->canvas;
313 print $companystatic->getNomUrl(1,
'prospect', 44);
317 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.