init
This commit is contained in:
28
modules/EcmStockOperations/testa.php
Normal file
28
modules/EcmStockOperations/testa.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$db = $GLOBALS['db'];
|
||||
$r=$db->query("select * from ecmstockoperations where
|
||||
product_id='582'
|
||||
and stock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4'
|
||||
and in_id is null and used=0 and type=0");
|
||||
$docs=array();
|
||||
$l=0;
|
||||
while($tmp=$db->fetchByAssoc($r)){
|
||||
|
||||
$ii=$db->query("select * from ecmstockoperations where in_id='".$tmp['id']."' and type=1");
|
||||
if($ii->num_rows>0){
|
||||
$quantity_tmp=$tmp['quantity'];
|
||||
while($tmp2=$db->fetchByAssoc($ii)){
|
||||
|
||||
$quantity_tmp-=$tmp2['quantity'];
|
||||
}
|
||||
$doc['quantity']=$quantity_tmp;
|
||||
$doc['parent_name']=$tmp['parent_name'];
|
||||
$docs[]=$doc;
|
||||
} else {
|
||||
$doc['quantity']=$tmp['quantity'];
|
||||
$doc['parent_name']=$tmp['parent_name'];
|
||||
$docs[]=$doc;
|
||||
}
|
||||
}
|
||||
var_dump($docs);
|
||||
?>
|
||||
Reference in New Issue
Block a user