Fix statistics on products
This commit is contained in:
parent
811b0d9af4
commit
b92980c6ff
@ -25,11 +25,13 @@ ProductAccountancySellCode=Accountancy code (sale)
|
|||||||
ProductOrService=Product or Service
|
ProductOrService=Product or Service
|
||||||
ProductsAndServices=Products and Services
|
ProductsAndServices=Products and Services
|
||||||
ProductsOrServices=Products or Services
|
ProductsOrServices=Products or Services
|
||||||
ProductsOnSell=Product for sale or for purchase
|
ProductsOnSaleOnly=Products for sale only
|
||||||
|
ProductsOnPurchaseOnly=Product for purchase only
|
||||||
ProductsNotOnSell=Product not for sale and not for purchase
|
ProductsNotOnSell=Product not for sale and not for purchase
|
||||||
ProductsOnSellAndOnBuy=Products for sale and for purchase
|
ProductsOnSellAndOnBuy=Products for sale and for purchase
|
||||||
ServicesOnSell=Services for sale or for purchase
|
ServicesOnSaleOnly=Services for sale only
|
||||||
ServicesNotOnSell=Services not for sale
|
ServicesOnPurchaseOnly=Services for purchase only
|
||||||
|
ServicesNotOnSell=Services not for sale and not for purchase
|
||||||
ServicesOnSellAndOnBuy=Services for sale and for purchase
|
ServicesOnSellAndOnBuy=Services for sale and for purchase
|
||||||
LastModifiedProductsAndServices=Latest %s modified products/services
|
LastModifiedProductsAndServices=Latest %s modified products/services
|
||||||
LastRecordedProducts=Latest %s recorded products
|
LastRecordedProducts=Latest %s recorded products
|
||||||
|
|||||||
@ -84,7 +84,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
{
|
{
|
||||||
$listofsearchfields['search_product']=array('text'=>'ProductOrService');
|
$listofsearchfields['search_product']=array('text'=>'ProductOrService');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($listofsearchfields))
|
if (count($listofsearchfields))
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||||
@ -100,7 +100,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
@ -111,7 +111,8 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
* Number of products and/or services
|
* Number of products and/or services
|
||||||
*/
|
*/
|
||||||
$prodser = array();
|
$prodser = array();
|
||||||
$prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0;
|
$prodser[0][0]=$prodser[0][1]=$prodser[0][2]=$prodser[0][3]=0;
|
||||||
|
$prodser[1][0]=$prodser[1][1]=$prodser[1][2]=$prodser[1][3]=0;
|
||||||
|
|
||||||
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
|
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
@ -120,9 +121,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
while ($objp = $db->fetch_object($result))
|
while ($objp = $db->fetch_object($result))
|
||||||
{
|
{
|
||||||
$status=2;
|
$status=3;
|
||||||
if (! $objp->tosell && ! $objp->tobuy) $status=0; // To sell OR to buy
|
if (! $objp->tosell && ! $objp->tobuy) $status=0; // Not on sale, not on purchase
|
||||||
if ((! $objp->tosell && $objp->tobuy) || ($objp->tosell && ! $objp->tobuy)) $status=1;
|
if ($objp->tosell && ! $objp->tobuy) $status=1; // On sale only
|
||||||
|
if (! $objp->tosell && $objp->tobuy) $status=2; // On purchase only
|
||||||
$prodser[$objp->fk_product_type][$status]=$objp->total;
|
$prodser[$objp->fk_product_type][$status]=$objp->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,10 +136,13 @@ if (! empty($conf->product->enabled))
|
|||||||
$statProducts.= '<td><a href="list.php?type=0&tosell=0&tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
|
$statProducts.= '<td><a href="list.php?type=0&tosell=0&tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
|
||||||
$statProducts.= "</tr>";
|
$statProducts.= "</tr>";
|
||||||
$statProducts.= '<tr class="oddeven">';
|
$statProducts.= '<tr class="oddeven">';
|
||||||
$statProducts.= '<td><a href="list.php?type=0">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
|
$statProducts.= '<td><a href="list.php?type=0">'.$langs->trans("ProductsOnSaleOnly").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
|
||||||
$statProducts.= "</tr>";
|
$statProducts.= "</tr>";
|
||||||
$statProducts.= '<tr class="oddeven">';
|
$statProducts.= '<tr class="oddeven">';
|
||||||
$statProducts.= '<td><a href="list.php?type=0&tosell=1&tobuy=1">'.$langs->trans("ProductsOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[0][2]).'</td>';
|
$statProducts.= '<td><a href="list.php?type=0">'.$langs->trans("ProductsOnPurchaseOnly").'</a></td><td align="right">'.round($prodser[0][2]).'</td>';
|
||||||
|
$statProducts.= "</tr>";
|
||||||
|
$statProducts.= '<tr class="oddeven">';
|
||||||
|
$statProducts.= '<td><a href="list.php?type=0&tosell=1&tobuy=1">'.$langs->trans("ProductsOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[0][3]).'</td>';
|
||||||
$statProducts.= "</tr>";
|
$statProducts.= "</tr>";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -147,10 +152,13 @@ if (! empty($conf->service->enabled))
|
|||||||
$statServices.= '<td><a href="list.php?type=1&tosell=0&tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
|
$statServices.= '<td><a href="list.php?type=1&tosell=0&tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
|
||||||
$statServices.= "</tr>";
|
$statServices.= "</tr>";
|
||||||
$statServices.= '<tr class="oddeven">';
|
$statServices.= '<tr class="oddeven">';
|
||||||
$statServices.= '<td><a href="list.php?type=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
|
$statServices.= '<td><a href="list.php?type=1">'.$langs->trans("ServicesOnSaleOnly").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
|
||||||
$statServices.= "</tr>";
|
$statServices.= "</tr>";
|
||||||
$statServices.= '<tr class="oddeven">';
|
$statServices.= '<tr class="oddeven">';
|
||||||
$statServices.= '<td><a href="list.php?type=1&tosell=1&tobuy=1">'.$langs->trans("ServicesOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[1][2]).'</td>';
|
$statServices.= '<td><a href="list.php?type=1">'.$langs->trans("ServicesOnPurchaseOnly").'</a></td><td align="right">'.round($prodser[1][2]).'</td>';
|
||||||
|
$statServices.= "</tr>";
|
||||||
|
$statServices.= '<tr class="oddeven">';
|
||||||
|
$statServices.= '<td><a href="list.php?type=1&tosell=1&tobuy=1">'.$langs->trans("ServicesOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[1][3]).'</td>';
|
||||||
$statServices.= "</tr>";
|
$statServices.= "</tr>";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -220,7 +228,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
|
print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
|
||||||
$total+=$obj->nb;
|
$total+=$obj->nb;
|
||||||
$i++;
|
$i++;
|
||||||
@ -292,7 +300,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$product_static->id=$objp->rowid;
|
$product_static->id=$objp->rowid;
|
||||||
@ -419,7 +427,7 @@ function activitytrim($product_type)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
@ -427,7 +435,7 @@ function activitytrim($product_type)
|
|||||||
{
|
{
|
||||||
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
||||||
print '<td align=right>'.price($trim1).'</td>';
|
print '<td align=right>'.price($trim1).'</td>';
|
||||||
print '<td align=right>'.price($trim2).'</td>';
|
print '<td align=right>'.price($trim2).'</td>';
|
||||||
@ -461,7 +469,7 @@ function activitytrim($product_type)
|
|||||||
}
|
}
|
||||||
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
||||||
print '<td align=right>'.price($trim1).'</td>';
|
print '<td align=right>'.price($trim1).'</td>';
|
||||||
print '<td align=right>'.price($trim2).'</td>';
|
print '<td align=right>'.price($trim2).'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user