add costprice in fields of the list
This commit is contained in:
parent
93fea8591c
commit
c370241afd
@ -43,7 +43,7 @@ if (!empty($conf->categorie->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('products', 'stocks', 'suppliers', 'companies'));
|
||||
$langs->loadLangs(array('products', 'stocks', 'suppliers', 'companies', 'margins'));
|
||||
if (!empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
@ -200,6 +200,7 @@ $arrayfields = array(
|
||||
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42),
|
||||
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
|
||||
'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
|
||||
'p.cost_price'=>array('label'=>$langs->trans("CostPrice"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45),
|
||||
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>50),
|
||||
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>51),
|
||||
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>52),
|
||||
@ -324,7 +325,7 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p
|
||||
$sql .= ' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
|
||||
$sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
|
||||
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,';
|
||||
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units,';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,';
|
||||
$sql .= ' MIN(pfp.unitprice) as minsellprice';
|
||||
@ -416,7 +417,7 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
|
||||
$sql .= " p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
|
||||
$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
|
||||
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.pmp, p.stock,';
|
||||
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.pmp, p.cost_price, p.stock,';
|
||||
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label';
|
||||
|
||||
@ -791,6 +792,13 @@ if ($resql)
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// cost_price
|
||||
if (!empty($arrayfields['p.cost_price']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Limit for alert
|
||||
if (!empty($arrayfields['p.seuil_stock_alerte']['checked']))
|
||||
{
|
||||
@ -919,6 +927,9 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.pmp']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
if (!empty($arrayfields['p.cost_price']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.cost_price']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
@ -1328,6 +1339,14 @@ if ($resql)
|
||||
print price($product_static->pmp, 1, $langs);
|
||||
print '</td>';
|
||||
}
|
||||
// cost_price
|
||||
if (!empty($arrayfields['p.cost_price']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
//print $obj->cost_price;
|
||||
print price($obj->cost_price).' '.$langs->trans("HT");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Limit alert
|
||||
if (!empty($arrayfields['p.seuil_stock_alerte']['checked']))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user