Add php files
This commit is contained in:
36
modules/EcmProductStockIndexs/getProductQuantity.php
Executable file
36
modules/EcmProductStockIndexs/getProductQuantity.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
if($_GET['stock_id'])$stock=" and stock_id='".$_GET['stock_id']."'";
|
||||
else $stock="";
|
||||
/*$z="select * from ecmproductstockindexoperations where deleted='0' and product_id='".$_GET['id']."'".$stock;
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
$total=0;
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w))
|
||||
{
|
||||
if($r['type']=="0" || $r['type']=="2")$total+=$r['quantity'];
|
||||
elseif($r['type']=="1") $total-=$r['quantity'];
|
||||
|
||||
}*/
|
||||
$q1=0;
|
||||
/*$w=$GLOBALS['db']->query("select quantity as qty,id,price from ecmproductstockindexoperations where deleted='0' and type='0' and in_id IS NULL".$stock." and product_id='".$_GET['id']."'");
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$ww=$GLOBALS['db']->query("select quantity from ecmproductstockindexoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL".$stock." and product_id='".$_GET['id']."' and deleted='0'");
|
||||
$rqty=0;
|
||||
while($rrp=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$rqty+=$rrp['quantity'];
|
||||
}
|
||||
$qty=$rrr['qty']-$rqty;
|
||||
if($qty>0){
|
||||
$arr[]=array("qty"=>$qty,"id"=>$rrr['id'],"price"=>$rrr['price']);
|
||||
}
|
||||
}
|
||||
|
||||
if(count($arr)>0){
|
||||
foreach($arr as $v){
|
||||
$q1+=$v['qty'];
|
||||
$pp1+=$v['qty']*$v['price'];
|
||||
}
|
||||
}*/
|
||||
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select quantity from ecmproductstockindexstates where deleted='0' and product_id='".$_GET['id']."'".$stock));
|
||||
$q1=$r['quantity'];
|
||||
print $q1;
|
||||
?>
|
||||
Reference in New Issue
Block a user