Products states table fix
This commit is contained in:
@@ -14,7 +14,8 @@ require_once('modules/EcmProducts/Forms.php');
|
|||||||
require_once('include/time.php');
|
require_once('include/time.php');
|
||||||
require_once('include/json_config.php');
|
require_once('include/json_config.php');
|
||||||
|
|
||||||
function getConsignmentsDocs($prod_id, $stock_id, $jm) {
|
function getConsignmentsDocs($prod_id, $stock_id, $jm)
|
||||||
|
{
|
||||||
$documents_map = array(
|
$documents_map = array(
|
||||||
'EcmStockDocIns' => 'PZ',
|
'EcmStockDocIns' => 'PZ',
|
||||||
'EcmStockDocCorrects' => 'KS',
|
'EcmStockDocCorrects' => 'KS',
|
||||||
@@ -62,7 +63,6 @@ function getConsignmentsDocs($prod_id, $stock_id, $jm) {
|
|||||||
if ($accountResult->num_rows > 0) {
|
if ($accountResult->num_rows > 0) {
|
||||||
$accountRow = $db->fetchByAssoc($accountResult);
|
$accountRow = $db->fetchByAssoc($accountResult);
|
||||||
$tmp['account_name'] = '<a href="index.php?module=Accounts&action=DetailView&record=' . $accountRow['parent_id'] . '">' . $accountRow['parent_name'] . '</a>';
|
$tmp['account_name'] = '<a href="index.php?module=Accounts&action=DetailView&record=' . $accountRow['parent_id'] . '">' . $accountRow['parent_name'] . '</a>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$tmp['account_name'] = '';
|
$tmp['account_name'] = '';
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,8 @@ function getConsignmentsDocs($prod_id, $stock_id, $jm) {
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStockOperations($product_id, $stock_id, $jm){
|
function getStockOperations($product_id, $stock_id, $jm)
|
||||||
|
{
|
||||||
global $db, $app_list_strings;
|
global $db, $app_list_strings;
|
||||||
$query = "SELECT date_entered, quantity, type, parent_name, parent_type, parent_id, price FROM ecmstockoperations so where so.product_id='" . $product_id . "' AND so.stock_id ='" . $stock_id . "'order by counter";
|
$query = "SELECT date_entered, quantity, type, parent_name, parent_type, parent_id, price FROM ecmstockoperations so where so.product_id='" . $product_id . "' AND so.stock_id ='" . $stock_id . "'order by counter";
|
||||||
$res = $db->query($query);
|
$res = $db->query($query);
|
||||||
@@ -239,9 +240,9 @@ $currency = new Currency();
|
|||||||
$currency_list = $currency->get_full_list('name');
|
$currency_list = $currency->get_full_list('name');
|
||||||
$currency->retrieve('-99');
|
$currency->retrieve('-99');
|
||||||
if (is_array($currency_list)) {
|
if (is_array($currency_list)) {
|
||||||
$currency_list = array_merge(Array($currency), $currency_list);
|
$currency_list = array_merge(array($currency), $currency_list);
|
||||||
} else {
|
} else {
|
||||||
$currency_list = Array($currency);
|
$currency_list = array($currency);
|
||||||
}
|
}
|
||||||
$arr = array();
|
$arr = array();
|
||||||
foreach ($currency_list as $key => $value) {
|
foreach ($currency_list as $key => $value) {
|
||||||
@@ -249,7 +250,8 @@ foreach ($currency_list as $key => $value) {
|
|||||||
}
|
}
|
||||||
$detail->ss->assign("EXCHANGE_RATE_NAME", $arr[$focus->exchange_rate_id]);
|
$detail->ss->assign("EXCHANGE_RATE_NAME", $arr[$focus->exchange_rate_id]);
|
||||||
|
|
||||||
function show_image($img) {
|
function show_image($img)
|
||||||
|
{
|
||||||
if (is_file($img)) {
|
if (is_file($img)) {
|
||||||
$obraz = @GetImageSize($img);
|
$obraz = @GetImageSize($img);
|
||||||
if ($obraz[0] >= 180) {
|
if ($obraz[0] >= 180) {
|
||||||
@@ -281,40 +283,33 @@ $pl4 = $this->bean->showPrices();
|
|||||||
$detail->ss->assign('POSITIONS4', $pl4);
|
$detail->ss->assign('POSITIONS4', $pl4);
|
||||||
$ii = '<table id="stock_info" cellspacing="0" cellpadding="0" border="0" width="400">
|
$ii = '<table id="stock_info" cellspacing="0" cellpadding="0" border="0" width="400">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center"><b>' . $mod_strings['LBL_II_STOCK'] . '</b></td>
|
<td style="text-align: left"><b>' . $mod_strings['LBL_II_STOCK'] . '</b></td>
|
||||||
<td style="text-align: center; width:10%"><b>' . $mod_strings['LBL_II_QTY'] . '</b></td>
|
<td style="text-align: right; width:10%"><b>' . $mod_strings['LBL_II_QTY'] . '</b></td>
|
||||||
<td style="text-align: center; width:10%"><b>Wartość</b></td>
|
<td style="text-align: right; width:10%"><b>Cena</b></td>
|
||||||
<td style="text-align: center; width:3%"></td>
|
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
$w = $GLOBALS['db']->query("SELECT
|
$w = $GLOBALS['db']->query("SELECT
|
||||||
s.name AS stockname,
|
s.name AS stockname,
|
||||||
s.id AS stockid,
|
s.id AS stockid,
|
||||||
so.quantity AS quantity ,
|
ss.quantity AS quantity ,
|
||||||
so.price AS price,
|
ss.price AS price
|
||||||
so.type AS type
|
|
||||||
FROM
|
FROM
|
||||||
ecmstockoperations so,
|
ecmstockstates ss,
|
||||||
ecmstocks s
|
ecmstocks s
|
||||||
WHERE
|
WHERE
|
||||||
so.product_id = '".$focus->id."'
|
ss.product_id = '" . $focus->id . "'
|
||||||
AND so.stock_id = s.id");
|
AND ss.stock_id = s.id AND ss.quantity IS NOT NULL");
|
||||||
$stocksplus = array();
|
$stocksplus = array();
|
||||||
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
|
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
|
||||||
if($r['type']==0){
|
|
||||||
$stocksplus[$r['stockid']]['quantity'] += $r['quantity'];
|
$ii .= '
|
||||||
$stocksplus[$r['stockid']]['pricequantity'] += $r['quantity']*$r['price'];
|
<tr>
|
||||||
}elseif($r['type']==1){
|
<td>'.$r['stockname'].'</td>
|
||||||
$stocksplus[$r['stockid']]['quantity'] -= $r['quantity'];
|
<td style="text-align: right">'.$r['quantity'].'</td>
|
||||||
$stocksplus[$r['stockid']]['pricequantity'] -= $r['quantity']*$r['price'];
|
<td style="text-align: right">'.$r['price'].'</td>
|
||||||
}
|
<tr>
|
||||||
$stocksplus[$r['stockid']]['stockid'] = $r['stockid'];
|
';
|
||||||
$stocksplus[$r['stockid']]['stockname'] = $r['stockname'];
|
/*
|
||||||
}
|
|
||||||
if(count($stocksplus)==0){
|
|
||||||
$ii='Brak operacji magazynowych';
|
|
||||||
}else{
|
|
||||||
foreach($stocksplus as $key => $value){
|
|
||||||
// if ($value['quantity'] > 0){
|
// if ($value['quantity'] > 0){
|
||||||
$ii .= '<tr>
|
$ii .= '<tr>
|
||||||
<td>
|
<td>
|
||||||
@@ -328,10 +323,11 @@ if(count($stocksplus)==0){
|
|||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan='4'>" . getConsignmentsDocs($focus->id, $value['stockid'], $focus->unit_id) . "</td></tr>
|
<tr><td colspan='4'>" . getConsignmentsDocs($focus->id, $value['stockid'], $focus->unit_id) . "</td></tr>
|
||||||
<tr><td colspan='4'>" . getStockOperations($focus->id, $value['stockid'], $focus->unit_id) . "</td></tr>";
|
<tr><td colspan='4'>" . getStockOperations($focus->id, $value['stockid'], $focus->unit_id) . "</td></tr>";
|
||||||
// }
|
';
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
$ii .= '</table>';
|
$ii .= '</table>';
|
||||||
}
|
|
||||||
|
|
||||||
unset($stocksplus);
|
unset($stocksplus);
|
||||||
|
|
||||||
@@ -499,4 +495,3 @@ echo $detail->display();
|
|||||||
require_once('include/SubPanel/SubPanelTiles.php');
|
require_once('include/SubPanel/SubPanelTiles.php');
|
||||||
$subpanel = new SubPanelTiles($focus, "EcmProducts");
|
$subpanel = new SubPanelTiles($focus, "EcmProducts");
|
||||||
echo $subpanel->display();
|
echo $subpanel->display();
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user