NEW The probability of lead/opportunity can be defined per lead.
This commit is contained in:
parent
7aecc5ed95
commit
7c2ac4b3ee
@ -539,9 +539,10 @@ class FormProjets
|
|||||||
* @param int $showempty Add an empty line
|
* @param int $showempty Add an empty line
|
||||||
* @param int $useshortlabel Use short label
|
* @param int $useshortlabel Use short label
|
||||||
* @param int $showallnone Add choice "All" and "None"
|
* @param int $showallnone Add choice "All" and "None"
|
||||||
|
* @param int $showpercent Show default probability for status
|
||||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||||
*/
|
*/
|
||||||
function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0)
|
function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0, $showpercent=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -557,7 +558,7 @@ class FormProjets
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$sellist = '<select class="flat oppstatus" name="'.$htmlname.'">';
|
$sellist = '<select class="flat oppstatus" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
if ($showempty) $sellist.= '<option value="-1"></option>';
|
if ($showempty) $sellist.= '<option value="-1"></option>';
|
||||||
if ($showallnone) $sellist.= '<option value="all">--'.$langs->trans("Alls").'--</option>';
|
if ($showallnone) $sellist.= '<option value="all">--'.$langs->trans("Alls").'--</option>';
|
||||||
if ($showallnone) $sellist.= '<option value="none">--'.$langs->trans("None").'--</option>';
|
if ($showallnone) $sellist.= '<option value="none">--'.$langs->trans("None").'--</option>';
|
||||||
@ -565,7 +566,7 @@ class FormProjets
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$sellist .='<option value="'.$obj->rowid.'"';
|
$sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'"';
|
||||||
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
|
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
|
||||||
$sellist .= '>';
|
$sellist .= '>';
|
||||||
if ($useshortlabel)
|
if ($useshortlabel)
|
||||||
@ -575,7 +576,7 @@ class FormProjets
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
||||||
$finallabel.= ' ('.$obj->percent.'%)';
|
if ($showpercent) $finallabel.= ' ('.$obj->percent.'%)';
|
||||||
}
|
}
|
||||||
$sellist .= $finallabel;
|
$sellist .= $finallabel;
|
||||||
$sellist .='</option>';
|
$sellist .='</option>';
|
||||||
|
|||||||
@ -38,3 +38,5 @@ ALTER TABLE llx_cronjob MODIFY COLUMN unitfrequency varchar(255) NOT NULL DEFAUL
|
|||||||
|
|
||||||
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut);
|
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut);
|
||||||
|
|
||||||
|
UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_status as cls WHERE cls.rowid = p.fk_opp_status) WHERE p.opp_percent IS NULL AND p.fk_opp_status IS NOT NULL;
|
||||||
|
|
||||||
@ -132,6 +132,8 @@ TaskModifiedInDolibarr=Task %s modified
|
|||||||
TaskDeletedInDolibarr=Task %s deleted
|
TaskDeletedInDolibarr=Task %s deleted
|
||||||
OpportunityStatus=Opportunity status
|
OpportunityStatus=Opportunity status
|
||||||
OpportunityStatusShort=Opp. status
|
OpportunityStatusShort=Opp. status
|
||||||
|
OpportunityProbability=Opportunity probability
|
||||||
|
OpportunityProbabilityShort=Opp. probab.
|
||||||
OpportunityAmount=Opportunity amount
|
OpportunityAmount=Opportunity amount
|
||||||
OpportunityAmountShort=Opp. amount
|
OpportunityAmountShort=Opp. amount
|
||||||
##### Types de contacts #####
|
##### Types de contacts #####
|
||||||
@ -182,7 +184,7 @@ YouCanCompleteRef=If you want to complete the ref with some information (to use
|
|||||||
OpenedProjectsByThirdparties=Opened projects by thirdparties
|
OpenedProjectsByThirdparties=Opened projects by thirdparties
|
||||||
OpportunityTotalAmount=Opportunities total amount
|
OpportunityTotalAmount=Opportunities total amount
|
||||||
OpportunityPonderatedAmount=Opportunities weighted amount
|
OpportunityPonderatedAmount=Opportunities weighted amount
|
||||||
OpportunityPonderatedAmountDesc=Opportunities amount weighted with probability (depending on status of opportunity)
|
OpportunityPonderatedAmountDesc=Opportunities amount weighted with probability
|
||||||
OppStatusPROSP=Prospection
|
OppStatusPROSP=Prospection
|
||||||
OppStatusQUAL=Qualification
|
OppStatusQUAL=Qualification
|
||||||
OppStatusPROPO=Proposal
|
OppStatusPROPO=Proposal
|
||||||
|
|||||||
@ -42,6 +42,7 @@ $backtopage=GETPOST('backtopage','alpha');
|
|||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
$status=GETPOST('status','int');
|
$status=GETPOST('status','int');
|
||||||
$opp_status=GETPOST('opp_status','int');
|
$opp_status=GETPOST('opp_status','int');
|
||||||
|
$opp_percent=price2num(GETPOST('opp_percent','alpha'));
|
||||||
|
|
||||||
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
|
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
|
||||||
|
|
||||||
@ -145,6 +146,7 @@ if (empty($reshook))
|
|||||||
$object->date_end=$date_end;
|
$object->date_end=$date_end;
|
||||||
$object->statuts = $status;
|
$object->statuts = $status;
|
||||||
$object->opp_status = $opp_status;
|
$object->opp_status = $opp_status;
|
||||||
|
$object->opp_percent = $opp_percent;
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
@ -232,6 +234,7 @@ if (empty($reshook))
|
|||||||
if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount'));
|
if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount'));
|
||||||
if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount'));
|
if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount'));
|
||||||
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
|
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
|
||||||
|
if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent;
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
@ -505,6 +508,13 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
print $formproject->selectOpportunityStatus('opp_status',$object->opp_status);
|
print $formproject->selectOpportunityStatus('opp_status',$object->opp_status);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Opportunity probability
|
||||||
|
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
|
||||||
|
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(GETPOST('opp_percent')!=''?price(GETPOST('opp_percent')):'').'"> %';
|
||||||
|
print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.(GETPOST('opp_percent')!=''?'0':'1').'">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Opportunity amount
|
// Opportunity amount
|
||||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
||||||
print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOST('opp_amount')!=''?price(GETPOST('opp_amount')):'').'"></td>';
|
print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOST('opp_amount')!=''?price(GETPOST('opp_amount')):'').'"></td>';
|
||||||
@ -545,6 +555,22 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// Change probability from status
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function change_percent()
|
||||||
|
{
|
||||||
|
var element = jQuery("#opp_status option:selected");
|
||||||
|
var defaultpercent = element.attr("defaultpercent");
|
||||||
|
/*if (jQuery("#opp_percent_not_set").val() == "") */
|
||||||
|
jQuery("#opp_percent").val(defaultpercent);
|
||||||
|
}
|
||||||
|
/*init_myfunc();*/
|
||||||
|
jQuery("#opp_status").change(function() {
|
||||||
|
change_percent();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -670,15 +696,20 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Opportunity probability
|
||||||
|
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
|
||||||
|
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?price($object->opp_percent,0,$langs,1,0):'')).'"> %</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Opportunity amount
|
// Opportunity amount
|
||||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
||||||
print '<td><input size="5" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount):'')).'"></td>';
|
print '<td><input size="5" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount,0,$langs,1,0):'')).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td>';
|
||||||
print '<td><input size="5" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount):'')).'"></td>';
|
print '<td><input size="5" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount,0,$langs,1,0):'')).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
@ -750,15 +781,20 @@ else
|
|||||||
if ($code) print $langs->trans("OppStatus".$code);
|
if ($code) print $langs->trans("OppStatus".$code);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Opportunity percent
|
||||||
|
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
|
||||||
|
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Opportunity Amount
|
// Opportunity Amount
|
||||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
|
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
|
||||||
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
|
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||||
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency);
|
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
@ -788,6 +824,23 @@ else
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// Change probability from status
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function change_percent()
|
||||||
|
{
|
||||||
|
var element = jQuery("#opp_status option:selected");
|
||||||
|
var defaultpercent = element.attr("defaultpercent");
|
||||||
|
/*if (jQuery("#opp_percent_not_set").val() == "") */
|
||||||
|
jQuery("#opp_percent").val(defaultpercent);
|
||||||
|
}
|
||||||
|
/*init_myfunc();*/
|
||||||
|
jQuery("#opp_status").change(function() {
|
||||||
|
change_percent();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
|
|||||||
@ -236,6 +236,7 @@ class Project extends CommonObject
|
|||||||
$this->title = trim($this->title);
|
$this->title = trim($this->title);
|
||||||
$this->description = trim($this->description);
|
$this->description = trim($this->description);
|
||||||
if ($this->opp_amount < 0) $this->opp_amount='';
|
if ($this->opp_amount < 0) $this->opp_amount='';
|
||||||
|
if ($this->opp_percent < 0) $this->opp_percent='';
|
||||||
|
|
||||||
if (dol_strlen(trim($this->ref)) > 0)
|
if (dol_strlen(trim($this->ref)) > 0)
|
||||||
{
|
{
|
||||||
@ -247,7 +248,7 @@ class Project extends CommonObject
|
|||||||
$sql.= ", description = '" . $this->db->escape($this->description) . "'";
|
$sql.= ", description = '" . $this->db->escape($this->description) . "'";
|
||||||
$sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null");
|
$sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null");
|
||||||
$sql.= ", fk_statut = " . $this->statut;
|
$sql.= ", fk_statut = " . $this->statut;
|
||||||
$sql.= ", fk_opp_status = " . ($this->opp_status > 0 ? $this->opp_status : 'null');
|
$sql.= ", fk_opp_status = " . ((is_numeric($this->opp_status) && $this->opp_status != '') ? $this->opp_status : 'null');
|
||||||
$sql.= ", opp_percent = " . ((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null');
|
$sql.= ", opp_percent = " . ((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null');
|
||||||
$sql.= ", public = " . ($this->public ? 1 : 0);
|
$sql.= ", public = " . ($this->public ? 1 : 0);
|
||||||
$sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null');
|
$sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null');
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
$sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, p.fk_opp_status as opp_status";
|
$sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount, p.fk_opp_status as opp_status";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
$sql.= " AND p.fk_statut = 1";
|
$sql.= " AND p.fk_statut = 1";
|
||||||
@ -9,6 +9,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
$sql.= " GROUP BY p.fk_opp_status";
|
$sql.= " GROUP BY p.fk_opp_status";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -32,7 +33,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
$valsamount[$obj->opp_status]=$obj->opp_amount;
|
$valsamount[$obj->opp_status]=$obj->opp_amount;
|
||||||
$totalnb+=$obj->nb;
|
$totalnb+=$obj->nb;
|
||||||
$totalamount+=$obj->opp_amount;
|
$totalamount+=$obj->opp_amount;
|
||||||
$ponderated_opp_amount = $ponderated_opp_amount + price2num($listofoppstatus[$obj->opp_status] * $obj->opp_amount / 100);
|
$ponderated_opp_amount+=$obj->ponderated_opp_amount;
|
||||||
}
|
}
|
||||||
$total+=$row[0];
|
$total+=$row[0];
|
||||||
}
|
}
|
||||||
@ -40,6 +41,8 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
|
$ponderated_opp_amount = $ponderated_opp_amount / 100;
|
||||||
|
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<table class="noborder nohover" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'</td></tr>'."\n";
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'</td></tr>'."\n";
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -53,7 +56,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
|
if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
|
||||||
|
|
||||||
//$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
|
//$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
|
||||||
$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
|
//$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
|
||||||
|
|
||||||
$dataseries[]=array('label'=>$labelstatus,'data'=>(isset($valsamount[$status])?(float) $valsamount[$status]:0));
|
$dataseries[]=array('label'=>$labelstatus,'data'=>(isset($valsamount[$status])?(float) $valsamount[$status]:0));
|
||||||
if (! $conf->use_javascript_ajax)
|
if (! $conf->use_javascript_ajax)
|
||||||
@ -75,7 +78,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
//if ($totalinprocess != $total)
|
//if ($totalinprocess != $total)
|
||||||
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("OpportunityTotalAmount").'</td><td align="right">'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
print '<tr class="liste_total"><td>'.$langs->trans("OpportunityTotalAmount").'</td><td align="right">'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("OpportunityPonderatedAmount").'</td><td align="right">'.price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
print '<tr class="liste_total"><td>'.$langs->trans("OpportunityPonderatedAmount").'</td><td align="right">'.price(price2num($ponderated_opp_amount,'MT'), 0, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
@ -70,6 +70,7 @@ $search_year=GETPOST("search_year");
|
|||||||
$search_all=GETPOST("search_all");
|
$search_all=GETPOST("search_all");
|
||||||
$search_status=GETPOST("search_status",'int');
|
$search_status=GETPOST("search_status",'int');
|
||||||
$search_opp_status=GETPOST("search_opp_status",'alpha');
|
$search_opp_status=GETPOST("search_opp_status",'alpha');
|
||||||
|
$search_opp_percent=GETPOST("search_opp_percent",'alpha');
|
||||||
$search_public=GETPOST("search_public",'int');
|
$search_public=GETPOST("search_public",'int');
|
||||||
$search_user=GETPOST('search_user','int');
|
$search_user=GETPOST('search_user','int');
|
||||||
$search_sale=GETPOST('search_sale','int');
|
$search_sale=GETPOST('search_sale','int');
|
||||||
@ -128,6 +129,7 @@ $arrayfields=array(
|
|||||||
'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102),
|
'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102),
|
||||||
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103),
|
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103),
|
||||||
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104),
|
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104),
|
||||||
|
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>105),
|
||||||
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
@ -208,7 +210,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0';
|
|||||||
|
|
||||||
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
||||||
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
|
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
|
||||||
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.tms as date_update";
|
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update";
|
||||||
$sql.= ", s.nom as name, s.rowid as socid";
|
$sql.= ", s.nom as name, s.rowid as socid";
|
||||||
$sql.= ", cls.code as opp_status_code";
|
$sql.= ", cls.code as opp_status_code";
|
||||||
// Add fields for extrafields
|
// Add fields for extrafields
|
||||||
@ -311,6 +313,7 @@ if ($resql)
|
|||||||
if ($search_societe != '') $param.='&search_societe='.$search_societe;
|
if ($search_societe != '') $param.='&search_societe='.$search_societe;
|
||||||
if ($search_status >= 0) $param.='&search_status='.$search_status;
|
if ($search_status >= 0) $param.='&search_status='.$search_status;
|
||||||
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status);
|
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status);
|
||||||
|
if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent);
|
||||||
if ($search_public != '') $param.='&search_public='.$search_public;
|
if ($search_public != '') $param.='&search_public='.$search_public;
|
||||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||||
@ -393,6 +396,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'],$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
|
if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'],$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -475,6 +479,11 @@ if ($resql)
|
|||||||
print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1,1);
|
print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['p.opp_percent']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre nowrap">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -559,7 +568,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Sales Rapresentatives
|
// Sales Representatives
|
||||||
if (! empty($arrayfields['commercial']['checked']))
|
if (! empty($arrayfields['commercial']['checked']))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -623,7 +632,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['p.opp_amount']['checked']))
|
if (! empty($arrayfields['p.opp_amount']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, - 1, - 1, $conf->currency);
|
if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, -1, -1, $conf->currency);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
||||||
@ -632,6 +641,12 @@ if ($resql)
|
|||||||
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['p.opp_percent']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user