Files
crm.e5.pl/modules/EcmStockOperations/calculateTrans.php
2024-04-27 09:23:34 +02:00

33 lines
941 B
PHP

<?php
/*
*
$db=$GLOBALS['db'];
ini_set('memory_limit',-1);
ini_set('max_execution_timee',-1);
$query="select id,product_id,quantity from ecmstockoperations where deleted=0 and parent_type='EcmStockDocInsideIns'";
$res = $db->query($query);
$koszt=15.4;
while($dane= $db->fetchByAssoc($res)){
$query2="select c.quantity from ecmproductcomponents c
inner join ecmproducts p on p.id=c.ecmcomponent_id
inner join ecmproductcategories_bean c2 on c2.bean_id=c.ecmcomponent_id
where c.deleted=0 and c.ecmproduct_id='".$dane['product_id']."' and c2.ecmproductcategory_id='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1'";
$res2=$db->query($query2);
$total_koszt=0;
while($dane2=$db->fetchByAssoc($res2)){
$total_koszt=$total_koszt+($dane['quantity']*$dane2['quantity']*$koszt);
}
$query3="update ecmstockoperations set work_price=$total_koszt where id='".$dane['id']."'";
$db->query($query3);
}
*/
?>