27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
31 $langs->load(
"propal");
36 $socid = $user->socid;
45 $companystatic =
new Societe($db);
53 print '<div class="fichecenter"><div class="fichethirdleft">';
56 if (!empty($conf->propal->enabled))
59 print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/propal/card.php">';
60 print
'<input type="hidden" name="token" value="'.newToken().
'">';
61 print
'<table class="noborder nohover centpercent">';
62 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"SearchAProposal").
'</td></tr>';
63 print
'<tr class="oddeven"><td>';
64 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>';
65 print
'<tr class="oddeven"><td class="nowrap">'.$langs->trans(
"Other").
':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
67 print
"</table></form><br>\n";
75 $sql =
"SELECT count(*) as cc, st.libelle, st.picto, st.id";
76 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
77 $sql .=
", ".MAIN_DB_PREFIX.
"c_stcomm as st ";
78 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
79 $sql .=
" WHERE s.fk_stcomm = st.id";
80 $sql .=
" AND s.client IN (2, 3)";
81 $sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
82 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
83 $sql .=
" GROUP BY st.id";
84 $sql .=
" ORDER BY st.id";
89 $num = $db->num_rows(
$resql);
93 print
'<table class="noborder centpercent">';
94 print
'<tr class="liste_titre">';
95 print
'<td colspan="2">'.$langs->trans(
"ProspectsByStatus").
'</td></tr>';
98 $obj = $db->fetch_object(
$resql);
100 print
'<tr class="oddeven"><td>';
101 print
'<a href="prospects.php?page=0&stcomm='.$obj->id.
'">';
102 print
img_action($langs->trans(
"Show"), $obj->id, $obj->picto).
' ';
103 print $langs->trans(
"StatusProspect".$obj->id);
104 print
'</a></td><td class="right">'.$obj->cc.
'</td></tr>';
107 print
"</table><br>";
115 if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
117 $sql =
"SELECT p.rowid, p.ref, p.price, s.nom as sname";
118 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
119 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
120 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
121 $sql .=
" WHERE p.fk_statut = 0";
122 $sql .=
" AND p.fk_soc = s.rowid";
123 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
124 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
126 $resql = $db->query($sql);
130 $num = $db->num_rows(
$resql);
134 print
'<table class="noborder"" width="100%">';
135 print
'<tr class="liste_titre">';
136 print
'<td colspan="2">'.$langs->trans(
"ProposalsDraft").
'</td></tr>';
140 $obj = $db->fetch_object(
$resql);
142 print
'<tr class="oddeven"><td>';
143 print
'<a href="'.DOL_URL_ROOT.
'/comm/propal/card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a>';
144 print
'</td><td class="right">';
145 print
price($obj->price);
148 $total += $obj->price;
151 print
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
"</td><td align=\"right\">".
price($total).
"</td></tr>";
153 print
"</table><br>";
161 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
172 if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
174 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
175 $sql .=
" p.rowid as propalid, p.total as total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
176 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
177 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
178 $sql .=
", ".MAIN_DB_PREFIX.
"c_propalst as c";
179 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
180 $sql .=
" WHERE p.fk_soc = s.rowid";
181 $sql .=
" AND p.fk_statut = c.id";
182 $sql .=
" AND p.fk_statut = 1";
183 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
184 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
185 if ($socid) $sql .=
" AND s.rowid = ".$socid;
186 $sql .=
" ORDER BY p.rowid DESC";
187 $sql .= $db->plimit(5, 0);
189 $resql = $db->query($sql);
193 $num = $db->num_rows(
$resql);
197 print
'<table class="noborder centpercent">';
198 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"ProposalsOpened").
'</td></tr>';
202 $obj = $db->fetch_object(
$resql);
204 print
'<tr class="oddeven"><td>';
205 print
'<a href="../propal.php?id='.$obj->propalid.
'">';
206 print
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$obj->ref.
'</a></td>';
209 $companystatic->id = $obj->socid;
210 $companystatic->name = $obj->name;
211 $companystatic->client = $obj->client;
212 $companystatic->canvas = $obj->canvas;
213 print $companystatic->getNomUrl(1,
'', 44);
215 print
"<td align=\"right\">";
217 print
"<td align=\"right\">".price($obj->total_ttc).
"</td></tr>\n";
219 $total += $obj->price;
223 print
'<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans(
"Total").
"</td><td class=\"right\">".
price($total).
"</td></tr>";
225 print
"</table><br>";
236 $sql =
"SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
237 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
238 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
239 $sql .=
" WHERE s.fk_stcomm = 1";
240 $sql .=
" AND s.entity IN (".getEntity($companystatic->element).
")";
241 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
242 $sql .=
" ORDER BY s.tms ASC";
243 $sql .= $db->plimit(15, 0);
245 $resql = $db->query($sql);
248 $num = $db->num_rows(
$resql);
252 print
'<table class="noborder centpercent">';
253 print
'<tr class="liste_titre"><td>'.$langs->trans(
"ProspectToContact").
'</td></tr>';
257 $obj = $db->fetch_object(
$resql);
259 print
'<tr class="oddeven"><td width="12%">';
260 $companystatic->id = $obj->socid;
261 $companystatic->name = $obj->name;
262 $companystatic->client = $obj->client;
263 $companystatic->canvas = $obj->canvas;
264 print $companystatic->getNomUrl(1,
'prospect', 44);
268 print
"</table><br>";
274 print
'</div></div></div>';
img_action($titlealt, $numaction, $picto= '')
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...
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.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
print
Draft customers invoices.
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(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
show_array_actions_to_do($max=5)
Show actions to do array.