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
|
||||||
|
|||||||
@ -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>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user