Products states table fix
This commit is contained in:
@@ -14,12 +14,13 @@ 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 (
|
{
|
||||||
'EcmStockDocIns' => 'PZ',
|
$documents_map = array(
|
||||||
'EcmStockDocCorrects' => 'KS',
|
'EcmStockDocIns' => 'PZ',
|
||||||
'EcmStockDocMoves' => 'MM',
|
'EcmStockDocCorrects' => 'KS',
|
||||||
'EcmStockDocInsideIns' => 'PW'
|
'EcmStockDocMoves' => 'MM',
|
||||||
|
'EcmStockDocInsideIns' => 'PW'
|
||||||
);
|
);
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
@@ -37,48 +38,47 @@ function getConsignmentsDocs($prod_id, $stock_id, $jm) {
|
|||||||
i.type='0'
|
i.type='0'
|
||||||
group by i.id
|
group by i.id
|
||||||
order by i.date_entered;";
|
order by i.date_entered;";
|
||||||
$res = $db->query ( $query );
|
$res = $db->query($query);
|
||||||
$result = array ();
|
$result = array();
|
||||||
global $app_list_strings, $sugar_config;
|
global $app_list_strings, $sugar_config;
|
||||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
while ($row = $db->fetchByAssoc($res)) {
|
||||||
$availability = (floatval ( $row ['in_qty'] ) - floatval ( $row ['out_qty'] ));
|
$availability = (floatval($row['in_qty']) - floatval($row['out_qty']));
|
||||||
if ($availability <= 0)
|
if ($availability <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$tmp = array ();
|
$tmp = array();
|
||||||
if($row ['parent_type'] == 'EcmStockDocInsideIns'){
|
if ($row['parent_type'] == 'EcmStockDocInsideIns') {
|
||||||
|
|
||||||
$accountQuery = "SELECT name FROM ecmstockdocinsideins WHERE id='" . $row['parent_id'] . "'";
|
$accountQuery = "SELECT name FROM ecmstockdocinsideins WHERE id='" . $row['parent_id'] . "'";
|
||||||
$accountResult = $db->query($accountQuery);
|
$accountResult = $db->query($accountQuery);
|
||||||
if($accountResult->num_rows > 0){
|
if ($accountResult->num_rows > 0) {
|
||||||
$accountRow = $db->fetchByAssoc ( $accountResult );
|
$accountRow = $db->fetchByAssoc($accountResult);
|
||||||
$tmp ['account_name'] = $accountRow ['name'];
|
$tmp['account_name'] = $accountRow['name'];
|
||||||
}else{
|
} else {
|
||||||
$tmp ['account_name'] = '';
|
$tmp['account_name'] = '';
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$accountQuery = "SELECT parent_id, parent_name FROM " . strtolower($row ['parent_type']) ." WHERE id='" . $row['parent_id'] . "'";
|
$accountQuery = "SELECT parent_id, parent_name FROM " . strtolower($row['parent_type']) . " WHERE id='" . $row['parent_id'] . "'";
|
||||||
$accountResult = $db->query($accountQuery);
|
$accountResult = $db->query($accountQuery);
|
||||||
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'] = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tmp ['operation_id'] = $row ['id'];
|
$tmp['operation_id'] = $row['id'];
|
||||||
$tmp ['parent_name'] = '<a href="index.php?module='.$row ['parent_type'].'&action=DetailView&record='.$row['parent_id'].'">' . $documents_map [$row ['parent_type']] . ' ' . $row ['parent_name'] . '</a>';
|
$tmp['parent_name'] = '<a href="index.php?module=' . $row['parent_type'] . '&action=DetailView&record=' . $row['parent_id'] . '">' . $documents_map[$row['parent_type']] . ' ' . $row['parent_name'] . '</a>';
|
||||||
$tmp ['part_no'] = $row['part_no'];
|
$tmp['part_no'] = $row['part_no'];
|
||||||
$tmp ['availability'] = $availability;
|
$tmp['availability'] = $availability;
|
||||||
$tmp ['parent_id'] = $row ['parent_id'];
|
$tmp['parent_id'] = $row['parent_id'];
|
||||||
$tmp ['parent_type'] = $row ['parent_type'];
|
$tmp['parent_type'] = $row['parent_type'];
|
||||||
|
|
||||||
$tmp ['price'] = $row ['price'];
|
$tmp['price'] = $row['price'];
|
||||||
$tmp ['unit'] = $app_list_strings ['ecmproducts_unit_dom'] [$row ['unit_id']];
|
$tmp['unit'] = $app_list_strings['ecmproducts_unit_dom'][$row['unit_id']];
|
||||||
$tmp ['currency'] = $sugar_config ['default_currency_iso4217'];
|
$tmp['currency'] = $sugar_config['default_currency_iso4217'];
|
||||||
|
|
||||||
$result [] = $tmp;
|
$result[] = $tmp;
|
||||||
}
|
}
|
||||||
// number_format($tmp, 2, ",", ".")
|
// number_format($tmp, 2, ",", ".")
|
||||||
$html = '
|
$html = '
|
||||||
@@ -93,26 +93,27 @@ function getConsignmentsDocs($prod_id, $stock_id, $jm) {
|
|||||||
<td style="text-align: center; width:10%"><b>Wartość</b></td>
|
<td style="text-align: center; width:10%"><b>Wartość</b></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
foreach($result as $key => $value){
|
foreach ($result as $key => $value) {
|
||||||
$tmp = $value['availability']*$value['price'];
|
$tmp = $value['availability'] * $value['price'];
|
||||||
$html.='<tr>';
|
$html .= '<tr>';
|
||||||
$html.='<td>' . $value['parent_name'] .'</td>';
|
$html .= '<td>' . $value['parent_name'] . '</td>';
|
||||||
$html.='<td>' . $value['account_name'] .'</td>';
|
$html .= '<td>' . $value['account_name'] . '</td>';
|
||||||
$html.='<td>' . $value['part_no'] .'</td>';
|
$html .= '<td>' . $value['part_no'] . '</td>';
|
||||||
$html.='<td style="text-align: right">' . number_format($value['availability'], $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") .' ' . $value['unit'].'</td>'; //FormatNumber(c.availability) + ' ' + c.unit
|
$html .= '<td style="text-align: right">' . number_format($value['availability'], $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") . ' ' . $value['unit'] . '</td>'; //FormatNumber(c.availability) + ' ' + c.unit
|
||||||
$html.='<td style="text-align: right">' . number_format($value['price'], 2, ",", ".") . ' ' . $value['currency'] . ' / ' . $value['unit'] . '</td>'; //FormatNumber(c.price) + ' ' + c.currency + ' / ' + c.unit
|
$html .= '<td style="text-align: right">' . number_format($value['price'], 2, ",", ".") . ' ' . $value['currency'] . ' / ' . $value['unit'] . '</td>'; //FormatNumber(c.price) + ' ' + c.currency + ' / ' + c.unit
|
||||||
$html.='<td style="text-align: right">'. number_format($tmp, 2, ",", ".") .' zł</td>';
|
$html .= '<td style="text-align: right">' . number_format($tmp, 2, ",", ".") . ' zł</td>';
|
||||||
$html.='</tr>';
|
$html .= '</tr>';
|
||||||
}
|
}
|
||||||
$html .= '</table><br><br></div>';
|
$html .= '</table><br><br></div>';
|
||||||
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);
|
||||||
$result = array ();
|
$result = array();
|
||||||
$html = '
|
$html = '
|
||||||
<div style="text-align: center; display: none"><font size="4">Operacje magazynowe</font><br>
|
<div style="text-align: center; display: none"><font size="4">Operacje magazynowe</font><br>
|
||||||
<table name="stockOperations">
|
<table name="stockOperations">
|
||||||
@@ -124,58 +125,58 @@ function getStockOperations($product_id, $stock_id, $jm){
|
|||||||
<td style="text-align: center; width:10%"><b>Ilość</b></td>
|
<td style="text-align: center; width:10%"><b>Ilość</b></td>
|
||||||
<td style="text-align: center; width:10%"><b>Stan po</b></td>
|
<td style="text-align: center; width:10%"><b>Stan po</b></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
$stanpo =0;
|
$stanpo = 0;
|
||||||
$doc_name=array(
|
$doc_name = array(
|
||||||
'EcmStockDocInsideIns'=>'PW',
|
'EcmStockDocInsideIns' => 'PW',
|
||||||
'EcmStockDocMoves'=>'MM',
|
'EcmStockDocMoves' => 'MM',
|
||||||
'EcmStockDocCorrects'=>'KS',
|
'EcmStockDocCorrects' => 'KS',
|
||||||
'EcmStockDocIns'=>'PZ',
|
'EcmStockDocIns' => 'PZ',
|
||||||
'EcmStockDocOuts'=>'WZ',
|
'EcmStockDocOuts' => 'WZ',
|
||||||
'EcmStockDocInsideOuts'=>'RW',
|
'EcmStockDocInsideOuts' => 'RW',
|
||||||
'EcmInvoiceOuts'=>'FK'
|
'EcmInvoiceOuts' => 'FK'
|
||||||
);
|
);
|
||||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
while ($row = $db->fetchByAssoc($res)) {
|
||||||
$subquery = '';
|
$subquery = '';
|
||||||
$subquery = 'SELECT parent_id, parent_name, parent_type FROM ' . strtolower($row['parent_type']) . ' WHERE id = "'.$row['parent_id'].'"';
|
$subquery = 'SELECT parent_id, parent_name, parent_type FROM ' . strtolower($row['parent_type']) . ' WHERE id = "' . $row['parent_id'] . '"';
|
||||||
$result = $db->query ( $subquery );
|
$result = $db->query($subquery);
|
||||||
if(!$result){
|
if (!$result) {
|
||||||
$subquery = 'SELECT parent_id, parent_name FROM ' . strtolower($row['parent_type']) . ' WHERE id = "'.$row['parent_id'].'"';
|
$subquery = 'SELECT parent_id, parent_name FROM ' . strtolower($row['parent_type']) . ' WHERE id = "' . $row['parent_id'] . '"';
|
||||||
$result = $db->query ( $subquery );
|
$result = $db->query($subquery);
|
||||||
}
|
}
|
||||||
$kontrahent = $db->fetchByAssoc ( $result );
|
$kontrahent = $db->fetchByAssoc($result);
|
||||||
if($kontrahent['parent_type']==NULL || $kontrahent['parent_type']==''){
|
if ($kontrahent['parent_type'] == NULL || $kontrahent['parent_type'] == '') {
|
||||||
switch($row['parent_type']){
|
switch ($row['parent_type']) {
|
||||||
case 'EcmStockDocIns' :{
|
case 'EcmStockDocIns': {
|
||||||
$kontrahent['parent_type'] = 'Accounts';
|
$kontrahent['parent_type'] = 'Accounts';
|
||||||
$tmp = '<a href="index.php?module='.$kontrahent['parent_type'].'&action=DetailView&record='.$kontrahent['parent_id'].'">' . $kontrahent['parent_name'] . '</a>';
|
$tmp = '<a href="index.php?module=' . $kontrahent['parent_type'] . '&action=DetailView&record=' . $kontrahent['parent_id'] . '">' . $kontrahent['parent_name'] . '</a>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default :{
|
default: {
|
||||||
$tmp = $kontrahent['parent_name'];
|
$tmp = $kontrahent['parent_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$tmp = '<a href="index.php?module='.$kontrahent['parent_type'].'&action=DetailView&record='.$kontrahent['parent_id'].'">' . $kontrahent['parent_name'] . '</a>';
|
$tmp = '<a href="index.php?module=' . $kontrahent['parent_type'] . '&action=DetailView&record=' . $kontrahent['parent_id'] . '">' . $kontrahent['parent_name'] . '</a>';
|
||||||
}
|
}
|
||||||
$nazwa = '';
|
$nazwa = '';
|
||||||
if($row['type']==0){
|
if ($row['type'] == 0) {
|
||||||
$nazwa = '<a href="index.php?module='.$row['parent_type'].'&action=DetailView&record='.$row['parent_id'].'"><font color="green">' . $doc_name[$row['parent_type']] . ' ' . $row['parent_name'] . '</font></a>';
|
$nazwa = '<a href="index.php?module=' . $row['parent_type'] . '&action=DetailView&record=' . $row['parent_id'] . '"><font color="green">' . $doc_name[$row['parent_type']] . ' ' . $row['parent_name'] . '</font></a>';
|
||||||
$stanpo +=$row['quantity'];
|
$stanpo += $row['quantity'];
|
||||||
}elseif($row['type']==1){
|
} elseif ($row['type'] == 1) {
|
||||||
$nazwa = '<a href="index.php?module='.$row['parent_type'].'&action=DetailView&record='.$row['parent_id'].'"><font color="red">' . $doc_name[$row['parent_type']] . ' ' . $row['parent_name'] . '</font></a>';
|
$nazwa = '<a href="index.php?module=' . $row['parent_type'] . '&action=DetailView&record=' . $row['parent_id'] . '"><font color="red">' . $doc_name[$row['parent_type']] . ' ' . $row['parent_name'] . '</font></a>';
|
||||||
$stanpo -=$row['quantity'];
|
$stanpo -= $row['quantity'];
|
||||||
}
|
}
|
||||||
$data = substr($row['date_entered'],0,10);
|
$data = substr($row['date_entered'], 0, 10);
|
||||||
$data = explode('-', $data);
|
$data = explode('-', $data);
|
||||||
$data = $data[2] . '.' .$data[1] . '.' .$data[0];
|
$data = $data[2] . '.' . $data[1] . '.' . $data[0];
|
||||||
$html.='<tr>';
|
$html .= '<tr>';
|
||||||
$html.='<td>' . $nazwa .'</td>';
|
$html .= '<td>' . $nazwa . '</td>';
|
||||||
$html.='<td>' . $tmp .'</td>';
|
$html .= '<td>' . $tmp . '</td>';
|
||||||
$html.='<td style="text-align: right">' . $data . '</td>'; //FormatNumber(c.availability) + ' ' + c.unit
|
$html .= '<td style="text-align: right">' . $data . '</td>'; //FormatNumber(c.availability) + ' ' + c.unit
|
||||||
$html.='<td style="text-align: right">' . number_format($row['price'], 2, ",", ".") . '</td>';
|
$html .= '<td style="text-align: right">' . number_format($row['price'], 2, ",", ".") . '</td>';
|
||||||
$html.='<td style="text-align: right">'. number_format($row['quantity'], $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") .'</td>';
|
$html .= '<td style="text-align: right">' . number_format($row['quantity'], $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") . '</td>';
|
||||||
$html.='<td style="text-align: right">'. number_format($stanpo, $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") .'</td>';
|
$html .= '<td style="text-align: right">' . number_format($stanpo, $app_list_strings['ecmproducts_unit_dom_precision'][$jm], ",", ".") . '</td>';
|
||||||
$html.='</tr>';
|
$html .= '</tr>';
|
||||||
}
|
}
|
||||||
$html .= '</table><br><br></div>';
|
$html .= '</table><br><br></div>';
|
||||||
return $html;
|
return $html;
|
||||||
@@ -204,11 +205,11 @@ $uunit_array = array();
|
|||||||
$uunit = '';
|
$uunit = '';
|
||||||
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
|
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
|
||||||
foreach ($app_list_strings['ecmproducts_unit_dom'] as $key => $value) {
|
foreach ($app_list_strings['ecmproducts_unit_dom'] as $key => $value) {
|
||||||
$uunit.='<option value="' . $key . '"';
|
$uunit .= '<option value="' . $key . '"';
|
||||||
if ($focus->usage_unit_id == $key) {
|
if ($focus->usage_unit_id == $key) {
|
||||||
$uunit.=' selected';
|
$uunit .= ' selected';
|
||||||
}
|
}
|
||||||
$uunit.='>' . $value . '</option>';
|
$uunit .= '>' . $value . '</option>';
|
||||||
$uunit_array[$key] = $value;
|
$uunit_array[$key] = $value;
|
||||||
}
|
}
|
||||||
$detail->ss->assign("USAGE_UNIT_ID", $uunit);
|
$detail->ss->assign("USAGE_UNIT_ID", $uunit);
|
||||||
@@ -216,20 +217,20 @@ $detail->ss->assign("USAGE_UNIT_ID", $uunit);
|
|||||||
$fbas = '';
|
$fbas = '';
|
||||||
$result = $db->query("select id,name from ecmproductbasis order by name asc");
|
$result = $db->query("select id,name from ecmproductbasis order by name asc");
|
||||||
while (($row = $db->fetchByAssoc($result)) != null) {
|
while (($row = $db->fetchByAssoc($result)) != null) {
|
||||||
$fbas.='<option value="' . $row['id'] . '"';
|
$fbas .= '<option value="' . $row['id'] . '"';
|
||||||
if ($focus->fob_basis_id == $row['id'])
|
if ($focus->fob_basis_id == $row['id'])
|
||||||
$fbas.=' selected';
|
$fbas .= ' selected';
|
||||||
$fbas.='>' . $row['name'] . '</option>';
|
$fbas .= '>' . $row['name'] . '</option>';
|
||||||
}
|
}
|
||||||
$detail->ss->assign("FOB_BASIS_ID", $fbas);
|
$detail->ss->assign("FOB_BASIS_ID", $fbas);
|
||||||
|
|
||||||
$pack = '';
|
$pack = '';
|
||||||
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
|
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
|
||||||
while (($row = $db->fetchByAssoc($result)) != null) {
|
while (($row = $db->fetchByAssoc($result)) != null) {
|
||||||
$pack.='<option value="' . $row['id'] . '"';
|
$pack .= '<option value="' . $row['id'] . '"';
|
||||||
if ($focus->packing_type_id == $row['id'])
|
if ($focus->packing_type_id == $row['id'])
|
||||||
$pack.=' selected';
|
$pack .= ' selected';
|
||||||
$pack.='>' . $row['name'] . '</option>';
|
$pack .= '>' . $row['name'] . '</option>';
|
||||||
}
|
}
|
||||||
$detail->ss->assign("PACKING_TYPE_ID", $pack);
|
$detail->ss->assign("PACKING_TYPE_ID", $pack);
|
||||||
|
|
||||||
@@ -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) {
|
||||||
@@ -261,7 +263,7 @@ function show_image($img) {
|
|||||||
}
|
}
|
||||||
$height = $obraz[1] + 20;
|
$height = $obraz[1] + 20;
|
||||||
$width = $obraz[0] + 20;
|
$width = $obraz[0] + 20;
|
||||||
return '<a style="cursor:pointer;" onclick="window.open(\'' . $img . '\',\'Image\',\'height=' . $height . ',width=' . $width . '\');"><img src="' . $img . '" width="'. $szerokosc . '" height=" ' . $wysokosc .'"></a>';
|
return '<a style="cursor:pointer;" onclick="window.open(\'' . $img . '\',\'Image\',\'height=' . $height . ',width=' . $width . '\');"><img src="' . $img . '" width="' . $szerokosc . '" height=" ' . $wysokosc . '"></a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,46 +283,39 @@ $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){
|
// if ($value['quantity'] > 0){
|
||||||
$ii='Brak operacji magazynowych';
|
$ii .= '<tr>
|
||||||
}else{
|
|
||||||
foreach($stocksplus as $key => $value){
|
|
||||||
// if ($value['quantity'] > 0){
|
|
||||||
$ii.='<tr>
|
|
||||||
<td>
|
<td>
|
||||||
<a href="index.php?query=true&module=EcmStockOperations&action=&searchFormTab=basic_search&product_id_basic=' . $_REQUEST['record'] . '&product_name_basic=' . $focus->name . '&stock_id_basic=' . $value['stockid'] . '&stock_name_basic=' . $value['stockname'] . '">' . $value['stockname'] . "</a>
|
<a href="index.php?query=true&module=EcmStockOperations&action=&searchFormTab=basic_search&product_id_basic=' . $_REQUEST['record'] . '&product_name_basic=' . $focus->name . '&stock_id_basic=' . $value['stockid'] . '&stock_name_basic=' . $value['stockname'] . '">' . $value['stockname'] . "</a>
|
||||||
</td>
|
</td>
|
||||||
<td style='text-align: right'>" . number_format($value['quantity'], $app_list_strings['ecmproducts_unit_dom_precision'][$focus->unit_id], ",", ".") .' '. $app_list_strings ['ecmproducts_unit_dom'] [$focus->unit_id] . "</td>
|
<td style='text-align: right'>" . number_format($value['quantity'], $app_list_strings['ecmproducts_unit_dom_precision'][$focus->unit_id], ",", ".") . ' ' . $app_list_strings['ecmproducts_unit_dom'][$focus->unit_id] . "</td>
|
||||||
<td style='text-align: right'>
|
<td style='text-align: right'>
|
||||||
" . number_format($value['pricequantity'], 2, ",", ".") . " zł
|
" . number_format($value['pricequantity'], 2, ",", ".") . " zł
|
||||||
</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);
|
||||||
|
|
||||||
@@ -399,33 +395,33 @@ else
|
|||||||
global $mod_strings;
|
global $mod_strings;
|
||||||
|
|
||||||
$desc = '';
|
$desc = '';
|
||||||
$desc.='<input title="Product Card" class="button" onclick="if(document.getElementById(\'div_desc2\').style.display==\'none\')document.getElementById(\'div_desc2\').style.display=\'block\';else document.getElementById(\'div_desc2\').style.display=\'none\';" type="button" name="productcard" id="productcard" value="' . $mod_strings['LBL_PRODUCT_CARD'] . '">';
|
$desc .= '<input title="Product Card" class="button" onclick="if(document.getElementById(\'div_desc2\').style.display==\'none\')document.getElementById(\'div_desc2\').style.display=\'block\';else document.getElementById(\'div_desc2\').style.display=\'none\';" type="button" name="productcard" id="productcard" value="' . $mod_strings['LBL_PRODUCT_CARD'] . '">';
|
||||||
$desc.='<div id="div_desc2" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
$desc .= '<div id="div_desc2" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||||
$desc.='Zdjęcie: <select name="new_image" id="new_image"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
$desc .= 'Zdjęcie: <select name="new_image" id="new_image"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||||||
$desc.='Pokaż cene: <select name="new_show_price" id="new_show_price"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
$desc .= 'Pokaż cene: <select name="new_show_price" id="new_show_price"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||||||
$desc.='Cena: <select name="new_price" id="new_price"><option value="srp_price">SRP Price</option></select><br /><br />';
|
$desc .= 'Cena: <select name="new_price" id="new_price"><option value="srp_price">SRP Price</option></select><br /><br />';
|
||||||
$desc.='Język: <select name="new_language" id="new_language"><option value="pl">pl</option><option value="en">en</option></select><br /><br />';
|
$desc .= 'Język: <select name="new_language" id="new_language"><option value="pl">pl</option><option value="en">en</option></select><br /><br />';
|
||||||
$desc.='EAN: <select name="new_ean" id="new_ean"><option value="1">1</option><option value="2">2</option></select><br /><br />';
|
$desc .= 'EAN: <select name="new_ean" id="new_ean"><option value="1">1</option><option value="2">2</option></select><br /><br />';
|
||||||
|
|
||||||
$desc.='<input type="button" class="button" name="generate" id="generate" value="Generuj" onclick="window.open(\'index.php?module=EcmProducts&action=generateCard&record=' . $_REQUEST['record'] . '&to_pdf=1&price=\'+document.getElementById(\'new_price\').value+\'&create_img=\'+document.getElementById(\'new_image\').value+\'&show_price=\'+document.getElementById(\'new_show_price\').value+\'&language=\'+document.getElementById(\'new_language\').value+\'&ean=\'+document.getElementById(\'new_ean\').value);"></div>';
|
$desc .= '<input type="button" class="button" name="generate" id="generate" value="Generuj" onclick="window.open(\'index.php?module=EcmProducts&action=generateCard&record=' . $_REQUEST['record'] . '&to_pdf=1&price=\'+document.getElementById(\'new_price\').value+\'&create_img=\'+document.getElementById(\'new_image\').value+\'&show_price=\'+document.getElementById(\'new_show_price\').value+\'&language=\'+document.getElementById(\'new_language\').value+\'&ean=\'+document.getElementById(\'new_ean\').value);"></div>';
|
||||||
|
|
||||||
$detail->ss->assign("CATALOGUE_NEW", $desc);
|
$detail->ss->assign("CATALOGUE_NEW", $desc);
|
||||||
|
|
||||||
$desc = '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
$desc = '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||||
$desc.='<input type="checkbox" name="show_characteristic" id="show_characteristic" value="1" checked">Show attributes<br />';
|
$desc .= '<input type="checkbox" name="show_characteristic" id="show_characteristic" value="1" checked">Show attributes<br />';
|
||||||
$desc.='<input type="checkbox" name="show_description" id="show_description" value="1" checked">Show description<br />';
|
$desc .= '<input type="checkbox" name="show_description" id="show_description" value="1" checked">Show description<br />';
|
||||||
$desc.='<input type="checkbox" name="show_specification" id="show_specification" value="1" checked">Show specification<br />';
|
$desc .= '<input type="checkbox" name="show_specification" id="show_specification" value="1" checked">Show specification<br />';
|
||||||
$desc.='<input type="checkbox" name="print_version" id="print_version" value="1" checked">Print version<br />';
|
$desc .= '<input type="checkbox" name="print_version" id="print_version" value="1" checked">Print version<br />';
|
||||||
$desc.='Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
|
$desc .= 'Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
|
||||||
$desc.='<input type="button" class="button" name="generate" id="generate" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record=' . $_REQUEST['record'] . '&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic\').checked+\'&show_specification=\'+document.getElementById(\'show_specification\').checked+\'&show_description=\'+document.getElementById(\'show_description\').checked+\'&print_version=\'+document.getElementById(\'print_version\').checked+\'&language=\'+document.getElementById(\'language\').value);"></div>';
|
$desc .= '<input type="button" class="button" name="generate" id="generate" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record=' . $_REQUEST['record'] . '&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic\').checked+\'&show_specification=\'+document.getElementById(\'show_specification\').checked+\'&show_description=\'+document.getElementById(\'show_description\').checked+\'&print_version=\'+document.getElementById(\'print_version\').checked+\'&language=\'+document.getElementById(\'language\').value);"></div>';
|
||||||
$detail->ss->assign("DIV_DESC", $desc);
|
$detail->ss->assign("DIV_DESC", $desc);
|
||||||
|
|
||||||
$desc = '<div id="div_desc_card" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
$desc = '<div id="div_desc_card" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||||
$desc.='<input type="checkbox" name="show_characteristic_card" id="show_characteristic_card" value="1" checked">Show attributes<br />';
|
$desc .= '<input type="checkbox" name="show_characteristic_card" id="show_characteristic_card" value="1" checked">Show attributes<br />';
|
||||||
$desc.='<input type="checkbox" name="show_description_card" id="show_description_card" value="1" checked">Show description<br />';
|
$desc .= '<input type="checkbox" name="show_description_card" id="show_description_card" value="1" checked">Show description<br />';
|
||||||
$desc.='<input type="checkbox" name="show_specification_card" id="show_specification_card" value="1" checked">Show specification<br />';
|
$desc .= '<input type="checkbox" name="show_specification_card" id="show_specification_card" value="1" checked">Show specification<br />';
|
||||||
$desc.='Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
|
$desc .= 'Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
|
||||||
$desc.='<input type="button" class="button" name="generate_card" id="generate_card" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record=' . $_REQUEST['record'] . '&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic_card\').checked+\'&show_specification=\'+document.getElementById(\'show_specification_card\').checked+\'&show_description=\'+document.getElementById(\'show_description_card\').checked+\'&html=1\'+\'&language=\'+document.getElementById(\'language\').value,\'create_html\',\'location=0,status=0,scrollbars=0,width=640,height=500\');"></div>';
|
$desc .= '<input type="button" class="button" name="generate_card" id="generate_card" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record=' . $_REQUEST['record'] . '&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic_card\').checked+\'&show_specification=\'+document.getElementById(\'show_specification_card\').checked+\'&show_description=\'+document.getElementById(\'show_description_card\').checked+\'&html=1\'+\'&language=\'+document.getElementById(\'language\').value,\'create_html\',\'location=0,status=0,scrollbars=0,width=640,height=500\');"></div>';
|
||||||
$detail->ss->assign("DIV_DESC_CARD", $desc);
|
$detail->ss->assign("DIV_DESC_CARD", $desc);
|
||||||
|
|
||||||
//Added for Graduated Prices - Begin
|
//Added for Graduated Prices - Begin
|
||||||
@@ -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