EcmProducts

Production: Make Production


fetchByAssoc($GLOBALS['db']->query("select * from ecminsideorders where id='".$_REQUEST['record']."'")); $t.='
'; $t.='
Inventory '; $rs=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$rdoc['rw_stock_id']."'"));$t.=$rs['name']; $t.='
'; $t.=$tbs; $t.=$trs; $t.=$tds1; $t.="Index"; $t.=$tde; $t.=$tds1; $t.="Name"; $t.=$tde; $t.=$tds1; $t.="Inventory"; $t.=$tde; $t.=$tds1; $t.="Quantity"; $t.=$tde; $t.=$tre; $w=$GLOBALS['db']->query("select * from ecmproducts_ecminsideorders where product_component=1 and deleted='0' and ecminsideorder_id='".$_REQUEST['record']."'"); $used = array(); while($r=$GLOBALS['db']->fetchByAssoc($w)){ $cat = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT product_category_id as cat FROM ecmproducts WHERE id='".$r['ecmproduct_id']."'")); $stop=0; //uwzględniamy już użyte $stock=($op->getStock($r['ecmproduct_id'],$rdoc['rw_stock_id'])-$used[$r['ecmproduct_id']]); if (!isset($used[$r['ecmproduct_id']])) $used[$r['ecmproduct_id']] = 0; if ($cat['cat']!='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1') $used[$r['ecmproduct_id']]+=$r['product_prod_quantity']; $t.=$trs.$tds.$r['product_code'].$tde.$tds.$r['product_name'].$tde.$tds.$stock.$tde.$tds.$r['product_prod_quantity'].$tde.$tre; if($stock<$r['product_prod_quantity'])$stop=1; if($stop && $cat['cat']!='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1'){ $t.=$trs.$tds." ".$tde.$tds."no products in stock".$tde.$tds." ".$tde.$tds." ".$tde.$tre; $stop_arr[$r['product_guid']]=$r['product_guid']; } else{ $rw_prod[]=array("id"=>$r['ecmproduct_id'],"quantity"=>$r['product_prod_quantity'],"guid"=>$r['product_guid'],'price'=>$r['product_price']); } } $t.=$tbe; $t.='
'; $t.='
Inventory '; $rs=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$rdoc['pw_stock_id']."'"));$t.=$rs['name']; $t.='
'; $t.=$tbs; $t.=$trs; $t.=$tds1; $t.="Index"; $t.=$tde; $t.=$tds1; $t.="Name"; $t.=$tde; $t.=$tds1; $t.="Inventory"; $t.=$tde; $t.=$tds1; $t.="Quantity"; $t.=$tde; $t.=$tds1; $t.="Price"; $t.=$tde; $t.=$tre; $w=$GLOBALS['db']->query("select * from ecmproducts_ecminsideorders where product_component!=1 and deleted='0' and ecminsideorder_id='".$_REQUEST['record']."'"); while($r=$GLOBALS['db']->fetchByAssoc($w)){ if(in_array($r['product_guid'],$stop_arr))$stop="
no products in stock"; else { $stop=""; $pw_prod[]=array("id"=>$r['ecmproduct_id'],"quantity"=>$r['product_prod_quantity'],"price"=>$r['product_price'],"guid"=>$r['product_guid']); } $t.=$trs.$tds.$r['product_code'].$tde.$tds.$r['product_name'].$stop.$tde.$tds.$op->getStock($r['ecmproduct_id'],$rdoc['pw_stock_id']).$tde.$tds.$r['product_prod_quantity'].$tde.$tds.$r['product_price'].$tde.$tre; } $t.=$tbe; //generate inputs //rw $t.=''; if(count($rw_prod)>0){ foreach($rw_prod as $rp){ $t.=''; $t.=''; $t.=''; $t.=''; } } //pw $t.=''; if(count($pw_prod)>0){ foreach($pw_prod as $pp){ $t.=''; $t.=''; $t.=''; $t.=''; } } function check0stocks($d){ if(count($d)>0){ foreach($d as $dd){ if ($dd['category_id']='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1') continue; if($dd['quantity']==0 || $dd['quantity']=="")return false; } } return true; } if(check0stocks($rw_prod) && check0stocks($pw_prod) && count($stop_arr)==0)$t.='
'; else $t.="
Check stocks or please fill production quantities in Inside Order"; $t.='
'; echo $t; ?>