29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/propal.lib.php';
36$hookmanager->initHooks(array(
'proposalindex'));
39$langs->loadLangs(array(
'propal',
'companies'));
45$socid =
GETPOST(
'socid',
'int');
46if (isset($user->socid) && $user->socid > 0) {
48 $socid = $user->socid;
58$propalstatic =
new Propal($db);
59$companystatic =
new Societe($db);
62$help_url =
"EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|ES:Módulo_Presupuestos";
64llxHeader(
"", $langs->trans(
"ProspectionArea"), $help_url);
68print
'<div class="fichecenter">';
69print
'<div class="fichethirdleft">';
80if (isModEnabled(
"propal")) {
81 $sql =
"SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc";
82 $sql .=
", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.email, s.entity, s.code_compta";
83 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
84 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
85 if (empty($user->rights->societe->client->voir) && !$socid) {
86 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
88 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
89 $sql .=
" AND p.fk_soc = s.rowid";
90 $sql .=
" AND p.fk_statut =".Propal::STATUS_DRAFT;
91 if (empty($user->rights->societe->client->voir) && !$socid) {
92 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
95 $sql .=
" AND p.fk_soc = ".((int) $socid);
98 $resql = $db->query($sql);
100 $num = $db->num_rows($resql);
101 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
108 while ($i < $nbofloop) {
109 $obj = $db->fetch_object($resql);
111 $propalstatic->id = $obj->rowid;
112 $propalstatic->ref = $obj->ref;
113 $propalstatic->ref_client = $obj->ref_client;
114 $propalstatic->total_ht = $obj->total_ht;
115 $propalstatic->total_tva = $obj->total_tva;
116 $propalstatic->total_ttc = $obj->total_ttc;
118 $companystatic->id = $obj->socid;
119 $companystatic->name = $obj->name;
120 $companystatic->client = $obj->client;
121 $companystatic->code_client = $obj->code_client;
122 $companystatic->code_fournisseur = $obj->code_fournisseur;
123 $companystatic->canvas = $obj->canvas;
124 $companystatic->entity = $obj->entity;
125 $companystatic->email = $obj->email;
126 $companystatic->code_compta = $obj->code_compta;
128 print
'<tr class="oddeven">';
129 print
'<td class="nowrap">'.$propalstatic->getNomUrl(1).
'</td>';
130 print
'<td class="nowrap">'.$companystatic->getNomUrl(1,
'customer', 16).
'</td>';
131 print
'<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
135 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
149print
'<div class="fichetwothirdright">';
155$sql =
"SELECT c.rowid, c.entity, c.ref, c.fk_statut, date_cloture as datec";
156$sql .=
", s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta";
157$sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as c";
158$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
159if (empty($user->rights->societe->client->voir) && !$socid) {
160 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
162$sql .=
" WHERE c.entity IN (".getEntity($propalstatic->element).
")";
163$sql .=
" AND c.fk_soc = s.rowid";
166 $sql .=
" AND c.fk_soc = ".((int) $socid);
168if (empty($user->rights->societe->client->voir) && !$socid) {
169 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
171$sql .=
" ORDER BY c.tms DESC";
172$sql .= $db->plimit($max, 0);
174$resql = $db->query($sql);
176 $num = $db->num_rows($resql);
182 $obj = $db->fetch_object($resql);
184 $propalstatic->id = $obj->rowid;
185 $propalstatic->ref = $obj->ref;
187 $companystatic->id = $obj->socid;
188 $companystatic->name = $obj->socname;
189 $companystatic->client = $obj->client;
190 $companystatic->canvas = $obj->canvas;
191 $companystatic->email = $obj->email;
192 $companystatic->code_compta = $obj->code_compta;
196 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
198 print
'<tr class="oddeven">';
200 print
'<td width="20%" class="nowrap">';
201 print
'<table class="nobordernopadding">';
202 print
'<tr class="nocellnopadd">';
203 print
'<td width="96" class="nobordernopadding nowrap">'.$propalstatic->getNomUrl(1).
'</td>';
204 print
'<td width="16" class="nobordernopadding nowrap"></td>';
205 print
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).
'</td>';
210 print
'<td>'.$companystatic->getNomUrl(1,
'customer').
'</td>';
211 print
'<td>'.dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
212 print
'<td class="right">'.$propalstatic->LibStatut($obj->fk_statut, 3).
'</td>';
230if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
231 $sql =
"SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta";
232 $sql .=
", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
233 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
234 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
235 if (empty($user->rights->societe->client->voir) && !$socid) {
236 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
238 $sql .=
" WHERE p.fk_soc = s.rowid";
239 $sql .=
" AND p.entity IN (".getEntity($propalstatic->element).
")";
240 $sql .=
" AND p.fk_statut = ".Propal::STATUS_VALIDATED;
241 if (empty($user->rights->societe->client->voir) && !$socid) {
242 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
245 $sql .=
" AND s.rowid = ".((int) $socid);
247 $sql .=
" ORDER BY p.rowid DESC";
249 $resql = $db->query($sql);
252 $num = $db->num_rows($resql);
253 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
258 while ($i < $nbofloop) {
259 $obj = $db->fetch_object($resql);
261 $propalstatic->id = $obj->propalid;
262 $propalstatic->ref = $obj->ref;
264 $companystatic->id = $obj->socid;
265 $companystatic->name = $obj->socname;
266 $companystatic->client = $obj->client;
267 $companystatic->canvas = $obj->canvas;
268 $companystatic->email = $obj->email;
269 $companystatic->code_compta = $obj->code_compta;
273 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->propalid;
275 $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ?
img_warning($langs->trans(
"Late")) :
'';
277 print
'<tr class="oddeven">';
280 print
'<td class="nowrap" width="140">';
281 print
'<table class="nobordernopadding">';
282 print
'<tr class="nocellnopadd">';
283 print
'<td class="nobordernopadding nowrap">'.$propalstatic->getNomUrl(1).
'</td>';
284 print
'<td width="18" class="nobordernopadding nowrap">'.$warning.
'</td>';
285 print
'<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).
'</td>';
290 print
'<td class="left">'.$companystatic->getNomUrl(1,
'customer', 44).
'</td>';
291 print
'<td class="right">'.dol_print_date($db->jdate($obj->dp),
'day').
'</td>';
292 print
'<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
293 print
'<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).
'</td>';
298 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
462$parameters = array(
'user' => $user);
463$reshook = $hookmanager->executeHooks(
'dashboardPropals', $parameters, $object);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage proposals.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage third parties objects (customers, suppliers, prospects...)
finishSimpleTable($addLineBreak=false)
Add the correct HTML close tags for "startSimpleTable(...)" (use after the last table line)
startSimpleTable($header, $link="", $arguments="", $emptyRows=0, $number=-1)
Start a table with headers and a optinal clickable number (don't forget to use "finishSimpleTable()" ...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
addSummaryTableLine($tableColumnCount, $num, $nbofloop=0, $total=0, $noneWord="None", $extraRightColumn=false)
Add a summary line to the current open table ("None", "XMoreLines" or "Total xxx")
getCustomerProposalPieChart($socid=0)
Return a HTML table that contains a pie chart of customer proposals.
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.