Add php files
This commit is contained in:
14
modules/EcmStockOperations/used.php
Executable file
14
modules/EcmStockOperations/used.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include("../../config.php");
|
||||
$sql=mysql_connect("localhost","e5crm.more7.com","5z#JaL");
|
||||
mysql_select_db("e5crm_more7_com");
|
||||
$w=$GLOBALS['db']->query("select id,product_code,quantity,price,parent_name from ecmstockoperations where (used=0 or used is null) and type=0 and deleted='0'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){;
|
||||
$qty=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select sum(quantity) as qty from ecmstockoperations where type=1 and in_id='".$r['id']."' and deleted='0'"));
|
||||
if($qty['qty']>=$r['quantity']){
|
||||
echo $r['product_code']." ".$r['parent_name']." ".$r['quantity']." ".$qty['qty']."\n";
|
||||
$GLOBALS['db']->query("update ecmstockoperations set used=1 where id='".$r['id']."'");
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
Reference in New Issue
Block a user