87 lines
4.6 KiB
PHP
87 lines
4.6 KiB
PHP
|
|
<?
|
||
|
|
require_once("modules/EcmDevices/ListHelper.php");
|
||
|
|
$_COOKIE['pricebook_id']=$_REQUEST['pricebook_id'];
|
||
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,id from ecmdevices where id='".$_REQUEST['pricebook_id']."'"));
|
||
|
|
$pricebook_name=$r['name'];
|
||
|
|
$pricebook_id=$r['id'];
|
||
|
|
|
||
|
|
$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'];
|
||
|
|
|
||
|
|
$t=array(" ",$mod_strings['LBL_PRODUCT_NAME'],$mod_strings['LBL_INDEX'],$mod_strings['LBL_PRICEBOOK_NAME'], $mod_strings['LBL_UNIT_PRICE'],$mod_strings['LBL_MARGIN'],$mod_strings['LBL_LIST_PRICE_ADD']);
|
||
|
|
|
||
|
|
$sorder=$_REQUEST['sorder'];
|
||
|
|
print '<script language="javascript" src="modules/EcmProducts/helper.js"></script>';
|
||
|
|
|
||
|
|
print '<form name="AddToPriceBook" 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="AddToPriceBook">';
|
||
|
|
print '<input type="hidden" name="pricebook_id" value="'.$_REQUEST['pricebook_id'].'">';
|
||
|
|
print '<input class="button" type="submit" value="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>';
|
||
|
|
|
||
|
|
if($_REQUEST['name'])$arr[]="ecmproducts.name like '%".$_REQUEST['name']."%'";
|
||
|
|
if($_REQUEST['code'])$arr[]="ecmproducts.code like '%".$_REQUEST['code']."%'";
|
||
|
|
if($_REQUEST['purchase_price'])$arr[]="ecmproducts.purchase_price='".$_REQUEST['purchase_price']."'";
|
||
|
|
if($_REQUEST['product_category'])$arr[]="ecmproducts.product_category_id='".$_REQUEST['product_category']."'";
|
||
|
|
if($_REQUEST['manufacturer'])$arr[]="ecmproducts.manufacturer_id='".$_REQUEST['manufacturer']."'";
|
||
|
|
$arr[]="ecmproducts.deleted='0'";
|
||
|
|
|
||
|
|
$w=$GLOBALS['db']->query("select ecmproduct_id from ecmdevices_ecmproducts where deleted='0' and ecmdevice_id='".$_REQUEST['pricebook_id']."'");
|
||
|
|
while($r=$GLOBALS['db']->fetchByAssoc($w))$arr[]="ecmproducts.id!='".$r['ecmproduct_id']."'";
|
||
|
|
|
||
|
|
$where=implode(" and ",$arr);
|
||
|
|
$z="select ecmproducts.name as name,ecmproducts.code as code,ecmproducts.id as id,ecmproducts.purchase_price as purchase_price from ecmproducts where ".$where." order by ecmproducts.name";
|
||
|
|
//print $z;
|
||
|
|
$result = $GLOBALS['db']->query($z);
|
||
|
|
|
||
|
|
|
||
|
|
print mysql_error();
|
||
|
|
$i=0;
|
||
|
|
while($row=$GLOBALS['db']->fetchByAssoc($result))
|
||
|
|
{
|
||
|
|
print '<tr>';
|
||
|
|
print '<input type="hidden" name="product_id['.$i.']" value="'.$row['id'].'">';
|
||
|
|
|
||
|
|
print '<td class="oddListRowS1" width="1%"><input onclick="getPrice(\''.$row['id'].'\',\'up\');ShowHideBlock(\'price_block2_'.$row['id'].'\');ShowHideBlock(\'price_block3_'.$row['id'].'\');" type="checkbox" name="check['.$i.']" value="'.$row['id'].'"></td>';
|
||
|
|
|
||
|
|
print '<td class="oddListRowS1"><a href="index.php?module=EcmProducts&action=DetailView&record='.$row['id'].'">'.$row['name'].'</a></td>';
|
||
|
|
print '<td class="oddListRowS1">'.$row['code'].'</td>';
|
||
|
|
print '<td class="oddListRowS1"><a href="index.php?module=EcmDevices&action=DetailView&record='.$pricebook_id.'">'.$pricebook_name.'</a></td>';
|
||
|
|
print '<td class="oddListRowS1">'.number_format($row['purchase_price'],2,",",".").'</td>';
|
||
|
|
|
||
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select price from ecmdevices_ecmproducts where ecmdevice_id='".$_REQUEST['pricebook_id']."' and ecmproduct_id='".$row['id']."'"));
|
||
|
|
|
||
|
|
//print '<td class="oddListRowS1">'.number_format($r['price'],2,",",".").'</td>';
|
||
|
|
|
||
|
|
print '
|
||
|
|
<div id="price_block1_'.$row['id'].'" style="display:none;">
|
||
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'down\');" onclick="getPrice(\''.$row['id'].'\',\'up\');" name="purchase_price_'.$row['id'].'" type="hidden" id="purchase_price_'.$row['id'].'" value="'.$row['purchase_price'].'" size="5" />
|
||
|
|
</div>
|
||
|
|
';
|
||
|
|
print '<td>
|
||
|
|
<div id="price_block2_'.$row['id'].'" style="display:none;">
|
||
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'down\');" onclick="getPrice(\''.$row['id'].'\',\'up\');" name="margin_rate_'.$row['id'].'" type="text" id="margin_rate_'.$row['id'].'" value="20" size="2" />
|
||
|
|
</td>
|
||
|
|
<td>
|
||
|
|
<div id="price_block3_'.$row['id'].'" style="display:none;">
|
||
|
|
<input onchange="getPrice(\''.$row['id'].'\',\'down\');" onclick="getPrice(\''.$row['id'].'\',\'up\');" 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>';
|
||
|
|
|
||
|
|
?>
|