74 lines
4.0 KiB
PHP
Executable File
74 lines
4.0 KiB
PHP
Executable File
<?
|
|
require_once("modules/EcmDevices/ListHelper.php");
|
|
|
|
echo "\n<p>\n";
|
|
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_TITLE'], true);
|
|
echo "\n</p>\n";
|
|
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id,name,purchase_price from ecmproducts where id='".$_REQUEST['product_id']."'"));
|
|
$product_name=$r['name'];
|
|
$product_id=$r['id'];
|
|
$purchase_price=$r['purchase_price'];
|
|
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,exchange_rate_id from ecmdevices where id='".$_COOKIE['pricebook_id']."'"));
|
|
$name=$r['name'];
|
|
$exchange_rate_id=$r['exchange_rate_id'];
|
|
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select value from ecmproductexchangerates where id='".$exchange_rate_id."'"));
|
|
$er_value=$r['value'];
|
|
|
|
$result = $GLOBALS['db']->query("select * from ecmdevices_customview where id='".$_REQUEST['customview_id']."'");
|
|
$row=$GLOBALS['db']->fetchByAssoc($result);
|
|
$t=array(" ",$mod_strings['LBL_PRODUCT_NAME'],$mod_strings['LBL_PRICEBOOK_NAME'],$mod_strings['LBL_PURCHASE_PRICE'],$mod_strings['LBL_LIST_PRICE'], " ");
|
|
|
|
$sorder=$_REQUEST['sorder'];
|
|
print '<script language="javascript" src="modules/EcmProducts/helper.js"></script>';
|
|
print '<form name="UpdatePriceBook" method="post" action="index.php">';
|
|
print '<input type="hidden" name="to_pdf" value="1">';
|
|
print '<input type="hidden" name="module" value="EcmDevices">';
|
|
print '<input type="hidden" name="action" value="UpdatePriceBook">';
|
|
print '<input type="hidden" name="product_id" value="'.$_REQUEST['product_id'].'">';
|
|
print '<input type="hidden" name="return_id" value="'.$_REQUEST['return_id'].'">';
|
|
print '<input type="hidden" name="return_module" value="'.$_REQUEST['return_module'].'">';
|
|
print '<input type="hidden" name="return_action" value="'.$_REQUEST['return_action'].'">';
|
|
print '<input class="button" type="submit" value="'.$mod_strings['LBL_UPDATE'].'"><br><br>';
|
|
print '<table cellpadding="0" cellspacing="0" width="100%" border="0" class="ListView"><tr>';
|
|
for($i=0;$i<count($t);$i++)
|
|
{
|
|
print '<td class="listViewThS1">'.$t[$i].'</td>';
|
|
}
|
|
print '</tr>';
|
|
|
|
$result = $GLOBALS['db']->query("select name,id from ecmdevices where deleted='0'");
|
|
|
|
$i=0;
|
|
while($row=$GLOBALS['db']->fetchByAssoc($result))
|
|
{
|
|
print '<tr>';
|
|
print '<input type="hidden" name="pricebook_id['.$i.']" value="'.$row['id'].'">';
|
|
|
|
print '<td class="oddListRowS1" width="1%"><input onclick="ShowHideBlock(\'price_block_'.$row['id'].'\');" type="checkbox" name="check['.$i.']" value="'.$row['id'].'"></td>';
|
|
|
|
print '<td class="oddListRowS1"><a href="index.php?module=EcmProducts&action=DetailView&record='.$product_id.'">'.$product_name.'</a></td>';
|
|
print '<td class="oddListRowS1"><a href="index.php?module=EcmDevices&action=DetailView&record='.$row['id'].'">'.$row['name'].'</a></td>';
|
|
print '<td class="oddListRowS1">'.number_format($purchase_price,2,",",".").'</td>';
|
|
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select price from ecmdevices_ecmproducts where ecmproduct_id='".$_REQUEST['product_id']."' and ecmdevice_id='".$row['id']."'"));
|
|
$price=$r['price'];
|
|
|
|
print '<td class="oddListRowS1">'.number_format($price,2,",",".").'</td>';
|
|
print '<td>
|
|
<div id="price_block_'.$row['id'].'" style="display:none;">
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'up\');" onclick="getPrice(\''.$row['id'].'\',\'down\');" name="purchase_price_'.$row['id'].'" type="text" id="purchase_price_'.$row['id'].'" value="'.$purchase_price.'" size="5" />
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'up\');" onclick="getPrice(\''.$row['id'].'\',\'down\');" name="margin_rate_'.$row['id'].'" type="text" id="margin_rate_'.$row['id'].'" value="20" size="2" />
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'up\');" onclick="getPrice(\''.$row['id'].'\',\'down\');" name="list_price_'.$row['id'].'" type="text" id="list_price_'.$row['id'].'" value="" size="6" />
|
|
<script>getPrice(\''.$row['id'].'\',\'up\');</script></div></td>';
|
|
print '</tr>';
|
|
$i++;
|
|
}
|
|
print '</table>';
|
|
print '<br><input class="button" type="submit" value="'.$mod_strings['LBL_UPDATE'].'">';
|
|
print '</form>';
|
|
|
|
?>
|