diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index d0a1fc5db76..b9a5c430b92 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -509,6 +509,7 @@ else print_liste_field_titre("Product", "", "p.ref", "&id=".$id, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", "", "p.label", "&id=".$id, "", "", $sortfield, $sortorder); print_liste_field_titre("Units", "", "ps.reel", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + if(!empty($conf->global->PRODUCT_USE_UNITS)) print_liste_field_titre("Unit","", "p.fk_unit","&id=".$id,"",'align="left"',$sortfield,$sortorder); print_liste_field_titre("AverageUnitPricePMPShort", "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("EstimatedStockValueShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); if (empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -530,6 +531,7 @@ else $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,"; $sql .= " ps.reel as value"; + if(!empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ",fk_unit"; $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE ps.fk_product = p.rowid"; $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) @@ -573,6 +575,7 @@ else $productstatic->type = $objp->type; $productstatic->entity = $objp->entity; $productstatic->status_batch = $objp->tobatch; + $productstatic->fk_unit=$objp->fk_unit; print $productstatic->getNomUrl(1, 'stock', 16); print ''; @@ -585,6 +588,13 @@ else print ''; $totalunit += $objp->value; + if(!empty($conf->global->PRODUCT_USE_UNITS)) { + // Units + print ''; + if(is_null($productstatic->fk_unit))$productstatic->fk_unit=1; + print $langs->trans($productstatic->getLabelOfUnit()); + print ''; + } // Price buy PMP print ''.price(price2num($objp->ppmp, 'MU')).''; @@ -620,15 +630,24 @@ else print ""; } - print ""; - $i++; - } - $db->free($resql); + if ($user->rights->stock->creer) { + print ''; + print $langs->trans("StockCorrection"); + print ""; + } + if(!empty($conf->global->PRODUCT_USE_UNITS)) { + if ($i == 0) $units = $productstatic->fk_unit; + elseif($productstatic->fk_unit !== $units) $sameunits = false; + } + print ""; + $i++; + } + $db->free($resql); print ''.$langs->trans("Total").''; - print ''; - $valtoshow = price2num($totalunit, 'MS'); - print empty($valtoshow) ? '0' : $valtoshow; + print ''; + $valtoshow=price2num($totalunit, 'MS'); + if(empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) print empty($valtoshow)?'0':$valtoshow; print ''; print ' '; print ''.price(price2num($totalvalue, 'MT')).'';