29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
41$langs->load(
"propal");
43if ($user->socid > 0) {
44 $socid = $user->socid;
51 $socid = $user->socid;
61$companystatic =
new Societe($db);
69print
'<div class="fichecenter"><div class="fichethirdleft">';
72if (isModEnabled(
"propal")) {
74 print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/propal/card.php">';
75 print
'<input type="hidden" name="token" value="'.newToken().
'">';
76 print
'<table class="noborder nohover centpercent">';
77 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"SearchAProposal").
'</td></tr>';
78 print
'<tr class="oddeven"><td>';
79 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>';
80 print
'<tr class="oddeven"><td class="nowrap">'.$langs->trans(
"Other").
':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
82 print
"</table></form><br>\n";
89$sql =
"SELECT count(*) as cc, st.libelle as stcomm, st.picto, st.id";
90$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
91$sql .=
", ".MAIN_DB_PREFIX.
"c_stcomm as st ";
92$sql .=
" WHERE s.fk_stcomm = st.id";
93$sql .=
" AND s.client IN (2, 3)";
94$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
97if (!$user->hasRight(
'societe',
'client',
'voir')) {
98 $search_sale = $user->id;
101if ($search_sale && $search_sale !=
'-1') {
102 if ($search_sale == -2) {
103 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
104 } elseif ($search_sale > 0) {
105 $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).
")";
110 $sql .=
" AND s.rowid = ".((int) $socid);
112$sql .=
" GROUP BY st.id";
113$sql .=
" ORDER BY st.id";
115$resql = $db->query($sql);
117 $num = $db->num_rows($resql);
120 print
'<table class="noborder centpercent">';
121 print
'<tr class="liste_titre">';
122 print
'<td colspan="2">'.$langs->trans(
"ProspectsByStatus").
'</td></tr>';
124 $obj = $db->fetch_object($resql);
126 print
'<tr class="oddeven"><td>';
127 print
'<a href="prospects.php?page=0&stcomm='.$obj->id.
'">';
128 print
img_action($langs->trans(
"Show"), $obj->id, $obj->picto).
' ';
129 print $langs->trans(
"StatusProspect".$obj->id);
130 print
'</a></td><td class="right">'.$obj->cc.
'</td></tr>';
133 print
"</table><br>";
141if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
142 $sql =
"SELECT p.rowid, p.ref, p.price, s.nom as sname";
143 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
144 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
145 $sql .=
" WHERE p.fk_statut = 0";
146 $sql .=
" AND p.fk_soc = s.rowid";
147 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
150 if (!$user->hasRight(
'societe',
'client',
'voir')) {
151 $search_sale = $user->id;
154 if ($search_sale && $search_sale !=
'-1') {
155 if ($search_sale == -2) {
156 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
157 } elseif ($search_sale > 0) {
158 $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).
")";
163 $sql .=
" AND s.rowid = ".((int) $socid);
166 $resql = $db->query($sql);
169 $num = $db->num_rows($resql);
172 print
'<table class="noborder"" width="100%">';
173 print
'<tr class="liste_titre">';
174 print
'<td colspan="2">'.$langs->trans(
"ProposalsDraft").
'</td></tr>';
177 $obj = $db->fetch_object($resql);
179 print
'<tr class="oddeven"><td>';
180 print
'<a href="'.DOL_URL_ROOT.
'/comm/propal/card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a>';
181 print
'</td><td class="right">';
182 print
price($obj->price);
185 $total += $obj->price;
188 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
"</td><td align=\"right\">".
price($total).
"</td></tr>";
190 print
"</table><br>";
197print
'</div><div class="fichetwothirdright">';
203if (isModEnabled(
'agenda')) {
210if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
211 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
212 $sql .=
" p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
213 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
214 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
215 $sql .=
", ".MAIN_DB_PREFIX.
"c_propalst as c";
216 $sql .=
" WHERE p.fk_soc = s.rowid";
217 $sql .=
" AND p.fk_statut = c.id";
218 $sql .=
" AND p.fk_statut = 1";
219 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
222 if (!$user->hasRight(
'societe',
'client',
'voir')) {
223 $search_sale = $user->id;
226 if ($search_sale && $search_sale !=
'-1') {
227 if ($search_sale == -2) {
228 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
229 } elseif ($search_sale > 0) {
230 $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).
")";
235 $sql .=
" AND p.fk_soc = ".((int) $socid);
237 $sql .=
" ORDER BY p.rowid DESC";
238 $sql .= $db->plimit(5, 0);
240 $resql = $db->query($sql);
243 $num = $db->num_rows($resql);
246 print
'<table class="noborder centpercent">';
247 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"ProposalsOpened").
'</td></tr>';
250 $obj = $db->fetch_object($resql);
252 print
'<tr class="oddeven"><td>';
253 print
'<a href="../propal.php?id='.$obj->propalid.
'">';
254 print
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a></td>';
257 $companystatic->id = $obj->socid;
258 $companystatic->name = $obj->name;
259 $companystatic->client = $obj->client;
260 $companystatic->canvas = $obj->canvas;
261 print $companystatic->getNomUrl(1,
'', 44);
263 print
"<td align=\"right\">";
265 print
"<td align=\"right\">".price($obj->total_ttc).
"</td></tr>\n";
267 $total += $obj->price;
270 print
'<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans(
"Total").
"</td><td class=\"right\">".
price($total).
"</td></tr>";
272 print
"</table><br>";
282$sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
283$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
284$sql .=
" WHERE s.fk_stcomm = 1";
285$sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
288if (!$user->hasRight(
'societe',
'client',
'voir')) {
289 $search_sale = $user->id;
292if ($search_sale && $search_sale !=
'-1') {
293 if ($search_sale == -2) {
294 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
295 } elseif ($search_sale > 0) {
296 $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).
")";
301 $sql .=
" AND s.rowid = ".((int) $socid);
303$sql .=
" ORDER BY s.tms ASC";
304$sql .= $db->plimit(15, 0);
306$resql = $db->query($sql);
308 $num = $db->num_rows($resql);
311 print
'<table class="noborder centpercent">';
312 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ProspectToContact").
'</td></tr>';
315 $obj = $db->fetch_object($resql);
317 print
'<tr class="oddeven"><td width="12%">';
318 $companystatic->id = $obj->socid;
319 $companystatic->name = $obj->name;
320 $companystatic->client = $obj->client;
321 $companystatic->canvas = $obj->canvas;
322 print $companystatic->getNomUrl(1,
'prospect', 44);
326 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.