37 lines
1.3 KiB
PHP
Executable File
37 lines
1.3 KiB
PHP
Executable File
<?
|
|
if($_GET['stock_id'])$stock=" and stock_id='".$_GET['stock_id']."'";
|
|
else $stock="";
|
|
/*$z="select * from ecmstockoperations 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 ecmstockoperations 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 ecmstockoperations 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 ecmstockstates where deleted='0' and product_id='".$_GET['id']."'".$stock));
|
|
$q1=$r['quantity'];
|
|
print $q1;
|
|
?>
|